check / check (push) Successful in 3m13s
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
16 lines
256 B
Go
16 lines
256 B
Go
// 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
|
|
}
|