drizzle-kit 0.21.4 → 0.22.0-18d9643
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 +1256 -526
- package/index.d.mts +6 -11
- package/index.d.ts +6 -11
- package/package.json +4 -4
- package/payload.d.mts +188 -20
- package/payload.d.ts +188 -20
- package/payload.js +2477 -1404
- package/payload.mjs +2507 -1425
- package/utils-studio.js +297 -31
- package/utils-studio.mjs +297 -31
- package/utils.js +141 -10
- package/utils.mjs +140 -10
package/utils.js
CHANGED
|
@@ -569,6 +569,7 @@ __export(utils_exports, {
|
|
|
569
569
|
copy: () => copy,
|
|
570
570
|
dryJournal: () => dryJournal,
|
|
571
571
|
kloudMeta: () => kloudMeta,
|
|
572
|
+
normaliseSQLiteUrl: () => normaliseSQLiteUrl,
|
|
572
573
|
objectValues: () => objectValues,
|
|
573
574
|
prepareMigrationFolder: () => prepareMigrationFolder,
|
|
574
575
|
prepareMigrationMeta: () => prepareMigrationMeta,
|
|
@@ -1077,7 +1078,10 @@ var info = (msg, greyMsg = "") => {
|
|
|
1077
1078
|
|
|
1078
1079
|
// src/global.ts
|
|
1079
1080
|
var originUUID = "00000000-0000-0000-0000-000000000000";
|
|
1080
|
-
var snapshotVersion = "
|
|
1081
|
+
var snapshotVersion = "7";
|
|
1082
|
+
function assertUnreachable(x) {
|
|
1083
|
+
throw new Error("Didn't expect to get here");
|
|
1084
|
+
}
|
|
1081
1085
|
|
|
1082
1086
|
// node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.mjs
|
|
1083
1087
|
var util;
|
|
@@ -4910,7 +4914,16 @@ var kitInternals = objectType({
|
|
|
4910
4914
|
objectType({ isDefaultAnExpression: booleanType().optional() }).optional()
|
|
4911
4915
|
)
|
|
4912
4916
|
}).optional()
|
|
4913
|
-
)
|
|
4917
|
+
).optional(),
|
|
4918
|
+
indexes: recordType(
|
|
4919
|
+
stringType(),
|
|
4920
|
+
objectType({
|
|
4921
|
+
columns: recordType(
|
|
4922
|
+
stringType(),
|
|
4923
|
+
objectType({ isExpression: booleanType().optional() }).optional()
|
|
4924
|
+
)
|
|
4925
|
+
}).optional()
|
|
4926
|
+
).optional()
|
|
4914
4927
|
}).optional();
|
|
4915
4928
|
var dialect = literalType("mysql");
|
|
4916
4929
|
var schemaHash = objectType({
|
|
@@ -5060,10 +5073,48 @@ var pgSchemaV1 = objectType({
|
|
|
5060
5073
|
tables: recordType(stringType(), tableV1),
|
|
5061
5074
|
enums: recordType(stringType(), enumSchemaV1)
|
|
5062
5075
|
}).strict();
|
|
5076
|
+
var indexColumn = objectType({
|
|
5077
|
+
expression: stringType(),
|
|
5078
|
+
isExpression: booleanType(),
|
|
5079
|
+
asc: booleanType(),
|
|
5080
|
+
nulls: stringType().optional(),
|
|
5081
|
+
opclass: stringType().optional()
|
|
5082
|
+
});
|
|
5063
5083
|
var index2 = objectType({
|
|
5084
|
+
name: stringType(),
|
|
5085
|
+
columns: indexColumn.array(),
|
|
5086
|
+
isUnique: booleanType(),
|
|
5087
|
+
with: recordType(stringType(), anyType()).optional(),
|
|
5088
|
+
method: stringType().default("btree"),
|
|
5089
|
+
where: stringType().optional(),
|
|
5090
|
+
concurrently: booleanType().default(false)
|
|
5091
|
+
}).strict();
|
|
5092
|
+
var indexV4 = objectType({
|
|
5064
5093
|
name: stringType(),
|
|
5065
5094
|
columns: stringType().array(),
|
|
5066
|
-
isUnique: booleanType()
|
|
5095
|
+
isUnique: booleanType(),
|
|
5096
|
+
with: recordType(stringType(), stringType()).optional(),
|
|
5097
|
+
method: stringType().default("btree"),
|
|
5098
|
+
where: stringType().optional(),
|
|
5099
|
+
concurrently: booleanType().default(false)
|
|
5100
|
+
}).strict();
|
|
5101
|
+
var indexV5 = objectType({
|
|
5102
|
+
name: stringType(),
|
|
5103
|
+
columns: stringType().array(),
|
|
5104
|
+
isUnique: booleanType(),
|
|
5105
|
+
with: recordType(stringType(), stringType()).optional(),
|
|
5106
|
+
method: stringType().default("btree"),
|
|
5107
|
+
where: stringType().optional(),
|
|
5108
|
+
concurrently: booleanType().default(false)
|
|
5109
|
+
}).strict();
|
|
5110
|
+
var indexV6 = objectType({
|
|
5111
|
+
name: stringType(),
|
|
5112
|
+
columns: stringType().array(),
|
|
5113
|
+
isUnique: booleanType(),
|
|
5114
|
+
with: recordType(stringType(), stringType()).optional(),
|
|
5115
|
+
method: stringType().default("btree"),
|
|
5116
|
+
where: stringType().optional(),
|
|
5117
|
+
concurrently: booleanType().default(false)
|
|
5067
5118
|
}).strict();
|
|
5068
5119
|
var fk2 = objectType({
|
|
5069
5120
|
name: stringType(),
|
|
@@ -5105,9 +5156,27 @@ var tableV42 = objectType({
|
|
|
5105
5156
|
name: stringType(),
|
|
5106
5157
|
schema: stringType(),
|
|
5107
5158
|
columns: recordType(stringType(), column2),
|
|
5108
|
-
indexes: recordType(stringType(),
|
|
5159
|
+
indexes: recordType(stringType(), indexV4),
|
|
5109
5160
|
foreignKeys: recordType(stringType(), fk2)
|
|
5110
5161
|
}).strict();
|
|
5162
|
+
var tableV6 = objectType({
|
|
5163
|
+
name: stringType(),
|
|
5164
|
+
schema: stringType(),
|
|
5165
|
+
columns: recordType(stringType(), column2),
|
|
5166
|
+
indexes: recordType(stringType(), indexV6),
|
|
5167
|
+
foreignKeys: recordType(stringType(), fk2),
|
|
5168
|
+
compositePrimaryKeys: recordType(stringType(), compositePK2),
|
|
5169
|
+
uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
|
|
5170
|
+
}).strict();
|
|
5171
|
+
var tableV5 = objectType({
|
|
5172
|
+
name: stringType(),
|
|
5173
|
+
schema: stringType(),
|
|
5174
|
+
columns: recordType(stringType(), column2),
|
|
5175
|
+
indexes: recordType(stringType(), indexV5),
|
|
5176
|
+
foreignKeys: recordType(stringType(), fk2),
|
|
5177
|
+
compositePrimaryKeys: recordType(stringType(), compositePK2),
|
|
5178
|
+
uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
|
|
5179
|
+
}).strict();
|
|
5111
5180
|
var table2 = objectType({
|
|
5112
5181
|
name: stringType(),
|
|
5113
5182
|
schema: stringType(),
|
|
@@ -5152,7 +5221,7 @@ var pgSchemaInternalV4 = objectType({
|
|
|
5152
5221
|
var pgSchemaInternalV5 = objectType({
|
|
5153
5222
|
version: literalType("5"),
|
|
5154
5223
|
dialect: literalType("pg"),
|
|
5155
|
-
tables: recordType(stringType(),
|
|
5224
|
+
tables: recordType(stringType(), tableV5),
|
|
5156
5225
|
enums: recordType(stringType(), enumSchemaV1),
|
|
5157
5226
|
schemas: recordType(stringType(), stringType()),
|
|
5158
5227
|
_meta: objectType({
|
|
@@ -5162,6 +5231,19 @@ var pgSchemaInternalV5 = objectType({
|
|
|
5162
5231
|
}),
|
|
5163
5232
|
internal: kitInternals2
|
|
5164
5233
|
}).strict();
|
|
5234
|
+
var pgSchemaInternalV6 = objectType({
|
|
5235
|
+
version: literalType("6"),
|
|
5236
|
+
dialect: literalType("postgresql"),
|
|
5237
|
+
tables: recordType(stringType(), tableV6),
|
|
5238
|
+
enums: recordType(stringType(), enumSchema),
|
|
5239
|
+
schemas: recordType(stringType(), stringType()),
|
|
5240
|
+
_meta: objectType({
|
|
5241
|
+
schemas: recordType(stringType(), stringType()),
|
|
5242
|
+
tables: recordType(stringType(), stringType()),
|
|
5243
|
+
columns: recordType(stringType(), stringType())
|
|
5244
|
+
}),
|
|
5245
|
+
internal: kitInternals2
|
|
5246
|
+
}).strict();
|
|
5165
5247
|
var pgSchemaExternal = objectType({
|
|
5166
5248
|
version: literalType("5"),
|
|
5167
5249
|
dialect: literalType("pg"),
|
|
@@ -5175,7 +5257,7 @@ var pgSchemaExternal = objectType({
|
|
|
5175
5257
|
})
|
|
5176
5258
|
}).strict();
|
|
5177
5259
|
var pgSchemaInternal = objectType({
|
|
5178
|
-
version: literalType("
|
|
5260
|
+
version: literalType("7"),
|
|
5179
5261
|
dialect: literalType("postgresql"),
|
|
5180
5262
|
tables: recordType(stringType(), table2),
|
|
5181
5263
|
enums: recordType(stringType(), enumSchema),
|
|
@@ -5210,18 +5292,30 @@ var pgSchemaSquashedV4 = objectType({
|
|
|
5210
5292
|
enums: recordType(stringType(), enumSchemaV1),
|
|
5211
5293
|
schemas: recordType(stringType(), stringType())
|
|
5212
5294
|
}).strict();
|
|
5213
|
-
var
|
|
5295
|
+
var pgSchemaSquashedV6 = objectType({
|
|
5214
5296
|
version: literalType("6"),
|
|
5215
5297
|
dialect: literalType("postgresql"),
|
|
5216
5298
|
tables: recordType(stringType(), tableSquashed2),
|
|
5217
5299
|
enums: recordType(stringType(), enumSchema),
|
|
5218
5300
|
schemas: recordType(stringType(), stringType())
|
|
5219
5301
|
}).strict();
|
|
5302
|
+
var pgSchemaSquashed = objectType({
|
|
5303
|
+
version: literalType("7"),
|
|
5304
|
+
dialect: literalType("postgresql"),
|
|
5305
|
+
tables: recordType(stringType(), tableSquashed2),
|
|
5306
|
+
enums: recordType(stringType(), enumSchema),
|
|
5307
|
+
schemas: recordType(stringType(), stringType())
|
|
5308
|
+
}).strict();
|
|
5220
5309
|
var pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
|
|
5221
5310
|
var pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
|
|
5222
5311
|
var pgSchemaV5 = pgSchemaInternalV5.merge(schemaHash2);
|
|
5312
|
+
var pgSchemaV6 = pgSchemaInternalV6.merge(schemaHash2);
|
|
5223
5313
|
var pgSchema = pgSchemaInternal.merge(schemaHash2);
|
|
5224
|
-
var backwardCompatiblePgSchema = unionType([
|
|
5314
|
+
var backwardCompatiblePgSchema = unionType([
|
|
5315
|
+
pgSchemaV5,
|
|
5316
|
+
pgSchemaV6,
|
|
5317
|
+
pgSchema
|
|
5318
|
+
]);
|
|
5225
5319
|
var dryPg = pgSchema.parse({
|
|
5226
5320
|
version: snapshotVersion,
|
|
5227
5321
|
dialect: "postgresql",
|
|
@@ -5310,6 +5404,17 @@ var schemaInternalV52 = objectType({
|
|
|
5310
5404
|
columns: recordType(stringType(), stringType())
|
|
5311
5405
|
})
|
|
5312
5406
|
}).strict();
|
|
5407
|
+
var kitInternals3 = objectType({
|
|
5408
|
+
indexes: recordType(
|
|
5409
|
+
stringType(),
|
|
5410
|
+
objectType({
|
|
5411
|
+
columns: recordType(
|
|
5412
|
+
stringType(),
|
|
5413
|
+
objectType({ isExpression: booleanType().optional() }).optional()
|
|
5414
|
+
)
|
|
5415
|
+
}).optional()
|
|
5416
|
+
).optional()
|
|
5417
|
+
}).optional();
|
|
5313
5418
|
var latestVersion = literalType("6");
|
|
5314
5419
|
var schemaInternal2 = objectType({
|
|
5315
5420
|
version: latestVersion,
|
|
@@ -5319,7 +5424,8 @@ var schemaInternal2 = objectType({
|
|
|
5319
5424
|
_meta: objectType({
|
|
5320
5425
|
tables: recordType(stringType(), stringType()),
|
|
5321
5426
|
columns: recordType(stringType(), stringType())
|
|
5322
|
-
})
|
|
5427
|
+
}),
|
|
5428
|
+
internal: kitInternals3
|
|
5323
5429
|
}).strict();
|
|
5324
5430
|
var schemaV32 = schemaInternalV32.merge(schemaHash3).strict();
|
|
5325
5431
|
var schemaV42 = schemaInternalV42.merge(schemaHash3).strict();
|
|
@@ -5356,6 +5462,7 @@ var backwardCompatibleSqliteSchema = unionType([sqliteSchemaV5, schema2]);
|
|
|
5356
5462
|
|
|
5357
5463
|
// src/utils.ts
|
|
5358
5464
|
var import_path = require("path");
|
|
5465
|
+
var import_url = require("url");
|
|
5359
5466
|
var copy = (it) => {
|
|
5360
5467
|
return JSON.parse(JSON.stringify(it));
|
|
5361
5468
|
};
|
|
@@ -5399,7 +5506,7 @@ var prepareOutFolder = (out, dialect3) => {
|
|
|
5399
5506
|
var validatorForDialect = (dialect3) => {
|
|
5400
5507
|
switch (dialect3) {
|
|
5401
5508
|
case "postgresql":
|
|
5402
|
-
return { validator: backwardCompatiblePgSchema, version:
|
|
5509
|
+
return { validator: backwardCompatiblePgSchema, version: 7 };
|
|
5403
5510
|
case "sqlite":
|
|
5404
5511
|
return { validator: backwardCompatibleSqliteSchema, version: 6 };
|
|
5405
5512
|
case "mysql":
|
|
@@ -5524,6 +5631,29 @@ var kloudMeta = () => {
|
|
|
5524
5631
|
sqlite: []
|
|
5525
5632
|
};
|
|
5526
5633
|
};
|
|
5634
|
+
var normaliseSQLiteUrl = (it, type) => {
|
|
5635
|
+
if (type === "libsql") {
|
|
5636
|
+
if (it.startsWith("file:")) {
|
|
5637
|
+
return it;
|
|
5638
|
+
}
|
|
5639
|
+
try {
|
|
5640
|
+
const url = (0, import_url.parse)(it);
|
|
5641
|
+
if (url.protocol === null) {
|
|
5642
|
+
return `file:${it}`;
|
|
5643
|
+
}
|
|
5644
|
+
return it;
|
|
5645
|
+
} catch (e) {
|
|
5646
|
+
return `file:${it}`;
|
|
5647
|
+
}
|
|
5648
|
+
}
|
|
5649
|
+
if (type === "better-sqlite") {
|
|
5650
|
+
if (it.startsWith("file:")) {
|
|
5651
|
+
return it.substring(5);
|
|
5652
|
+
}
|
|
5653
|
+
return it;
|
|
5654
|
+
}
|
|
5655
|
+
assertUnreachable(type);
|
|
5656
|
+
};
|
|
5527
5657
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5528
5658
|
0 && (module.exports = {
|
|
5529
5659
|
assertV1OutFolder,
|
|
@@ -5531,6 +5661,7 @@ var kloudMeta = () => {
|
|
|
5531
5661
|
copy,
|
|
5532
5662
|
dryJournal,
|
|
5533
5663
|
kloudMeta,
|
|
5664
|
+
normaliseSQLiteUrl,
|
|
5534
5665
|
objectValues,
|
|
5535
5666
|
prepareMigrationFolder,
|
|
5536
5667
|
prepareMigrationMeta,
|
package/utils.mjs
CHANGED
|
@@ -1068,7 +1068,10 @@ var info = (msg, greyMsg = "") => {
|
|
|
1068
1068
|
|
|
1069
1069
|
// src/global.ts
|
|
1070
1070
|
var originUUID = "00000000-0000-0000-0000-000000000000";
|
|
1071
|
-
var snapshotVersion = "
|
|
1071
|
+
var snapshotVersion = "7";
|
|
1072
|
+
function assertUnreachable(x) {
|
|
1073
|
+
throw new Error("Didn't expect to get here");
|
|
1074
|
+
}
|
|
1072
1075
|
|
|
1073
1076
|
// node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.mjs
|
|
1074
1077
|
var util;
|
|
@@ -4901,7 +4904,16 @@ var kitInternals = objectType({
|
|
|
4901
4904
|
objectType({ isDefaultAnExpression: booleanType().optional() }).optional()
|
|
4902
4905
|
)
|
|
4903
4906
|
}).optional()
|
|
4904
|
-
)
|
|
4907
|
+
).optional(),
|
|
4908
|
+
indexes: recordType(
|
|
4909
|
+
stringType(),
|
|
4910
|
+
objectType({
|
|
4911
|
+
columns: recordType(
|
|
4912
|
+
stringType(),
|
|
4913
|
+
objectType({ isExpression: booleanType().optional() }).optional()
|
|
4914
|
+
)
|
|
4915
|
+
}).optional()
|
|
4916
|
+
).optional()
|
|
4905
4917
|
}).optional();
|
|
4906
4918
|
var dialect = literalType("mysql");
|
|
4907
4919
|
var schemaHash = objectType({
|
|
@@ -5051,10 +5063,48 @@ var pgSchemaV1 = objectType({
|
|
|
5051
5063
|
tables: recordType(stringType(), tableV1),
|
|
5052
5064
|
enums: recordType(stringType(), enumSchemaV1)
|
|
5053
5065
|
}).strict();
|
|
5066
|
+
var indexColumn = objectType({
|
|
5067
|
+
expression: stringType(),
|
|
5068
|
+
isExpression: booleanType(),
|
|
5069
|
+
asc: booleanType(),
|
|
5070
|
+
nulls: stringType().optional(),
|
|
5071
|
+
opclass: stringType().optional()
|
|
5072
|
+
});
|
|
5054
5073
|
var index2 = objectType({
|
|
5074
|
+
name: stringType(),
|
|
5075
|
+
columns: indexColumn.array(),
|
|
5076
|
+
isUnique: booleanType(),
|
|
5077
|
+
with: recordType(stringType(), anyType()).optional(),
|
|
5078
|
+
method: stringType().default("btree"),
|
|
5079
|
+
where: stringType().optional(),
|
|
5080
|
+
concurrently: booleanType().default(false)
|
|
5081
|
+
}).strict();
|
|
5082
|
+
var indexV4 = objectType({
|
|
5055
5083
|
name: stringType(),
|
|
5056
5084
|
columns: stringType().array(),
|
|
5057
|
-
isUnique: booleanType()
|
|
5085
|
+
isUnique: booleanType(),
|
|
5086
|
+
with: recordType(stringType(), stringType()).optional(),
|
|
5087
|
+
method: stringType().default("btree"),
|
|
5088
|
+
where: stringType().optional(),
|
|
5089
|
+
concurrently: booleanType().default(false)
|
|
5090
|
+
}).strict();
|
|
5091
|
+
var indexV5 = objectType({
|
|
5092
|
+
name: stringType(),
|
|
5093
|
+
columns: stringType().array(),
|
|
5094
|
+
isUnique: booleanType(),
|
|
5095
|
+
with: recordType(stringType(), stringType()).optional(),
|
|
5096
|
+
method: stringType().default("btree"),
|
|
5097
|
+
where: stringType().optional(),
|
|
5098
|
+
concurrently: booleanType().default(false)
|
|
5099
|
+
}).strict();
|
|
5100
|
+
var indexV6 = objectType({
|
|
5101
|
+
name: stringType(),
|
|
5102
|
+
columns: stringType().array(),
|
|
5103
|
+
isUnique: booleanType(),
|
|
5104
|
+
with: recordType(stringType(), stringType()).optional(),
|
|
5105
|
+
method: stringType().default("btree"),
|
|
5106
|
+
where: stringType().optional(),
|
|
5107
|
+
concurrently: booleanType().default(false)
|
|
5058
5108
|
}).strict();
|
|
5059
5109
|
var fk2 = objectType({
|
|
5060
5110
|
name: stringType(),
|
|
@@ -5096,9 +5146,27 @@ var tableV42 = objectType({
|
|
|
5096
5146
|
name: stringType(),
|
|
5097
5147
|
schema: stringType(),
|
|
5098
5148
|
columns: recordType(stringType(), column2),
|
|
5099
|
-
indexes: recordType(stringType(),
|
|
5149
|
+
indexes: recordType(stringType(), indexV4),
|
|
5100
5150
|
foreignKeys: recordType(stringType(), fk2)
|
|
5101
5151
|
}).strict();
|
|
5152
|
+
var tableV6 = objectType({
|
|
5153
|
+
name: stringType(),
|
|
5154
|
+
schema: stringType(),
|
|
5155
|
+
columns: recordType(stringType(), column2),
|
|
5156
|
+
indexes: recordType(stringType(), indexV6),
|
|
5157
|
+
foreignKeys: recordType(stringType(), fk2),
|
|
5158
|
+
compositePrimaryKeys: recordType(stringType(), compositePK2),
|
|
5159
|
+
uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
|
|
5160
|
+
}).strict();
|
|
5161
|
+
var tableV5 = objectType({
|
|
5162
|
+
name: stringType(),
|
|
5163
|
+
schema: stringType(),
|
|
5164
|
+
columns: recordType(stringType(), column2),
|
|
5165
|
+
indexes: recordType(stringType(), indexV5),
|
|
5166
|
+
foreignKeys: recordType(stringType(), fk2),
|
|
5167
|
+
compositePrimaryKeys: recordType(stringType(), compositePK2),
|
|
5168
|
+
uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
|
|
5169
|
+
}).strict();
|
|
5102
5170
|
var table2 = objectType({
|
|
5103
5171
|
name: stringType(),
|
|
5104
5172
|
schema: stringType(),
|
|
@@ -5143,7 +5211,7 @@ var pgSchemaInternalV4 = objectType({
|
|
|
5143
5211
|
var pgSchemaInternalV5 = objectType({
|
|
5144
5212
|
version: literalType("5"),
|
|
5145
5213
|
dialect: literalType("pg"),
|
|
5146
|
-
tables: recordType(stringType(),
|
|
5214
|
+
tables: recordType(stringType(), tableV5),
|
|
5147
5215
|
enums: recordType(stringType(), enumSchemaV1),
|
|
5148
5216
|
schemas: recordType(stringType(), stringType()),
|
|
5149
5217
|
_meta: objectType({
|
|
@@ -5153,6 +5221,19 @@ var pgSchemaInternalV5 = objectType({
|
|
|
5153
5221
|
}),
|
|
5154
5222
|
internal: kitInternals2
|
|
5155
5223
|
}).strict();
|
|
5224
|
+
var pgSchemaInternalV6 = objectType({
|
|
5225
|
+
version: literalType("6"),
|
|
5226
|
+
dialect: literalType("postgresql"),
|
|
5227
|
+
tables: recordType(stringType(), tableV6),
|
|
5228
|
+
enums: recordType(stringType(), enumSchema),
|
|
5229
|
+
schemas: recordType(stringType(), stringType()),
|
|
5230
|
+
_meta: objectType({
|
|
5231
|
+
schemas: recordType(stringType(), stringType()),
|
|
5232
|
+
tables: recordType(stringType(), stringType()),
|
|
5233
|
+
columns: recordType(stringType(), stringType())
|
|
5234
|
+
}),
|
|
5235
|
+
internal: kitInternals2
|
|
5236
|
+
}).strict();
|
|
5156
5237
|
var pgSchemaExternal = objectType({
|
|
5157
5238
|
version: literalType("5"),
|
|
5158
5239
|
dialect: literalType("pg"),
|
|
@@ -5166,7 +5247,7 @@ var pgSchemaExternal = objectType({
|
|
|
5166
5247
|
})
|
|
5167
5248
|
}).strict();
|
|
5168
5249
|
var pgSchemaInternal = objectType({
|
|
5169
|
-
version: literalType("
|
|
5250
|
+
version: literalType("7"),
|
|
5170
5251
|
dialect: literalType("postgresql"),
|
|
5171
5252
|
tables: recordType(stringType(), table2),
|
|
5172
5253
|
enums: recordType(stringType(), enumSchema),
|
|
@@ -5201,18 +5282,30 @@ var pgSchemaSquashedV4 = objectType({
|
|
|
5201
5282
|
enums: recordType(stringType(), enumSchemaV1),
|
|
5202
5283
|
schemas: recordType(stringType(), stringType())
|
|
5203
5284
|
}).strict();
|
|
5204
|
-
var
|
|
5285
|
+
var pgSchemaSquashedV6 = objectType({
|
|
5205
5286
|
version: literalType("6"),
|
|
5206
5287
|
dialect: literalType("postgresql"),
|
|
5207
5288
|
tables: recordType(stringType(), tableSquashed2),
|
|
5208
5289
|
enums: recordType(stringType(), enumSchema),
|
|
5209
5290
|
schemas: recordType(stringType(), stringType())
|
|
5210
5291
|
}).strict();
|
|
5292
|
+
var pgSchemaSquashed = objectType({
|
|
5293
|
+
version: literalType("7"),
|
|
5294
|
+
dialect: literalType("postgresql"),
|
|
5295
|
+
tables: recordType(stringType(), tableSquashed2),
|
|
5296
|
+
enums: recordType(stringType(), enumSchema),
|
|
5297
|
+
schemas: recordType(stringType(), stringType())
|
|
5298
|
+
}).strict();
|
|
5211
5299
|
var pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
|
|
5212
5300
|
var pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
|
|
5213
5301
|
var pgSchemaV5 = pgSchemaInternalV5.merge(schemaHash2);
|
|
5302
|
+
var pgSchemaV6 = pgSchemaInternalV6.merge(schemaHash2);
|
|
5214
5303
|
var pgSchema = pgSchemaInternal.merge(schemaHash2);
|
|
5215
|
-
var backwardCompatiblePgSchema = unionType([
|
|
5304
|
+
var backwardCompatiblePgSchema = unionType([
|
|
5305
|
+
pgSchemaV5,
|
|
5306
|
+
pgSchemaV6,
|
|
5307
|
+
pgSchema
|
|
5308
|
+
]);
|
|
5216
5309
|
var dryPg = pgSchema.parse({
|
|
5217
5310
|
version: snapshotVersion,
|
|
5218
5311
|
dialect: "postgresql",
|
|
@@ -5301,6 +5394,17 @@ var schemaInternalV52 = objectType({
|
|
|
5301
5394
|
columns: recordType(stringType(), stringType())
|
|
5302
5395
|
})
|
|
5303
5396
|
}).strict();
|
|
5397
|
+
var kitInternals3 = objectType({
|
|
5398
|
+
indexes: recordType(
|
|
5399
|
+
stringType(),
|
|
5400
|
+
objectType({
|
|
5401
|
+
columns: recordType(
|
|
5402
|
+
stringType(),
|
|
5403
|
+
objectType({ isExpression: booleanType().optional() }).optional()
|
|
5404
|
+
)
|
|
5405
|
+
}).optional()
|
|
5406
|
+
).optional()
|
|
5407
|
+
}).optional();
|
|
5304
5408
|
var latestVersion = literalType("6");
|
|
5305
5409
|
var schemaInternal2 = objectType({
|
|
5306
5410
|
version: latestVersion,
|
|
@@ -5310,7 +5414,8 @@ var schemaInternal2 = objectType({
|
|
|
5310
5414
|
_meta: objectType({
|
|
5311
5415
|
tables: recordType(stringType(), stringType()),
|
|
5312
5416
|
columns: recordType(stringType(), stringType())
|
|
5313
|
-
})
|
|
5417
|
+
}),
|
|
5418
|
+
internal: kitInternals3
|
|
5314
5419
|
}).strict();
|
|
5315
5420
|
var schemaV32 = schemaInternalV32.merge(schemaHash3).strict();
|
|
5316
5421
|
var schemaV42 = schemaInternalV42.merge(schemaHash3).strict();
|
|
@@ -5347,6 +5452,7 @@ var backwardCompatibleSqliteSchema = unionType([sqliteSchemaV5, schema2]);
|
|
|
5347
5452
|
|
|
5348
5453
|
// src/utils.ts
|
|
5349
5454
|
import { join } from "path";
|
|
5455
|
+
import { parse } from "url";
|
|
5350
5456
|
var copy = (it) => {
|
|
5351
5457
|
return JSON.parse(JSON.stringify(it));
|
|
5352
5458
|
};
|
|
@@ -5390,7 +5496,7 @@ var prepareOutFolder = (out, dialect3) => {
|
|
|
5390
5496
|
var validatorForDialect = (dialect3) => {
|
|
5391
5497
|
switch (dialect3) {
|
|
5392
5498
|
case "postgresql":
|
|
5393
|
-
return { validator: backwardCompatiblePgSchema, version:
|
|
5499
|
+
return { validator: backwardCompatiblePgSchema, version: 7 };
|
|
5394
5500
|
case "sqlite":
|
|
5395
5501
|
return { validator: backwardCompatibleSqliteSchema, version: 6 };
|
|
5396
5502
|
case "mysql":
|
|
@@ -5515,12 +5621,36 @@ var kloudMeta = () => {
|
|
|
5515
5621
|
sqlite: []
|
|
5516
5622
|
};
|
|
5517
5623
|
};
|
|
5624
|
+
var normaliseSQLiteUrl = (it, type) => {
|
|
5625
|
+
if (type === "libsql") {
|
|
5626
|
+
if (it.startsWith("file:")) {
|
|
5627
|
+
return it;
|
|
5628
|
+
}
|
|
5629
|
+
try {
|
|
5630
|
+
const url = parse(it);
|
|
5631
|
+
if (url.protocol === null) {
|
|
5632
|
+
return `file:${it}`;
|
|
5633
|
+
}
|
|
5634
|
+
return it;
|
|
5635
|
+
} catch (e) {
|
|
5636
|
+
return `file:${it}`;
|
|
5637
|
+
}
|
|
5638
|
+
}
|
|
5639
|
+
if (type === "better-sqlite") {
|
|
5640
|
+
if (it.startsWith("file:")) {
|
|
5641
|
+
return it.substring(5);
|
|
5642
|
+
}
|
|
5643
|
+
return it;
|
|
5644
|
+
}
|
|
5645
|
+
assertUnreachable(type);
|
|
5646
|
+
};
|
|
5518
5647
|
export {
|
|
5519
5648
|
assertV1OutFolder,
|
|
5520
5649
|
columnRenameKey,
|
|
5521
5650
|
copy,
|
|
5522
5651
|
dryJournal,
|
|
5523
5652
|
kloudMeta,
|
|
5653
|
+
normaliseSQLiteUrl,
|
|
5524
5654
|
objectValues,
|
|
5525
5655
|
prepareMigrationFolder,
|
|
5526
5656
|
prepareMigrationMeta,
|