Skip to content

Commit

Permalink
downmigrate changes + UTs + cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
venkat-iblox committed Sep 23, 2024
1 parent 98be678 commit 8ab5a72
Show file tree
Hide file tree
Showing 7 changed files with 1,878 additions and 1,574 deletions.
58 changes: 29 additions & 29 deletions cmd/migrate/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,40 @@ package main
import "github.com/spf13/pflag"

const (
// configuration defaults support local development (i.e. "go run ...")
defaultDatabaseDSN = ""
defaultDatabaseDriver = "postgres"
defaultDatabaseAddress = "0.0.0.0:5432"
defaultDatabaseName = ""
defaultDatabaseUser = "postgres"
defaultDatabasePassword = "postgres"
defaultDatabaseSSL = "disable"
defaultConfigDirectory = "/cli/config"
// configuration defaults support local development (i.e. "go run ...")
defaultDatabaseDSN = ""

Check failure on line 7 in cmd/migrate/config.go

View workflow job for this annotation

GitHub Actions / lint

const `defaultDatabaseDSN` is unused (unused)
defaultDatabaseDriver = "postgres"

Check failure on line 8 in cmd/migrate/config.go

View workflow job for this annotation

GitHub Actions / lint

const `defaultDatabaseDriver` is unused (unused)
defaultDatabaseAddress = "0.0.0.0:5432"

Check failure on line 9 in cmd/migrate/config.go

View workflow job for this annotation

GitHub Actions / lint

const `defaultDatabaseAddress` is unused (unused)
defaultDatabaseName = ""

Check failure on line 10 in cmd/migrate/config.go

View workflow job for this annotation

GitHub Actions / lint

const `defaultDatabaseName` is unused (unused)
defaultDatabaseUser = "postgres"

Check failure on line 11 in cmd/migrate/config.go

View workflow job for this annotation

GitHub Actions / lint

const `defaultDatabaseUser` is unused (unused)
defaultDatabasePassword = "postgres"

Check failure on line 12 in cmd/migrate/config.go

View workflow job for this annotation

GitHub Actions / lint

const `defaultDatabasePassword` is unused (unused)
defaultDatabaseSSL = "disable"

Check failure on line 13 in cmd/migrate/config.go

View workflow job for this annotation

GitHub Actions / lint

const `defaultDatabaseSSL` is unused (unused)
defaultConfigDirectory = "/cli/config"

Check failure on line 14 in cmd/migrate/config.go

View workflow job for this annotation

GitHub Actions / lint

const `defaultConfigDirectory` is unused (unused)
)

var (
// define flag overrides
flagHelp = pflag.Bool("help", false, "Print usage")
flagVersion = pflag.String("version", Version, "Print version")
flagLoggingVerbose = pflag.Bool("verbose", true, "Print verbose logging")
flagPrefetch = pflag.Uint("prefetch", 10, "Number of migrations to load in advance before executing")
flaglockTimeout = pflag.Uint("lock-timeout", 15, "Allow N seconds to acquire database lock")
// define flag overrides
flagHelp = pflag.Bool("help", false, "Print usage")
flagVersion = pflag.String("version", Version, "Print version")
flagLoggingVerbose = pflag.Bool("verbose", true, "Print verbose logging")
flagPrefetch = pflag.Uint("prefetch", 10, "Number of migrations to load in advance before executing")
flaglockTimeout = pflag.Uint("lock-timeout", 15, "Allow N seconds to acquire database lock")

flagDatabaseDSN = pflag.String("database.dsn", defaultDatabaseDSN, "database connection string")
flagDatabaseDriver = pflag.String("database.driver", defaultDatabaseDriver, "database driver")
flagDatabaseAddress = pflag.String("database.address", defaultDatabaseAddress, "address of the database")
flagDatabaseName = pflag.String("database.name", defaultDatabaseName, "name of the database")
flagDatabaseUser = pflag.String("database.user", defaultDatabaseUser, "database username")
flagDatabasePassword = pflag.String("database.password", defaultDatabasePassword, "database password")
flagDatabaseSSL = pflag.String("database.ssl", defaultDatabaseSSL, "database ssl mode")
flagDatabaseDSN = pflag.String("database.dsn", defaultDatabaseDSN, "database connection string")
flagDatabaseDriver = pflag.String("database.driver", defaultDatabaseDriver, "database driver")
flagDatabaseAddress = pflag.String("database.address", defaultDatabaseAddress, "address of the database")
flagDatabaseName = pflag.String("database.name", defaultDatabaseName, "name of the database")
flagDatabaseUser = pflag.String("database.user", defaultDatabaseUser, "database username")
flagDatabasePassword = pflag.String("database.password", defaultDatabasePassword, "database password")
flagDatabaseSSL = pflag.String("database.ssl", defaultDatabaseSSL, "database ssl mode")

flagSource = pflag.String("source", "", "Location of the migrations (driver://url)")
flagPath = pflag.String("path", "", "Shorthand for -source=file://path")
flagSource = pflag.String("source", "", "Location of the migrations (driver://url)")
flagPath = pflag.String("path", "", "Shorthand for -source=file://path")

flagConfigDirectory = pflag.String("config.source", defaultConfigDirectory, "directory of the configuration file")
flagConfigFile = pflag.String("config.file", "", "configuration file name without extension")
flagConfigDirectory = pflag.String("config.source", defaultConfigDirectory, "directory of the configuration file")
flagConfigFile = pflag.String("config.file", "", "configuration file name without extension")

// goto command flags
flagDirty = pflag.Bool("dirty", false, "migration is dirty")
flagPVCPath = pflag.String("intermediate-path", "", "path to the mounted volume which is used to copy the migration files")
// goto command flags
flagDirty = pflag.Bool("dirty", false, "migration is dirty")
flagPVCPath = pflag.String("intermediate-path", "", "path to the mounted volume which is used to copy the migration files")
)
Loading

0 comments on commit 8ab5a72

Please sign in to comment.