Move migrations to internal/db/migrations (closes #96)
check / check (push) Successful in 14s
check / check (push) Successful in 14s
REPO_POLICIES.md puts migrations in internal/db/migrations/ as 000_migration.sql and 001_schema.sql. The two files move there with their contents unchanged. go:embed cannot reach outside its own package, so internal/db/migrations has a small package that embeds them, and internal/database reads them through its FS(). The database package stays where CONVENTIONS.md puts it; moving it would change existing test files in other packages. The version still comes from the filename prefix, so a database that has recorded versions 0 and 1 runs neither again. A new test applies the migrations twice to one database file and checks that the second run applies nothing. Model: opus-5-5
This commit was merged in pull request #155.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
// Package migrations provides the embedded SQL migration files.
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
)
|
||||
|
||||
//go:embed *.sql
|
||||
var files embed.FS
|
||||
|
||||
// FS returns the embedded filesystem containing the migration files.
|
||||
func FS() fs.FS {
|
||||
return files
|
||||
}
|
||||
Reference in New Issue
Block a user