migrate

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoChanges = fmt.Errorf("no changes")
)

Functions

func CreateFromModel added in v0.18.0

func CreateFromModel(m models.Model) (*schema.CreateTableBuilder, error)

func RunModelCreate added in v0.21.0

func RunModelCreate(ctx context.Context, db builder.QueryExecer, models ...models.Model) error

func SrcFile

func SrcFile(migrationName, packageName string, up, down ToGoer) (string, error)

Types

type DBMigration added in v0.18.0

type DBMigration struct {
	models.BaseModel
	Name string `db:"name,primary"`
	Run  bool   `db:"run"`
	// contains filtered or unexported fields
}

func (*DBMigration) Table added in v0.18.0

func (m *DBMigration) Table() string

type Migration

type Migration struct {
	Name string
	Up   schema.Runner
	Down schema.Runner
}

type Migrations

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

func New

func New() *Migrations

func (*Migrations) Add

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

func (*Migrations) Blueprint

func (m *Migrations) Blueprint(tableName string) *schema.Blueprint

func (*Migrations) GenerateMigration

func (m *Migrations) GenerateMigration(migrationName, packageName string, model models.Model) (string, error)

func (*Migrations) Up

type ToGoer

type ToGoer interface {
	ToGo() string
}

Jump to

Keyboard shortcuts

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