drizzle-kit 1.0.0-beta.5-0a7601e → 1.0.0-beta.6-c513c71

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/api-mysql.js CHANGED
@@ -19441,6 +19441,7 @@ var init_grammar5 = __esm({
19441
19441
  "use strict";
19442
19442
  init_utils();
19443
19443
  init_when_json_met_bigint();
19444
+ init_utils2();
19444
19445
  viewAsStatementRegex = new RegExp(`\\bAS\\b\\s+(WITH.+|SELECT.+)$`, "is");
19445
19446
  }
19446
19447
  });
package/api-mysql.mjs CHANGED
@@ -19453,6 +19453,7 @@ var init_grammar5 = __esm({
19453
19453
  "use strict";
19454
19454
  init_utils();
19455
19455
  init_when_json_met_bigint();
19456
+ init_utils2();
19456
19457
  viewAsStatementRegex = new RegExp(`\\bAS\\b\\s+(WITH.+|SELECT.+)$`, "is");
19457
19458
  }
19458
19459
  });
package/api-postgres.js CHANGED
@@ -6916,6 +6916,9 @@ var init_grammar = __esm({
6916
6916
  if (!value) return { options, default: "" };
6917
6917
  value = trimChar(value, "'");
6918
6918
  if (value === "gen_random_uuid()") return { options, default: ".defaultRandom()" };
6919
+ if (!value.startsWith("'") && !value.endsWith("'") && value.endsWith("()")) {
6920
+ return { options, default: `sql\`${value}\`` };
6921
+ }
6919
6922
  return { options, default: `"${trimChar(value, "'")}"` };
6920
6923
  },
6921
6924
  toArrayTs: (type, value) => {
@@ -16085,25 +16088,35 @@ var init_views = __esm({
16085
16088
  const columnsAltered = fksAlters.filter((it) => it.columns);
16086
16089
  const columnsToAltered = fksAlters.filter((it) => it.columnsTo);
16087
16090
  const tablesToAltered = fksAlters.filter((it) => it.tableTo);
16088
- res += `\u2502 Foreign key constraint was altered:
16089
- `;
16090
- if (columnsAltered) {
16091
+ const onUpdateAltered = fksAlters.filter((it) => it.onUpdate);
16092
+ const onDeleteAltered = fksAlters.filter((it) => it.onDelete);
16093
+ res += columnsAltered.length > 0 && columnsToAltered.length > 0 && tablesToAltered.length > 0 && onUpdateAltered.length > 0 && onDeleteAltered.length > 0 ? `\u2502 Foreign key constraint was altered:
16094
+ ` : "";
16095
+ if (columnsAltered.length) {
16091
16096
  res += `${columnsAltered.map(
16092
16097
  (it) => `\u2502 name: ${it.name} => columns: [${it.columns?.from.join(",")}] -> [${it.columns?.to.join(",")}]`
16093
16098
  )}
16094
16099
  `;
16095
16100
  }
16096
- if (columnsToAltered) {
16101
+ if (columnsToAltered.length) {
16097
16102
  res += ` ${columnsToAltered.map(
16098
16103
  (it) => `\u2502 name: ${it.name} => columnsTo: [${it.columnsTo?.from.join(",")}] -> [${it.columnsTo?.to.join(",")}]`
16099
16104
  )}
16100
16105
  `;
16101
16106
  }
16102
- if (tablesToAltered) {
16107
+ if (tablesToAltered.length) {
16103
16108
  res += `${tablesToAltered.map((it) => `\u2502 name: ${it.name} => tableTo: [${it.tableTo?.from}] -> [${it.tableTo?.to}]`)}
16104
16109
  `;
16105
16110
  }
16106
- blocks.push([res]);
16111
+ if (onUpdateAltered.length) {
16112
+ res += `${onUpdateAltered.map((it) => `\u2502 name: ${it.name} => onUpdate: [${it.onUpdate?.from}] -> [${it.onUpdate?.to}]`)}
16113
+ `;
16114
+ }
16115
+ if (onDeleteAltered.length) {
16116
+ res += `${onDeleteAltered.map((it) => `\u2502 name: ${it.name} => onDelete: [${it.onDelete?.from}] -> [${it.onDelete?.to}]`)}
16117
+ `;
16118
+ }
16119
+ if (res) blocks.push([res]);
16107
16120
  }
16108
16121
  if (fksDiff.length) {
16109
16122
  const fksCreated = fksDiff.filter((it) => it.$diffType === "create");
@@ -21553,6 +21566,7 @@ var init_grammar5 = __esm({
21553
21566
  "use strict";
21554
21567
  init_utils();
21555
21568
  init_when_json_met_bigint();
21569
+ init_utils2();
21556
21570
  viewAsStatementRegex = new RegExp(`\\bAS\\b\\s+(WITH.+|SELECT.+)$`, "is");
21557
21571
  }
21558
21572
  });
@@ -22782,6 +22796,82 @@ var init_mocks = __esm({
22782
22796
  }
22783
22797
  });
22784
22798
 
22799
+ // src/utils/node-assert/deep-strict-equal.ts
22800
+ function deepStrictEqualInternal(actual, expected) {
22801
+ if (actual === expected) {
22802
+ return true;
22803
+ }
22804
+ if (actual === null || expected === null) {
22805
+ return false;
22806
+ }
22807
+ if (typeof actual !== "object" || typeof expected !== "object") {
22808
+ return false;
22809
+ }
22810
+ if (Array.isArray(actual) && Array.isArray(expected)) {
22811
+ if (actual.length !== expected.length) {
22812
+ return false;
22813
+ }
22814
+ for (let i7 = 0; i7 < actual.length; i7++) {
22815
+ if (!deepStrictEqualInternal(actual[i7], expected[i7])) {
22816
+ return false;
22817
+ }
22818
+ }
22819
+ return true;
22820
+ }
22821
+ if (Array.isArray(actual) !== Array.isArray(expected)) {
22822
+ return false;
22823
+ }
22824
+ const actualObj = actual;
22825
+ const expectedObj = expected;
22826
+ const actualKeys = Object.keys(actualObj);
22827
+ const expectedKeys = Object.keys(expectedObj);
22828
+ if (actualKeys.length !== expectedKeys.length) {
22829
+ return false;
22830
+ }
22831
+ for (const key of actualKeys) {
22832
+ if (!Object.prototype.hasOwnProperty.call(expectedObj, key)) {
22833
+ return false;
22834
+ }
22835
+ if (!deepStrictEqualInternal(actualObj[key], expectedObj[key])) {
22836
+ return false;
22837
+ }
22838
+ }
22839
+ return true;
22840
+ }
22841
+ function deepStrictEqual(actual, expected, message) {
22842
+ if (!deepStrictEqualInternal(actual, expected)) {
22843
+ if (message instanceof Error) {
22844
+ throw message;
22845
+ }
22846
+ throw new AssertionError({
22847
+ message: message || `Expected values to be strictly deep-equal`,
22848
+ actual,
22849
+ expected,
22850
+ operator: "deepStrictEqual"
22851
+ });
22852
+ }
22853
+ }
22854
+ var AssertionError;
22855
+ var init_deep_strict_equal = __esm({
22856
+ "src/utils/node-assert/deep-strict-equal.ts"() {
22857
+ "use strict";
22858
+ AssertionError = class extends Error {
22859
+ actual;
22860
+ expected;
22861
+ operator;
22862
+ constructor(options) {
22863
+ super(
22864
+ options.message || `${JSON.stringify(options.actual)} ${options.operator} ${JSON.stringify(options.expected)}`
22865
+ );
22866
+ this.name = "AssertionError";
22867
+ this.actual = options.actual;
22868
+ this.expected = options.expected;
22869
+ this.operator = options.operator;
22870
+ }
22871
+ };
22872
+ }
22873
+ });
22874
+
22785
22875
  // src/utils/sequence-matcher.ts
22786
22876
  function diffStringArrays(oldArr, newArr) {
22787
22877
  const opcodes = getOpcodes(oldArr, newArr);
@@ -23632,6 +23722,7 @@ var init_diff = __esm({
23632
23722
  init_when_json_met_bigint();
23633
23723
  init_utils();
23634
23724
  init_mocks();
23725
+ init_deep_strict_equal();
23635
23726
  init_sequence_matcher();
23636
23727
  init_dialect();
23637
23728
  init_utils2();
@@ -24243,10 +24334,12 @@ var init_diff = __esm({
24243
24334
  const columnAlters = alters.filter((it) => it.entityType === "columns").filter((it) => {
24244
24335
  if (it.default && (it.$left.type === "json" && it.$right.type === "json" || it.$left.type === "jsonb" && it.$right.type === "jsonb")) {
24245
24336
  if (it.default.from !== null && it.default.to !== null) {
24246
- const left = stringify(parse(trimChar(it.default.from, "'")));
24247
- const right = stringify(parse(trimChar(it.default.to, "'")));
24248
- if (left === right) {
24337
+ const parsedLeft = parse(trimChar(it.default.from, "'"));
24338
+ const parsedRight = parse(trimChar(it.default.to, "'"));
24339
+ try {
24340
+ deepStrictEqual(parsedLeft, parsedRight);
24249
24341
  delete it.default;
24342
+ } catch {
24250
24343
  }
24251
24344
  }
24252
24345
  }
package/api-postgres.mjs CHANGED
@@ -6922,6 +6922,9 @@ var init_grammar = __esm({
6922
6922
  if (!value) return { options, default: "" };
6923
6923
  value = trimChar(value, "'");
6924
6924
  if (value === "gen_random_uuid()") return { options, default: ".defaultRandom()" };
6925
+ if (!value.startsWith("'") && !value.endsWith("'") && value.endsWith("()")) {
6926
+ return { options, default: `sql\`${value}\`` };
6927
+ }
6925
6928
  return { options, default: `"${trimChar(value, "'")}"` };
6926
6929
  },
6927
6930
  toArrayTs: (type, value) => {
@@ -16091,25 +16094,35 @@ var init_views = __esm({
16091
16094
  const columnsAltered = fksAlters.filter((it) => it.columns);
16092
16095
  const columnsToAltered = fksAlters.filter((it) => it.columnsTo);
16093
16096
  const tablesToAltered = fksAlters.filter((it) => it.tableTo);
16094
- res += `\u2502 Foreign key constraint was altered:
16095
- `;
16096
- if (columnsAltered) {
16097
+ const onUpdateAltered = fksAlters.filter((it) => it.onUpdate);
16098
+ const onDeleteAltered = fksAlters.filter((it) => it.onDelete);
16099
+ res += columnsAltered.length > 0 && columnsToAltered.length > 0 && tablesToAltered.length > 0 && onUpdateAltered.length > 0 && onDeleteAltered.length > 0 ? `\u2502 Foreign key constraint was altered:
16100
+ ` : "";
16101
+ if (columnsAltered.length) {
16097
16102
  res += `${columnsAltered.map(
16098
16103
  (it) => `\u2502 name: ${it.name} => columns: [${it.columns?.from.join(",")}] -> [${it.columns?.to.join(",")}]`
16099
16104
  )}
16100
16105
  `;
16101
16106
  }
16102
- if (columnsToAltered) {
16107
+ if (columnsToAltered.length) {
16103
16108
  res += ` ${columnsToAltered.map(
16104
16109
  (it) => `\u2502 name: ${it.name} => columnsTo: [${it.columnsTo?.from.join(",")}] -> [${it.columnsTo?.to.join(",")}]`
16105
16110
  )}
16106
16111
  `;
16107
16112
  }
16108
- if (tablesToAltered) {
16113
+ if (tablesToAltered.length) {
16109
16114
  res += `${tablesToAltered.map((it) => `\u2502 name: ${it.name} => tableTo: [${it.tableTo?.from}] -> [${it.tableTo?.to}]`)}
16110
16115
  `;
16111
16116
  }
16112
- blocks.push([res]);
16117
+ if (onUpdateAltered.length) {
16118
+ res += `${onUpdateAltered.map((it) => `\u2502 name: ${it.name} => onUpdate: [${it.onUpdate?.from}] -> [${it.onUpdate?.to}]`)}
16119
+ `;
16120
+ }
16121
+ if (onDeleteAltered.length) {
16122
+ res += `${onDeleteAltered.map((it) => `\u2502 name: ${it.name} => onDelete: [${it.onDelete?.from}] -> [${it.onDelete?.to}]`)}
16123
+ `;
16124
+ }
16125
+ if (res) blocks.push([res]);
16113
16126
  }
16114
16127
  if (fksDiff.length) {
16115
16128
  const fksCreated = fksDiff.filter((it) => it.$diffType === "create");
@@ -21559,6 +21572,7 @@ var init_grammar5 = __esm({
21559
21572
  "use strict";
21560
21573
  init_utils();
21561
21574
  init_when_json_met_bigint();
21575
+ init_utils2();
21562
21576
  viewAsStatementRegex = new RegExp(`\\bAS\\b\\s+(WITH.+|SELECT.+)$`, "is");
21563
21577
  }
21564
21578
  });
@@ -22819,6 +22833,82 @@ var init_mocks = __esm({
22819
22833
  }
22820
22834
  });
22821
22835
 
22836
+ // src/utils/node-assert/deep-strict-equal.ts
22837
+ function deepStrictEqualInternal(actual, expected) {
22838
+ if (actual === expected) {
22839
+ return true;
22840
+ }
22841
+ if (actual === null || expected === null) {
22842
+ return false;
22843
+ }
22844
+ if (typeof actual !== "object" || typeof expected !== "object") {
22845
+ return false;
22846
+ }
22847
+ if (Array.isArray(actual) && Array.isArray(expected)) {
22848
+ if (actual.length !== expected.length) {
22849
+ return false;
22850
+ }
22851
+ for (let i7 = 0; i7 < actual.length; i7++) {
22852
+ if (!deepStrictEqualInternal(actual[i7], expected[i7])) {
22853
+ return false;
22854
+ }
22855
+ }
22856
+ return true;
22857
+ }
22858
+ if (Array.isArray(actual) !== Array.isArray(expected)) {
22859
+ return false;
22860
+ }
22861
+ const actualObj = actual;
22862
+ const expectedObj = expected;
22863
+ const actualKeys = Object.keys(actualObj);
22864
+ const expectedKeys = Object.keys(expectedObj);
22865
+ if (actualKeys.length !== expectedKeys.length) {
22866
+ return false;
22867
+ }
22868
+ for (const key of actualKeys) {
22869
+ if (!Object.prototype.hasOwnProperty.call(expectedObj, key)) {
22870
+ return false;
22871
+ }
22872
+ if (!deepStrictEqualInternal(actualObj[key], expectedObj[key])) {
22873
+ return false;
22874
+ }
22875
+ }
22876
+ return true;
22877
+ }
22878
+ function deepStrictEqual(actual, expected, message) {
22879
+ if (!deepStrictEqualInternal(actual, expected)) {
22880
+ if (message instanceof Error) {
22881
+ throw message;
22882
+ }
22883
+ throw new AssertionError({
22884
+ message: message || `Expected values to be strictly deep-equal`,
22885
+ actual,
22886
+ expected,
22887
+ operator: "deepStrictEqual"
22888
+ });
22889
+ }
22890
+ }
22891
+ var AssertionError;
22892
+ var init_deep_strict_equal = __esm({
22893
+ "src/utils/node-assert/deep-strict-equal.ts"() {
22894
+ "use strict";
22895
+ AssertionError = class extends Error {
22896
+ actual;
22897
+ expected;
22898
+ operator;
22899
+ constructor(options) {
22900
+ super(
22901
+ options.message || `${JSON.stringify(options.actual)} ${options.operator} ${JSON.stringify(options.expected)}`
22902
+ );
22903
+ this.name = "AssertionError";
22904
+ this.actual = options.actual;
22905
+ this.expected = options.expected;
22906
+ this.operator = options.operator;
22907
+ }
22908
+ };
22909
+ }
22910
+ });
22911
+
22822
22912
  // src/utils/sequence-matcher.ts
22823
22913
  function diffStringArrays(oldArr, newArr) {
22824
22914
  const opcodes = getOpcodes(oldArr, newArr);
@@ -23669,6 +23759,7 @@ var init_diff = __esm({
23669
23759
  init_when_json_met_bigint();
23670
23760
  init_utils();
23671
23761
  init_mocks();
23762
+ init_deep_strict_equal();
23672
23763
  init_sequence_matcher();
23673
23764
  init_dialect();
23674
23765
  init_utils2();
@@ -24280,10 +24371,12 @@ var init_diff = __esm({
24280
24371
  const columnAlters = alters.filter((it) => it.entityType === "columns").filter((it) => {
24281
24372
  if (it.default && (it.$left.type === "json" && it.$right.type === "json" || it.$left.type === "jsonb" && it.$right.type === "jsonb")) {
24282
24373
  if (it.default.from !== null && it.default.to !== null) {
24283
- const left = stringify(parse(trimChar(it.default.from, "'")));
24284
- const right = stringify(parse(trimChar(it.default.to, "'")));
24285
- if (left === right) {
24374
+ const parsedLeft = parse(trimChar(it.default.from, "'"));
24375
+ const parsedRight = parse(trimChar(it.default.to, "'"));
24376
+ try {
24377
+ deepStrictEqual(parsedLeft, parsedRight);
24286
24378
  delete it.default;
24379
+ } catch {
24287
24380
  }
24288
24381
  }
24289
24382
  }
package/api-sqlite.js CHANGED
@@ -19441,6 +19441,7 @@ var init_grammar5 = __esm({
19441
19441
  "use strict";
19442
19442
  init_utils();
19443
19443
  init_when_json_met_bigint();
19444
+ init_utils2();
19444
19445
  viewAsStatementRegex = new RegExp(`\\bAS\\b\\s+(WITH.+|SELECT.+)$`, "is");
19445
19446
  }
19446
19447
  });
package/api-sqlite.mjs CHANGED
@@ -19453,6 +19453,7 @@ var init_grammar5 = __esm({
19453
19453
  "use strict";
19454
19454
  init_utils();
19455
19455
  init_when_json_met_bigint();
19456
+ init_utils2();
19456
19457
  viewAsStatementRegex = new RegExp(`\\bAS\\b\\s+(WITH.+|SELECT.+)$`, "is");
19457
19458
  }
19458
19459
  });
package/bin.cjs CHANGED
@@ -21828,6 +21828,9 @@ var init_grammar2 = __esm({
21828
21828
  if (!value) return { options, default: "" };
21829
21829
  value = trimChar(value, "'");
21830
21830
  if (value === "gen_random_uuid()") return { options, default: ".defaultRandom()" };
21831
+ if (!value.startsWith("'") && !value.endsWith("'") && value.endsWith("()")) {
21832
+ return { options, default: `sql\`${value}\`` };
21833
+ }
21831
21834
  return { options, default: `"${trimChar(value, "'")}"` };
21832
21835
  },
21833
21836
  toArrayTs: (type, value) => {
@@ -23807,9 +23810,11 @@ var init_views = __esm({
23807
23810
  const columnsAltered = fksAlters.filter((it2) => it2.columns);
23808
23811
  const columnsToAltered = fksAlters.filter((it2) => it2.columnsTo);
23809
23812
  const tablesToAltered = fksAlters.filter((it2) => it2.tableTo);
23810
- res += `\u2502 Foreign key constraint was altered:
23811
- `;
23812
- if (columnsAltered) {
23813
+ const onUpdateAltered = fksAlters.filter((it2) => it2.onUpdate);
23814
+ const onDeleteAltered = fksAlters.filter((it2) => it2.onDelete);
23815
+ res += columnsAltered.length > 0 && columnsToAltered.length > 0 && tablesToAltered.length > 0 && onUpdateAltered.length > 0 && onDeleteAltered.length > 0 ? `\u2502 Foreign key constraint was altered:
23816
+ ` : "";
23817
+ if (columnsAltered.length) {
23813
23818
  res += `${columnsAltered.map(
23814
23819
  (it2) => {
23815
23820
  var _a5, _b;
@@ -23818,7 +23823,7 @@ var init_views = __esm({
23818
23823
  )}
23819
23824
  `;
23820
23825
  }
23821
- if (columnsToAltered) {
23826
+ if (columnsToAltered.length) {
23822
23827
  res += ` ${columnsToAltered.map(
23823
23828
  (it2) => {
23824
23829
  var _a5, _b;
@@ -23827,14 +23832,28 @@ var init_views = __esm({
23827
23832
  )}
23828
23833
  `;
23829
23834
  }
23830
- if (tablesToAltered) {
23835
+ if (tablesToAltered.length) {
23831
23836
  res += `${tablesToAltered.map((it2) => {
23832
23837
  var _a5, _b;
23833
23838
  return `\u2502 name: ${it2.name} => tableTo: [${(_a5 = it2.tableTo) == null ? void 0 : _a5.from}] -> [${(_b = it2.tableTo) == null ? void 0 : _b.to}]`;
23834
23839
  })}
23835
23840
  `;
23836
23841
  }
23837
- blocks.push([res]);
23842
+ if (onUpdateAltered.length) {
23843
+ res += `${onUpdateAltered.map((it2) => {
23844
+ var _a5, _b;
23845
+ return `\u2502 name: ${it2.name} => onUpdate: [${(_a5 = it2.onUpdate) == null ? void 0 : _a5.from}] -> [${(_b = it2.onUpdate) == null ? void 0 : _b.to}]`;
23846
+ })}
23847
+ `;
23848
+ }
23849
+ if (onDeleteAltered.length) {
23850
+ res += `${onDeleteAltered.map((it2) => {
23851
+ var _a5, _b;
23852
+ return `\u2502 name: ${it2.name} => onDelete: [${(_a5 = it2.onDelete) == null ? void 0 : _a5.from}] -> [${(_b = it2.onDelete) == null ? void 0 : _b.to}]`;
23853
+ })}
23854
+ `;
23855
+ }
23856
+ if (res) blocks.push([res]);
23838
23857
  }
23839
23858
  if (fksDiff.length) {
23840
23859
  const fksCreated = fksDiff.filter((it2) => it2.$diffType === "create");
@@ -28110,7 +28129,10 @@ function sqlTypeFrom(sqlType) {
28110
28129
  if (["real", "double", "double precision", "float"].some((it2) => lowered.startsWith(it2))) {
28111
28130
  return "real";
28112
28131
  }
28113
- return "numeric";
28132
+ if (["numeric", "decimal", "boolean", "date", "datetime"].some((it2) => lowered.startsWith(it2))) {
28133
+ return "numeric";
28134
+ }
28135
+ return sqlType;
28114
28136
  }
28115
28137
  function extractGeneratedColumns(input) {
28116
28138
  const columns = {};
@@ -28280,12 +28302,13 @@ function parseToHex(value) {
28280
28302
  }
28281
28303
  return value;
28282
28304
  }
28283
- var namedCheckPattern, unnamedCheckPattern, viewAsStatementRegex2, nameForForeignKey, nameForUnique2, nameForPk, intAffinities, Int5, realAffinities, Real5, numericAffinities, Numeric3, textAffinities, Text4, Blob3, typeFor5, parseDefault2, parseTableSQL, parseViewSQL2, defaultsCommutative3, transformOnUpdateDelete;
28305
+ var namedCheckPattern, unnamedCheckPattern, viewAsStatementRegex2, nameForForeignKey, nameForUnique2, nameForPk, intAffinities, Int5, realAffinities, Real5, numericAffinities, Numeric3, textAffinities, Text4, Blob3, Custom5, typeFor5, parseDefault2, parseTableSQL, parseViewSQL2, defaultsCommutative3, transformOnUpdateDelete;
28284
28306
  var init_grammar5 = __esm({
28285
28307
  "src/dialects/sqlite/grammar.ts"() {
28286
28308
  "use strict";
28287
28309
  init_utils2();
28288
28310
  init_when_json_met_bigint();
28311
+ init_utils3();
28289
28312
  namedCheckPattern = /CONSTRAINT\s+["'`[]?(\w+)["'`\]]?\s+CHECK\s*\((.*)\)/gi;
28290
28313
  unnamedCheckPattern = /CHECK\s+\((.*)\)/gi;
28291
28314
  viewAsStatementRegex2 = new RegExp(`\\bAS\\b\\s+(WITH.+|SELECT.+)$`, "is");
@@ -28412,7 +28435,7 @@ var init_grammar5 = __esm({
28412
28435
  Text4 = {
28413
28436
  is: function(type) {
28414
28437
  const lowered = type.toLowerCase();
28415
- return textAffinities.indexOf(lowered) >= 0 || lowered.startsWith("character(") || lowered.startsWith("varchar(") || lowered.startsWith("varying character(") || lowered.startsWith("nchar(") || lowered.startsWith("native character(") || lowered.startsWith("nvarchar(");
28438
+ return textAffinities.indexOf(lowered) >= 0 || lowered.startsWith("text(") || lowered.startsWith("character(") || lowered.startsWith("varchar(") || lowered.startsWith("varying character(") || lowered.startsWith("nchar(") || lowered.startsWith("native character(") || lowered.startsWith("nvarchar(") || lowered.startsWith("clob(");
28416
28439
  },
28417
28440
  drizzleImport: function() {
28418
28441
  return "text";
@@ -28474,7 +28497,7 @@ var init_grammar5 = __esm({
28474
28497
  defaultFromIntrospect: function(value) {
28475
28498
  return value;
28476
28499
  },
28477
- toTs: function(value) {
28500
+ toTs: function(value, type) {
28478
28501
  if (value === null) return "";
28479
28502
  if (typeof Buffer !== "undefined" && value.startsWith("X'")) {
28480
28503
  const parsed = Buffer.from(value.slice(2, value.length - 1), "hex").toString("utf-8");
@@ -28493,7 +28516,25 @@ var init_grammar5 = __esm({
28493
28516
  }
28494
28517
  } catch {
28495
28518
  }
28496
- return Text4.toTs(value);
28519
+ return Text4.toTs(value, type);
28520
+ }
28521
+ };
28522
+ Custom5 = {
28523
+ is: (_type) => {
28524
+ throw Error("Mocked");
28525
+ },
28526
+ drizzleImport: () => "customType",
28527
+ defaultFromDrizzle: (value) => {
28528
+ if (!value) return "";
28529
+ return String(value);
28530
+ },
28531
+ defaultFromIntrospect: (value) => {
28532
+ return value;
28533
+ },
28534
+ toTs: function(value, type) {
28535
+ if (!value) return { def: "", customType: type };
28536
+ const escaped = escapeForTsLiteral(value);
28537
+ return { def: escaped, customType: type };
28497
28538
  }
28498
28539
  };
28499
28540
  typeFor5 = (sqlType) => {
@@ -28502,7 +28543,8 @@ var init_grammar5 = __esm({
28502
28543
  if (Numeric3.is(sqlType)) return Numeric3;
28503
28544
  if (Text4.is(sqlType)) return Text4;
28504
28545
  if (Blob3.is(sqlType)) return Blob3;
28505
- return Numeric3;
28546
+ if (Numeric3.is(sqlType)) return Numeric3;
28547
+ return Custom5;
28506
28548
  };
28507
28549
  parseDefault2 = (type, it2) => {
28508
28550
  if (it2 === null) return null;
@@ -39027,6 +39069,82 @@ var init_mocks = __esm({
39027
39069
  }
39028
39070
  });
39029
39071
 
39072
+ // src/utils/node-assert/deep-strict-equal.ts
39073
+ function deepStrictEqualInternal(actual, expected) {
39074
+ if (actual === expected) {
39075
+ return true;
39076
+ }
39077
+ if (actual === null || expected === null) {
39078
+ return false;
39079
+ }
39080
+ if (typeof actual !== "object" || typeof expected !== "object") {
39081
+ return false;
39082
+ }
39083
+ if (Array.isArray(actual) && Array.isArray(expected)) {
39084
+ if (actual.length !== expected.length) {
39085
+ return false;
39086
+ }
39087
+ for (let i6 = 0; i6 < actual.length; i6++) {
39088
+ if (!deepStrictEqualInternal(actual[i6], expected[i6])) {
39089
+ return false;
39090
+ }
39091
+ }
39092
+ return true;
39093
+ }
39094
+ if (Array.isArray(actual) !== Array.isArray(expected)) {
39095
+ return false;
39096
+ }
39097
+ const actualObj = actual;
39098
+ const expectedObj = expected;
39099
+ const actualKeys = Object.keys(actualObj);
39100
+ const expectedKeys = Object.keys(expectedObj);
39101
+ if (actualKeys.length !== expectedKeys.length) {
39102
+ return false;
39103
+ }
39104
+ for (const key of actualKeys) {
39105
+ if (!Object.prototype.hasOwnProperty.call(expectedObj, key)) {
39106
+ return false;
39107
+ }
39108
+ if (!deepStrictEqualInternal(actualObj[key], expectedObj[key])) {
39109
+ return false;
39110
+ }
39111
+ }
39112
+ return true;
39113
+ }
39114
+ function deepStrictEqual(actual, expected, message) {
39115
+ if (!deepStrictEqualInternal(actual, expected)) {
39116
+ if (message instanceof Error) {
39117
+ throw message;
39118
+ }
39119
+ throw new AssertionError({
39120
+ message: message || `Expected values to be strictly deep-equal`,
39121
+ actual,
39122
+ expected,
39123
+ operator: "deepStrictEqual"
39124
+ });
39125
+ }
39126
+ }
39127
+ var AssertionError;
39128
+ var init_deep_strict_equal = __esm({
39129
+ "src/utils/node-assert/deep-strict-equal.ts"() {
39130
+ "use strict";
39131
+ AssertionError = class extends Error {
39132
+ actual;
39133
+ expected;
39134
+ operator;
39135
+ constructor(options) {
39136
+ super(
39137
+ options.message || `${JSON.stringify(options.actual)} ${options.operator} ${JSON.stringify(options.expected)}`
39138
+ );
39139
+ this.name = "AssertionError";
39140
+ this.actual = options.actual;
39141
+ this.expected = options.expected;
39142
+ this.operator = options.operator;
39143
+ }
39144
+ };
39145
+ }
39146
+ });
39147
+
39030
39148
  // src/utils/sequence-matcher.ts
39031
39149
  function diffStringArrays(oldArr, newArr) {
39032
39150
  const opcodes = getOpcodes(oldArr, newArr);
@@ -39877,6 +39995,7 @@ var init_diff = __esm({
39877
39995
  init_when_json_met_bigint();
39878
39996
  init_utils2();
39879
39997
  init_mocks();
39998
+ init_deep_strict_equal();
39880
39999
  init_sequence_matcher();
39881
40000
  init_dialect();
39882
40001
  init_utils3();
@@ -40489,10 +40608,12 @@ var init_diff = __esm({
40489
40608
  var _a5, _b;
40490
40609
  if (it2.default && (it2.$left.type === "json" && it2.$right.type === "json" || it2.$left.type === "jsonb" && it2.$right.type === "jsonb")) {
40491
40610
  if (it2.default.from !== null && it2.default.to !== null) {
40492
- const left = stringify(parse(trimChar(it2.default.from, "'")));
40493
- const right = stringify(parse(trimChar(it2.default.to, "'")));
40494
- if (left === right) {
40611
+ const parsedLeft = parse(trimChar(it2.default.from, "'"));
40612
+ const parsedRight = parse(trimChar(it2.default.to, "'"));
40613
+ try {
40614
+ deepStrictEqual(parsedLeft, parsedRight);
40495
40615
  delete it2.default;
40616
+ } catch {
40496
40617
  }
40497
40618
  }
40498
40619
  }
@@ -42576,6 +42697,10 @@ var init_diff3 = __esm({
42576
42697
  if (it2.nameExplicit) {
42577
42698
  delete it2.nameExplicit;
42578
42699
  }
42700
+ if (it2.columns && it2.columns.to && it2.columns.from && it2.columns.from.length === it2.columns.to.length) {
42701
+ const unique = new Set(it2.columns.to);
42702
+ if (it2.columns.from.every((col) => unique.has(col))) delete it2.columns;
42703
+ }
42579
42704
  return ddl22.pks.hasDiff(it2);
42580
42705
  });
42581
42706
  const fksAlters = updates.filter((it2) => it2.entityType === "fks").filter((it2) => {
@@ -171444,7 +171569,7 @@ var init_typescript3 = __esm({
171444
171569
  init_utils();
171445
171570
  init_utils2();
171446
171571
  init_grammar5();
171447
- imports3 = ["integer", "real", "text", "numeric", "blob"];
171572
+ imports3 = ["integer", "real", "text", "numeric", "blob", "customType"];
171448
171573
  sqliteImports = /* @__PURE__ */ new Set([
171449
171574
  "sqliteTable",
171450
171575
  ...imports3
@@ -171493,7 +171618,7 @@ var init_typescript3 = __esm({
171493
171618
  for (const it2 of schema5.entities.list()) {
171494
171619
  if (it2.entityType === "indexes") imports6.add(it2.isUnique ? "uniqueIndex" : "index");
171495
171620
  if (it2.entityType === "pks" && it2.columns.length > 1) imports6.add("primaryKey");
171496
- if (it2.entityType === "uniques" && it2.columns.length > 1) imports6.add("unique");
171621
+ if (it2.entityType === "uniques") imports6.add("unique");
171497
171622
  if (it2.entityType === "checks") imports6.add("check");
171498
171623
  if (it2.entityType === "columns") columnTypes.add(it2.type);
171499
171624
  if (it2.entityType === "views") imports6.add("sqliteView");
@@ -171597,11 +171722,11 @@ import { sql } from "drizzle-orm"
171597
171722
  const grammarType = typeFor5(type);
171598
171723
  if (grammarType) {
171599
171724
  const drizzleType = grammarType.drizzleImport();
171600
- const res = grammarType.toTs(defaultValue);
171601
- const { def, options } = typeof res === "string" ? { def: res } : res;
171725
+ const res = grammarType.toTs(defaultValue, type);
171726
+ const { def, options, customType } = typeof res === "string" ? { def: res } : res;
171602
171727
  const defaultStatement = def ? `.default(${def})` : "";
171603
171728
  const opts = options ? `${JSON.stringify(options)}` : "";
171604
- return `${withCasing3(name, casing2)}: ${drizzleType}(${dbColumnName3({ name, casing: casing2, withMode: Boolean(opts) })}${opts})${defaultStatement}`;
171729
+ return `${withCasing3(name, casing2)}: ${drizzleType}${customType ? `({ dataType: () => '${customType}' })` : ""}(${dbColumnName3({ name, casing: casing2, withMode: Boolean(opts) })}${opts})${defaultStatement}`;
171605
171730
  }
171606
171731
  if (lowered.startsWith("text")) {
171607
171732
  const match3 = lowered.match(/\d+/);
@@ -171620,7 +171745,7 @@ import { sql } from "drizzle-orm"
171620
171745
  createTableColumns3 = (columns, fks, pk, casing2) => {
171621
171746
  let statement = "";
171622
171747
  for (const it2 of columns) {
171623
- const isPrimary = pk && pk.columns.length === 1 && pk.columns[0] === it2.name;
171748
+ const isPrimary = pk && pk.columns.length === 1 && pk.columns[0] === it2.name && pk.table === it2.table;
171624
171749
  statement += " ";
171625
171750
  statement += column8(it2.type, it2.name, it2.default, casing2);
171626
171751
  statement += isPrimary ? `.primaryKey(${it2.autoincrement ? "{ autoIncrement: true }" : ""})` : "";
@@ -171657,9 +171782,6 @@ import { sql } from "drizzle-orm"
171657
171782
  createTableIndexes3 = (tableName, idxs, casing2) => {
171658
171783
  let statement = "";
171659
171784
  for (const it2 of idxs) {
171660
- let idxKey = it2.name.startsWith(tableName) && it2.name !== tableName ? it2.name.slice(tableName.length + 1) : it2.name;
171661
- idxKey = idxKey.endsWith("_index") ? idxKey.slice(0, -"_index".length) + "_idx" : idxKey;
171662
- idxKey = withCasing3(idxKey, casing2);
171663
171785
  const columnNames = it2.columns.filter((c5) => !c5.isExpression).map((c5) => c5.value);
171664
171786
  const indexGeneratedName = `${tableName}_${columnNames.join("_")}_index`;
171665
171787
  const escapedIndexName = indexGeneratedName === it2.name ? "" : `"${it2.name}"`;
@@ -171674,8 +171796,6 @@ import { sql } from "drizzle-orm"
171674
171796
  createTableUniques2 = (unqs, casing2) => {
171675
171797
  let statement = "";
171676
171798
  unqs.forEach((it2) => {
171677
- const idxKey = withCasing3(it2.name, casing2);
171678
- statement += ` ${idxKey}: `;
171679
171799
  statement += "unique(";
171680
171800
  statement += `"${it2.name}")`;
171681
171801
  statement += `.on(${it2.columns.map((it3) => `table.${withCasing3(it3, casing2)}`).join(", ")}),`;
@@ -171702,7 +171822,7 @@ import { sql } from "drizzle-orm"
171702
171822
  }).join(", ")}]`;
171703
171823
  statement += `${pk.name ? `, name: "${pk.name}"` : ""}}`;
171704
171824
  statement += ")";
171705
- statement += `
171825
+ statement += `,
171706
171826
  `;
171707
171827
  return statement;
171708
171828
  };
@@ -182900,7 +183020,7 @@ init_views();
182900
183020
  var version3 = async () => {
182901
183021
  const { npmVersion } = await ormCoreVersions();
182902
183022
  const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
182903
- const envVersion = "1.0.0-beta.5";
183023
+ const envVersion = "1.0.0-beta.6";
182904
183024
  const kitVersion = envVersion ? `v${envVersion}` : "--";
182905
183025
  const versions = `drizzle-kit: ${kitVersion}
182906
183026
  ${ormVersion}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "1.0.0-beta.5-0a7601e",
3
+ "version": "1.0.0-beta.6-c513c71",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",