drizzle-kit 0.25.0-1fba875 → 0.25.0-588085a
Sign up to get free protection for your applications and to get access to all the features.
- package/api.d.mts +4 -3
- package/api.d.ts +4 -3
- package/api.js +14848 -87978
- package/api.mjs +14848 -87975
- package/bin.cjs +599 -467
- package/common-DYjgLS6u.d.mts +8 -0
- package/common-DYjgLS6u.d.ts +8 -0
- package/index.d.mts +2 -5
- package/index.d.ts +2 -5
- package/package.json +2 -2
- package/utils.js +8 -0
- package/utils.mjs +7 -0
package/bin.cjs
CHANGED
@@ -6591,11 +6591,17 @@ function findAddedAndRemoved(columnNames1, columnNames2) {
|
|
6591
6591
|
const removedColumns = columnNames1.filter((it) => !set2.has(it));
|
6592
6592
|
return { addedColumns, removedColumns };
|
6593
6593
|
}
|
6594
|
-
|
6594
|
+
function getColumnCasing(column7, casing2) {
|
6595
|
+
if (!column7.name)
|
6596
|
+
return "";
|
6597
|
+
return !column7.keyAsName || casing2 === void 0 ? column7.name : casing2 === "camelCase" ? (0, import_casing.toCamelCase)(column7.name) : (0, import_casing.toSnakeCase)(column7.name);
|
6598
|
+
}
|
6599
|
+
var import_casing, import_fs, import_path, import_url, copy, objectValues, assertV1OutFolder, dryJournal, prepareOutFolder, validatorForDialect, validateWithReport, prepareMigrationFolder, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey, normaliseSQLiteUrl, normalisePGliteUrl;
|
6595
6600
|
var init_utils = __esm({
|
6596
6601
|
"src/utils.ts"() {
|
6597
6602
|
"use strict";
|
6598
6603
|
init_source();
|
6604
|
+
import_casing = require("drizzle-orm/casing");
|
6599
6605
|
import_fs = require("fs");
|
6600
6606
|
import_path = require("path");
|
6601
6607
|
import_url = require("url");
|
@@ -6625,27 +6631,27 @@ var init_utils = __esm({
|
|
6625
6631
|
process.exit(1);
|
6626
6632
|
}
|
6627
6633
|
};
|
6628
|
-
dryJournal = (
|
6634
|
+
dryJournal = (dialect4) => {
|
6629
6635
|
return {
|
6630
6636
|
version: snapshotVersion,
|
6631
|
-
dialect:
|
6637
|
+
dialect: dialect4,
|
6632
6638
|
entries: []
|
6633
6639
|
};
|
6634
6640
|
};
|
6635
|
-
prepareOutFolder = (out,
|
6641
|
+
prepareOutFolder = (out, dialect4) => {
|
6636
6642
|
const meta = (0, import_path.join)(out, "meta");
|
6637
6643
|
const journalPath = (0, import_path.join)(meta, "_journal.json");
|
6638
6644
|
if (!(0, import_fs.existsSync)((0, import_path.join)(out, "meta"))) {
|
6639
6645
|
(0, import_fs.mkdirSync)(meta, { recursive: true });
|
6640
|
-
(0, import_fs.writeFileSync)(journalPath, JSON.stringify(dryJournal(
|
6646
|
+
(0, import_fs.writeFileSync)(journalPath, JSON.stringify(dryJournal(dialect4)));
|
6641
6647
|
}
|
6642
6648
|
const journal = JSON.parse((0, import_fs.readFileSync)(journalPath).toString());
|
6643
6649
|
const snapshots = (0, import_fs.readdirSync)(meta).filter((it) => !it.startsWith("_")).map((it) => (0, import_path.join)(meta, it));
|
6644
6650
|
snapshots.sort();
|
6645
6651
|
return { meta, snapshots, journal };
|
6646
6652
|
};
|
6647
|
-
validatorForDialect = (
|
6648
|
-
switch (
|
6653
|
+
validatorForDialect = (dialect4) => {
|
6654
|
+
switch (dialect4) {
|
6649
6655
|
case "postgresql":
|
6650
6656
|
return { validator: backwardCompatiblePgSchema, version: 7 };
|
6651
6657
|
case "sqlite":
|
@@ -6656,8 +6662,8 @@ var init_utils = __esm({
|
|
6656
6662
|
return { validator: backwardCompatibleMysqlSchema, version: 5 };
|
6657
6663
|
}
|
6658
6664
|
};
|
6659
|
-
validateWithReport = (snapshots,
|
6660
|
-
const { validator: validator2, version: version3 } = validatorForDialect(
|
6665
|
+
validateWithReport = (snapshots, dialect4) => {
|
6666
|
+
const { validator: validator2, version: version3 } = validatorForDialect(dialect4);
|
6661
6667
|
const result = snapshots.reduce(
|
6662
6668
|
(accum, it) => {
|
6663
6669
|
const raw2 = JSON.parse((0, import_fs.readFileSync)(`./${it}`).toString());
|
@@ -6698,9 +6704,9 @@ var init_utils = __esm({
|
|
6698
6704
|
);
|
6699
6705
|
return result;
|
6700
6706
|
};
|
6701
|
-
prepareMigrationFolder = (outFolder = "drizzle",
|
6702
|
-
const { snapshots, journal } = prepareOutFolder(outFolder,
|
6703
|
-
const report = validateWithReport(snapshots,
|
6707
|
+
prepareMigrationFolder = (outFolder = "drizzle", dialect4) => {
|
6708
|
+
const { snapshots, journal } = prepareOutFolder(outFolder, dialect4);
|
6709
|
+
const report = validateWithReport(snapshots, dialect4);
|
6704
6710
|
if (report.nonLatest.length > 0) {
|
6705
6711
|
console.log(
|
6706
6712
|
report.nonLatest.map((it) => {
|
@@ -11250,7 +11256,7 @@ var init_outputs = __esm({
|
|
11250
11256
|
});
|
11251
11257
|
|
11252
11258
|
// src/cli/validations/common.ts
|
11253
|
-
var assertCollisions, sqliteDriversLiterals, postgresqlDriversLiterals, prefixes, prefix, sqliteDriver, postgresDriver, driver, configMigrations, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema, drivers, wrapParam;
|
11259
|
+
var assertCollisions, sqliteDriversLiterals, postgresqlDriversLiterals, prefixes, prefix, casingTypes, casingType, sqliteDriver, postgresDriver, driver, configMigrations, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema, drivers, wrapParam;
|
11254
11260
|
var init_common = __esm({
|
11255
11261
|
"src/cli/validations/common.ts"() {
|
11256
11262
|
"use strict";
|
@@ -11294,6 +11300,8 @@ var init_common = __esm({
|
|
11294
11300
|
{
|
11295
11301
|
const _2 = "";
|
11296
11302
|
}
|
11303
|
+
casingTypes = ["snake_case", "camelCase"];
|
11304
|
+
casingType = enumType(casingTypes);
|
11297
11305
|
sqliteDriver = unionType(sqliteDriversLiterals);
|
11298
11306
|
postgresDriver = unionType(postgresqlDriversLiterals);
|
11299
11307
|
driver = unionType([sqliteDriver, postgresDriver]);
|
@@ -11312,7 +11320,8 @@ var init_common = __esm({
|
|
11312
11320
|
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
11313
11321
|
schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
|
11314
11322
|
migrations: configMigrations,
|
11315
|
-
dbCredentials: anyType().optional()
|
11323
|
+
dbCredentials: anyType().optional(),
|
11324
|
+
casing: casingType.optional()
|
11316
11325
|
}).passthrough();
|
11317
11326
|
casing = unionType([literalType("camel"), literalType("preserve")]).default(
|
11318
11327
|
"camel"
|
@@ -11394,6 +11403,7 @@ var init_cli = __esm({
|
|
11394
11403
|
}).strict();
|
11395
11404
|
pushParams = objectType({
|
11396
11405
|
dialect: dialect3,
|
11406
|
+
casing: casingType.optional(),
|
11397
11407
|
schema: unionType([stringType(), stringType().array()]),
|
11398
11408
|
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
11399
11409
|
schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
|
@@ -17410,11 +17420,11 @@ var init_utils4 = __esm({
|
|
17410
17420
|
prepareGenerateConfig = async (options, from) => {
|
17411
17421
|
var _a;
|
17412
17422
|
const config = from === "config" ? await drizzleConfigFromFile(options.config) : options;
|
17413
|
-
const { schema: schema5, out, breakpoints, dialect:
|
17414
|
-
if (!schema5 || !
|
17423
|
+
const { schema: schema5, out, breakpoints, dialect: dialect4, driver: driver2, casing: casing2 } = config;
|
17424
|
+
if (!schema5 || !dialect4) {
|
17415
17425
|
console.log(error("Please provide required params:"));
|
17416
17426
|
console.log(wrapParam("schema", schema5));
|
17417
|
-
console.log(wrapParam("dialect",
|
17427
|
+
console.log(wrapParam("dialect", dialect4));
|
17418
17428
|
console.log(wrapParam("out", out, true));
|
17419
17429
|
process.exit(1);
|
17420
17430
|
}
|
@@ -17425,14 +17435,15 @@ var init_utils4 = __esm({
|
|
17425
17435
|
}
|
17426
17436
|
const prefix2 = ("migrations" in config ? (_a = config.migrations) == null ? void 0 : _a.prefix : options.prefix) || "index";
|
17427
17437
|
return {
|
17428
|
-
dialect:
|
17438
|
+
dialect: dialect4,
|
17429
17439
|
name: options.name,
|
17430
17440
|
custom: options.custom || false,
|
17431
17441
|
prefix: prefix2,
|
17432
17442
|
breakpoints: breakpoints || true,
|
17433
17443
|
schema: schema5,
|
17434
17444
|
out: out || "drizzle",
|
17435
|
-
bundle: driver2 === "expo"
|
17445
|
+
bundle: driver2 === "expo",
|
17446
|
+
casing: casing2
|
17436
17447
|
};
|
17437
17448
|
};
|
17438
17449
|
flattenDatabaseCredentials = (config) => {
|
@@ -17499,6 +17510,7 @@ var init_utils4 = __esm({
|
|
17499
17510
|
verbose: config.verbose ?? false,
|
17500
17511
|
force: options.force ?? false,
|
17501
17512
|
credentials: parsed2.data,
|
17513
|
+
casing: config.casing,
|
17502
17514
|
tablesFilter,
|
17503
17515
|
schemasFilter
|
17504
17516
|
};
|
@@ -17516,6 +17528,7 @@ var init_utils4 = __esm({
|
|
17516
17528
|
verbose: config.verbose ?? false,
|
17517
17529
|
force: options.force ?? false,
|
17518
17530
|
credentials: parsed2.data,
|
17531
|
+
casing: config.casing,
|
17519
17532
|
tablesFilter,
|
17520
17533
|
schemasFilter
|
17521
17534
|
};
|
@@ -17533,6 +17546,7 @@ var init_utils4 = __esm({
|
|
17533
17546
|
verbose: config.verbose ?? false,
|
17534
17547
|
force: options.force ?? false,
|
17535
17548
|
credentials: parsed2.data,
|
17549
|
+
casing: config.casing,
|
17536
17550
|
tablesFilter,
|
17537
17551
|
schemasFilter
|
17538
17552
|
};
|
@@ -17550,6 +17564,7 @@ var init_utils4 = __esm({
|
|
17550
17564
|
verbose: config.verbose ?? false,
|
17551
17565
|
force: options.force ?? false,
|
17552
17566
|
credentials: parsed2.data,
|
17567
|
+
casing: config.casing,
|
17553
17568
|
tablesFilter,
|
17554
17569
|
schemasFilter
|
17555
17570
|
};
|
@@ -17568,11 +17583,11 @@ var init_utils4 = __esm({
|
|
17568
17583
|
process.exit(1);
|
17569
17584
|
}
|
17570
17585
|
const config = parsed.data;
|
17571
|
-
const
|
17586
|
+
const dialect4 = config.dialect;
|
17572
17587
|
const tablesFilterConfig = config.tablesFilter;
|
17573
17588
|
const tablesFilter = tablesFilterConfig ? typeof tablesFilterConfig === "string" ? [tablesFilterConfig] : tablesFilterConfig : [];
|
17574
17589
|
if (config.extensionsFilters) {
|
17575
|
-
if (config.extensionsFilters.includes("postgis") &&
|
17590
|
+
if (config.extensionsFilters.includes("postgis") && dialect4 === "postgresql") {
|
17576
17591
|
tablesFilter.push(
|
17577
17592
|
...["!geography_columns", "!geometry_columns", "!spatial_ref_sys"]
|
17578
17593
|
);
|
@@ -17580,7 +17595,7 @@ var init_utils4 = __esm({
|
|
17580
17595
|
}
|
17581
17596
|
const schemasFilterConfig = config.schemaFilter;
|
17582
17597
|
const schemasFilter = schemasFilterConfig ? typeof schemasFilterConfig === "string" ? [schemasFilterConfig] : schemasFilterConfig : [];
|
17583
|
-
if (
|
17598
|
+
if (dialect4 === "postgresql") {
|
17584
17599
|
const parsed2 = postgresCredentials.safeParse(config);
|
17585
17600
|
if (!parsed2.success) {
|
17586
17601
|
printConfigConnectionIssues3(config);
|
@@ -17597,7 +17612,7 @@ var init_utils4 = __esm({
|
|
17597
17612
|
prefix: ((_a = config.migrations) == null ? void 0 : _a.prefix) || "index"
|
17598
17613
|
};
|
17599
17614
|
}
|
17600
|
-
if (
|
17615
|
+
if (dialect4 === "mysql") {
|
17601
17616
|
const parsed2 = mysqlCredentials.safeParse(config);
|
17602
17617
|
if (!parsed2.success) {
|
17603
17618
|
printConfigConnectionIssues2(config);
|
@@ -17614,7 +17629,7 @@ var init_utils4 = __esm({
|
|
17614
17629
|
prefix: ((_b = config.migrations) == null ? void 0 : _b.prefix) || "index"
|
17615
17630
|
};
|
17616
17631
|
}
|
17617
|
-
if (
|
17632
|
+
if (dialect4 === "sqlite") {
|
17618
17633
|
const parsed2 = sqliteCredentials.safeParse(config);
|
17619
17634
|
if (!parsed2.success) {
|
17620
17635
|
printConfigConnectionIssues4(config, "pull");
|
@@ -17631,14 +17646,14 @@ var init_utils4 = __esm({
|
|
17631
17646
|
prefix: ((_c = config.migrations) == null ? void 0 : _c.prefix) || "index"
|
17632
17647
|
};
|
17633
17648
|
}
|
17634
|
-
if (
|
17649
|
+
if (dialect4 === "turso") {
|
17635
17650
|
const parsed2 = libSQLCredentials.safeParse(config);
|
17636
17651
|
if (!parsed2.success) {
|
17637
17652
|
printConfigConnectionIssues(config, "pull");
|
17638
17653
|
process.exit(1);
|
17639
17654
|
}
|
17640
17655
|
return {
|
17641
|
-
dialect:
|
17656
|
+
dialect: dialect4,
|
17642
17657
|
out: config.out,
|
17643
17658
|
breakpoints: config.breakpoints,
|
17644
17659
|
casing: config.casing,
|
@@ -17648,7 +17663,7 @@ var init_utils4 = __esm({
|
|
17648
17663
|
prefix: ((_d = config.migrations) == null ? void 0 : _d.prefix) || "index"
|
17649
17664
|
};
|
17650
17665
|
}
|
17651
|
-
assertUnreachable(
|
17666
|
+
assertUnreachable(dialect4);
|
17652
17667
|
};
|
17653
17668
|
prepareStudioConfig = async (options) => {
|
17654
17669
|
const params = studioCliParams.parse(options);
|
@@ -17665,9 +17680,9 @@ var init_utils4 = __esm({
|
|
17665
17680
|
process.exit(1);
|
17666
17681
|
}
|
17667
17682
|
const { host, port } = params;
|
17668
|
-
const { dialect:
|
17683
|
+
const { dialect: dialect4, schema: schema5 } = result.data;
|
17669
17684
|
const flattened = flattenDatabaseCredentials(config);
|
17670
|
-
if (
|
17685
|
+
if (dialect4 === "postgresql") {
|
17671
17686
|
const parsed = postgresCredentials.safeParse(flattened);
|
17672
17687
|
if (!parsed.success) {
|
17673
17688
|
printConfigConnectionIssues3(flattened);
|
@@ -17675,14 +17690,14 @@ var init_utils4 = __esm({
|
|
17675
17690
|
}
|
17676
17691
|
const credentials2 = parsed.data;
|
17677
17692
|
return {
|
17678
|
-
dialect:
|
17693
|
+
dialect: dialect4,
|
17679
17694
|
schema: schema5,
|
17680
17695
|
host,
|
17681
17696
|
port,
|
17682
17697
|
credentials: credentials2
|
17683
17698
|
};
|
17684
17699
|
}
|
17685
|
-
if (
|
17700
|
+
if (dialect4 === "mysql") {
|
17686
17701
|
const parsed = mysqlCredentials.safeParse(flattened);
|
17687
17702
|
if (!parsed.success) {
|
17688
17703
|
printConfigConnectionIssues2(flattened);
|
@@ -17690,14 +17705,14 @@ var init_utils4 = __esm({
|
|
17690
17705
|
}
|
17691
17706
|
const credentials2 = parsed.data;
|
17692
17707
|
return {
|
17693
|
-
dialect:
|
17708
|
+
dialect: dialect4,
|
17694
17709
|
schema: schema5,
|
17695
17710
|
host,
|
17696
17711
|
port,
|
17697
17712
|
credentials: credentials2
|
17698
17713
|
};
|
17699
17714
|
}
|
17700
|
-
if (
|
17715
|
+
if (dialect4 === "sqlite") {
|
17701
17716
|
const parsed = sqliteCredentials.safeParse(flattened);
|
17702
17717
|
if (!parsed.success) {
|
17703
17718
|
printConfigConnectionIssues4(flattened, "studio");
|
@@ -17705,14 +17720,14 @@ var init_utils4 = __esm({
|
|
17705
17720
|
}
|
17706
17721
|
const credentials2 = parsed.data;
|
17707
17722
|
return {
|
17708
|
-
dialect:
|
17723
|
+
dialect: dialect4,
|
17709
17724
|
schema: schema5,
|
17710
17725
|
host,
|
17711
17726
|
port,
|
17712
17727
|
credentials: credentials2
|
17713
17728
|
};
|
17714
17729
|
}
|
17715
|
-
if (
|
17730
|
+
if (dialect4 === "turso") {
|
17716
17731
|
const parsed = libSQLCredentials.safeParse(flattened);
|
17717
17732
|
if (!parsed.success) {
|
17718
17733
|
printConfigConnectionIssues(flattened, "studio");
|
@@ -17720,14 +17735,14 @@ var init_utils4 = __esm({
|
|
17720
17735
|
}
|
17721
17736
|
const credentials2 = parsed.data;
|
17722
17737
|
return {
|
17723
|
-
dialect:
|
17738
|
+
dialect: dialect4,
|
17724
17739
|
schema: schema5,
|
17725
17740
|
host,
|
17726
17741
|
port,
|
17727
17742
|
credentials: credentials2
|
17728
17743
|
};
|
17729
17744
|
}
|
17730
|
-
assertUnreachable(
|
17745
|
+
assertUnreachable(dialect4);
|
17731
17746
|
};
|
17732
17747
|
migrateConfig = objectType({
|
17733
17748
|
dialect: dialect3,
|
@@ -17742,10 +17757,10 @@ var init_utils4 = __esm({
|
|
17742
17757
|
console.log(wrapParam("dialect", config.dialect));
|
17743
17758
|
process.exit(1);
|
17744
17759
|
}
|
17745
|
-
const { dialect:
|
17760
|
+
const { dialect: dialect4, out } = parsed.data;
|
17746
17761
|
const { schema: schema5, table: table4 } = parsed.data.migrations || {};
|
17747
17762
|
const flattened = flattenDatabaseCredentials(config);
|
17748
|
-
if (
|
17763
|
+
if (dialect4 === "postgresql") {
|
17749
17764
|
const parsed2 = postgresCredentials.safeParse(flattened);
|
17750
17765
|
if (!parsed2.success) {
|
17751
17766
|
printConfigConnectionIssues3(flattened);
|
@@ -17753,14 +17768,14 @@ var init_utils4 = __esm({
|
|
17753
17768
|
}
|
17754
17769
|
const credentials2 = parsed2.data;
|
17755
17770
|
return {
|
17756
|
-
dialect:
|
17771
|
+
dialect: dialect4,
|
17757
17772
|
out,
|
17758
17773
|
credentials: credentials2,
|
17759
17774
|
schema: schema5,
|
17760
17775
|
table: table4
|
17761
17776
|
};
|
17762
17777
|
}
|
17763
|
-
if (
|
17778
|
+
if (dialect4 === "mysql") {
|
17764
17779
|
const parsed2 = mysqlCredentials.safeParse(flattened);
|
17765
17780
|
if (!parsed2.success) {
|
17766
17781
|
printConfigConnectionIssues2(flattened);
|
@@ -17768,14 +17783,14 @@ var init_utils4 = __esm({
|
|
17768
17783
|
}
|
17769
17784
|
const credentials2 = parsed2.data;
|
17770
17785
|
return {
|
17771
|
-
dialect:
|
17786
|
+
dialect: dialect4,
|
17772
17787
|
out,
|
17773
17788
|
credentials: credentials2,
|
17774
17789
|
schema: schema5,
|
17775
17790
|
table: table4
|
17776
17791
|
};
|
17777
17792
|
}
|
17778
|
-
if (
|
17793
|
+
if (dialect4 === "sqlite") {
|
17779
17794
|
const parsed2 = sqliteCredentials.safeParse(flattened);
|
17780
17795
|
if (!parsed2.success) {
|
17781
17796
|
printConfigConnectionIssues4(flattened, "migrate");
|
@@ -17783,14 +17798,14 @@ var init_utils4 = __esm({
|
|
17783
17798
|
}
|
17784
17799
|
const credentials2 = parsed2.data;
|
17785
17800
|
return {
|
17786
|
-
dialect:
|
17801
|
+
dialect: dialect4,
|
17787
17802
|
out,
|
17788
17803
|
credentials: credentials2,
|
17789
17804
|
schema: schema5,
|
17790
17805
|
table: table4
|
17791
17806
|
};
|
17792
17807
|
}
|
17793
|
-
if (
|
17808
|
+
if (dialect4 === "turso") {
|
17794
17809
|
const parsed2 = libSQLCredentials.safeParse(flattened);
|
17795
17810
|
if (!parsed2.success) {
|
17796
17811
|
printConfigConnectionIssues(flattened, "migrate");
|
@@ -17798,14 +17813,14 @@ var init_utils4 = __esm({
|
|
17798
17813
|
}
|
17799
17814
|
const credentials2 = parsed2.data;
|
17800
17815
|
return {
|
17801
|
-
dialect:
|
17816
|
+
dialect: dialect4,
|
17802
17817
|
out,
|
17803
17818
|
credentials: credentials2,
|
17804
17819
|
schema: schema5,
|
17805
17820
|
table: table4
|
17806
17821
|
};
|
17807
17822
|
}
|
17808
|
-
assertUnreachable(
|
17823
|
+
assertUnreachable(dialect4);
|
17809
17824
|
};
|
17810
17825
|
drizzleConfigFromFile = async (configPath) => {
|
17811
17826
|
const prefix2 = process.env.TEST_CONFIG_PATH_PREFIX || "";
|
@@ -17834,6 +17849,7 @@ var init_utils4 = __esm({
|
|
17834
17849
|
unregister();
|
17835
17850
|
const res = configCommonSchema.safeParse(content);
|
17836
17851
|
if (!res.success) {
|
17852
|
+
console.log(res.error);
|
17837
17853
|
if (!("dialect" in content)) {
|
17838
17854
|
console.log(error("Please specify 'dialect' param in config file"));
|
17839
17855
|
}
|
@@ -17906,7 +17922,7 @@ function clearDefaults(defaultValue, collate) {
|
|
17906
17922
|
return `(${resultDefault})`;
|
17907
17923
|
}
|
17908
17924
|
}
|
17909
|
-
var import_drizzle_orm2, import_drizzle_orm3, import_mysql_core2, import_mysql_core3,
|
17925
|
+
var import_drizzle_orm2, import_drizzle_orm3, import_mysql_core2, import_mysql_core3, indexName, generateMySqlSnapshot, fromDatabase;
|
17910
17926
|
var init_mysqlSerializer = __esm({
|
17911
17927
|
"src/serializer/mysqlSerializer.ts"() {
|
17912
17928
|
"use strict";
|
@@ -17916,12 +17932,13 @@ var init_mysqlSerializer = __esm({
|
|
17916
17932
|
import_mysql_core2 = require("drizzle-orm/mysql-core");
|
17917
17933
|
import_mysql_core3 = require("drizzle-orm/mysql-core");
|
17918
17934
|
init_outputs();
|
17935
|
+
init_utils();
|
17919
17936
|
init_serializer();
|
17920
|
-
dialect4 = new import_mysql_core2.MySqlDialect();
|
17921
17937
|
indexName = (tableName, columns) => {
|
17922
17938
|
return `${tableName}_${columns.join("_")}_index`;
|
17923
17939
|
};
|
17924
|
-
generateMySqlSnapshot = (tables) => {
|
17940
|
+
generateMySqlSnapshot = (tables, casing2) => {
|
17941
|
+
const dialect4 = new import_mysql_core2.MySqlDialect({ casing: casing2 });
|
17925
17942
|
const result = {};
|
17926
17943
|
const internal = { tables: {}, indexes: {} };
|
17927
17944
|
for (const table4 of tables) {
|
@@ -17940,12 +17957,13 @@ var init_mysqlSerializer = __esm({
|
|
17940
17957
|
const primaryKeysObject = {};
|
17941
17958
|
const uniqueConstraintObject = {};
|
17942
17959
|
columns.forEach((column7) => {
|
17960
|
+
const name = getColumnCasing(column7, casing2);
|
17943
17961
|
const notNull = column7.notNull;
|
17944
17962
|
const sqlTypeLowered = column7.getSQLType().toLowerCase();
|
17945
17963
|
const autoIncrement = typeof column7.autoIncrement === "undefined" ? false : column7.autoIncrement;
|
17946
17964
|
const generated = column7.generated;
|
17947
17965
|
const columnToSet = {
|
17948
|
-
name
|
17966
|
+
name,
|
17949
17967
|
type: column7.getSQLType(),
|
17950
17968
|
primaryKey: false,
|
17951
17969
|
// If field is autoincrement it's notNull by default
|
@@ -17959,9 +17977,9 @@ var init_mysqlSerializer = __esm({
|
|
17959
17977
|
} : void 0
|
17960
17978
|
};
|
17961
17979
|
if (column7.primary) {
|
17962
|
-
primaryKeysObject[`${tableName}_${
|
17963
|
-
name: `${tableName}_${
|
17964
|
-
columns: [
|
17980
|
+
primaryKeysObject[`${tableName}_${name}`] = {
|
17981
|
+
name: `${tableName}_${name}`,
|
17982
|
+
columns: [name]
|
17965
17983
|
};
|
17966
17984
|
}
|
17967
17985
|
if (column7.isUnique) {
|
@@ -17975,7 +17993,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
17975
17993
|
The unique constraint ${source_default.underline.blue(
|
17976
17994
|
column7.uniqueName
|
17977
17995
|
)} on the ${source_default.underline.blue(
|
17978
|
-
|
17996
|
+
name
|
17979
17997
|
)} column is confilcting with a unique constraint name already defined for ${source_default.underline.blue(
|
17980
17998
|
existingUnique.columns.join(",")
|
17981
17999
|
)} columns
|
@@ -17990,7 +18008,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
17990
18008
|
}
|
17991
18009
|
if (column7.default !== void 0) {
|
17992
18010
|
if ((0, import_drizzle_orm2.is)(column7.default, import_drizzle_orm3.SQL)) {
|
17993
|
-
columnToSet.default = sqlToStr(column7.default);
|
18011
|
+
columnToSet.default = sqlToStr(column7.default, casing2);
|
17994
18012
|
} else {
|
17995
18013
|
if (typeof column7.default === "string") {
|
17996
18014
|
columnToSet.default = `'${column7.default}'`;
|
@@ -18012,20 +18030,27 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18012
18030
|
}
|
18013
18031
|
}
|
18014
18032
|
}
|
18015
|
-
columnsObject[
|
18033
|
+
columnsObject[name] = columnToSet;
|
18016
18034
|
});
|
18017
18035
|
primaryKeys.map((pk) => {
|
18018
|
-
const
|
18019
|
-
|
18020
|
-
|
18036
|
+
const originalColumnNames = pk.columns.map((c) => c.name);
|
18037
|
+
const columnNames = pk.columns.map((c) => getColumnCasing(c, casing2));
|
18038
|
+
let name = pk.getName();
|
18039
|
+
if (casing2 !== void 0) {
|
18040
|
+
for (let i2 = 0; i2 < originalColumnNames.length; i2++) {
|
18041
|
+
name = name.replace(originalColumnNames[i2], columnNames[i2]);
|
18042
|
+
}
|
18043
|
+
}
|
18044
|
+
primaryKeysObject[name] = {
|
18045
|
+
name,
|
18021
18046
|
columns: columnNames
|
18022
18047
|
};
|
18023
18048
|
for (const column7 of pk.columns) {
|
18024
|
-
columnsObject[column7
|
18049
|
+
columnsObject[getColumnCasing(column7, casing2)].notNull = true;
|
18025
18050
|
}
|
18026
18051
|
});
|
18027
18052
|
uniqueConstraints == null ? void 0 : uniqueConstraints.map((unq) => {
|
18028
|
-
const columnNames = unq.columns.map((c) => c
|
18053
|
+
const columnNames = unq.columns.map((c) => getColumnCasing(c, casing2));
|
18029
18054
|
const name = unq.name ?? (0, import_mysql_core2.uniqueKeyName)(table4, columnNames);
|
18030
18055
|
const existingUnique = uniqueConstraintObject[name];
|
18031
18056
|
if (typeof existingUnique !== "undefined") {
|
@@ -18053,15 +18078,25 @@ The unique constraint ${source_default.underline.blue(
|
|
18053
18078
|
};
|
18054
18079
|
});
|
18055
18080
|
const fks = foreignKeys.map((fk4) => {
|
18056
|
-
const name = fk4.getName();
|
18057
18081
|
const tableFrom = tableName;
|
18058
18082
|
const onDelete = fk4.onDelete ?? "no action";
|
18059
18083
|
const onUpdate = fk4.onUpdate ?? "no action";
|
18060
18084
|
const reference = fk4.reference();
|
18061
18085
|
const referenceFT = reference.foreignTable;
|
18062
18086
|
const tableTo = (0, import_drizzle_orm2.getTableName)(referenceFT);
|
18063
|
-
const
|
18064
|
-
const
|
18087
|
+
const originalColumnsFrom = reference.columns.map((it) => it.name);
|
18088
|
+
const columnsFrom = reference.columns.map((it) => getColumnCasing(it, casing2));
|
18089
|
+
const originalColumnsTo = reference.foreignColumns.map((it) => it.name);
|
18090
|
+
const columnsTo = reference.foreignColumns.map((it) => getColumnCasing(it, casing2));
|
18091
|
+
let name = fk4.getName();
|
18092
|
+
if (casing2 !== void 0) {
|
18093
|
+
for (let i2 = 0; i2 < originalColumnsFrom.length; i2++) {
|
18094
|
+
name = name.replace(originalColumnsFrom[i2], columnsFrom[i2]);
|
18095
|
+
}
|
18096
|
+
for (let i2 = 0; i2 < originalColumnsTo.length; i2++) {
|
18097
|
+
name = name.replace(originalColumnsTo[i2], columnsTo[i2]);
|
18098
|
+
}
|
18099
|
+
}
|
18065
18100
|
return {
|
18066
18101
|
name,
|
18067
18102
|
tableFrom,
|
@@ -18101,7 +18136,7 @@ The unique constraint ${source_default.underline.blue(
|
|
18101
18136
|
}
|
18102
18137
|
return sql;
|
18103
18138
|
} else {
|
18104
|
-
return `${it
|
18139
|
+
return `${getColumnCasing(it, casing2)}`;
|
18105
18140
|
}
|
18106
18141
|
});
|
18107
18142
|
if (value.config.unique) {
|
@@ -18546,7 +18581,7 @@ function buildArrayString(array, sqlType) {
|
|
18546
18581
|
}).join(",");
|
18547
18582
|
return `{${values}}`;
|
18548
18583
|
}
|
18549
|
-
var import_drizzle_orm5, import_pg_core2, import_pg_core3,
|
18584
|
+
var import_drizzle_orm5, import_pg_core2, import_pg_core3, indexName2, generatePgSnapshot, trimChar, fromDatabase2, defaultForColumn;
|
18550
18585
|
var init_pgSerializer = __esm({
|
18551
18586
|
"src/serializer/pgSerializer.ts"() {
|
18552
18587
|
"use strict";
|
@@ -18558,12 +18593,12 @@ var init_pgSerializer = __esm({
|
|
18558
18593
|
init_outputs();
|
18559
18594
|
init_utils();
|
18560
18595
|
init_serializer();
|
18561
|
-
dialect5 = new import_pg_core2.PgDialect();
|
18562
18596
|
indexName2 = (tableName, columns) => {
|
18563
18597
|
return `${tableName}_${columns.join("_")}_index`;
|
18564
18598
|
};
|
18565
|
-
generatePgSnapshot = (tables, enums, schemas, sequences, schemaFilter) => {
|
18599
|
+
generatePgSnapshot = (tables, enums, schemas, sequences, casing2, schemaFilter) => {
|
18566
18600
|
var _a, _b, _c, _d, _e, _f;
|
18601
|
+
const dialect4 = new import_pg_core2.PgDialect({ casing: casing2 });
|
18567
18602
|
const result = {};
|
18568
18603
|
const sequencesToReturn = {};
|
18569
18604
|
const indexesInSchema = {};
|
@@ -18588,6 +18623,7 @@ var init_pgSerializer = __esm({
|
|
18588
18623
|
const uniqueConstraintObject = {};
|
18589
18624
|
columns.forEach((column7) => {
|
18590
18625
|
var _a2, _b2, _c2, _d2, _e2, _f2;
|
18626
|
+
const name = getColumnCasing(column7, casing2);
|
18591
18627
|
const notNull = column7.notNull;
|
18592
18628
|
const primaryKey = column7.primary;
|
18593
18629
|
const sqlTypeLowered = column7.getSQLType().toLowerCase();
|
@@ -18600,18 +18636,18 @@ var init_pgSerializer = __esm({
|
|
18600
18636
|
const startWith = stringFromIdentityProperty((_d2 = identity == null ? void 0 : identity.sequenceOptions) == null ? void 0 : _d2.startWith) ?? (parseFloat(increment) < 0 ? maxValue : minValue);
|
18601
18637
|
const cache = stringFromIdentityProperty((_e2 = identity == null ? void 0 : identity.sequenceOptions) == null ? void 0 : _e2.cache) ?? "1";
|
18602
18638
|
const columnToSet = {
|
18603
|
-
name
|
18639
|
+
name,
|
18604
18640
|
type: column7.getSQLType(),
|
18605
18641
|
typeSchema,
|
18606
18642
|
primaryKey,
|
18607
18643
|
notNull,
|
18608
18644
|
generated: generated ? {
|
18609
|
-
as: (0, import_drizzle_orm5.is)(generated.as, import_drizzle_orm5.SQL) ?
|
18645
|
+
as: (0, import_drizzle_orm5.is)(generated.as, import_drizzle_orm5.SQL) ? dialect4.sqlToQuery(generated.as).sql : typeof generated.as === "function" ? dialect4.sqlToQuery(generated.as()).sql : generated.as,
|
18610
18646
|
type: "stored"
|
18611
18647
|
} : void 0,
|
18612
18648
|
identity: identity ? {
|
18613
18649
|
type: identity.type,
|
18614
|
-
name: identity.sequenceName ?? `${tableName}_${
|
18650
|
+
name: identity.sequenceName ?? `${tableName}_${name}_seq`,
|
18615
18651
|
schema: schema5 ?? "public",
|
18616
18652
|
increment,
|
18617
18653
|
startWith,
|
@@ -18632,7 +18668,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18632
18668
|
The unique constraint ${source_default.underline.blue(
|
18633
18669
|
column7.uniqueName
|
18634
18670
|
)} on the ${source_default.underline.blue(
|
18635
|
-
|
18671
|
+
name
|
18636
18672
|
)} column is confilcting with a unique constraint name already defined for ${source_default.underline.blue(
|
18637
18673
|
existingUnique.columns.join(",")
|
18638
18674
|
)} columns
|
@@ -18648,7 +18684,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18648
18684
|
}
|
18649
18685
|
if (column7.default !== void 0) {
|
18650
18686
|
if ((0, import_drizzle_orm5.is)(column7.default, import_drizzle_orm5.SQL)) {
|
18651
|
-
columnToSet.default = sqlToStr(column7.default);
|
18687
|
+
columnToSet.default = sqlToStr(column7.default, casing2);
|
18652
18688
|
} else {
|
18653
18689
|
if (typeof column7.default === "string") {
|
18654
18690
|
columnToSet.default = `'${column7.default}'`;
|
@@ -18676,17 +18712,24 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18676
18712
|
}
|
18677
18713
|
}
|
18678
18714
|
}
|
18679
|
-
columnsObject[
|
18715
|
+
columnsObject[name] = columnToSet;
|
18680
18716
|
});
|
18681
18717
|
primaryKeys.map((pk) => {
|
18682
|
-
const
|
18683
|
-
|
18684
|
-
|
18718
|
+
const originalColumnNames = pk.columns.map((c) => c.name);
|
18719
|
+
const columnNames = pk.columns.map((c) => getColumnCasing(c, casing2));
|
18720
|
+
let name = pk.getName();
|
18721
|
+
if (casing2 !== void 0) {
|
18722
|
+
for (let i2 = 0; i2 < originalColumnNames.length; i2++) {
|
18723
|
+
name = name.replace(originalColumnNames[i2], columnNames[i2]);
|
18724
|
+
}
|
18725
|
+
}
|
18726
|
+
primaryKeysObject[name] = {
|
18727
|
+
name,
|
18685
18728
|
columns: columnNames
|
18686
18729
|
};
|
18687
18730
|
});
|
18688
18731
|
uniqueConstraints == null ? void 0 : uniqueConstraints.map((unq) => {
|
18689
|
-
const columnNames = unq.columns.map((c) => c
|
18732
|
+
const columnNames = unq.columns.map((c) => getColumnCasing(c, casing2));
|
18690
18733
|
const name = unq.name ?? (0, import_pg_core2.uniqueKeyName)(table4, columnNames);
|
18691
18734
|
const existingUnique = uniqueConstraintObject[name];
|
18692
18735
|
if (typeof existingUnique !== "undefined") {
|
@@ -18713,15 +18756,25 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18713
18756
|
};
|
18714
18757
|
});
|
18715
18758
|
const fks = foreignKeys.map((fk4) => {
|
18716
|
-
const name = fk4.getName();
|
18717
18759
|
const tableFrom = tableName;
|
18718
18760
|
const onDelete = fk4.onDelete;
|
18719
18761
|
const onUpdate = fk4.onUpdate;
|
18720
18762
|
const reference = fk4.reference();
|
18721
18763
|
const tableTo = (0, import_drizzle_orm5.getTableName)(reference.foreignTable);
|
18722
18764
|
const schemaTo = (0, import_pg_core3.getTableConfig)(reference.foreignTable).schema;
|
18723
|
-
const
|
18724
|
-
const
|
18765
|
+
const originalColumnsFrom = reference.columns.map((it) => it.name);
|
18766
|
+
const columnsFrom = reference.columns.map((it) => getColumnCasing(it, casing2));
|
18767
|
+
const originalColumnsTo = reference.foreignColumns.map((it) => it.name);
|
18768
|
+
const columnsTo = reference.foreignColumns.map((it) => getColumnCasing(it, casing2));
|
18769
|
+
let name = fk4.getName();
|
18770
|
+
if (casing2 !== void 0) {
|
18771
|
+
for (let i2 = 0; i2 < originalColumnsFrom.length; i2++) {
|
18772
|
+
name = name.replace(originalColumnsFrom[i2], columnsFrom[i2]);
|
18773
|
+
}
|
18774
|
+
for (let i2 = 0; i2 < originalColumnsTo.length; i2++) {
|
18775
|
+
name = name.replace(originalColumnsTo[i2], columnsTo[i2]);
|
18776
|
+
}
|
18777
|
+
}
|
18725
18778
|
return {
|
18726
18779
|
name,
|
18727
18780
|
tableFrom,
|
@@ -18747,19 +18800,20 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18747
18800
|
${withStyle.errorWarning(
|
18748
18801
|
`Please specify an index name in ${(0, import_drizzle_orm5.getTableName)(
|
18749
18802
|
value.config.table
|
18750
|
-
)} table that has "${
|
18803
|
+
)} table that has "${dialect4.sqlToQuery(it).sql}" expression. We can generate index names for indexes on columns only; for expressions in indexes, you need to specify the name yourself.`
|
18751
18804
|
)}`
|
18752
18805
|
);
|
18753
18806
|
process.exit(1);
|
18754
18807
|
}
|
18755
18808
|
}
|
18756
18809
|
it = it;
|
18810
|
+
const name2 = getColumnCasing(it, casing2);
|
18757
18811
|
if (!(0, import_drizzle_orm5.is)(it, import_drizzle_orm5.SQL) && it.type === "PgVector" && typeof it.indexConfig.opClass === "undefined") {
|
18758
18812
|
console.log(
|
18759
18813
|
`
|
18760
18814
|
${withStyle.errorWarning(
|
18761
18815
|
`You are specifying an index on the ${source_default.blueBright(
|
18762
|
-
|
18816
|
+
name2
|
18763
18817
|
)} column inside the ${source_default.blueBright(
|
18764
18818
|
tableName
|
18765
18819
|
)} table with the ${source_default.blueBright(
|
@@ -18769,7 +18823,7 @@ ${withStyle.errorWarning(
|
|
18769
18823
|
)}].
|
18770
18824
|
|
18771
18825
|
You can specify it using current syntax: ${source_default.underline(
|
18772
|
-
`index("${value.config.name}").using("${value.config.method}", table.${
|
18826
|
+
`index("${value.config.name}").using("${value.config.method}", table.${name2}.op("${vectorOps[0]}"))`
|
18773
18827
|
)}
|
18774
18828
|
|
18775
18829
|
You can check the "pg_vector" docs for more info: https://github.com/pgvector/pgvector?tab=readme-ov-file#indexing
|
@@ -18778,7 +18832,7 @@ You can check the "pg_vector" docs for more info: https://github.com/pgvector/pg
|
|
18778
18832
|
);
|
18779
18833
|
process.exit(1);
|
18780
18834
|
}
|
18781
|
-
indexColumnNames.push(
|
18835
|
+
indexColumnNames.push(name2);
|
18782
18836
|
});
|
18783
18837
|
const name = value.config.name ? value.config.name : indexName2(tableName, indexColumnNames);
|
18784
18838
|
let indexColumns = columns2.map(
|
@@ -18786,7 +18840,7 @@ You can check the "pg_vector" docs for more info: https://github.com/pgvector/pg
|
|
18786
18840
|
var _a2, _b2, _c2, _d2, _e2;
|
18787
18841
|
if ((0, import_drizzle_orm5.is)(it, import_drizzle_orm5.SQL)) {
|
18788
18842
|
return {
|
18789
|
-
expression:
|
18843
|
+
expression: dialect4.sqlToQuery(it, "indexes").sql,
|
18790
18844
|
asc: true,
|
18791
18845
|
isExpression: true,
|
18792
18846
|
nulls: "last"
|
@@ -18794,7 +18848,7 @@ You can check the "pg_vector" docs for more info: https://github.com/pgvector/pg
|
|
18794
18848
|
} else {
|
18795
18849
|
it = it;
|
18796
18850
|
return {
|
18797
|
-
expression: it
|
18851
|
+
expression: getColumnCasing(it, casing2),
|
18798
18852
|
isExpression: false,
|
18799
18853
|
asc: ((_a2 = it.indexConfig) == null ? void 0 : _a2.order) === "asc",
|
18800
18854
|
nulls: ((_b2 = it.indexConfig) == null ? void 0 : _b2.nulls) ? (_c2 = it.indexConfig) == null ? void 0 : _c2.nulls : ((_d2 = it.indexConfig) == null ? void 0 : _d2.order) === "desc" ? "first" : "last",
|
@@ -18825,7 +18879,7 @@ ${withStyle.errorWarning(
|
|
18825
18879
|
name,
|
18826
18880
|
columns: indexColumns,
|
18827
18881
|
isUnique: value.config.unique ?? false,
|
18828
|
-
where: value.config.where ?
|
18882
|
+
where: value.config.where ? dialect4.sqlToQuery(value.config.where).sql : void 0,
|
18829
18883
|
concurrently: value.config.concurrently ?? false,
|
18830
18884
|
method: value.config.method ?? "btree",
|
18831
18885
|
with: value.config.with ?? {}
|
@@ -19263,7 +19317,7 @@ ${withStyle.errorWarning(
|
|
19263
19317
|
schema: tableSchema
|
19264
19318
|
} : void 0
|
19265
19319
|
};
|
19266
|
-
if (identityName) {
|
19320
|
+
if (identityName && typeof identityName === "string") {
|
19267
19321
|
delete sequencesToReturn[`${tableSchema}.${identityName.startsWith('"') && identityName.endsWith('"') ? identityName.slice(1, -1) : identityName}`];
|
19268
19322
|
delete sequencesToReturn[identityName];
|
19269
19323
|
}
|
@@ -19594,7 +19648,7 @@ function extractGeneratedColumns(input) {
|
|
19594
19648
|
}
|
19595
19649
|
return columns;
|
19596
19650
|
}
|
19597
|
-
var import_drizzle_orm7, import_sqlite_core2,
|
19651
|
+
var import_drizzle_orm7, import_sqlite_core2, generateSqliteSnapshot, fromDatabase3;
|
19598
19652
|
var init_sqliteSerializer = __esm({
|
19599
19653
|
"src/serializer/sqliteSerializer.ts"() {
|
19600
19654
|
"use strict";
|
@@ -19602,9 +19656,10 @@ var init_sqliteSerializer = __esm({
|
|
19602
19656
|
import_drizzle_orm7 = require("drizzle-orm");
|
19603
19657
|
import_sqlite_core2 = require("drizzle-orm/sqlite-core");
|
19604
19658
|
init_outputs();
|
19659
|
+
init_utils();
|
19605
19660
|
init_serializer();
|
19606
|
-
|
19607
|
-
|
19661
|
+
generateSqliteSnapshot = (tables, casing2) => {
|
19662
|
+
const dialect4 = new import_sqlite_core2.SQLiteSyncDialect({ casing: casing2 });
|
19608
19663
|
const result = {};
|
19609
19664
|
const internal = { indexes: {} };
|
19610
19665
|
for (const table4 of tables) {
|
@@ -19622,28 +19677,29 @@ var init_sqliteSerializer = __esm({
|
|
19622
19677
|
uniqueConstraints
|
19623
19678
|
} = (0, import_sqlite_core2.getTableConfig)(table4);
|
19624
19679
|
columns.forEach((column7) => {
|
19680
|
+
const name = getColumnCasing(column7, casing2);
|
19625
19681
|
const notNull = column7.notNull;
|
19626
19682
|
const primaryKey = column7.primary;
|
19627
19683
|
const generated = column7.generated;
|
19628
19684
|
const columnToSet = {
|
19629
|
-
name
|
19685
|
+
name,
|
19630
19686
|
type: column7.getSQLType(),
|
19631
19687
|
primaryKey,
|
19632
19688
|
notNull,
|
19633
19689
|
autoincrement: (0, import_drizzle_orm7.is)(column7, import_sqlite_core2.SQLiteBaseInteger) ? column7.autoIncrement : false,
|
19634
19690
|
generated: generated ? {
|
19635
|
-
as: (0, import_drizzle_orm7.is)(generated.as, import_drizzle_orm7.SQL) ? `(${
|
19691
|
+
as: (0, import_drizzle_orm7.is)(generated.as, import_drizzle_orm7.SQL) ? `(${dialect4.sqlToQuery(generated.as, "indexes").sql})` : typeof generated.as === "function" ? `(${dialect4.sqlToQuery(generated.as(), "indexes").sql})` : `(${generated.as})`,
|
19636
19692
|
type: generated.mode ?? "virtual"
|
19637
19693
|
} : void 0
|
19638
19694
|
};
|
19639
19695
|
if (column7.default !== void 0) {
|
19640
19696
|
if ((0, import_drizzle_orm7.is)(column7.default, import_drizzle_orm7.SQL)) {
|
19641
|
-
columnToSet.default = sqlToStr(column7.default);
|
19697
|
+
columnToSet.default = sqlToStr(column7.default, casing2);
|
19642
19698
|
} else {
|
19643
19699
|
columnToSet.default = typeof column7.default === "string" ? `'${column7.default}'` : typeof column7.default === "object" || Array.isArray(column7.default) ? `'${JSON.stringify(column7.default)}'` : column7.default;
|
19644
19700
|
}
|
19645
19701
|
}
|
19646
|
-
columnsObject[
|
19702
|
+
columnsObject[name] = columnToSet;
|
19647
19703
|
if (column7.isUnique) {
|
19648
19704
|
const existingUnique = indexesObject[column7.uniqueName];
|
19649
19705
|
if (typeof existingUnique !== "undefined") {
|
@@ -19655,7 +19711,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
19655
19711
|
The unique constraint ${source_default.underline.blue(
|
19656
19712
|
column7.uniqueName
|
19657
19713
|
)} on the ${source_default.underline.blue(
|
19658
|
-
|
19714
|
+
name
|
19659
19715
|
)} column is confilcting with a unique constraint name already defined for ${source_default.underline.blue(
|
19660
19716
|
existingUnique.columns.join(",")
|
19661
19717
|
)} columns
|
@@ -19671,15 +19727,25 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
19671
19727
|
}
|
19672
19728
|
});
|
19673
19729
|
const foreignKeys = tableForeignKeys.map((fk4) => {
|
19674
|
-
const name = fk4.getName();
|
19675
19730
|
const tableFrom = tableName;
|
19676
19731
|
const onDelete = fk4.onDelete ?? "no action";
|
19677
19732
|
const onUpdate = fk4.onUpdate ?? "no action";
|
19678
19733
|
const reference = fk4.reference();
|
19679
19734
|
const referenceFT = reference.foreignTable;
|
19680
19735
|
const tableTo = (0, import_drizzle_orm7.getTableName)(referenceFT);
|
19681
|
-
const
|
19682
|
-
const
|
19736
|
+
const originalColumnsFrom = reference.columns.map((it) => it.name);
|
19737
|
+
const columnsFrom = reference.columns.map((it) => getColumnCasing(it, casing2));
|
19738
|
+
const originalColumnsTo = reference.foreignColumns.map((it) => it.name);
|
19739
|
+
const columnsTo = reference.foreignColumns.map((it) => getColumnCasing(it, casing2));
|
19740
|
+
let name = fk4.getName();
|
19741
|
+
if (casing2 !== void 0) {
|
19742
|
+
for (let i2 = 0; i2 < originalColumnsFrom.length; i2++) {
|
19743
|
+
name = name.replace(originalColumnsFrom[i2], columnsFrom[i2]);
|
19744
|
+
}
|
19745
|
+
for (let i2 = 0; i2 < originalColumnsTo.length; i2++) {
|
19746
|
+
name = name.replace(originalColumnsTo[i2], columnsTo[i2]);
|
19747
|
+
}
|
19748
|
+
}
|
19683
19749
|
return {
|
19684
19750
|
name,
|
19685
19751
|
tableFrom,
|
@@ -19699,7 +19765,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
19699
19765
|
let indexColumns = columns2.map((it) => {
|
19700
19766
|
var _a;
|
19701
19767
|
if ((0, import_drizzle_orm7.is)(it, import_drizzle_orm7.SQL)) {
|
19702
|
-
const sql =
|
19768
|
+
const sql = dialect4.sqlToQuery(it, "indexes").sql;
|
19703
19769
|
if (typeof internal.indexes[name] === "undefined") {
|
19704
19770
|
internal.indexes[name] = {
|
19705
19771
|
columns: {
|
@@ -19719,13 +19785,13 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
19719
19785
|
}
|
19720
19786
|
return sql;
|
19721
19787
|
} else {
|
19722
|
-
return it
|
19788
|
+
return getColumnCasing(it, casing2);
|
19723
19789
|
}
|
19724
19790
|
});
|
19725
19791
|
let where = void 0;
|
19726
19792
|
if (value.config.where !== void 0) {
|
19727
19793
|
if ((0, import_drizzle_orm7.is)(value.config.where, import_drizzle_orm7.SQL)) {
|
19728
|
-
where =
|
19794
|
+
where = dialect4.sqlToQuery(value.config.where).sql;
|
19729
19795
|
}
|
19730
19796
|
}
|
19731
19797
|
indexesObject[name] = {
|
@@ -19736,7 +19802,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
19736
19802
|
};
|
19737
19803
|
});
|
19738
19804
|
uniqueConstraints == null ? void 0 : uniqueConstraints.map((unq) => {
|
19739
|
-
const columnNames = unq.columns.map((c) => c
|
19805
|
+
const columnNames = unq.columns.map((c) => getColumnCasing(c, casing2));
|
19740
19806
|
const name = unq.name ?? (0, import_sqlite_core2.uniqueKeyName)(table4, columnNames);
|
19741
19807
|
const existingUnique = indexesObject[name];
|
19742
19808
|
if (typeof existingUnique !== "undefined") {
|
@@ -19766,12 +19832,20 @@ The unique constraint ${source_default.underline.blue(
|
|
19766
19832
|
});
|
19767
19833
|
primaryKeys.forEach((it) => {
|
19768
19834
|
if (it.columns.length > 1) {
|
19769
|
-
|
19770
|
-
|
19771
|
-
|
19835
|
+
const originalColumnNames = it.columns.map((c) => c.name);
|
19836
|
+
const columnNames = it.columns.map((c) => getColumnCasing(c, casing2));
|
19837
|
+
let name = it.getName();
|
19838
|
+
if (casing2 !== void 0) {
|
19839
|
+
for (let i2 = 0; i2 < originalColumnNames.length; i2++) {
|
19840
|
+
name = name.replace(originalColumnNames[i2], columnNames[i2]);
|
19841
|
+
}
|
19842
|
+
}
|
19843
|
+
primaryKeysObject[name] = {
|
19844
|
+
columns: columnNames,
|
19845
|
+
name
|
19772
19846
|
};
|
19773
19847
|
} else {
|
19774
|
-
columnsObject[it.columns[0]
|
19848
|
+
columnsObject[getColumnCasing(it.columns[0], casing2)].primaryKey = true;
|
19775
19849
|
}
|
19776
19850
|
});
|
19777
19851
|
result[tableName] = {
|
@@ -20016,16 +20090,17 @@ WHERE
|
|
20016
20090
|
});
|
20017
20091
|
|
20018
20092
|
// src/serializer/index.ts
|
20019
|
-
var import_fs3, glob, import_path3, sqlToStr, serializeMySql, serializePg, serializeSQLite, prepareFilenames;
|
20093
|
+
var import_casing2, import_fs3, glob, import_path3, sqlToStr, serializeMySql, serializePg, serializeSQLite, prepareFilenames;
|
20020
20094
|
var init_serializer = __esm({
|
20021
20095
|
"src/serializer/index.ts"() {
|
20022
20096
|
"use strict";
|
20023
20097
|
init_source();
|
20098
|
+
import_casing2 = require("drizzle-orm/casing");
|
20024
20099
|
import_fs3 = __toESM(require("fs"));
|
20025
20100
|
glob = __toESM(require_glob());
|
20026
20101
|
import_path3 = __toESM(require("path"));
|
20027
20102
|
init_views();
|
20028
|
-
sqlToStr = (sql) => {
|
20103
|
+
sqlToStr = (sql, casing2) => {
|
20029
20104
|
return sql.toQuery({
|
20030
20105
|
escapeName: () => {
|
20031
20106
|
throw new Error("we don't support params for `sql` default values");
|
@@ -20035,10 +20110,11 @@ var init_serializer = __esm({
|
|
20035
20110
|
},
|
20036
20111
|
escapeString: () => {
|
20037
20112
|
throw new Error("we don't support params for `sql` default values");
|
20038
|
-
}
|
20113
|
+
},
|
20114
|
+
casing: new import_casing2.CasingCache(casing2)
|
20039
20115
|
}).sql;
|
20040
20116
|
};
|
20041
|
-
serializeMySql = async (path5) => {
|
20117
|
+
serializeMySql = async (path5, casing2) => {
|
20042
20118
|
const filenames = prepareFilenames(path5);
|
20043
20119
|
console.log(source_default.gray(`Reading schema files:
|
20044
20120
|
${filenames.join("\n")}
|
@@ -20046,23 +20122,23 @@ ${filenames.join("\n")}
|
|
20046
20122
|
const { prepareFromMySqlImports: prepareFromMySqlImports2 } = await Promise.resolve().then(() => (init_mysqlImports(), mysqlImports_exports));
|
20047
20123
|
const { generateMySqlSnapshot: generateMySqlSnapshot2 } = await Promise.resolve().then(() => (init_mysqlSerializer(), mysqlSerializer_exports));
|
20048
20124
|
const { tables } = await prepareFromMySqlImports2(filenames);
|
20049
|
-
return generateMySqlSnapshot2(tables);
|
20125
|
+
return generateMySqlSnapshot2(tables, casing2);
|
20050
20126
|
};
|
20051
|
-
serializePg = async (path5, schemaFilter) => {
|
20127
|
+
serializePg = async (path5, casing2, schemaFilter) => {
|
20052
20128
|
const filenames = prepareFilenames(path5);
|
20053
20129
|
const { prepareFromPgImports: prepareFromPgImports2 } = await Promise.resolve().then(() => (init_pgImports(), pgImports_exports));
|
20054
20130
|
const { generatePgSnapshot: generatePgSnapshot2 } = await Promise.resolve().then(() => (init_pgSerializer(), pgSerializer_exports));
|
20055
20131
|
const { tables, enums, schemas, sequences } = await prepareFromPgImports2(
|
20056
20132
|
filenames
|
20057
20133
|
);
|
20058
|
-
return generatePgSnapshot2(tables, enums, schemas, sequences, schemaFilter);
|
20134
|
+
return generatePgSnapshot2(tables, enums, schemas, sequences, casing2, schemaFilter);
|
20059
20135
|
};
|
20060
|
-
serializeSQLite = async (path5) => {
|
20136
|
+
serializeSQLite = async (path5, casing2) => {
|
20061
20137
|
const filenames = prepareFilenames(path5);
|
20062
20138
|
const { prepareFromSqliteImports: prepareFromSqliteImports2 } = await Promise.resolve().then(() => (init_sqliteImports(), sqliteImports_exports));
|
20063
20139
|
const { generateSqliteSnapshot: generateSqliteSnapshot2 } = await Promise.resolve().then(() => (init_sqliteSerializer(), sqliteSerializer_exports));
|
20064
20140
|
const { tables } = await prepareFromSqliteImports2(filenames);
|
20065
|
-
return generateSqliteSnapshot2(tables);
|
20141
|
+
return generateSqliteSnapshot2(tables, casing2);
|
20066
20142
|
};
|
20067
20143
|
prepareFilenames = (path5) => {
|
20068
20144
|
if (typeof path5 === "string") {
|
@@ -20111,45 +20187,45 @@ var init_migrationPreparator = __esm({
|
|
20111
20187
|
init_mysqlSchema();
|
20112
20188
|
init_pgSchema();
|
20113
20189
|
init_sqliteSchema();
|
20114
|
-
prepareMySqlDbPushSnapshot = async (prev, schemaPath) => {
|
20115
|
-
const serialized = await serializeMySql(schemaPath);
|
20190
|
+
prepareMySqlDbPushSnapshot = async (prev, schemaPath, casing2) => {
|
20191
|
+
const serialized = await serializeMySql(schemaPath, casing2);
|
20116
20192
|
const id = (0, import_crypto.randomUUID)();
|
20117
20193
|
const idPrev = prev.id;
|
20118
|
-
const { version: version3, dialect:
|
20119
|
-
const result = { version: version3, dialect:
|
20194
|
+
const { version: version3, dialect: dialect4, ...rest } = serialized;
|
20195
|
+
const result = { version: version3, dialect: dialect4, id, prevId: idPrev, ...rest };
|
20120
20196
|
return { prev, cur: result };
|
20121
20197
|
};
|
20122
|
-
prepareSQLiteDbPushSnapshot = async (prev, schemaPath) => {
|
20123
|
-
const serialized = await serializeSQLite(schemaPath);
|
20198
|
+
prepareSQLiteDbPushSnapshot = async (prev, schemaPath, casing2) => {
|
20199
|
+
const serialized = await serializeSQLite(schemaPath, casing2);
|
20124
20200
|
const id = (0, import_crypto.randomUUID)();
|
20125
20201
|
const idPrev = prev.id;
|
20126
|
-
const { version: version3, dialect:
|
20202
|
+
const { version: version3, dialect: dialect4, ...rest } = serialized;
|
20127
20203
|
const result = {
|
20128
20204
|
version: version3,
|
20129
|
-
dialect:
|
20205
|
+
dialect: dialect4,
|
20130
20206
|
id,
|
20131
20207
|
prevId: idPrev,
|
20132
20208
|
...rest
|
20133
20209
|
};
|
20134
20210
|
return { prev, cur: result };
|
20135
20211
|
};
|
20136
|
-
preparePgDbPushSnapshot = async (prev, schemaPath, schemaFilter = ["public"]) => {
|
20137
|
-
const serialized = await serializePg(schemaPath, schemaFilter);
|
20212
|
+
preparePgDbPushSnapshot = async (prev, schemaPath, casing2, schemaFilter = ["public"]) => {
|
20213
|
+
const serialized = await serializePg(schemaPath, casing2, schemaFilter);
|
20138
20214
|
const id = (0, import_crypto.randomUUID)();
|
20139
20215
|
const idPrev = prev.id;
|
20140
|
-
const { version: version3, dialect:
|
20141
|
-
const result = { version: version3, dialect:
|
20216
|
+
const { version: version3, dialect: dialect4, ...rest } = serialized;
|
20217
|
+
const result = { version: version3, dialect: dialect4, id, prevId: idPrev, ...rest };
|
20142
20218
|
return { prev, cur: result };
|
20143
20219
|
};
|
20144
|
-
prepareMySqlMigrationSnapshot = async (migrationFolders, schemaPath) => {
|
20220
|
+
prepareMySqlMigrationSnapshot = async (migrationFolders, schemaPath, casing2) => {
|
20145
20221
|
const prevSnapshot = mysqlSchema.parse(
|
20146
20222
|
preparePrevSnapshot(migrationFolders, dryMySql)
|
20147
20223
|
);
|
20148
|
-
const serialized = await serializeMySql(schemaPath);
|
20224
|
+
const serialized = await serializeMySql(schemaPath, casing2);
|
20149
20225
|
const id = (0, import_crypto.randomUUID)();
|
20150
20226
|
const idPrev = prevSnapshot.id;
|
20151
|
-
const { version: version3, dialect:
|
20152
|
-
const result = { version: version3, dialect:
|
20227
|
+
const { version: version3, dialect: dialect4, ...rest } = serialized;
|
20228
|
+
const result = { version: version3, dialect: dialect4, id, prevId: idPrev, ...rest };
|
20153
20229
|
const { id: _ignoredId, prevId: _ignoredPrevId, ...prevRest } = prevSnapshot;
|
20154
20230
|
const custom2 = {
|
20155
20231
|
id,
|
@@ -20158,17 +20234,17 @@ var init_migrationPreparator = __esm({
|
|
20158
20234
|
};
|
20159
20235
|
return { prev: prevSnapshot, cur: result, custom: custom2 };
|
20160
20236
|
};
|
20161
|
-
prepareSqliteMigrationSnapshot = async (snapshots, schemaPath) => {
|
20237
|
+
prepareSqliteMigrationSnapshot = async (snapshots, schemaPath, casing2) => {
|
20162
20238
|
const prevSnapshot = sqliteSchema.parse(
|
20163
20239
|
preparePrevSnapshot(snapshots, drySQLite)
|
20164
20240
|
);
|
20165
|
-
const serialized = await serializeSQLite(schemaPath);
|
20241
|
+
const serialized = await serializeSQLite(schemaPath, casing2);
|
20166
20242
|
const id = (0, import_crypto.randomUUID)();
|
20167
20243
|
const idPrev = prevSnapshot.id;
|
20168
|
-
const { version: version3, dialect:
|
20244
|
+
const { version: version3, dialect: dialect4, ...rest } = serialized;
|
20169
20245
|
const result = {
|
20170
20246
|
version: version3,
|
20171
|
-
dialect:
|
20247
|
+
dialect: dialect4,
|
20172
20248
|
id,
|
20173
20249
|
prevId: idPrev,
|
20174
20250
|
...rest
|
@@ -20188,9 +20264,9 @@ var init_migrationPreparator = __esm({
|
|
20188
20264
|
}) => {
|
20189
20265
|
return { id, prevId: idPrev, ...serialized };
|
20190
20266
|
};
|
20191
|
-
preparePgMigrationSnapshot = async (snapshots, schemaPath) => {
|
20267
|
+
preparePgMigrationSnapshot = async (snapshots, schemaPath, casing2) => {
|
20192
20268
|
const prevSnapshot = pgSchema.parse(preparePrevSnapshot(snapshots, dryPg));
|
20193
|
-
const serialized = await serializePg(schemaPath);
|
20269
|
+
const serialized = await serializePg(schemaPath, casing2);
|
20194
20270
|
const id = (0, import_crypto.randomUUID)();
|
20195
20271
|
const idPrev = prevSnapshot.id;
|
20196
20272
|
const result = { id, prevId: idPrev, ...serialized };
|
@@ -23016,10 +23092,10 @@ var init_jsonDiffer = __esm({
|
|
23016
23092
|
});
|
23017
23093
|
|
23018
23094
|
// src/sqlgenerator.ts
|
23019
|
-
function fromJson(statements,
|
23095
|
+
function fromJson(statements, dialect4, action, json2) {
|
23020
23096
|
const result = statements.flatMap((statement) => {
|
23021
23097
|
const filtered = convertors.filter((it) => {
|
23022
|
-
return it.can(statement,
|
23098
|
+
return it.can(statement, dialect4);
|
23023
23099
|
});
|
23024
23100
|
const convertor = filtered.length === 1 ? filtered[0] : void 0;
|
23025
23101
|
if (!convertor) {
|
@@ -23087,8 +23163,8 @@ var init_sqlgenerator = __esm({
|
|
23087
23163
|
Convertor = class {
|
23088
23164
|
};
|
23089
23165
|
PgCreateTableConvertor = class extends Convertor {
|
23090
|
-
can(statement,
|
23091
|
-
return statement.type === "create_table" &&
|
23166
|
+
can(statement, dialect4) {
|
23167
|
+
return statement.type === "create_table" && dialect4 === "postgresql";
|
23092
23168
|
}
|
23093
23169
|
convert(st) {
|
23094
23170
|
const { tableName, schema: schema5, columns, compositePKs, uniqueConstraints } = st;
|
@@ -23132,8 +23208,8 @@ var init_sqlgenerator = __esm({
|
|
23132
23208
|
}
|
23133
23209
|
};
|
23134
23210
|
MySqlCreateTableConvertor = class extends Convertor {
|
23135
|
-
can(statement,
|
23136
|
-
return statement.type === "create_table" &&
|
23211
|
+
can(statement, dialect4) {
|
23212
|
+
return statement.type === "create_table" && dialect4 === "mysql";
|
23137
23213
|
}
|
23138
23214
|
convert(st) {
|
23139
23215
|
var _a, _b;
|
@@ -23183,8 +23259,8 @@ var init_sqlgenerator = __esm({
|
|
23183
23259
|
}
|
23184
23260
|
};
|
23185
23261
|
SQLiteCreateTableConvertor = class extends Convertor {
|
23186
|
-
can(statement,
|
23187
|
-
return statement.type === "sqlite_create_table" && (
|
23262
|
+
can(statement, dialect4) {
|
23263
|
+
return statement.type === "sqlite_create_table" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23188
23264
|
}
|
23189
23265
|
convert(st) {
|
23190
23266
|
const {
|
@@ -23246,8 +23322,8 @@ var init_sqlgenerator = __esm({
|
|
23246
23322
|
}
|
23247
23323
|
};
|
23248
23324
|
PgAlterTableAlterColumnSetGenerated = class extends Convertor {
|
23249
|
-
can(statement,
|
23250
|
-
return statement.type === "alter_table_alter_column_set_identity" &&
|
23325
|
+
can(statement, dialect4) {
|
23326
|
+
return statement.type === "alter_table_alter_column_set_identity" && dialect4 === "postgresql";
|
23251
23327
|
}
|
23252
23328
|
convert(statement) {
|
23253
23329
|
const { identity, tableName, columnName, schema: schema5 } = statement;
|
@@ -23259,8 +23335,8 @@ var init_sqlgenerator = __esm({
|
|
23259
23335
|
}
|
23260
23336
|
};
|
23261
23337
|
PgAlterTableAlterColumnDropGenerated = class extends Convertor {
|
23262
|
-
can(statement,
|
23263
|
-
return statement.type === "alter_table_alter_column_drop_identity" &&
|
23338
|
+
can(statement, dialect4) {
|
23339
|
+
return statement.type === "alter_table_alter_column_drop_identity" && dialect4 === "postgresql";
|
23264
23340
|
}
|
23265
23341
|
convert(statement) {
|
23266
23342
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -23269,8 +23345,8 @@ var init_sqlgenerator = __esm({
|
|
23269
23345
|
}
|
23270
23346
|
};
|
23271
23347
|
PgAlterTableAlterColumnAlterGenerated = class extends Convertor {
|
23272
|
-
can(statement,
|
23273
|
-
return statement.type === "alter_table_alter_column_change_identity" &&
|
23348
|
+
can(statement, dialect4) {
|
23349
|
+
return statement.type === "alter_table_alter_column_change_identity" && dialect4 === "postgresql";
|
23274
23350
|
}
|
23275
23351
|
convert(statement) {
|
23276
23352
|
const { identity, oldIdentity, tableName, columnName, schema: schema5 } = statement;
|
@@ -23317,8 +23393,8 @@ var init_sqlgenerator = __esm({
|
|
23317
23393
|
}
|
23318
23394
|
};
|
23319
23395
|
PgAlterTableAddUniqueConstraintConvertor = class extends Convertor {
|
23320
|
-
can(statement,
|
23321
|
-
return statement.type === "create_unique_constraint" &&
|
23396
|
+
can(statement, dialect4) {
|
23397
|
+
return statement.type === "create_unique_constraint" && dialect4 === "postgresql";
|
23322
23398
|
}
|
23323
23399
|
convert(statement) {
|
23324
23400
|
const unsquashed = PgSquasher.unsquashUnique(statement.data);
|
@@ -23327,8 +23403,8 @@ var init_sqlgenerator = __esm({
|
|
23327
23403
|
}
|
23328
23404
|
};
|
23329
23405
|
PgAlterTableDropUniqueConstraintConvertor = class extends Convertor {
|
23330
|
-
can(statement,
|
23331
|
-
return statement.type === "delete_unique_constraint" &&
|
23406
|
+
can(statement, dialect4) {
|
23407
|
+
return statement.type === "delete_unique_constraint" && dialect4 === "postgresql";
|
23332
23408
|
}
|
23333
23409
|
convert(statement) {
|
23334
23410
|
const unsquashed = PgSquasher.unsquashUnique(statement.data);
|
@@ -23337,8 +23413,8 @@ var init_sqlgenerator = __esm({
|
|
23337
23413
|
}
|
23338
23414
|
};
|
23339
23415
|
MySQLAlterTableAddUniqueConstraintConvertor = class extends Convertor {
|
23340
|
-
can(statement,
|
23341
|
-
return statement.type === "create_unique_constraint" &&
|
23416
|
+
can(statement, dialect4) {
|
23417
|
+
return statement.type === "create_unique_constraint" && dialect4 === "mysql";
|
23342
23418
|
}
|
23343
23419
|
convert(statement) {
|
23344
23420
|
const unsquashed = MySqlSquasher.unsquashUnique(statement.data);
|
@@ -23346,8 +23422,8 @@ var init_sqlgenerator = __esm({
|
|
23346
23422
|
}
|
23347
23423
|
};
|
23348
23424
|
MySQLAlterTableDropUniqueConstraintConvertor = class extends Convertor {
|
23349
|
-
can(statement,
|
23350
|
-
return statement.type === "delete_unique_constraint" &&
|
23425
|
+
can(statement, dialect4) {
|
23426
|
+
return statement.type === "delete_unique_constraint" && dialect4 === "mysql";
|
23351
23427
|
}
|
23352
23428
|
convert(statement) {
|
23353
23429
|
const unsquashed = MySqlSquasher.unsquashUnique(statement.data);
|
@@ -23355,8 +23431,8 @@ var init_sqlgenerator = __esm({
|
|
23355
23431
|
}
|
23356
23432
|
};
|
23357
23433
|
CreatePgSequenceConvertor = class extends Convertor {
|
23358
|
-
can(statement,
|
23359
|
-
return statement.type === "create_sequence" &&
|
23434
|
+
can(statement, dialect4) {
|
23435
|
+
return statement.type === "create_sequence" && dialect4 === "postgresql";
|
23360
23436
|
}
|
23361
23437
|
convert(st) {
|
23362
23438
|
const { name, values, schema: schema5 } = st;
|
@@ -23365,8 +23441,8 @@ var init_sqlgenerator = __esm({
|
|
23365
23441
|
}
|
23366
23442
|
};
|
23367
23443
|
DropPgSequenceConvertor = class extends Convertor {
|
23368
|
-
can(statement,
|
23369
|
-
return statement.type === "drop_sequence" &&
|
23444
|
+
can(statement, dialect4) {
|
23445
|
+
return statement.type === "drop_sequence" && dialect4 === "postgresql";
|
23370
23446
|
}
|
23371
23447
|
convert(st) {
|
23372
23448
|
const { name, schema: schema5 } = st;
|
@@ -23375,8 +23451,8 @@ var init_sqlgenerator = __esm({
|
|
23375
23451
|
}
|
23376
23452
|
};
|
23377
23453
|
RenamePgSequenceConvertor = class extends Convertor {
|
23378
|
-
can(statement,
|
23379
|
-
return statement.type === "rename_sequence" &&
|
23454
|
+
can(statement, dialect4) {
|
23455
|
+
return statement.type === "rename_sequence" && dialect4 === "postgresql";
|
23380
23456
|
}
|
23381
23457
|
convert(st) {
|
23382
23458
|
const { nameFrom, nameTo, schema: schema5 } = st;
|
@@ -23386,8 +23462,8 @@ var init_sqlgenerator = __esm({
|
|
23386
23462
|
}
|
23387
23463
|
};
|
23388
23464
|
MovePgSequenceConvertor = class extends Convertor {
|
23389
|
-
can(statement,
|
23390
|
-
return statement.type === "move_sequence" &&
|
23465
|
+
can(statement, dialect4) {
|
23466
|
+
return statement.type === "move_sequence" && dialect4 === "postgresql";
|
23391
23467
|
}
|
23392
23468
|
convert(st) {
|
23393
23469
|
const { schemaFrom, schemaTo, name } = st;
|
@@ -23397,8 +23473,8 @@ var init_sqlgenerator = __esm({
|
|
23397
23473
|
}
|
23398
23474
|
};
|
23399
23475
|
AlterPgSequenceConvertor = class extends Convertor {
|
23400
|
-
can(statement,
|
23401
|
-
return statement.type === "alter_sequence" &&
|
23476
|
+
can(statement, dialect4) {
|
23477
|
+
return statement.type === "alter_sequence" && dialect4 === "postgresql";
|
23402
23478
|
}
|
23403
23479
|
convert(st) {
|
23404
23480
|
const { name, schema: schema5, values } = st;
|
@@ -23441,8 +23517,8 @@ var init_sqlgenerator = __esm({
|
|
23441
23517
|
}
|
23442
23518
|
};
|
23443
23519
|
PgDropTableConvertor = class extends Convertor {
|
23444
|
-
can(statement,
|
23445
|
-
return statement.type === "drop_table" &&
|
23520
|
+
can(statement, dialect4) {
|
23521
|
+
return statement.type === "drop_table" && dialect4 === "postgresql";
|
23446
23522
|
}
|
23447
23523
|
convert(statement) {
|
23448
23524
|
const { tableName, schema: schema5 } = statement;
|
@@ -23451,8 +23527,8 @@ var init_sqlgenerator = __esm({
|
|
23451
23527
|
}
|
23452
23528
|
};
|
23453
23529
|
MySQLDropTableConvertor = class extends Convertor {
|
23454
|
-
can(statement,
|
23455
|
-
return statement.type === "drop_table" &&
|
23530
|
+
can(statement, dialect4) {
|
23531
|
+
return statement.type === "drop_table" && dialect4 === "mysql";
|
23456
23532
|
}
|
23457
23533
|
convert(statement) {
|
23458
23534
|
const { tableName } = statement;
|
@@ -23460,8 +23536,8 @@ var init_sqlgenerator = __esm({
|
|
23460
23536
|
}
|
23461
23537
|
};
|
23462
23538
|
SQLiteDropTableConvertor = class extends Convertor {
|
23463
|
-
can(statement,
|
23464
|
-
return statement.type === "drop_table" && (
|
23539
|
+
can(statement, dialect4) {
|
23540
|
+
return statement.type === "drop_table" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23465
23541
|
}
|
23466
23542
|
convert(statement) {
|
23467
23543
|
const { tableName } = statement;
|
@@ -23469,8 +23545,8 @@ var init_sqlgenerator = __esm({
|
|
23469
23545
|
}
|
23470
23546
|
};
|
23471
23547
|
PgRenameTableConvertor = class extends Convertor {
|
23472
|
-
can(statement,
|
23473
|
-
return statement.type === "rename_table" &&
|
23548
|
+
can(statement, dialect4) {
|
23549
|
+
return statement.type === "rename_table" && dialect4 === "postgresql";
|
23474
23550
|
}
|
23475
23551
|
convert(statement) {
|
23476
23552
|
const { tableNameFrom, tableNameTo, toSchema, fromSchema } = statement;
|
@@ -23480,8 +23556,8 @@ var init_sqlgenerator = __esm({
|
|
23480
23556
|
}
|
23481
23557
|
};
|
23482
23558
|
SqliteRenameTableConvertor = class extends Convertor {
|
23483
|
-
can(statement,
|
23484
|
-
return statement.type === "rename_table" && (
|
23559
|
+
can(statement, dialect4) {
|
23560
|
+
return statement.type === "rename_table" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23485
23561
|
}
|
23486
23562
|
convert(statement) {
|
23487
23563
|
const { tableNameFrom, tableNameTo } = statement;
|
@@ -23489,8 +23565,8 @@ var init_sqlgenerator = __esm({
|
|
23489
23565
|
}
|
23490
23566
|
};
|
23491
23567
|
MySqlRenameTableConvertor = class extends Convertor {
|
23492
|
-
can(statement,
|
23493
|
-
return statement.type === "rename_table" &&
|
23568
|
+
can(statement, dialect4) {
|
23569
|
+
return statement.type === "rename_table" && dialect4 === "mysql";
|
23494
23570
|
}
|
23495
23571
|
convert(statement) {
|
23496
23572
|
const { tableNameFrom, tableNameTo } = statement;
|
@@ -23498,8 +23574,8 @@ var init_sqlgenerator = __esm({
|
|
23498
23574
|
}
|
23499
23575
|
};
|
23500
23576
|
PgAlterTableRenameColumnConvertor = class extends Convertor {
|
23501
|
-
can(statement,
|
23502
|
-
return statement.type === "alter_table_rename_column" &&
|
23577
|
+
can(statement, dialect4) {
|
23578
|
+
return statement.type === "alter_table_rename_column" && dialect4 === "postgresql";
|
23503
23579
|
}
|
23504
23580
|
convert(statement) {
|
23505
23581
|
const { tableName, oldColumnName, newColumnName, schema: schema5 } = statement;
|
@@ -23508,8 +23584,8 @@ var init_sqlgenerator = __esm({
|
|
23508
23584
|
}
|
23509
23585
|
};
|
23510
23586
|
MySqlAlterTableRenameColumnConvertor = class extends Convertor {
|
23511
|
-
can(statement,
|
23512
|
-
return statement.type === "alter_table_rename_column" &&
|
23587
|
+
can(statement, dialect4) {
|
23588
|
+
return statement.type === "alter_table_rename_column" && dialect4 === "mysql";
|
23513
23589
|
}
|
23514
23590
|
convert(statement) {
|
23515
23591
|
const { tableName, oldColumnName, newColumnName } = statement;
|
@@ -23517,8 +23593,8 @@ var init_sqlgenerator = __esm({
|
|
23517
23593
|
}
|
23518
23594
|
};
|
23519
23595
|
SQLiteAlterTableRenameColumnConvertor = class extends Convertor {
|
23520
|
-
can(statement,
|
23521
|
-
return statement.type === "alter_table_rename_column" && (
|
23596
|
+
can(statement, dialect4) {
|
23597
|
+
return statement.type === "alter_table_rename_column" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23522
23598
|
}
|
23523
23599
|
convert(statement) {
|
23524
23600
|
const { tableName, oldColumnName, newColumnName } = statement;
|
@@ -23526,8 +23602,8 @@ var init_sqlgenerator = __esm({
|
|
23526
23602
|
}
|
23527
23603
|
};
|
23528
23604
|
PgAlterTableDropColumnConvertor = class extends Convertor {
|
23529
|
-
can(statement,
|
23530
|
-
return statement.type === "alter_table_drop_column" &&
|
23605
|
+
can(statement, dialect4) {
|
23606
|
+
return statement.type === "alter_table_drop_column" && dialect4 === "postgresql";
|
23531
23607
|
}
|
23532
23608
|
convert(statement) {
|
23533
23609
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -23536,8 +23612,8 @@ var init_sqlgenerator = __esm({
|
|
23536
23612
|
}
|
23537
23613
|
};
|
23538
23614
|
MySqlAlterTableDropColumnConvertor = class extends Convertor {
|
23539
|
-
can(statement,
|
23540
|
-
return statement.type === "alter_table_drop_column" &&
|
23615
|
+
can(statement, dialect4) {
|
23616
|
+
return statement.type === "alter_table_drop_column" && dialect4 === "mysql";
|
23541
23617
|
}
|
23542
23618
|
convert(statement) {
|
23543
23619
|
const { tableName, columnName } = statement;
|
@@ -23545,8 +23621,8 @@ var init_sqlgenerator = __esm({
|
|
23545
23621
|
}
|
23546
23622
|
};
|
23547
23623
|
SQLiteAlterTableDropColumnConvertor = class extends Convertor {
|
23548
|
-
can(statement,
|
23549
|
-
return statement.type === "alter_table_drop_column" && (
|
23624
|
+
can(statement, dialect4) {
|
23625
|
+
return statement.type === "alter_table_drop_column" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23550
23626
|
}
|
23551
23627
|
convert(statement) {
|
23552
23628
|
const { tableName, columnName } = statement;
|
@@ -23554,8 +23630,8 @@ var init_sqlgenerator = __esm({
|
|
23554
23630
|
}
|
23555
23631
|
};
|
23556
23632
|
PgAlterTableAddColumnConvertor = class extends Convertor {
|
23557
|
-
can(statement,
|
23558
|
-
return statement.type === "alter_table_add_column" &&
|
23633
|
+
can(statement, dialect4) {
|
23634
|
+
return statement.type === "alter_table_add_column" && dialect4 === "postgresql";
|
23559
23635
|
}
|
23560
23636
|
convert(statement) {
|
23561
23637
|
const { tableName, column: column7, schema: schema5 } = statement;
|
@@ -23574,8 +23650,8 @@ var init_sqlgenerator = __esm({
|
|
23574
23650
|
}
|
23575
23651
|
};
|
23576
23652
|
MySqlAlterTableAddColumnConvertor = class extends Convertor {
|
23577
|
-
can(statement,
|
23578
|
-
return statement.type === "alter_table_add_column" &&
|
23653
|
+
can(statement, dialect4) {
|
23654
|
+
return statement.type === "alter_table_add_column" && dialect4 === "mysql";
|
23579
23655
|
}
|
23580
23656
|
convert(statement) {
|
23581
23657
|
const { tableName, column: column7 } = statement;
|
@@ -23598,8 +23674,8 @@ var init_sqlgenerator = __esm({
|
|
23598
23674
|
}
|
23599
23675
|
};
|
23600
23676
|
SQLiteAlterTableAddColumnConvertor = class extends Convertor {
|
23601
|
-
can(statement,
|
23602
|
-
return statement.type === "sqlite_alter_table_add_column" && (
|
23677
|
+
can(statement, dialect4) {
|
23678
|
+
return statement.type === "sqlite_alter_table_add_column" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23603
23679
|
}
|
23604
23680
|
convert(statement) {
|
23605
23681
|
const { tableName, column: column7, referenceData } = statement;
|
@@ -23614,8 +23690,8 @@ var init_sqlgenerator = __esm({
|
|
23614
23690
|
}
|
23615
23691
|
};
|
23616
23692
|
PgAlterTableAlterColumnSetTypeConvertor = class extends Convertor {
|
23617
|
-
can(statement,
|
23618
|
-
return statement.type === "alter_table_alter_column_set_type" &&
|
23693
|
+
can(statement, dialect4) {
|
23694
|
+
return statement.type === "alter_table_alter_column_set_type" && dialect4 === "postgresql";
|
23619
23695
|
}
|
23620
23696
|
convert(statement) {
|
23621
23697
|
const { tableName, columnName, newDataType, schema: schema5 } = statement;
|
@@ -23624,8 +23700,8 @@ var init_sqlgenerator = __esm({
|
|
23624
23700
|
}
|
23625
23701
|
};
|
23626
23702
|
PgAlterTableAlterColumnSetDefaultConvertor = class extends Convertor {
|
23627
|
-
can(statement,
|
23628
|
-
return statement.type === "alter_table_alter_column_set_default" &&
|
23703
|
+
can(statement, dialect4) {
|
23704
|
+
return statement.type === "alter_table_alter_column_set_default" && dialect4 === "postgresql";
|
23629
23705
|
}
|
23630
23706
|
convert(statement) {
|
23631
23707
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -23634,8 +23710,8 @@ var init_sqlgenerator = __esm({
|
|
23634
23710
|
}
|
23635
23711
|
};
|
23636
23712
|
PgAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
|
23637
|
-
can(statement,
|
23638
|
-
return statement.type === "alter_table_alter_column_drop_default" &&
|
23713
|
+
can(statement, dialect4) {
|
23714
|
+
return statement.type === "alter_table_alter_column_drop_default" && dialect4 === "postgresql";
|
23639
23715
|
}
|
23640
23716
|
convert(statement) {
|
23641
23717
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -23644,8 +23720,8 @@ var init_sqlgenerator = __esm({
|
|
23644
23720
|
}
|
23645
23721
|
};
|
23646
23722
|
PgAlterTableAlterColumnDropGeneratedConvertor = class extends Convertor {
|
23647
|
-
can(statement,
|
23648
|
-
return statement.type === "alter_table_alter_column_drop_generated" &&
|
23723
|
+
can(statement, dialect4) {
|
23724
|
+
return statement.type === "alter_table_alter_column_drop_generated" && dialect4 === "postgresql";
|
23649
23725
|
}
|
23650
23726
|
convert(statement) {
|
23651
23727
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -23654,8 +23730,8 @@ var init_sqlgenerator = __esm({
|
|
23654
23730
|
}
|
23655
23731
|
};
|
23656
23732
|
PgAlterTableAlterColumnSetExpressionConvertor = class extends Convertor {
|
23657
|
-
can(statement,
|
23658
|
-
return statement.type === "alter_table_alter_column_set_generated" &&
|
23733
|
+
can(statement, dialect4) {
|
23734
|
+
return statement.type === "alter_table_alter_column_set_generated" && dialect4 === "postgresql";
|
23659
23735
|
}
|
23660
23736
|
convert(statement) {
|
23661
23737
|
const {
|
@@ -23692,8 +23768,8 @@ var init_sqlgenerator = __esm({
|
|
23692
23768
|
}
|
23693
23769
|
};
|
23694
23770
|
PgAlterTableAlterColumnAlterrGeneratedConvertor = class extends Convertor {
|
23695
|
-
can(statement,
|
23696
|
-
return statement.type === "alter_table_alter_column_alter_generated" &&
|
23771
|
+
can(statement, dialect4) {
|
23772
|
+
return statement.type === "alter_table_alter_column_alter_generated" && dialect4 === "postgresql";
|
23697
23773
|
}
|
23698
23774
|
convert(statement) {
|
23699
23775
|
const {
|
@@ -23730,8 +23806,8 @@ var init_sqlgenerator = __esm({
|
|
23730
23806
|
}
|
23731
23807
|
};
|
23732
23808
|
SqliteAlterTableAlterColumnDropGeneratedConvertor = class extends Convertor {
|
23733
|
-
can(statement,
|
23734
|
-
return statement.type === "alter_table_alter_column_drop_generated" && (
|
23809
|
+
can(statement, dialect4) {
|
23810
|
+
return statement.type === "alter_table_alter_column_drop_generated" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23735
23811
|
}
|
23736
23812
|
convert(statement) {
|
23737
23813
|
const {
|
@@ -23771,8 +23847,8 @@ var init_sqlgenerator = __esm({
|
|
23771
23847
|
}
|
23772
23848
|
};
|
23773
23849
|
SqliteAlterTableAlterColumnSetExpressionConvertor = class extends Convertor {
|
23774
|
-
can(statement,
|
23775
|
-
return statement.type === "alter_table_alter_column_set_generated" && (
|
23850
|
+
can(statement, dialect4) {
|
23851
|
+
return statement.type === "alter_table_alter_column_set_generated" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23776
23852
|
}
|
23777
23853
|
convert(statement) {
|
23778
23854
|
const {
|
@@ -23812,8 +23888,8 @@ var init_sqlgenerator = __esm({
|
|
23812
23888
|
}
|
23813
23889
|
};
|
23814
23890
|
SqliteAlterTableAlterColumnAlterGeneratedConvertor = class extends Convertor {
|
23815
|
-
can(statement,
|
23816
|
-
return statement.type === "alter_table_alter_column_alter_generated" && (
|
23891
|
+
can(statement, dialect4) {
|
23892
|
+
return statement.type === "alter_table_alter_column_alter_generated" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23817
23893
|
}
|
23818
23894
|
convert(statement) {
|
23819
23895
|
const {
|
@@ -23853,8 +23929,8 @@ var init_sqlgenerator = __esm({
|
|
23853
23929
|
}
|
23854
23930
|
};
|
23855
23931
|
MySqlAlterTableAlterColumnAlterrGeneratedConvertor = class extends Convertor {
|
23856
|
-
can(statement,
|
23857
|
-
return statement.type === "alter_table_alter_column_alter_generated" &&
|
23932
|
+
can(statement, dialect4) {
|
23933
|
+
return statement.type === "alter_table_alter_column_alter_generated" && dialect4 === "mysql";
|
23858
23934
|
}
|
23859
23935
|
convert(statement) {
|
23860
23936
|
const {
|
@@ -23891,24 +23967,24 @@ var init_sqlgenerator = __esm({
|
|
23891
23967
|
}
|
23892
23968
|
};
|
23893
23969
|
MySqlAlterTableAddPk = class extends Convertor {
|
23894
|
-
can(statement,
|
23895
|
-
return statement.type === "alter_table_alter_column_set_pk" &&
|
23970
|
+
can(statement, dialect4) {
|
23971
|
+
return statement.type === "alter_table_alter_column_set_pk" && dialect4 === "mysql";
|
23896
23972
|
}
|
23897
23973
|
convert(statement) {
|
23898
23974
|
return `ALTER TABLE \`${statement.tableName}\` ADD PRIMARY KEY (\`${statement.columnName}\`);`;
|
23899
23975
|
}
|
23900
23976
|
};
|
23901
23977
|
MySqlAlterTableDropPk = class extends Convertor {
|
23902
|
-
can(statement,
|
23903
|
-
return statement.type === "alter_table_alter_column_drop_pk" &&
|
23978
|
+
can(statement, dialect4) {
|
23979
|
+
return statement.type === "alter_table_alter_column_drop_pk" && dialect4 === "mysql";
|
23904
23980
|
}
|
23905
23981
|
convert(statement) {
|
23906
23982
|
return `ALTER TABLE \`${statement.tableName}\` DROP PRIMARY KEY`;
|
23907
23983
|
}
|
23908
23984
|
};
|
23909
23985
|
LibSQLModifyColumn = class extends Convertor {
|
23910
|
-
can(statement,
|
23911
|
-
return (statement.type === "alter_table_alter_column_set_type" || statement.type === "alter_table_alter_column_drop_notnull" || statement.type === "alter_table_alter_column_set_notnull" || statement.type === "alter_table_alter_column_set_default" || statement.type === "alter_table_alter_column_drop_default") &&
|
23986
|
+
can(statement, dialect4) {
|
23987
|
+
return (statement.type === "alter_table_alter_column_set_type" || statement.type === "alter_table_alter_column_drop_notnull" || statement.type === "alter_table_alter_column_set_notnull" || statement.type === "alter_table_alter_column_set_default" || statement.type === "alter_table_alter_column_drop_default") && dialect4 === "turso";
|
23912
23988
|
}
|
23913
23989
|
convert(statement, json2) {
|
23914
23990
|
const { tableName, columnName } = statement;
|
@@ -23968,8 +24044,8 @@ var init_sqlgenerator = __esm({
|
|
23968
24044
|
}
|
23969
24045
|
};
|
23970
24046
|
MySqlModifyColumn = class extends Convertor {
|
23971
|
-
can(statement,
|
23972
|
-
return (statement.type === "alter_table_alter_column_set_type" || statement.type === "alter_table_alter_column_set_notnull" || statement.type === "alter_table_alter_column_drop_notnull" || statement.type === "alter_table_alter_column_drop_on_update" || statement.type === "alter_table_alter_column_set_on_update" || statement.type === "alter_table_alter_column_set_autoincrement" || statement.type === "alter_table_alter_column_drop_autoincrement" || statement.type === "alter_table_alter_column_set_default" || statement.type === "alter_table_alter_column_drop_default" || statement.type === "alter_table_alter_column_set_generated" || statement.type === "alter_table_alter_column_drop_generated") &&
|
24047
|
+
can(statement, dialect4) {
|
24048
|
+
return (statement.type === "alter_table_alter_column_set_type" || statement.type === "alter_table_alter_column_set_notnull" || statement.type === "alter_table_alter_column_drop_notnull" || statement.type === "alter_table_alter_column_drop_on_update" || statement.type === "alter_table_alter_column_set_on_update" || statement.type === "alter_table_alter_column_set_autoincrement" || statement.type === "alter_table_alter_column_drop_autoincrement" || statement.type === "alter_table_alter_column_set_default" || statement.type === "alter_table_alter_column_drop_default" || statement.type === "alter_table_alter_column_set_generated" || statement.type === "alter_table_alter_column_drop_generated") && dialect4 === "mysql";
|
23973
24049
|
}
|
23974
24050
|
convert(statement) {
|
23975
24051
|
var _a, _b, _c, _d, _e, _f, _g;
|
@@ -24106,8 +24182,8 @@ var init_sqlgenerator = __esm({
|
|
24106
24182
|
}
|
24107
24183
|
};
|
24108
24184
|
PgAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
|
24109
|
-
can(statement,
|
24110
|
-
return statement.type === "create_composite_pk" &&
|
24185
|
+
can(statement, dialect4) {
|
24186
|
+
return statement.type === "create_composite_pk" && dialect4 === "postgresql";
|
24111
24187
|
}
|
24112
24188
|
convert(statement) {
|
24113
24189
|
const { name, columns } = PgSquasher.unsquashPK(statement.data);
|
@@ -24116,8 +24192,8 @@ var init_sqlgenerator = __esm({
|
|
24116
24192
|
}
|
24117
24193
|
};
|
24118
24194
|
PgAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
|
24119
|
-
can(statement,
|
24120
|
-
return statement.type === "delete_composite_pk" &&
|
24195
|
+
can(statement, dialect4) {
|
24196
|
+
return statement.type === "delete_composite_pk" && dialect4 === "postgresql";
|
24121
24197
|
}
|
24122
24198
|
convert(statement) {
|
24123
24199
|
const { name, columns } = PgSquasher.unsquashPK(statement.data);
|
@@ -24126,8 +24202,8 @@ var init_sqlgenerator = __esm({
|
|
24126
24202
|
}
|
24127
24203
|
};
|
24128
24204
|
PgAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
|
24129
|
-
can(statement,
|
24130
|
-
return statement.type === "alter_composite_pk" &&
|
24205
|
+
can(statement, dialect4) {
|
24206
|
+
return statement.type === "alter_composite_pk" && dialect4 === "postgresql";
|
24131
24207
|
}
|
24132
24208
|
convert(statement) {
|
24133
24209
|
const { name, columns } = PgSquasher.unsquashPK(statement.old);
|
@@ -24140,8 +24216,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24140
24216
|
}
|
24141
24217
|
};
|
24142
24218
|
MySqlAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
|
24143
|
-
can(statement,
|
24144
|
-
return statement.type === "create_composite_pk" &&
|
24219
|
+
can(statement, dialect4) {
|
24220
|
+
return statement.type === "create_composite_pk" && dialect4 === "mysql";
|
24145
24221
|
}
|
24146
24222
|
convert(statement) {
|
24147
24223
|
const { name, columns } = MySqlSquasher.unsquashPK(statement.data);
|
@@ -24149,8 +24225,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24149
24225
|
}
|
24150
24226
|
};
|
24151
24227
|
MySqlAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
|
24152
|
-
can(statement,
|
24153
|
-
return statement.type === "delete_composite_pk" &&
|
24228
|
+
can(statement, dialect4) {
|
24229
|
+
return statement.type === "delete_composite_pk" && dialect4 === "mysql";
|
24154
24230
|
}
|
24155
24231
|
convert(statement) {
|
24156
24232
|
const { name, columns } = MySqlSquasher.unsquashPK(statement.data);
|
@@ -24158,8 +24234,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24158
24234
|
}
|
24159
24235
|
};
|
24160
24236
|
MySqlAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
|
24161
|
-
can(statement,
|
24162
|
-
return statement.type === "alter_composite_pk" &&
|
24237
|
+
can(statement, dialect4) {
|
24238
|
+
return statement.type === "alter_composite_pk" && dialect4 === "mysql";
|
24163
24239
|
}
|
24164
24240
|
convert(statement) {
|
24165
24241
|
const { name, columns } = MySqlSquasher.unsquashPK(statement.old);
|
@@ -24170,8 +24246,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24170
24246
|
}
|
24171
24247
|
};
|
24172
24248
|
PgAlterTableAlterColumnSetPrimaryKeyConvertor = class extends Convertor {
|
24173
|
-
can(statement,
|
24174
|
-
return statement.type === "alter_table_alter_column_set_pk" &&
|
24249
|
+
can(statement, dialect4) {
|
24250
|
+
return statement.type === "alter_table_alter_column_set_pk" && dialect4 === "postgresql";
|
24175
24251
|
}
|
24176
24252
|
convert(statement) {
|
24177
24253
|
const { tableName, columnName } = statement;
|
@@ -24180,8 +24256,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24180
24256
|
}
|
24181
24257
|
};
|
24182
24258
|
PgAlterTableAlterColumnDropPrimaryKeyConvertor = class extends Convertor {
|
24183
|
-
can(statement,
|
24184
|
-
return statement.type === "alter_table_alter_column_drop_pk" &&
|
24259
|
+
can(statement, dialect4) {
|
24260
|
+
return statement.type === "alter_table_alter_column_drop_pk" && dialect4 === "postgresql";
|
24185
24261
|
}
|
24186
24262
|
convert(statement) {
|
24187
24263
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -24204,8 +24280,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24204
24280
|
}
|
24205
24281
|
};
|
24206
24282
|
PgAlterTableAlterColumnSetNotNullConvertor = class extends Convertor {
|
24207
|
-
can(statement,
|
24208
|
-
return statement.type === "alter_table_alter_column_set_notnull" &&
|
24283
|
+
can(statement, dialect4) {
|
24284
|
+
return statement.type === "alter_table_alter_column_set_notnull" && dialect4 === "postgresql";
|
24209
24285
|
}
|
24210
24286
|
convert(statement) {
|
24211
24287
|
const { tableName, columnName } = statement;
|
@@ -24214,8 +24290,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24214
24290
|
}
|
24215
24291
|
};
|
24216
24292
|
PgAlterTableAlterColumnDropNotNullConvertor = class extends Convertor {
|
24217
|
-
can(statement,
|
24218
|
-
return statement.type === "alter_table_alter_column_drop_notnull" &&
|
24293
|
+
can(statement, dialect4) {
|
24294
|
+
return statement.type === "alter_table_alter_column_drop_notnull" && dialect4 === "postgresql";
|
24219
24295
|
}
|
24220
24296
|
convert(statement) {
|
24221
24297
|
const { tableName, columnName } = statement;
|
@@ -24224,8 +24300,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24224
24300
|
}
|
24225
24301
|
};
|
24226
24302
|
PgCreateForeignKeyConvertor = class extends Convertor {
|
24227
|
-
can(statement,
|
24228
|
-
return statement.type === "create_reference" &&
|
24303
|
+
can(statement, dialect4) {
|
24304
|
+
return statement.type === "create_reference" && dialect4 === "postgresql";
|
24229
24305
|
}
|
24230
24306
|
convert(statement) {
|
24231
24307
|
const {
|
@@ -24254,8 +24330,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24254
24330
|
}
|
24255
24331
|
};
|
24256
24332
|
LibSQLCreateForeignKeyConvertor = class extends Convertor {
|
24257
|
-
can(statement,
|
24258
|
-
return statement.type === "create_reference" &&
|
24333
|
+
can(statement, dialect4) {
|
24334
|
+
return statement.type === "create_reference" && dialect4 === "turso";
|
24259
24335
|
}
|
24260
24336
|
convert(statement, json2, action) {
|
24261
24337
|
const { columnsFrom, columnsTo, tableFrom, onDelete, onUpdate, tableTo } = action === "push" ? SQLiteSquasher.unsquashPushFK(statement.data) : SQLiteSquasher.unsquashFK(statement.data);
|
@@ -24271,8 +24347,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24271
24347
|
}
|
24272
24348
|
};
|
24273
24349
|
MySqlCreateForeignKeyConvertor = class extends Convertor {
|
24274
|
-
can(statement,
|
24275
|
-
return statement.type === "create_reference" &&
|
24350
|
+
can(statement, dialect4) {
|
24351
|
+
return statement.type === "create_reference" && dialect4 === "mysql";
|
24276
24352
|
}
|
24277
24353
|
convert(statement) {
|
24278
24354
|
const {
|
@@ -24292,8 +24368,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24292
24368
|
}
|
24293
24369
|
};
|
24294
24370
|
PgAlterForeignKeyConvertor = class extends Convertor {
|
24295
|
-
can(statement,
|
24296
|
-
return statement.type === "alter_reference" &&
|
24371
|
+
can(statement, dialect4) {
|
24372
|
+
return statement.type === "alter_reference" && dialect4 === "postgresql";
|
24297
24373
|
}
|
24298
24374
|
convert(statement) {
|
24299
24375
|
const newFk = PgSquasher.unsquashFK(statement.data);
|
@@ -24317,8 +24393,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24317
24393
|
}
|
24318
24394
|
};
|
24319
24395
|
PgDeleteForeignKeyConvertor = class extends Convertor {
|
24320
|
-
can(statement,
|
24321
|
-
return statement.type === "delete_reference" &&
|
24396
|
+
can(statement, dialect4) {
|
24397
|
+
return statement.type === "delete_reference" && dialect4 === "postgresql";
|
24322
24398
|
}
|
24323
24399
|
convert(statement) {
|
24324
24400
|
const tableFrom = statement.tableName;
|
@@ -24329,8 +24405,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24329
24405
|
}
|
24330
24406
|
};
|
24331
24407
|
MySqlDeleteForeignKeyConvertor = class extends Convertor {
|
24332
|
-
can(statement,
|
24333
|
-
return statement.type === "delete_reference" &&
|
24408
|
+
can(statement, dialect4) {
|
24409
|
+
return statement.type === "delete_reference" && dialect4 === "mysql";
|
24334
24410
|
}
|
24335
24411
|
convert(statement) {
|
24336
24412
|
const tableFrom = statement.tableName;
|
@@ -24340,8 +24416,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24340
24416
|
}
|
24341
24417
|
};
|
24342
24418
|
CreatePgIndexConvertor = class extends Convertor {
|
24343
|
-
can(statement,
|
24344
|
-
return statement.type === "create_index_pg" &&
|
24419
|
+
can(statement, dialect4) {
|
24420
|
+
return statement.type === "create_index_pg" && dialect4 === "postgresql";
|
24345
24421
|
}
|
24346
24422
|
convert(statement) {
|
24347
24423
|
const {
|
@@ -24372,8 +24448,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24372
24448
|
}
|
24373
24449
|
};
|
24374
24450
|
CreateMySqlIndexConvertor = class extends Convertor {
|
24375
|
-
can(statement,
|
24376
|
-
return statement.type === "create_index" &&
|
24451
|
+
can(statement, dialect4) {
|
24452
|
+
return statement.type === "create_index" && dialect4 === "mysql";
|
24377
24453
|
}
|
24378
24454
|
convert(statement) {
|
24379
24455
|
const { name, columns, isUnique } = MySqlSquasher.unsquashIdx(
|
@@ -24388,8 +24464,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24388
24464
|
}
|
24389
24465
|
};
|
24390
24466
|
CreateSqliteIndexConvertor = class extends Convertor {
|
24391
|
-
can(statement,
|
24392
|
-
return statement.type === "create_index" && (
|
24467
|
+
can(statement, dialect4) {
|
24468
|
+
return statement.type === "create_index" && (dialect4 === "sqlite" || dialect4 === "turso");
|
24393
24469
|
}
|
24394
24470
|
convert(statement) {
|
24395
24471
|
const { name, columns, isUnique, where } = SQLiteSquasher.unsquashIdx(
|
@@ -24405,8 +24481,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24405
24481
|
}
|
24406
24482
|
};
|
24407
24483
|
PgDropIndexConvertor = class extends Convertor {
|
24408
|
-
can(statement,
|
24409
|
-
return statement.type === "drop_index" &&
|
24484
|
+
can(statement, dialect4) {
|
24485
|
+
return statement.type === "drop_index" && dialect4 === "postgresql";
|
24410
24486
|
}
|
24411
24487
|
convert(statement) {
|
24412
24488
|
const { name } = PgSquasher.unsquashIdx(statement.data);
|
@@ -24414,8 +24490,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24414
24490
|
}
|
24415
24491
|
};
|
24416
24492
|
PgCreateSchemaConvertor = class extends Convertor {
|
24417
|
-
can(statement,
|
24418
|
-
return statement.type === "create_schema" &&
|
24493
|
+
can(statement, dialect4) {
|
24494
|
+
return statement.type === "create_schema" && dialect4 === "postgresql";
|
24419
24495
|
}
|
24420
24496
|
convert(statement) {
|
24421
24497
|
const { name } = statement;
|
@@ -24424,8 +24500,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24424
24500
|
}
|
24425
24501
|
};
|
24426
24502
|
PgRenameSchemaConvertor = class extends Convertor {
|
24427
|
-
can(statement,
|
24428
|
-
return statement.type === "rename_schema" &&
|
24503
|
+
can(statement, dialect4) {
|
24504
|
+
return statement.type === "rename_schema" && dialect4 === "postgresql";
|
24429
24505
|
}
|
24430
24506
|
convert(statement) {
|
24431
24507
|
const { from, to } = statement;
|
@@ -24434,8 +24510,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24434
24510
|
}
|
24435
24511
|
};
|
24436
24512
|
PgDropSchemaConvertor = class extends Convertor {
|
24437
|
-
can(statement,
|
24438
|
-
return statement.type === "drop_schema" &&
|
24513
|
+
can(statement, dialect4) {
|
24514
|
+
return statement.type === "drop_schema" && dialect4 === "postgresql";
|
24439
24515
|
}
|
24440
24516
|
convert(statement) {
|
24441
24517
|
const { name } = statement;
|
@@ -24444,8 +24520,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24444
24520
|
}
|
24445
24521
|
};
|
24446
24522
|
PgAlterTableSetSchemaConvertor = class extends Convertor {
|
24447
|
-
can(statement,
|
24448
|
-
return statement.type === "alter_table_set_schema" &&
|
24523
|
+
can(statement, dialect4) {
|
24524
|
+
return statement.type === "alter_table_set_schema" && dialect4 === "postgresql";
|
24449
24525
|
}
|
24450
24526
|
convert(statement) {
|
24451
24527
|
const { tableName, schemaFrom, schemaTo } = statement;
|
@@ -24454,8 +24530,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24454
24530
|
}
|
24455
24531
|
};
|
24456
24532
|
PgAlterTableSetNewSchemaConvertor = class extends Convertor {
|
24457
|
-
can(statement,
|
24458
|
-
return statement.type === "alter_table_set_new_schema" &&
|
24533
|
+
can(statement, dialect4) {
|
24534
|
+
return statement.type === "alter_table_set_new_schema" && dialect4 === "postgresql";
|
24459
24535
|
}
|
24460
24536
|
convert(statement) {
|
24461
24537
|
const { tableName, to, from } = statement;
|
@@ -24465,8 +24541,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24465
24541
|
}
|
24466
24542
|
};
|
24467
24543
|
PgAlterTableRemoveFromSchemaConvertor = class extends Convertor {
|
24468
|
-
can(statement,
|
24469
|
-
return statement.type === "alter_table_remove_from_schema" &&
|
24544
|
+
can(statement, dialect4) {
|
24545
|
+
return statement.type === "alter_table_remove_from_schema" && dialect4 === "postgresql";
|
24470
24546
|
}
|
24471
24547
|
convert(statement) {
|
24472
24548
|
const { tableName, schema: schema5 } = statement;
|
@@ -24476,8 +24552,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24476
24552
|
}
|
24477
24553
|
};
|
24478
24554
|
SqliteDropIndexConvertor = class extends Convertor {
|
24479
|
-
can(statement,
|
24480
|
-
return statement.type === "drop_index" && (
|
24555
|
+
can(statement, dialect4) {
|
24556
|
+
return statement.type === "drop_index" && (dialect4 === "sqlite" || dialect4 === "turso");
|
24481
24557
|
}
|
24482
24558
|
convert(statement) {
|
24483
24559
|
const { name } = PgSquasher.unsquashIdx(statement.data);
|
@@ -24485,8 +24561,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24485
24561
|
}
|
24486
24562
|
};
|
24487
24563
|
MySqlDropIndexConvertor = class extends Convertor {
|
24488
|
-
can(statement,
|
24489
|
-
return statement.type === "drop_index" &&
|
24564
|
+
can(statement, dialect4) {
|
24565
|
+
return statement.type === "drop_index" && dialect4 === "mysql";
|
24490
24566
|
}
|
24491
24567
|
convert(statement) {
|
24492
24568
|
const { name } = MySqlSquasher.unsquashIdx(statement.data);
|
@@ -24494,8 +24570,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24494
24570
|
}
|
24495
24571
|
};
|
24496
24572
|
SQLiteRecreateTableConvertor = class extends Convertor {
|
24497
|
-
can(statement,
|
24498
|
-
return statement.type === "recreate_table" &&
|
24573
|
+
can(statement, dialect4) {
|
24574
|
+
return statement.type === "recreate_table" && dialect4 === "sqlite";
|
24499
24575
|
}
|
24500
24576
|
convert(statement) {
|
24501
24577
|
const { tableName, columns, compositePKs, referenceData } = statement;
|
@@ -24536,8 +24612,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24536
24612
|
}
|
24537
24613
|
};
|
24538
24614
|
LibSQLRecreateTableConvertor = class extends Convertor {
|
24539
|
-
can(statement,
|
24540
|
-
return statement.type === "recreate_table" &&
|
24615
|
+
can(statement, dialect4) {
|
24616
|
+
return statement.type === "recreate_table" && dialect4 === "turso";
|
24541
24617
|
}
|
24542
24618
|
convert(statement) {
|
24543
24619
|
const { tableName, columns, compositePKs, referenceData } = statement;
|
@@ -29637,6 +29713,7 @@ var init_migrate = __esm({
|
|
29637
29713
|
prepareAndMigratePg = async (config) => {
|
29638
29714
|
const outFolder = config.out;
|
29639
29715
|
const schemaPath = config.schema;
|
29716
|
+
const casing2 = config.casing;
|
29640
29717
|
try {
|
29641
29718
|
assertV1OutFolder(outFolder);
|
29642
29719
|
const { snapshots, journal } = prepareMigrationFolder(
|
@@ -29645,7 +29722,8 @@ var init_migrate = __esm({
|
|
29645
29722
|
);
|
29646
29723
|
const { prev, cur, custom: custom2 } = await preparePgMigrationSnapshot(
|
29647
29724
|
snapshots,
|
29648
|
-
schemaPath
|
29725
|
+
schemaPath,
|
29726
|
+
casing2
|
29649
29727
|
);
|
29650
29728
|
const validatedPrev = pgSchema.parse(prev);
|
29651
29729
|
const validatedCur = pgSchema.parse(cur);
|
@@ -29688,10 +29766,11 @@ var init_migrate = __esm({
|
|
29688
29766
|
console.error(e2);
|
29689
29767
|
}
|
29690
29768
|
};
|
29691
|
-
preparePgPush = async (schemaPath, snapshot, schemaFilter) => {
|
29769
|
+
preparePgPush = async (schemaPath, snapshot, schemaFilter, casing2) => {
|
29692
29770
|
const { prev, cur } = await preparePgDbPushSnapshot(
|
29693
29771
|
snapshot,
|
29694
29772
|
schemaPath,
|
29773
|
+
casing2,
|
29695
29774
|
schemaFilter
|
29696
29775
|
);
|
29697
29776
|
const validatedPrev = pgSchema.parse(prev);
|
@@ -29712,11 +29791,12 @@ var init_migrate = __esm({
|
|
29712
29791
|
);
|
29713
29792
|
return { sqlStatements, statements, squashedPrev, squashedCur };
|
29714
29793
|
};
|
29715
|
-
prepareMySQLPush = async (schemaPath, snapshot) => {
|
29794
|
+
prepareMySQLPush = async (schemaPath, snapshot, casing2) => {
|
29716
29795
|
try {
|
29717
29796
|
const { prev, cur } = await prepareMySqlDbPushSnapshot(
|
29718
29797
|
snapshot,
|
29719
|
-
schemaPath
|
29798
|
+
schemaPath,
|
29799
|
+
casing2
|
29720
29800
|
);
|
29721
29801
|
const validatedPrev = mysqlSchema.parse(prev);
|
29722
29802
|
const validatedCur = mysqlSchema.parse(cur);
|
@@ -29740,12 +29820,14 @@ var init_migrate = __esm({
|
|
29740
29820
|
prepareAndMigrateMysql = async (config) => {
|
29741
29821
|
const outFolder = config.out;
|
29742
29822
|
const schemaPath = config.schema;
|
29823
|
+
const casing2 = config.casing;
|
29743
29824
|
try {
|
29744
29825
|
assertV1OutFolder(outFolder);
|
29745
29826
|
const { snapshots, journal } = prepareMigrationFolder(outFolder, "mysql");
|
29746
29827
|
const { prev, cur, custom: custom2 } = await prepareMySqlMigrationSnapshot(
|
29747
29828
|
snapshots,
|
29748
|
-
schemaPath
|
29829
|
+
schemaPath,
|
29830
|
+
casing2
|
29749
29831
|
);
|
29750
29832
|
const validatedPrev = mysqlSchema.parse(prev);
|
29751
29833
|
const validatedCur = mysqlSchema.parse(cur);
|
@@ -29789,12 +29871,14 @@ var init_migrate = __esm({
|
|
29789
29871
|
prepareAndMigrateSqlite = async (config) => {
|
29790
29872
|
const outFolder = config.out;
|
29791
29873
|
const schemaPath = config.schema;
|
29874
|
+
const casing2 = config.casing;
|
29792
29875
|
try {
|
29793
29876
|
assertV1OutFolder(outFolder);
|
29794
29877
|
const { snapshots, journal } = prepareMigrationFolder(outFolder, "sqlite");
|
29795
29878
|
const { prev, cur, custom: custom2 } = await prepareSqliteMigrationSnapshot(
|
29796
29879
|
snapshots,
|
29797
|
-
schemaPath
|
29880
|
+
schemaPath,
|
29881
|
+
casing2
|
29798
29882
|
);
|
29799
29883
|
const validatedPrev = sqliteSchema.parse(prev);
|
29800
29884
|
const validatedCur = sqliteSchema.parse(cur);
|
@@ -29840,12 +29924,14 @@ var init_migrate = __esm({
|
|
29840
29924
|
prepareAndMigrateLibSQL = async (config) => {
|
29841
29925
|
const outFolder = config.out;
|
29842
29926
|
const schemaPath = config.schema;
|
29927
|
+
const casing2 = config.casing;
|
29843
29928
|
try {
|
29844
29929
|
assertV1OutFolder(outFolder);
|
29845
29930
|
const { snapshots, journal } = prepareMigrationFolder(outFolder, "sqlite");
|
29846
29931
|
const { prev, cur, custom: custom2 } = await prepareSqliteMigrationSnapshot(
|
29847
29932
|
snapshots,
|
29848
|
-
schemaPath
|
29933
|
+
schemaPath,
|
29934
|
+
casing2
|
29849
29935
|
);
|
29850
29936
|
const validatedPrev = sqliteSchema.parse(prev);
|
29851
29937
|
const validatedCur = sqliteSchema.parse(cur);
|
@@ -29888,8 +29974,8 @@ var init_migrate = __esm({
|
|
29888
29974
|
console.error(e2);
|
29889
29975
|
}
|
29890
29976
|
};
|
29891
|
-
prepareSQLitePush = async (schemaPath, snapshot) => {
|
29892
|
-
const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath);
|
29977
|
+
prepareSQLitePush = async (schemaPath, snapshot, casing2) => {
|
29978
|
+
const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath, casing2);
|
29893
29979
|
const validatedPrev = sqliteSchema.parse(prev);
|
29894
29980
|
const validatedCur = sqliteSchema.parse(cur);
|
29895
29981
|
const squashedPrev = squashSqliteScheme(validatedPrev, "push");
|
@@ -29911,8 +29997,8 @@ var init_migrate = __esm({
|
|
29911
29997
|
meta: _meta
|
29912
29998
|
};
|
29913
29999
|
};
|
29914
|
-
prepareLibSQLPush = async (schemaPath, snapshot) => {
|
29915
|
-
const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath);
|
30000
|
+
prepareLibSQLPush = async (schemaPath, snapshot, casing2) => {
|
30001
|
+
const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath, casing2);
|
29916
30002
|
const validatedPrev = sqliteSchema.parse(prev);
|
29917
30003
|
const validatedCur = sqliteSchema.parse(cur);
|
29918
30004
|
const squashedPrev = squashSqliteScheme(validatedPrev, "push");
|
@@ -56234,9 +56320,9 @@ var require_dist_cjs46 = __commonJS({
|
|
56234
56320
|
}
|
56235
56321
|
});
|
56236
56322
|
|
56237
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/auth/httpAuthSchemeProvider.js
|
56323
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/auth/httpAuthSchemeProvider.js
|
56238
56324
|
var require_httpAuthSchemeProvider3 = __commonJS({
|
56239
|
-
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/auth/httpAuthSchemeProvider.js"(exports2) {
|
56325
|
+
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/auth/httpAuthSchemeProvider.js"(exports2) {
|
56240
56326
|
"use strict";
|
56241
56327
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
56242
56328
|
exports2.resolveHttpAuthSchemeConfig = exports2.defaultSSOOIDCHttpAuthSchemeProvider = exports2.defaultSSOOIDCHttpAuthSchemeParametersProvider = void 0;
|
@@ -56303,9 +56389,9 @@ var require_httpAuthSchemeProvider3 = __commonJS({
|
|
56303
56389
|
}
|
56304
56390
|
});
|
56305
56391
|
|
56306
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/package.json
|
56392
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/package.json
|
56307
56393
|
var require_package4 = __commonJS({
|
56308
|
-
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/package.json"(exports2, module2) {
|
56394
|
+
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/package.json"(exports2, module2) {
|
56309
56395
|
module2.exports = {
|
56310
56396
|
name: "@aws-sdk/client-sso-oidc",
|
56311
56397
|
description: "AWS SDK for JavaScript Sso Oidc Client for Node.js, Browser and React Native",
|
@@ -56409,9 +56495,9 @@ var require_package4 = __commonJS({
|
|
56409
56495
|
}
|
56410
56496
|
});
|
56411
56497
|
|
56412
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/ruleset.js
|
56498
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/ruleset.js
|
56413
56499
|
var require_ruleset2 = __commonJS({
|
56414
|
-
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/ruleset.js"(exports2) {
|
56500
|
+
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/ruleset.js"(exports2) {
|
56415
56501
|
"use strict";
|
56416
56502
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
56417
56503
|
exports2.ruleSet = void 0;
|
@@ -56444,9 +56530,9 @@ var require_ruleset2 = __commonJS({
|
|
56444
56530
|
}
|
56445
56531
|
});
|
56446
56532
|
|
56447
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/endpointResolver.js
|
56533
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/endpointResolver.js
|
56448
56534
|
var require_endpointResolver2 = __commonJS({
|
56449
|
-
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/endpointResolver.js"(exports2) {
|
56535
|
+
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/endpointResolver.js"(exports2) {
|
56450
56536
|
"use strict";
|
56451
56537
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
56452
56538
|
exports2.defaultEndpointResolver = void 0;
|
@@ -56464,9 +56550,9 @@ var require_endpointResolver2 = __commonJS({
|
|
56464
56550
|
}
|
56465
56551
|
});
|
56466
56552
|
|
56467
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.shared.js
|
56553
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.shared.js
|
56468
56554
|
var require_runtimeConfig_shared2 = __commonJS({
|
56469
|
-
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.shared.js"(exports2) {
|
56555
|
+
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.shared.js"(exports2) {
|
56470
56556
|
"use strict";
|
56471
56557
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
56472
56558
|
exports2.getRuntimeConfig = void 0;
|
@@ -56510,9 +56596,9 @@ var require_runtimeConfig_shared2 = __commonJS({
|
|
56510
56596
|
}
|
56511
56597
|
});
|
56512
56598
|
|
56513
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.js
|
56599
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.js
|
56514
56600
|
var require_runtimeConfig2 = __commonJS({
|
56515
|
-
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.js"(exports2) {
|
56601
|
+
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.js"(exports2) {
|
56516
56602
|
"use strict";
|
56517
56603
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
56518
56604
|
exports2.getRuntimeConfig = void 0;
|
@@ -56563,9 +56649,9 @@ var require_runtimeConfig2 = __commonJS({
|
|
56563
56649
|
}
|
56564
56650
|
});
|
56565
56651
|
|
56566
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js
|
56652
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js
|
56567
56653
|
var require_dist_cjs47 = __commonJS({
|
56568
|
-
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js"(exports2, module2) {
|
56654
|
+
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js"(exports2, module2) {
|
56569
56655
|
"use strict";
|
56570
56656
|
var __defProp3 = Object.defineProperty;
|
56571
56657
|
var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
|
@@ -57911,9 +57997,9 @@ Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.ht
|
|
57911
57997
|
}
|
57912
57998
|
});
|
57913
57999
|
|
57914
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58000
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthSchemeProvider.js
|
57915
58001
|
var require_httpAuthSchemeProvider4 = __commonJS({
|
57916
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58002
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthSchemeProvider.js"(exports2) {
|
57917
58003
|
"use strict";
|
57918
58004
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
57919
58005
|
exports2.resolveHttpAuthSchemeConfig = exports2.resolveStsAuthConfig = exports2.defaultSTSHttpAuthSchemeProvider = exports2.defaultSTSHttpAuthSchemeParametersProvider = void 0;
|
@@ -57983,9 +58069,9 @@ var require_httpAuthSchemeProvider4 = __commonJS({
|
|
57983
58069
|
}
|
57984
58070
|
});
|
57985
58071
|
|
57986
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58072
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/EndpointParameters.js
|
57987
58073
|
var require_EndpointParameters = __commonJS({
|
57988
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58074
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/EndpointParameters.js"(exports2) {
|
57989
58075
|
"use strict";
|
57990
58076
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
57991
58077
|
exports2.commonParams = exports2.resolveClientEndpointParameters = void 0;
|
@@ -58009,9 +58095,9 @@ var require_EndpointParameters = __commonJS({
|
|
58009
58095
|
}
|
58010
58096
|
});
|
58011
58097
|
|
58012
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58098
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/package.json
|
58013
58099
|
var require_package5 = __commonJS({
|
58014
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58100
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/package.json"(exports2, module2) {
|
58015
58101
|
module2.exports = {
|
58016
58102
|
name: "@aws-sdk/client-sts",
|
58017
58103
|
description: "AWS SDK for JavaScript Sts Client for Node.js, Browser and React Native",
|
@@ -58117,9 +58203,9 @@ var require_package5 = __commonJS({
|
|
58117
58203
|
}
|
58118
58204
|
});
|
58119
58205
|
|
58120
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58206
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/ruleset.js
|
58121
58207
|
var require_ruleset3 = __commonJS({
|
58122
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58208
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/ruleset.js"(exports2) {
|
58123
58209
|
"use strict";
|
58124
58210
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58125
58211
|
exports2.ruleSet = void 0;
|
@@ -58164,9 +58250,9 @@ var require_ruleset3 = __commonJS({
|
|
58164
58250
|
}
|
58165
58251
|
});
|
58166
58252
|
|
58167
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58253
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js
|
58168
58254
|
var require_endpointResolver3 = __commonJS({
|
58169
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58255
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js"(exports2) {
|
58170
58256
|
"use strict";
|
58171
58257
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58172
58258
|
exports2.defaultEndpointResolver = void 0;
|
@@ -58184,9 +58270,9 @@ var require_endpointResolver3 = __commonJS({
|
|
58184
58270
|
}
|
58185
58271
|
});
|
58186
58272
|
|
58187
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58273
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.shared.js
|
58188
58274
|
var require_runtimeConfig_shared3 = __commonJS({
|
58189
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58275
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.shared.js"(exports2) {
|
58190
58276
|
"use strict";
|
58191
58277
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58192
58278
|
exports2.getRuntimeConfig = void 0;
|
@@ -58230,9 +58316,9 @@ var require_runtimeConfig_shared3 = __commonJS({
|
|
58230
58316
|
}
|
58231
58317
|
});
|
58232
58318
|
|
58233
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58319
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js
|
58234
58320
|
var require_runtimeConfig3 = __commonJS({
|
58235
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58321
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js"(exports2) {
|
58236
58322
|
"use strict";
|
58237
58323
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58238
58324
|
exports2.getRuntimeConfig = void 0;
|
@@ -58296,9 +58382,9 @@ var require_runtimeConfig3 = __commonJS({
|
|
58296
58382
|
}
|
58297
58383
|
});
|
58298
58384
|
|
58299
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58385
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthExtensionConfiguration.js
|
58300
58386
|
var require_httpAuthExtensionConfiguration = __commonJS({
|
58301
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58387
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthExtensionConfiguration.js"(exports2) {
|
58302
58388
|
"use strict";
|
58303
58389
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58304
58390
|
exports2.resolveHttpAuthRuntimeConfig = exports2.getHttpAuthExtensionConfiguration = void 0;
|
@@ -58344,9 +58430,9 @@ var require_httpAuthExtensionConfiguration = __commonJS({
|
|
58344
58430
|
}
|
58345
58431
|
});
|
58346
58432
|
|
58347
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58433
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeExtensions.js
|
58348
58434
|
var require_runtimeExtensions = __commonJS({
|
58349
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58435
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeExtensions.js"(exports2) {
|
58350
58436
|
"use strict";
|
58351
58437
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58352
58438
|
exports2.resolveRuntimeExtensions = void 0;
|
@@ -58375,9 +58461,9 @@ var require_runtimeExtensions = __commonJS({
|
|
58375
58461
|
}
|
58376
58462
|
});
|
58377
58463
|
|
58378
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58464
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js
|
58379
58465
|
var require_STSClient = __commonJS({
|
58380
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58466
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js"(exports2) {
|
58381
58467
|
"use strict";
|
58382
58468
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58383
58469
|
exports2.STSClient = exports2.__Client = void 0;
|
@@ -58439,9 +58525,9 @@ var require_STSClient = __commonJS({
|
|
58439
58525
|
}
|
58440
58526
|
});
|
58441
58527
|
|
58442
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58528
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/index.js
|
58443
58529
|
var require_dist_cjs50 = __commonJS({
|
58444
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58530
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/index.js"(exports2, module2) {
|
58445
58531
|
"use strict";
|
58446
58532
|
var __defProp3 = Object.defineProperty;
|
58447
58533
|
var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
|
@@ -62599,7 +62685,7 @@ var init_studio2 = __esm({
|
|
62599
62685
|
});
|
62600
62686
|
};
|
62601
62687
|
prepareServer = async ({
|
62602
|
-
dialect:
|
62688
|
+
dialect: dialect4,
|
62603
62689
|
driver: driver2,
|
62604
62690
|
proxy,
|
62605
62691
|
customDefaults,
|
@@ -62649,7 +62735,7 @@ var init_studio2 = __esm({
|
|
62649
62735
|
}));
|
62650
62736
|
return c.json({
|
62651
62737
|
version: "6",
|
62652
|
-
dialect:
|
62738
|
+
dialect: dialect4,
|
62653
62739
|
driver: driver2,
|
62654
62740
|
schemaFiles,
|
62655
62741
|
customDefaults: preparedDefaults,
|
@@ -78956,11 +79042,13 @@ var init_pgIntrospect = __esm({
|
|
78956
79042
|
});
|
78957
79043
|
|
78958
79044
|
// src/introspect-sqlite.ts
|
78959
|
-
var sqliteImportsList, indexName3, objToStatement2, relations, escapeColumnKey, withCasing, schemaToTypeScript, isCyclic, isSelf, mapColumnDefault, column4, createTableColumns, createTableIndexes, createTableUniques, createTablePKs, createTableFKs;
|
79045
|
+
var import_casing3, sqliteImportsList, indexName3, objToStatement2, relations, escapeColumnKey, withCasing, dbColumnName, schemaToTypeScript, isCyclic, isSelf, mapColumnDefault, column4, createTableColumns, createTableIndexes, createTableUniques, createTablePKs, createTableFKs;
|
78960
79046
|
var init_introspect_sqlite = __esm({
|
78961
79047
|
"src/introspect-sqlite.ts"() {
|
78962
79048
|
"use strict";
|
79049
|
+
import_casing3 = require("drizzle-orm/casing");
|
78963
79050
|
init_utils3();
|
79051
|
+
init_global();
|
78964
79052
|
sqliteImportsList = /* @__PURE__ */ new Set([
|
78965
79053
|
"sqliteTable",
|
78966
79054
|
"integer",
|
@@ -78998,6 +79086,15 @@ var init_introspect_sqlite = __esm({
|
|
78998
79086
|
}
|
78999
79087
|
return value;
|
79000
79088
|
};
|
79089
|
+
dbColumnName = ({ name, casing: casing2, withMode = false }) => {
|
79090
|
+
if (casing2 === "preserve") {
|
79091
|
+
return "";
|
79092
|
+
}
|
79093
|
+
if (casing2 === "camel") {
|
79094
|
+
return (0, import_casing3.toCamelCase)(name) === name ? "" : withMode ? `"${name}", ` : `"${name}"`;
|
79095
|
+
}
|
79096
|
+
assertUnreachable(casing2);
|
79097
|
+
};
|
79001
79098
|
schemaToTypeScript = (schema5, casing2) => {
|
79002
79099
|
Object.values(schema5.tables).forEach((table4) => {
|
79003
79100
|
Object.values(table4.foreignKeys).forEach((fk4) => {
|
@@ -79117,13 +79214,14 @@ var init_introspect_sqlite = __esm({
|
|
79117
79214
|
};
|
79118
79215
|
column4 = (type, name, defaultValue, autoincrement, casing2) => {
|
79119
79216
|
let lowered = type;
|
79217
|
+
casing2 = casing2;
|
79120
79218
|
if (lowered === "integer") {
|
79121
|
-
let out = `${withCasing(name, casing2)}: integer(
|
79219
|
+
let out = `${withCasing(name, casing2)}: integer(${dbColumnName({ name, casing: casing2 })})`;
|
79122
79220
|
out += typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault(defaultValue)})` : "";
|
79123
79221
|
return out;
|
79124
79222
|
}
|
79125
79223
|
if (lowered === "real") {
|
79126
|
-
let out = `${withCasing(name, casing2)}: real(
|
79224
|
+
let out = `${withCasing(name, casing2)}: real(${dbColumnName({ name, casing: casing2 })})`;
|
79127
79225
|
out += defaultValue ? `.default(${mapColumnDefault(defaultValue)})` : "";
|
79128
79226
|
return out;
|
79129
79227
|
}
|
@@ -79131,20 +79229,20 @@ var init_introspect_sqlite = __esm({
|
|
79131
79229
|
const match2 = lowered.match(/\d+/);
|
79132
79230
|
let out;
|
79133
79231
|
if (match2) {
|
79134
|
-
out = `${withCasing(name, casing2)}: text(
|
79232
|
+
out = `${withCasing(name, casing2)}: text(${dbColumnName({ name, casing: casing2, withMode: true })}{ length: ${match2[0]} })`;
|
79135
79233
|
} else {
|
79136
|
-
out = `${withCasing(name, casing2)}: text(
|
79234
|
+
out = `${withCasing(name, casing2)}: text(${dbColumnName({ name, casing: casing2 })})`;
|
79137
79235
|
}
|
79138
79236
|
out += defaultValue ? `.default("${mapColumnDefault(defaultValue)}")` : "";
|
79139
79237
|
return out;
|
79140
79238
|
}
|
79141
79239
|
if (lowered === "blob") {
|
79142
|
-
let out = `${withCasing(name, casing2)}: blob(
|
79240
|
+
let out = `${withCasing(name, casing2)}: blob(${dbColumnName({ name, casing: casing2 })})`;
|
79143
79241
|
out += defaultValue ? `.default(${mapColumnDefault(defaultValue)})` : "";
|
79144
79242
|
return out;
|
79145
79243
|
}
|
79146
79244
|
if (lowered === "numeric") {
|
79147
|
-
let out = `${withCasing(name, casing2)}: numeric(
|
79245
|
+
let out = `${withCasing(name, casing2)}: numeric(${dbColumnName({ name, casing: casing2 })})`;
|
79148
79246
|
out += defaultValue ? `.default(${mapColumnDefault(defaultValue)})` : "";
|
79149
79247
|
return out;
|
79150
79248
|
}
|
@@ -79368,13 +79466,13 @@ var init_push = __esm({
|
|
79368
79466
|
init_mysqlPushUtils();
|
79369
79467
|
init_pgPushUtils();
|
79370
79468
|
init_sqlitePushUtils();
|
79371
|
-
mysqlPush = async (schemaPath, credentials2, tablesFilter, strict, verbose, force) => {
|
79469
|
+
mysqlPush = async (schemaPath, credentials2, tablesFilter, strict, verbose, force, casing2) => {
|
79372
79470
|
const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
79373
79471
|
const { mysqlPushIntrospect: mysqlPushIntrospect2 } = await Promise.resolve().then(() => (init_mysqlIntrospect(), mysqlIntrospect_exports));
|
79374
79472
|
const { db, database } = await connectToMySQL2(credentials2);
|
79375
79473
|
const { schema: schema5 } = await mysqlPushIntrospect2(db, database, tablesFilter);
|
79376
79474
|
const { prepareMySQLPush: prepareMySQLPush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
79377
|
-
const statements = await prepareMySQLPush2(schemaPath, schema5);
|
79475
|
+
const statements = await prepareMySQLPush2(schemaPath, schema5, casing2);
|
79378
79476
|
const filteredStatements = filterStatements(
|
79379
79477
|
statements.statements ?? [],
|
79380
79478
|
statements.validatedCur,
|
@@ -79469,13 +79567,13 @@ var init_push = __esm({
|
|
79469
79567
|
console.log(e2);
|
79470
79568
|
}
|
79471
79569
|
};
|
79472
|
-
pgPush = async (schemaPath, verbose, strict, credentials2, tablesFilter, schemasFilter, force) => {
|
79570
|
+
pgPush = async (schemaPath, verbose, strict, credentials2, tablesFilter, schemasFilter, force, casing2) => {
|
79473
79571
|
const { preparePostgresDB: preparePostgresDB2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
79474
79572
|
const { pgPushIntrospect: pgPushIntrospect2 } = await Promise.resolve().then(() => (init_pgIntrospect(), pgIntrospect_exports));
|
79475
79573
|
const db = await preparePostgresDB2(credentials2);
|
79476
79574
|
const { schema: schema5 } = await pgPushIntrospect2(db, tablesFilter, schemasFilter);
|
79477
79575
|
const { preparePgPush: preparePgPush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
79478
|
-
const statements = await preparePgPush2(schemaPath, schema5, schemasFilter);
|
79576
|
+
const statements = await preparePgPush2(schemaPath, schema5, schemasFilter, casing2);
|
79479
79577
|
try {
|
79480
79578
|
if (statements.sqlStatements.length === 0) {
|
79481
79579
|
(0, import_hanji11.render)(`[${source_default.blue("i")}] No changes detected`);
|
@@ -79543,13 +79641,13 @@ var init_push = __esm({
|
|
79543
79641
|
console.error(e2);
|
79544
79642
|
}
|
79545
79643
|
};
|
79546
|
-
sqlitePush = async (schemaPath, verbose, strict, credentials2, tablesFilter, force) => {
|
79644
|
+
sqlitePush = async (schemaPath, verbose, strict, credentials2, tablesFilter, force, casing2) => {
|
79547
79645
|
const { connectToSQLite: connectToSQLite2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
79548
79646
|
const { sqlitePushIntrospect: sqlitePushIntrospect2 } = await Promise.resolve().then(() => (init_sqliteIntrospect(), sqliteIntrospect_exports));
|
79549
79647
|
const db = await connectToSQLite2(credentials2);
|
79550
79648
|
const { schema: schema5 } = await sqlitePushIntrospect2(db, tablesFilter);
|
79551
79649
|
const { prepareSQLitePush: prepareSQLitePush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
79552
|
-
const statements = await prepareSQLitePush2(schemaPath, schema5);
|
79650
|
+
const statements = await prepareSQLitePush2(schemaPath, schema5, casing2);
|
79553
79651
|
if (statements.sqlStatements.length === 0) {
|
79554
79652
|
(0, import_hanji11.render)(`
|
79555
79653
|
[${source_default.blue("i")}] No changes detected`);
|
@@ -79631,13 +79729,13 @@ var init_push = __esm({
|
|
79631
79729
|
}
|
79632
79730
|
}
|
79633
79731
|
};
|
79634
|
-
libSQLPush = async (schemaPath, verbose, strict, credentials2, tablesFilter, force) => {
|
79732
|
+
libSQLPush = async (schemaPath, verbose, strict, credentials2, tablesFilter, force, casing2) => {
|
79635
79733
|
const { connectToLibSQL: connectToLibSQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
79636
79734
|
const { sqlitePushIntrospect: sqlitePushIntrospect2 } = await Promise.resolve().then(() => (init_sqliteIntrospect(), sqliteIntrospect_exports));
|
79637
79735
|
const db = await connectToLibSQL2(credentials2);
|
79638
79736
|
const { schema: schema5 } = await sqlitePushIntrospect2(db, tablesFilter);
|
79639
79737
|
const { prepareLibSQLPush: prepareLibSQLPush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
79640
|
-
const statements = await prepareLibSQLPush2(schemaPath, schema5);
|
79738
|
+
const statements = await prepareLibSQLPush2(schemaPath, schema5, casing2);
|
79641
79739
|
if (statements.sqlStatements.length === 0) {
|
79642
79740
|
(0, import_hanji11.render)(`
|
79643
79741
|
[${source_default.blue("i")}] No changes detected`);
|
@@ -80067,11 +80165,13 @@ var require_pluralize = __commonJS({
|
|
80067
80165
|
});
|
80068
80166
|
|
80069
80167
|
// src/introspect-mysql.ts
|
80070
|
-
var mysqlImportsList, objToStatement22, timeConfig, binaryConfig, importsPatch, relations2, escapeColumnKey2, prepareCasing, schemaToTypeScript2, isCyclic2, isSelf2, mapColumnDefault2, mapColumnDefaultForJson, column5, createTableColumns2, createTableIndexes2, createTableUniques2, createTablePKs2, createTableFKs2;
|
80168
|
+
var import_casing4, mysqlImportsList, objToStatement22, timeConfig, binaryConfig, importsPatch, relations2, escapeColumnKey2, prepareCasing, dbColumnName2, schemaToTypeScript2, isCyclic2, isSelf2, mapColumnDefault2, mapColumnDefaultForJson, column5, createTableColumns2, createTableIndexes2, createTableUniques2, createTablePKs2, createTableFKs2;
|
80071
80169
|
var init_introspect_mysql = __esm({
|
80072
80170
|
"src/introspect-mysql.ts"() {
|
80073
80171
|
"use strict";
|
80172
|
+
import_casing4 = require("drizzle-orm/casing");
|
80074
80173
|
init_utils3();
|
80174
|
+
init_global();
|
80075
80175
|
init_mysqlSerializer();
|
80076
80176
|
mysqlImportsList = /* @__PURE__ */ new Set([
|
80077
80177
|
"mysqlTable",
|
@@ -80151,7 +80251,16 @@ var init_introspect_mysql = __esm({
|
|
80151
80251
|
if (casing2 === "camel") {
|
80152
80252
|
return escapeColumnKey2(value.camelCase());
|
80153
80253
|
}
|
80154
|
-
|
80254
|
+
assertUnreachable(casing2);
|
80255
|
+
};
|
80256
|
+
dbColumnName2 = ({ name, casing: casing2, withMode = false }) => {
|
80257
|
+
if (casing2 === "preserve") {
|
80258
|
+
return "";
|
80259
|
+
}
|
80260
|
+
if (casing2 === "camel") {
|
80261
|
+
return (0, import_casing4.toCamelCase)(name) === name ? "" : withMode ? `"${name}", ` : `"${name}"`;
|
80262
|
+
}
|
80263
|
+
assertUnreachable(casing2);
|
80155
80264
|
};
|
80156
80265
|
schemaToTypeScript2 = (schema5, casing2) => {
|
80157
80266
|
const withCasing4 = prepareCasing(casing2);
|
@@ -80212,6 +80321,7 @@ var init_introspect_mysql = __esm({
|
|
80212
80321
|
Object.values(table4.columns),
|
80213
80322
|
Object.values(table4.foreignKeys),
|
80214
80323
|
withCasing4,
|
80324
|
+
casing2,
|
80215
80325
|
table4.name,
|
80216
80326
|
schema5
|
80217
80327
|
);
|
@@ -80291,51 +80401,51 @@ import { sql } from "drizzle-orm"
|
|
80291
80401
|
}
|
80292
80402
|
return defaultValue;
|
80293
80403
|
};
|
80294
|
-
column5 = (type, name, casing2, defaultValue, autoincrement, onUpdate, isExpression) => {
|
80404
|
+
column5 = (type, name, casing2, rawCasing, defaultValue, autoincrement, onUpdate, isExpression) => {
|
80295
80405
|
let lowered = type;
|
80296
80406
|
if (!type.startsWith("enum(")) {
|
80297
80407
|
lowered = type.toLowerCase();
|
80298
80408
|
}
|
80299
80409
|
if (lowered === "serial") {
|
80300
|
-
return `${casing2(name)}: serial(
|
80410
|
+
return `${casing2(name)}: serial(${dbColumnName2({ name, casing: rawCasing })})`;
|
80301
80411
|
}
|
80302
80412
|
if (lowered.startsWith("int")) {
|
80303
80413
|
const isUnsigned = lowered.startsWith("int unsigned");
|
80304
|
-
let out = `${casing2(name)}: int(
|
80414
|
+
let out = `${casing2(name)}: int(${dbColumnName2({ name, casing: rawCasing, withMode: isUnsigned })}${isUnsigned ? "{ unsigned: true }" : ""})`;
|
80305
80415
|
out += autoincrement ? `.autoincrement()` : "";
|
80306
80416
|
out += typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80307
80417
|
return out;
|
80308
80418
|
}
|
80309
80419
|
if (lowered.startsWith("tinyint")) {
|
80310
80420
|
const isUnsigned = lowered.startsWith("tinyint unsigned");
|
80311
|
-
let out = `${casing2(name)}: tinyint(
|
80421
|
+
let out = `${casing2(name)}: tinyint(${dbColumnName2({ name, casing: rawCasing, withMode: isUnsigned })}${isUnsigned ? ", { unsigned: true }" : ""})`;
|
80312
80422
|
out += autoincrement ? `.autoincrement()` : "";
|
80313
80423
|
out += typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80314
80424
|
return out;
|
80315
80425
|
}
|
80316
80426
|
if (lowered.startsWith("smallint")) {
|
80317
80427
|
const isUnsigned = lowered.startsWith("smallint unsigned");
|
80318
|
-
let out = `${casing2(name)}: smallint(
|
80428
|
+
let out = `${casing2(name)}: smallint(${dbColumnName2({ name, casing: rawCasing, withMode: isUnsigned })}${isUnsigned ? ", { unsigned: true }" : ""})`;
|
80319
80429
|
out += autoincrement ? `.autoincrement()` : "";
|
80320
80430
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80321
80431
|
return out;
|
80322
80432
|
}
|
80323
80433
|
if (lowered.startsWith("mediumint")) {
|
80324
80434
|
const isUnsigned = lowered.startsWith("mediumint unsigned");
|
80325
|
-
let out = `${casing2(name)}: mediumint(
|
80435
|
+
let out = `${casing2(name)}: mediumint(${dbColumnName2({ name, casing: rawCasing, withMode: isUnsigned })}${isUnsigned ? ", { unsigned: true }" : ""})`;
|
80326
80436
|
out += autoincrement ? `.autoincrement()` : "";
|
80327
80437
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80328
80438
|
return out;
|
80329
80439
|
}
|
80330
80440
|
if (lowered.startsWith("bigint")) {
|
80331
80441
|
const isUnsigned = lowered.startsWith("bigint unsigned");
|
80332
|
-
let out = `${casing2(name)}: bigint(
|
80442
|
+
let out = `${casing2(name)}: bigint(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ mode: "number"${isUnsigned ? ", unsigned: true" : ""} })`;
|
80333
80443
|
out += autoincrement ? `.autoincrement()` : "";
|
80334
80444
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80335
80445
|
return out;
|
80336
80446
|
}
|
80337
80447
|
if (lowered === "boolean") {
|
80338
|
-
let out = `${casing2(name)}: boolean(
|
80448
|
+
let out = `${casing2(name)}: boolean(${dbColumnName2({ name, casing: rawCasing })})`;
|
80339
80449
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80340
80450
|
return out;
|
80341
80451
|
}
|
@@ -80345,17 +80455,18 @@ import { sql } from "drizzle-orm"
|
|
80345
80455
|
const [precision, scale] = lowered.slice(7, lowered.length - 1).split(",");
|
80346
80456
|
params = { precision, scale };
|
80347
80457
|
}
|
80348
|
-
|
80458
|
+
const timeConfigParams = params ? timeConfig(params) : void 0;
|
80459
|
+
let out = params ? `${casing2(name)}: double(${dbColumnName2({ name, casing: rawCasing, withMode: timeConfigParams !== void 0 })}${timeConfig(params)})` : `${casing2(name)}: double(${dbColumnName2({ name, casing: rawCasing })})`;
|
80349
80460
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80350
80461
|
return out;
|
80351
80462
|
}
|
80352
80463
|
if (lowered === "float") {
|
80353
|
-
let out = `${casing2(name)}: float(
|
80464
|
+
let out = `${casing2(name)}: float(${dbColumnName2({ name, casing: rawCasing })})`;
|
80354
80465
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80355
80466
|
return out;
|
80356
80467
|
}
|
80357
80468
|
if (lowered === "real") {
|
80358
|
-
let out = `${casing2(name)}: real(
|
80469
|
+
let out = `${casing2(name)}: real(${dbColumnName2({ name, casing: rawCasing })})`;
|
80359
80470
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80360
80471
|
return out;
|
80361
80472
|
}
|
@@ -80364,7 +80475,7 @@ import { sql } from "drizzle-orm"
|
|
80364
80475
|
let fsp = lowered.length > keyLength ? Number(lowered.substring(keyLength, lowered.length - 1)) : null;
|
80365
80476
|
fsp = fsp ? fsp : null;
|
80366
80477
|
const params = timeConfig({ fsp, mode: "'string'" });
|
80367
|
-
let out = params ? `${casing2(name)}: timestamp(
|
80478
|
+
let out = params ? `${casing2(name)}: timestamp(${dbColumnName2({ name, casing: rawCasing, withMode: params !== void 0 })}${params})` : `${casing2(name)}: timestamp(${dbColumnName2({ name, casing: rawCasing })})`;
|
80368
80479
|
defaultValue = defaultValue === "now()" || defaultValue === "(CURRENT_TIMESTAMP)" ? ".defaultNow()" : defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80369
80480
|
out += defaultValue;
|
80370
80481
|
let onUpdateNow = onUpdate ? ".onUpdateNow()" : "";
|
@@ -80376,7 +80487,7 @@ import { sql } from "drizzle-orm"
|
|
80376
80487
|
let fsp = lowered.length > keyLength ? Number(lowered.substring(keyLength, lowered.length - 1)) : null;
|
80377
80488
|
fsp = fsp ? fsp : null;
|
80378
80489
|
const params = timeConfig({ fsp });
|
80379
|
-
let out = params ? `${casing2(name)}: time(
|
80490
|
+
let out = params ? `${casing2(name)}: time(${dbColumnName2({ name, casing: rawCasing, withMode: params !== void 0 })}${params})` : `${casing2(name)}: time(${dbColumnName2({ name, casing: rawCasing })})`;
|
80380
80491
|
defaultValue = defaultValue === "now()" ? ".defaultNow()" : defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80381
80492
|
out += defaultValue;
|
80382
80493
|
return out;
|
@@ -80385,45 +80496,45 @@ import { sql } from "drizzle-orm"
|
|
80385
80496
|
let out = `// you can use { mode: 'date' }, if you want to have Date as type for this column
|
80386
80497
|
${casing2(
|
80387
80498
|
name
|
80388
|
-
)}: date(
|
80499
|
+
)}: date(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ mode: 'string' })`;
|
80389
80500
|
defaultValue = defaultValue === "now()" ? ".defaultNow()" : defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80390
80501
|
out += defaultValue;
|
80391
80502
|
return out;
|
80392
80503
|
}
|
80393
80504
|
if (lowered === "text") {
|
80394
|
-
let out = `${casing2(name)}: text(
|
80505
|
+
let out = `${casing2(name)}: text(${dbColumnName2({ name, casing: rawCasing })})`;
|
80395
80506
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80396
80507
|
return out;
|
80397
80508
|
}
|
80398
80509
|
if (lowered === "tinytext") {
|
80399
|
-
let out = `${casing2(name)}: tinytext(
|
80510
|
+
let out = `${casing2(name)}: tinytext(${dbColumnName2({ name, casing: rawCasing })})`;
|
80400
80511
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80401
80512
|
return out;
|
80402
80513
|
}
|
80403
80514
|
if (lowered === "mediumtext") {
|
80404
|
-
let out = `${casing2(name)}: mediumtext(
|
80515
|
+
let out = `${casing2(name)}: mediumtext(${dbColumnName2({ name, casing: rawCasing })})`;
|
80405
80516
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80406
80517
|
return out;
|
80407
80518
|
}
|
80408
80519
|
if (lowered === "longtext") {
|
80409
|
-
let out = `${casing2(name)}: longtext(
|
80520
|
+
let out = `${casing2(name)}: longtext(${dbColumnName2({ name, casing: rawCasing })})`;
|
80410
80521
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80411
80522
|
return out;
|
80412
80523
|
}
|
80413
80524
|
if (lowered === "year") {
|
80414
|
-
let out = `${casing2(name)}: year(
|
80525
|
+
let out = `${casing2(name)}: year(${dbColumnName2({ name, casing: rawCasing })})`;
|
80415
80526
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80416
80527
|
return out;
|
80417
80528
|
}
|
80418
80529
|
if (lowered === "json") {
|
80419
|
-
let out = `${casing2(name)}: json(
|
80530
|
+
let out = `${casing2(name)}: json(${dbColumnName2({ name, casing: rawCasing })})`;
|
80420
80531
|
out += defaultValue ? `.default(${mapColumnDefaultForJson(defaultValue)})` : "";
|
80421
80532
|
return out;
|
80422
80533
|
}
|
80423
80534
|
if (lowered.startsWith("varchar")) {
|
80424
80535
|
let out = `${casing2(
|
80425
80536
|
name
|
80426
|
-
)}: varchar(
|
80537
|
+
)}: varchar(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ length: ${lowered.substring(
|
80427
80538
|
"varchar".length + 1,
|
80428
80539
|
lowered.length - 1
|
80429
80540
|
)} })`;
|
@@ -80433,7 +80544,7 @@ import { sql } from "drizzle-orm"
|
|
80433
80544
|
if (lowered.startsWith("char")) {
|
80434
80545
|
let out = `${casing2(
|
80435
80546
|
name
|
80436
|
-
)}: char(
|
80547
|
+
)}: char(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ length: ${lowered.substring(
|
80437
80548
|
"char".length + 1,
|
80438
80549
|
lowered.length - 1
|
80439
80550
|
)} })`;
|
@@ -80446,10 +80557,10 @@ import { sql } from "drizzle-orm"
|
|
80446
80557
|
const fsp = lowered.startsWith("datetime(") ? lowered.substring("datetime".length + 1, lowered.length - 1) : void 0;
|
80447
80558
|
out = fsp ? `${casing2(
|
80448
80559
|
name
|
80449
|
-
)}: datetime(
|
80560
|
+
)}: datetime(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ mode: 'string', fsp: ${lowered.substring(
|
80450
80561
|
"datetime".length + 1,
|
80451
80562
|
lowered.length - 1
|
80452
|
-
)} })` : `${casing2(name)}: datetime(
|
80563
|
+
)} })` : `${casing2(name)}: datetime(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ mode: 'string'})`;
|
80453
80564
|
defaultValue = defaultValue === "now()" ? ".defaultNow()" : defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80454
80565
|
out += defaultValue;
|
80455
80566
|
return out;
|
@@ -80460,7 +80571,8 @@ import { sql } from "drizzle-orm"
|
|
80460
80571
|
const [precision, scale] = lowered.slice(8, lowered.length - 1).split(",");
|
80461
80572
|
params = { precision, scale };
|
80462
80573
|
}
|
80463
|
-
|
80574
|
+
const timeConfigParams = params ? timeConfig(params) : void 0;
|
80575
|
+
let out = params ? `${casing2(name)}: decimal(${dbColumnName2({ name, casing: rawCasing, withMode: timeConfigParams !== void 0 })}${timeConfigParams})` : `${casing2(name)}: decimal(${dbColumnName2({ name, casing: rawCasing })})`;
|
80464
80576
|
defaultValue = typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80465
80577
|
out += defaultValue;
|
80466
80578
|
return out;
|
@@ -80470,14 +80582,14 @@ import { sql } from "drizzle-orm"
|
|
80470
80582
|
let length = lowered.length > keyLength ? Number(lowered.substring(keyLength, lowered.length - 1)) : null;
|
80471
80583
|
length = length ? length : null;
|
80472
80584
|
const params = binaryConfig({ length });
|
80473
|
-
let out = params ? `${casing2(name)}: binary(
|
80585
|
+
let out = params ? `${casing2(name)}: binary(${dbColumnName2({ name, casing: rawCasing, withMode: params !== void 0 })}${params})` : `${casing2(name)}: binary(${dbColumnName2({ name, casing: rawCasing })})`;
|
80474
80586
|
defaultValue = defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80475
80587
|
out += defaultValue;
|
80476
80588
|
return out;
|
80477
80589
|
}
|
80478
80590
|
if (lowered.startsWith("enum")) {
|
80479
80591
|
const values = lowered.substring("enum".length + 1, lowered.length - 1);
|
80480
|
-
let out = `${casing2(name)}: mysqlEnum(
|
80592
|
+
let out = `${casing2(name)}: mysqlEnum(${dbColumnName2({ name, casing: rawCasing, withMode: true })}[${values}])`;
|
80481
80593
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80482
80594
|
return out;
|
80483
80595
|
}
|
@@ -80486,7 +80598,7 @@ import { sql } from "drizzle-orm"
|
|
80486
80598
|
let length = lowered.length > keyLength ? Number(lowered.substring(keyLength, lowered.length - 1)) : null;
|
80487
80599
|
length = length ? length : null;
|
80488
80600
|
const params = binaryConfig({ length });
|
80489
|
-
let out = params ? `${casing2(name)}: varbinary(
|
80601
|
+
let out = params ? `${casing2(name)}: varbinary(${dbColumnName2({ name, casing: rawCasing, withMode: params !== void 0 })}${params})` : `${casing2(name)}: varbinary(${dbColumnName2({ name, casing: rawCasing })})`;
|
80490
80602
|
defaultValue = defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80491
80603
|
out += defaultValue;
|
80492
80604
|
return out;
|
@@ -80495,7 +80607,7 @@ import { sql } from "drizzle-orm"
|
|
80495
80607
|
return `// Warning: Can't parse ${type} from database
|
80496
80608
|
// ${type}Type: ${type}("${name}")`;
|
80497
80609
|
};
|
80498
|
-
createTableColumns2 = (columns, fks, casing2, tableName, schema5) => {
|
80610
|
+
createTableColumns2 = (columns, fks, casing2, rawCasing, tableName, schema5) => {
|
80499
80611
|
let statement = "";
|
80500
80612
|
const oneColumnsFKs = Object.values(fks).filter((it) => {
|
80501
80613
|
return !isSelf2(it);
|
@@ -80513,6 +80625,7 @@ import { sql } from "drizzle-orm"
|
|
80513
80625
|
it.type,
|
80514
80626
|
it.name,
|
80515
80627
|
casing2,
|
80628
|
+
rawCasing,
|
80516
80629
|
it.default,
|
80517
80630
|
it.autoincrement,
|
80518
80631
|
it.onUpdate,
|
@@ -80643,13 +80756,14 @@ function generateIdentityParams(identity) {
|
|
80643
80756
|
}
|
80644
80757
|
return `.generatedByDefaultAsIdentity(${paramsObj})`;
|
80645
80758
|
}
|
80646
|
-
var import_drizzle_orm9, import_relations, pgImportsList, timeConfig2, possibleIntervals, intervalStrToObj, intervalConfig, mapColumnDefault3, importsPatch2, relations3, escapeColumnKey3, withCasing2, paramNameFor, schemaToTypeScript3, isCyclic3, isSelf3, buildArrayDefault, mapDefault, column6, dimensionsInArray, createTableColumns3, createTableIndexes3, createTablePKs3, createTableUniques3, createTableFKs3;
|
80759
|
+
var import_drizzle_orm9, import_relations, import_casing5, pgImportsList, timeConfig2, possibleIntervals, intervalStrToObj, intervalConfig, mapColumnDefault3, importsPatch2, relations3, escapeColumnKey3, withCasing2, dbColumnName3, paramNameFor, schemaToTypeScript3, isCyclic3, isSelf3, buildArrayDefault, mapDefault, column6, dimensionsInArray, createTableColumns3, createTableIndexes3, createTablePKs3, createTableUniques3, createTableFKs3;
|
80647
80760
|
var init_introspect_pg = __esm({
|
80648
80761
|
"src/introspect-pg.ts"() {
|
80649
80762
|
"use strict";
|
80650
80763
|
import_drizzle_orm9 = require("drizzle-orm");
|
80651
80764
|
import_relations = require("drizzle-orm/relations");
|
80652
80765
|
init_utils3();
|
80766
|
+
import_casing5 = require("drizzle-orm/casing");
|
80653
80767
|
init_vector();
|
80654
80768
|
init_global();
|
80655
80769
|
init_pgSerializer();
|
@@ -80775,6 +80889,15 @@ var init_introspect_pg = __esm({
|
|
80775
80889
|
}
|
80776
80890
|
assertUnreachable(casing2);
|
80777
80891
|
};
|
80892
|
+
dbColumnName3 = ({ name, casing: casing2, withMode = false }) => {
|
80893
|
+
if (casing2 === "preserve") {
|
80894
|
+
return "";
|
80895
|
+
}
|
80896
|
+
if (casing2 === "camel") {
|
80897
|
+
return (0, import_casing5.toCamelCase)(name) === name ? "" : withMode ? `"${name}", ` : `"${name}"`;
|
80898
|
+
}
|
80899
|
+
assertUnreachable(casing2);
|
80900
|
+
};
|
80778
80901
|
paramNameFor = (name, schema5) => {
|
80779
80902
|
const schemaSuffix = schema5 && schema5 !== "public" ? `In${schema5.capitalise()}` : "";
|
80780
80903
|
return `${name}${schemaSuffix}`;
|
@@ -81070,49 +81193,49 @@ var init_introspect_pg = __esm({
|
|
81070
81193
|
let out = `${withCasing2(name, casing2)}: ${withCasing2(
|
81071
81194
|
paramNameFor(type.replace("[]", ""), typeSchema),
|
81072
81195
|
casing2
|
81073
|
-
)}(
|
81196
|
+
)}(${dbColumnName3({ name, casing: casing2 })})`;
|
81074
81197
|
return out;
|
81075
81198
|
}
|
81076
81199
|
if (lowered.startsWith("serial")) {
|
81077
|
-
return `${withCasing2(name, casing2)}: serial(
|
81200
|
+
return `${withCasing2(name, casing2)}: serial(${dbColumnName3({ name, casing: casing2 })})`;
|
81078
81201
|
}
|
81079
81202
|
if (lowered.startsWith("smallserial")) {
|
81080
|
-
return `${withCasing2(name, casing2)}: smallserial(
|
81203
|
+
return `${withCasing2(name, casing2)}: smallserial(${dbColumnName3({ name, casing: casing2 })})`;
|
81081
81204
|
}
|
81082
81205
|
if (lowered.startsWith("bigserial")) {
|
81083
81206
|
return `${withCasing2(
|
81084
81207
|
name,
|
81085
81208
|
casing2
|
81086
|
-
)}: bigserial(
|
81209
|
+
)}: bigserial(${dbColumnName3({ name, casing: casing2, withMode: true })}{ mode: "bigint" })`;
|
81087
81210
|
}
|
81088
81211
|
if (lowered.startsWith("integer")) {
|
81089
|
-
let out = `${withCasing2(name, casing2)}: integer(
|
81212
|
+
let out = `${withCasing2(name, casing2)}: integer(${dbColumnName3({ name, casing: casing2 })})`;
|
81090
81213
|
return out;
|
81091
81214
|
}
|
81092
81215
|
if (lowered.startsWith("smallint")) {
|
81093
|
-
let out = `${withCasing2(name, casing2)}: smallint(
|
81216
|
+
let out = `${withCasing2(name, casing2)}: smallint(${dbColumnName3({ name, casing: casing2 })})`;
|
81094
81217
|
return out;
|
81095
81218
|
}
|
81096
81219
|
if (lowered.startsWith("bigint")) {
|
81097
81220
|
let out = `// You can use { mode: "bigint" } if numbers are exceeding js number limitations
|
81098
81221
|
`;
|
81099
|
-
out += `${withCasing2(name, casing2)}: bigint(
|
81222
|
+
out += `${withCasing2(name, casing2)}: bigint(${dbColumnName3({ name, casing: casing2, withMode: true })}{ mode: "number" })`;
|
81100
81223
|
return out;
|
81101
81224
|
}
|
81102
81225
|
if (lowered.startsWith("boolean")) {
|
81103
|
-
let out = `${withCasing2(name, casing2)}: boolean(
|
81226
|
+
let out = `${withCasing2(name, casing2)}: boolean(${dbColumnName3({ name, casing: casing2 })})`;
|
81104
81227
|
return out;
|
81105
81228
|
}
|
81106
81229
|
if (lowered.startsWith("double precision")) {
|
81107
|
-
let out = `${withCasing2(name, casing2)}: doublePrecision(
|
81230
|
+
let out = `${withCasing2(name, casing2)}: doublePrecision(${dbColumnName3({ name, casing: casing2 })})`;
|
81108
81231
|
return out;
|
81109
81232
|
}
|
81110
81233
|
if (lowered.startsWith("real")) {
|
81111
|
-
let out = `${withCasing2(name, casing2)}: real(
|
81234
|
+
let out = `${withCasing2(name, casing2)}: real(${dbColumnName3({ name, casing: casing2 })})`;
|
81112
81235
|
return out;
|
81113
81236
|
}
|
81114
81237
|
if (lowered.startsWith("uuid")) {
|
81115
|
-
let out = `${withCasing2(name, casing2)}: uuid(
|
81238
|
+
let out = `${withCasing2(name, casing2)}: uuid(${dbColumnName3({ name, casing: casing2 })})`;
|
81116
81239
|
return out;
|
81117
81240
|
}
|
81118
81241
|
if (lowered.startsWith("numeric")) {
|
@@ -81121,7 +81244,7 @@ var init_introspect_pg = __esm({
|
|
81121
81244
|
const [precision, scale] = lowered.slice(8, lowered.length - 1).split(",");
|
81122
81245
|
params = { precision, scale };
|
81123
81246
|
}
|
81124
|
-
let out = params ? `${withCasing2(name, casing2)}: numeric(
|
81247
|
+
let out = params ? `${withCasing2(name, casing2)}: numeric(${dbColumnName3({ name, casing: casing2, withMode: true })}${timeConfig2(params)})` : `${withCasing2(name, casing2)}: numeric(${dbColumnName3({ name, casing: casing2 })})`;
|
81125
81248
|
return out;
|
81126
81249
|
}
|
81127
81250
|
if (lowered.startsWith("timestamp")) {
|
@@ -81135,7 +81258,7 @@ var init_introspect_pg = __esm({
|
|
81135
81258
|
withTimezone,
|
81136
81259
|
mode: "'string'"
|
81137
81260
|
});
|
81138
|
-
let out = params ? `${withCasing2(name, casing2)}: timestamp(
|
81261
|
+
let out = params ? `${withCasing2(name, casing2)}: timestamp(${dbColumnName3({ name, casing: casing2, withMode: true })}${params})` : `${withCasing2(name, casing2)}: timestamp(${dbColumnName3({ name, casing: casing2 })})`;
|
81139
81262
|
return out;
|
81140
81263
|
}
|
81141
81264
|
if (lowered.startsWith("time")) {
|
@@ -81145,44 +81268,44 @@ var init_introspect_pg = __esm({
|
|
81145
81268
|
) : null;
|
81146
81269
|
precision = precision ? precision : null;
|
81147
81270
|
const params = timeConfig2({ precision, withTimezone });
|
81148
|
-
let out = params ? `${withCasing2(name, casing2)}: time(
|
81271
|
+
let out = params ? `${withCasing2(name, casing2)}: time(${dbColumnName3({ name, casing: casing2, withMode: true })}${params})` : `${withCasing2(name, casing2)}: time(${dbColumnName3({ name, casing: casing2 })})`;
|
81149
81272
|
return out;
|
81150
81273
|
}
|
81151
81274
|
if (lowered.startsWith("interval")) {
|
81152
81275
|
const params = intervalConfig(lowered);
|
81153
|
-
let out = params ? `${withCasing2(name, casing2)}: interval(
|
81276
|
+
let out = params ? `${withCasing2(name, casing2)}: interval(${dbColumnName3({ name, casing: casing2, withMode: true })}${params})` : `${withCasing2(name, casing2)}: interval(${dbColumnName3({ name, casing: casing2 })})`;
|
81154
81277
|
return out;
|
81155
81278
|
}
|
81156
81279
|
if (lowered === "date") {
|
81157
|
-
let out = `${withCasing2(name, casing2)}: date(
|
81280
|
+
let out = `${withCasing2(name, casing2)}: date(${dbColumnName3({ name, casing: casing2 })})`;
|
81158
81281
|
return out;
|
81159
81282
|
}
|
81160
81283
|
if (lowered.startsWith("text")) {
|
81161
|
-
let out = `${withCasing2(name, casing2)}: text(
|
81284
|
+
let out = `${withCasing2(name, casing2)}: text(${dbColumnName3({ name, casing: casing2 })})`;
|
81162
81285
|
return out;
|
81163
81286
|
}
|
81164
81287
|
if (lowered.startsWith("jsonb")) {
|
81165
|
-
let out = `${withCasing2(name, casing2)}: jsonb(
|
81288
|
+
let out = `${withCasing2(name, casing2)}: jsonb(${dbColumnName3({ name, casing: casing2 })})`;
|
81166
81289
|
return out;
|
81167
81290
|
}
|
81168
81291
|
if (lowered.startsWith("json")) {
|
81169
|
-
let out = `${withCasing2(name, casing2)}: json(
|
81292
|
+
let out = `${withCasing2(name, casing2)}: json(${dbColumnName3({ name, casing: casing2 })})`;
|
81170
81293
|
return out;
|
81171
81294
|
}
|
81172
81295
|
if (lowered.startsWith("inet")) {
|
81173
|
-
let out = `${withCasing2(name, casing2)}: inet(
|
81296
|
+
let out = `${withCasing2(name, casing2)}: inet(${dbColumnName3({ name, casing: casing2 })})`;
|
81174
81297
|
return out;
|
81175
81298
|
}
|
81176
81299
|
if (lowered.startsWith("cidr")) {
|
81177
|
-
let out = `${withCasing2(name, casing2)}: cidr(
|
81300
|
+
let out = `${withCasing2(name, casing2)}: cidr(${dbColumnName3({ name, casing: casing2 })})`;
|
81178
81301
|
return out;
|
81179
81302
|
}
|
81180
81303
|
if (lowered.startsWith("macaddr8")) {
|
81181
|
-
let out = `${withCasing2(name, casing2)}: macaddr8(
|
81304
|
+
let out = `${withCasing2(name, casing2)}: macaddr8(${dbColumnName3({ name, casing: casing2 })})`;
|
81182
81305
|
return out;
|
81183
81306
|
}
|
81184
81307
|
if (lowered.startsWith("macaddr")) {
|
81185
|
-
let out = `${withCasing2(name, casing2)}: macaddr(
|
81308
|
+
let out = `${withCasing2(name, casing2)}: macaddr(${dbColumnName3({ name, casing: casing2 })})`;
|
81186
81309
|
return out;
|
81187
81310
|
}
|
81188
81311
|
if (lowered.startsWith("varchar")) {
|
@@ -81191,21 +81314,21 @@ var init_introspect_pg = __esm({
|
|
81191
81314
|
out = `${withCasing2(
|
81192
81315
|
name,
|
81193
81316
|
casing2
|
81194
|
-
)}: varchar(
|
81317
|
+
)}: varchar(${dbColumnName3({ name, casing: casing2, withMode: true })}{ length: ${lowered.substring(
|
81195
81318
|
8,
|
81196
81319
|
lowered.length - 1
|
81197
81320
|
)} })`;
|
81198
81321
|
} else {
|
81199
|
-
out = `${withCasing2(name, casing2)}: varchar(
|
81322
|
+
out = `${withCasing2(name, casing2)}: varchar(${dbColumnName3({ name, casing: casing2 })})`;
|
81200
81323
|
}
|
81201
81324
|
return out;
|
81202
81325
|
}
|
81203
81326
|
if (lowered.startsWith("point")) {
|
81204
|
-
let out = `${withCasing2(name, casing2)}: point(
|
81327
|
+
let out = `${withCasing2(name, casing2)}: point(${dbColumnName3({ name, casing: casing2 })})`;
|
81205
81328
|
return out;
|
81206
81329
|
}
|
81207
81330
|
if (lowered.startsWith("line")) {
|
81208
|
-
let out = `${withCasing2(name, casing2)}: point(
|
81331
|
+
let out = `${withCasing2(name, casing2)}: point(${dbColumnName3({ name, casing: casing2 })})`;
|
81209
81332
|
return out;
|
81210
81333
|
}
|
81211
81334
|
if (lowered.startsWith("geometry")) {
|
@@ -81214,14 +81337,14 @@ var init_introspect_pg = __esm({
|
|
81214
81337
|
if (lowered.length !== 8) {
|
81215
81338
|
const geometryOptions = lowered.slice(9, -1).split(",");
|
81216
81339
|
if (geometryOptions.length === 1 && geometryOptions[0] !== "") {
|
81217
|
-
out = `${withCasing2(name, casing2)}: geometry(
|
81340
|
+
out = `${withCasing2(name, casing2)}: geometry(${dbColumnName3({ name, casing: casing2, withMode: true })}{ type: "${geometryOptions[0]}" })`;
|
81218
81341
|
} else if (geometryOptions.length === 2) {
|
81219
|
-
out = `${withCasing2(name, casing2)}: geometry(
|
81342
|
+
out = `${withCasing2(name, casing2)}: geometry(${dbColumnName3({ name, casing: casing2, withMode: true })}{ type: "${geometryOptions[0]}", srid: ${geometryOptions[1]} })`;
|
81220
81343
|
} else {
|
81221
81344
|
isGeoUnknown = true;
|
81222
81345
|
}
|
81223
81346
|
} else {
|
81224
|
-
out = `${withCasing2(name, casing2)}: geometry(
|
81347
|
+
out = `${withCasing2(name, casing2)}: geometry(${dbColumnName3({ name, casing: casing2 })})`;
|
81225
81348
|
}
|
81226
81349
|
if (isGeoUnknown) {
|
81227
81350
|
let unknown2 = `// TODO: failed to parse geometry type because found more than 2 options inside geometry function '${type}'
|
@@ -81238,12 +81361,12 @@ var init_introspect_pg = __esm({
|
|
81238
81361
|
out = `${withCasing2(
|
81239
81362
|
name,
|
81240
81363
|
casing2
|
81241
|
-
)}: vector(
|
81364
|
+
)}: vector(${dbColumnName3({ name, casing: casing2, withMode: true })}{ dimensions: ${lowered.substring(
|
81242
81365
|
7,
|
81243
81366
|
lowered.length - 1
|
81244
81367
|
)} })`;
|
81245
81368
|
} else {
|
81246
|
-
out = `${withCasing2(name, casing2)}: vector(
|
81369
|
+
out = `${withCasing2(name, casing2)}: vector(${dbColumnName3({ name, casing: casing2 })})`;
|
81247
81370
|
}
|
81248
81371
|
return out;
|
81249
81372
|
}
|
@@ -81253,12 +81376,12 @@ var init_introspect_pg = __esm({
|
|
81253
81376
|
out = `${withCasing2(
|
81254
81377
|
name,
|
81255
81378
|
casing2
|
81256
|
-
)}: char(
|
81379
|
+
)}: char(${dbColumnName3({ name, casing: casing2, withMode: true })}{ length: ${lowered.substring(
|
81257
81380
|
5,
|
81258
81381
|
lowered.length - 1
|
81259
81382
|
)} })`;
|
81260
81383
|
} else {
|
81261
|
-
out = `${withCasing2(name, casing2)}: char(
|
81384
|
+
out = `${withCasing2(name, casing2)}: char(${dbColumnName3({ name, casing: casing2 })})`;
|
81262
81385
|
}
|
81263
81386
|
return out;
|
81264
81387
|
}
|
@@ -83356,9 +83479,9 @@ init_source();
|
|
83356
83479
|
|
83357
83480
|
// src/cli/commands/check.ts
|
83358
83481
|
init_utils();
|
83359
|
-
var checkHandler = (out,
|
83360
|
-
const { snapshots } = prepareOutFolder(out,
|
83361
|
-
const report = validateWithReport(snapshots,
|
83482
|
+
var checkHandler = (out, dialect4) => {
|
83483
|
+
const { snapshots } = prepareOutFolder(out, dialect4);
|
83484
|
+
const report = validateWithReport(snapshots, dialect4);
|
83362
83485
|
if (report.nonLatest.length > 0) {
|
83363
83486
|
console.log(
|
83364
83487
|
report.nonLatest.map((it) => {
|
@@ -84645,12 +84768,14 @@ var optionBreakpoints = boolean().desc(
|
|
84645
84768
|
`Prepare SQL statements with breakpoints`
|
84646
84769
|
);
|
84647
84770
|
var optionDriver = string().enum(...drivers).desc("Database driver");
|
84771
|
+
var optionCasing = string().enum("camelCase", "snake_case").desc("Casing for serialization");
|
84648
84772
|
var generate = command({
|
84649
84773
|
name: "generate",
|
84650
84774
|
options: {
|
84651
84775
|
config: optionConfig,
|
84652
84776
|
dialect: optionDialect,
|
84653
84777
|
driver: optionDriver,
|
84778
|
+
casing: optionCasing,
|
84654
84779
|
schema: string().desc("Path to a schema file or folder"),
|
84655
84780
|
out: optionOut,
|
84656
84781
|
name: string().desc("Migration file name"),
|
@@ -84663,7 +84788,7 @@ var generate = command({
|
|
84663
84788
|
"generate",
|
84664
84789
|
opts,
|
84665
84790
|
["prefix", "name", "custom"],
|
84666
|
-
["driver", "breakpoints", "schema", "out", "dialect"]
|
84791
|
+
["driver", "breakpoints", "schema", "out", "dialect", "casing"]
|
84667
84792
|
);
|
84668
84793
|
return prepareGenerateConfig(opts, from);
|
84669
84794
|
},
|
@@ -84676,17 +84801,17 @@ var generate = command({
|
|
84676
84801
|
prepareAndMigrateSqlite: prepareAndMigrateSqlite2,
|
84677
84802
|
prepareAndMigrateLibSQL: prepareAndMigrateLibSQL2
|
84678
84803
|
} = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
84679
|
-
const
|
84680
|
-
if (
|
84804
|
+
const dialect4 = opts.dialect;
|
84805
|
+
if (dialect4 === "postgresql") {
|
84681
84806
|
await prepareAndMigratePg2(opts);
|
84682
|
-
} else if (
|
84807
|
+
} else if (dialect4 === "mysql") {
|
84683
84808
|
await prepareAndMigrateMysql2(opts);
|
84684
|
-
} else if (
|
84809
|
+
} else if (dialect4 === "sqlite") {
|
84685
84810
|
await prepareAndMigrateSqlite2(opts);
|
84686
|
-
} else if (
|
84811
|
+
} else if (dialect4 === "turso") {
|
84687
84812
|
await prepareAndMigrateLibSQL2(opts);
|
84688
84813
|
} else {
|
84689
|
-
assertUnreachable(
|
84814
|
+
assertUnreachable(dialect4);
|
84690
84815
|
}
|
84691
84816
|
}
|
84692
84817
|
});
|
@@ -84701,9 +84826,9 @@ var migrate = command({
|
|
84701
84826
|
handler: async (opts) => {
|
84702
84827
|
await assertOrmCoreVersion();
|
84703
84828
|
await assertPackages("drizzle-orm");
|
84704
|
-
const { dialect:
|
84829
|
+
const { dialect: dialect4, schema: schema5, table: table4, out, credentials: credentials2 } = opts;
|
84705
84830
|
try {
|
84706
|
-
if (
|
84831
|
+
if (dialect4 === "postgresql") {
|
84707
84832
|
if ("driver" in credentials2) {
|
84708
84833
|
const { driver: driver2 } = credentials2;
|
84709
84834
|
if (driver2 === "aws-data-api") {
|
@@ -84734,7 +84859,7 @@ var migrate = command({
|
|
84734
84859
|
migrationsSchema: schema5
|
84735
84860
|
})
|
84736
84861
|
);
|
84737
|
-
} else if (
|
84862
|
+
} else if (dialect4 === "mysql") {
|
84738
84863
|
const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
84739
84864
|
const { migrate: migrate2 } = await connectToMySQL2(credentials2);
|
84740
84865
|
await (0, import_hanji13.renderWithTask)(
|
@@ -84745,7 +84870,7 @@ var migrate = command({
|
|
84745
84870
|
migrationsSchema: schema5
|
84746
84871
|
})
|
84747
84872
|
);
|
84748
|
-
} else if (
|
84873
|
+
} else if (dialect4 === "sqlite") {
|
84749
84874
|
const { connectToSQLite: connectToSQLite2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
84750
84875
|
const { migrate: migrate2 } = await connectToSQLite2(credentials2);
|
84751
84876
|
await (0, import_hanji13.renderWithTask)(
|
@@ -84756,7 +84881,7 @@ var migrate = command({
|
|
84756
84881
|
migrationsSchema: schema5
|
84757
84882
|
})
|
84758
84883
|
);
|
84759
|
-
} else if (
|
84884
|
+
} else if (dialect4 === "turso") {
|
84760
84885
|
const { connectToLibSQL: connectToLibSQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
84761
84886
|
const { migrate: migrate2 } = await connectToLibSQL2(credentials2);
|
84762
84887
|
await (0, import_hanji13.renderWithTask)(
|
@@ -84768,7 +84893,7 @@ var migrate = command({
|
|
84768
84893
|
})
|
84769
84894
|
);
|
84770
84895
|
} else {
|
84771
|
-
assertUnreachable(
|
84896
|
+
assertUnreachable(dialect4);
|
84772
84897
|
}
|
84773
84898
|
} catch (e2) {
|
84774
84899
|
console.error(e2);
|
@@ -84802,6 +84927,7 @@ var push = command({
|
|
84802
84927
|
options: {
|
84803
84928
|
config: optionConfig,
|
84804
84929
|
dialect: optionDialect,
|
84930
|
+
casing: optionCasing,
|
84805
84931
|
schema: string().desc("Path to a schema file or folder"),
|
84806
84932
|
...optionsFilters,
|
84807
84933
|
...optionsDatabaseCredentials,
|
@@ -84830,7 +84956,8 @@ var push = command({
|
|
84830
84956
|
"authToken",
|
84831
84957
|
"schemaFilters",
|
84832
84958
|
"extensionsFilters",
|
84833
|
-
"tablesFilter"
|
84959
|
+
"tablesFilter",
|
84960
|
+
"casing"
|
84834
84961
|
]
|
84835
84962
|
);
|
84836
84963
|
return preparePushConfig(opts, from);
|
@@ -84839,17 +84966,18 @@ var push = command({
|
|
84839
84966
|
await assertPackages("drizzle-orm");
|
84840
84967
|
await assertOrmCoreVersion();
|
84841
84968
|
const {
|
84842
|
-
dialect:
|
84969
|
+
dialect: dialect4,
|
84843
84970
|
schemaPath,
|
84844
84971
|
strict,
|
84845
84972
|
verbose,
|
84846
84973
|
credentials: credentials2,
|
84847
84974
|
tablesFilter,
|
84848
84975
|
schemasFilter,
|
84849
|
-
force
|
84976
|
+
force,
|
84977
|
+
casing: casing2
|
84850
84978
|
} = config;
|
84851
84979
|
try {
|
84852
|
-
if (
|
84980
|
+
if (dialect4 === "mysql") {
|
84853
84981
|
const { mysqlPush: mysqlPush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
|
84854
84982
|
await mysqlPush2(
|
84855
84983
|
schemaPath,
|
@@ -84857,9 +84985,10 @@ var push = command({
|
|
84857
84985
|
tablesFilter,
|
84858
84986
|
strict,
|
84859
84987
|
verbose,
|
84860
|
-
force
|
84988
|
+
force,
|
84989
|
+
casing2
|
84861
84990
|
);
|
84862
|
-
} else if (
|
84991
|
+
} else if (dialect4 === "postgresql") {
|
84863
84992
|
if ("driver" in credentials2) {
|
84864
84993
|
const { driver: driver2 } = credentials2;
|
84865
84994
|
if (driver2 === "aws-data-api") {
|
@@ -84888,9 +85017,10 @@ var push = command({
|
|
84888
85017
|
credentials2,
|
84889
85018
|
tablesFilter,
|
84890
85019
|
schemasFilter,
|
84891
|
-
force
|
85020
|
+
force,
|
85021
|
+
casing2
|
84892
85022
|
);
|
84893
|
-
} else if (
|
85023
|
+
} else if (dialect4 === "sqlite") {
|
84894
85024
|
const { sqlitePush: sqlitePush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
|
84895
85025
|
await sqlitePush2(
|
84896
85026
|
schemaPath,
|
@@ -84898,9 +85028,10 @@ var push = command({
|
|
84898
85028
|
strict,
|
84899
85029
|
credentials2,
|
84900
85030
|
tablesFilter,
|
84901
|
-
force
|
85031
|
+
force,
|
85032
|
+
casing2
|
84902
85033
|
);
|
84903
|
-
} else if (
|
85034
|
+
} else if (dialect4 === "turso") {
|
84904
85035
|
const { libSQLPush: libSQLPush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
|
84905
85036
|
await libSQLPush2(
|
84906
85037
|
schemaPath,
|
@@ -84908,10 +85039,11 @@ var push = command({
|
|
84908
85039
|
strict,
|
84909
85040
|
credentials2,
|
84910
85041
|
tablesFilter,
|
84911
|
-
force
|
85042
|
+
force,
|
85043
|
+
casing2
|
84912
85044
|
);
|
84913
85045
|
} else {
|
84914
|
-
assertUnreachable(
|
85046
|
+
assertUnreachable(dialect4);
|
84915
85047
|
}
|
84916
85048
|
} catch (e2) {
|
84917
85049
|
console.error(e2);
|
@@ -84932,8 +85064,8 @@ var check = command({
|
|
84932
85064
|
},
|
84933
85065
|
handler: async (config) => {
|
84934
85066
|
await assertOrmCoreVersion();
|
84935
|
-
const { out, dialect:
|
84936
|
-
checkHandler(out,
|
85067
|
+
const { out, dialect: dialect4 } = config;
|
85068
|
+
checkHandler(out, dialect4);
|
84937
85069
|
console.log("Everything's fine \u{1F436}\u{1F525}");
|
84938
85070
|
}
|
84939
85071
|
});
|
@@ -84950,15 +85082,15 @@ var up = command({
|
|
84950
85082
|
},
|
84951
85083
|
handler: async (config) => {
|
84952
85084
|
await assertOrmCoreVersion();
|
84953
|
-
const { out, dialect:
|
85085
|
+
const { out, dialect: dialect4 } = config;
|
84954
85086
|
await assertPackages("drizzle-orm");
|
84955
|
-
if (
|
85087
|
+
if (dialect4 === "postgresql") {
|
84956
85088
|
upPgHandler(out);
|
84957
85089
|
}
|
84958
|
-
if (
|
85090
|
+
if (dialect4 === "mysql") {
|
84959
85091
|
upMysqlHandler(out);
|
84960
85092
|
}
|
84961
|
-
if (
|
85093
|
+
if (dialect4 === "sqlite" || dialect4 === "turso") {
|
84962
85094
|
upSqliteHandler(out);
|
84963
85095
|
}
|
84964
85096
|
}
|
@@ -85005,7 +85137,7 @@ var pull = command({
|
|
85005
85137
|
await assertPackages("drizzle-orm");
|
85006
85138
|
await assertOrmCoreVersion();
|
85007
85139
|
const {
|
85008
|
-
dialect:
|
85140
|
+
dialect: dialect4,
|
85009
85141
|
credentials: credentials2,
|
85010
85142
|
out,
|
85011
85143
|
casing: casing2,
|
@@ -85022,7 +85154,7 @@ var pull = command({
|
|
85022
85154
|
);
|
85023
85155
|
console.log();
|
85024
85156
|
try {
|
85025
|
-
if (
|
85157
|
+
if (dialect4 === "postgresql") {
|
85026
85158
|
if ("driver" in credentials2) {
|
85027
85159
|
const { driver: driver2 } = credentials2;
|
85028
85160
|
if (driver2 === "aws-data-api") {
|
@@ -85053,7 +85185,7 @@ var pull = command({
|
|
85053
85185
|
schemasFilter,
|
85054
85186
|
prefix2
|
85055
85187
|
);
|
85056
|
-
} else if (
|
85188
|
+
} else if (dialect4 === "mysql") {
|
85057
85189
|
const { introspectMysql: introspectMysql2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
|
85058
85190
|
await introspectMysql2(
|
85059
85191
|
casing2,
|
@@ -85063,7 +85195,7 @@ var pull = command({
|
|
85063
85195
|
tablesFilter,
|
85064
85196
|
prefix2
|
85065
85197
|
);
|
85066
|
-
} else if (
|
85198
|
+
} else if (dialect4 === "sqlite") {
|
85067
85199
|
const { introspectSqlite: introspectSqlite2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
|
85068
85200
|
await introspectSqlite2(
|
85069
85201
|
casing2,
|
@@ -85073,7 +85205,7 @@ var pull = command({
|
|
85073
85205
|
tablesFilter,
|
85074
85206
|
prefix2
|
85075
85207
|
);
|
85076
|
-
} else if (
|
85208
|
+
} else if (dialect4 === "turso") {
|
85077
85209
|
const { introspectLibSQL: introspectLibSQL2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
|
85078
85210
|
await introspectLibSQL2(
|
85079
85211
|
casing2,
|
@@ -85084,7 +85216,7 @@ var pull = command({
|
|
85084
85216
|
prefix2
|
85085
85217
|
);
|
85086
85218
|
} else {
|
85087
|
-
assertUnreachable(
|
85219
|
+
assertUnreachable(dialect4);
|
85088
85220
|
}
|
85089
85221
|
} catch (e2) {
|
85090
85222
|
console.error(e2);
|
@@ -85122,7 +85254,7 @@ var studio = command({
|
|
85122
85254
|
await assertPackages("drizzle-orm");
|
85123
85255
|
assertStudioNodeVersion();
|
85124
85256
|
const {
|
85125
|
-
dialect:
|
85257
|
+
dialect: dialect4,
|
85126
85258
|
schema: schemaPath,
|
85127
85259
|
port,
|
85128
85260
|
host,
|
@@ -85138,7 +85270,7 @@ var studio = command({
|
|
85138
85270
|
} = await Promise.resolve().then(() => (init_studio2(), studio_exports));
|
85139
85271
|
let setup;
|
85140
85272
|
try {
|
85141
|
-
if (
|
85273
|
+
if (dialect4 === "postgresql") {
|
85142
85274
|
if ("driver" in credentials2) {
|
85143
85275
|
const { driver: driver2 } = credentials2;
|
85144
85276
|
if (driver2 === "aws-data-api") {
|
@@ -85161,17 +85293,17 @@ var studio = command({
|
|
85161
85293
|
}
|
85162
85294
|
const { schema: schema5, relations: relations4, files } = schemaPath ? await preparePgSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
|
85163
85295
|
setup = await drizzleForPostgres2(credentials2, schema5, relations4, files);
|
85164
|
-
} else if (
|
85296
|
+
} else if (dialect4 === "mysql") {
|
85165
85297
|
const { schema: schema5, relations: relations4, files } = schemaPath ? await prepareMySqlSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
|
85166
85298
|
setup = await drizzleForMySQL2(credentials2, schema5, relations4, files);
|
85167
|
-
} else if (
|
85299
|
+
} else if (dialect4 === "sqlite") {
|
85168
85300
|
const { schema: schema5, relations: relations4, files } = schemaPath ? await prepareSQLiteSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
|
85169
85301
|
setup = await drizzleForSQLite2(credentials2, schema5, relations4, files);
|
85170
|
-
} else if (
|
85302
|
+
} else if (dialect4 === "turso") {
|
85171
85303
|
const { schema: schema5, relations: relations4, files } = schemaPath ? await prepareSQLiteSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
|
85172
85304
|
setup = await drizzleForLibSQL(credentials2, schema5, relations4, files);
|
85173
85305
|
} else {
|
85174
|
-
assertUnreachable(
|
85306
|
+
assertUnreachable(dialect4);
|
85175
85307
|
}
|
85176
85308
|
const { prepareServer: prepareServer2 } = await Promise.resolve().then(() => (init_studio2(), studio_exports));
|
85177
85309
|
const server = await prepareServer2(setup);
|
@@ -85222,7 +85354,7 @@ init_utils2();
|
|
85222
85354
|
var version2 = async () => {
|
85223
85355
|
const { npmVersion } = await ormCoreVersions();
|
85224
85356
|
const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
|
85225
|
-
const envVersion = "0.25.0-
|
85357
|
+
const envVersion = "0.25.0-588085a";
|
85226
85358
|
const kitVersion = envVersion ? `v${envVersion}` : "--";
|
85227
85359
|
const versions = `drizzle-kit: ${kitVersion}
|
85228
85360
|
${ormVersion}`;
|