From d2186ed58d907a81648aa62ffa17ec20fb2d213e Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sun, 18 Aug 2024 14:51:00 -0400 Subject: GH-4: Add configurable migrations table name (#6) * Add configurable migrations table name * Update codecov to be informational * Add mockdb and couple of extra tests * remove extra files * Add list query error test * Add readme update for custom migration table --- internal/configloader/configloader.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'internal/configloader/configloader.go') diff --git a/internal/configloader/configloader.go b/internal/configloader/configloader.go index c13977a..0f724a6 100644 --- a/internal/configloader/configloader.go +++ b/internal/configloader/configloader.go @@ -54,12 +54,13 @@ type MigrationsConfig struct { } type ConnectionConfig struct { - Host string `toml:"host" envconfig:"BOLT_DB_HOST"` - Port string `toml:"port" envconfig:"BOLT_DB_PORT"` - User string `toml:"user" envconfig:"BOLT_DB_USER"` - Password string `toml:"password" envconfig:"BOLT_DB_PASSWORD"` - DBName string `toml:"dbname" envconfig:"BOLT_DB_NAME"` - Driver string `toml:"driver" envconfig:"BOLT_DB_DRIVER"` + Host string `toml:"host" envconfig:"BOLT_DB_HOST"` + Port string `toml:"port" envconfig:"BOLT_DB_PORT"` + User string `toml:"user" envconfig:"BOLT_DB_USER"` + Password string `toml:"password" envconfig:"BOLT_DB_PASSWORD"` + DBName string `toml:"dbname" envconfig:"BOLT_DB_NAME"` + Driver string `toml:"driver" envconfig:"BOLT_DB_DRIVER"` + MigrationsTable string `toml:"migrations_table" envconfig:"BOLT_DB_MIGRATIONS_TABLE"` } func NewConfig() (*Config, error) { @@ -73,6 +74,9 @@ func NewConfig() (*Config, error) { DirectoryPath: "migrations", VersionStyle: VersionStyleTimestamp, }, + Connection: ConnectionConfig{ + MigrationsTable: "bolt_migrations", + }, } if !errors.Is(err, ErrConfigFileNotFound) { _, err = toml.DecodeFile(filePath, &cfg) -- cgit v1.2.3