Documentation ¶
Index ¶
Constants ¶
const ( // MigrationTypeUp represents "up" migrations MigrationTypeUp = "up" // MigrationTypeDown represents "down" migrations MigrationTypeDown = "down" // MigrationTypeAlways represents "always" migrations MigrationTypeAlways = "always" )
const AlwaysSuffix = ".always.sql"
AlwaysSuffix is the suffix for always migrations
const DownSuffix = ".down.sql"
DownSuffix is the suffix for down migrations
const UpSuffix = ".up.sql"
UpSuffix is the suffix for up migrations
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByVersion ¶
type ByVersion []MigrationFile
ByVersion is a type used for sorting files by version in ascending order
type Configuration ¶
Configuration is a holder for various configuration data
func NewConfiguration ¶
func NewConfiguration(engine, connectionFile string) Configuration
NewConfiguration builds a default configuration
func NewConfigurationFromFile ¶
func NewConfigurationFromFile(name string) (Configuration, error)
NewConfigurationFromFile parses a Toml file to build a Configuration
func (Configuration) ConnectionString ¶
func (c Configuration) ConnectionString() (string, error)
type MigrationFile ¶
type MigrationFile struct { Dirname string Filename string Version string Description string Type MigrationType }
MigrationFile represents the parsed data from an indiviual migration file
func GatherFiles ¶
func GatherFiles(dirs []string, suffixes []string) ([]MigrationFile, error)
GatherFiles files in the directories supplied and returns an array of MigrationFile values if the files match any of the suffixes provided
func (MigrationFile) Contents ¶
func (f MigrationFile) Contents() (string, error)
Contents reads then entire contents of the MigrationFile
type MigrationType ¶
type MigrationType string
MigrationType is used to contain types of migrations (up, down, always, invalid)
type Steps ¶
type Steps struct {
// contains filtered or unexported fields
}
Steps helps output nice messages
func (Steps) Done ¶
func (s Steps) Done()
Done outputs the end of an entry in the table with a status of DONE
func (Steps) Error ¶
func (s Steps) Error()
Error outputs the end of an entry in the table with a status of ERROR
func (Steps) Fail ¶
func (s Steps) Fail()
Fail outputs the end of an entry in the table with a status of FAIL