Skip to content

Releases: icbd/gorm-migration

Update ChangeFuncWrap with Transaction

29 Oct 15:24
Compare
Choose a tag to compare
v0.0.3

feat: Update ChangeFuncWrap with Transaction

Publish MigrationManger

29 Oct 02:01
Compare
Choose a tag to compare
v0.0.2

feat: Publish MigrationManger

check migrate and rollback

28 Oct 02:51
Compare
Choose a tag to compare

Migrate

It will perform all the tasks that haven't been run yet.

db := newMemoryDB()
mm := NewMigrationManger(db, Migrate)
mm.RegisterFunctions(
    mm.createUsersTable,
    mm.addAvatarToUsers,
    mm.addEmailIndexToUsers)
mm.Migrate()

Rollback

It will roll it back step by step.

# ...
mm.Type = Rollback
mm.Migrate()

Check

# ...
mm.Type = Check
mm.Migrate()