package database import ( "context" "fmt" "strings" "github.com/jackc/pgx/v5/pgxpool" ) // Migrate applies the idempotent local MVP schema. Production migration tooling // can execute the same reviewed SQL from migrations/. func Migrate(ctx context.Context, pool *pgxpool.Pool, migration string) error { for statement := range strings.SplitSeq(migration, "-- statement-break") { if strings.TrimSpace(statement) == "" { continue } if _, err := pool.Exec(ctx, statement); err != nil { return fmt.Errorf("applying migration: %w", err) } } return nil }