drizzle-kit 0.20.10-b4cd19e → 0.20.10
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/bin.cjs +5 -4
- package/package.json +1 -1
- package/utils.js +5 -4
package/bin.cjs
CHANGED
@@ -12323,7 +12323,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
12323
12323
|
name,
|
12324
12324
|
tableFrom,
|
12325
12325
|
tableTo,
|
12326
|
-
schemaTo,
|
12326
|
+
schemaTo: schemaTo ?? "public",
|
12327
12327
|
columnsFrom,
|
12328
12328
|
columnsTo,
|
12329
12329
|
onDelete,
|
@@ -16186,7 +16186,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
16186
16186
|
const fromColumnsString = columnsFrom.map((it) => `"${it}"`).join(",");
|
16187
16187
|
const toColumnsString = columnsTo.map((it) => `"${it}"`).join(",");
|
16188
16188
|
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${tableFrom}"` : `"${tableFrom}"`;
|
16189
|
-
const tableToNameWithSchema =
|
16189
|
+
const tableToNameWithSchema = schemaTo ? `"${schemaTo}"."${tableTo}"` : `"${tableTo}"`;
|
16190
16190
|
const alterStatement = `ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${name}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement}`;
|
16191
16191
|
let sql2 = "DO $$ BEGIN\n";
|
16192
16192
|
sql2 += " " + alterStatement + ";\n";
|
@@ -16245,8 +16245,9 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
16245
16245
|
const onUpdateStatement = newFk.onUpdate ? ` ON UPDATE ${newFk.onUpdate}` : "";
|
16246
16246
|
const fromColumnsString = newFk.columnsFrom.map((it) => `"${it}"`).join(",");
|
16247
16247
|
const toColumnsString = newFk.columnsTo.map((it) => `"${it}"`).join(",");
|
16248
|
-
const tableFromNameWithSchema =
|
16249
|
-
const
|
16248
|
+
const tableFromNameWithSchema = oldFk.schemaTo ? `"${oldFk.schemaTo}"."${oldFk.tableFrom}"` : `"${oldFk.tableFrom}"`;
|
16249
|
+
const tableToNameWithSchema = newFk.schemaTo ? `"${newFk.schemaTo}"."${newFk.tableFrom}"` : `"${newFk.tableFrom}"`;
|
16250
|
+
const alterStatement = `ALTER TABLE ${tableFromNameWithSchema} ADD CONSTRAINT "${newFk.name}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement}`;
|
16250
16251
|
sql2 += "DO $$ BEGIN\n";
|
16251
16252
|
sql2 += " " + alterStatement + ";\n";
|
16252
16253
|
sql2 += "EXCEPTION\n";
|
package/package.json
CHANGED
package/utils.js
CHANGED
@@ -12048,7 +12048,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
12048
12048
|
name,
|
12049
12049
|
tableFrom,
|
12050
12050
|
tableTo,
|
12051
|
-
schemaTo,
|
12051
|
+
schemaTo: schemaTo ?? "public",
|
12052
12052
|
columnsFrom,
|
12053
12053
|
columnsTo,
|
12054
12054
|
onDelete,
|
@@ -15903,7 +15903,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
15903
15903
|
const fromColumnsString = columnsFrom.map((it) => `"${it}"`).join(",");
|
15904
15904
|
const toColumnsString = columnsTo.map((it) => `"${it}"`).join(",");
|
15905
15905
|
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${tableFrom}"` : `"${tableFrom}"`;
|
15906
|
-
const tableToNameWithSchema =
|
15906
|
+
const tableToNameWithSchema = schemaTo ? `"${schemaTo}"."${tableTo}"` : `"${tableTo}"`;
|
15907
15907
|
const alterStatement = `ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${name}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement}`;
|
15908
15908
|
let sql2 = "DO $$ BEGIN\n";
|
15909
15909
|
sql2 += " " + alterStatement + ";\n";
|
@@ -15962,8 +15962,9 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
15962
15962
|
const onUpdateStatement = newFk.onUpdate ? ` ON UPDATE ${newFk.onUpdate}` : "";
|
15963
15963
|
const fromColumnsString = newFk.columnsFrom.map((it) => `"${it}"`).join(",");
|
15964
15964
|
const toColumnsString = newFk.columnsTo.map((it) => `"${it}"`).join(",");
|
15965
|
-
const tableFromNameWithSchema =
|
15966
|
-
const
|
15965
|
+
const tableFromNameWithSchema = oldFk.schemaTo ? `"${oldFk.schemaTo}"."${oldFk.tableFrom}"` : `"${oldFk.tableFrom}"`;
|
15966
|
+
const tableToNameWithSchema = newFk.schemaTo ? `"${newFk.schemaTo}"."${newFk.tableFrom}"` : `"${newFk.tableFrom}"`;
|
15967
|
+
const alterStatement = `ALTER TABLE ${tableFromNameWithSchema} ADD CONSTRAINT "${newFk.name}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement}`;
|
15967
15968
|
sql2 += "DO $$ BEGIN\n";
|
15968
15969
|
sql2 += " " + alterStatement + ";\n";
|
15969
15970
|
sql2 += "EXCEPTION\n";
|