Documentation
¶
Index ¶
- Variables
- func CreateMigration(db *sql.DB, dir, name, migrationType string) error
- func Down(db *sql.DB, dir, dialect string) error
- func DownTo(db *sql.DB, dir, dialect string, version int64) error
- func ExecMultiple(tx *gorm.DB, sqls string) error
- func GetStatus(db *sql.DB, dir, dialect string) error
- func GetVersion(db *sql.DB) (int64, error)
- func Redo(db *sql.DB, dir, dialect string) error
- func Reset(db *sql.DB, dir, dialect string) error
- func Run(db *gorm.DB, migrations []*gormigrate.Migration)
- func RunGoose(db *sql.DB, cfg *GooseConfig) error
- func UpByOne(db *sql.DB, dir, dialect string) error
- func UpTo(db *sql.DB, dir, dialect string, version int64) error
- type GooseConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultMigrationOptions = &gormigrate.Options{ TableName: "migrations", IDColumnName: "id", IDColumnSize: 255, UseTransaction: true, }
DefaultMigrationOptions contains default options for the gormigrate package
Functions ¶
func CreateMigration ¶
CreateMigration creates a new migration file
func ExecMultiple ¶
ExecMultiple executes multiple SQL sentences
func GetVersion ¶
GetVersion returns the current database version
func Run ¶
func Run(db *gorm.DB, migrations []*gormigrate.Migration)
Run executes the migrations given
func RunGoose ¶
func RunGoose(db *sql.DB, cfg *GooseConfig) error
RunGoose initializes and runs goose migrations
Types ¶
type GooseConfig ¶
type GooseConfig struct {
Dir string // Directory containing migration files
TableName string // Migration table name (default: goose_db_version)
Dialect string // Database dialect: mysql, postgres, sqlite3
Verbose bool // Enable verbose logging
AllowMissing bool // Allow missing (out-of-order) migrations
}
GooseConfig contains configuration for goose migrations
func DefaultGooseConfig ¶
func DefaultGooseConfig() *GooseConfig
DefaultGooseConfig returns default configuration for goose
Click to show internal directories.
Click to hide internal directories.