Documentation
¶
Index ¶
- Constants
- func Create(c *Config) error
- func CreateMigration(c *Config, name string, noTransaction bool) error
- func Drop(c *Config) error
- func Dump(c *Config) error
- func Initialize(c *Config) error
- func Load(c *Config) error
- func LoadConfig(config *Config, ctx argumentContext) error
- func Migrate(c *Config) error
- func Rollback(c *Config) error
- func SQLConnectionString(c *Config) string
- func Version(c *Config) (int64, error)
- type Config
- type DumpConfig
- type Migration
Constants ¶
const ( DOWN = iota UP )
Migration directions
const ( MIGRATION = "migration" ROLLBACK = "rollback" )
Migration directions used for error message building
Variables ¶
This section is empty.
Functions ¶
func CreateMigration ¶
CreateMigration generates new, empty migration files.
func Initialize ¶
Initialize creates the schema_migrations table if necessary.
func LoadConfig ¶
LoadConfig reads the config file, applies CLI arguments as overrides, and returns an error if the configuration is invalid.
func SQLConnectionString ¶ added in v1.0.1
SQLConnectionString formats the values pulled from the config into a connection string
Types ¶
type Config ¶
type Config struct {
// connection
Username string
Password string
Database string
Host string
Port int
URL string
SslMode string
// dump
DumpConfig DumpConfig `json:"dump-options"`
// filepaths
MigrationFolder string `json:"migration-folder"`
// options
MigrationTable string `json:"migration-table"`
MigrationDriver string `json:"migration-driver"`
ColumnType string `json:"column-type"`
Format string
// deprecated -- see dump_config.go
DumpFile string `json:"dump-file"`
SeedTables []string `json:"seed-tables"`
}
Config stores the options used by pgmgr.
type DumpConfig ¶ added in v1.1.0
type DumpConfig struct {
// exclusions
ExcludeSchemas []string `json:"exclude-schemas"`
// inclusions
IncludeTables []string `json:"seed-tables"`
IncludePrivileges bool `json:"include-privileges"`
IncludeTriggers bool `json:"include-triggers"`
// options
NoCompress bool `json:"no-compress"`
DumpFile string `json:"dump-file"`
}
DumpConfig stores the options used by pgmgr's dump tool and defers connection-type options to the main config file
func (DumpConfig) GetDumpFile ¶ added in v1.1.0
func (config DumpConfig) GetDumpFile() string
GetDumpFile returns the true dump file name with or without the specified compression suffix
func (DumpConfig) GetDumpFileRaw ¶ added in v1.1.0
func (config DumpConfig) GetDumpFileRaw() string
GetDumpFileRaw returns the literal dump file name as configured
func (DumpConfig) IsCompressed ¶ added in v1.1.1
func (config DumpConfig) IsCompressed() bool
IsCompressed returns whether compression is set