Documentation ¶
Index ¶
- type GolangMigrator
- func (gm *GolangMigrator) Hash() (string, error)
- func (gm *GolangMigrator) Migrate(_ context.Context, _ *sql.DB, templateConfig pgtestdb.Config) error
- func (*GolangMigrator) Prepare(_ context.Context, _ *sql.DB, _ pgtestdb.Config) error
- func (*GolangMigrator) Verify(_ context.Context, _ *sql.DB, _ pgtestdb.Config) error
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GolangMigrator ¶
GolangMigrator is a pgtestdb.Migrator that uses golang-migrate to perform migrations.
Because Hash() requires calculating a unique hash based on the contents of the migrations, database, this implementation only supports reading migration files from disk or an embedded filesystem.
GolangMigrator does not perform any Verify() or Prepare() logic.
func New ¶
func New(migrationsDir string, opts ...Option) *GolangMigrator
New returns a GolangMigrator, which is a pgtestdb.Migrator that uses golang-migrate to perform migrations.
`migrationsDir` is the path to the directory containing migration files.
You can configure the behavior of dbmate by passing Options:
- WithFS allows you to use an embedded filesystem.
func (*GolangMigrator) Hash ¶
func (gm *GolangMigrator) Hash() (string, error)
func (*GolangMigrator) Migrate ¶
func (gm *GolangMigrator) Migrate( _ context.Context, _ *sql.DB, templateConfig pgtestdb.Config, ) error
Migrate runs migrate.Up() to migrate the template database.
type Option ¶
type Option func(*GolangMigrator)
Option provides a way to configure the GolangMigrator struct and its behavior.
golang-migrate documentation: https://github.com/golang-migrate/migrate
See: