Migrations are not at the mandated internal/db/migrations/ path or filenames #96
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
From the audit against the canonical
REPO_POLICIES.md, verified againstmainat61f42e6.The policy requires:
> Database migrations live in
internal/db/migrations/...000_migration.sql— contains ONLY the creation of the migrations tracking table itself. Nothing else.001_schema.sql— the full application schema.EXISTING_REPO_CHECKLIST.mdrepeats it: "Go migrations ininternal/db/migrations/and embedded in binary".Actual layout:
internal/database/schema/000.sql— wrong directory, wrong filenameinternal/database/schema/001_initial_schema.sql— wrong directory, wrong filenameThe content is correct and needs no change:
000.sqlcontains only theschema_migrationstable creation plus its bootstrap insert, and001_initial_schema.sqlis the full application schema. Migrations are correctly embedded (//go:embed schema/*.sql,internal/database/database.go:22) — that directive and any path constants would need updating alongside the move.This is cosmetic today, but it is worth doing before 1.0 specifically because the same policy forbids editing migrations after a tagged release. Renaming files that are pinned as immutable post-1.0 is materially more awkward than doing it now, and this is the last window where it is a pure rename.
Definition of done
internal/db/migrations/000_migration.sqlandinternal/db/migrations/001_schema.sql, preserving content byte-for-byte.//go:embeddirective and any path constants updated; the package location (internal/databasevsinternal/db) resolved consistently — decide whether the whole package moves or only the migrations directory, and say which and why.TestApplyMigrations_CreatesSchemaAndTablesstill passes unmodified.schema_migrationstable tracks versions, not filenames, so verify the renamed files do not cause already-applied migrations to re-run. This is the one real risk in an otherwise mechanical change; cover it with a test that applies migrations twice.make checkgreen.Coordination
001_initial_schema.sqlis rewritten by PR #55 (it folds the eviction schema in, per that PR's round-1 review). Do this after #55 merges — attempting it now guarantees a conflict with a merge-ready PR.