Versions in this module Expand all Collapse all v1 v1.1.11 Jan 16, 2023 v1.1.10 Jan 16, 2023 v1.0.9 Jan 16, 2023 v1.0.8 Jan 16, 2023 v1.0.7 Jan 16, 2023 v1.0.6 Jan 16, 2023 v1.0.5 Jan 16, 2023 v1.0.4 Jan 16, 2023 v1.0.3 Jan 16, 2023 v1.0.2 Jan 16, 2023 v1.0.1 Jan 16, 2023 v1.0.0 Jan 16, 2023 Changes in this version + func Exec(ctx context.Context, db *bun.DB, f io.Reader, isTx bool) error + type GoMigrationOption func(cfg *goMigrationConfig) + 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) 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