diff --git a/pkg/migration/migration.go b/pkg/migration/migration.go index 55881189f..9b04be248 100644 --- a/pkg/migration/migration.go +++ b/pkg/migration/migration.go @@ -62,6 +62,7 @@ func Migrate(x *xorm.Engine) { if err != nil { log.Log.Fatalf("Migration failed: %v", err) } + log.Log.Info("Ran all migrations successfully.") } func ListMigrations() { @@ -78,7 +79,6 @@ func ListMigrations() { table := tablewriter.NewWriter(os.Stdout) table.SetHeader([]string{"ID", "Description"}) table.SetAlignment(tablewriter.ALIGN_LEFT) - table.SetHeaderColor(tablewriter.Colors{tablewriter.Bold, tablewriter.BgGreenColor}, tablewriter.Colors{tablewriter.Bold, tablewriter.BgGreenColor}) @@ -88,8 +88,13 @@ func ListMigrations() { table.Render() } -func Rollback(until string) { - +func Rollback(migrationID string) { + m := initMigration(nil) + err := m.RollbackTo(migrationID) + if err != nil { + log.Log.Fatalf("Could not rollback: %v", err) + } + log.Log.Info("Rolled back successfully.") } // Deletes a column from a table. All arguments are strings, to let them be standalone and not depending on any struct.