Versions in this module Expand all Collapse all v0 v0.0.3 Sep 18, 2023 v0.0.2 Sep 18, 2023 Changes in this version + const Version + var ErrCantConnect = errors.New("unable to connect to database") + var ErrCreateDirectory = errors.New("unable to create directory") + var ErrInvalidURL = errors.New(...) + var ErrMigrationAlreadyExist = errors.New("file already exists") + var ErrMigrationDirNotFound = errors.New("could not find migrations directory") + var ErrMigrationNotFound = errors.New("can't find migration file") + var ErrNoMigrationFiles = errors.New("no migration files found") + var ErrNoMigrationName = errors.New("please specify a name for the new migration") + var ErrNoRollback = errors.New("can't rollback: no migrations have been applied") + var ErrParseMissingDown = errors.New("dbmate requires each migration to define a down block with '-- migrate:down'") + var ErrParseMissingUp = errors.New("dbmate requires each migration to define an up block with '-- migrate:up'") + var ErrParseUnexpectedStmt = errors.New("dbmate does not support statements preceding the '-- migrate:up' block") + var ErrParseWrongOrder = errors.New("dbmate requires '-- migrate:up' to appear before '-- migrate:down'") + var ErrUnsupportedDriver = errors.New("unsupported driver") + func RegisterDriver(f DriverFunc, scheme string) + type DB struct + AutoDumpSchema bool + DatabaseURL *url.URL + FS fs.FS + Log io.Writer + MigrationsDir []string + MigrationsTableName string + SchemaFile string + Verbose bool + WaitBefore bool + WaitInterval time.Duration + WaitTimeout time.Duration + func New(databaseURL *url.URL) *DB + func (db *DB) Create() error + func (db *DB) CreateAndMigrate() error + func (db *DB) Driver() (Driver, error) + func (db *DB) Drop() error + func (db *DB) DumpSchema() error + func (db *DB) FindMigrations() ([]Migration, error) + func (db *DB) Migrate() error + func (db *DB) NewMigration(name string) error + func (db *DB) Rollback() error + func (db *DB) Status(quiet bool) (int, error) + func (db *DB) Wait() error + type Driver interface + CreateDatabase func() error + CreateMigrationsTable func(*sql.DB) error + DatabaseExists func() (bool, error) + DeleteMigration func(dbutil.Transaction, string) error + DropDatabase func() error + DumpSchema func(*sql.DB) ([]byte, error) + InsertMigration func(dbutil.Transaction, string) error + MigrationsTableExists func(*sql.DB) (bool, error) + Open func() (*sql.DB, error) + Ping func() error + SelectMigrations func(*sql.DB, int) (map[string]bool, error) + type DriverConfig struct + DatabaseURL *url.URL + Log io.Writer + MigrationsTableName string + type DriverFunc func(DriverConfig) Driver + type Migration struct + Applied bool + FS fs.FS + FileName string + FilePath string + Version string + func (m *Migration) Parse() (*ParsedMigration, error) + type ParsedMigration struct + Down string + DownOptions ParsedMigrationOptions + Up string + UpOptions ParsedMigrationOptions + type ParsedMigrationOptions interface + Transaction func() bool + type StatusResult struct + Applied bool + Filename string