migrate

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: BSD-2-Clause Imports: 15 Imported by: 164

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Name string
}

type Migration

type Migration struct {
	bun.BaseModel `bun:"alias:m"`

	ID         int64
	Name       string
	GroupID    int64
	MigratedAt time.Time `bun:",notnull,default:current_timestamp"`

	Up   MigrationFunc `bun:"-"`
	Down MigrationFunc `bun:"-"`
}

type MigrationFunc

type MigrationFunc func(ctx context.Context, db *bun.DB) error

func NewSQLMigrationFunc

func NewSQLMigrationFunc(fsys fs.FS, name string) MigrationFunc

type Migrations

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

func NewMigrations

func NewMigrations(opts ...MigrationsOption) *Migrations

func (*Migrations) CreateGo

func (m *Migrations) CreateGo(ctx context.Context, db *bun.DB, name string) error

func (*Migrations) CreateSQL

func (m *Migrations) CreateSQL(ctx context.Context, db *bun.DB, name string) error

func (*Migrations) Discover

func (m *Migrations) Discover(fsys fs.FS) error

func (*Migrations) DiscoverCaller

func (m *Migrations) DiscoverCaller() error

func (*Migrations) Init

func (m *Migrations) Init(ctx context.Context, db *bun.DB) error

func (*Migrations) Lock

func (m *Migrations) Lock(ctx context.Context, db *bun.DB) error

func (*Migrations) MarkCompleted added in v0.1.8

func (m *Migrations) MarkCompleted(ctx context.Context, db *bun.DB) error

func (*Migrations) Migrate

func (m *Migrations) Migrate(ctx context.Context, db *bun.DB) error

func (*Migrations) Migrations

func (m *Migrations) Migrations() []Migration

func (*Migrations) MustRegister

func (m *Migrations) MustRegister(up, down MigrationFunc)

func (*Migrations) Register

func (m *Migrations) Register(up, down MigrationFunc) error

func (*Migrations) Rollback

func (m *Migrations) Rollback(ctx context.Context, db *bun.DB) error

func (*Migrations) Status added in v0.1.8

func (m *Migrations) Status(ctx context.Context, db *bun.DB) error

func (*Migrations) Unlock

func (m *Migrations) Unlock(ctx context.Context, db *bun.DB) error

type MigrationsOption

type MigrationsOption func(m *Migrations)

func WithLocksTableName

func WithLocksTableName(table string) MigrationsOption

func WithTableName

func WithTableName(table string) MigrationsOption

Jump to

Keyboard shortcuts

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