migrate

package module
v0.0.0-...-3ae9ae9 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2016 License: BSD-3-Clause Imports: 3 Imported by: 0

README

go-ozzo-migrate

Db migration tool based on ozzo-dbx

Not ready for production

How to use

	e := NewExecutor(db)

	e.NewMigration("item_test").
		UpSql("CREATE TABLE item_ (id INT, name VARCHAR(10))").
		DownSql("DROP TABLE item");

	e.NewMigration("category_test").
		UpSql("CREATE TABLE category (id INT, name VARCHAR(10))").
		DownSql("DROP TABLE category");

    // Apply migrations
	err := e.Up()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor struct {
	TableName string
	LogFunc   dbx.LogFunc
	// contains filtered or unexported fields
}

func NewExecutor

func NewExecutor(db *dbx.DB) *Executor

func (*Executor) Add

func (*Executor) NewMigration

func (m *Executor) NewMigration(name string) *Migration

Creates new Description and adds it to migrations

func (*Executor) Up

func (m *Executor) Up() error

type Migration

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

func (*Migration) Down

func (d *Migration) Down() *dbx.Query

func (*Migration) DownQuery

func (d *Migration) DownQuery(query *dbx.Query) *Migration

func (*Migration) DownSql

func (d *Migration) DownSql(sql string) *Migration

func (*Migration) Name

func (d *Migration) Name() string

func (*Migration) Up

func (d *Migration) Up() *dbx.Query

func (*Migration) UpQuery

func (d *Migration) UpQuery(query *dbx.Query) *Migration

func (*Migration) UpSql

func (d *Migration) UpSql(sql string) *Migration

type MigrationDescriptor

type MigrationDescriptor interface {
	Name() string
	Up() *dbx.Query
	Down() *dbx.Query
}

MigrationDescriptor interface

Jump to

Keyboard shortcuts

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