We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 9c9fb18 + 222c67f commit 1da7886Copy full SHA for 1da7886
migrations.go
@@ -391,7 +391,10 @@ func lockTable(tx *pg.Tx) error {
391
if err != nil {
392
return err
393
}
394
- _, err = tx.Exec("LOCK ? ", pg.Ident(migrationTableName))
+ // https://www.postgresql.org/docs/current/explicit-locking.html
395
+ // This mode protects a table against concurrent data changes, and is self-exclusive so that only one session can hold it at a time.
396
+ // This means only one migration can run at a time, but pg_dump can still COPY from the table (since it acquires a ACCESS SHARE lock, or so I am told)
397
+ _, err = tx.Exec("LOCK ? in SHARE ROW EXCLUSIVE MODE", pg.Ident(migrationTableName))
398
399
400
0 commit comments