migrate

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: MIT Imports: 4 Imported by: 4

README

sqlx-migrate

Build Status

Forked from joncalhoun/migrate

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Migration

type Migration struct {
	ID       string
	Name     string
	Migrate  func(tx *sqlx.Tx) error
	Rollback func(tx *sqlx.Tx) error
}

Migration is a unique ID plus a function that uses a sqlx transaction to perform a database migration step.

type SqlxMigrate

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

SqlxMigrate is a migrator that uses github.com/jmoiron/sqlx

func New

func New(db *sqlx.DB, migrations []Migration) *SqlxMigrate

New creates a SqlxMigrate instance

func (*SqlxMigrate) Migrate

func (m *SqlxMigrate) Migrate() error

Migrate will run the migrations using the provided db connection.

func (*SqlxMigrate) Rollback

func (m *SqlxMigrate) Rollback() error

Rollback will run all rollbacks using the provided db connection.

Jump to

Keyboard shortcuts

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