rake-db 2.25.8 → 2.25.9
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 +7 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -2477,6 +2477,7 @@ const changeEnumValues = async (migration, enumName, fromValues, toValues) => {
|
|
|
2477
2477
|
const recreateEnum = async (migration, { schema, name }, values, errorMessage) => {
|
|
2478
2478
|
const defaultSchema = migration.adapter.schema;
|
|
2479
2479
|
const quotedName = quoteTable(schema, name);
|
|
2480
|
+
const relKinds = ["r", "m"];
|
|
2480
2481
|
const { rows: tables } = await migration.adapter.query(
|
|
2481
2482
|
`SELECT n.nspname AS "schema",
|
|
2482
2483
|
c.relname AS "table",
|
|
@@ -2488,6 +2489,7 @@ JOIN pg_type t ON a.atttypid = t.oid AND t.typname = ${singleQuote(name)}
|
|
|
2488
2489
|
JOIN pg_namespace tn ON tn.oid = t.typnamespace AND tn.nspname = ${singleQuote(
|
|
2489
2490
|
schema ?? defaultSchema
|
|
2490
2491
|
)}
|
|
2492
|
+
WHERE c.relkind IN (${relKinds.map((c) => `'${c}'`).join(", ")})
|
|
2491
2493
|
GROUP BY n.nspname, c.relname`
|
|
2492
2494
|
);
|
|
2493
2495
|
const sql = tables.map(
|
|
@@ -4850,14 +4852,16 @@ const astToMigration = (currentSchema, config, asts) => {
|
|
|
4850
4852
|
const item = items[i];
|
|
4851
4853
|
let satisfied = true;
|
|
4852
4854
|
for (const dep of item.deps) {
|
|
4853
|
-
if (toBeAdded.has(dep) && !added.has(dep)) {
|
|
4855
|
+
if (toBeAdded.has(dep) && !added.has(dep) && !item.add.has(dep)) {
|
|
4854
4856
|
satisfied = false;
|
|
4855
4857
|
break;
|
|
4856
4858
|
}
|
|
4857
4859
|
}
|
|
4858
4860
|
if (satisfied) {
|
|
4859
|
-
for (const
|
|
4860
|
-
|
|
4861
|
+
for (const dep of item.drop) {
|
|
4862
|
+
const selfRef = item.deps.has(dep);
|
|
4863
|
+
const depsLeft = remainingDeps.get(dep);
|
|
4864
|
+
if (depsLeft && depsLeft > (selfRef ? 1 : 0)) {
|
|
4861
4865
|
satisfied = false;
|
|
4862
4866
|
break;
|
|
4863
4867
|
}
|