Documentation
¶
Index ¶
Constants ¶
View Source
const ( POSTGRES driver = "postgres" // connection instance must have `multiStatements` set to true MYSQL driver = "mysql" MSSQLSERVER driver = "sqlserver" SQLITE3 driver = "sqlite3" )
Variables ¶
View Source
var ( ErrDatabaseConnectionNull = errors.New("database connection is null") ErrUnsupportedDatabaseDriver = errors.New("unsupported database driver") ErrRunnerNotInitialized = errors.New("runner not initialized") ErrLocationCannotBeEmpty = errors.New("migration location cannot be empty") )
Functions ¶
func CalculateChecksum ¶
CalculateChecksum generate file checksum, it is used to check script integrity
func Migrate ¶
func Migrate(c GoFlywayConfig) (int, error)
Migrate apply migrations to database and returns the total of executed migrations
Types ¶
type ErrMigration ¶
type ErrMigration struct {
// contains filtered or unexported fields
}
func (*ErrMigration) Error ¶
func (e *ErrMigration) Error() string
type GoFlywayConfig ¶
type GoFlywayConfig struct { // Name of the schema history table that will be used by GoFlyway. Defaul is "goflyway_schema_history" Table string // File name prefix for SQL migrations. Default is "V" SqlMigrationPrefix string // File name separator for SQL migrations. Default is "__" SqlMigrationSeparator string // Location of migrations scripts. Examle: "/home/user/my-project/migrations" Location string // Whether to allow migrations to be run out of order. Default is "false" OutOfOrder bool // Ignore missing migrations. Default is "false" IgnoreMissingMigrations bool // Database connection Db *sql.DB // Database drive Driver driver // Shows warning logs. Default is "false" ShowWarningLog bool // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.