Documentation
¶
Overview ¶
Package tern runs jackc/tern migrations for testdb through tern's Go library, so no tern binary or tern.conf is needed.
pool := postgres.Setup(t, testdb.WithMigrator(tern.Dir("./migrations")))
A Migrator's Migrate method is also a template setup function:
tpl, err := postgres.EnsureTemplate(ctx, "schema", tern.Dir("./migrations").Migrate)
Index ¶
Constants ¶
View Source
const DefaultVersionTable = "schema_version"
DefaultVersionTable is where tern records the applied version, matching the tern CLI's default.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator applies tern migrations to a PostgreSQL database. Create one with Dir or FS.
type Option ¶
type Option func(*Migrator)
Option configures a Migrator.
func WithDisableTx ¶
func WithDisableTx() Option
WithDisableTx runs migrations outside a transaction, for statements that cannot run inside one (CREATE INDEX CONCURRENTLY, for example).
func WithVersionTable ¶
WithVersionTable sets the table tern records the schema version in. Default: DefaultVersionTable.
Click to show internal directories.
Click to hide internal directories.