Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Migrate ¶
Migrate applies all pending migrations to db. It is idempotent: already-applied migrations are skipped.
Concurrent callers — parallel test packages sharing one database, or several nodes starting at once — are serialized with a lease row in lockTable: goose's Up is not concurrency-safe, so two concurrent runs can both see a migration as pending and race its DDL (plain CREATE TABLE, no IF NOT EXISTS) or the goose_db_version bookkeeping insert. Waiters poll the lease with read-only queries only; on the emulator a read-write transaction in flight would make the holder's DDL fail.
The holder renews the lease while goose runs, so schema changes that outlive leaseSeconds keep their lease, and goose executes under a fencing context: the moment holdership can no longer be proven — another holder took the row, or renewal failed for a full lease window — the context is canceled and the fenced holder stops instead of racing its successor.
Types ¶
This section is empty.