12345678910111213141516171819202122232425262728293031323334353637383940 |
- package main
- import (
- "code.osinet.fr/fgm/kurz/infrastructure"
- "os"
- _ "code.osinet.fr/fgm/kurz/migrations"
- "github.com/pressly/goose"
- "github.com/spf13/cobra"
- )
- var cmdMigrateStatus = &cobra.Command{
- Args: cobra.NoArgs,
- Long: "Dump the Kurz migration status table. Kurz version of 'goose status'",
- Run: migrateStatusHandler,
- Short: "Migration status",
- Use: "status",
- }
- func init() {
- cmdMigrate.AddCommand(cmdMigrateStatus)
- }
- // migrateStatusHandler implements the "kurzd migrate status" command.
- func migrateStatusHandler(_ *cobra.Command, args []string) {
- dbDriver, dbDsn := infrastructure.ParseDbCred()
- db, err := infrastructure.DbDial(dbDriver, dbDsn)
- if err != nil {
- panic(err)
- }
- defer db.Close()
- cwd, err := os.Getwd()
- if err != nil {
- panic(err)
- }
- goose.SetDialect(dbDriver)
- goose.Status(db, cwd)
- }
|