Documentation ¶
Index ¶
Constants ¶
View Source
const NoTransactionPrefix = "-- migrate: no-transaction\n"
If your migration must run outside a transaction, the first line must match this constant. (Useful for migrations like PostgreSQL "CREATE INDEX CONCURRENTLY" statements.)
Variables ¶
View Source
var (
ErrFsNotWriteable = fmt.Errorf("Migration filesystem not writeable")
)
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface { ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) }
New() accepts a *database/sql.DB or equivalent.
type Migrator ¶
type Migrator interface { MigrateLatest(ctx context.Context) error MigrateTo(ctx context.Context, version int) error GetVersion(ctx context.Context) (int, error) HasPending(ctx context.Context) (bool, error) Create(ctx context.Context, name string) error SetTableName(name string) // If set, "table" becomes schema."table" SetTableSchema(schema string) // Set to nil to disable output. Default: os.Stdout SetOutputWriter(io.Writer) }
Click to show internal directories.
Click to hide internal directories.