Versions in this module Expand all Collapse all v1 v1.0.1 Sep 25, 2023 Changes in this version + var ErrNoSuccessfulBaseline = errors.New("no baseline migration was found, consider migrating") v1.0.0 Jan 17, 2023 Changes in this version + var ErrHasFailedMigrations = errors.New("found failed migrations, consider fixing your db") + var ErrHasForthcomingMigrations = errors.New("found not completed forthcoming migrations, consider migrating") + var ErrTargetVersionNotLatest = errors.New("target version falls behind migrations, consider raising target version") + type ManagerOption func(*MigrationManager) + func WithLogFlags(flags int) ManagerOption + func WithLogWriter(w io.Writer) ManagerOption + type Migration struct + func NewBaselineMigration(migrator Migrator) *Migration + func NewRepeatableMigration(migrator RepeatableMigrator, opts ...RepeatableMigratorOption) *Migration + func NewVersionedMigration(migrator VersionedMigrator) *Migration + type MigrationManager struct + func NewMigrationsManager(db *gorm.DB, targetVersion string, opts ...ManagerOption) (*MigrationManager, error) + func (m *MigrationManager) CheckFulfillment() (reasonErr error, ok bool, err error) + func (m *MigrationManager) Downgrade() (err error) + func (m *MigrationManager) HasFailedMigrations() (bool, error) + func (m *MigrationManager) HasForthcomingMigrations() (bool, error) + func (m *MigrationManager) Migrate() error + func (m *MigrationManager) RegisterMigration(migration *Migration, opts ...MigrationOption) + func (m *MigrationManager) TargetVersionNotLatest() (bool, error) + type MigrationOption func(*Migration) + func WithTransaction(useTransaction bool) MigrationOption + type MigrationType string + const TypeBaseline + const TypeRepeatable + const TypeVersioned + type Migrator interface + Description func() string + Migrate func(db *gorm.DB) error + Version func() Version + type RepeatableMigrator interface + Checksum func() string + type RepeatableMigratorOption func(*Migration) + func WithRepeatUnconditional() RepeatableMigratorOption + type Version struct + Major int + Minor int + Patch int + PreRelease int + func (v Version) Equals(version Version) bool + func (v Version) LessOrEqual(version Version) bool + func (v Version) LessThan(version Version) bool + func (v Version) MoreOrEqual(version Version) bool + func (v Version) MoreThan(version Version) bool + func (v Version) String() string + type VersionedMigrator interface + Downgrade func(db *gorm.DB) error