drizzle-kit 0.19.13 → 0.20.0-baf960c
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/index.cjs +16676 -727
- package/index.d.ts +6 -0
- package/package.json +4 -2
- package/utils.js +37 -24
package/index.d.ts
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "drizzle-kit",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.20.0-baf960c",
|
4
4
|
"repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
|
5
5
|
"author": "Drizzle Team",
|
6
6
|
"license": "MIT",
|
@@ -64,9 +64,11 @@
|
|
64
64
|
"hanji": "^0.0.5",
|
65
65
|
"json-diff": "0.9.0",
|
66
66
|
"minimatch": "^7.4.3",
|
67
|
+
"wrangler": "^3.7.0",
|
67
68
|
"zod": "^3.20.2"
|
68
69
|
},
|
69
70
|
"devDependencies": {
|
71
|
+
"@cloudflare/workers-types": "^4.20230518.0",
|
70
72
|
"@libsql/client": "^0.1.6",
|
71
73
|
"@types/better-sqlite3": "^7.6.4",
|
72
74
|
"@types/dockerode": "^3.3.14",
|
@@ -80,7 +82,7 @@
|
|
80
82
|
"better-sqlite3": "^8.4.0",
|
81
83
|
"dockerode": "^3.3.4",
|
82
84
|
"dotenv": "^16.0.3",
|
83
|
-
"drizzle-orm": "0.
|
85
|
+
"drizzle-orm": "0.28.7-4e094f0",
|
84
86
|
"eslint": "^8.29.0",
|
85
87
|
"eslint-config-prettier": "^8.5.0",
|
86
88
|
"eslint-plugin-prettier": "^4.2.1",
|
package/utils.js
CHANGED
@@ -12696,6 +12696,13 @@ var init_serializer = __esm({
|
|
12696
12696
|
}
|
12697
12697
|
});
|
12698
12698
|
|
12699
|
+
// src/cli/validations/outputs.ts
|
12700
|
+
var init_outputs = __esm({
|
12701
|
+
"src/cli/validations/outputs.ts"() {
|
12702
|
+
init_source();
|
12703
|
+
}
|
12704
|
+
});
|
12705
|
+
|
12699
12706
|
// src/utils.ts
|
12700
12707
|
var utils_exports = {};
|
12701
12708
|
__export(utils_exports, {
|
@@ -13265,7 +13272,8 @@ var fk3 = objectType({
|
|
13265
13272
|
onDelete: stringType().optional()
|
13266
13273
|
}).strict();
|
13267
13274
|
var compositePK3 = objectType({
|
13268
|
-
columns: stringType().array()
|
13275
|
+
columns: stringType().array(),
|
13276
|
+
name: stringType()
|
13269
13277
|
}).strict();
|
13270
13278
|
var column3 = objectType({
|
13271
13279
|
name: stringType(),
|
@@ -13656,6 +13664,7 @@ init_serializer();
|
|
13656
13664
|
var import_hanji2 = __toESM(require_hanji());
|
13657
13665
|
init_views();
|
13658
13666
|
init_source();
|
13667
|
+
init_outputs();
|
13659
13668
|
var BREAKPOINT = "--> statement-breakpoint\n";
|
13660
13669
|
|
13661
13670
|
// src/sqlgenerator.ts
|
@@ -13886,7 +13895,7 @@ var MySQLAlterTableDropUniqueConstraintConvertor = class extends Convertor {
|
|
13886
13895
|
convert(statement) {
|
13887
13896
|
const unsquashed = MySqlSquasher.unsquashUnique(statement.data);
|
13888
13897
|
const tableNameWithSchema = statement.schema ? `\`${statement.schema}\`.\`${statement.tableName}\`` : `\`${statement.tableName}\``;
|
13889
|
-
return `ALTER TABLE ${tableNameWithSchema} DROP
|
13898
|
+
return `ALTER TABLE ${tableNameWithSchema} DROP INDEX \`${unsquashed.name}\`;`;
|
13890
13899
|
}
|
13891
13900
|
};
|
13892
13901
|
var SQLiteAlterTableAddUniqueConstraintConvertor = class extends Convertor {
|
@@ -14990,9 +14999,7 @@ var prepareMySqlCreateTableJson = (table4, json2) => {
|
|
14990
14999
|
schema: schema4,
|
14991
15000
|
columns: Object.values(columns),
|
14992
15001
|
compositePKs: Object.values(compositePrimaryKeys),
|
14993
|
-
compositePkName: Object.values(compositePrimaryKeys).length > 0 ? json2.tables[name].compositePrimaryKeys[
|
14994
|
-
Object.values(compositePrimaryKeys)[0]
|
14995
|
-
).columns.join("_")}`].name : "",
|
15002
|
+
compositePkName: Object.values(compositePrimaryKeys).length > 0 ? json2.tables[name].compositePrimaryKeys[MySqlSquasher.unsquashPK(Object.values(compositePrimaryKeys)[0]).name].name : "",
|
14996
15003
|
uniqueConstraints: Object.values(uniqueConstraints)
|
14997
15004
|
};
|
14998
15005
|
};
|
@@ -15513,7 +15520,7 @@ var prepareAddCompositePrimaryKeyMySql = (tableName, pks, json1, json2) => {
|
|
15513
15520
|
type: "create_composite_pk",
|
15514
15521
|
tableName,
|
15515
15522
|
data: it,
|
15516
|
-
constraintName: json2.tables[tableName].compositePrimaryKeys[
|
15523
|
+
constraintName: json2.tables[tableName].compositePrimaryKeys[unsquashed.name].name
|
15517
15524
|
});
|
15518
15525
|
}
|
15519
15526
|
return res;
|
@@ -15524,7 +15531,7 @@ var prepareDeleteCompositePrimaryKeyMySql = (tableName, pks, json1) => {
|
|
15524
15531
|
type: "delete_composite_pk",
|
15525
15532
|
tableName,
|
15526
15533
|
data: it,
|
15527
|
-
constraintName: json1.tables[tableName].compositePrimaryKeys[
|
15534
|
+
constraintName: json1.tables[tableName].compositePrimaryKeys[MySqlSquasher.unsquashPK(it).name].name
|
15528
15535
|
};
|
15529
15536
|
});
|
15530
15537
|
};
|
@@ -15535,8 +15542,8 @@ var prepareAlterCompositePrimaryKeyMySql = (tableName, pks, json1, json2) => {
|
|
15535
15542
|
tableName,
|
15536
15543
|
old: it.__old,
|
15537
15544
|
new: it.__new,
|
15538
|
-
oldConstraintName: json1.tables[tableName].compositePrimaryKeys[
|
15539
|
-
newConstraintName: json2.tables[tableName].compositePrimaryKeys[
|
15545
|
+
oldConstraintName: json1.tables[tableName].compositePrimaryKeys[MySqlSquasher.unsquashPK(it.__old).name].name,
|
15546
|
+
newConstraintName: json2.tables[tableName].compositePrimaryKeys[MySqlSquasher.unsquashPK(it.__new).name].name
|
15540
15547
|
};
|
15541
15548
|
});
|
15542
15549
|
};
|
@@ -15893,19 +15900,17 @@ var applySnapshotsDiff = async (json1, json2, dialect3, schemasResolver, tablesR
|
|
15893
15900
|
curFull
|
15894
15901
|
);
|
15895
15902
|
} else {
|
15896
|
-
|
15897
|
-
|
15898
|
-
|
15899
|
-
|
15900
|
-
|
15901
|
-
|
15902
|
-
|
15903
|
-
|
15904
|
-
|
15905
|
-
|
15906
|
-
|
15907
|
-
);
|
15908
|
-
}
|
15903
|
+
addedCompositePKs = prepareAddCompositePrimaryKeyMySql(
|
15904
|
+
it.name,
|
15905
|
+
it.addedCompositePKs,
|
15906
|
+
prevFull,
|
15907
|
+
curFull
|
15908
|
+
);
|
15909
|
+
deletedCompositePKs = prepareDeleteCompositePrimaryKeyMySql(
|
15910
|
+
it.name,
|
15911
|
+
it.deletedCompositePKs,
|
15912
|
+
prevFull
|
15913
|
+
);
|
15909
15914
|
alteredCompositePKs = prepareAlterCompositePrimaryKeyMySql(
|
15910
15915
|
it.name,
|
15911
15916
|
it.alteredCompositePKs,
|
@@ -16112,10 +16117,16 @@ var applySnapshotsDiff = async (json1, json2, dialect3, schemasResolver, tablesR
|
|
16112
16117
|
jsonStatements.push(...jsonRenameTables);
|
16113
16118
|
jsonStatements.push(...jsonRenameColumnsStatements);
|
16114
16119
|
jsonStatements.push(...jsonDeletedCompositePKs);
|
16115
|
-
|
16120
|
+
if (dialect3 !== "mysql") {
|
16121
|
+
jsonStatements.push(...jsonDeletedUniqueConstraints);
|
16122
|
+
}
|
16116
16123
|
jsonStatements.push(...jsonDroppedReferencesForAlteredTables);
|
16117
16124
|
jsonStatements.push(...jsonDropIndexesForAllAlteredTables);
|
16118
16125
|
jsonStatements.push(...jsonTableAlternations.alterColumns);
|
16126
|
+
if (dialect3 === "mysql") {
|
16127
|
+
jsonStatements.push(...jsonAddedUniqueConstraints);
|
16128
|
+
jsonStatements.push(...jsonDeletedUniqueConstraints);
|
16129
|
+
}
|
16119
16130
|
jsonStatements.push(...jsonTableAlternations.createColumns);
|
16120
16131
|
jsonStatements.push(...jsonCreateIndexesForCreatedTables);
|
16121
16132
|
jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
|
@@ -16125,7 +16136,9 @@ var applySnapshotsDiff = async (json1, json2, dialect3, schemasResolver, tablesR
|
|
16125
16136
|
jsonStatements.push(...jsonCreateReferences);
|
16126
16137
|
jsonStatements.push(...jsonAddedCompositePKs);
|
16127
16138
|
jsonStatements.push(...jsonAlteredCompositePKs);
|
16128
|
-
|
16139
|
+
if (dialect3 !== "mysql") {
|
16140
|
+
jsonStatements.push(...jsonAddedUniqueConstraints);
|
16141
|
+
}
|
16129
16142
|
jsonStatements.push(...jsonAlteredUniqueConstraints);
|
16130
16143
|
jsonStatements.push(...jsonSetTableSchemas);
|
16131
16144
|
jsonStatements.push(...filteredJsonSetNewTableSchemas);
|