Documentation ¶
Index ¶
- type Config
- type Migration
- type Migrations
- type Migrator
- func (m *Migrator) DryRun(ctx context.Context, filenames []string, chCurrentFile chan string) error
- func (m *Migrator) Last(ctx context.Context, num int) ([]PgMigration, error)
- func (m *Migrator) Plan(ctx context.Context) ([]string, error)
- func (m *Migrator) Redo(ctx context.Context, chCurrentFile chan string) (*PgMigration, error)
- func (m *Migrator) Run(ctx context.Context, filenames []string, chCurrentFile chan string) error
- func (m *Migrator) Skip(ctx context.Context, filenames []string, chCurrentFile chan string) error
- func (m *Migrator) Verify(ctx context.Context) ([]PgMigration, error)
- type PgMigration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
func NewDefaultConfig ¶ added in v0.2.0
func NewDefaultConfig() Config
type Migration ¶
func NewMigration ¶
func (*Migration) ToDB ¶
func (m *Migration) ToDB() *PgMigration
type Migrations ¶
type Migrations []Migration
func (Migrations) FirstNonTransactional ¶
func (mm Migrations) FirstNonTransactional() (*Migration, bool)
func (Migrations) ToDB ¶
func (mm Migrations) ToDB() []PgMigration
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
func NewMigrator ¶
func (*Migrator) DryRun ¶
DryRun tries to apply migrations. Runs migrations inside single transaction and always rolls back it returns err, if apply done with error or if non-transactional migration was found
func (*Migrator) Plan ¶
Plan reads filenames from migrator root dir, fetch completed filenames from db, compare its and returns .
type PgMigration ¶
type PgMigration struct { ID int `pg:"id,pk"` Filename string `pg:"filename,use_zero"` StartedAt time.Time `pg:"startedAt,use_zero"` FinishedAt *time.Time `pg:"finishedAt"` Transactional bool `pg:"transactional,use_zero"` Md5sum string `pg:"md5sum,use_zero"` Md5sumLocal string `pg:"-"` // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.