drizzle-kit 0.20.14-a183d8b → 0.20.14-c82ab68
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +4957 -4374
- package/cli/commands/migrate.d.ts +17 -17
- package/cli/commands/mysqlIntrospect.d.ts +8 -8
- package/cli/commands/mysqlUp.d.ts +2 -2
- package/cli/commands/pgIntrospect.d.ts +11 -8
- package/cli/commands/pgUp.d.ts +2 -2
- package/cli/commands/sqliteIntrospect.d.ts +8 -8
- package/cli/commands/utils.d.ts +4 -5
- package/cli/{index.d.ts → validations/cli.d.ts} +30 -20
- package/cli/validations/common.d.ts +1 -1
- package/global.d.ts +1 -1
- package/index.js +1 -0
- package/introspect-pg.d.ts +4 -1
- package/jsonStatements.d.ts +1 -1
- package/package.json +3 -1
- package/payload.js +565 -113
- package/payload.mjs +564 -113
- package/schemaValidator.d.ts +39 -39
- package/serializer/mysqlSchema.d.ts +1991 -753
- package/serializer/pgSchema.d.ts +1113 -788
- package/serializer/sqliteSchema.d.ts +144 -570
- package/snapshotsDiffer.d.ts +24 -20
- package/utils-studio.js +379 -9
- package/utils-studio.mjs +378 -9
- package/utils.d.ts +12 -12
- package/utils.js +146 -85
- package/utils.mjs +145 -85
- package/cli/commands/check.d.ts +0 -2
- package/cli/commands/drop.d.ts +0 -4
- package/cli/commands/push.d.ts +0 -6
- package/cli/commands/sqliteUp.d.ts +0 -2
- package/cli/utils.d.ts +0 -12
- package/cli/validations/studio.d.ts +0 -593
- package/orm-extenstions/d1-driver/driver.d.ts +0 -8
- package/orm-extenstions/d1-driver/session.d.ts +0 -51
- package/orm-extenstions/d1-driver/wrangler-client.d.ts +0 -3
- package/serializer/studioUtils.d.ts +0 -65
- package/utils/certs.d.ts +0 -4
package/payload.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
|
+
"use strict";
|
2
3
|
var __create = Object.create;
|
3
4
|
var __defProp = Object.defineProperty;
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
@@ -1078,6 +1079,7 @@ var require_hanji = __commonJS({
|
|
1078
1079
|
var import_hanji, info, error, schema, isRenamePromptItem, ResolveColumnSelect, ResolveTableSelect, ResolveSchemasSelect;
|
1079
1080
|
var init_views = __esm({
|
1080
1081
|
"src/cli/views.ts"() {
|
1082
|
+
"use strict";
|
1081
1083
|
init_source();
|
1082
1084
|
import_hanji = __toESM(require_hanji());
|
1083
1085
|
info = (msg, greyMsg = "") => {
|
@@ -1099,7 +1101,7 @@ var init_views = __esm({
|
|
1099
1101
|
)}`;
|
1100
1102
|
}).join("\n");
|
1101
1103
|
msg += "\n";
|
1102
|
-
const enums = Object.values(schema4["enums"] || {});
|
1104
|
+
const enums = Object.values("enums" in schema4 ? schema4["enums"] || {} : {});
|
1103
1105
|
if (enums.length > 0) {
|
1104
1106
|
msg += "\n";
|
1105
1107
|
msg += source_default.bold(`${enums.length} enums
|
@@ -1114,7 +1116,7 @@ var init_views = __esm({
|
|
1114
1116
|
return msg;
|
1115
1117
|
};
|
1116
1118
|
isRenamePromptItem = (item) => {
|
1117
|
-
return
|
1119
|
+
return "from" in item && "to" in item;
|
1118
1120
|
};
|
1119
1121
|
ResolveColumnSelect = class extends import_hanji.Prompt {
|
1120
1122
|
constructor(tableName, base, data) {
|
@@ -1262,6 +1264,7 @@ __export(mysqlImports_exports, {
|
|
1262
1264
|
var import_mysql_core, import_drizzle_orm, prepareFromExports, prepareFromMySqlImports;
|
1263
1265
|
var init_mysqlImports = __esm({
|
1264
1266
|
"src/serializer/mysqlImports.ts"() {
|
1267
|
+
"use strict";
|
1265
1268
|
import_mysql_core = require("drizzle-orm/mysql-core");
|
1266
1269
|
import_drizzle_orm = require("drizzle-orm");
|
1267
1270
|
init_utils();
|
@@ -1303,6 +1306,7 @@ var init_mysqlImports = __esm({
|
|
1303
1306
|
var withStyle;
|
1304
1307
|
var init_outputs = __esm({
|
1305
1308
|
"src/cli/validations/outputs.ts"() {
|
1309
|
+
"use strict";
|
1306
1310
|
init_source();
|
1307
1311
|
withStyle = {
|
1308
1312
|
error: (str) => `${source_default.red(`${source_default.white.bgRed(" Invalid input ")} ${str}`)}`,
|
@@ -1341,6 +1345,7 @@ function clearDefaults(defaultValue, collate) {
|
|
1341
1345
|
var import_mysql_core2, import_drizzle_orm2, import_mysql_core3, import_drizzle_orm3, dialect, indexName, generateMySqlSnapshot, fromDatabase;
|
1342
1346
|
var init_mysqlSerializer = __esm({
|
1343
1347
|
"src/serializer/mysqlSerializer.ts"() {
|
1348
|
+
"use strict";
|
1344
1349
|
import_mysql_core2 = require("drizzle-orm/mysql-core");
|
1345
1350
|
import_drizzle_orm2 = require("drizzle-orm");
|
1346
1351
|
import_mysql_core3 = require("drizzle-orm/mysql-core");
|
@@ -1556,7 +1561,8 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
1556
1561
|
lock: value.config.lock
|
1557
1562
|
};
|
1558
1563
|
});
|
1559
|
-
|
1564
|
+
const tableKey = `${schema4 || "public"}.${tableName}`;
|
1565
|
+
result[tableKey] = {
|
1560
1566
|
name: tableName,
|
1561
1567
|
schema: schema4,
|
1562
1568
|
columns: columnsObject,
|
@@ -1570,7 +1576,7 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
1570
1576
|
mysqlSchemas.map((it) => [it.schemaName, it.schemaName])
|
1571
1577
|
);
|
1572
1578
|
return {
|
1573
|
-
version: "
|
1579
|
+
version: "6",
|
1574
1580
|
dialect: "mysql",
|
1575
1581
|
tables: result,
|
1576
1582
|
schemas,
|
@@ -1825,7 +1831,7 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
1825
1831
|
}
|
1826
1832
|
const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
|
1827
1833
|
return {
|
1828
|
-
version: "
|
1834
|
+
version: "6",
|
1829
1835
|
dialect: "mysql",
|
1830
1836
|
tables: result,
|
1831
1837
|
schemas: schemasObject,
|
@@ -1850,6 +1856,7 @@ __export(pgSerializer_exports, {
|
|
1850
1856
|
var import_pg_core, import_pg_core2, import_drizzle_orm4, dialect2, indexName2, generatePgSnapshot, trimChar, fromDatabase2, columnToDefault, defaultForColumn;
|
1851
1857
|
var init_pgSerializer = __esm({
|
1852
1858
|
"src/serializer/pgSerializer.ts"() {
|
1859
|
+
"use strict";
|
1853
1860
|
import_pg_core = require("drizzle-orm/pg-core");
|
1854
1861
|
import_pg_core2 = require("drizzle-orm/pg-core");
|
1855
1862
|
import_drizzle_orm4 = require("drizzle-orm");
|
@@ -1985,7 +1992,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
1985
1992
|
const onUpdate = fk4.onUpdate;
|
1986
1993
|
const reference = fk4.reference();
|
1987
1994
|
const tableTo = (0, import_drizzle_orm4.getTableName)(reference.foreignTable);
|
1988
|
-
const schemaTo = (0, import_pg_core2.getTableConfig)(reference.foreignTable).schema
|
1995
|
+
const schemaTo = (0, import_pg_core2.getTableConfig)(reference.foreignTable).schema;
|
1989
1996
|
const columnsFrom = reference.columns.map((it) => it.name);
|
1990
1997
|
const columnsTo = reference.foreignColumns.map((it) => it.name);
|
1991
1998
|
return {
|
@@ -2040,7 +2047,8 @@ ${withStyle.errorWarning(
|
|
2040
2047
|
isUnique: value.config.unique ?? false
|
2041
2048
|
};
|
2042
2049
|
});
|
2043
|
-
|
2050
|
+
const tableKey = `${schema4 ?? "public"}.${tableName}`;
|
2051
|
+
result[tableKey] = {
|
2044
2052
|
name: tableName,
|
2045
2053
|
schema: schema4 ?? "",
|
2046
2054
|
columns: columnsObject,
|
@@ -2069,7 +2077,7 @@ ${withStyle.errorWarning(
|
|
2069
2077
|
}).map((it) => [it.schemaName, it.schemaName])
|
2070
2078
|
);
|
2071
2079
|
return {
|
2072
|
-
version: "
|
2080
|
+
version: "6",
|
2073
2081
|
dialect: "pg",
|
2074
2082
|
tables: result,
|
2075
2083
|
enums: enumsToReturn,
|
@@ -2417,7 +2425,7 @@ ${withStyle.errorWarning(
|
|
2417
2425
|
}
|
2418
2426
|
const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
|
2419
2427
|
return {
|
2420
|
-
version: "
|
2428
|
+
version: "6",
|
2421
2429
|
dialect: "pg",
|
2422
2430
|
tables: result,
|
2423
2431
|
enums: enumsToReturn,
|
@@ -2498,6 +2506,7 @@ __export(sqliteImports_exports, {
|
|
2498
2506
|
var import_sqlite_core, import_drizzle_orm5, prepareFromExports2, prepareFromSqliteImports;
|
2499
2507
|
var init_sqliteImports = __esm({
|
2500
2508
|
"src/serializer/sqliteImports.ts"() {
|
2509
|
+
"use strict";
|
2501
2510
|
import_sqlite_core = require("drizzle-orm/sqlite-core");
|
2502
2511
|
import_drizzle_orm5 = require("drizzle-orm");
|
2503
2512
|
init_utils();
|
@@ -2536,6 +2545,7 @@ __export(sqliteSerializer_exports, {
|
|
2536
2545
|
generateSqliteSnapshot: () => generateSqliteSnapshot
|
2537
2546
|
});
|
2538
2547
|
function mapSqlToSqliteType(sqlType) {
|
2548
|
+
const lowered = sqlType.toLowerCase();
|
2539
2549
|
if ([
|
2540
2550
|
"int",
|
2541
2551
|
"integer",
|
@@ -2547,24 +2557,27 @@ function mapSqlToSqliteType(sqlType) {
|
|
2547
2557
|
"unsigned big int",
|
2548
2558
|
"int2",
|
2549
2559
|
"int8"
|
2550
|
-
].
|
2560
|
+
].some((it) => lowered.startsWith(it))) {
|
2551
2561
|
return "integer";
|
2552
2562
|
} else if ([
|
2553
2563
|
"character",
|
2554
2564
|
"varchar",
|
2555
|
-
"
|
2565
|
+
"varying character",
|
2566
|
+
"national varying character",
|
2556
2567
|
"nchar",
|
2557
2568
|
"native character",
|
2558
2569
|
"nvarchar",
|
2559
2570
|
"text",
|
2560
2571
|
"clob"
|
2561
|
-
].some((it) =>
|
2572
|
+
].some((it) => lowered.startsWith(it))) {
|
2573
|
+
const match2 = lowered.match(/\d+/);
|
2574
|
+
if (match2) {
|
2575
|
+
return `text(${match2[0]})`;
|
2576
|
+
}
|
2562
2577
|
return "text";
|
2563
|
-
} else if (
|
2578
|
+
} else if (lowered.startsWith("blob")) {
|
2564
2579
|
return "blob";
|
2565
|
-
} else if (["real", "double", "double precision", "float"].
|
2566
|
-
sqlType.toLowerCase()
|
2567
|
-
)) {
|
2580
|
+
} else if (["real", "double", "double precision", "float"].some((it) => lowered.startsWith(it))) {
|
2568
2581
|
return "real";
|
2569
2582
|
} else {
|
2570
2583
|
return "numeric";
|
@@ -2573,6 +2586,7 @@ function mapSqlToSqliteType(sqlType) {
|
|
2573
2586
|
var import_drizzle_orm6, import_sqlite_core2, dialect3, generateSqliteSnapshot, fromDatabase3;
|
2574
2587
|
var init_sqliteSerializer = __esm({
|
2575
2588
|
"src/serializer/sqliteSerializer.ts"() {
|
2589
|
+
"use strict";
|
2576
2590
|
import_drizzle_orm6 = require("drizzle-orm");
|
2577
2591
|
import_sqlite_core2 = require("drizzle-orm/sqlite-core");
|
2578
2592
|
init_serializer();
|
@@ -2945,6 +2959,7 @@ WHERE
|
|
2945
2959
|
var import_fs, import_path, glob, sqlToStr, serializeMySql, serializePg, serializeSQLite, prepareFilenames;
|
2946
2960
|
var init_serializer = __esm({
|
2947
2961
|
"src/serializer/index.ts"() {
|
2962
|
+
"use strict";
|
2948
2963
|
import_fs = __toESM(require("fs"));
|
2949
2964
|
import_path = __toESM(require("path"));
|
2950
2965
|
glob = __toESM(require("glob"));
|
@@ -3015,11 +3030,15 @@ ${filenames.join("\n")}
|
|
3015
3030
|
});
|
3016
3031
|
|
3017
3032
|
// src/global.ts
|
3033
|
+
function assertUnreachable(x) {
|
3034
|
+
throw new Error("Didn't expect to get here");
|
3035
|
+
}
|
3018
3036
|
var originUUID, snapshotVersion, mapValues;
|
3019
3037
|
var init_global = __esm({
|
3020
3038
|
"src/global.ts"() {
|
3039
|
+
"use strict";
|
3021
3040
|
originUUID = "00000000-0000-0000-0000-000000000000";
|
3022
|
-
snapshotVersion = "
|
3041
|
+
snapshotVersion = "6";
|
3023
3042
|
mapValues = (obj, map) => {
|
3024
3043
|
const result = Object.keys(obj).reduce(function(result2, key) {
|
3025
3044
|
result2[key] = map(obj[key]);
|
@@ -6177,9 +6196,10 @@ var init_lib = __esm({
|
|
6177
6196
|
});
|
6178
6197
|
|
6179
6198
|
// src/serializer/mysqlSchema.ts
|
6180
|
-
var index, fk, column, tableV3, compositePK, uniqueConstraint, tableV4, table, dialect4, schemaHash, schemaInternalV3, schemaInternalV4,
|
6199
|
+
var index, fk, column, tableV3, compositePK, uniqueConstraint, tableV4, table, kitInternals, dialect4, schemaHash, schemaInternalV3, schemaInternalV4, schemaInternalV5, schemaInternalV6, schemaInternal, schemaV3, schemaV4, schemaV5, schema2, tableSquashedV4, tableSquashed, schemaSquashed, schemaSquashedV4, MySqlSquasher, squashMysqlScheme, mysqlSchema, mysqlSchemaV5, mysqlSchemaSquashed, backwardCompatibleMysqlSchema, dryMySql;
|
6181
6200
|
var init_mysqlSchema = __esm({
|
6182
6201
|
"src/serializer/mysqlSchema.ts"() {
|
6202
|
+
"use strict";
|
6183
6203
|
init_global();
|
6184
6204
|
init_lib();
|
6185
6205
|
index = objectType({
|
@@ -6238,6 +6258,17 @@ var init_mysqlSchema = __esm({
|
|
6238
6258
|
compositePrimaryKeys: recordType(stringType(), compositePK),
|
6239
6259
|
uniqueConstraints: recordType(stringType(), uniqueConstraint).default({})
|
6240
6260
|
}).strict();
|
6261
|
+
kitInternals = objectType({
|
6262
|
+
tables: recordType(
|
6263
|
+
stringType(),
|
6264
|
+
objectType({
|
6265
|
+
columns: recordType(
|
6266
|
+
stringType(),
|
6267
|
+
objectType({ isDefaultAnExpression: booleanType().optional() }).optional()
|
6268
|
+
)
|
6269
|
+
}).optional()
|
6270
|
+
)
|
6271
|
+
}).optional();
|
6241
6272
|
dialect4 = literalType("mysql");
|
6242
6273
|
schemaHash = objectType({
|
6243
6274
|
id: stringType(),
|
@@ -6254,18 +6285,7 @@ var init_mysqlSchema = __esm({
|
|
6254
6285
|
tables: recordType(stringType(), tableV4),
|
6255
6286
|
schemas: recordType(stringType(), stringType())
|
6256
6287
|
}).strict();
|
6257
|
-
|
6258
|
-
tables: recordType(
|
6259
|
-
stringType(),
|
6260
|
-
objectType({
|
6261
|
-
columns: recordType(
|
6262
|
-
stringType(),
|
6263
|
-
objectType({ isDefaultAnExpression: booleanType().optional() }).optional()
|
6264
|
-
)
|
6265
|
-
}).optional()
|
6266
|
-
)
|
6267
|
-
}).optional();
|
6268
|
-
schemaInternal = objectType({
|
6288
|
+
schemaInternalV5 = objectType({
|
6269
6289
|
version: literalType("5"),
|
6270
6290
|
dialect: dialect4,
|
6271
6291
|
tables: recordType(stringType(), table),
|
@@ -6277,8 +6297,33 @@ var init_mysqlSchema = __esm({
|
|
6277
6297
|
}),
|
6278
6298
|
internal: kitInternals
|
6279
6299
|
}).strict();
|
6300
|
+
schemaInternalV6 = objectType({
|
6301
|
+
version: literalType("6"),
|
6302
|
+
dialect: dialect4,
|
6303
|
+
tables: recordType(stringType(), table),
|
6304
|
+
schemas: recordType(stringType(), stringType()),
|
6305
|
+
_meta: objectType({
|
6306
|
+
schemas: recordType(stringType(), stringType()),
|
6307
|
+
tables: recordType(stringType(), stringType()),
|
6308
|
+
columns: recordType(stringType(), stringType())
|
6309
|
+
}),
|
6310
|
+
internal: kitInternals
|
6311
|
+
}).strict();
|
6312
|
+
schemaInternal = objectType({
|
6313
|
+
version: literalType("6"),
|
6314
|
+
dialect: dialect4,
|
6315
|
+
tables: recordType(stringType(), table),
|
6316
|
+
schemas: recordType(stringType(), stringType()),
|
6317
|
+
_meta: objectType({
|
6318
|
+
schemas: recordType(stringType(), stringType()),
|
6319
|
+
tables: recordType(stringType(), stringType()),
|
6320
|
+
columns: recordType(stringType(), stringType())
|
6321
|
+
}),
|
6322
|
+
internal: kitInternals
|
6323
|
+
}).strict();
|
6280
6324
|
schemaV3 = schemaInternalV3.merge(schemaHash);
|
6281
6325
|
schemaV4 = schemaInternalV4.merge(schemaHash);
|
6326
|
+
schemaV5 = schemaInternalV5.merge(schemaHash);
|
6282
6327
|
schema2 = schemaInternal.merge(schemaHash);
|
6283
6328
|
tableSquashedV4 = objectType({
|
6284
6329
|
name: stringType(),
|
@@ -6404,12 +6449,9 @@ var init_mysqlSchema = __esm({
|
|
6404
6449
|
};
|
6405
6450
|
};
|
6406
6451
|
mysqlSchema = schema2;
|
6452
|
+
mysqlSchemaV5 = schemaV5;
|
6407
6453
|
mysqlSchemaSquashed = schemaSquashed;
|
6408
|
-
backwardCompatibleMysqlSchema = unionType([
|
6409
|
-
schemaV3,
|
6410
|
-
schemaV4,
|
6411
|
-
schema2
|
6412
|
-
]);
|
6454
|
+
backwardCompatibleMysqlSchema = unionType([mysqlSchemaV5, schema2]);
|
6413
6455
|
dryMySql = mysqlSchema.parse({
|
6414
6456
|
version: snapshotVersion,
|
6415
6457
|
dialect: "mysql",
|
@@ -6427,9 +6469,10 @@ var init_mysqlSchema = __esm({
|
|
6427
6469
|
});
|
6428
6470
|
|
6429
6471
|
// src/serializer/pgSchema.ts
|
6430
|
-
var indexV2, columnV2, tableV2, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, index2, fk2, column2, tableV32, compositePK2, uniqueConstraint2, tableV42, table2, schemaHash2, pgSchemaInternalV3, pgSchemaInternalV4,
|
6472
|
+
var indexV2, columnV2, tableV2, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, index2, fk2, column2, tableV32, compositePK2, uniqueConstraint2, tableV42, table2, schemaHash2, kitInternals2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaExternal, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg;
|
6431
6473
|
var init_pgSchema = __esm({
|
6432
6474
|
"src/serializer/pgSchema.ts"() {
|
6475
|
+
"use strict";
|
6433
6476
|
init_global();
|
6434
6477
|
init_lib();
|
6435
6478
|
indexV2 = objectType({
|
@@ -6549,6 +6592,21 @@ var init_pgSchema = __esm({
|
|
6549
6592
|
id: stringType(),
|
6550
6593
|
prevId: stringType()
|
6551
6594
|
});
|
6595
|
+
kitInternals2 = objectType({
|
6596
|
+
tables: recordType(
|
6597
|
+
stringType(),
|
6598
|
+
objectType({
|
6599
|
+
columns: recordType(
|
6600
|
+
stringType(),
|
6601
|
+
objectType({
|
6602
|
+
isArray: booleanType().optional(),
|
6603
|
+
dimensions: numberType().optional(),
|
6604
|
+
rawType: stringType().optional()
|
6605
|
+
}).optional()
|
6606
|
+
)
|
6607
|
+
}).optional()
|
6608
|
+
)
|
6609
|
+
}).optional();
|
6552
6610
|
pgSchemaInternalV3 = objectType({
|
6553
6611
|
version: literalType("3"),
|
6554
6612
|
dialect: literalType("pg"),
|
@@ -6562,6 +6620,19 @@ var init_pgSchema = __esm({
|
|
6562
6620
|
enums: recordType(stringType(), enumSchema),
|
6563
6621
|
schemas: recordType(stringType(), stringType())
|
6564
6622
|
}).strict();
|
6623
|
+
pgSchemaInternalV5 = objectType({
|
6624
|
+
version: literalType("5"),
|
6625
|
+
dialect: literalType("pg"),
|
6626
|
+
tables: recordType(stringType(), table2),
|
6627
|
+
enums: recordType(stringType(), enumSchema),
|
6628
|
+
schemas: recordType(stringType(), stringType()),
|
6629
|
+
_meta: objectType({
|
6630
|
+
schemas: recordType(stringType(), stringType()),
|
6631
|
+
tables: recordType(stringType(), stringType()),
|
6632
|
+
columns: recordType(stringType(), stringType())
|
6633
|
+
}),
|
6634
|
+
internal: kitInternals2
|
6635
|
+
}).strict();
|
6565
6636
|
pgSchemaExternal = objectType({
|
6566
6637
|
version: literalType("5"),
|
6567
6638
|
dialect: literalType("pg"),
|
@@ -6574,23 +6645,8 @@ var init_pgSchema = __esm({
|
|
6574
6645
|
columns: recordType(stringType(), stringType())
|
6575
6646
|
})
|
6576
6647
|
}).strict();
|
6577
|
-
kitInternals2 = objectType({
|
6578
|
-
tables: recordType(
|
6579
|
-
stringType(),
|
6580
|
-
objectType({
|
6581
|
-
columns: recordType(
|
6582
|
-
stringType(),
|
6583
|
-
objectType({
|
6584
|
-
isArray: booleanType().optional(),
|
6585
|
-
dimensions: numberType().optional(),
|
6586
|
-
rawType: stringType().optional()
|
6587
|
-
}).optional()
|
6588
|
-
)
|
6589
|
-
}).optional()
|
6590
|
-
)
|
6591
|
-
}).optional();
|
6592
6648
|
pgSchemaInternal = objectType({
|
6593
|
-
version: literalType("
|
6649
|
+
version: literalType("6"),
|
6594
6650
|
dialect: literalType("pg"),
|
6595
6651
|
tables: recordType(stringType(), table2),
|
6596
6652
|
enums: recordType(stringType(), enumSchema),
|
@@ -6626,7 +6682,7 @@ var init_pgSchema = __esm({
|
|
6626
6682
|
schemas: recordType(stringType(), stringType())
|
6627
6683
|
}).strict();
|
6628
6684
|
pgSchemaSquashed = objectType({
|
6629
|
-
version: literalType("
|
6685
|
+
version: literalType("6"),
|
6630
6686
|
dialect: enumType(["pg"]),
|
6631
6687
|
tables: recordType(stringType(), tableSquashed2),
|
6632
6688
|
enums: recordType(stringType(), enumSchema),
|
@@ -6634,14 +6690,9 @@ var init_pgSchema = __esm({
|
|
6634
6690
|
}).strict();
|
6635
6691
|
pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
|
6636
6692
|
pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
|
6693
|
+
pgSchemaV5 = pgSchemaInternalV5.merge(schemaHash2);
|
6637
6694
|
pgSchema = pgSchemaInternal.merge(schemaHash2);
|
6638
|
-
backwardCompatiblePgSchema = unionType([
|
6639
|
-
pgSchemaV1,
|
6640
|
-
pgSchemaV2,
|
6641
|
-
pgSchemaV3,
|
6642
|
-
pgSchemaV4,
|
6643
|
-
pgSchema
|
6644
|
-
]);
|
6695
|
+
backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema]);
|
6645
6696
|
PgSquasher = {
|
6646
6697
|
squashIdx: (idx) => {
|
6647
6698
|
index2.parse(idx);
|
@@ -6657,7 +6708,7 @@ var init_pgSchema = __esm({
|
|
6657
6708
|
return result;
|
6658
6709
|
},
|
6659
6710
|
squashFK: (fk4) => {
|
6660
|
-
return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${fk4.onUpdate ?? ""};${fk4.onDelete ?? ""};${fk4.schemaTo
|
6711
|
+
return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${fk4.onUpdate ?? ""};${fk4.onDelete ?? ""};${fk4.schemaTo || "public"}`;
|
6661
6712
|
},
|
6662
6713
|
squashPK: (pk) => {
|
6663
6714
|
return `${pk.columns.join(",")};${pk.name}`;
|
@@ -6734,7 +6785,7 @@ var init_pgSchema = __esm({
|
|
6734
6785
|
})
|
6735
6786
|
);
|
6736
6787
|
return {
|
6737
|
-
version: "
|
6788
|
+
version: "6",
|
6738
6789
|
dialect: json.dialect,
|
6739
6790
|
tables: mappedTables,
|
6740
6791
|
enums: json.enums,
|
@@ -6762,6 +6813,7 @@ var init_pgSchema = __esm({
|
|
6762
6813
|
var index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3, table3, dialect5, schemaHash3, schemaInternalV32, schemaInternalV42, latestVersion, schemaInternal2, schemaV32, schemaV42, schema3, tableSquashed3, schemaSquashed2, SQLiteSquasher, squashSqliteScheme, drySQLite, sqliteSchema, SQLiteSchemaSquashed, backwardCompatibleSqliteSchema;
|
6763
6814
|
var init_sqliteSchema = __esm({
|
6764
6815
|
"src/serializer/sqliteSchema.ts"() {
|
6816
|
+
"use strict";
|
6765
6817
|
init_global();
|
6766
6818
|
init_lib();
|
6767
6819
|
index3 = objectType({
|
@@ -6946,7 +6998,7 @@ var init_sqliteSchema = __esm({
|
|
6946
6998
|
};
|
6947
6999
|
};
|
6948
7000
|
drySQLite = schema3.parse({
|
6949
|
-
version:
|
7001
|
+
version: "5",
|
6950
7002
|
dialect: "sqlite",
|
6951
7003
|
id: originUUID,
|
6952
7004
|
prevId: "",
|
@@ -6959,11 +7011,7 @@ var init_sqliteSchema = __esm({
|
|
6959
7011
|
});
|
6960
7012
|
sqliteSchema = schema3;
|
6961
7013
|
SQLiteSchemaSquashed = schemaSquashed2;
|
6962
|
-
backwardCompatibleSqliteSchema =
|
6963
|
-
schemaV32,
|
6964
|
-
schemaV42,
|
6965
|
-
schema3
|
6966
|
-
]);
|
7014
|
+
backwardCompatibleSqliteSchema = schema3;
|
6967
7015
|
}
|
6968
7016
|
});
|
6969
7017
|
|
@@ -6971,6 +7019,7 @@ var init_sqliteSchema = __esm({
|
|
6971
7019
|
var dialect6, commonSquashedSchema, commonSchema;
|
6972
7020
|
var init_schemaValidator = __esm({
|
6973
7021
|
"src/schemaValidator.ts"() {
|
7022
|
+
"use strict";
|
6974
7023
|
init_lib();
|
6975
7024
|
init_mysqlSchema();
|
6976
7025
|
init_pgSchema();
|
@@ -6993,6 +7042,7 @@ var init_schemaValidator = __esm({
|
|
6993
7042
|
var driver, configCommonSchema, introspectCasing, configIntrospectSchema, configIntrospectCliSchema, configGenerateSchema, configPushSchema, mysqlConnectionSchema, mySqlCliConfigSchema;
|
6994
7043
|
var init_common = __esm({
|
6995
7044
|
"src/cli/validations/common.ts"() {
|
7045
|
+
"use strict";
|
6996
7046
|
init_outputs();
|
6997
7047
|
init_lib();
|
6998
7048
|
init_schemaValidator();
|
@@ -7073,6 +7123,7 @@ var init_common = __esm({
|
|
7073
7123
|
var mysqlConnectionCli, mysql2credentials, mysqlConnectionConfig, mysqlConfigIntrospectSchema, mysqlCliIntrospectParams, mysqlCliPushParams, mysqlConfigPushParams;
|
7074
7124
|
var init_mysql = __esm({
|
7075
7125
|
"src/cli/validations/mysql.ts"() {
|
7126
|
+
"use strict";
|
7076
7127
|
init_lib();
|
7077
7128
|
init_utils();
|
7078
7129
|
init_common();
|
@@ -7133,6 +7184,7 @@ var init_mysql = __esm({
|
|
7133
7184
|
var pgConnectionCli, pgConnectionConfig, pgConfigIntrospectSchema, pgCliIntrospectParams, pgCliPushParams, pgConfigPushParams;
|
7134
7185
|
var init_pg = __esm({
|
7135
7186
|
"src/cli/validations/pg.ts"() {
|
7187
|
+
"use strict";
|
7136
7188
|
init_lib();
|
7137
7189
|
init_utils();
|
7138
7190
|
init_common();
|
@@ -7199,6 +7251,7 @@ var init_pg = __esm({
|
|
7199
7251
|
var sqliteConnectionCli, sqliteConnectionSchema, sqliteCliConfigSchema, sqliteCliIntrospectParams, sqliteCliPushParams, sqliteConfigPushParams;
|
7200
7252
|
var init_sqlite = __esm({
|
7201
7253
|
"src/cli/validations/sqlite.ts"() {
|
7254
|
+
"use strict";
|
7202
7255
|
init_lib();
|
7203
7256
|
init_utils();
|
7204
7257
|
init_common();
|
@@ -7267,6 +7320,7 @@ __export(es5_exports, {
|
|
7267
7320
|
var _, es5_default;
|
7268
7321
|
var init_es5 = __esm({
|
7269
7322
|
"src/cli/commands/_es5.ts"() {
|
7323
|
+
"use strict";
|
7270
7324
|
_ = "";
|
7271
7325
|
es5_default = _;
|
7272
7326
|
}
|
@@ -7368,20 +7422,20 @@ var require_ms = __commonJS({
|
|
7368
7422
|
function fmtLong(ms) {
|
7369
7423
|
var msAbs = Math.abs(ms);
|
7370
7424
|
if (msAbs >= d) {
|
7371
|
-
return
|
7425
|
+
return plural2(ms, msAbs, d, "day");
|
7372
7426
|
}
|
7373
7427
|
if (msAbs >= h) {
|
7374
|
-
return
|
7428
|
+
return plural2(ms, msAbs, h, "hour");
|
7375
7429
|
}
|
7376
7430
|
if (msAbs >= m) {
|
7377
|
-
return
|
7431
|
+
return plural2(ms, msAbs, m, "minute");
|
7378
7432
|
}
|
7379
7433
|
if (msAbs >= s) {
|
7380
|
-
return
|
7434
|
+
return plural2(ms, msAbs, s, "second");
|
7381
7435
|
}
|
7382
7436
|
return ms + " ms";
|
7383
7437
|
}
|
7384
|
-
function
|
7438
|
+
function plural2(ms, msAbs, n, name) {
|
7385
7439
|
var isPlural = msAbs >= n * 1.5;
|
7386
7440
|
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
7387
7441
|
}
|
@@ -12820,7 +12874,7 @@ var require_node2 = __commonJS({
|
|
12820
12874
|
...overrides
|
12821
12875
|
} = esbuildOptions;
|
12822
12876
|
const compile = function compile2(code, filename, format) {
|
12823
|
-
const
|
12877
|
+
const define2 = {
|
12824
12878
|
"import.meta.url": IMPORT_META_URL_VARIABLE_NAME,
|
12825
12879
|
...overrides.define
|
12826
12880
|
};
|
@@ -12839,7 +12893,7 @@ var require_node2 = __commonJS({
|
|
12839
12893
|
jsxFactory: options.jsxFactory,
|
12840
12894
|
jsxFragment: options.jsxFragment,
|
12841
12895
|
format,
|
12842
|
-
define,
|
12896
|
+
define: define2,
|
12843
12897
|
banner,
|
12844
12898
|
...overrides
|
12845
12899
|
});
|
@@ -12881,6 +12935,7 @@ var require_node2 = __commonJS({
|
|
12881
12935
|
var import_hanji2, assertES5, safeRegister;
|
12882
12936
|
var init_utils = __esm({
|
12883
12937
|
"src/cli/commands/utils.ts"() {
|
12938
|
+
"use strict";
|
12884
12939
|
init_serializer();
|
12885
12940
|
init_source();
|
12886
12941
|
init_views();
|
@@ -12944,6 +12999,7 @@ __export(pgImports_exports, {
|
|
12944
12999
|
var import_pg_core3, import_drizzle_orm7, prepareFromExports3, prepareFromPgImports;
|
12945
13000
|
var init_pgImports = __esm({
|
12946
13001
|
"src/serializer/pgImports.ts"() {
|
13002
|
+
"use strict";
|
12947
13003
|
import_pg_core3 = require("drizzle-orm/pg-core");
|
12948
13004
|
import_drizzle_orm7 = require("drizzle-orm");
|
12949
13005
|
init_utils();
|
@@ -12989,6 +13045,7 @@ var init_pgImports = __esm({
|
|
12989
13045
|
var import_fs2, import_crypto, prepareMySqlDbPushSnapshot, prepareSQLiteDbPushSnapshot, preparePgDbPushSnapshot, prepareMySqlMigrationSnapshot, prepareSqliteMigrationSnapshot, fillPgSnapshot, preparePgMigrationSnapshot, preparePrevSnapshot;
|
12990
13046
|
var init_migrationPreparator = __esm({
|
12991
13047
|
"src/migrationPreparator.ts"() {
|
13048
|
+
"use strict";
|
12992
13049
|
import_fs2 = __toESM(require("fs"));
|
12993
13050
|
import_crypto = require("crypto");
|
12994
13051
|
init_serializer();
|
@@ -13077,7 +13134,7 @@ var init_migrationPreparator = __esm({
|
|
13077
13134
|
const serialized = await serializePg(schemaPath);
|
13078
13135
|
const id = (0, import_crypto.randomUUID)();
|
13079
13136
|
const idPrev = prevSnapshot.id;
|
13080
|
-
const result =
|
13137
|
+
const result = { id, prevId: idPrev, ...serialized };
|
13081
13138
|
const { id: _ignoredId, prevId: _ignoredPrevId, ...prevRest } = prevSnapshot;
|
13082
13139
|
const custom = fillPgSnapshot({ serialized: prevRest, id, idPrev });
|
13083
13140
|
return { prev: prevSnapshot, cur: result, custom };
|
@@ -13095,6 +13152,363 @@ var init_migrationPreparator = __esm({
|
|
13095
13152
|
}
|
13096
13153
|
});
|
13097
13154
|
|
13155
|
+
// node_modules/.pnpm/pluralize@8.0.0/node_modules/pluralize/pluralize.js
|
13156
|
+
var require_pluralize = __commonJS({
|
13157
|
+
"node_modules/.pnpm/pluralize@8.0.0/node_modules/pluralize/pluralize.js"(exports, module2) {
|
13158
|
+
(function(root, pluralize) {
|
13159
|
+
if (typeof require === "function" && typeof exports === "object" && typeof module2 === "object") {
|
13160
|
+
module2.exports = pluralize();
|
13161
|
+
} else if (typeof define === "function" && define.amd) {
|
13162
|
+
define(function() {
|
13163
|
+
return pluralize();
|
13164
|
+
});
|
13165
|
+
} else {
|
13166
|
+
root.pluralize = pluralize();
|
13167
|
+
}
|
13168
|
+
})(exports, function() {
|
13169
|
+
var pluralRules = [];
|
13170
|
+
var singularRules = [];
|
13171
|
+
var uncountables = {};
|
13172
|
+
var irregularPlurals = {};
|
13173
|
+
var irregularSingles = {};
|
13174
|
+
function sanitizeRule(rule) {
|
13175
|
+
if (typeof rule === "string") {
|
13176
|
+
return new RegExp("^" + rule + "$", "i");
|
13177
|
+
}
|
13178
|
+
return rule;
|
13179
|
+
}
|
13180
|
+
function restoreCase(word, token) {
|
13181
|
+
if (word === token)
|
13182
|
+
return token;
|
13183
|
+
if (word === word.toLowerCase())
|
13184
|
+
return token.toLowerCase();
|
13185
|
+
if (word === word.toUpperCase())
|
13186
|
+
return token.toUpperCase();
|
13187
|
+
if (word[0] === word[0].toUpperCase()) {
|
13188
|
+
return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase();
|
13189
|
+
}
|
13190
|
+
return token.toLowerCase();
|
13191
|
+
}
|
13192
|
+
function interpolate(str, args) {
|
13193
|
+
return str.replace(/\$(\d{1,2})/g, function(match2, index4) {
|
13194
|
+
return args[index4] || "";
|
13195
|
+
});
|
13196
|
+
}
|
13197
|
+
function replace(word, rule) {
|
13198
|
+
return word.replace(rule[0], function(match2, index4) {
|
13199
|
+
var result = interpolate(rule[1], arguments);
|
13200
|
+
if (match2 === "") {
|
13201
|
+
return restoreCase(word[index4 - 1], result);
|
13202
|
+
}
|
13203
|
+
return restoreCase(match2, result);
|
13204
|
+
});
|
13205
|
+
}
|
13206
|
+
function sanitizeWord(token, word, rules) {
|
13207
|
+
if (!token.length || uncountables.hasOwnProperty(token)) {
|
13208
|
+
return word;
|
13209
|
+
}
|
13210
|
+
var len = rules.length;
|
13211
|
+
while (len--) {
|
13212
|
+
var rule = rules[len];
|
13213
|
+
if (rule[0].test(word))
|
13214
|
+
return replace(word, rule);
|
13215
|
+
}
|
13216
|
+
return word;
|
13217
|
+
}
|
13218
|
+
function replaceWord(replaceMap, keepMap, rules) {
|
13219
|
+
return function(word) {
|
13220
|
+
var token = word.toLowerCase();
|
13221
|
+
if (keepMap.hasOwnProperty(token)) {
|
13222
|
+
return restoreCase(word, token);
|
13223
|
+
}
|
13224
|
+
if (replaceMap.hasOwnProperty(token)) {
|
13225
|
+
return restoreCase(word, replaceMap[token]);
|
13226
|
+
}
|
13227
|
+
return sanitizeWord(token, word, rules);
|
13228
|
+
};
|
13229
|
+
}
|
13230
|
+
function checkWord(replaceMap, keepMap, rules, bool) {
|
13231
|
+
return function(word) {
|
13232
|
+
var token = word.toLowerCase();
|
13233
|
+
if (keepMap.hasOwnProperty(token))
|
13234
|
+
return true;
|
13235
|
+
if (replaceMap.hasOwnProperty(token))
|
13236
|
+
return false;
|
13237
|
+
return sanitizeWord(token, token, rules) === token;
|
13238
|
+
};
|
13239
|
+
}
|
13240
|
+
function pluralize(word, count, inclusive) {
|
13241
|
+
var pluralized = count === 1 ? pluralize.singular(word) : pluralize.plural(word);
|
13242
|
+
return (inclusive ? count + " " : "") + pluralized;
|
13243
|
+
}
|
13244
|
+
pluralize.plural = replaceWord(
|
13245
|
+
irregularSingles,
|
13246
|
+
irregularPlurals,
|
13247
|
+
pluralRules
|
13248
|
+
);
|
13249
|
+
pluralize.isPlural = checkWord(
|
13250
|
+
irregularSingles,
|
13251
|
+
irregularPlurals,
|
13252
|
+
pluralRules
|
13253
|
+
);
|
13254
|
+
pluralize.singular = replaceWord(
|
13255
|
+
irregularPlurals,
|
13256
|
+
irregularSingles,
|
13257
|
+
singularRules
|
13258
|
+
);
|
13259
|
+
pluralize.isSingular = checkWord(
|
13260
|
+
irregularPlurals,
|
13261
|
+
irregularSingles,
|
13262
|
+
singularRules
|
13263
|
+
);
|
13264
|
+
pluralize.addPluralRule = function(rule, replacement) {
|
13265
|
+
pluralRules.push([sanitizeRule(rule), replacement]);
|
13266
|
+
};
|
13267
|
+
pluralize.addSingularRule = function(rule, replacement) {
|
13268
|
+
singularRules.push([sanitizeRule(rule), replacement]);
|
13269
|
+
};
|
13270
|
+
pluralize.addUncountableRule = function(word) {
|
13271
|
+
if (typeof word === "string") {
|
13272
|
+
uncountables[word.toLowerCase()] = true;
|
13273
|
+
return;
|
13274
|
+
}
|
13275
|
+
pluralize.addPluralRule(word, "$0");
|
13276
|
+
pluralize.addSingularRule(word, "$0");
|
13277
|
+
};
|
13278
|
+
pluralize.addIrregularRule = function(single, plural2) {
|
13279
|
+
plural2 = plural2.toLowerCase();
|
13280
|
+
single = single.toLowerCase();
|
13281
|
+
irregularSingles[single] = plural2;
|
13282
|
+
irregularPlurals[plural2] = single;
|
13283
|
+
};
|
13284
|
+
[
|
13285
|
+
// Pronouns.
|
13286
|
+
["I", "we"],
|
13287
|
+
["me", "us"],
|
13288
|
+
["he", "they"],
|
13289
|
+
["she", "they"],
|
13290
|
+
["them", "them"],
|
13291
|
+
["myself", "ourselves"],
|
13292
|
+
["yourself", "yourselves"],
|
13293
|
+
["itself", "themselves"],
|
13294
|
+
["herself", "themselves"],
|
13295
|
+
["himself", "themselves"],
|
13296
|
+
["themself", "themselves"],
|
13297
|
+
["is", "are"],
|
13298
|
+
["was", "were"],
|
13299
|
+
["has", "have"],
|
13300
|
+
["this", "these"],
|
13301
|
+
["that", "those"],
|
13302
|
+
// Words ending in with a consonant and `o`.
|
13303
|
+
["echo", "echoes"],
|
13304
|
+
["dingo", "dingoes"],
|
13305
|
+
["volcano", "volcanoes"],
|
13306
|
+
["tornado", "tornadoes"],
|
13307
|
+
["torpedo", "torpedoes"],
|
13308
|
+
// Ends with `us`.
|
13309
|
+
["genus", "genera"],
|
13310
|
+
["viscus", "viscera"],
|
13311
|
+
// Ends with `ma`.
|
13312
|
+
["stigma", "stigmata"],
|
13313
|
+
["stoma", "stomata"],
|
13314
|
+
["dogma", "dogmata"],
|
13315
|
+
["lemma", "lemmata"],
|
13316
|
+
["schema", "schemata"],
|
13317
|
+
["anathema", "anathemata"],
|
13318
|
+
// Other irregular rules.
|
13319
|
+
["ox", "oxen"],
|
13320
|
+
["axe", "axes"],
|
13321
|
+
["die", "dice"],
|
13322
|
+
["yes", "yeses"],
|
13323
|
+
["foot", "feet"],
|
13324
|
+
["eave", "eaves"],
|
13325
|
+
["goose", "geese"],
|
13326
|
+
["tooth", "teeth"],
|
13327
|
+
["quiz", "quizzes"],
|
13328
|
+
["human", "humans"],
|
13329
|
+
["proof", "proofs"],
|
13330
|
+
["carve", "carves"],
|
13331
|
+
["valve", "valves"],
|
13332
|
+
["looey", "looies"],
|
13333
|
+
["thief", "thieves"],
|
13334
|
+
["groove", "grooves"],
|
13335
|
+
["pickaxe", "pickaxes"],
|
13336
|
+
["passerby", "passersby"]
|
13337
|
+
].forEach(function(rule) {
|
13338
|
+
return pluralize.addIrregularRule(rule[0], rule[1]);
|
13339
|
+
});
|
13340
|
+
[
|
13341
|
+
[/s?$/i, "s"],
|
13342
|
+
[/[^\u0000-\u007F]$/i, "$0"],
|
13343
|
+
[/([^aeiou]ese)$/i, "$1"],
|
13344
|
+
[/(ax|test)is$/i, "$1es"],
|
13345
|
+
[/(alias|[^aou]us|t[lm]as|gas|ris)$/i, "$1es"],
|
13346
|
+
[/(e[mn]u)s?$/i, "$1s"],
|
13347
|
+
[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, "$1"],
|
13348
|
+
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1i"],
|
13349
|
+
[/(alumn|alg|vertebr)(?:a|ae)$/i, "$1ae"],
|
13350
|
+
[/(seraph|cherub)(?:im)?$/i, "$1im"],
|
13351
|
+
[/(her|at|gr)o$/i, "$1oes"],
|
13352
|
+
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, "$1a"],
|
13353
|
+
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, "$1a"],
|
13354
|
+
[/sis$/i, "ses"],
|
13355
|
+
[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, "$1$2ves"],
|
13356
|
+
[/([^aeiouy]|qu)y$/i, "$1ies"],
|
13357
|
+
[/([^ch][ieo][ln])ey$/i, "$1ies"],
|
13358
|
+
[/(x|ch|ss|sh|zz)$/i, "$1es"],
|
13359
|
+
[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, "$1ices"],
|
13360
|
+
[/\b((?:tit)?m|l)(?:ice|ouse)$/i, "$1ice"],
|
13361
|
+
[/(pe)(?:rson|ople)$/i, "$1ople"],
|
13362
|
+
[/(child)(?:ren)?$/i, "$1ren"],
|
13363
|
+
[/eaux$/i, "$0"],
|
13364
|
+
[/m[ae]n$/i, "men"],
|
13365
|
+
["thou", "you"]
|
13366
|
+
].forEach(function(rule) {
|
13367
|
+
return pluralize.addPluralRule(rule[0], rule[1]);
|
13368
|
+
});
|
13369
|
+
[
|
13370
|
+
[/s$/i, ""],
|
13371
|
+
[/(ss)$/i, "$1"],
|
13372
|
+
[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, "$1fe"],
|
13373
|
+
[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, "$1f"],
|
13374
|
+
[/ies$/i, "y"],
|
13375
|
+
[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, "$1ie"],
|
13376
|
+
[/\b(mon|smil)ies$/i, "$1ey"],
|
13377
|
+
[/\b((?:tit)?m|l)ice$/i, "$1ouse"],
|
13378
|
+
[/(seraph|cherub)im$/i, "$1"],
|
13379
|
+
[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, "$1"],
|
13380
|
+
[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, "$1sis"],
|
13381
|
+
[/(movie|twelve|abuse|e[mn]u)s$/i, "$1"],
|
13382
|
+
[/(test)(?:is|es)$/i, "$1is"],
|
13383
|
+
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1us"],
|
13384
|
+
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, "$1um"],
|
13385
|
+
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, "$1on"],
|
13386
|
+
[/(alumn|alg|vertebr)ae$/i, "$1a"],
|
13387
|
+
[/(cod|mur|sil|vert|ind)ices$/i, "$1ex"],
|
13388
|
+
[/(matr|append)ices$/i, "$1ix"],
|
13389
|
+
[/(pe)(rson|ople)$/i, "$1rson"],
|
13390
|
+
[/(child)ren$/i, "$1"],
|
13391
|
+
[/(eau)x?$/i, "$1"],
|
13392
|
+
[/men$/i, "man"]
|
13393
|
+
].forEach(function(rule) {
|
13394
|
+
return pluralize.addSingularRule(rule[0], rule[1]);
|
13395
|
+
});
|
13396
|
+
[
|
13397
|
+
// Singular words with no plurals.
|
13398
|
+
"adulthood",
|
13399
|
+
"advice",
|
13400
|
+
"agenda",
|
13401
|
+
"aid",
|
13402
|
+
"aircraft",
|
13403
|
+
"alcohol",
|
13404
|
+
"ammo",
|
13405
|
+
"analytics",
|
13406
|
+
"anime",
|
13407
|
+
"athletics",
|
13408
|
+
"audio",
|
13409
|
+
"bison",
|
13410
|
+
"blood",
|
13411
|
+
"bream",
|
13412
|
+
"buffalo",
|
13413
|
+
"butter",
|
13414
|
+
"carp",
|
13415
|
+
"cash",
|
13416
|
+
"chassis",
|
13417
|
+
"chess",
|
13418
|
+
"clothing",
|
13419
|
+
"cod",
|
13420
|
+
"commerce",
|
13421
|
+
"cooperation",
|
13422
|
+
"corps",
|
13423
|
+
"debris",
|
13424
|
+
"diabetes",
|
13425
|
+
"digestion",
|
13426
|
+
"elk",
|
13427
|
+
"energy",
|
13428
|
+
"equipment",
|
13429
|
+
"excretion",
|
13430
|
+
"expertise",
|
13431
|
+
"firmware",
|
13432
|
+
"flounder",
|
13433
|
+
"fun",
|
13434
|
+
"gallows",
|
13435
|
+
"garbage",
|
13436
|
+
"graffiti",
|
13437
|
+
"hardware",
|
13438
|
+
"headquarters",
|
13439
|
+
"health",
|
13440
|
+
"herpes",
|
13441
|
+
"highjinks",
|
13442
|
+
"homework",
|
13443
|
+
"housework",
|
13444
|
+
"information",
|
13445
|
+
"jeans",
|
13446
|
+
"justice",
|
13447
|
+
"kudos",
|
13448
|
+
"labour",
|
13449
|
+
"literature",
|
13450
|
+
"machinery",
|
13451
|
+
"mackerel",
|
13452
|
+
"mail",
|
13453
|
+
"media",
|
13454
|
+
"mews",
|
13455
|
+
"moose",
|
13456
|
+
"music",
|
13457
|
+
"mud",
|
13458
|
+
"manga",
|
13459
|
+
"news",
|
13460
|
+
"only",
|
13461
|
+
"personnel",
|
13462
|
+
"pike",
|
13463
|
+
"plankton",
|
13464
|
+
"pliers",
|
13465
|
+
"police",
|
13466
|
+
"pollution",
|
13467
|
+
"premises",
|
13468
|
+
"rain",
|
13469
|
+
"research",
|
13470
|
+
"rice",
|
13471
|
+
"salmon",
|
13472
|
+
"scissors",
|
13473
|
+
"series",
|
13474
|
+
"sewage",
|
13475
|
+
"shambles",
|
13476
|
+
"shrimp",
|
13477
|
+
"software",
|
13478
|
+
"species",
|
13479
|
+
"staff",
|
13480
|
+
"swine",
|
13481
|
+
"tennis",
|
13482
|
+
"traffic",
|
13483
|
+
"transportation",
|
13484
|
+
"trout",
|
13485
|
+
"tuna",
|
13486
|
+
"wealth",
|
13487
|
+
"welfare",
|
13488
|
+
"whiting",
|
13489
|
+
"wildebeest",
|
13490
|
+
"wildlife",
|
13491
|
+
"you",
|
13492
|
+
/pok[eé]mon$/i,
|
13493
|
+
// Regexes.
|
13494
|
+
/[^aeiou]ese$/i,
|
13495
|
+
// "chinese", "japanese"
|
13496
|
+
/deer$/i,
|
13497
|
+
// "deer", "reindeer"
|
13498
|
+
/fish$/i,
|
13499
|
+
// "fish", "blowfish", "angelfish"
|
13500
|
+
/measles$/i,
|
13501
|
+
/o[iu]s$/i,
|
13502
|
+
// "carnivorous"
|
13503
|
+
/pox$/i,
|
13504
|
+
// "chickpox", "smallpox"
|
13505
|
+
/sheep$/i
|
13506
|
+
].forEach(pluralize.addUncountableRule);
|
13507
|
+
return pluralize;
|
13508
|
+
});
|
13509
|
+
}
|
13510
|
+
});
|
13511
|
+
|
13098
13512
|
// node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js
|
13099
13513
|
var require_balanced_match = __commonJS({
|
13100
13514
|
"node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js"(exports, module2) {
|
@@ -13384,6 +13798,7 @@ function applyJsonDiff(json1, json2) {
|
|
13384
13798
|
var import_json_diff, findAlternationsInTable, alternationsInColumn;
|
13385
13799
|
var init_jsonDiffer = __esm({
|
13386
13800
|
"src/jsonDiffer.js"() {
|
13801
|
+
"use strict";
|
13387
13802
|
"use-strict";
|
13388
13803
|
import_json_diff = require("json-diff");
|
13389
13804
|
findAlternationsInTable = (table4, tableSchema) => {
|
@@ -13556,20 +13971,21 @@ var init_jsonDiffer = __esm({
|
|
13556
13971
|
var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, prepareAlterTableColumnsJson, _prepareDropColumns, _prepareAddColumns, _prepareSQLiteAddColumns, _prepareAlterColumns, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql;
|
13557
13972
|
var init_jsonStatements = __esm({
|
13558
13973
|
"src/jsonStatements.ts"() {
|
13974
|
+
"use strict";
|
13559
13975
|
init_mysqlSchema();
|
13560
13976
|
init_pgSchema();
|
13561
13977
|
init_sqliteSchema();
|
13562
13978
|
preparePgCreateTableJson = (table4, json2) => {
|
13563
13979
|
const { name, schema: schema4, columns, compositePrimaryKeys, uniqueConstraints } = table4;
|
13980
|
+
const tableKey = `${schema4 || "public"}.${name}`;
|
13981
|
+
const compositePkName = Object.values(compositePrimaryKeys).length > 0 ? json2.tables[tableKey].compositePrimaryKeys[`${PgSquasher.unsquashPK(Object.values(compositePrimaryKeys)[0]).name}`].name : "";
|
13564
13982
|
return {
|
13565
13983
|
type: "create_table",
|
13566
13984
|
tableName: name,
|
13567
13985
|
schema: schema4,
|
13568
13986
|
columns: Object.values(columns),
|
13569
13987
|
compositePKs: Object.values(compositePrimaryKeys),
|
13570
|
-
compositePkName
|
13571
|
-
Object.values(compositePrimaryKeys)[0]
|
13572
|
-
).name}`].name : "",
|
13988
|
+
compositePkName,
|
13573
13989
|
uniqueConstraints: Object.values(uniqueConstraints)
|
13574
13990
|
};
|
13575
13991
|
};
|
@@ -13671,7 +14087,8 @@ var init_jsonStatements = __esm({
|
|
13671
14087
|
prepareAlterTableColumnsJson = (tableName, schema4, deleted, added, altered, addedFk, json2, dialect7) => {
|
13672
14088
|
const addColumns = [];
|
13673
14089
|
const dropColumns = _prepareDropColumns(tableName, schema4, deleted);
|
13674
|
-
const
|
14090
|
+
const tableKey = `${schema4 || "public"}.${tableName}`;
|
14091
|
+
const alterColumns = _prepareAlterColumns(tableKey, schema4, altered, json2);
|
13675
14092
|
if (dialect7 === "sqlite") {
|
13676
14093
|
let jsonCreateFKStatements = Object.values(addedFk);
|
13677
14094
|
const sqliteAddColumns = _prepareSQLiteAddColumns(
|
@@ -13721,19 +14138,22 @@ var init_jsonStatements = __esm({
|
|
13721
14138
|
};
|
13722
14139
|
});
|
13723
14140
|
};
|
13724
|
-
_prepareAlterColumns = (
|
14141
|
+
_prepareAlterColumns = (tableKey, schema4, columns, json2) => {
|
13725
14142
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
13726
14143
|
let statements = [];
|
13727
14144
|
let dropPkStatements = [];
|
13728
14145
|
let setPkStatements = [];
|
13729
14146
|
for (const column4 of columns) {
|
13730
14147
|
const columnName = typeof column4.name !== "string" ? column4.name.new : column4.name;
|
13731
|
-
const
|
13732
|
-
const
|
13733
|
-
const
|
13734
|
-
const
|
13735
|
-
const
|
13736
|
-
const
|
14148
|
+
const table4 = json2.tables[tableKey];
|
14149
|
+
const tableName = table4.name;
|
14150
|
+
const snapshotColumn = table4.columns[columnName];
|
14151
|
+
const columnType = snapshotColumn.type;
|
14152
|
+
const columnDefault = snapshotColumn.default;
|
14153
|
+
const columnOnUpdate = "onUpdate" in snapshotColumn ? snapshotColumn.onUpdate : void 0;
|
14154
|
+
const columnNotNull = table4.columns[columnName].notNull;
|
14155
|
+
const columnAutoIncrement = "autoincrement" in snapshotColumn ? snapshotColumn.autoincrement ?? false : false;
|
14156
|
+
const columnPk = table4.columns[columnName].primaryKey;
|
13737
14157
|
if (((_a = column4.autoincrement) == null ? void 0 : _a.type) === "added") {
|
13738
14158
|
statements.push({
|
13739
14159
|
type: "alter_table_alter_column_set_autoincrement",
|
@@ -13780,13 +14200,14 @@ var init_jsonStatements = __esm({
|
|
13780
14200
|
}
|
13781
14201
|
for (const column4 of columns) {
|
13782
14202
|
const columnName = typeof column4.name !== "string" ? column4.name.new : column4.name;
|
13783
|
-
const
|
13784
|
-
const
|
13785
|
-
const
|
13786
|
-
const
|
13787
|
-
const
|
13788
|
-
const
|
13789
|
-
const
|
14203
|
+
const tableName = json2.tables[tableKey].name;
|
14204
|
+
const columnType = json2.tables[tableKey].columns[columnName].type;
|
14205
|
+
const columnDefault = json2.tables[tableKey].columns[columnName].default;
|
14206
|
+
const columnOnUpdate = json2.tables[tableKey].columns[columnName].onUpdate;
|
14207
|
+
const columnNotNull = json2.tables[tableKey].columns[columnName].notNull;
|
14208
|
+
const columnAutoIncrement = json2.tables[tableKey].columns[columnName].autoincrement;
|
14209
|
+
const columnPk = json2.tables[tableKey].columns[columnName].primaryKey;
|
14210
|
+
const compositePk = json2.tables[tableKey].compositePrimaryKeys[`${tableName}_${columnName}`];
|
13790
14211
|
if (typeof column4.name !== "string") {
|
13791
14212
|
statements.push({
|
13792
14213
|
type: "alter_table_rename_column",
|
@@ -14137,6 +14558,7 @@ var init_jsonStatements = __esm({
|
|
14137
14558
|
var prepareMigrationMetadata, adjectives, heroes;
|
14138
14559
|
var init_words = __esm({
|
14139
14560
|
"src/utils/words.ts"() {
|
14561
|
+
"use strict";
|
14140
14562
|
prepareMigrationMetadata = (idx) => {
|
14141
14563
|
const prefix = idx.toFixed(0).padStart(4, "0");
|
14142
14564
|
const suffix = `${adjectives.random()}_${heroes.random()}`;
|
@@ -15457,6 +15879,7 @@ var init_words = __esm({
|
|
15457
15879
|
// src/cli/commands/pgUp.ts
|
15458
15880
|
var init_pgUp = __esm({
|
15459
15881
|
"src/cli/commands/pgUp.ts"() {
|
15882
|
+
"use strict";
|
15460
15883
|
init_source();
|
15461
15884
|
init_global();
|
15462
15885
|
init_pgSchema();
|
@@ -15467,6 +15890,7 @@ var init_pgUp = __esm({
|
|
15467
15890
|
// src/cli/commands/mysqlUp.ts
|
15468
15891
|
var init_mysqlUp = __esm({
|
15469
15892
|
"src/cli/commands/mysqlUp.ts"() {
|
15893
|
+
"use strict";
|
15470
15894
|
init_source();
|
15471
15895
|
init_mysqlSchema();
|
15472
15896
|
init_utils2();
|
@@ -15476,6 +15900,7 @@ var init_mysqlUp = __esm({
|
|
15476
15900
|
// src/cli/commands/upFolders.ts
|
15477
15901
|
var init_upFolders = __esm({
|
15478
15902
|
"src/cli/commands/upFolders.ts"() {
|
15903
|
+
"use strict";
|
15479
15904
|
init_jsonDiffer();
|
15480
15905
|
init_mysqlSchema();
|
15481
15906
|
init_sqliteSchema();
|
@@ -15489,9 +15914,10 @@ var init_upFolders = __esm({
|
|
15489
15914
|
});
|
15490
15915
|
|
15491
15916
|
// src/utils.ts
|
15492
|
-
var import_fs3, import_path2, assertV1OutFolder, dryJournal,
|
15917
|
+
var import_fs3, import_path2, assertV1OutFolder, dryJournal, prepareOutFolder, validatorForDialect, validateWithReport, prepareMigrationFolder, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey;
|
15493
15918
|
var init_utils2 = __esm({
|
15494
15919
|
"src/utils.ts"() {
|
15920
|
+
"use strict";
|
15495
15921
|
import_fs3 = require("fs");
|
15496
15922
|
init_views();
|
15497
15923
|
init_mysqlSchema();
|
@@ -15502,7 +15928,7 @@ var init_utils2 = __esm({
|
|
15502
15928
|
init_global();
|
15503
15929
|
init_upFolders();
|
15504
15930
|
init_snapshotsDiffer();
|
15505
|
-
assertV1OutFolder = (out
|
15931
|
+
assertV1OutFolder = (out) => {
|
15506
15932
|
if (!(0, import_fs3.existsSync)(out))
|
15507
15933
|
return;
|
15508
15934
|
const oldMigrationFolders = (0, import_fs3.readdirSync)(out).filter(
|
@@ -15511,7 +15937,7 @@ var init_utils2 = __esm({
|
|
15511
15937
|
if (oldMigrationFolders.length > 0) {
|
15512
15938
|
console.log(
|
15513
15939
|
`Your migrations folder format is outdated, please run ${source_default.green.bold(
|
15514
|
-
`drizzle-kit up
|
15940
|
+
`drizzle-kit up`
|
15515
15941
|
)}`
|
15516
15942
|
);
|
15517
15943
|
process.exit(1);
|
@@ -15524,7 +15950,7 @@ var init_utils2 = __esm({
|
|
15524
15950
|
entries: []
|
15525
15951
|
};
|
15526
15952
|
};
|
15527
|
-
|
15953
|
+
prepareOutFolder = (out, dialect7) => {
|
15528
15954
|
const meta = (0, import_path2.join)(out, "meta");
|
15529
15955
|
const journalPath = (0, import_path2.join)(meta, "_journal.json");
|
15530
15956
|
if (!(0, import_fs3.existsSync)((0, import_path2.join)(out, "meta"))) {
|
@@ -15539,9 +15965,9 @@ var init_utils2 = __esm({
|
|
15539
15965
|
validatorForDialect = (dialect7) => {
|
15540
15966
|
switch (dialect7) {
|
15541
15967
|
case "pg":
|
15542
|
-
return { validator: backwardCompatiblePgSchema, version:
|
15968
|
+
return { validator: backwardCompatiblePgSchema, version: 6 };
|
15543
15969
|
case "sqlite":
|
15544
|
-
return { validator: backwardCompatibleSqliteSchema, version:
|
15970
|
+
return { validator: backwardCompatibleSqliteSchema, version: 6 };
|
15545
15971
|
case "mysql":
|
15546
15972
|
return { validator: backwardCompatibleMysqlSchema, version: 5 };
|
15547
15973
|
}
|
@@ -15589,13 +16015,13 @@ var init_utils2 = __esm({
|
|
15589
16015
|
return result;
|
15590
16016
|
};
|
15591
16017
|
prepareMigrationFolder = (outFolder = "drizzle", dialect7) => {
|
15592
|
-
const { snapshots, journal } =
|
16018
|
+
const { snapshots, journal } = prepareOutFolder(outFolder, dialect7);
|
15593
16019
|
const report = validateWithReport(snapshots, dialect7);
|
15594
16020
|
if (report.nonLatest.length > 0) {
|
15595
16021
|
console.log(
|
15596
16022
|
report.nonLatest.map((it) => {
|
15597
16023
|
return `${it}/snapshot.json is not of the latest version`;
|
15598
|
-
}).concat(`Run ${source_default.green.bold(`drizzle-kit up
|
16024
|
+
}).concat(`Run ${source_default.green.bold(`drizzle-kit up`)}`).join("\n")
|
15599
16025
|
);
|
15600
16026
|
process.exit(0);
|
15601
16027
|
}
|
@@ -15664,6 +16090,7 @@ var init_utils2 = __esm({
|
|
15664
16090
|
var makeChanged, makeSelfOrChanged, makePatched, makeSelfOrPatched, valueFromSelfOrPatchedNew, columnSchema, alteredColumnSchema, enumSchema2, changedEnumSchema, tableScheme, alteredTableScheme, diffResultScheme, applySnapshotsDiff;
|
15665
16091
|
var init_snapshotsDiffer = __esm({
|
15666
16092
|
"src/snapshotsDiffer.ts"() {
|
16093
|
+
"use strict";
|
15667
16094
|
init_sqlgenerator();
|
15668
16095
|
init_lib();
|
15669
16096
|
init_jsonDiffer();
|
@@ -15671,6 +16098,7 @@ var init_snapshotsDiffer = __esm({
|
|
15671
16098
|
init_utils2();
|
15672
16099
|
init_sqliteSchema();
|
15673
16100
|
init_mysqlSchema();
|
16101
|
+
init_global();
|
15674
16102
|
makeChanged = (schema4) => {
|
15675
16103
|
return objectType({
|
15676
16104
|
type: enumType(["changed"]),
|
@@ -15709,7 +16137,7 @@ var init_snapshotsDiffer = __esm({
|
|
15709
16137
|
return unionType([
|
15710
16138
|
objectType({
|
15711
16139
|
type: literalType("none"),
|
15712
|
-
value: schema4
|
16140
|
+
value: schema4
|
15713
16141
|
}),
|
15714
16142
|
objectType({
|
15715
16143
|
type: literalType("added"),
|
@@ -15833,7 +16261,6 @@ var init_snapshotsDiffer = __esm({
|
|
15833
16261
|
}).strict();
|
15834
16262
|
applySnapshotsDiff = async (json1, json2, dialect7, schemasResolver, tablesResolver, columnsResolver, prevFull, curFull) => {
|
15835
16263
|
var _a, _b;
|
15836
|
-
let diffResult;
|
15837
16264
|
if (dialect7 === "mysql") {
|
15838
16265
|
for (const tableName in json1.tables) {
|
15839
16266
|
const table4 = json1.tables[tableName];
|
@@ -15861,13 +16288,26 @@ var init_snapshotsDiffer = __esm({
|
|
15861
16288
|
}
|
15862
16289
|
}
|
15863
16290
|
}
|
15864
|
-
diffResult = applyJsonDiff(json1, json2);
|
15865
16291
|
}
|
15866
|
-
diffResult = applyJsonDiff(json1, json2);
|
16292
|
+
const diffResult = applyJsonDiff(json1, json2);
|
15867
16293
|
if (Object.keys(diffResult).length === 0) {
|
15868
16294
|
return { statements: [], sqlStatements: [], _meta: void 0 };
|
15869
16295
|
}
|
15870
16296
|
const typedResult = diffResultScheme.parse(diffResult);
|
16297
|
+
typedResult.alteredTablesWithColumns = typedResult.alteredTablesWithColumns.map((it) => {
|
16298
|
+
let schemaToTrim;
|
16299
|
+
if (it.schema.type === "none") {
|
16300
|
+
schemaToTrim = it.schema.value || "public";
|
16301
|
+
} else if (it.schema.type === "deleted") {
|
16302
|
+
schemaToTrim = it.schema.value;
|
16303
|
+
} else if (it.schema.type === "added") {
|
16304
|
+
schemaToTrim = "public";
|
16305
|
+
} else {
|
16306
|
+
schemaToTrim = it.schema.old;
|
16307
|
+
}
|
16308
|
+
it.name = it.name.substring(schemaToTrim.length + 1);
|
16309
|
+
return it;
|
16310
|
+
});
|
15871
16311
|
const {
|
15872
16312
|
created: createdSchemas,
|
15873
16313
|
deleted: deletedSchemas,
|
@@ -16019,7 +16459,7 @@ var init_snapshotsDiffer = __esm({
|
|
16019
16459
|
prevFull,
|
16020
16460
|
curFull
|
16021
16461
|
);
|
16022
|
-
} else {
|
16462
|
+
} else if (dialect7 === "mysql") {
|
16023
16463
|
addedCompositePKs = prepareAddCompositePrimaryKeyMySql(
|
16024
16464
|
it.name,
|
16025
16465
|
it.addedCompositePKs,
|
@@ -16037,6 +16477,8 @@ var init_snapshotsDiffer = __esm({
|
|
16037
16477
|
prevFull,
|
16038
16478
|
curFull
|
16039
16479
|
);
|
16480
|
+
} else {
|
16481
|
+
assertUnreachable(dialect7);
|
16040
16482
|
}
|
16041
16483
|
let addedUniqueConstraints = [];
|
16042
16484
|
let deletedUniqueConstraints = [];
|
@@ -16227,11 +16669,13 @@ var init_snapshotsDiffer = __esm({
|
|
16227
16669
|
return preparePgCreateTableJson(it, curFull);
|
16228
16670
|
});
|
16229
16671
|
jsonStatements.push(...jsonPgCreateTables);
|
16230
|
-
} else {
|
16672
|
+
} else if (dialect7 === "mysql") {
|
16231
16673
|
const jsonMySqlCreateTables = created.map((it) => {
|
16232
16674
|
return prepareMySqlCreateTableJson(it, curFull);
|
16233
16675
|
});
|
16234
16676
|
jsonStatements.push(...jsonMySqlCreateTables);
|
16677
|
+
} else {
|
16678
|
+
assertUnreachable(dialect7);
|
16235
16679
|
}
|
16236
16680
|
jsonStatements.push(...jsonDropTables);
|
16237
16681
|
jsonStatements.push(...jsonRenameTables);
|
@@ -16299,6 +16743,7 @@ __export(migrate_exports, {
|
|
16299
16743
|
var import_fs4, import_path3, import_hanji4, prepareAndMigratePg, prepareMySQLPush, prepareSQLitePush, preparePgPush, prepareAndMigrateMySql, prepareAndMigrateSqlite, prepareSQL, promptColumnsConflicts, promptTablesConflict, promptSchemasConflict, BREAKPOINT, writeResult, embeddedMigrations, prepareSnapshotFolderName, two;
|
16300
16744
|
var init_migrate = __esm({
|
16301
16745
|
"src/cli/commands/migrate.ts"() {
|
16746
|
+
"use strict";
|
16302
16747
|
import_fs4 = __toESM(require("fs"));
|
16303
16748
|
init_migrationPreparator();
|
16304
16749
|
init_snapshotsDiffer();
|
@@ -16316,7 +16761,7 @@ var init_migrate = __esm({
|
|
16316
16761
|
const outFolder = config.out;
|
16317
16762
|
const schemaPath = config.schema;
|
16318
16763
|
try {
|
16319
|
-
assertV1OutFolder(outFolder
|
16764
|
+
assertV1OutFolder(outFolder);
|
16320
16765
|
const { snapshots, journal } = prepareMigrationFolder(outFolder, "pg");
|
16321
16766
|
const { prev, cur, custom } = await preparePgMigrationSnapshot(
|
16322
16767
|
snapshots,
|
@@ -16425,7 +16870,7 @@ var init_migrate = __esm({
|
|
16425
16870
|
const outFolder = config.out;
|
16426
16871
|
const schemaPath = config.schema;
|
16427
16872
|
try {
|
16428
|
-
assertV1OutFolder(outFolder
|
16873
|
+
assertV1OutFolder(outFolder);
|
16429
16874
|
const { snapshots, journal } = prepareMigrationFolder(outFolder, "mysql");
|
16430
16875
|
const { prev, cur, custom } = await prepareMySqlMigrationSnapshot(
|
16431
16876
|
snapshots,
|
@@ -16469,7 +16914,7 @@ var init_migrate = __esm({
|
|
16469
16914
|
const outFolder = config.out;
|
16470
16915
|
const schemaPath = config.schema;
|
16471
16916
|
try {
|
16472
|
-
assertV1OutFolder(outFolder
|
16917
|
+
assertV1OutFolder(outFolder);
|
16473
16918
|
const { snapshots, journal } = prepareMigrationFolder(outFolder, "sqlite");
|
16474
16919
|
const { prev, cur, custom } = await prepareSqliteMigrationSnapshot(
|
16475
16920
|
snapshots,
|
@@ -16494,7 +16939,9 @@ var init_migrate = __esm({
|
|
16494
16939
|
const { sqlStatements, _meta } = await prepareSQL(
|
16495
16940
|
squashedPrev,
|
16496
16941
|
squashedCur,
|
16497
|
-
"sqlite"
|
16942
|
+
"sqlite",
|
16943
|
+
validatedPrev,
|
16944
|
+
validatedCur
|
16498
16945
|
);
|
16499
16946
|
writeResult({
|
16500
16947
|
cur,
|
@@ -16793,6 +17240,7 @@ ${sql2}
|
|
16793
17240
|
var pgNativeTypes, isPgNativeType, Convertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, PgAlterTableAddUniqueConstraintConvertor, PgAlterTableDropUniqueConstraintConvertor, MySQLAlterTableAddUniqueConstraintConvertor, MySQLAlterTableDropUniqueConstraintConvertor, SQLiteAlterTableAddUniqueConstraintConvertor, SQLiteAlterTableDropUniqueConstraintConvertor, CreateTypeEnumConvertor, AlterTypeAddValueConvertor, PgDropTableConvertor, MySQLDropTableConvertor, SQLiteDropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, SQLiteAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, SqliteAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, MySqlAlterTableAddPk, MySqlAlterTableDropPk, MySqlModifyColumn, SqliteAlterTableAlterColumnDropDefaultConvertor, PgAlterTableCreateCompositePrimaryKeyConvertor, PgAlterTableDeleteCompositePrimaryKeyConvertor, PgAlterTableAlterCompositePrimaryKeyConvertor, MySqlAlterTableCreateCompositePrimaryKeyConvertor, MySqlAlterTableDeleteCompositePrimaryKeyConvertor, MySqlAlterTableAlterCompositePrimaryKeyConvertor, SqliteAlterTableCreateCompositePrimaryKeyConvertor, SqliteAlterTableDeleteCompositePrimaryKeyConvertor, SqliteAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetPrimaryKeyConvertor, PgAlterTableAlterColumnDropPrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, SqliteAlterTableAlterColumnSetNotNullConvertor, SqliteAlterTableAlterColumnSetAutoincrementConvertor, SqliteAlterTableAlterColumnDropAutoincrementConvertor, PgAlterTableAlterColumnDropNotNullConvertor, SqliteAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, SqliteCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, SqliteAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, SqliteDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MysqlCreateSchemaConvertor, MysqlDropSchemaConvertor, MysqlAlterTableSetSchemaConvertor, MysqlAlterTableSetNewSchemaConvertor, MysqlAlterTableRemoveFromSchemaConvertor, MySqlDropIndexConvertor, convertors, fromJson;
|
16794
17241
|
var init_sqlgenerator = __esm({
|
16795
17242
|
"src/sqlgenerator.ts"() {
|
17243
|
+
"use strict";
|
16796
17244
|
init_migrate();
|
16797
17245
|
init_mysqlSchema();
|
16798
17246
|
init_pgSchema();
|
@@ -18110,6 +18558,7 @@ drop type __venum;
|
|
18110
18558
|
var import_hanji5, Select;
|
18111
18559
|
var init_selector_ui = __esm({
|
18112
18560
|
"src/cli/selector-ui.ts"() {
|
18561
|
+
"use strict";
|
18113
18562
|
init_source();
|
18114
18563
|
import_hanji5 = __toESM(require_hanji());
|
18115
18564
|
Select = class extends import_hanji5.Prompt {
|
@@ -34711,6 +35160,7 @@ __export(drivers_exports, {
|
|
34711
35160
|
var import_drizzle_orm9, DrizzleDbClient, DrizzleORMPgClient, DrizzleORMMySQLClient, DrizzleORMSQLiteClient, BetterSqlite, MySQL2Client, TursoSqlite, PgPostgres;
|
34712
35161
|
var init_drivers = __esm({
|
34713
35162
|
"src/drivers/index.ts"() {
|
35163
|
+
"use strict";
|
34714
35164
|
import_drizzle_orm9 = require("drizzle-orm");
|
34715
35165
|
DrizzleDbClient = class {
|
34716
35166
|
constructor(db) {
|
@@ -34792,6 +35242,7 @@ __export(mysqlPushUtils_exports, {
|
|
34792
35242
|
var import_hanji9, filterStatements, logSuggestionsAndReturn2;
|
34793
35243
|
var init_mysqlPushUtils = __esm({
|
34794
35244
|
"src/cli/commands/mysqlPushUtils.ts"() {
|
35245
|
+
"use strict";
|
34795
35246
|
init_source();
|
34796
35247
|
import_hanji9 = __toESM(require_hanji());
|
34797
35248
|
init_mysqlSchema();
|
@@ -35067,6 +35518,7 @@ init_pgSerializer();
|
|
35067
35518
|
|
35068
35519
|
// src/introspect-pg.ts
|
35069
35520
|
var import_drizzle_orm8 = require("drizzle-orm");
|
35521
|
+
var import_pluralize = __toESM(require_pluralize());
|
35070
35522
|
var import_relations = require("drizzle-orm/relations");
|
35071
35523
|
|
35072
35524
|
// node_modules/.pnpm/camelcase@7.0.1/node_modules/camelcase/index.js
|
@@ -35168,7 +35620,7 @@ String.prototype.camelCase = function() {
|
|
35168
35620
|
return camelCase(String(this));
|
35169
35621
|
};
|
35170
35622
|
String.prototype.concatIf = function(it, condition) {
|
35171
|
-
return condition ? `${this}${it}` : this;
|
35623
|
+
return condition ? `${this}${it}` : String(this);
|
35172
35624
|
};
|
35173
35625
|
Array.prototype.random = function() {
|
35174
35626
|
return this[~~(Math.random() * this.length)];
|