19 lines
822 B
Go
19 lines
822 B
Go
// Package migrations holds the schema migrations: one Go file per
|
|
// migration, named <YYYYMMDDHHMMSS>_<snake_name>.go, each registering
|
|
// itself into Migrations via init(). `make migrate-new` scaffolds the next
|
|
// one with a fresh timestamp.
|
|
//
|
|
// Prefer model-driven DDL (db.NewCreateTable().Model((*pkg.Thing)(nil))) —
|
|
// bun emits dialect-correct SQL for both sqlite and postgres, so migrations
|
|
// stay portable. Reach for db.Exec with dialect-specific SQL only when a
|
|
// model can't express it.
|
|
package migrations
|
|
|
|
import "github.com/uptrace/bun/migrate"
|
|
|
|
// Migrations is the registry consumed by internal/database.NewMigrator.
|
|
// The directory option tells `migrate new` where to write (from backend/).
|
|
var Migrations = migrate.NewMigrations(
|
|
migrate.WithMigrationsDirectory("internal/database/migrations"),
|
|
)
|