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.mjs
CHANGED
@@ -1085,6 +1085,7 @@ var require_hanji = __commonJS({
|
|
1085
1085
|
var import_hanji, info, error, schema, isRenamePromptItem, ResolveColumnSelect, ResolveTableSelect, ResolveSchemasSelect;
|
1086
1086
|
var init_views = __esm({
|
1087
1087
|
"src/cli/views.ts"() {
|
1088
|
+
"use strict";
|
1088
1089
|
init_source();
|
1089
1090
|
import_hanji = __toESM(require_hanji());
|
1090
1091
|
info = (msg, greyMsg = "") => {
|
@@ -1106,7 +1107,7 @@ var init_views = __esm({
|
|
1106
1107
|
)}`;
|
1107
1108
|
}).join("\n");
|
1108
1109
|
msg += "\n";
|
1109
|
-
const enums = Object.values(schema4["enums"] || {});
|
1110
|
+
const enums = Object.values("enums" in schema4 ? schema4["enums"] || {} : {});
|
1110
1111
|
if (enums.length > 0) {
|
1111
1112
|
msg += "\n";
|
1112
1113
|
msg += source_default.bold(`${enums.length} enums
|
@@ -1121,7 +1122,7 @@ var init_views = __esm({
|
|
1121
1122
|
return msg;
|
1122
1123
|
};
|
1123
1124
|
isRenamePromptItem = (item) => {
|
1124
|
-
return
|
1125
|
+
return "from" in item && "to" in item;
|
1125
1126
|
};
|
1126
1127
|
ResolveColumnSelect = class extends import_hanji.Prompt {
|
1127
1128
|
constructor(tableName, base, data) {
|
@@ -1271,6 +1272,7 @@ import { is } from "drizzle-orm";
|
|
1271
1272
|
var prepareFromExports, prepareFromMySqlImports;
|
1272
1273
|
var init_mysqlImports = __esm({
|
1273
1274
|
"src/serializer/mysqlImports.ts"() {
|
1275
|
+
"use strict";
|
1274
1276
|
init_utils();
|
1275
1277
|
prepareFromExports = (exports) => {
|
1276
1278
|
const tables = [];
|
@@ -1310,6 +1312,7 @@ var init_mysqlImports = __esm({
|
|
1310
1312
|
var withStyle;
|
1311
1313
|
var init_outputs = __esm({
|
1312
1314
|
"src/cli/validations/outputs.ts"() {
|
1315
|
+
"use strict";
|
1313
1316
|
init_source();
|
1314
1317
|
withStyle = {
|
1315
1318
|
error: (str) => `${source_default.red(`${source_default.white.bgRed(" Invalid input ")} ${str}`)}`,
|
@@ -1355,6 +1358,7 @@ function clearDefaults(defaultValue, collate) {
|
|
1355
1358
|
var dialect, indexName, generateMySqlSnapshot, fromDatabase;
|
1356
1359
|
var init_mysqlSerializer = __esm({
|
1357
1360
|
"src/serializer/mysqlSerializer.ts"() {
|
1361
|
+
"use strict";
|
1358
1362
|
init_serializer();
|
1359
1363
|
init_outputs();
|
1360
1364
|
init_source();
|
@@ -1566,7 +1570,8 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
1566
1570
|
lock: value.config.lock
|
1567
1571
|
};
|
1568
1572
|
});
|
1569
|
-
|
1573
|
+
const tableKey = `${schema4 || "public"}.${tableName}`;
|
1574
|
+
result[tableKey] = {
|
1570
1575
|
name: tableName,
|
1571
1576
|
schema: schema4,
|
1572
1577
|
columns: columnsObject,
|
@@ -1580,7 +1585,7 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
1580
1585
|
mysqlSchemas.map((it) => [it.schemaName, it.schemaName])
|
1581
1586
|
);
|
1582
1587
|
return {
|
1583
|
-
version: "
|
1588
|
+
version: "6",
|
1584
1589
|
dialect: "mysql",
|
1585
1590
|
tables: result,
|
1586
1591
|
schemas,
|
@@ -1835,7 +1840,7 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
1835
1840
|
}
|
1836
1841
|
const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
|
1837
1842
|
return {
|
1838
|
-
version: "
|
1843
|
+
version: "6",
|
1839
1844
|
dialect: "mysql",
|
1840
1845
|
tables: result,
|
1841
1846
|
schemas: schemasObject,
|
@@ -1866,6 +1871,7 @@ import { is as is3, SQL as SQL2, getTableName as getTableName2 } from "drizzle-o
|
|
1866
1871
|
var dialect2, indexName2, generatePgSnapshot, trimChar, fromDatabase2, columnToDefault, defaultForColumn;
|
1867
1872
|
var init_pgSerializer = __esm({
|
1868
1873
|
"src/serializer/pgSerializer.ts"() {
|
1874
|
+
"use strict";
|
1869
1875
|
init_serializer();
|
1870
1876
|
init_source();
|
1871
1877
|
init_outputs();
|
@@ -1998,7 +2004,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
1998
2004
|
const onUpdate = fk4.onUpdate;
|
1999
2005
|
const reference = fk4.reference();
|
2000
2006
|
const tableTo = getTableName2(reference.foreignTable);
|
2001
|
-
const schemaTo = getTableConfig2(reference.foreignTable).schema
|
2007
|
+
const schemaTo = getTableConfig2(reference.foreignTable).schema;
|
2002
2008
|
const columnsFrom = reference.columns.map((it) => it.name);
|
2003
2009
|
const columnsTo = reference.foreignColumns.map((it) => it.name);
|
2004
2010
|
return {
|
@@ -2053,7 +2059,8 @@ ${withStyle.errorWarning(
|
|
2053
2059
|
isUnique: value.config.unique ?? false
|
2054
2060
|
};
|
2055
2061
|
});
|
2056
|
-
|
2062
|
+
const tableKey = `${schema4 ?? "public"}.${tableName}`;
|
2063
|
+
result[tableKey] = {
|
2057
2064
|
name: tableName,
|
2058
2065
|
schema: schema4 ?? "",
|
2059
2066
|
columns: columnsObject,
|
@@ -2082,7 +2089,7 @@ ${withStyle.errorWarning(
|
|
2082
2089
|
}).map((it) => [it.schemaName, it.schemaName])
|
2083
2090
|
);
|
2084
2091
|
return {
|
2085
|
-
version: "
|
2092
|
+
version: "6",
|
2086
2093
|
dialect: "pg",
|
2087
2094
|
tables: result,
|
2088
2095
|
enums: enumsToReturn,
|
@@ -2430,7 +2437,7 @@ ${withStyle.errorWarning(
|
|
2430
2437
|
}
|
2431
2438
|
const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
|
2432
2439
|
return {
|
2433
|
-
version: "
|
2440
|
+
version: "6",
|
2434
2441
|
dialect: "pg",
|
2435
2442
|
tables: result,
|
2436
2443
|
enums: enumsToReturn,
|
@@ -2513,6 +2520,7 @@ import { is as is4 } from "drizzle-orm";
|
|
2513
2520
|
var prepareFromExports2, prepareFromSqliteImports;
|
2514
2521
|
var init_sqliteImports = __esm({
|
2515
2522
|
"src/serializer/sqliteImports.ts"() {
|
2523
|
+
"use strict";
|
2516
2524
|
init_utils();
|
2517
2525
|
prepareFromExports2 = (exports) => {
|
2518
2526
|
const tables = [];
|
@@ -2556,6 +2564,7 @@ import {
|
|
2556
2564
|
uniqueKeyName as uniqueKeyName3
|
2557
2565
|
} from "drizzle-orm/sqlite-core";
|
2558
2566
|
function mapSqlToSqliteType(sqlType) {
|
2567
|
+
const lowered = sqlType.toLowerCase();
|
2559
2568
|
if ([
|
2560
2569
|
"int",
|
2561
2570
|
"integer",
|
@@ -2567,24 +2576,27 @@ function mapSqlToSqliteType(sqlType) {
|
|
2567
2576
|
"unsigned big int",
|
2568
2577
|
"int2",
|
2569
2578
|
"int8"
|
2570
|
-
].
|
2579
|
+
].some((it) => lowered.startsWith(it))) {
|
2571
2580
|
return "integer";
|
2572
2581
|
} else if ([
|
2573
2582
|
"character",
|
2574
2583
|
"varchar",
|
2575
|
-
"
|
2584
|
+
"varying character",
|
2585
|
+
"national varying character",
|
2576
2586
|
"nchar",
|
2577
2587
|
"native character",
|
2578
2588
|
"nvarchar",
|
2579
2589
|
"text",
|
2580
2590
|
"clob"
|
2581
|
-
].some((it) =>
|
2591
|
+
].some((it) => lowered.startsWith(it))) {
|
2592
|
+
const match2 = lowered.match(/\d+/);
|
2593
|
+
if (match2) {
|
2594
|
+
return `text(${match2[0]})`;
|
2595
|
+
}
|
2582
2596
|
return "text";
|
2583
|
-
} else if (
|
2597
|
+
} else if (lowered.startsWith("blob")) {
|
2584
2598
|
return "blob";
|
2585
|
-
} else if (["real", "double", "double precision", "float"].
|
2586
|
-
sqlType.toLowerCase()
|
2587
|
-
)) {
|
2599
|
+
} else if (["real", "double", "double precision", "float"].some((it) => lowered.startsWith(it))) {
|
2588
2600
|
return "real";
|
2589
2601
|
} else {
|
2590
2602
|
return "numeric";
|
@@ -2593,6 +2605,7 @@ function mapSqlToSqliteType(sqlType) {
|
|
2593
2605
|
var dialect3, generateSqliteSnapshot, fromDatabase3;
|
2594
2606
|
var init_sqliteSerializer = __esm({
|
2595
2607
|
"src/serializer/sqliteSerializer.ts"() {
|
2608
|
+
"use strict";
|
2596
2609
|
init_serializer();
|
2597
2610
|
init_outputs();
|
2598
2611
|
init_source();
|
@@ -2966,6 +2979,7 @@ import * as glob from "glob";
|
|
2966
2979
|
var sqlToStr, serializeMySql, serializePg, serializeSQLite, prepareFilenames;
|
2967
2980
|
var init_serializer = __esm({
|
2968
2981
|
"src/serializer/index.ts"() {
|
2982
|
+
"use strict";
|
2969
2983
|
init_source();
|
2970
2984
|
init_views();
|
2971
2985
|
sqlToStr = (sql2) => {
|
@@ -3033,11 +3047,15 @@ ${filenames.join("\n")}
|
|
3033
3047
|
});
|
3034
3048
|
|
3035
3049
|
// src/global.ts
|
3050
|
+
function assertUnreachable(x) {
|
3051
|
+
throw new Error("Didn't expect to get here");
|
3052
|
+
}
|
3036
3053
|
var originUUID, snapshotVersion, mapValues;
|
3037
3054
|
var init_global = __esm({
|
3038
3055
|
"src/global.ts"() {
|
3056
|
+
"use strict";
|
3039
3057
|
originUUID = "00000000-0000-0000-0000-000000000000";
|
3040
|
-
snapshotVersion = "
|
3058
|
+
snapshotVersion = "6";
|
3041
3059
|
mapValues = (obj, map) => {
|
3042
3060
|
const result = Object.keys(obj).reduce(function(result2, key) {
|
3043
3061
|
result2[key] = map(obj[key]);
|
@@ -6195,9 +6213,10 @@ var init_lib = __esm({
|
|
6195
6213
|
});
|
6196
6214
|
|
6197
6215
|
// src/serializer/mysqlSchema.ts
|
6198
|
-
var index, fk, column, tableV3, compositePK, uniqueConstraint, tableV4, table, dialect4, schemaHash, schemaInternalV3, schemaInternalV4,
|
6216
|
+
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;
|
6199
6217
|
var init_mysqlSchema = __esm({
|
6200
6218
|
"src/serializer/mysqlSchema.ts"() {
|
6219
|
+
"use strict";
|
6201
6220
|
init_global();
|
6202
6221
|
init_lib();
|
6203
6222
|
index = objectType({
|
@@ -6256,6 +6275,17 @@ var init_mysqlSchema = __esm({
|
|
6256
6275
|
compositePrimaryKeys: recordType(stringType(), compositePK),
|
6257
6276
|
uniqueConstraints: recordType(stringType(), uniqueConstraint).default({})
|
6258
6277
|
}).strict();
|
6278
|
+
kitInternals = objectType({
|
6279
|
+
tables: recordType(
|
6280
|
+
stringType(),
|
6281
|
+
objectType({
|
6282
|
+
columns: recordType(
|
6283
|
+
stringType(),
|
6284
|
+
objectType({ isDefaultAnExpression: booleanType().optional() }).optional()
|
6285
|
+
)
|
6286
|
+
}).optional()
|
6287
|
+
)
|
6288
|
+
}).optional();
|
6259
6289
|
dialect4 = literalType("mysql");
|
6260
6290
|
schemaHash = objectType({
|
6261
6291
|
id: stringType(),
|
@@ -6272,18 +6302,7 @@ var init_mysqlSchema = __esm({
|
|
6272
6302
|
tables: recordType(stringType(), tableV4),
|
6273
6303
|
schemas: recordType(stringType(), stringType())
|
6274
6304
|
}).strict();
|
6275
|
-
|
6276
|
-
tables: recordType(
|
6277
|
-
stringType(),
|
6278
|
-
objectType({
|
6279
|
-
columns: recordType(
|
6280
|
-
stringType(),
|
6281
|
-
objectType({ isDefaultAnExpression: booleanType().optional() }).optional()
|
6282
|
-
)
|
6283
|
-
}).optional()
|
6284
|
-
)
|
6285
|
-
}).optional();
|
6286
|
-
schemaInternal = objectType({
|
6305
|
+
schemaInternalV5 = objectType({
|
6287
6306
|
version: literalType("5"),
|
6288
6307
|
dialect: dialect4,
|
6289
6308
|
tables: recordType(stringType(), table),
|
@@ -6295,8 +6314,33 @@ var init_mysqlSchema = __esm({
|
|
6295
6314
|
}),
|
6296
6315
|
internal: kitInternals
|
6297
6316
|
}).strict();
|
6317
|
+
schemaInternalV6 = objectType({
|
6318
|
+
version: literalType("6"),
|
6319
|
+
dialect: dialect4,
|
6320
|
+
tables: recordType(stringType(), table),
|
6321
|
+
schemas: recordType(stringType(), stringType()),
|
6322
|
+
_meta: objectType({
|
6323
|
+
schemas: recordType(stringType(), stringType()),
|
6324
|
+
tables: recordType(stringType(), stringType()),
|
6325
|
+
columns: recordType(stringType(), stringType())
|
6326
|
+
}),
|
6327
|
+
internal: kitInternals
|
6328
|
+
}).strict();
|
6329
|
+
schemaInternal = objectType({
|
6330
|
+
version: literalType("6"),
|
6331
|
+
dialect: dialect4,
|
6332
|
+
tables: recordType(stringType(), table),
|
6333
|
+
schemas: recordType(stringType(), stringType()),
|
6334
|
+
_meta: objectType({
|
6335
|
+
schemas: recordType(stringType(), stringType()),
|
6336
|
+
tables: recordType(stringType(), stringType()),
|
6337
|
+
columns: recordType(stringType(), stringType())
|
6338
|
+
}),
|
6339
|
+
internal: kitInternals
|
6340
|
+
}).strict();
|
6298
6341
|
schemaV3 = schemaInternalV3.merge(schemaHash);
|
6299
6342
|
schemaV4 = schemaInternalV4.merge(schemaHash);
|
6343
|
+
schemaV5 = schemaInternalV5.merge(schemaHash);
|
6300
6344
|
schema2 = schemaInternal.merge(schemaHash);
|
6301
6345
|
tableSquashedV4 = objectType({
|
6302
6346
|
name: stringType(),
|
@@ -6422,12 +6466,9 @@ var init_mysqlSchema = __esm({
|
|
6422
6466
|
};
|
6423
6467
|
};
|
6424
6468
|
mysqlSchema = schema2;
|
6469
|
+
mysqlSchemaV5 = schemaV5;
|
6425
6470
|
mysqlSchemaSquashed = schemaSquashed;
|
6426
|
-
backwardCompatibleMysqlSchema = unionType([
|
6427
|
-
schemaV3,
|
6428
|
-
schemaV4,
|
6429
|
-
schema2
|
6430
|
-
]);
|
6471
|
+
backwardCompatibleMysqlSchema = unionType([mysqlSchemaV5, schema2]);
|
6431
6472
|
dryMySql = mysqlSchema.parse({
|
6432
6473
|
version: snapshotVersion,
|
6433
6474
|
dialect: "mysql",
|
@@ -6445,9 +6486,10 @@ var init_mysqlSchema = __esm({
|
|
6445
6486
|
});
|
6446
6487
|
|
6447
6488
|
// src/serializer/pgSchema.ts
|
6448
|
-
var indexV2, columnV2, tableV2, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, index2, fk2, column2, tableV32, compositePK2, uniqueConstraint2, tableV42, table2, schemaHash2, pgSchemaInternalV3, pgSchemaInternalV4,
|
6489
|
+
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;
|
6449
6490
|
var init_pgSchema = __esm({
|
6450
6491
|
"src/serializer/pgSchema.ts"() {
|
6492
|
+
"use strict";
|
6451
6493
|
init_global();
|
6452
6494
|
init_lib();
|
6453
6495
|
indexV2 = objectType({
|
@@ -6567,6 +6609,21 @@ var init_pgSchema = __esm({
|
|
6567
6609
|
id: stringType(),
|
6568
6610
|
prevId: stringType()
|
6569
6611
|
});
|
6612
|
+
kitInternals2 = objectType({
|
6613
|
+
tables: recordType(
|
6614
|
+
stringType(),
|
6615
|
+
objectType({
|
6616
|
+
columns: recordType(
|
6617
|
+
stringType(),
|
6618
|
+
objectType({
|
6619
|
+
isArray: booleanType().optional(),
|
6620
|
+
dimensions: numberType().optional(),
|
6621
|
+
rawType: stringType().optional()
|
6622
|
+
}).optional()
|
6623
|
+
)
|
6624
|
+
}).optional()
|
6625
|
+
)
|
6626
|
+
}).optional();
|
6570
6627
|
pgSchemaInternalV3 = objectType({
|
6571
6628
|
version: literalType("3"),
|
6572
6629
|
dialect: literalType("pg"),
|
@@ -6580,6 +6637,19 @@ var init_pgSchema = __esm({
|
|
6580
6637
|
enums: recordType(stringType(), enumSchema),
|
6581
6638
|
schemas: recordType(stringType(), stringType())
|
6582
6639
|
}).strict();
|
6640
|
+
pgSchemaInternalV5 = objectType({
|
6641
|
+
version: literalType("5"),
|
6642
|
+
dialect: literalType("pg"),
|
6643
|
+
tables: recordType(stringType(), table2),
|
6644
|
+
enums: recordType(stringType(), enumSchema),
|
6645
|
+
schemas: recordType(stringType(), stringType()),
|
6646
|
+
_meta: objectType({
|
6647
|
+
schemas: recordType(stringType(), stringType()),
|
6648
|
+
tables: recordType(stringType(), stringType()),
|
6649
|
+
columns: recordType(stringType(), stringType())
|
6650
|
+
}),
|
6651
|
+
internal: kitInternals2
|
6652
|
+
}).strict();
|
6583
6653
|
pgSchemaExternal = objectType({
|
6584
6654
|
version: literalType("5"),
|
6585
6655
|
dialect: literalType("pg"),
|
@@ -6592,23 +6662,8 @@ var init_pgSchema = __esm({
|
|
6592
6662
|
columns: recordType(stringType(), stringType())
|
6593
6663
|
})
|
6594
6664
|
}).strict();
|
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();
|
6610
6665
|
pgSchemaInternal = objectType({
|
6611
|
-
version: literalType("
|
6666
|
+
version: literalType("6"),
|
6612
6667
|
dialect: literalType("pg"),
|
6613
6668
|
tables: recordType(stringType(), table2),
|
6614
6669
|
enums: recordType(stringType(), enumSchema),
|
@@ -6644,7 +6699,7 @@ var init_pgSchema = __esm({
|
|
6644
6699
|
schemas: recordType(stringType(), stringType())
|
6645
6700
|
}).strict();
|
6646
6701
|
pgSchemaSquashed = objectType({
|
6647
|
-
version: literalType("
|
6702
|
+
version: literalType("6"),
|
6648
6703
|
dialect: enumType(["pg"]),
|
6649
6704
|
tables: recordType(stringType(), tableSquashed2),
|
6650
6705
|
enums: recordType(stringType(), enumSchema),
|
@@ -6652,14 +6707,9 @@ var init_pgSchema = __esm({
|
|
6652
6707
|
}).strict();
|
6653
6708
|
pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
|
6654
6709
|
pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
|
6710
|
+
pgSchemaV5 = pgSchemaInternalV5.merge(schemaHash2);
|
6655
6711
|
pgSchema = pgSchemaInternal.merge(schemaHash2);
|
6656
|
-
backwardCompatiblePgSchema = unionType([
|
6657
|
-
pgSchemaV1,
|
6658
|
-
pgSchemaV2,
|
6659
|
-
pgSchemaV3,
|
6660
|
-
pgSchemaV4,
|
6661
|
-
pgSchema
|
6662
|
-
]);
|
6712
|
+
backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema]);
|
6663
6713
|
PgSquasher = {
|
6664
6714
|
squashIdx: (idx) => {
|
6665
6715
|
index2.parse(idx);
|
@@ -6675,7 +6725,7 @@ var init_pgSchema = __esm({
|
|
6675
6725
|
return result;
|
6676
6726
|
},
|
6677
6727
|
squashFK: (fk4) => {
|
6678
|
-
return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${fk4.onUpdate ?? ""};${fk4.onDelete ?? ""};${fk4.schemaTo
|
6728
|
+
return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${fk4.onUpdate ?? ""};${fk4.onDelete ?? ""};${fk4.schemaTo || "public"}`;
|
6679
6729
|
},
|
6680
6730
|
squashPK: (pk) => {
|
6681
6731
|
return `${pk.columns.join(",")};${pk.name}`;
|
@@ -6752,7 +6802,7 @@ var init_pgSchema = __esm({
|
|
6752
6802
|
})
|
6753
6803
|
);
|
6754
6804
|
return {
|
6755
|
-
version: "
|
6805
|
+
version: "6",
|
6756
6806
|
dialect: json.dialect,
|
6757
6807
|
tables: mappedTables,
|
6758
6808
|
enums: json.enums,
|
@@ -6780,6 +6830,7 @@ var init_pgSchema = __esm({
|
|
6780
6830
|
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;
|
6781
6831
|
var init_sqliteSchema = __esm({
|
6782
6832
|
"src/serializer/sqliteSchema.ts"() {
|
6833
|
+
"use strict";
|
6783
6834
|
init_global();
|
6784
6835
|
init_lib();
|
6785
6836
|
index3 = objectType({
|
@@ -6964,7 +7015,7 @@ var init_sqliteSchema = __esm({
|
|
6964
7015
|
};
|
6965
7016
|
};
|
6966
7017
|
drySQLite = schema3.parse({
|
6967
|
-
version:
|
7018
|
+
version: "5",
|
6968
7019
|
dialect: "sqlite",
|
6969
7020
|
id: originUUID,
|
6970
7021
|
prevId: "",
|
@@ -6977,11 +7028,7 @@ var init_sqliteSchema = __esm({
|
|
6977
7028
|
});
|
6978
7029
|
sqliteSchema = schema3;
|
6979
7030
|
SQLiteSchemaSquashed = schemaSquashed2;
|
6980
|
-
backwardCompatibleSqliteSchema =
|
6981
|
-
schemaV32,
|
6982
|
-
schemaV42,
|
6983
|
-
schema3
|
6984
|
-
]);
|
7031
|
+
backwardCompatibleSqliteSchema = schema3;
|
6985
7032
|
}
|
6986
7033
|
});
|
6987
7034
|
|
@@ -6989,6 +7036,7 @@ var init_sqliteSchema = __esm({
|
|
6989
7036
|
var dialect6, commonSquashedSchema, commonSchema;
|
6990
7037
|
var init_schemaValidator = __esm({
|
6991
7038
|
"src/schemaValidator.ts"() {
|
7039
|
+
"use strict";
|
6992
7040
|
init_lib();
|
6993
7041
|
init_mysqlSchema();
|
6994
7042
|
init_pgSchema();
|
@@ -7011,6 +7059,7 @@ var init_schemaValidator = __esm({
|
|
7011
7059
|
var driver, configCommonSchema, introspectCasing, configIntrospectSchema, configIntrospectCliSchema, configGenerateSchema, configPushSchema, mysqlConnectionSchema, mySqlCliConfigSchema;
|
7012
7060
|
var init_common = __esm({
|
7013
7061
|
"src/cli/validations/common.ts"() {
|
7062
|
+
"use strict";
|
7014
7063
|
init_outputs();
|
7015
7064
|
init_lib();
|
7016
7065
|
init_schemaValidator();
|
@@ -7091,6 +7140,7 @@ var init_common = __esm({
|
|
7091
7140
|
var mysqlConnectionCli, mysql2credentials, mysqlConnectionConfig, mysqlConfigIntrospectSchema, mysqlCliIntrospectParams, mysqlCliPushParams, mysqlConfigPushParams;
|
7092
7141
|
var init_mysql = __esm({
|
7093
7142
|
"src/cli/validations/mysql.ts"() {
|
7143
|
+
"use strict";
|
7094
7144
|
init_lib();
|
7095
7145
|
init_utils();
|
7096
7146
|
init_common();
|
@@ -7151,6 +7201,7 @@ var init_mysql = __esm({
|
|
7151
7201
|
var pgConnectionCli, pgConnectionConfig, pgConfigIntrospectSchema, pgCliIntrospectParams, pgCliPushParams, pgConfigPushParams;
|
7152
7202
|
var init_pg = __esm({
|
7153
7203
|
"src/cli/validations/pg.ts"() {
|
7204
|
+
"use strict";
|
7154
7205
|
init_lib();
|
7155
7206
|
init_utils();
|
7156
7207
|
init_common();
|
@@ -7217,6 +7268,7 @@ var init_pg = __esm({
|
|
7217
7268
|
var sqliteConnectionCli, sqliteConnectionSchema, sqliteCliConfigSchema, sqliteCliIntrospectParams, sqliteCliPushParams, sqliteConfigPushParams;
|
7218
7269
|
var init_sqlite = __esm({
|
7219
7270
|
"src/cli/validations/sqlite.ts"() {
|
7271
|
+
"use strict";
|
7220
7272
|
init_lib();
|
7221
7273
|
init_utils();
|
7222
7274
|
init_common();
|
@@ -7285,6 +7337,7 @@ __export(es5_exports, {
|
|
7285
7337
|
var _, es5_default;
|
7286
7338
|
var init_es5 = __esm({
|
7287
7339
|
"src/cli/commands/_es5.ts"() {
|
7340
|
+
"use strict";
|
7288
7341
|
_ = "";
|
7289
7342
|
es5_default = _;
|
7290
7343
|
}
|
@@ -7386,20 +7439,20 @@ var require_ms = __commonJS({
|
|
7386
7439
|
function fmtLong(ms) {
|
7387
7440
|
var msAbs = Math.abs(ms);
|
7388
7441
|
if (msAbs >= d) {
|
7389
|
-
return
|
7442
|
+
return plural2(ms, msAbs, d, "day");
|
7390
7443
|
}
|
7391
7444
|
if (msAbs >= h) {
|
7392
|
-
return
|
7445
|
+
return plural2(ms, msAbs, h, "hour");
|
7393
7446
|
}
|
7394
7447
|
if (msAbs >= m) {
|
7395
|
-
return
|
7448
|
+
return plural2(ms, msAbs, m, "minute");
|
7396
7449
|
}
|
7397
7450
|
if (msAbs >= s) {
|
7398
|
-
return
|
7451
|
+
return plural2(ms, msAbs, s, "second");
|
7399
7452
|
}
|
7400
7453
|
return ms + " ms";
|
7401
7454
|
}
|
7402
|
-
function
|
7455
|
+
function plural2(ms, msAbs, n, name) {
|
7403
7456
|
var isPlural = msAbs >= n * 1.5;
|
7404
7457
|
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
7405
7458
|
}
|
@@ -12838,7 +12891,7 @@ var require_node2 = __commonJS({
|
|
12838
12891
|
...overrides
|
12839
12892
|
} = esbuildOptions;
|
12840
12893
|
const compile = function compile2(code, filename, format) {
|
12841
|
-
const
|
12894
|
+
const define2 = {
|
12842
12895
|
"import.meta.url": IMPORT_META_URL_VARIABLE_NAME,
|
12843
12896
|
...overrides.define
|
12844
12897
|
};
|
@@ -12857,7 +12910,7 @@ var require_node2 = __commonJS({
|
|
12857
12910
|
jsxFactory: options.jsxFactory,
|
12858
12911
|
jsxFragment: options.jsxFragment,
|
12859
12912
|
format,
|
12860
|
-
define,
|
12913
|
+
define: define2,
|
12861
12914
|
banner,
|
12862
12915
|
...overrides
|
12863
12916
|
});
|
@@ -12899,6 +12952,7 @@ var require_node2 = __commonJS({
|
|
12899
12952
|
var import_hanji2, assertES5, safeRegister;
|
12900
12953
|
var init_utils = __esm({
|
12901
12954
|
"src/cli/commands/utils.ts"() {
|
12955
|
+
"use strict";
|
12902
12956
|
init_serializer();
|
12903
12957
|
init_source();
|
12904
12958
|
init_views();
|
@@ -12968,6 +13022,7 @@ import { is as is6 } from "drizzle-orm";
|
|
12968
13022
|
var prepareFromExports3, prepareFromPgImports;
|
12969
13023
|
var init_pgImports = __esm({
|
12970
13024
|
"src/serializer/pgImports.ts"() {
|
13025
|
+
"use strict";
|
12971
13026
|
init_utils();
|
12972
13027
|
prepareFromExports3 = (exports) => {
|
12973
13028
|
const tables = [];
|
@@ -13013,6 +13068,7 @@ import { randomUUID } from "crypto";
|
|
13013
13068
|
var prepareMySqlDbPushSnapshot, prepareSQLiteDbPushSnapshot, preparePgDbPushSnapshot, prepareMySqlMigrationSnapshot, prepareSqliteMigrationSnapshot, fillPgSnapshot, preparePgMigrationSnapshot, preparePrevSnapshot;
|
13014
13069
|
var init_migrationPreparator = __esm({
|
13015
13070
|
"src/migrationPreparator.ts"() {
|
13071
|
+
"use strict";
|
13016
13072
|
init_serializer();
|
13017
13073
|
init_pgSchema();
|
13018
13074
|
init_sqliteSchema();
|
@@ -13099,7 +13155,7 @@ var init_migrationPreparator = __esm({
|
|
13099
13155
|
const serialized = await serializePg(schemaPath);
|
13100
13156
|
const id = randomUUID();
|
13101
13157
|
const idPrev = prevSnapshot.id;
|
13102
|
-
const result =
|
13158
|
+
const result = { id, prevId: idPrev, ...serialized };
|
13103
13159
|
const { id: _ignoredId, prevId: _ignoredPrevId, ...prevRest } = prevSnapshot;
|
13104
13160
|
const custom = fillPgSnapshot({ serialized: prevRest, id, idPrev });
|
13105
13161
|
return { prev: prevSnapshot, cur: result, custom };
|
@@ -13117,6 +13173,363 @@ var init_migrationPreparator = __esm({
|
|
13117
13173
|
}
|
13118
13174
|
});
|
13119
13175
|
|
13176
|
+
// node_modules/.pnpm/pluralize@8.0.0/node_modules/pluralize/pluralize.js
|
13177
|
+
var require_pluralize = __commonJS({
|
13178
|
+
"node_modules/.pnpm/pluralize@8.0.0/node_modules/pluralize/pluralize.js"(exports, module) {
|
13179
|
+
(function(root, pluralize) {
|
13180
|
+
if (typeof __require === "function" && typeof exports === "object" && typeof module === "object") {
|
13181
|
+
module.exports = pluralize();
|
13182
|
+
} else if (typeof define === "function" && define.amd) {
|
13183
|
+
define(function() {
|
13184
|
+
return pluralize();
|
13185
|
+
});
|
13186
|
+
} else {
|
13187
|
+
root.pluralize = pluralize();
|
13188
|
+
}
|
13189
|
+
})(exports, function() {
|
13190
|
+
var pluralRules = [];
|
13191
|
+
var singularRules = [];
|
13192
|
+
var uncountables = {};
|
13193
|
+
var irregularPlurals = {};
|
13194
|
+
var irregularSingles = {};
|
13195
|
+
function sanitizeRule(rule) {
|
13196
|
+
if (typeof rule === "string") {
|
13197
|
+
return new RegExp("^" + rule + "$", "i");
|
13198
|
+
}
|
13199
|
+
return rule;
|
13200
|
+
}
|
13201
|
+
function restoreCase(word, token) {
|
13202
|
+
if (word === token)
|
13203
|
+
return token;
|
13204
|
+
if (word === word.toLowerCase())
|
13205
|
+
return token.toLowerCase();
|
13206
|
+
if (word === word.toUpperCase())
|
13207
|
+
return token.toUpperCase();
|
13208
|
+
if (word[0] === word[0].toUpperCase()) {
|
13209
|
+
return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase();
|
13210
|
+
}
|
13211
|
+
return token.toLowerCase();
|
13212
|
+
}
|
13213
|
+
function interpolate(str, args) {
|
13214
|
+
return str.replace(/\$(\d{1,2})/g, function(match2, index4) {
|
13215
|
+
return args[index4] || "";
|
13216
|
+
});
|
13217
|
+
}
|
13218
|
+
function replace(word, rule) {
|
13219
|
+
return word.replace(rule[0], function(match2, index4) {
|
13220
|
+
var result = interpolate(rule[1], arguments);
|
13221
|
+
if (match2 === "") {
|
13222
|
+
return restoreCase(word[index4 - 1], result);
|
13223
|
+
}
|
13224
|
+
return restoreCase(match2, result);
|
13225
|
+
});
|
13226
|
+
}
|
13227
|
+
function sanitizeWord(token, word, rules) {
|
13228
|
+
if (!token.length || uncountables.hasOwnProperty(token)) {
|
13229
|
+
return word;
|
13230
|
+
}
|
13231
|
+
var len = rules.length;
|
13232
|
+
while (len--) {
|
13233
|
+
var rule = rules[len];
|
13234
|
+
if (rule[0].test(word))
|
13235
|
+
return replace(word, rule);
|
13236
|
+
}
|
13237
|
+
return word;
|
13238
|
+
}
|
13239
|
+
function replaceWord(replaceMap, keepMap, rules) {
|
13240
|
+
return function(word) {
|
13241
|
+
var token = word.toLowerCase();
|
13242
|
+
if (keepMap.hasOwnProperty(token)) {
|
13243
|
+
return restoreCase(word, token);
|
13244
|
+
}
|
13245
|
+
if (replaceMap.hasOwnProperty(token)) {
|
13246
|
+
return restoreCase(word, replaceMap[token]);
|
13247
|
+
}
|
13248
|
+
return sanitizeWord(token, word, rules);
|
13249
|
+
};
|
13250
|
+
}
|
13251
|
+
function checkWord(replaceMap, keepMap, rules, bool) {
|
13252
|
+
return function(word) {
|
13253
|
+
var token = word.toLowerCase();
|
13254
|
+
if (keepMap.hasOwnProperty(token))
|
13255
|
+
return true;
|
13256
|
+
if (replaceMap.hasOwnProperty(token))
|
13257
|
+
return false;
|
13258
|
+
return sanitizeWord(token, token, rules) === token;
|
13259
|
+
};
|
13260
|
+
}
|
13261
|
+
function pluralize(word, count, inclusive) {
|
13262
|
+
var pluralized = count === 1 ? pluralize.singular(word) : pluralize.plural(word);
|
13263
|
+
return (inclusive ? count + " " : "") + pluralized;
|
13264
|
+
}
|
13265
|
+
pluralize.plural = replaceWord(
|
13266
|
+
irregularSingles,
|
13267
|
+
irregularPlurals,
|
13268
|
+
pluralRules
|
13269
|
+
);
|
13270
|
+
pluralize.isPlural = checkWord(
|
13271
|
+
irregularSingles,
|
13272
|
+
irregularPlurals,
|
13273
|
+
pluralRules
|
13274
|
+
);
|
13275
|
+
pluralize.singular = replaceWord(
|
13276
|
+
irregularPlurals,
|
13277
|
+
irregularSingles,
|
13278
|
+
singularRules
|
13279
|
+
);
|
13280
|
+
pluralize.isSingular = checkWord(
|
13281
|
+
irregularPlurals,
|
13282
|
+
irregularSingles,
|
13283
|
+
singularRules
|
13284
|
+
);
|
13285
|
+
pluralize.addPluralRule = function(rule, replacement) {
|
13286
|
+
pluralRules.push([sanitizeRule(rule), replacement]);
|
13287
|
+
};
|
13288
|
+
pluralize.addSingularRule = function(rule, replacement) {
|
13289
|
+
singularRules.push([sanitizeRule(rule), replacement]);
|
13290
|
+
};
|
13291
|
+
pluralize.addUncountableRule = function(word) {
|
13292
|
+
if (typeof word === "string") {
|
13293
|
+
uncountables[word.toLowerCase()] = true;
|
13294
|
+
return;
|
13295
|
+
}
|
13296
|
+
pluralize.addPluralRule(word, "$0");
|
13297
|
+
pluralize.addSingularRule(word, "$0");
|
13298
|
+
};
|
13299
|
+
pluralize.addIrregularRule = function(single, plural2) {
|
13300
|
+
plural2 = plural2.toLowerCase();
|
13301
|
+
single = single.toLowerCase();
|
13302
|
+
irregularSingles[single] = plural2;
|
13303
|
+
irregularPlurals[plural2] = single;
|
13304
|
+
};
|
13305
|
+
[
|
13306
|
+
// Pronouns.
|
13307
|
+
["I", "we"],
|
13308
|
+
["me", "us"],
|
13309
|
+
["he", "they"],
|
13310
|
+
["she", "they"],
|
13311
|
+
["them", "them"],
|
13312
|
+
["myself", "ourselves"],
|
13313
|
+
["yourself", "yourselves"],
|
13314
|
+
["itself", "themselves"],
|
13315
|
+
["herself", "themselves"],
|
13316
|
+
["himself", "themselves"],
|
13317
|
+
["themself", "themselves"],
|
13318
|
+
["is", "are"],
|
13319
|
+
["was", "were"],
|
13320
|
+
["has", "have"],
|
13321
|
+
["this", "these"],
|
13322
|
+
["that", "those"],
|
13323
|
+
// Words ending in with a consonant and `o`.
|
13324
|
+
["echo", "echoes"],
|
13325
|
+
["dingo", "dingoes"],
|
13326
|
+
["volcano", "volcanoes"],
|
13327
|
+
["tornado", "tornadoes"],
|
13328
|
+
["torpedo", "torpedoes"],
|
13329
|
+
// Ends with `us`.
|
13330
|
+
["genus", "genera"],
|
13331
|
+
["viscus", "viscera"],
|
13332
|
+
// Ends with `ma`.
|
13333
|
+
["stigma", "stigmata"],
|
13334
|
+
["stoma", "stomata"],
|
13335
|
+
["dogma", "dogmata"],
|
13336
|
+
["lemma", "lemmata"],
|
13337
|
+
["schema", "schemata"],
|
13338
|
+
["anathema", "anathemata"],
|
13339
|
+
// Other irregular rules.
|
13340
|
+
["ox", "oxen"],
|
13341
|
+
["axe", "axes"],
|
13342
|
+
["die", "dice"],
|
13343
|
+
["yes", "yeses"],
|
13344
|
+
["foot", "feet"],
|
13345
|
+
["eave", "eaves"],
|
13346
|
+
["goose", "geese"],
|
13347
|
+
["tooth", "teeth"],
|
13348
|
+
["quiz", "quizzes"],
|
13349
|
+
["human", "humans"],
|
13350
|
+
["proof", "proofs"],
|
13351
|
+
["carve", "carves"],
|
13352
|
+
["valve", "valves"],
|
13353
|
+
["looey", "looies"],
|
13354
|
+
["thief", "thieves"],
|
13355
|
+
["groove", "grooves"],
|
13356
|
+
["pickaxe", "pickaxes"],
|
13357
|
+
["passerby", "passersby"]
|
13358
|
+
].forEach(function(rule) {
|
13359
|
+
return pluralize.addIrregularRule(rule[0], rule[1]);
|
13360
|
+
});
|
13361
|
+
[
|
13362
|
+
[/s?$/i, "s"],
|
13363
|
+
[/[^\u0000-\u007F]$/i, "$0"],
|
13364
|
+
[/([^aeiou]ese)$/i, "$1"],
|
13365
|
+
[/(ax|test)is$/i, "$1es"],
|
13366
|
+
[/(alias|[^aou]us|t[lm]as|gas|ris)$/i, "$1es"],
|
13367
|
+
[/(e[mn]u)s?$/i, "$1s"],
|
13368
|
+
[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, "$1"],
|
13369
|
+
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1i"],
|
13370
|
+
[/(alumn|alg|vertebr)(?:a|ae)$/i, "$1ae"],
|
13371
|
+
[/(seraph|cherub)(?:im)?$/i, "$1im"],
|
13372
|
+
[/(her|at|gr)o$/i, "$1oes"],
|
13373
|
+
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, "$1a"],
|
13374
|
+
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, "$1a"],
|
13375
|
+
[/sis$/i, "ses"],
|
13376
|
+
[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, "$1$2ves"],
|
13377
|
+
[/([^aeiouy]|qu)y$/i, "$1ies"],
|
13378
|
+
[/([^ch][ieo][ln])ey$/i, "$1ies"],
|
13379
|
+
[/(x|ch|ss|sh|zz)$/i, "$1es"],
|
13380
|
+
[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, "$1ices"],
|
13381
|
+
[/\b((?:tit)?m|l)(?:ice|ouse)$/i, "$1ice"],
|
13382
|
+
[/(pe)(?:rson|ople)$/i, "$1ople"],
|
13383
|
+
[/(child)(?:ren)?$/i, "$1ren"],
|
13384
|
+
[/eaux$/i, "$0"],
|
13385
|
+
[/m[ae]n$/i, "men"],
|
13386
|
+
["thou", "you"]
|
13387
|
+
].forEach(function(rule) {
|
13388
|
+
return pluralize.addPluralRule(rule[0], rule[1]);
|
13389
|
+
});
|
13390
|
+
[
|
13391
|
+
[/s$/i, ""],
|
13392
|
+
[/(ss)$/i, "$1"],
|
13393
|
+
[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, "$1fe"],
|
13394
|
+
[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, "$1f"],
|
13395
|
+
[/ies$/i, "y"],
|
13396
|
+
[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, "$1ie"],
|
13397
|
+
[/\b(mon|smil)ies$/i, "$1ey"],
|
13398
|
+
[/\b((?:tit)?m|l)ice$/i, "$1ouse"],
|
13399
|
+
[/(seraph|cherub)im$/i, "$1"],
|
13400
|
+
[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, "$1"],
|
13401
|
+
[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, "$1sis"],
|
13402
|
+
[/(movie|twelve|abuse|e[mn]u)s$/i, "$1"],
|
13403
|
+
[/(test)(?:is|es)$/i, "$1is"],
|
13404
|
+
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1us"],
|
13405
|
+
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, "$1um"],
|
13406
|
+
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, "$1on"],
|
13407
|
+
[/(alumn|alg|vertebr)ae$/i, "$1a"],
|
13408
|
+
[/(cod|mur|sil|vert|ind)ices$/i, "$1ex"],
|
13409
|
+
[/(matr|append)ices$/i, "$1ix"],
|
13410
|
+
[/(pe)(rson|ople)$/i, "$1rson"],
|
13411
|
+
[/(child)ren$/i, "$1"],
|
13412
|
+
[/(eau)x?$/i, "$1"],
|
13413
|
+
[/men$/i, "man"]
|
13414
|
+
].forEach(function(rule) {
|
13415
|
+
return pluralize.addSingularRule(rule[0], rule[1]);
|
13416
|
+
});
|
13417
|
+
[
|
13418
|
+
// Singular words with no plurals.
|
13419
|
+
"adulthood",
|
13420
|
+
"advice",
|
13421
|
+
"agenda",
|
13422
|
+
"aid",
|
13423
|
+
"aircraft",
|
13424
|
+
"alcohol",
|
13425
|
+
"ammo",
|
13426
|
+
"analytics",
|
13427
|
+
"anime",
|
13428
|
+
"athletics",
|
13429
|
+
"audio",
|
13430
|
+
"bison",
|
13431
|
+
"blood",
|
13432
|
+
"bream",
|
13433
|
+
"buffalo",
|
13434
|
+
"butter",
|
13435
|
+
"carp",
|
13436
|
+
"cash",
|
13437
|
+
"chassis",
|
13438
|
+
"chess",
|
13439
|
+
"clothing",
|
13440
|
+
"cod",
|
13441
|
+
"commerce",
|
13442
|
+
"cooperation",
|
13443
|
+
"corps",
|
13444
|
+
"debris",
|
13445
|
+
"diabetes",
|
13446
|
+
"digestion",
|
13447
|
+
"elk",
|
13448
|
+
"energy",
|
13449
|
+
"equipment",
|
13450
|
+
"excretion",
|
13451
|
+
"expertise",
|
13452
|
+
"firmware",
|
13453
|
+
"flounder",
|
13454
|
+
"fun",
|
13455
|
+
"gallows",
|
13456
|
+
"garbage",
|
13457
|
+
"graffiti",
|
13458
|
+
"hardware",
|
13459
|
+
"headquarters",
|
13460
|
+
"health",
|
13461
|
+
"herpes",
|
13462
|
+
"highjinks",
|
13463
|
+
"homework",
|
13464
|
+
"housework",
|
13465
|
+
"information",
|
13466
|
+
"jeans",
|
13467
|
+
"justice",
|
13468
|
+
"kudos",
|
13469
|
+
"labour",
|
13470
|
+
"literature",
|
13471
|
+
"machinery",
|
13472
|
+
"mackerel",
|
13473
|
+
"mail",
|
13474
|
+
"media",
|
13475
|
+
"mews",
|
13476
|
+
"moose",
|
13477
|
+
"music",
|
13478
|
+
"mud",
|
13479
|
+
"manga",
|
13480
|
+
"news",
|
13481
|
+
"only",
|
13482
|
+
"personnel",
|
13483
|
+
"pike",
|
13484
|
+
"plankton",
|
13485
|
+
"pliers",
|
13486
|
+
"police",
|
13487
|
+
"pollution",
|
13488
|
+
"premises",
|
13489
|
+
"rain",
|
13490
|
+
"research",
|
13491
|
+
"rice",
|
13492
|
+
"salmon",
|
13493
|
+
"scissors",
|
13494
|
+
"series",
|
13495
|
+
"sewage",
|
13496
|
+
"shambles",
|
13497
|
+
"shrimp",
|
13498
|
+
"software",
|
13499
|
+
"species",
|
13500
|
+
"staff",
|
13501
|
+
"swine",
|
13502
|
+
"tennis",
|
13503
|
+
"traffic",
|
13504
|
+
"transportation",
|
13505
|
+
"trout",
|
13506
|
+
"tuna",
|
13507
|
+
"wealth",
|
13508
|
+
"welfare",
|
13509
|
+
"whiting",
|
13510
|
+
"wildebeest",
|
13511
|
+
"wildlife",
|
13512
|
+
"you",
|
13513
|
+
/pok[eé]mon$/i,
|
13514
|
+
// Regexes.
|
13515
|
+
/[^aeiou]ese$/i,
|
13516
|
+
// "chinese", "japanese"
|
13517
|
+
/deer$/i,
|
13518
|
+
// "deer", "reindeer"
|
13519
|
+
/fish$/i,
|
13520
|
+
// "fish", "blowfish", "angelfish"
|
13521
|
+
/measles$/i,
|
13522
|
+
/o[iu]s$/i,
|
13523
|
+
// "carnivorous"
|
13524
|
+
/pox$/i,
|
13525
|
+
// "chickpox", "smallpox"
|
13526
|
+
/sheep$/i
|
13527
|
+
].forEach(pluralize.addUncountableRule);
|
13528
|
+
return pluralize;
|
13529
|
+
});
|
13530
|
+
}
|
13531
|
+
});
|
13532
|
+
|
13120
13533
|
// node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js
|
13121
13534
|
var require_balanced_match = __commonJS({
|
13122
13535
|
"node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js"(exports, module) {
|
@@ -13407,6 +13820,7 @@ function applyJsonDiff(json1, json2) {
|
|
13407
13820
|
var findAlternationsInTable, alternationsInColumn;
|
13408
13821
|
var init_jsonDiffer = __esm({
|
13409
13822
|
"src/jsonDiffer.js"() {
|
13823
|
+
"use strict";
|
13410
13824
|
"use-strict";
|
13411
13825
|
findAlternationsInTable = (table4, tableSchema) => {
|
13412
13826
|
const columns = table4.columns ?? {};
|
@@ -13578,20 +13992,21 @@ var init_jsonDiffer = __esm({
|
|
13578
13992
|
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;
|
13579
13993
|
var init_jsonStatements = __esm({
|
13580
13994
|
"src/jsonStatements.ts"() {
|
13995
|
+
"use strict";
|
13581
13996
|
init_mysqlSchema();
|
13582
13997
|
init_pgSchema();
|
13583
13998
|
init_sqliteSchema();
|
13584
13999
|
preparePgCreateTableJson = (table4, json2) => {
|
13585
14000
|
const { name, schema: schema4, columns, compositePrimaryKeys, uniqueConstraints } = table4;
|
14001
|
+
const tableKey = `${schema4 || "public"}.${name}`;
|
14002
|
+
const compositePkName = Object.values(compositePrimaryKeys).length > 0 ? json2.tables[tableKey].compositePrimaryKeys[`${PgSquasher.unsquashPK(Object.values(compositePrimaryKeys)[0]).name}`].name : "";
|
13586
14003
|
return {
|
13587
14004
|
type: "create_table",
|
13588
14005
|
tableName: name,
|
13589
14006
|
schema: schema4,
|
13590
14007
|
columns: Object.values(columns),
|
13591
14008
|
compositePKs: Object.values(compositePrimaryKeys),
|
13592
|
-
compositePkName
|
13593
|
-
Object.values(compositePrimaryKeys)[0]
|
13594
|
-
).name}`].name : "",
|
14009
|
+
compositePkName,
|
13595
14010
|
uniqueConstraints: Object.values(uniqueConstraints)
|
13596
14011
|
};
|
13597
14012
|
};
|
@@ -13693,7 +14108,8 @@ var init_jsonStatements = __esm({
|
|
13693
14108
|
prepareAlterTableColumnsJson = (tableName, schema4, deleted, added, altered, addedFk, json2, dialect7) => {
|
13694
14109
|
const addColumns = [];
|
13695
14110
|
const dropColumns = _prepareDropColumns(tableName, schema4, deleted);
|
13696
|
-
const
|
14111
|
+
const tableKey = `${schema4 || "public"}.${tableName}`;
|
14112
|
+
const alterColumns = _prepareAlterColumns(tableKey, schema4, altered, json2);
|
13697
14113
|
if (dialect7 === "sqlite") {
|
13698
14114
|
let jsonCreateFKStatements = Object.values(addedFk);
|
13699
14115
|
const sqliteAddColumns = _prepareSQLiteAddColumns(
|
@@ -13743,19 +14159,22 @@ var init_jsonStatements = __esm({
|
|
13743
14159
|
};
|
13744
14160
|
});
|
13745
14161
|
};
|
13746
|
-
_prepareAlterColumns = (
|
14162
|
+
_prepareAlterColumns = (tableKey, schema4, columns, json2) => {
|
13747
14163
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
13748
14164
|
let statements = [];
|
13749
14165
|
let dropPkStatements = [];
|
13750
14166
|
let setPkStatements = [];
|
13751
14167
|
for (const column4 of columns) {
|
13752
14168
|
const columnName = typeof column4.name !== "string" ? column4.name.new : column4.name;
|
13753
|
-
const
|
13754
|
-
const
|
13755
|
-
const
|
13756
|
-
const
|
13757
|
-
const
|
13758
|
-
const
|
14169
|
+
const table4 = json2.tables[tableKey];
|
14170
|
+
const tableName = table4.name;
|
14171
|
+
const snapshotColumn = table4.columns[columnName];
|
14172
|
+
const columnType = snapshotColumn.type;
|
14173
|
+
const columnDefault = snapshotColumn.default;
|
14174
|
+
const columnOnUpdate = "onUpdate" in snapshotColumn ? snapshotColumn.onUpdate : void 0;
|
14175
|
+
const columnNotNull = table4.columns[columnName].notNull;
|
14176
|
+
const columnAutoIncrement = "autoincrement" in snapshotColumn ? snapshotColumn.autoincrement ?? false : false;
|
14177
|
+
const columnPk = table4.columns[columnName].primaryKey;
|
13759
14178
|
if (((_a = column4.autoincrement) == null ? void 0 : _a.type) === "added") {
|
13760
14179
|
statements.push({
|
13761
14180
|
type: "alter_table_alter_column_set_autoincrement",
|
@@ -13802,13 +14221,14 @@ var init_jsonStatements = __esm({
|
|
13802
14221
|
}
|
13803
14222
|
for (const column4 of columns) {
|
13804
14223
|
const columnName = typeof column4.name !== "string" ? column4.name.new : column4.name;
|
13805
|
-
const
|
13806
|
-
const
|
13807
|
-
const
|
13808
|
-
const
|
13809
|
-
const
|
13810
|
-
const
|
13811
|
-
const
|
14224
|
+
const tableName = json2.tables[tableKey].name;
|
14225
|
+
const columnType = json2.tables[tableKey].columns[columnName].type;
|
14226
|
+
const columnDefault = json2.tables[tableKey].columns[columnName].default;
|
14227
|
+
const columnOnUpdate = json2.tables[tableKey].columns[columnName].onUpdate;
|
14228
|
+
const columnNotNull = json2.tables[tableKey].columns[columnName].notNull;
|
14229
|
+
const columnAutoIncrement = json2.tables[tableKey].columns[columnName].autoincrement;
|
14230
|
+
const columnPk = json2.tables[tableKey].columns[columnName].primaryKey;
|
14231
|
+
const compositePk = json2.tables[tableKey].compositePrimaryKeys[`${tableName}_${columnName}`];
|
13812
14232
|
if (typeof column4.name !== "string") {
|
13813
14233
|
statements.push({
|
13814
14234
|
type: "alter_table_rename_column",
|
@@ -14159,6 +14579,7 @@ var init_jsonStatements = __esm({
|
|
14159
14579
|
var prepareMigrationMetadata, adjectives, heroes;
|
14160
14580
|
var init_words = __esm({
|
14161
14581
|
"src/utils/words.ts"() {
|
14582
|
+
"use strict";
|
14162
14583
|
prepareMigrationMetadata = (idx) => {
|
14163
14584
|
const prefix = idx.toFixed(0).padStart(4, "0");
|
14164
14585
|
const suffix = `${adjectives.random()}_${heroes.random()}`;
|
@@ -15479,6 +15900,7 @@ var init_words = __esm({
|
|
15479
15900
|
// src/cli/commands/pgUp.ts
|
15480
15901
|
var init_pgUp = __esm({
|
15481
15902
|
"src/cli/commands/pgUp.ts"() {
|
15903
|
+
"use strict";
|
15482
15904
|
init_source();
|
15483
15905
|
init_global();
|
15484
15906
|
init_pgSchema();
|
@@ -15489,6 +15911,7 @@ var init_pgUp = __esm({
|
|
15489
15911
|
// src/cli/commands/mysqlUp.ts
|
15490
15912
|
var init_mysqlUp = __esm({
|
15491
15913
|
"src/cli/commands/mysqlUp.ts"() {
|
15914
|
+
"use strict";
|
15492
15915
|
init_source();
|
15493
15916
|
init_mysqlSchema();
|
15494
15917
|
init_utils2();
|
@@ -15498,6 +15921,7 @@ var init_mysqlUp = __esm({
|
|
15498
15921
|
// src/cli/commands/upFolders.ts
|
15499
15922
|
var init_upFolders = __esm({
|
15500
15923
|
"src/cli/commands/upFolders.ts"() {
|
15924
|
+
"use strict";
|
15501
15925
|
init_jsonDiffer();
|
15502
15926
|
init_mysqlSchema();
|
15503
15927
|
init_sqliteSchema();
|
@@ -15519,9 +15943,10 @@ import {
|
|
15519
15943
|
writeFileSync
|
15520
15944
|
} from "fs";
|
15521
15945
|
import { join } from "path";
|
15522
|
-
var assertV1OutFolder, dryJournal,
|
15946
|
+
var assertV1OutFolder, dryJournal, prepareOutFolder, validatorForDialect, validateWithReport, prepareMigrationFolder, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey;
|
15523
15947
|
var init_utils2 = __esm({
|
15524
15948
|
"src/utils.ts"() {
|
15949
|
+
"use strict";
|
15525
15950
|
init_views();
|
15526
15951
|
init_mysqlSchema();
|
15527
15952
|
init_pgSchema();
|
@@ -15530,7 +15955,7 @@ var init_utils2 = __esm({
|
|
15530
15955
|
init_global();
|
15531
15956
|
init_upFolders();
|
15532
15957
|
init_snapshotsDiffer();
|
15533
|
-
assertV1OutFolder = (out
|
15958
|
+
assertV1OutFolder = (out) => {
|
15534
15959
|
if (!existsSync(out))
|
15535
15960
|
return;
|
15536
15961
|
const oldMigrationFolders = readdirSync(out).filter(
|
@@ -15539,7 +15964,7 @@ var init_utils2 = __esm({
|
|
15539
15964
|
if (oldMigrationFolders.length > 0) {
|
15540
15965
|
console.log(
|
15541
15966
|
`Your migrations folder format is outdated, please run ${source_default.green.bold(
|
15542
|
-
`drizzle-kit up
|
15967
|
+
`drizzle-kit up`
|
15543
15968
|
)}`
|
15544
15969
|
);
|
15545
15970
|
process.exit(1);
|
@@ -15552,7 +15977,7 @@ var init_utils2 = __esm({
|
|
15552
15977
|
entries: []
|
15553
15978
|
};
|
15554
15979
|
};
|
15555
|
-
|
15980
|
+
prepareOutFolder = (out, dialect7) => {
|
15556
15981
|
const meta = join(out, "meta");
|
15557
15982
|
const journalPath = join(meta, "_journal.json");
|
15558
15983
|
if (!existsSync(join(out, "meta"))) {
|
@@ -15567,9 +15992,9 @@ var init_utils2 = __esm({
|
|
15567
15992
|
validatorForDialect = (dialect7) => {
|
15568
15993
|
switch (dialect7) {
|
15569
15994
|
case "pg":
|
15570
|
-
return { validator: backwardCompatiblePgSchema, version:
|
15995
|
+
return { validator: backwardCompatiblePgSchema, version: 6 };
|
15571
15996
|
case "sqlite":
|
15572
|
-
return { validator: backwardCompatibleSqliteSchema, version:
|
15997
|
+
return { validator: backwardCompatibleSqliteSchema, version: 6 };
|
15573
15998
|
case "mysql":
|
15574
15999
|
return { validator: backwardCompatibleMysqlSchema, version: 5 };
|
15575
16000
|
}
|
@@ -15617,13 +16042,13 @@ var init_utils2 = __esm({
|
|
15617
16042
|
return result;
|
15618
16043
|
};
|
15619
16044
|
prepareMigrationFolder = (outFolder = "drizzle", dialect7) => {
|
15620
|
-
const { snapshots, journal } =
|
16045
|
+
const { snapshots, journal } = prepareOutFolder(outFolder, dialect7);
|
15621
16046
|
const report = validateWithReport(snapshots, dialect7);
|
15622
16047
|
if (report.nonLatest.length > 0) {
|
15623
16048
|
console.log(
|
15624
16049
|
report.nonLatest.map((it) => {
|
15625
16050
|
return `${it}/snapshot.json is not of the latest version`;
|
15626
|
-
}).concat(`Run ${source_default.green.bold(`drizzle-kit up
|
16051
|
+
}).concat(`Run ${source_default.green.bold(`drizzle-kit up`)}`).join("\n")
|
15627
16052
|
);
|
15628
16053
|
process.exit(0);
|
15629
16054
|
}
|
@@ -15692,6 +16117,7 @@ var init_utils2 = __esm({
|
|
15692
16117
|
var makeChanged, makeSelfOrChanged, makePatched, makeSelfOrPatched, valueFromSelfOrPatchedNew, columnSchema, alteredColumnSchema, enumSchema2, changedEnumSchema, tableScheme, alteredTableScheme, diffResultScheme, applySnapshotsDiff;
|
15693
16118
|
var init_snapshotsDiffer = __esm({
|
15694
16119
|
"src/snapshotsDiffer.ts"() {
|
16120
|
+
"use strict";
|
15695
16121
|
init_sqlgenerator();
|
15696
16122
|
init_lib();
|
15697
16123
|
init_jsonDiffer();
|
@@ -15699,6 +16125,7 @@ var init_snapshotsDiffer = __esm({
|
|
15699
16125
|
init_utils2();
|
15700
16126
|
init_sqliteSchema();
|
15701
16127
|
init_mysqlSchema();
|
16128
|
+
init_global();
|
15702
16129
|
makeChanged = (schema4) => {
|
15703
16130
|
return objectType({
|
15704
16131
|
type: enumType(["changed"]),
|
@@ -15737,7 +16164,7 @@ var init_snapshotsDiffer = __esm({
|
|
15737
16164
|
return unionType([
|
15738
16165
|
objectType({
|
15739
16166
|
type: literalType("none"),
|
15740
|
-
value: schema4
|
16167
|
+
value: schema4
|
15741
16168
|
}),
|
15742
16169
|
objectType({
|
15743
16170
|
type: literalType("added"),
|
@@ -15861,7 +16288,6 @@ var init_snapshotsDiffer = __esm({
|
|
15861
16288
|
}).strict();
|
15862
16289
|
applySnapshotsDiff = async (json1, json2, dialect7, schemasResolver, tablesResolver, columnsResolver, prevFull, curFull) => {
|
15863
16290
|
var _a, _b;
|
15864
|
-
let diffResult;
|
15865
16291
|
if (dialect7 === "mysql") {
|
15866
16292
|
for (const tableName in json1.tables) {
|
15867
16293
|
const table4 = json1.tables[tableName];
|
@@ -15889,13 +16315,26 @@ var init_snapshotsDiffer = __esm({
|
|
15889
16315
|
}
|
15890
16316
|
}
|
15891
16317
|
}
|
15892
|
-
diffResult = applyJsonDiff(json1, json2);
|
15893
16318
|
}
|
15894
|
-
diffResult = applyJsonDiff(json1, json2);
|
16319
|
+
const diffResult = applyJsonDiff(json1, json2);
|
15895
16320
|
if (Object.keys(diffResult).length === 0) {
|
15896
16321
|
return { statements: [], sqlStatements: [], _meta: void 0 };
|
15897
16322
|
}
|
15898
16323
|
const typedResult = diffResultScheme.parse(diffResult);
|
16324
|
+
typedResult.alteredTablesWithColumns = typedResult.alteredTablesWithColumns.map((it) => {
|
16325
|
+
let schemaToTrim;
|
16326
|
+
if (it.schema.type === "none") {
|
16327
|
+
schemaToTrim = it.schema.value || "public";
|
16328
|
+
} else if (it.schema.type === "deleted") {
|
16329
|
+
schemaToTrim = it.schema.value;
|
16330
|
+
} else if (it.schema.type === "added") {
|
16331
|
+
schemaToTrim = "public";
|
16332
|
+
} else {
|
16333
|
+
schemaToTrim = it.schema.old;
|
16334
|
+
}
|
16335
|
+
it.name = it.name.substring(schemaToTrim.length + 1);
|
16336
|
+
return it;
|
16337
|
+
});
|
15899
16338
|
const {
|
15900
16339
|
created: createdSchemas,
|
15901
16340
|
deleted: deletedSchemas,
|
@@ -16047,7 +16486,7 @@ var init_snapshotsDiffer = __esm({
|
|
16047
16486
|
prevFull,
|
16048
16487
|
curFull
|
16049
16488
|
);
|
16050
|
-
} else {
|
16489
|
+
} else if (dialect7 === "mysql") {
|
16051
16490
|
addedCompositePKs = prepareAddCompositePrimaryKeyMySql(
|
16052
16491
|
it.name,
|
16053
16492
|
it.addedCompositePKs,
|
@@ -16065,6 +16504,8 @@ var init_snapshotsDiffer = __esm({
|
|
16065
16504
|
prevFull,
|
16066
16505
|
curFull
|
16067
16506
|
);
|
16507
|
+
} else {
|
16508
|
+
assertUnreachable(dialect7);
|
16068
16509
|
}
|
16069
16510
|
let addedUniqueConstraints = [];
|
16070
16511
|
let deletedUniqueConstraints = [];
|
@@ -16255,11 +16696,13 @@ var init_snapshotsDiffer = __esm({
|
|
16255
16696
|
return preparePgCreateTableJson(it, curFull);
|
16256
16697
|
});
|
16257
16698
|
jsonStatements.push(...jsonPgCreateTables);
|
16258
|
-
} else {
|
16699
|
+
} else if (dialect7 === "mysql") {
|
16259
16700
|
const jsonMySqlCreateTables = created.map((it) => {
|
16260
16701
|
return prepareMySqlCreateTableJson(it, curFull);
|
16261
16702
|
});
|
16262
16703
|
jsonStatements.push(...jsonMySqlCreateTables);
|
16704
|
+
} else {
|
16705
|
+
assertUnreachable(dialect7);
|
16263
16706
|
}
|
16264
16707
|
jsonStatements.push(...jsonDropTables);
|
16265
16708
|
jsonStatements.push(...jsonRenameTables);
|
@@ -16329,6 +16772,7 @@ import path2, { join as join2 } from "path";
|
|
16329
16772
|
var import_hanji4, prepareAndMigratePg, prepareMySQLPush, prepareSQLitePush, preparePgPush, prepareAndMigrateMySql, prepareAndMigrateSqlite, prepareSQL, promptColumnsConflicts, promptTablesConflict, promptSchemasConflict, BREAKPOINT, writeResult, embeddedMigrations, prepareSnapshotFolderName, two;
|
16330
16773
|
var init_migrate = __esm({
|
16331
16774
|
"src/cli/commands/migrate.ts"() {
|
16775
|
+
"use strict";
|
16332
16776
|
init_migrationPreparator();
|
16333
16777
|
init_snapshotsDiffer();
|
16334
16778
|
import_hanji4 = __toESM(require_hanji());
|
@@ -16344,7 +16788,7 @@ var init_migrate = __esm({
|
|
16344
16788
|
const outFolder = config.out;
|
16345
16789
|
const schemaPath = config.schema;
|
16346
16790
|
try {
|
16347
|
-
assertV1OutFolder(outFolder
|
16791
|
+
assertV1OutFolder(outFolder);
|
16348
16792
|
const { snapshots, journal } = prepareMigrationFolder(outFolder, "pg");
|
16349
16793
|
const { prev, cur, custom } = await preparePgMigrationSnapshot(
|
16350
16794
|
snapshots,
|
@@ -16453,7 +16897,7 @@ var init_migrate = __esm({
|
|
16453
16897
|
const outFolder = config.out;
|
16454
16898
|
const schemaPath = config.schema;
|
16455
16899
|
try {
|
16456
|
-
assertV1OutFolder(outFolder
|
16900
|
+
assertV1OutFolder(outFolder);
|
16457
16901
|
const { snapshots, journal } = prepareMigrationFolder(outFolder, "mysql");
|
16458
16902
|
const { prev, cur, custom } = await prepareMySqlMigrationSnapshot(
|
16459
16903
|
snapshots,
|
@@ -16497,7 +16941,7 @@ var init_migrate = __esm({
|
|
16497
16941
|
const outFolder = config.out;
|
16498
16942
|
const schemaPath = config.schema;
|
16499
16943
|
try {
|
16500
|
-
assertV1OutFolder(outFolder
|
16944
|
+
assertV1OutFolder(outFolder);
|
16501
16945
|
const { snapshots, journal } = prepareMigrationFolder(outFolder, "sqlite");
|
16502
16946
|
const { prev, cur, custom } = await prepareSqliteMigrationSnapshot(
|
16503
16947
|
snapshots,
|
@@ -16522,7 +16966,9 @@ var init_migrate = __esm({
|
|
16522
16966
|
const { sqlStatements, _meta } = await prepareSQL(
|
16523
16967
|
squashedPrev,
|
16524
16968
|
squashedCur,
|
16525
|
-
"sqlite"
|
16969
|
+
"sqlite",
|
16970
|
+
validatedPrev,
|
16971
|
+
validatedCur
|
16526
16972
|
);
|
16527
16973
|
writeResult({
|
16528
16974
|
cur,
|
@@ -16821,6 +17267,7 @@ ${sql2}
|
|
16821
17267
|
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;
|
16822
17268
|
var init_sqlgenerator = __esm({
|
16823
17269
|
"src/sqlgenerator.ts"() {
|
17270
|
+
"use strict";
|
16824
17271
|
init_migrate();
|
16825
17272
|
init_mysqlSchema();
|
16826
17273
|
init_pgSchema();
|
@@ -18138,6 +18585,7 @@ drop type __venum;
|
|
18138
18585
|
var import_hanji5, Select;
|
18139
18586
|
var init_selector_ui = __esm({
|
18140
18587
|
"src/cli/selector-ui.ts"() {
|
18588
|
+
"use strict";
|
18141
18589
|
init_source();
|
18142
18590
|
import_hanji5 = __toESM(require_hanji());
|
18143
18591
|
Select = class extends import_hanji5.Prompt {
|
@@ -34740,6 +35188,7 @@ import { sql } from "drizzle-orm";
|
|
34740
35188
|
var DrizzleDbClient, DrizzleORMPgClient, DrizzleORMMySQLClient, DrizzleORMSQLiteClient, BetterSqlite, MySQL2Client, TursoSqlite, PgPostgres;
|
34741
35189
|
var init_drivers = __esm({
|
34742
35190
|
"src/drivers/index.ts"() {
|
35191
|
+
"use strict";
|
34743
35192
|
DrizzleDbClient = class {
|
34744
35193
|
constructor(db) {
|
34745
35194
|
this.db = db;
|
@@ -34820,6 +35269,7 @@ __export(mysqlPushUtils_exports, {
|
|
34820
35269
|
var import_hanji9, filterStatements, logSuggestionsAndReturn2;
|
34821
35270
|
var init_mysqlPushUtils = __esm({
|
34822
35271
|
"src/cli/commands/mysqlPushUtils.ts"() {
|
35272
|
+
"use strict";
|
34823
35273
|
init_source();
|
34824
35274
|
import_hanji9 = __toESM(require_hanji());
|
34825
35275
|
init_mysqlSchema();
|
@@ -35081,6 +35531,7 @@ init_views();
|
|
35081
35531
|
init_pgSerializer();
|
35082
35532
|
|
35083
35533
|
// src/introspect-pg.ts
|
35534
|
+
var import_pluralize = __toESM(require_pluralize());
|
35084
35535
|
import { getTableName as getTableName4, is as is7 } from "drizzle-orm";
|
35085
35536
|
import {
|
35086
35537
|
createTableRelationsHelpers,
|
@@ -35188,7 +35639,7 @@ String.prototype.camelCase = function() {
|
|
35188
35639
|
return camelCase(String(this));
|
35189
35640
|
};
|
35190
35641
|
String.prototype.concatIf = function(it, condition) {
|
35191
|
-
return condition ? `${this}${it}` : this;
|
35642
|
+
return condition ? `${this}${it}` : String(this);
|
35192
35643
|
};
|
35193
35644
|
Array.prototype.random = function() {
|
35194
35645
|
return this[~~(Math.random() * this.length)];
|