rake-db 2.37.13 → 2.37.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import path, { join } from "node:path";
3
3
  import { fileURLToPath, pathToFileURL } from "node:url";
4
4
  import { createDbWithAdapter } from "pqb";
5
5
  import fs, { mkdir, readFile, readdir, stat, writeFile } from "node:fs/promises";
6
- const RAKE_DB_LOCK_KEY = "8582141715823621641";
6
+ const RAKE_DB_LOCK_KEY = 8582141715823621641n;
7
7
  const getFirstWordAndRest = (input) => {
8
8
  const i = input.search(/(?=[A-Z])|[-_ ]/);
9
9
  if (i !== -1) {
@@ -65,7 +65,7 @@ const transaction = (adapter, config, fn) => {
65
65
  const searchPath = config.transactionSearchPath;
66
66
  return adapter.transaction(void 0, searchPath ? { setConfig: { search_path: typeof searchPath === "function" ? searchPath() : searchPath } } : void 0, fn);
67
67
  };
68
- const queryLock = (trx) => trx.query(`SELECT pg_advisory_xact_lock('${RAKE_DB_LOCK_KEY}')`);
68
+ const queryLock = (trx, key = RAKE_DB_LOCK_KEY) => trx.query(`SELECT pg_advisory_xact_lock('${key}')`);
69
69
  const getCliParam = (args, name) => {
70
70
  if (args) {
71
71
  const key = "--" + name;
@@ -3459,7 +3459,7 @@ const migrateOrRollback = async (trx, config, set, versions, count, up, redo, fo
3459
3459
  set.migrations.reverse();
3460
3460
  }
3461
3461
  }
3462
- if (!skipLock) await queryLock(trx);
3462
+ if (!skipLock) await queryLock(trx, config.migrationLockKey);
3463
3463
  let db;
3464
3464
  const beforeMigrate = config[up ? "beforeMigrate" : "beforeRollback"];
3465
3465
  if (beforeMigrate || config.beforeChange) {