drizzle-kit 1.0.0-beta.5-0a7601e → 1.0.0-beta.5-5d28122
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-postgres.js +101 -9
- package/api-postgres.mjs +101 -9
- package/bin.cjs +117 -12
- package/package.json +1 -1
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
|
-
|
|
16089
|
-
|
|
16090
|
-
|
|
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
|
-
|
|
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");
|
|
@@ -22782,6 +22795,82 @@ var init_mocks = __esm({
|
|
|
22782
22795
|
}
|
|
22783
22796
|
});
|
|
22784
22797
|
|
|
22798
|
+
// src/utils/node-assert/deep-strict-equal.ts
|
|
22799
|
+
function deepStrictEqualInternal(actual, expected) {
|
|
22800
|
+
if (actual === expected) {
|
|
22801
|
+
return true;
|
|
22802
|
+
}
|
|
22803
|
+
if (actual === null || expected === null) {
|
|
22804
|
+
return false;
|
|
22805
|
+
}
|
|
22806
|
+
if (typeof actual !== "object" || typeof expected !== "object") {
|
|
22807
|
+
return false;
|
|
22808
|
+
}
|
|
22809
|
+
if (Array.isArray(actual) && Array.isArray(expected)) {
|
|
22810
|
+
if (actual.length !== expected.length) {
|
|
22811
|
+
return false;
|
|
22812
|
+
}
|
|
22813
|
+
for (let i7 = 0; i7 < actual.length; i7++) {
|
|
22814
|
+
if (!deepStrictEqualInternal(actual[i7], expected[i7])) {
|
|
22815
|
+
return false;
|
|
22816
|
+
}
|
|
22817
|
+
}
|
|
22818
|
+
return true;
|
|
22819
|
+
}
|
|
22820
|
+
if (Array.isArray(actual) !== Array.isArray(expected)) {
|
|
22821
|
+
return false;
|
|
22822
|
+
}
|
|
22823
|
+
const actualObj = actual;
|
|
22824
|
+
const expectedObj = expected;
|
|
22825
|
+
const actualKeys = Object.keys(actualObj);
|
|
22826
|
+
const expectedKeys = Object.keys(expectedObj);
|
|
22827
|
+
if (actualKeys.length !== expectedKeys.length) {
|
|
22828
|
+
return false;
|
|
22829
|
+
}
|
|
22830
|
+
for (const key of actualKeys) {
|
|
22831
|
+
if (!Object.prototype.hasOwnProperty.call(expectedObj, key)) {
|
|
22832
|
+
return false;
|
|
22833
|
+
}
|
|
22834
|
+
if (!deepStrictEqualInternal(actualObj[key], expectedObj[key])) {
|
|
22835
|
+
return false;
|
|
22836
|
+
}
|
|
22837
|
+
}
|
|
22838
|
+
return true;
|
|
22839
|
+
}
|
|
22840
|
+
function deepStrictEqual(actual, expected, message) {
|
|
22841
|
+
if (!deepStrictEqualInternal(actual, expected)) {
|
|
22842
|
+
if (message instanceof Error) {
|
|
22843
|
+
throw message;
|
|
22844
|
+
}
|
|
22845
|
+
throw new AssertionError({
|
|
22846
|
+
message: message || `Expected values to be strictly deep-equal`,
|
|
22847
|
+
actual,
|
|
22848
|
+
expected,
|
|
22849
|
+
operator: "deepStrictEqual"
|
|
22850
|
+
});
|
|
22851
|
+
}
|
|
22852
|
+
}
|
|
22853
|
+
var AssertionError;
|
|
22854
|
+
var init_deep_strict_equal = __esm({
|
|
22855
|
+
"src/utils/node-assert/deep-strict-equal.ts"() {
|
|
22856
|
+
"use strict";
|
|
22857
|
+
AssertionError = class extends Error {
|
|
22858
|
+
actual;
|
|
22859
|
+
expected;
|
|
22860
|
+
operator;
|
|
22861
|
+
constructor(options) {
|
|
22862
|
+
super(
|
|
22863
|
+
options.message || `${JSON.stringify(options.actual)} ${options.operator} ${JSON.stringify(options.expected)}`
|
|
22864
|
+
);
|
|
22865
|
+
this.name = "AssertionError";
|
|
22866
|
+
this.actual = options.actual;
|
|
22867
|
+
this.expected = options.expected;
|
|
22868
|
+
this.operator = options.operator;
|
|
22869
|
+
}
|
|
22870
|
+
};
|
|
22871
|
+
}
|
|
22872
|
+
});
|
|
22873
|
+
|
|
22785
22874
|
// src/utils/sequence-matcher.ts
|
|
22786
22875
|
function diffStringArrays(oldArr, newArr) {
|
|
22787
22876
|
const opcodes = getOpcodes(oldArr, newArr);
|
|
@@ -23632,6 +23721,7 @@ var init_diff = __esm({
|
|
|
23632
23721
|
init_when_json_met_bigint();
|
|
23633
23722
|
init_utils();
|
|
23634
23723
|
init_mocks();
|
|
23724
|
+
init_deep_strict_equal();
|
|
23635
23725
|
init_sequence_matcher();
|
|
23636
23726
|
init_dialect();
|
|
23637
23727
|
init_utils2();
|
|
@@ -24243,10 +24333,12 @@ var init_diff = __esm({
|
|
|
24243
24333
|
const columnAlters = alters.filter((it) => it.entityType === "columns").filter((it) => {
|
|
24244
24334
|
if (it.default && (it.$left.type === "json" && it.$right.type === "json" || it.$left.type === "jsonb" && it.$right.type === "jsonb")) {
|
|
24245
24335
|
if (it.default.from !== null && it.default.to !== null) {
|
|
24246
|
-
const
|
|
24247
|
-
const
|
|
24248
|
-
|
|
24336
|
+
const parsedLeft = parse(trimChar(it.default.from, "'"));
|
|
24337
|
+
const parsedRight = parse(trimChar(it.default.to, "'"));
|
|
24338
|
+
try {
|
|
24339
|
+
deepStrictEqual(parsedLeft, parsedRight);
|
|
24249
24340
|
delete it.default;
|
|
24341
|
+
} catch {
|
|
24250
24342
|
}
|
|
24251
24343
|
}
|
|
24252
24344
|
}
|
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
|
-
|
|
16095
|
-
|
|
16096
|
-
|
|
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
|
-
|
|
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");
|
|
@@ -22819,6 +22832,82 @@ var init_mocks = __esm({
|
|
|
22819
22832
|
}
|
|
22820
22833
|
});
|
|
22821
22834
|
|
|
22835
|
+
// src/utils/node-assert/deep-strict-equal.ts
|
|
22836
|
+
function deepStrictEqualInternal(actual, expected) {
|
|
22837
|
+
if (actual === expected) {
|
|
22838
|
+
return true;
|
|
22839
|
+
}
|
|
22840
|
+
if (actual === null || expected === null) {
|
|
22841
|
+
return false;
|
|
22842
|
+
}
|
|
22843
|
+
if (typeof actual !== "object" || typeof expected !== "object") {
|
|
22844
|
+
return false;
|
|
22845
|
+
}
|
|
22846
|
+
if (Array.isArray(actual) && Array.isArray(expected)) {
|
|
22847
|
+
if (actual.length !== expected.length) {
|
|
22848
|
+
return false;
|
|
22849
|
+
}
|
|
22850
|
+
for (let i7 = 0; i7 < actual.length; i7++) {
|
|
22851
|
+
if (!deepStrictEqualInternal(actual[i7], expected[i7])) {
|
|
22852
|
+
return false;
|
|
22853
|
+
}
|
|
22854
|
+
}
|
|
22855
|
+
return true;
|
|
22856
|
+
}
|
|
22857
|
+
if (Array.isArray(actual) !== Array.isArray(expected)) {
|
|
22858
|
+
return false;
|
|
22859
|
+
}
|
|
22860
|
+
const actualObj = actual;
|
|
22861
|
+
const expectedObj = expected;
|
|
22862
|
+
const actualKeys = Object.keys(actualObj);
|
|
22863
|
+
const expectedKeys = Object.keys(expectedObj);
|
|
22864
|
+
if (actualKeys.length !== expectedKeys.length) {
|
|
22865
|
+
return false;
|
|
22866
|
+
}
|
|
22867
|
+
for (const key of actualKeys) {
|
|
22868
|
+
if (!Object.prototype.hasOwnProperty.call(expectedObj, key)) {
|
|
22869
|
+
return false;
|
|
22870
|
+
}
|
|
22871
|
+
if (!deepStrictEqualInternal(actualObj[key], expectedObj[key])) {
|
|
22872
|
+
return false;
|
|
22873
|
+
}
|
|
22874
|
+
}
|
|
22875
|
+
return true;
|
|
22876
|
+
}
|
|
22877
|
+
function deepStrictEqual(actual, expected, message) {
|
|
22878
|
+
if (!deepStrictEqualInternal(actual, expected)) {
|
|
22879
|
+
if (message instanceof Error) {
|
|
22880
|
+
throw message;
|
|
22881
|
+
}
|
|
22882
|
+
throw new AssertionError({
|
|
22883
|
+
message: message || `Expected values to be strictly deep-equal`,
|
|
22884
|
+
actual,
|
|
22885
|
+
expected,
|
|
22886
|
+
operator: "deepStrictEqual"
|
|
22887
|
+
});
|
|
22888
|
+
}
|
|
22889
|
+
}
|
|
22890
|
+
var AssertionError;
|
|
22891
|
+
var init_deep_strict_equal = __esm({
|
|
22892
|
+
"src/utils/node-assert/deep-strict-equal.ts"() {
|
|
22893
|
+
"use strict";
|
|
22894
|
+
AssertionError = class extends Error {
|
|
22895
|
+
actual;
|
|
22896
|
+
expected;
|
|
22897
|
+
operator;
|
|
22898
|
+
constructor(options) {
|
|
22899
|
+
super(
|
|
22900
|
+
options.message || `${JSON.stringify(options.actual)} ${options.operator} ${JSON.stringify(options.expected)}`
|
|
22901
|
+
);
|
|
22902
|
+
this.name = "AssertionError";
|
|
22903
|
+
this.actual = options.actual;
|
|
22904
|
+
this.expected = options.expected;
|
|
22905
|
+
this.operator = options.operator;
|
|
22906
|
+
}
|
|
22907
|
+
};
|
|
22908
|
+
}
|
|
22909
|
+
});
|
|
22910
|
+
|
|
22822
22911
|
// src/utils/sequence-matcher.ts
|
|
22823
22912
|
function diffStringArrays(oldArr, newArr) {
|
|
22824
22913
|
const opcodes = getOpcodes(oldArr, newArr);
|
|
@@ -23669,6 +23758,7 @@ var init_diff = __esm({
|
|
|
23669
23758
|
init_when_json_met_bigint();
|
|
23670
23759
|
init_utils();
|
|
23671
23760
|
init_mocks();
|
|
23761
|
+
init_deep_strict_equal();
|
|
23672
23762
|
init_sequence_matcher();
|
|
23673
23763
|
init_dialect();
|
|
23674
23764
|
init_utils2();
|
|
@@ -24280,10 +24370,12 @@ var init_diff = __esm({
|
|
|
24280
24370
|
const columnAlters = alters.filter((it) => it.entityType === "columns").filter((it) => {
|
|
24281
24371
|
if (it.default && (it.$left.type === "json" && it.$right.type === "json" || it.$left.type === "jsonb" && it.$right.type === "jsonb")) {
|
|
24282
24372
|
if (it.default.from !== null && it.default.to !== null) {
|
|
24283
|
-
const
|
|
24284
|
-
const
|
|
24285
|
-
|
|
24373
|
+
const parsedLeft = parse(trimChar(it.default.from, "'"));
|
|
24374
|
+
const parsedRight = parse(trimChar(it.default.to, "'"));
|
|
24375
|
+
try {
|
|
24376
|
+
deepStrictEqual(parsedLeft, parsedRight);
|
|
24286
24377
|
delete it.default;
|
|
24378
|
+
} catch {
|
|
24287
24379
|
}
|
|
24288
24380
|
}
|
|
24289
24381
|
}
|
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
|
-
|
|
23811
|
-
|
|
23812
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 = {};
|
|
@@ -39027,6 +39049,82 @@ var init_mocks = __esm({
|
|
|
39027
39049
|
}
|
|
39028
39050
|
});
|
|
39029
39051
|
|
|
39052
|
+
// src/utils/node-assert/deep-strict-equal.ts
|
|
39053
|
+
function deepStrictEqualInternal(actual, expected) {
|
|
39054
|
+
if (actual === expected) {
|
|
39055
|
+
return true;
|
|
39056
|
+
}
|
|
39057
|
+
if (actual === null || expected === null) {
|
|
39058
|
+
return false;
|
|
39059
|
+
}
|
|
39060
|
+
if (typeof actual !== "object" || typeof expected !== "object") {
|
|
39061
|
+
return false;
|
|
39062
|
+
}
|
|
39063
|
+
if (Array.isArray(actual) && Array.isArray(expected)) {
|
|
39064
|
+
if (actual.length !== expected.length) {
|
|
39065
|
+
return false;
|
|
39066
|
+
}
|
|
39067
|
+
for (let i6 = 0; i6 < actual.length; i6++) {
|
|
39068
|
+
if (!deepStrictEqualInternal(actual[i6], expected[i6])) {
|
|
39069
|
+
return false;
|
|
39070
|
+
}
|
|
39071
|
+
}
|
|
39072
|
+
return true;
|
|
39073
|
+
}
|
|
39074
|
+
if (Array.isArray(actual) !== Array.isArray(expected)) {
|
|
39075
|
+
return false;
|
|
39076
|
+
}
|
|
39077
|
+
const actualObj = actual;
|
|
39078
|
+
const expectedObj = expected;
|
|
39079
|
+
const actualKeys = Object.keys(actualObj);
|
|
39080
|
+
const expectedKeys = Object.keys(expectedObj);
|
|
39081
|
+
if (actualKeys.length !== expectedKeys.length) {
|
|
39082
|
+
return false;
|
|
39083
|
+
}
|
|
39084
|
+
for (const key of actualKeys) {
|
|
39085
|
+
if (!Object.prototype.hasOwnProperty.call(expectedObj, key)) {
|
|
39086
|
+
return false;
|
|
39087
|
+
}
|
|
39088
|
+
if (!deepStrictEqualInternal(actualObj[key], expectedObj[key])) {
|
|
39089
|
+
return false;
|
|
39090
|
+
}
|
|
39091
|
+
}
|
|
39092
|
+
return true;
|
|
39093
|
+
}
|
|
39094
|
+
function deepStrictEqual(actual, expected, message) {
|
|
39095
|
+
if (!deepStrictEqualInternal(actual, expected)) {
|
|
39096
|
+
if (message instanceof Error) {
|
|
39097
|
+
throw message;
|
|
39098
|
+
}
|
|
39099
|
+
throw new AssertionError({
|
|
39100
|
+
message: message || `Expected values to be strictly deep-equal`,
|
|
39101
|
+
actual,
|
|
39102
|
+
expected,
|
|
39103
|
+
operator: "deepStrictEqual"
|
|
39104
|
+
});
|
|
39105
|
+
}
|
|
39106
|
+
}
|
|
39107
|
+
var AssertionError;
|
|
39108
|
+
var init_deep_strict_equal = __esm({
|
|
39109
|
+
"src/utils/node-assert/deep-strict-equal.ts"() {
|
|
39110
|
+
"use strict";
|
|
39111
|
+
AssertionError = class extends Error {
|
|
39112
|
+
actual;
|
|
39113
|
+
expected;
|
|
39114
|
+
operator;
|
|
39115
|
+
constructor(options) {
|
|
39116
|
+
super(
|
|
39117
|
+
options.message || `${JSON.stringify(options.actual)} ${options.operator} ${JSON.stringify(options.expected)}`
|
|
39118
|
+
);
|
|
39119
|
+
this.name = "AssertionError";
|
|
39120
|
+
this.actual = options.actual;
|
|
39121
|
+
this.expected = options.expected;
|
|
39122
|
+
this.operator = options.operator;
|
|
39123
|
+
}
|
|
39124
|
+
};
|
|
39125
|
+
}
|
|
39126
|
+
});
|
|
39127
|
+
|
|
39030
39128
|
// src/utils/sequence-matcher.ts
|
|
39031
39129
|
function diffStringArrays(oldArr, newArr) {
|
|
39032
39130
|
const opcodes = getOpcodes(oldArr, newArr);
|
|
@@ -39877,6 +39975,7 @@ var init_diff = __esm({
|
|
|
39877
39975
|
init_when_json_met_bigint();
|
|
39878
39976
|
init_utils2();
|
|
39879
39977
|
init_mocks();
|
|
39978
|
+
init_deep_strict_equal();
|
|
39880
39979
|
init_sequence_matcher();
|
|
39881
39980
|
init_dialect();
|
|
39882
39981
|
init_utils3();
|
|
@@ -40489,10 +40588,12 @@ var init_diff = __esm({
|
|
|
40489
40588
|
var _a5, _b;
|
|
40490
40589
|
if (it2.default && (it2.$left.type === "json" && it2.$right.type === "json" || it2.$left.type === "jsonb" && it2.$right.type === "jsonb")) {
|
|
40491
40590
|
if (it2.default.from !== null && it2.default.to !== null) {
|
|
40492
|
-
const
|
|
40493
|
-
const
|
|
40494
|
-
|
|
40591
|
+
const parsedLeft = parse(trimChar(it2.default.from, "'"));
|
|
40592
|
+
const parsedRight = parse(trimChar(it2.default.to, "'"));
|
|
40593
|
+
try {
|
|
40594
|
+
deepStrictEqual(parsedLeft, parsedRight);
|
|
40495
40595
|
delete it2.default;
|
|
40596
|
+
} catch {
|
|
40496
40597
|
}
|
|
40497
40598
|
}
|
|
40498
40599
|
}
|
|
@@ -42576,6 +42677,10 @@ var init_diff3 = __esm({
|
|
|
42576
42677
|
if (it2.nameExplicit) {
|
|
42577
42678
|
delete it2.nameExplicit;
|
|
42578
42679
|
}
|
|
42680
|
+
if (it2.columns && it2.columns.to && it2.columns.from && it2.columns.from.length === it2.columns.to.length) {
|
|
42681
|
+
const unique = new Set(it2.columns.to);
|
|
42682
|
+
if (it2.columns.from.every((col) => unique.has(col))) delete it2.columns;
|
|
42683
|
+
}
|
|
42579
42684
|
return ddl22.pks.hasDiff(it2);
|
|
42580
42685
|
});
|
|
42581
42686
|
const fksAlters = updates.filter((it2) => it2.entityType === "fks").filter((it2) => {
|
|
@@ -171620,7 +171725,7 @@ import { sql } from "drizzle-orm"
|
|
|
171620
171725
|
createTableColumns3 = (columns, fks, pk, casing2) => {
|
|
171621
171726
|
let statement = "";
|
|
171622
171727
|
for (const it2 of columns) {
|
|
171623
|
-
const isPrimary = pk && pk.columns.length === 1 && pk.columns[0] === it2.name;
|
|
171728
|
+
const isPrimary = pk && pk.columns.length === 1 && pk.columns[0] === it2.name && pk.table === it2.table;
|
|
171624
171729
|
statement += " ";
|
|
171625
171730
|
statement += column8(it2.type, it2.name, it2.default, casing2);
|
|
171626
171731
|
statement += isPrimary ? `.primaryKey(${it2.autoincrement ? "{ autoIncrement: true }" : ""})` : "";
|
|
@@ -171702,7 +171807,7 @@ import { sql } from "drizzle-orm"
|
|
|
171702
171807
|
}).join(", ")}]`;
|
|
171703
171808
|
statement += `${pk.name ? `, name: "${pk.name}"` : ""}}`;
|
|
171704
171809
|
statement += ")";
|
|
171705
|
-
statement +=
|
|
171810
|
+
statement += `,
|
|
171706
171811
|
`;
|
|
171707
171812
|
return statement;
|
|
171708
171813
|
};
|