rake-db 2.37.11 → 2.37.13
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.js +21 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3559,16 +3559,32 @@ const checkMigrationOrder = (config, set, { sequence, map }, force) => {
|
|
|
3559
3559
|
return version;
|
|
3560
3560
|
}
|
|
3561
3561
|
};
|
|
3562
|
-
|
|
3562
|
+
/**
|
|
3563
|
+
* Cache of migration changes, keyed by the loaded migration module.
|
|
3564
|
+
* Different migration sets with the same keys load different modules, so they don't share changes.
|
|
3565
|
+
*
|
|
3566
|
+
* A migration file registers its changes by calling `change` at the top level, which runs only on the first import:
|
|
3567
|
+
* subsequent imports return the already evaluated module and register nothing.
|
|
3568
|
+
* The cache allows running the same migration again, for example, when migrating several databases.
|
|
3569
|
+
*/
|
|
3570
|
+
const changesByModule = /* @__PURE__ */ new WeakMap();
|
|
3571
|
+
/**
|
|
3572
|
+
* Cache of migration changes, keyed by the migration path, for loaders that don't return a module, such as file loaders.
|
|
3573
|
+
*/
|
|
3574
|
+
const changesByPath = /* @__PURE__ */ new Map();
|
|
3563
3575
|
const getChanges = async (file, config) => {
|
|
3564
3576
|
clearChanges();
|
|
3565
|
-
|
|
3577
|
+
const module = await file.load();
|
|
3578
|
+
const isModule = typeof module === "object" && module !== null;
|
|
3579
|
+
let changes;
|
|
3580
|
+
if (isModule) changes = changesByModule.get(module);
|
|
3581
|
+
else if (file.path) changes = changesByPath.get(file.path);
|
|
3566
3582
|
if (!changes) {
|
|
3567
|
-
const module = await file.load();
|
|
3568
3583
|
const exported = module?.default && (0, pqb_internal.toArray)(module.default);
|
|
3569
3584
|
if (config?.forceDefaultExports && !exported) throw new RakeDbError(`Missing a default export in ${file.path} migration`);
|
|
3570
3585
|
changes = exported || getCurrentChanges();
|
|
3571
|
-
if (
|
|
3586
|
+
if (isModule) changesByModule.set(module, changes);
|
|
3587
|
+
else if (file.path) changesByPath.set(file.path, changes);
|
|
3572
3588
|
}
|
|
3573
3589
|
return changes;
|
|
3574
3590
|
};
|
|
@@ -5165,6 +5181,7 @@ const defaultPrivilegesSql = `SELECT COALESCE(json_agg(t.*), '[]') FROM (
|
|
|
5165
5181
|
array_agg(ae.is_grantable) "isGrantables"
|
|
5166
5182
|
FROM pg_default_acl d
|
|
5167
5183
|
JOIN LATERAL aclexplode(d.defaclacl) ae ON true
|
|
5184
|
+
WHERE d.defaclnamespace <> 0 OR ae.grantee <> d.defaclrole
|
|
5168
5185
|
GROUP BY "grantor", "grantee", "schema", "object"
|
|
5169
5186
|
) t`;
|
|
5170
5187
|
const grantsSql = `SELECT COALESCE(json_agg(t.* ORDER BY t."target", t."schema", t."name", t."grantee", t."grantor"), '[]') FROM (
|