migrator

package
v1.1.11 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, pluginCreator func() DBMigratorPlugin)

Register register DBMigratorPlugin with adapter name

Types

type DBMigratorPlugin

type DBMigratorPlugin interface {
	Init([]sqlparser.Query)
	CompareSchema(*sql.DB, []string) ([]string, error)
}

DBMigratorPlugin interface for migration

type Migrator

type Migrator struct {
	DryRun bool
	Quiet  bool
	Plugin DBMigratorPlugin
}

Migrator migrates database schema

func NewMigrator

func NewMigrator(adapter string, dryRun bool, isQuiet bool) (*Migrator, error)

NewMigrator creates instance of Migrator

func (*Migrator) Migrate

func (m *Migrator) Migrate(schemaPath string) error

Migrate executes migrate

type MySQLMigrator

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

MySQLMigrator implements DBMigratorPlugin

func (*MySQLMigrator) CompareSchema

func (m *MySQLMigrator) CompareSchema(conn *sql.DB, allDDL []string) ([]string, error)

CompareSchema compare schema on mysql server with local schema

func (*MySQLMigrator) Init

func (m *MySQLMigrator) Init(queries []sqlparser.Query)

Init create mapping from table name to sqlparser.Query

Jump to

Keyboard shortcuts

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