migrator

package
v1.2.17 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 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() MigrationType
}

type MigrationType added in v0.9.5

type MigrationType int

MigrationType is migration type

const (
	// MigrationTypeClient is client migration type
	MigrationTypeClient MigrationType = iota + 1
	// MigrationTypeServer is server migration type
	MigrationTypeServer
)

type Migrator

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

Migrator struct to manage migrations of Testkube API and CRDs

func NewMigrator

func NewMigrator() *Migrator

NewMigrator returns new Migrator instance

func (*Migrator) Add

func (m *Migrator) Add(migration Migration)

Add adds new migration

func (Migrator) ExecuteCommands

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

ExecuteCommands executes multiple commands returns multiple commands outputs

func (*Migrator) GetValidMigrations

func (m *Migrator) GetValidMigrations(currentVersion string, migrationTypes ...MigrationType) (migrations []Migration)

GetValidMigrations returns valid migration list for currentVersion

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, migrationTypes ...MigrationType) error

Run runs migrations of passed migration types

Jump to

Keyboard shortcuts

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