drizzle-kit 0.22.3 → 0.22.5
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +5 -63
- package/package.json +2 -2
- package/payload.js +3 -61
- package/payload.mjs +3 -61
package/bin.cjs
CHANGED
@@ -9058,11 +9058,11 @@ var init_pgSchema = __esm({
|
|
9058
9058
|
},
|
9059
9059
|
squashIdxPush: (idx) => {
|
9060
9060
|
index2.parse(idx);
|
9061
|
-
return `${idx.name};${idx.columns.map((c) => `${c.isExpression ? "" : c.expression}
|
9061
|
+
return `${idx.name};${idx.columns.map((c) => `${c.isExpression ? "" : c.expression}--${c.asc}--${c.nulls}`).join(",,")};${idx.isUnique};${idx.method};${JSON.stringify(idx.with)}`;
|
9062
9062
|
},
|
9063
9063
|
unsquashIdxPush: (input) => {
|
9064
9064
|
const [name, columnsString, isUnique, method, idxWith] = input.split(";");
|
9065
|
-
const columnString = columnsString.split("
|
9065
|
+
const columnString = columnsString.split("--");
|
9066
9066
|
const columns = [];
|
9067
9067
|
for (const column7 of columnString) {
|
9068
9068
|
const [expression, asc, nulls, opclass] = column7.split(",");
|
@@ -23742,7 +23742,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
23742
23742
|
} = statement.data;
|
23743
23743
|
const indexPart = isUnique ? "UNIQUE INDEX" : "INDEX";
|
23744
23744
|
const value = columns.map(
|
23745
|
-
(it) => `${it.expression}${it.opclass ? ` ${it.opclass}` : it.asc ? "" : " DESC"}${it.asc && it.nulls && it.nulls === "last" || it.opclass ? "" : ` NULLS ${it.nulls.toUpperCase()}`}`
|
23745
|
+
(it) => `${it.isExpression ? it.expression : `"${it.expression}"`}${it.opclass ? ` ${it.opclass}` : it.asc ? "" : " DESC"}${it.asc && it.nulls && it.nulls === "last" || it.opclass ? "" : ` NULLS ${it.nulls.toUpperCase()}`}`
|
23746
23746
|
).join(",");
|
23747
23747
|
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
|
23748
23748
|
function reverseLogic(mappedWith) {
|
@@ -120410,64 +120410,6 @@ var init_pgPushUtils = __esm({
|
|
120410
120410
|
tablesToTruncate.push(statement.tableName);
|
120411
120411
|
shouldAskForApprove = true;
|
120412
120412
|
}
|
120413
|
-
} else if (statement.type === "alter_table_alter_column_drop_default") {
|
120414
|
-
if (statement.columnNotNull) {
|
120415
|
-
const res = await db2.query(
|
120416
|
-
`select count(*) as count from ${tableNameWithSchemaFrom(
|
120417
|
-
statement.schema,
|
120418
|
-
statement.tableName,
|
120419
|
-
renamedSchemas,
|
120420
|
-
renamedTables
|
120421
|
-
)}`
|
120422
|
-
);
|
120423
|
-
const count = Number(res[0].count);
|
120424
|
-
if (count > 0) {
|
120425
|
-
infoToPrint.push(
|
120426
|
-
`\xB7 You're about to remove default value from ${source_default.underline(
|
120427
|
-
statement.columnName
|
120428
|
-
)} not-null column with ${count} items`
|
120429
|
-
);
|
120430
|
-
tablesToTruncate.push(statement.tableName);
|
120431
|
-
statementsToExecute.push(
|
120432
|
-
`truncate table ${tableNameWithSchemaFrom(
|
120433
|
-
statement.schema,
|
120434
|
-
statement.tableName,
|
120435
|
-
renamedSchemas,
|
120436
|
-
renamedTables
|
120437
|
-
)} cascade;`
|
120438
|
-
);
|
120439
|
-
shouldAskForApprove = true;
|
120440
|
-
}
|
120441
|
-
}
|
120442
|
-
} else if (statement.type === "alter_table_alter_column_set_notnull") {
|
120443
|
-
if (typeof statement.columnDefault === "undefined") {
|
120444
|
-
const res = await db2.query(
|
120445
|
-
`select count(*) as count from ${tableNameWithSchemaFrom(
|
120446
|
-
statement.schema,
|
120447
|
-
statement.tableName,
|
120448
|
-
renamedSchemas,
|
120449
|
-
renamedTables
|
120450
|
-
)}`
|
120451
|
-
);
|
120452
|
-
const count = Number(res[0].count);
|
120453
|
-
if (count > 0) {
|
120454
|
-
infoToPrint.push(
|
120455
|
-
`\xB7 You're about to set not-null constraint to ${source_default.underline(
|
120456
|
-
statement.columnName
|
120457
|
-
)} column without default, which contains ${count} items`
|
120458
|
-
);
|
120459
|
-
tablesToTruncate.push(statement.tableName);
|
120460
|
-
statementsToExecute.push(
|
120461
|
-
`truncate table ${tableNameWithSchemaFrom(
|
120462
|
-
statement.schema,
|
120463
|
-
statement.tableName,
|
120464
|
-
renamedSchemas,
|
120465
|
-
renamedTables
|
120466
|
-
)} cascade;`
|
120467
|
-
);
|
120468
|
-
shouldAskForApprove = true;
|
120469
|
-
}
|
120470
|
-
}
|
120471
120413
|
} else if (statement.type === "alter_table_alter_column_drop_pk") {
|
120472
120414
|
const res = await db2.query(
|
120473
120415
|
`select count(*) as count from ${tableNameWithSchemaFrom(
|
@@ -122589,7 +122531,7 @@ var init_push = __esm({
|
|
122589
122531
|
}
|
122590
122532
|
}
|
122591
122533
|
} catch (e2) {
|
122592
|
-
console.
|
122534
|
+
console.error(e2);
|
122593
122535
|
}
|
122594
122536
|
};
|
122595
122537
|
sqlitePush = async (schemaPath, verbose, strict, credentials2, tablesFilter) => {
|
@@ -129560,7 +129502,7 @@ var printVersions = async () => {
|
|
129560
129502
|
var versions = async () => {
|
129561
129503
|
const { npmVersion } = await ormCoreVersions();
|
129562
129504
|
const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
|
129563
|
-
const envVersion = "0.22.
|
129505
|
+
const envVersion = "0.22.5";
|
129564
129506
|
const kitVersion = envVersion ? `v${envVersion}` : "--";
|
129565
129507
|
const versions2 = `drizzle-kit: ${kitVersion}
|
129566
129508
|
${ormVersion}`;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "drizzle-kit",
|
3
|
-
"version": "0.22.
|
3
|
+
"version": "0.22.5",
|
4
4
|
"repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
|
5
5
|
"author": "Drizzle Team",
|
6
6
|
"license": "MIT",
|
@@ -27,7 +27,7 @@
|
|
27
27
|
"@arethetypeswrong/cli": "^0.15.3",
|
28
28
|
"@aws-sdk/client-rds-data": "^3.556.0",
|
29
29
|
"@cloudflare/workers-types": "^4.20230518.0",
|
30
|
-
"@electric-sql/pglite": "^0.1.
|
30
|
+
"@electric-sql/pglite": "^0.1.5",
|
31
31
|
"@hono/node-server": "^1.9.0",
|
32
32
|
"@hono/zod-validator": "^0.2.1",
|
33
33
|
"@libsql/client": "^0.4.2",
|
package/payload.js
CHANGED
@@ -15191,11 +15191,11 @@ var init_pgSchema = __esm({
|
|
15191
15191
|
},
|
15192
15192
|
squashIdxPush: (idx) => {
|
15193
15193
|
index2.parse(idx);
|
15194
|
-
return `${idx.name};${idx.columns.map((c) => `${c.isExpression ? "" : c.expression}
|
15194
|
+
return `${idx.name};${idx.columns.map((c) => `${c.isExpression ? "" : c.expression}--${c.asc}--${c.nulls}`).join(",,")};${idx.isUnique};${idx.method};${JSON.stringify(idx.with)}`;
|
15195
15195
|
},
|
15196
15196
|
unsquashIdxPush: (input) => {
|
15197
15197
|
const [name2, columnsString, isUnique, method, idxWith] = input.split(";");
|
15198
|
-
const columnString = columnsString.split("
|
15198
|
+
const columnString = columnsString.split("--");
|
15199
15199
|
const columns = [];
|
15200
15200
|
for (const column4 of columnString) {
|
15201
15201
|
const [expression, asc2, nulls, opclass] = column4.split(",");
|
@@ -24359,7 +24359,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24359
24359
|
} = statement.data;
|
24360
24360
|
const indexPart = isUnique ? "UNIQUE INDEX" : "INDEX";
|
24361
24361
|
const value = columns.map(
|
24362
|
-
(it) => `${it.expression}${it.opclass ? ` ${it.opclass}` : it.asc ? "" : " DESC"}${it.asc && it.nulls && it.nulls === "last" || it.opclass ? "" : ` NULLS ${it.nulls.toUpperCase()}`}`
|
24362
|
+
(it) => `${it.isExpression ? it.expression : `"${it.expression}"`}${it.opclass ? ` ${it.opclass}` : it.asc ? "" : " DESC"}${it.asc && it.nulls && it.nulls === "last" || it.opclass ? "" : ` NULLS ${it.nulls.toUpperCase()}`}`
|
24363
24363
|
).join(",");
|
24364
24364
|
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
|
24365
24365
|
function reverseLogic(mappedWith) {
|
@@ -33468,64 +33468,6 @@ var pgSuggestions = async (db, statements) => {
|
|
33468
33468
|
tablesToTruncate.push(statement.tableName);
|
33469
33469
|
shouldAskForApprove = true;
|
33470
33470
|
}
|
33471
|
-
} else if (statement.type === "alter_table_alter_column_drop_default") {
|
33472
|
-
if (statement.columnNotNull) {
|
33473
|
-
const res = await db.query(
|
33474
|
-
`select count(*) as count from ${tableNameWithSchemaFrom(
|
33475
|
-
statement.schema,
|
33476
|
-
statement.tableName,
|
33477
|
-
renamedSchemas,
|
33478
|
-
renamedTables
|
33479
|
-
)}`
|
33480
|
-
);
|
33481
|
-
const count2 = Number(res[0].count);
|
33482
|
-
if (count2 > 0) {
|
33483
|
-
infoToPrint.push(
|
33484
|
-
`\xB7 You're about to remove default value from ${source_default.underline(
|
33485
|
-
statement.columnName
|
33486
|
-
)} not-null column with ${count2} items`
|
33487
|
-
);
|
33488
|
-
tablesToTruncate.push(statement.tableName);
|
33489
|
-
statementsToExecute.push(
|
33490
|
-
`truncate table ${tableNameWithSchemaFrom(
|
33491
|
-
statement.schema,
|
33492
|
-
statement.tableName,
|
33493
|
-
renamedSchemas,
|
33494
|
-
renamedTables
|
33495
|
-
)} cascade;`
|
33496
|
-
);
|
33497
|
-
shouldAskForApprove = true;
|
33498
|
-
}
|
33499
|
-
}
|
33500
|
-
} else if (statement.type === "alter_table_alter_column_set_notnull") {
|
33501
|
-
if (typeof statement.columnDefault === "undefined") {
|
33502
|
-
const res = await db.query(
|
33503
|
-
`select count(*) as count from ${tableNameWithSchemaFrom(
|
33504
|
-
statement.schema,
|
33505
|
-
statement.tableName,
|
33506
|
-
renamedSchemas,
|
33507
|
-
renamedTables
|
33508
|
-
)}`
|
33509
|
-
);
|
33510
|
-
const count2 = Number(res[0].count);
|
33511
|
-
if (count2 > 0) {
|
33512
|
-
infoToPrint.push(
|
33513
|
-
`\xB7 You're about to set not-null constraint to ${source_default.underline(
|
33514
|
-
statement.columnName
|
33515
|
-
)} column without default, which contains ${count2} items`
|
33516
|
-
);
|
33517
|
-
tablesToTruncate.push(statement.tableName);
|
33518
|
-
statementsToExecute.push(
|
33519
|
-
`truncate table ${tableNameWithSchemaFrom(
|
33520
|
-
statement.schema,
|
33521
|
-
statement.tableName,
|
33522
|
-
renamedSchemas,
|
33523
|
-
renamedTables
|
33524
|
-
)} cascade;`
|
33525
|
-
);
|
33526
|
-
shouldAskForApprove = true;
|
33527
|
-
}
|
33528
|
-
}
|
33529
33471
|
} else if (statement.type === "alter_table_alter_column_drop_pk") {
|
33530
33472
|
const res = await db.query(
|
33531
33473
|
`select count(*) as count from ${tableNameWithSchemaFrom(
|
package/payload.mjs
CHANGED
@@ -15197,11 +15197,11 @@ var init_pgSchema = __esm({
|
|
15197
15197
|
},
|
15198
15198
|
squashIdxPush: (idx) => {
|
15199
15199
|
index2.parse(idx);
|
15200
|
-
return `${idx.name};${idx.columns.map((c) => `${c.isExpression ? "" : c.expression}
|
15200
|
+
return `${idx.name};${idx.columns.map((c) => `${c.isExpression ? "" : c.expression}--${c.asc}--${c.nulls}`).join(",,")};${idx.isUnique};${idx.method};${JSON.stringify(idx.with)}`;
|
15201
15201
|
},
|
15202
15202
|
unsquashIdxPush: (input) => {
|
15203
15203
|
const [name2, columnsString, isUnique, method, idxWith] = input.split(";");
|
15204
|
-
const columnString = columnsString.split("
|
15204
|
+
const columnString = columnsString.split("--");
|
15205
15205
|
const columns = [];
|
15206
15206
|
for (const column4 of columnString) {
|
15207
15207
|
const [expression, asc2, nulls, opclass] = column4.split(",");
|
@@ -24365,7 +24365,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24365
24365
|
} = statement.data;
|
24366
24366
|
const indexPart = isUnique ? "UNIQUE INDEX" : "INDEX";
|
24367
24367
|
const value = columns.map(
|
24368
|
-
(it) => `${it.expression}${it.opclass ? ` ${it.opclass}` : it.asc ? "" : " DESC"}${it.asc && it.nulls && it.nulls === "last" || it.opclass ? "" : ` NULLS ${it.nulls.toUpperCase()}`}`
|
24368
|
+
(it) => `${it.isExpression ? it.expression : `"${it.expression}"`}${it.opclass ? ` ${it.opclass}` : it.asc ? "" : " DESC"}${it.asc && it.nulls && it.nulls === "last" || it.opclass ? "" : ` NULLS ${it.nulls.toUpperCase()}`}`
|
24369
24369
|
).join(",");
|
24370
24370
|
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
|
24371
24371
|
function reverseLogic(mappedWith) {
|
@@ -33460,64 +33460,6 @@ var pgSuggestions = async (db, statements) => {
|
|
33460
33460
|
tablesToTruncate.push(statement.tableName);
|
33461
33461
|
shouldAskForApprove = true;
|
33462
33462
|
}
|
33463
|
-
} else if (statement.type === "alter_table_alter_column_drop_default") {
|
33464
|
-
if (statement.columnNotNull) {
|
33465
|
-
const res = await db.query(
|
33466
|
-
`select count(*) as count from ${tableNameWithSchemaFrom(
|
33467
|
-
statement.schema,
|
33468
|
-
statement.tableName,
|
33469
|
-
renamedSchemas,
|
33470
|
-
renamedTables
|
33471
|
-
)}`
|
33472
|
-
);
|
33473
|
-
const count2 = Number(res[0].count);
|
33474
|
-
if (count2 > 0) {
|
33475
|
-
infoToPrint.push(
|
33476
|
-
`\xB7 You're about to remove default value from ${source_default.underline(
|
33477
|
-
statement.columnName
|
33478
|
-
)} not-null column with ${count2} items`
|
33479
|
-
);
|
33480
|
-
tablesToTruncate.push(statement.tableName);
|
33481
|
-
statementsToExecute.push(
|
33482
|
-
`truncate table ${tableNameWithSchemaFrom(
|
33483
|
-
statement.schema,
|
33484
|
-
statement.tableName,
|
33485
|
-
renamedSchemas,
|
33486
|
-
renamedTables
|
33487
|
-
)} cascade;`
|
33488
|
-
);
|
33489
|
-
shouldAskForApprove = true;
|
33490
|
-
}
|
33491
|
-
}
|
33492
|
-
} else if (statement.type === "alter_table_alter_column_set_notnull") {
|
33493
|
-
if (typeof statement.columnDefault === "undefined") {
|
33494
|
-
const res = await db.query(
|
33495
|
-
`select count(*) as count from ${tableNameWithSchemaFrom(
|
33496
|
-
statement.schema,
|
33497
|
-
statement.tableName,
|
33498
|
-
renamedSchemas,
|
33499
|
-
renamedTables
|
33500
|
-
)}`
|
33501
|
-
);
|
33502
|
-
const count2 = Number(res[0].count);
|
33503
|
-
if (count2 > 0) {
|
33504
|
-
infoToPrint.push(
|
33505
|
-
`\xB7 You're about to set not-null constraint to ${source_default.underline(
|
33506
|
-
statement.columnName
|
33507
|
-
)} column without default, which contains ${count2} items`
|
33508
|
-
);
|
33509
|
-
tablesToTruncate.push(statement.tableName);
|
33510
|
-
statementsToExecute.push(
|
33511
|
-
`truncate table ${tableNameWithSchemaFrom(
|
33512
|
-
statement.schema,
|
33513
|
-
statement.tableName,
|
33514
|
-
renamedSchemas,
|
33515
|
-
renamedTables
|
33516
|
-
)} cascade;`
|
33517
|
-
);
|
33518
|
-
shouldAskForApprove = true;
|
33519
|
-
}
|
33520
|
-
}
|
33521
33463
|
} else if (statement.type === "alter_table_alter_column_drop_pk") {
|
33522
33464
|
const res = await db.query(
|
33523
33465
|
`select count(*) as count from ${tableNameWithSchemaFrom(
|