Documentation
¶
Index ¶
- func RegisterBackend(name string, b DBBackend)
- type DBBackend
- type Manager
- func (mgr *Manager) Close() error
- func (mgr *Manager) CommitAll() error
- func (mgr *Manager) Down() error
- func (mgr *Manager) Force(version int) error
- func (mgr *Manager) SafeForce(target int) error
- func (mgr *Manager) Status() (uint, int, error)
- func (mgr *Manager) Steps(n int) error
- func (mgr *Manager) Up() error
- func (mgr *Manager) Version() (uint, bool, error)
- func (mgr *Manager) VersionCommitted(v uint) (bool, error)
- type PostgresBackend
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterBackend ¶
RegisterBackend registers a backend implementation by name.
Types ¶
type DBBackend ¶
type DBBackend interface {
DriverName() string
NewDriver(db *sql.DB) (database.Driver, error)
Validator() validate.Dialect
}
DBBackend abstracts database specific logic for migrations.
func GetBackend ¶
GetBackend returns the backend registered for driver name.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager wraps golang-migrate with retries, logging, notifications, and resource handling.
func NewManager ¶
func NewManager(backend DBBackend, dsn, migrationsDir string, retries int, logger *logrus.Entry, actor string, strict bool, confirmFn validate.ConfirmFunc, note notifier.Notifier) (*Manager, error)
NewManager creates a Manager. It limits DB pool to 1 connection to ensure advisory locks (used internally by the Postgres driver) apply correctly.
func (*Manager) SafeForce ¶
SafeForce only allows forcing down by one if dirty, and never up beyond last file.
type PostgresBackend ¶
type PostgresBackend struct{}
PostgresBackend implements DBBackend for PostgreSQL databases.
func (PostgresBackend) DriverName ¶
func (PostgresBackend) DriverName() string
func (PostgresBackend) Validator ¶
func (PostgresBackend) Validator() validate.Dialect
Click to show internal directories.
Click to hide internal directories.