Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMigrationFailed = errors.New("migration failed") ErrNoChange = errors.New("no migration needed") )
View Source
var Module = fx.Module("migrations", fx.Provide(func(pool *pgxpool.Pool, logger *slog.Logger, source MigrationSource) *Migrator { return NewMigrator(pool, logger, source.FS, source.Dir) }), fx.Invoke(runMigrationsIfEnabled), )
Module provides migration functionality to the fx application. Requires MigrationSource to be provided by the main application.
Functions ¶
Types ¶
type MigrationSource ¶
MigrationSource holds the embedded filesystem and directory for migrations.
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator handles database migrations.
func NewMigrator ¶
func NewMigrator(pool *pgxpool.Pool, logger *slog.Logger, sourceFS fs.FS, sourceDir string) *Migrator
NewMigrator creates a new Migrator instance.
Click to show internal directories.
Click to hide internal directories.