renommage lassistanoque
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"trankilou.fr/lassistanoque/backend/internal/adapter/database"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(
|
||||
newLigrateCmd(),
|
||||
)
|
||||
}
|
||||
|
||||
// newVersionCmd creates the version command for displaying version information.
|
||||
func newLigrateCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "migrate",
|
||||
Short: "migrate database",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
db, err := database.GetDatabase()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer db.Close()
|
||||
|
||||
err = db.Migrate()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
},
|
||||
}
|
||||
return cmd
|
||||
}
|
||||
Reference in New Issue
Block a user