Versions in this module Expand all Collapse all v1 v1.0.2 Oct 24, 2024 Changes in this version + func Exec(ctx context.Context, db *bun.DB, f io.Reader, isTx bool) error + type GoMigrationOption func(cfg *goMigrationConfig) + func WithGoTemplate(template string) GoMigrationOption + func WithPackageName(name string) GoMigrationOption + type Migration struct + Comment string + Down MigrationFunc + GroupID int64 + ID int64 + MigratedAt time.Time + Name string + Up MigrationFunc + func (m Migration) IsApplied() bool + func (m Migration) String() string + type MigrationFile struct + Content string + Name string + Path string + type MigrationFunc func(ctx context.Context, db *bun.DB) error + func NewSQLMigrationFunc(fsys fs.FS, name string) MigrationFunc + type MigrationGroup struct + ID int64 + Migrations MigrationSlice + func (g MigrationGroup) IsZero() bool + func (g MigrationGroup) String() string + type MigrationOption func(cfg *migrationConfig) + func WithNopMigration() MigrationOption + type MigrationSlice []Migration + func (ms MigrationSlice) Applied() MigrationSlice + func (ms MigrationSlice) LastGroup() *MigrationGroup + func (ms MigrationSlice) LastGroupID() int64 + func (ms MigrationSlice) String() string + func (ms MigrationSlice) Unapplied() MigrationSlice + type Migrations struct + func NewMigrations(opts ...MigrationsOption) *Migrations + func (m *Migrations) Add(migration Migration) + func (m *Migrations) Discover(fsys fs.FS) error + func (m *Migrations) DiscoverCaller() error + func (m *Migrations) MustRegister(up, down MigrationFunc) + func (m *Migrations) Register(up, down MigrationFunc) error + func (m *Migrations) Sorted() MigrationSlice + type MigrationsOption func(m *Migrations) + func WithMigrationsDirectory(directory string) MigrationsOption + type Migrator struct + func NewMigrator(db *bun.DB, migrations *Migrations, opts ...MigratorOption) *Migrator + func (m *Migrator) AppliedMigrations(ctx context.Context) (MigrationSlice, error) + func (m *Migrator) CreateGoMigration(ctx context.Context, name string, opts ...GoMigrationOption) (*MigrationFile, error) + func (m *Migrator) CreateSQLMigrations(ctx context.Context, name string) ([]*MigrationFile, error) + func (m *Migrator) CreateTxSQLMigrations(ctx context.Context, name string) ([]*MigrationFile, error) + func (m *Migrator) DB() *bun.DB + func (m *Migrator) Init(ctx context.Context) error + func (m *Migrator) Lock(ctx context.Context) error + func (m *Migrator) MarkApplied(ctx context.Context, migration *Migration) error + func (m *Migrator) MarkUnapplied(ctx context.Context, migration *Migration) error + func (m *Migrator) Migrate(ctx context.Context, opts ...MigrationOption) (*MigrationGroup, error) + func (m *Migrator) MigrationsWithStatus(ctx context.Context) (MigrationSlice, error) + func (m *Migrator) MissingMigrations(ctx context.Context) (MigrationSlice, error) + func (m *Migrator) Reset(ctx context.Context) error + func (m *Migrator) Rollback(ctx context.Context, opts ...MigrationOption) (*MigrationGroup, error) + func (m *Migrator) TruncateTable(ctx context.Context) error + func (m *Migrator) Unlock(ctx context.Context) error + type MigratorOption func(m *Migrator) + func WithLocksTableName(table string) MigratorOption + func WithMarkAppliedOnSuccess(enabled bool) MigratorOption + func WithTableName(table string) MigratorOption