drizzle-kit 0.12.4 → 0.12.5

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.
Files changed (2) hide show
  1. package/index.js +4 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -18460,8 +18460,8 @@ var PgCreateForeignKeyConvertor = class extends Convertor {
18460
18460
  }
18461
18461
  convert(statement) {
18462
18462
  const { name, tableFrom, tableTo, columnsFrom, columnsTo, onDelete, onUpdate } = PgSquasher.unsquashFK(statement.data);
18463
- const onDeleteStatement = `ON DELETE ${onDelete}` || "";
18464
- const onUpdateStatement = `ON UPDATE ${onUpdate}` || "";
18463
+ const onDeleteStatement = onDelete ? `ON DELETE ${onDelete}` : "";
18464
+ const onUpdateStatement = onUpdate ? `ON UPDATE ${onUpdate}` : "";
18465
18465
  const fromColumnsString = columnsFrom.map((it) => `"${it}"`).join(",");
18466
18466
  const toColumnsString = columnsTo.map((it) => `"${it}"`).join(",");
18467
18467
  const alterStatement = `ALTER TABLE ${tableFrom} ADD CONSTRAINT ${name} FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableTo}(${toColumnsString}) ${onDeleteStatement} ${onUpdateStatement}`.replace(/ +/g, " ").trim();
@@ -18479,8 +18479,8 @@ var MySqlCreateForeignKeyConvertor = class extends Convertor {
18479
18479
  }
18480
18480
  convert(statement) {
18481
18481
  const { name, tableFrom, tableTo, columnsFrom, columnsTo, onDelete, onUpdate } = PgSquasher.unsquashFK(statement.data);
18482
- const onDeleteStatement = `ON DELETE ${onDelete}` || "";
18483
- const onUpdateStatement = `ON UPDATE ${onUpdate}` || "";
18482
+ const onDeleteStatement = onDelete ? `ON DELETE ${onDelete}` : "";
18483
+ const onUpdateStatement = onUpdate ? `ON UPDATE ${onUpdate}` : "";
18484
18484
  const fromColumnsString = columnsFrom.map((it) => `\`${it}\``).join(",");
18485
18485
  const toColumnsString = columnsTo.map((it) => `\`${it}\``).join(",");
18486
18486
  return `ALTER TABLE ${tableFrom} ADD CONSTRAINT ${name} FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableTo}(${toColumnsString}) ${onDeleteStatement} ${onUpdateStatement};`.replace(/ +/g, " ").trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.12.4",
3
+ "version": "0.12.5",
4
4
  "repository": "https://github.com/lambda-direct/drizzle-kit",
5
5
  "author": "Alex Blokh <aleksandrblokh@gmail.com>",
6
6
  "license": "MIT",