Add rollback command

This commit is contained in:
dysphoricUnicorn 2024-12-28 22:24:08 +01:00
commit 64b2135685
3 changed files with 68 additions and 0 deletions

View file

@ -0,0 +1,12 @@
package rollback
import (
"context"
"github.com/superseriousbusiness/gotosocial/cmd/gotosocial/action"
"github.com/superseriousbusiness/gotosocial/internal/db/bundb"
)
var Rollback action.GTSAction = func(ctx context.Context) (err error) {
return bundb.DoRollback(ctx)
}

View file

@ -20,6 +20,7 @@ package main
import (
"github.com/spf13/cobra"
configaction "github.com/superseriousbusiness/gotosocial/cmd/gotosocial/action/debug/config"
rollbackaction "github.com/superseriousbusiness/gotosocial/cmd/gotosocial/action/debug/rollback"
"github.com/superseriousbusiness/gotosocial/internal/config"
)
@ -41,5 +42,17 @@ func debugCommands() *cobra.Command {
}
config.AddServerFlags(debugConfigCmd)
debugCmd.AddCommand(debugConfigCmd)
debugRollbackCmd := &cobra.Command{
Use: "rollback",
Short: "roll back the last run database migration",
RunE: func(cmd *cobra.Command, args []string) error {
return run(cmd.Context(), rollbackaction.Rollback)
},
}
config.AddServerFlags(debugRollbackCmd)
debugCmd.AddCommand(debugRollbackCmd)
return debugCmd
}