migration

package
v0.0.0-...-98c8ee3 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlterTableAddColumn

type AlterTableAddColumn struct {
	Name     string
	Type     string
	Default  string
	Nullable bool
}

func (AlterTableAddColumn) AlterTableSQL

func (o AlterTableAddColumn) AlterTableSQL(ato *AlterTableOperation) string

func (AlterTableAddColumn) Dump

func (o AlterTableAddColumn) Dump(buf *bytes.Buffer)

type AlterTableCreateForeignKey

type AlterTableCreateForeignKey struct {
	Name           string
	Columns        []string
	ForeignTable   string
	ForeignColumns []string
}

func (AlterTableCreateForeignKey) AlterTableSQL

func (AlterTableCreateForeignKey) Dump

type AlterTableCreatePrimaryKey

type AlterTableCreatePrimaryKey struct {
	Columns []string
}

func (AlterTableCreatePrimaryKey) AlterTableSQL

func (AlterTableCreatePrimaryKey) Dump

type AlterTableCreateUnique

type AlterTableCreateUnique struct {
	Name    string
	Columns []string
}

func (AlterTableCreateUnique) AlterTableSQL

func (o AlterTableCreateUnique) AlterTableSQL(ato *AlterTableOperation) string

func (AlterTableCreateUnique) Dump

func (o AlterTableCreateUnique) Dump(buf *bytes.Buffer)

type AlterTableDropColumn

type AlterTableDropColumn struct {
	Name string
}

func (AlterTableDropColumn) AlterTableSQL

func (o AlterTableDropColumn) AlterTableSQL(ato *AlterTableOperation) string

func (AlterTableDropColumn) Dump

func (o AlterTableDropColumn) Dump(buf *bytes.Buffer)

type AlterTableDropDefault

type AlterTableDropDefault struct {
	Name string
}

func (AlterTableDropDefault) AlterTableSQL

func (o AlterTableDropDefault) AlterTableSQL(ato *AlterTableOperation) string

func (AlterTableDropDefault) Dump

func (o AlterTableDropDefault) Dump(buf *bytes.Buffer)

type AlterTableDropForeignKey

type AlterTableDropForeignKey struct {
	Name string
}

func (AlterTableDropForeignKey) AlterTableSQL

func (o AlterTableDropForeignKey) AlterTableSQL(ato *AlterTableOperation) string

func (AlterTableDropForeignKey) Dump

func (o AlterTableDropForeignKey) Dump(buf *bytes.Buffer)

type AlterTableDropPrimaryKey

type AlterTableDropPrimaryKey struct {
}

func (AlterTableDropPrimaryKey) AlterTableSQL

func (o AlterTableDropPrimaryKey) AlterTableSQL(ato *AlterTableOperation) string

func (AlterTableDropPrimaryKey) Dump

func (o AlterTableDropPrimaryKey) Dump(buf *bytes.Buffer)

type AlterTableDropUnique

type AlterTableDropUnique struct {
	Name string
}

func (AlterTableDropUnique) AlterTableSQL

func (o AlterTableDropUnique) AlterTableSQL(ato *AlterTableOperation) string

func (AlterTableDropUnique) Dump

func (o AlterTableDropUnique) Dump(buf *bytes.Buffer)

type AlterTableOperation

type AlterTableOperation struct {
	Name string
	Ops  []AlterTableSuboperation
}

func (AlterTableOperation) Dump

func (o AlterTableOperation) Dump(buf *bytes.Buffer)

func (AlterTableOperation) Run

type AlterTableSetDefault

type AlterTableSetDefault struct {
	Name    string
	Default string
}

func (AlterTableSetDefault) AlterTableSQL

func (o AlterTableSetDefault) AlterTableSQL(ato *AlterTableOperation) string

func (AlterTableSetDefault) Dump

func (o AlterTableSetDefault) Dump(buf *bytes.Buffer)

type AlterTableSetNotNull

type AlterTableSetNotNull struct {
	Name string
}

func (AlterTableSetNotNull) AlterTableSQL

func (o AlterTableSetNotNull) AlterTableSQL(ato *AlterTableOperation) string

func (AlterTableSetNotNull) Dump

func (o AlterTableSetNotNull) Dump(buf *bytes.Buffer)

type AlterTableSetNull

type AlterTableSetNull struct {
	Name string
}

func (AlterTableSetNull) AlterTableSQL

func (o AlterTableSetNull) AlterTableSQL(ato *AlterTableOperation) string

func (AlterTableSetNull) Dump

func (o AlterTableSetNull) Dump(buf *bytes.Buffer)

type AlterTableSetType

type AlterTableSetType struct {
	Name string
	Type string
}

func (AlterTableSetType) AlterTableSQL

func (o AlterTableSetType) AlterTableSQL(ato *AlterTableOperation) string

func (AlterTableSetType) Dump

func (o AlterTableSetType) Dump(buf *bytes.Buffer)

type AlterTableSuboperation

type AlterTableSuboperation interface {
	AlterTableSQL(ato *AlterTableOperation) string
	Dump(buf *bytes.Buffer)
}

type Column

type Column struct {
	Name     string
	Type     string
	Default  string
	Nullable bool
}

func (Column) Dump

func (o Column) Dump(buf *bytes.Buffer)

type CreateIndexOperation

type CreateIndexOperation struct {
	Name      string
	IndexName string
	Columns   []string
}

func (CreateIndexOperation) Dump

func (o CreateIndexOperation) Dump(buf *bytes.Buffer)

func (CreateIndexOperation) Run

type CreateTableOperation

type CreateTableOperation struct {
	Name    string
	Columns []Column
}

func (CreateTableOperation) Dump

func (o CreateTableOperation) Dump(buf *bytes.Buffer)

func (CreateTableOperation) Run

type DropIndexOperation

type DropIndexOperation struct {
	Name      string
	IndexName string
}

func (DropIndexOperation) Dump

func (o DropIndexOperation) Dump(buf *bytes.Buffer)

func (DropIndexOperation) Run

type DropTableOperation

type DropTableOperation struct {
	Name string
}

func (DropTableOperation) Dump

func (o DropTableOperation) Dump(buf *bytes.Buffer)

func (DropTableOperation) Run

type Operation

type Operation interface {
	Run(ctx context.Context) error
	Dump(buf *bytes.Buffer)
}

type OperationList

type OperationList []Operation

func (OperationList) Dump

func (o OperationList) Dump(buf *bytes.Buffer)

type RenameColumnOperation

type RenameColumnOperation struct {
	Name          string
	OldColumnName string
	NewColumnName string
}

func (RenameColumnOperation) Dump

func (o RenameColumnOperation) Dump(buf *bytes.Buffer)

func (RenameColumnOperation) Run

type RenameTableOperation

type RenameTableOperation struct {
	OldName string
	NewName string
}

func (RenameTableOperation) Dump

func (o RenameTableOperation) Dump(buf *bytes.Buffer)

func (RenameTableOperation) Run

type SQLOperation

type SQLOperation struct {
	SQL string
}

func (SQLOperation) Dump

func (o SQLOperation) Dump(buf *bytes.Buffer)

func (SQLOperation) Run

func (o SQLOperation) Run(ctx context.Context) error

type Store

type Store struct {
	Migrations map[int64]OperationList
}

func (*Store) Register

func (m *Store) Register(index int64, ops OperationList)

func (*Store) Run

func (m *Store) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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