Packages
Search packages... ⌘K
Go Package
migrate
Database migration runner — up/down/status with versioned SQL files
Go Ready SI
Migration Execution
$ sbx migrate up --project sbx --env dev
[migrate] project: sbx, schema: sbx_dev
[migrate] 5 total, 3 applied, 2 pending
[migrate] applying 004_add_entity_references.up.sql...
[migrate] 004 applied — 12ms
[migrate] applying 005_create_activity_feed.up.sql...
[migrate] 005 applied — 8ms
[migrate] 2 migrations applied — schema up to date
About
Executes versioned SQL migration files against PostgreSQL databases. Tracks applied migrations in a history table, supports up/down operations, and provides status reporting with drift detection.
Public API
| Name | Kind | Signature |
|---|---|---|
| Migrator | type | type Migrator struct |
| NewMigrator | func | func NewMigrator(pool *database.Pool, dir string) *Migrator |
| Up | func | func (m *Migrator) Up(ctx context.Context) (*MigrateResult, error) |
| Down | func | func (m *Migrator) Down(ctx context.Context) (*MigrateResult, error) |
| Status | func | func (m *Migrator) Status(ctx context.Context) ([]MigrationStatus, error) |
Dependencies
Imports (2)
database Go Ready
PostgreSQL adapter — connection pooling, schema isolation, health checks
postgresqlpgxpoolingschema-isolation
4 exports 5 deps
external Go Ready
External process runner — exec.Command wrapper with timeout, output capture, error handling
execprocess-runnertimeoutoutput-capture
5 exports 7 deps
Related Packages
database Go Ready
PostgreSQL adapter — connection pooling, schema isolation, health checks
postgresqlpgxpoolingschema-isolation
4 exports 5 deps
external Go Ready
External process runner — exec.Command wrapper with timeout, output capture, error handling
execprocess-runnertimeoutoutput-capture
5 exports 7 deps
Source
github.com/shredbx/sbx-core/pkg/migrate
migrationssqlversionedup-down