Documentation
¶
Index ¶
- Variables
- func CreateTestMigrations(driver database.Driver)
- type Agent
- type DefaultCreator
- type DefaultMigrator
- type MysqlStubs
- type PostgresStubs
- type Repository
- func (r *Repository) CreateRepository() error
- func (r *Repository) Delete(migration string) error
- func (r *Repository) DeleteRepository() error
- func (r *Repository) GetLast() ([]migration.File, error)
- func (r *Repository) GetMigrations() ([]migration.File, error)
- func (r *Repository) GetMigrationsByBatch(batch int) ([]migration.File, error)
- func (r *Repository) GetMigrationsByStep(steps int) ([]migration.File, error)
- func (r *Repository) GetNextBatchNumber() (int, error)
- func (r *Repository) GetRan() ([]string, error)
- func (r *Repository) Log(file string, batch int) error
- func (r *Repository) RepositoryExists() bool
- type SqlCreator
- type SqlMigrator
- type SqliteStubs
- type SqlserverStubs
- type Stubs
- type TableGuesser
Constants ¶
This section is empty.
Variables ¶
var ChangePatterns = []string{
`_(to|from|in)_(\w+)_table$`,
`_(to|from|in)_(\w+)$`,
}
var CreatePatterns = []string{
`^create_(\w+)_table$`,
`^create_(\w+)$`,
}
Functions ¶
func CreateTestMigrations ¶
Types ¶
type DefaultCreator ¶
type DefaultCreator struct { }
func NewDefaultCreator ¶
func NewDefaultCreator() *DefaultCreator
func (*DefaultCreator) GetFileName ¶
func (r *DefaultCreator) GetFileName(name string) string
GetFileName Get the full path to the migration.
func (*DefaultCreator) GetPath ¶
func (r *DefaultCreator) GetPath(name string) string
GetPath Get the full path to the migration.
func (*DefaultCreator) GetStub ¶
func (r *DefaultCreator) GetStub(table string, create bool) string
GetStub Get the migration stub file.
func (*DefaultCreator) PopulateStub ¶
func (r *DefaultCreator) PopulateStub(stub, signature, table string) string
PopulateStub Populate the place-holders in the migration stub.
type DefaultMigrator ¶
type DefaultMigrator struct {
// contains filtered or unexported fields
}
func NewDefaultMigrator ¶
func NewDefaultMigrator(artisan console.Artisan, schema contractsschema.Schema, table string) *DefaultMigrator
func (*DefaultMigrator) Create ¶
func (r *DefaultMigrator) Create(name string) error
func (*DefaultMigrator) Fresh ¶
func (r *DefaultMigrator) Fresh() error
TODO Remove this function and move the logic to the migrate:fresh command when the sql migrator is removed.
func (*DefaultMigrator) Reset ¶
func (r *DefaultMigrator) Reset() error
func (*DefaultMigrator) Rollback ¶
func (r *DefaultMigrator) Rollback(step, batch int) error
func (*DefaultMigrator) Run ¶
func (r *DefaultMigrator) Run() error
func (*DefaultMigrator) Status ¶
func (r *DefaultMigrator) Status() ([]contractsmigration.Status, error)
type MysqlStubs ¶
type MysqlStubs struct { }
func (MysqlStubs) CreateDown ¶
func (receiver MysqlStubs) CreateDown() string
CreateDown Create down migration content.
func (MysqlStubs) CreateUp ¶
func (receiver MysqlStubs) CreateUp() string
CreateUp Create up migration content.
func (MysqlStubs) UpdateDown ¶
func (receiver MysqlStubs) UpdateDown() string
UpdateDown Update down migration content.
func (MysqlStubs) UpdateUp ¶
func (receiver MysqlStubs) UpdateUp() string
UpdateUp Update up migration content.
type PostgresStubs ¶
type PostgresStubs struct { }
func (PostgresStubs) CreateDown ¶
func (receiver PostgresStubs) CreateDown() string
CreateDown Create down migration content.
func (PostgresStubs) CreateUp ¶
func (receiver PostgresStubs) CreateUp() string
CreateUp Create up migration content.
func (PostgresStubs) UpdateDown ¶
func (receiver PostgresStubs) UpdateDown() string
UpdateDown Update down migration content.
func (PostgresStubs) UpdateUp ¶
func (receiver PostgresStubs) UpdateUp() string
UpdateUp Update up migration content.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(schema schema.Schema, table string) *Repository
func (*Repository) CreateRepository ¶
func (r *Repository) CreateRepository() error
func (*Repository) Delete ¶
func (r *Repository) Delete(migration string) error
func (*Repository) DeleteRepository ¶
func (r *Repository) DeleteRepository() error
func (*Repository) GetMigrations ¶
func (r *Repository) GetMigrations() ([]migration.File, error)
func (*Repository) GetMigrationsByBatch ¶
func (r *Repository) GetMigrationsByBatch(batch int) ([]migration.File, error)
func (*Repository) GetMigrationsByStep ¶
func (r *Repository) GetMigrationsByStep(steps int) ([]migration.File, error)
func (*Repository) GetNextBatchNumber ¶
func (r *Repository) GetNextBatchNumber() (int, error)
func (*Repository) GetRan ¶
func (r *Repository) GetRan() ([]string, error)
func (*Repository) RepositoryExists ¶
func (r *Repository) RepositoryExists() bool
type SqlCreator ¶
type SqlCreator struct {
// contains filtered or unexported fields
}
func NewSqlCreator ¶
func NewSqlCreator(driver database.Driver, charset string) *SqlCreator
func (*SqlCreator) GetPath ¶
func (r *SqlCreator) GetPath(name string, category string) string
GetPath Get the full path to the migration.
func (*SqlCreator) GetStub ¶
func (r *SqlCreator) GetStub(table string, create bool) (string, string)
GetStub Get the migration stub file.
func (*SqlCreator) PopulateStub ¶
func (r *SqlCreator) PopulateStub(stub string, table string) string
PopulateStub Populate the place-holders in the migration stub.
type SqlMigrator ¶
type SqlMigrator struct {
// contains filtered or unexported fields
}
TODO Remove in v1.16
func NewSqlMigrator ¶
func NewSqlMigrator(config config.Config) (*SqlMigrator, error)
func (*SqlMigrator) Create ¶
func (r *SqlMigrator) Create(name string) error
func (*SqlMigrator) Fresh ¶
func (r *SqlMigrator) Fresh() error
func (*SqlMigrator) Reset ¶
func (r *SqlMigrator) Reset() error
func (*SqlMigrator) Rollback ¶
func (r *SqlMigrator) Rollback(step, batch int) error
func (*SqlMigrator) Run ¶
func (r *SqlMigrator) Run() error
type SqliteStubs ¶
type SqliteStubs struct { }
func (SqliteStubs) CreateDown ¶
func (receiver SqliteStubs) CreateDown() string
CreateDown Create down migration content.
func (SqliteStubs) CreateUp ¶
func (receiver SqliteStubs) CreateUp() string
CreateUp Create up migration content.
func (SqliteStubs) UpdateDown ¶
func (receiver SqliteStubs) UpdateDown() string
UpdateDown Update down migration content.
func (SqliteStubs) UpdateUp ¶
func (receiver SqliteStubs) UpdateUp() string
UpdateUp Update up migration content.
type SqlserverStubs ¶
type SqlserverStubs struct { }
func (SqlserverStubs) CreateDown ¶
func (receiver SqlserverStubs) CreateDown() string
CreateDown Create down migration content.
func (SqlserverStubs) CreateUp ¶
func (receiver SqlserverStubs) CreateUp() string
CreateUp Create up migration content.
func (SqlserverStubs) UpdateDown ¶
func (receiver SqlserverStubs) UpdateDown() string
UpdateDown Update down migration content.
func (SqlserverStubs) UpdateUp ¶
func (receiver SqlserverStubs) UpdateUp() string
UpdateUp Update up migration content.
type TableGuesser ¶
type TableGuesser struct { }