migrator

package
v0.8.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Migration

type Migration interface {
	Migrate() error
	Version() string
	Info() string
}

type Migrator

type Migrator struct {
	Migrations []Migration
	Log        *zap.SugaredLogger
}

func NewMigrator

func NewMigrator() *Migrator

func (*Migrator) Add

func (m *Migrator) Add(migration Migration)

func (Migrator) ExecuteCommands

func (m Migrator) ExecuteCommands(commands []string) (outputs []string, err error)

func (*Migrator) GetValidMigrations

func (m *Migrator) GetValidMigrations(currentVersion string) (migrations []Migration)

func (Migrator) IsValid

func (m Migrator) IsValid(migrationVersion, currentVersion string) (bool, error)

IsValid checks if versions constraints are met, assuming that currentVersion is just updated version and it should be taken for migration

func (*Migrator) Run

func (m *Migrator) Run(currentVersion string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL