migrations

package
v0.0.0-...-c118757 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MigrationTableMigration = Migration{
	Name: "create_migration_table",
	Up:   []string{createMigrationTable},
	Down: []string{dropMigrationTable},
}

MigrationTableMigration set's up the needed migration table to track migrations This needs to be the first Migration added to your migrations list.

Functions

This section is empty.

Types

type Migration

type Migration struct {
	Name string
	Up   []string
	Down []string
	// contains filtered or unexported fields
}

Migration contains3 needed parts: Name: unique to the migration, identifies the migration in the database Up: Serie of SQL statements to run to apply the migration Down: Series of SQL statement to reverse the migration

type Migrations

type Migrations []Migration

Migrations holds the migrations in order

func GetMigrator

func GetMigrator() *Migrations

GetMigrator returns the migrator instance

func (*Migrations) Add

func (m *Migrations) Add(mig Migration) *Migrations

Add a migration to the queue

func (*Migrations) Down

func (m *Migrations) Down(db *postgres.Db) error

Down runs the 'down' migrations

func (*Migrations) Up

func (m *Migrations) Up(db *postgres.Db) error

Up runs the 'up' migrations

Jump to

Keyboard shortcuts

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