Documentation ¶
Index ¶
- Variables
- func Create(ctx context.Context, identifier string, db DBX) error
- type Action
- type DBX
- type Func
- type Migration
- func (migration *Migration) CurrentVersion(ctx context.Context, log *zap.Logger, db tagsql.DB) (int, error)
- func (migration *Migration) Run(ctx context.Context, log *zap.Logger) error
- func (migration *Migration) TargetVersion(version int) *Migration
- func (migration *Migration) ValidTableName() error
- func (migration *Migration) ValidateSteps() error
- func (migration *Migration) ValidateVersions(ctx context.Context, log *zap.Logger) error
- type SQL
- type Step
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrValidateVersionQuery is when there is an error querying version table ErrValidateVersionQuery = errs.Class("validate db version query error") // ErrValidateVersionMismatch is when the migration version does not match the current database version ErrValidateVersionMismatch = errs.Class("validate db version mismatch error") // ErrValidateMinVersion is when the migration version does not match the current database version ErrValidateMinVersion = errs.Class("validate minimum version error") )
View Source
var Error = errs.Class("migrate")
Error is the default migrate errs class
Functions ¶
Types ¶
type Action ¶
type Action interface {
Run(ctx context.Context, log *zap.Logger, db tagsql.DB, tx tagsql.Tx) error
}
Action is something that needs to be done
type Migration ¶
Migration describes a migration steps
func (*Migration) CurrentVersion ¶ added in v0.27.0
func (migration *Migration) CurrentVersion(ctx context.Context, log *zap.Logger, db tagsql.DB) (int, error)
CurrentVersion finds the latest version for the db
func (*Migration) TargetVersion ¶
TargetVersion returns migration with steps upto specified version
func (*Migration) ValidTableName ¶
ValidTableName checks whether the specified table name is valid
func (*Migration) ValidateSteps ¶
ValidateSteps checks that the version for each migration step increments in order
Click to show internal directories.
Click to hide internal directories.