drizzle-kit 0.20.6 → 0.20.7-05d4dfb
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 +31 -8
- package/package.json +1 -1
- package/utils.js +4 -4
package/bin.cjs
CHANGED
@@ -11983,8 +11983,8 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
11983
11983
|
}
|
11984
11984
|
for (const [key, value] of Object.entries(tableToPk)) {
|
11985
11985
|
result[key].compositePrimaryKeys = {
|
11986
|
-
[`${key}_${value.join("_")}
|
11987
|
-
name: `${key}_${value.join("_")}
|
11986
|
+
[`${key}_${value.join("_")}`]: {
|
11987
|
+
name: `${key}_${value.join("_")}`,
|
11988
11988
|
columns: value
|
11989
11989
|
}
|
11990
11990
|
};
|
@@ -17850,13 +17850,14 @@ var init_snapshotsDiffer = __esm({
|
|
17850
17850
|
jsonStatements.push(...jsonDropTables);
|
17851
17851
|
jsonStatements.push(...jsonRenameTables);
|
17852
17852
|
jsonStatements.push(...jsonRenameColumnsStatements);
|
17853
|
-
jsonStatements.push(...jsonDeletedCompositePKs);
|
17854
17853
|
if (dialect6 !== "mysql") {
|
17855
17854
|
jsonStatements.push(...jsonDeletedUniqueConstraints);
|
17856
17855
|
}
|
17857
17856
|
jsonStatements.push(...jsonDroppedReferencesForAlteredTables);
|
17858
17857
|
jsonStatements.push(...jsonDropIndexesForAllAlteredTables);
|
17858
|
+
jsonStatements.push(...jsonAddedCompositePKs);
|
17859
17859
|
jsonStatements.push(...jsonTableAlternations.alterColumns);
|
17860
|
+
jsonStatements.push(...jsonDeletedCompositePKs);
|
17860
17861
|
if (dialect6 === "mysql") {
|
17861
17862
|
jsonStatements.push(...jsonAddedUniqueConstraints);
|
17862
17863
|
jsonStatements.push(...jsonDeletedUniqueConstraints);
|
@@ -17868,7 +17869,6 @@ var init_snapshotsDiffer = __esm({
|
|
17868
17869
|
jsonStatements.push(...jsonTableAlternations.dropColumns);
|
17869
17870
|
if (dialect6 !== "sqlite")
|
17870
17871
|
jsonStatements.push(...jsonCreateReferences);
|
17871
|
-
jsonStatements.push(...jsonAddedCompositePKs);
|
17872
17872
|
jsonStatements.push(...jsonAlteredCompositePKs);
|
17873
17873
|
if (dialect6 !== "mysql") {
|
17874
17874
|
jsonStatements.push(...jsonAddedUniqueConstraints);
|
@@ -62158,7 +62158,7 @@ init_source();
|
|
62158
62158
|
// package.json
|
62159
62159
|
var package_default = {
|
62160
62160
|
name: "drizzle-kit",
|
62161
|
-
version: "0.20.
|
62161
|
+
version: "0.20.7",
|
62162
62162
|
repository: "https://github.com/drizzle-team/drizzle-kit-mirror",
|
62163
62163
|
author: "Drizzle Team",
|
62164
62164
|
license: "MIT",
|
@@ -62383,6 +62383,7 @@ init_source();
|
|
62383
62383
|
var import_hanji9 = __toESM(require_hanji());
|
62384
62384
|
init_mysqlSchema();
|
62385
62385
|
init_selector_ui();
|
62386
|
+
init_outputs();
|
62386
62387
|
var filterStatements = (statements, currentSchema, prevSchema) => {
|
62387
62388
|
return statements.filter((statement) => {
|
62388
62389
|
if (statement.type === "alter_table_alter_column_set_type") {
|
@@ -62426,7 +62427,8 @@ var filterStatements = (statements, currentSchema, prevSchema) => {
|
|
62426
62427
|
};
|
62427
62428
|
var logSuggestionsAndReturn = async ({
|
62428
62429
|
connection,
|
62429
|
-
statements
|
62430
|
+
statements,
|
62431
|
+
json2
|
62430
62432
|
}) => {
|
62431
62433
|
let shouldAskForApprove = false;
|
62432
62434
|
const statementsToExecute = [];
|
@@ -62512,7 +62514,6 @@ var logSuggestionsAndReturn = async ({
|
|
62512
62514
|
shouldAskForApprove = true;
|
62513
62515
|
}
|
62514
62516
|
}
|
62515
|
-
shouldAskForApprove = true;
|
62516
62517
|
} else if (statement.type === "alter_table_alter_column_set_notnull") {
|
62517
62518
|
if (typeof statement.columnDefault === "undefined") {
|
62518
62519
|
const res = await connection.query(
|
@@ -62534,6 +62535,16 @@ var logSuggestionsAndReturn = async ({
|
|
62534
62535
|
const res = await connection.query(
|
62535
62536
|
`select count(*) as count from \`${statement.tableName}\``
|
62536
62537
|
);
|
62538
|
+
if (Object.values(json2.tables[statement.tableName].columns).filter(
|
62539
|
+
(column7) => column7.autoincrement
|
62540
|
+
).length > 0) {
|
62541
|
+
console.log(
|
62542
|
+
`${withStyle.errorWarning(
|
62543
|
+
`You have removed the primary key from a ${statement.tableName} table without removing the auto-increment property from this table. As the database error states: 'there can be only one auto column, and it must be defined as a key. Make sure to remove autoincrement from ${statement.tableName} table`
|
62544
|
+
)}`
|
62545
|
+
);
|
62546
|
+
process.exit(1);
|
62547
|
+
}
|
62537
62548
|
const count = Number(res[0][0].count);
|
62538
62549
|
if (count > 0) {
|
62539
62550
|
infoToPrint.push(
|
@@ -62544,6 +62555,17 @@ var logSuggestionsAndReturn = async ({
|
|
62544
62555
|
tablesToTruncate.push(statement.tableName);
|
62545
62556
|
shouldAskForApprove = true;
|
62546
62557
|
}
|
62558
|
+
} else if (statement.type === "delete_composite_pk") {
|
62559
|
+
if (Object.values(json2.tables[statement.tableName].columns).filter(
|
62560
|
+
(column7) => column7.autoincrement
|
62561
|
+
).length > 0) {
|
62562
|
+
console.log(
|
62563
|
+
`${withStyle.errorWarning(
|
62564
|
+
`You have removed the primary key from a ${statement.tableName} table without removing the auto-increment property from this table. As the database error states: 'there can be only one auto column, and it must be defined as a key. Make sure to remove autoincrement from ${statement.tableName} table`
|
62565
|
+
)}`
|
62566
|
+
);
|
62567
|
+
process.exit(1);
|
62568
|
+
}
|
62547
62569
|
} else if (statement.type === "alter_table_add_column") {
|
62548
62570
|
if (statement.column.notNull && typeof statement.column.default === "undefined") {
|
62549
62571
|
const res = await connection.query(
|
@@ -63016,7 +63038,8 @@ var dbPushMysqlCommand = new import_commander.Command("push:mysql").option(
|
|
63016
63038
|
schemasToRemove
|
63017
63039
|
} = await logSuggestionsAndReturn({
|
63018
63040
|
connection: connection.client,
|
63019
|
-
statements: filteredStatements
|
63041
|
+
statements: filteredStatements,
|
63042
|
+
json2: statements == null ? void 0 : statements.validatedCur
|
63020
63043
|
});
|
63021
63044
|
const filteredSqlStatements = filteredStatements.map(
|
63022
63045
|
(filteredStatement) => fromJson([filteredStatement], "mysql")[0]
|
package/package.json
CHANGED
package/utils.js
CHANGED
@@ -11709,8 +11709,8 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
11709
11709
|
}
|
11710
11710
|
for (const [key, value] of Object.entries(tableToPk)) {
|
11711
11711
|
result[key].compositePrimaryKeys = {
|
11712
|
-
[`${key}_${value.join("_")}
|
11713
|
-
name: `${key}_${value.join("_")}
|
11712
|
+
[`${key}_${value.join("_")}`]: {
|
11713
|
+
name: `${key}_${value.join("_")}`,
|
11714
11714
|
columns: value
|
11715
11715
|
}
|
11716
11716
|
};
|
@@ -17568,13 +17568,14 @@ var init_snapshotsDiffer = __esm({
|
|
17568
17568
|
jsonStatements.push(...jsonDropTables);
|
17569
17569
|
jsonStatements.push(...jsonRenameTables);
|
17570
17570
|
jsonStatements.push(...jsonRenameColumnsStatements);
|
17571
|
-
jsonStatements.push(...jsonDeletedCompositePKs);
|
17572
17571
|
if (dialect6 !== "mysql") {
|
17573
17572
|
jsonStatements.push(...jsonDeletedUniqueConstraints);
|
17574
17573
|
}
|
17575
17574
|
jsonStatements.push(...jsonDroppedReferencesForAlteredTables);
|
17576
17575
|
jsonStatements.push(...jsonDropIndexesForAllAlteredTables);
|
17576
|
+
jsonStatements.push(...jsonAddedCompositePKs);
|
17577
17577
|
jsonStatements.push(...jsonTableAlternations.alterColumns);
|
17578
|
+
jsonStatements.push(...jsonDeletedCompositePKs);
|
17578
17579
|
if (dialect6 === "mysql") {
|
17579
17580
|
jsonStatements.push(...jsonAddedUniqueConstraints);
|
17580
17581
|
jsonStatements.push(...jsonDeletedUniqueConstraints);
|
@@ -17586,7 +17587,6 @@ var init_snapshotsDiffer = __esm({
|
|
17586
17587
|
jsonStatements.push(...jsonTableAlternations.dropColumns);
|
17587
17588
|
if (dialect6 !== "sqlite")
|
17588
17589
|
jsonStatements.push(...jsonCreateReferences);
|
17589
|
-
jsonStatements.push(...jsonAddedCompositePKs);
|
17590
17590
|
jsonStatements.push(...jsonAlteredCompositePKs);
|
17591
17591
|
if (dialect6 !== "mysql") {
|
17592
17592
|
jsonStatements.push(...jsonAddedUniqueConstraints);
|