Documentation
¶
Index ¶
- func AcquireLock(ctx context.Context, conn *pgx.Conn) error
- func AppliedSteps(ctx context.Context, conn *pgx.Conn, planName string) (map[int]bool, error)
- func EnsureTable(ctx context.Context, conn *pgx.Conn) error
- func InsertRecord(ctx context.Context, conn *pgx.Conn, rec *Record) error
- func LatestHash(ctx context.Context, conn *pgx.Conn) (string, error)
- func ReleaseLock(ctx context.Context, conn *pgx.Conn) error
- type Record
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcquireLock ¶
AcquireLock attempts to acquire a PostgreSQL advisory lock. This prevents concurrent migrations on the same database. Returns an error if the lock is already held.
func AppliedSteps ¶
AppliedSteps returns all applied step indexes for a given plan name.
func EnsureTable ¶
EnsureTable creates the _scheme_state table if it doesn't exist.
func InsertRecord ¶
InsertRecord inserts a migration step record into the state table.
func LatestHash ¶
LatestHash returns the schema hash from the most recent successful migration. Returns empty string if no migrations have been applied.
Types ¶
Click to show internal directories.
Click to hide internal directories.