migrate

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func CreateFromModel

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

func MustMigrateModel added in v0.9.1

func MustMigrateModel(db database.DB, m model.Model)

func RunModelCreate

func RunModelCreate(ctx context.Context, db database.DB, models ...model.Model) error

func SrcFile

func SrcFile(migrationName, packageName string, up, down fmt.GoStringer) (string, error)

Types

type DBMigration

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

func (*DBMigration) Table

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 model.Model) (string, error)

func (*Migrations) Up

func (m *Migrations) Up(ctx context.Context, db database.DB) error

Jump to

Keyboard shortcuts

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