1.6 KiB
1.6 KiB
Design Spec: Project Structure Cleanup and Standardization
Standardize the Go project structure, consolidate database packages, and remove redundant files to improve maintainability and idiomatic code patterns.
1. Database Package Consolidation
Current State
internal/dbcontainssqlcgenerated code in packagedatabase.internal/db/sqlite/sqlite.gois in a separate package for DB initialization.- Imports are scattered between
mal/internal/db(often aliased) andmal/internal/db/sqlite.
Changes
- Package Renaming: Change package
databasetodbin allinternal/db/*.gofiles. - sqlc configuration: Update
sqlc.yamlto usepackage: db. - Flattening: Move
internal/db/sqlite/sqlite.gotointernal/db/sqlite.go. - Import Cleanup: Update all consumers to use
mal/internal/dbdirectly.
2. Redundant File Removal
Changes
- Delete all
.gofiles intmp/scripts/(fix_json.go,fix_proxy.go,test_jikan.go, etc.). - Remove the empty directory
internal/db/sqliteafter moving the file.
3. Asset Build Optimization
Changes
- Investigate
dist/duplication. - Update
package.jsonbuild scripts if necessary to ensuredist/has a flat, clean structure matching whatNewRouterexpects.
4. Verification Plan
Automated Checks
go build ./...: Verify all Go imports and package renames.bun run typecheck: Verify TS/JS integrity.sqlc generate: Verify that regeneration doesn't break the new package naming.
Manual Checks
- Verify server starts and database migrations apply correctly.