Lock implements the Locker interface to obtain a global lock before the migrations are run.
(ctx context.Context, tx Queryer, tableName string)
| 20 | // Lock implements the Locker interface to obtain a global lock before the |
| 21 | // migrations are run. |
| 22 | func (p postgresDialect) Lock(ctx context.Context, tx Queryer, tableName string) error { |
| 23 | lockID := p.advisoryLockID(tableName) |
| 24 | query := fmt.Sprintf("SELECT pg_advisory_lock(%s)", lockID) |
| 25 | _, err := tx.ExecContext(ctx, query) |
| 26 | return err |
| 27 | } |
| 28 | |
| 29 | // Unlock implements the Locker interface to release the global lock after the |
| 30 | // migrations are run. |
nothing calls this directly
no test coverage detected