drizzle-kit 0.23.0-c31ad13 → 0.23.0-eb2ca29
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +10 -7
- package/package.json +1 -1
- package/payload.js +10 -7
- package/payload.mjs +10 -7
package/bin.cjs
CHANGED
@@ -20190,7 +20190,6 @@ var init_sqlgenerator = __esm({
|
|
20190
20190
|
statement += `PRIMARY KEY(${it.map((it2) => `\`${it2}\``).join(", ")})`;
|
20191
20191
|
});
|
20192
20192
|
for (let i2 = 0; i2 < referenceData.length; i2++) {
|
20193
|
-
const referenceAsString = referenceData[i2];
|
20194
20193
|
const {
|
20195
20194
|
name,
|
20196
20195
|
tableFrom,
|
@@ -20199,7 +20198,7 @@ var init_sqlgenerator = __esm({
|
|
20199
20198
|
columnsTo,
|
20200
20199
|
onDelete,
|
20201
20200
|
onUpdate
|
20202
|
-
} =
|
20201
|
+
} = referenceData[i2];
|
20203
20202
|
const onDeleteStatement = onDelete ? ` ON DELETE ${onDelete}` : "";
|
20204
20203
|
const onUpdateStatement = onUpdate ? ` ON UPDATE ${onUpdate}` : "";
|
20205
20204
|
const fromColumnsString = columnsFrom.map((it) => `\`${it}\``).join(",");
|
@@ -24622,17 +24621,20 @@ var init_jsonStatements = __esm({
|
|
24622
24621
|
internals
|
24623
24622
|
};
|
24624
24623
|
};
|
24625
|
-
prepareSQLiteCreateTable = (table4) => {
|
24624
|
+
prepareSQLiteCreateTable = (table4, action) => {
|
24626
24625
|
const { name, columns, uniqueConstraints } = table4;
|
24627
24626
|
const references2 = Object.values(table4.foreignKeys);
|
24628
24627
|
const composites = Object.values(table4.compositePrimaryKeys).map(
|
24629
24628
|
(it) => SQLiteSquasher.unsquashPK(it)
|
24630
24629
|
);
|
24630
|
+
const fks = references2.map(
|
24631
|
+
(it) => action === "push" ? SQLiteSquasher.unsquashPushFK(it) : SQLiteSquasher.unsquashFK(it)
|
24632
|
+
);
|
24631
24633
|
return {
|
24632
24634
|
type: "sqlite_create_table",
|
24633
24635
|
tableName: name,
|
24634
24636
|
columns: Object.values(columns),
|
24635
|
-
referenceData:
|
24637
|
+
referenceData: fks,
|
24636
24638
|
compositePKs: composites,
|
24637
24639
|
uniqueConstraints: Object.values(uniqueConstraints)
|
24638
24640
|
};
|
@@ -26876,7 +26878,7 @@ var init_snapshotsDiffer = __esm({
|
|
26876
26878
|
_meta
|
26877
26879
|
};
|
26878
26880
|
};
|
26879
|
-
applySqliteSnapshotsDiff = async (json1, json2, tablesResolver2, columnsResolver2, prevFull, curFull) => {
|
26881
|
+
applySqliteSnapshotsDiff = async (json1, json2, tablesResolver2, columnsResolver2, prevFull, curFull, action) => {
|
26880
26882
|
const tablesDiff = diffSchemasOrTables(json1.tables, json2.tables);
|
26881
26883
|
const {
|
26882
26884
|
created: createdTables,
|
@@ -26953,7 +26955,7 @@ var init_snapshotsDiffer = __esm({
|
|
26953
26955
|
tablesMap[obj.name] = obj;
|
26954
26956
|
});
|
26955
26957
|
const jsonCreateTables = createdTables.map((it) => {
|
26956
|
-
return prepareSQLiteCreateTable(it);
|
26958
|
+
return prepareSQLiteCreateTable(it, action);
|
26957
26959
|
});
|
26958
26960
|
const jsonCreateIndexesForCreatedTables = createdTables.map((it) => {
|
26959
26961
|
return prepareCreateIndexesJson(
|
@@ -28818,7 +28820,8 @@ var init_migrate = __esm({
|
|
28818
28820
|
tablesResolver,
|
28819
28821
|
columnsResolver,
|
28820
28822
|
validatedPrev,
|
28821
|
-
validatedCur
|
28823
|
+
validatedCur,
|
28824
|
+
"push"
|
28822
28825
|
);
|
28823
28826
|
return {
|
28824
28827
|
sqlStatements,
|
package/package.json
CHANGED
package/payload.js
CHANGED
@@ -21402,17 +21402,20 @@ var init_jsonStatements = __esm({
|
|
21402
21402
|
internals
|
21403
21403
|
};
|
21404
21404
|
};
|
21405
|
-
prepareSQLiteCreateTable = (table4) => {
|
21405
|
+
prepareSQLiteCreateTable = (table4, action) => {
|
21406
21406
|
const { name: name2, columns, uniqueConstraints } = table4;
|
21407
21407
|
const references2 = Object.values(table4.foreignKeys);
|
21408
21408
|
const composites = Object.values(table4.compositePrimaryKeys).map(
|
21409
21409
|
(it) => SQLiteSquasher.unsquashPK(it)
|
21410
21410
|
);
|
21411
|
+
const fks = references2.map(
|
21412
|
+
(it) => action === "push" ? SQLiteSquasher.unsquashPushFK(it) : SQLiteSquasher.unsquashFK(it)
|
21413
|
+
);
|
21411
21414
|
return {
|
21412
21415
|
type: "sqlite_create_table",
|
21413
21416
|
tableName: name2,
|
21414
21417
|
columns: Object.values(columns),
|
21415
|
-
referenceData:
|
21418
|
+
referenceData: fks,
|
21416
21419
|
compositePKs: composites,
|
21417
21420
|
uniqueConstraints: Object.values(uniqueConstraints)
|
21418
21421
|
};
|
@@ -23684,7 +23687,7 @@ var init_snapshotsDiffer = __esm({
|
|
23684
23687
|
_meta
|
23685
23688
|
};
|
23686
23689
|
};
|
23687
|
-
applySqliteSnapshotsDiff = async (json1, json2, tablesResolver2, columnsResolver2, prevFull, curFull) => {
|
23690
|
+
applySqliteSnapshotsDiff = async (json1, json2, tablesResolver2, columnsResolver2, prevFull, curFull, action) => {
|
23688
23691
|
const tablesDiff = diffSchemasOrTables(json1.tables, json2.tables);
|
23689
23692
|
const {
|
23690
23693
|
created: createdTables,
|
@@ -23761,7 +23764,7 @@ var init_snapshotsDiffer = __esm({
|
|
23761
23764
|
tablesMap[obj.name] = obj;
|
23762
23765
|
});
|
23763
23766
|
const jsonCreateTables = createdTables.map((it) => {
|
23764
|
-
return prepareSQLiteCreateTable(it);
|
23767
|
+
return prepareSQLiteCreateTable(it, action);
|
23765
23768
|
});
|
23766
23769
|
const jsonCreateIndexesForCreatedTables = createdTables.map((it) => {
|
23767
23770
|
return prepareCreateIndexesJson(
|
@@ -24409,7 +24412,6 @@ var init_sqlgenerator = __esm({
|
|
24409
24412
|
statement += `PRIMARY KEY(${it.map((it2) => `\`${it2}\``).join(", ")})`;
|
24410
24413
|
});
|
24411
24414
|
for (let i = 0; i < referenceData.length; i++) {
|
24412
|
-
const referenceAsString = referenceData[i];
|
24413
24415
|
const {
|
24414
24416
|
name: name2,
|
24415
24417
|
tableFrom,
|
@@ -24418,7 +24420,7 @@ var init_sqlgenerator = __esm({
|
|
24418
24420
|
columnsTo,
|
24419
24421
|
onDelete,
|
24420
24422
|
onUpdate
|
24421
|
-
} =
|
24423
|
+
} = referenceData[i];
|
24422
24424
|
const onDeleteStatement = onDelete ? ` ON DELETE ${onDelete}` : "";
|
24423
24425
|
const onUpdateStatement = onUpdate ? ` ON UPDATE ${onUpdate}` : "";
|
24424
24426
|
const fromColumnsString = columnsFrom.map((it) => `\`${it}\``).join(",");
|
@@ -35694,7 +35696,8 @@ var pushSQLiteSchema = async (imports, drizzleInstance) => {
|
|
35694
35696
|
tablesResolver,
|
35695
35697
|
columnsResolver,
|
35696
35698
|
validatedPrev,
|
35697
|
-
validatedCur
|
35699
|
+
validatedCur,
|
35700
|
+
"push"
|
35698
35701
|
);
|
35699
35702
|
const { shouldAskForApprove, statementsToExecute, infoToPrint } = await logSuggestionsAndReturn(
|
35700
35703
|
db,
|
package/payload.mjs
CHANGED
@@ -21408,17 +21408,20 @@ var init_jsonStatements = __esm({
|
|
21408
21408
|
internals
|
21409
21409
|
};
|
21410
21410
|
};
|
21411
|
-
prepareSQLiteCreateTable = (table4) => {
|
21411
|
+
prepareSQLiteCreateTable = (table4, action) => {
|
21412
21412
|
const { name: name2, columns, uniqueConstraints } = table4;
|
21413
21413
|
const references2 = Object.values(table4.foreignKeys);
|
21414
21414
|
const composites = Object.values(table4.compositePrimaryKeys).map(
|
21415
21415
|
(it) => SQLiteSquasher.unsquashPK(it)
|
21416
21416
|
);
|
21417
|
+
const fks = references2.map(
|
21418
|
+
(it) => action === "push" ? SQLiteSquasher.unsquashPushFK(it) : SQLiteSquasher.unsquashFK(it)
|
21419
|
+
);
|
21417
21420
|
return {
|
21418
21421
|
type: "sqlite_create_table",
|
21419
21422
|
tableName: name2,
|
21420
21423
|
columns: Object.values(columns),
|
21421
|
-
referenceData:
|
21424
|
+
referenceData: fks,
|
21422
21425
|
compositePKs: composites,
|
21423
21426
|
uniqueConstraints: Object.values(uniqueConstraints)
|
21424
21427
|
};
|
@@ -23690,7 +23693,7 @@ var init_snapshotsDiffer = __esm({
|
|
23690
23693
|
_meta
|
23691
23694
|
};
|
23692
23695
|
};
|
23693
|
-
applySqliteSnapshotsDiff = async (json1, json2, tablesResolver2, columnsResolver2, prevFull, curFull) => {
|
23696
|
+
applySqliteSnapshotsDiff = async (json1, json2, tablesResolver2, columnsResolver2, prevFull, curFull, action) => {
|
23694
23697
|
const tablesDiff = diffSchemasOrTables(json1.tables, json2.tables);
|
23695
23698
|
const {
|
23696
23699
|
created: createdTables,
|
@@ -23767,7 +23770,7 @@ var init_snapshotsDiffer = __esm({
|
|
23767
23770
|
tablesMap[obj.name] = obj;
|
23768
23771
|
});
|
23769
23772
|
const jsonCreateTables = createdTables.map((it) => {
|
23770
|
-
return prepareSQLiteCreateTable(it);
|
23773
|
+
return prepareSQLiteCreateTable(it, action);
|
23771
23774
|
});
|
23772
23775
|
const jsonCreateIndexesForCreatedTables = createdTables.map((it) => {
|
23773
23776
|
return prepareCreateIndexesJson(
|
@@ -24415,7 +24418,6 @@ var init_sqlgenerator = __esm({
|
|
24415
24418
|
statement += `PRIMARY KEY(${it.map((it2) => `\`${it2}\``).join(", ")})`;
|
24416
24419
|
});
|
24417
24420
|
for (let i = 0; i < referenceData.length; i++) {
|
24418
|
-
const referenceAsString = referenceData[i];
|
24419
24421
|
const {
|
24420
24422
|
name: name2,
|
24421
24423
|
tableFrom,
|
@@ -24424,7 +24426,7 @@ var init_sqlgenerator = __esm({
|
|
24424
24426
|
columnsTo,
|
24425
24427
|
onDelete,
|
24426
24428
|
onUpdate
|
24427
|
-
} =
|
24429
|
+
} = referenceData[i];
|
24428
24430
|
const onDeleteStatement = onDelete ? ` ON DELETE ${onDelete}` : "";
|
24429
24431
|
const onUpdateStatement = onUpdate ? ` ON UPDATE ${onUpdate}` : "";
|
24430
24432
|
const fromColumnsString = columnsFrom.map((it) => `\`${it}\``).join(",");
|
@@ -35686,7 +35688,8 @@ var pushSQLiteSchema = async (imports, drizzleInstance) => {
|
|
35686
35688
|
tablesResolver,
|
35687
35689
|
columnsResolver,
|
35688
35690
|
validatedPrev,
|
35689
|
-
validatedCur
|
35691
|
+
validatedCur,
|
35692
|
+
"push"
|
35690
35693
|
);
|
35691
35694
|
const { shouldAskForApprove, statementsToExecute, infoToPrint } = await logSuggestionsAndReturn(
|
35692
35695
|
db,
|