schema

package
v0.0.0-...-fb9541f Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(db *db.Session, latest []byte) error

Init installs the latest schema into db after clearing it first

func Migrate

func Migrate(db *sql.DB, migrations migrate.MigrationSource, dir MigrateDir, count int) (int, error)

Migrate performs schema migration. Migrations can occur in one of three ways:

- up: migrations are performed from the currently installed version upwards. If count is 0, all unapplied migrations will be run.

- down: migrations are performed from the current version downard. If count is 0, all applied migrations will be run in a downard direction.

- redo: migrations are first ran downard `count` times, and then are rand upward back to the current version at the start of the process. If count is 0, a count of 1 will be assumed.

Types

type MigrateDir

type MigrateDir string

MigrateDir represents a direction in which to perform schema migrations.

const (
	// MigrateUp causes migrations to be run in the "up" direction.
	MigrateUp MigrateDir = "up"
	// MigrateDown causes migrations to be run in the "down" direction.
	MigrateDown MigrateDir = "down"
	// MigrateRedo causes migrations to be run down, then up
	MigrateRedo MigrateDir = "redo"
)

Jump to

Keyboard shortcuts

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