migrate

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MigrationSteps []MigrationStep = []MigrationStep{{
	// contains filtered or unexported fields
}, {
	// contains filtered or unexported fields
},
}

Functions

func MakeSqliteDummyDB

func MakeSqliteDummyDB() *sqlx.DB

MakeSqliteDummyDB creates a Sqlite in-memory DB and migrates it to the current schema. It is to be used for testing purposes only.

Types

type MigrationStep

type MigrationStep struct {
	// contains filtered or unexported fields
}

MigrationStep represents a single migration step for host DB

type Migrator

type Migrator struct {
	Steps     []MigrationStep       `checkinject:"required"`
	Config    *domain.RuntimeConfig `checkinject:"required"`
	DBManager interface {
		GetHandle() *domain.DB
		GetSchema() string
		SetSchema(string) error
	} `checkinject:"required"`
}

Migrator manages the migration process

func (*Migrator) LastStepName

func (m *Migrator) LastStepName() string

LastStepName returns the last (current) schema name

func (*Migrator) Migrate

func (m *Migrator) Migrate(to string) error

Migrate transforms the DB and anything else to match schema at "to" if to is "" it will migrate to the last step.

Jump to

Keyboard shortcuts

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