feat(skel): db package with embedded migrations stub

Establishes the embed.FS and migrations/ layout up front. Migrate()
returns ErrNotConfigured intentionally — the real goose runner lands in
M2 alongside Postgres work, avoiding a toolchain bump to Go 1.24/1.25
through goose's transitive modernc.org/libc dependency chain.
This commit is contained in:
2026-04-18 21:20:34 +00:00
parent 4dbf02d645
commit 58fa790b2b
+33
View File
@@ -0,0 +1,33 @@
package db
import (
"embed"
"errors"
)
//go:embed migrations/*.sql
var migrationsFS embed.FS
// MigrationsFS exposes the embedded migration files. The concrete migration
// runner (goose) will be wired in M2 when Postgres work begins; this package
// intentionally keeps the embed + a placeholder surface so the file layout
// and `go:embed` directive are established from day one.
func MigrationsFS() embed.FS {
return migrationsFS
}
// ErrNotConfigured is returned by Migrate until the real runner is wired.
var ErrNotConfigured = errors.New("db: migrations not yet configured (wired in M2)")
// Migrate is a placeholder. It validates that the embedded migrations load
// and then returns ErrNotConfigured so callers can detect the stub.
func Migrate() error {
entries, err := migrationsFS.ReadDir("migrations")
if err != nil {
return err
}
if len(entries) == 0 {
return errors.New("db: no migration files found")
}
return ErrNotConfigured
}