migrate

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2016 License: MIT Imports: 9 Imported by: 41 modules, 33 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindMigrations added in v1.2.0

func FindMigrations(path string) ([]string, error)

Types

type BadVersionError

type BadVersionError string

func (BadVersionError) Error

func (e BadVersionError) Error() string

type IrreversibleMigrationError

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

func (IrreversibleMigrationError) Error

type Migration

type Migration struct {
	Sequence int32
	Name     string
	UpSQL    string
	DownSQL  string
}

type MigrationSyntaxError added in v1.3.2

type MigrationSyntaxError struct {
	Sql string
	pgx.PgError
}

type Migrator

type Migrator struct {
	Migrations []*Migration
	OnStart    func(int32, string, string, string) // OnStart is called when a migration is run with the sequence, name, direction, and SQL
	Data       map[string]interface{}              // Data available to use in migrations
	// contains filtered or unexported fields
}

func NewMigrator

func NewMigrator(conn *pgx.Conn, versionTable string) (m *Migrator, err error)

func (*Migrator) AppendMigration

func (m *Migrator) AppendMigration(name, upSQL, downSQL string)

func (*Migrator) GetCurrentVersion

func (m *Migrator) GetCurrentVersion() (v int32, err error)

func (*Migrator) LoadMigrations

func (m *Migrator) LoadMigrations(path string) error

func (*Migrator) Migrate

func (m *Migrator) Migrate() error

Migrate runs pending migrations It calls m.OnStart when it begins a migration

func (*Migrator) MigrateTo

func (m *Migrator) MigrateTo(targetVersion int32) (err error)

MigrateTo migrates to targetVersion

type NoMigrationsFoundError

type NoMigrationsFoundError struct {
	Path string
}

func (NoMigrationsFoundError) Error

func (e NoMigrationsFoundError) Error() string

Jump to

Keyboard shortcuts

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