mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-02 17:58:11 -06:00
Add rollback command
This commit is contained in:
parent
0784aa3218
commit
64b2135685
3 changed files with 68 additions and 0 deletions
12
cmd/gotosocial/action/debug/rollback/rollback.go
Normal file
12
cmd/gotosocial/action/debug/rollback/rollback.go
Normal 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)
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue