mirror of
https://github.com/go-shiori/shiori.git
synced 2025-01-16 12:57:58 +08:00
81d52a2e24
- Moved migrations from code to SQL files - Using golang-migrate/v4 - Added a new CLI command: migrate
21 lines
381 B
Go
21 lines
381 B
Go
package cmd
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func migrateCmd() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "migrate",
|
|
Short: "Migrates the database to the latest version",
|
|
Run: migrateHandler,
|
|
}
|
|
|
|
return cmd
|
|
}
|
|
|
|
func migrateHandler(cmd *cobra.Command, args []string) {
|
|
if err := db.Migrate(); err != nil {
|
|
cError.Printf("Error during migration: %s", err)
|
|
}
|
|
}
|