drizzle-kit 0.25.0-1800fdd → 0.25.0-1f15bfd
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 +14943 -88057
- package/api.mjs +14943 -88054
- package/bin.cjs +695 -484
- 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) {
|
@@ -23029,7 +23105,7 @@ function fromJson(statements, dialect7, action, json2) {
|
|
23029
23105
|
}).filter((it) => it !== "");
|
23030
23106
|
return result;
|
23031
23107
|
}
|
23032
|
-
var pgNativeTypes, isPgNativeType, Convertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, PgAlterTableAlterColumnSetGenerated, PgAlterTableAlterColumnDropGenerated, PgAlterTableAlterColumnAlterGenerated, PgAlterTableAddUniqueConstraintConvertor, PgAlterTableDropUniqueConstraintConvertor, MySQLAlterTableAddUniqueConstraintConvertor, MySQLAlterTableDropUniqueConstraintConvertor, CreatePgSequenceConvertor, DropPgSequenceConvertor, RenamePgSequenceConvertor, MovePgSequenceConvertor, AlterPgSequenceConvertor, CreateTypeEnumConvertor, AlterTypeAddValueConvertor, PgDropTableConvertor, MySQLDropTableConvertor, SQLiteDropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, PgAlterTableAlterColumnDropGeneratedConvertor, PgAlterTableAlterColumnSetExpressionConvertor, PgAlterTableAlterColumnAlterrGeneratedConvertor, SqliteAlterTableAlterColumnDropGeneratedConvertor, SqliteAlterTableAlterColumnSetExpressionConvertor, SqliteAlterTableAlterColumnAlterGeneratedConvertor, MySqlAlterTableAlterColumnAlterrGeneratedConvertor, MySqlAlterTableAddPk, MySqlAlterTableDropPk, LibSQLModifyColumn, MySqlModifyColumn, PgAlterTableCreateCompositePrimaryKeyConvertor, PgAlterTableDeleteCompositePrimaryKeyConvertor, PgAlterTableAlterCompositePrimaryKeyConvertor, MySqlAlterTableCreateCompositePrimaryKeyConvertor, MySqlAlterTableDeleteCompositePrimaryKeyConvertor, MySqlAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetPrimaryKeyConvertor, PgAlterTableAlterColumnDropPrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, PgAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, LibSQLCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MySqlDropIndexConvertor, SQLiteRecreateTableConvertor, LibSQLRecreateTableConvertor, convertors;
|
23108
|
+
var pgNativeTypes, isPgNativeType, Convertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, PgAlterTableAlterColumnSetGenerated, PgAlterTableAlterColumnDropGenerated, PgAlterTableAlterColumnAlterGenerated, PgAlterTableAddUniqueConstraintConvertor, PgAlterTableDropUniqueConstraintConvertor, MySQLAlterTableAddUniqueConstraintConvertor, MySQLAlterTableDropUniqueConstraintConvertor, CreatePgSequenceConvertor, DropPgSequenceConvertor, RenamePgSequenceConvertor, MovePgSequenceConvertor, AlterPgSequenceConvertor, CreateTypeEnumConvertor, DropTypeEnumConvertor, AlterTypeAddValueConvertor, AlterTypeSetSchemaConvertor, AlterRenameTypeConvertor, AlterTypeDropValueConvertor, PgDropTableConvertor, MySQLDropTableConvertor, SQLiteDropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, PgAlterTableAlterColumnDropGeneratedConvertor, PgAlterTableAlterColumnSetExpressionConvertor, PgAlterTableAlterColumnAlterrGeneratedConvertor, SqliteAlterTableAlterColumnDropGeneratedConvertor, SqliteAlterTableAlterColumnSetExpressionConvertor, SqliteAlterTableAlterColumnAlterGeneratedConvertor, MySqlAlterTableAlterColumnAlterrGeneratedConvertor, MySqlAlterTableAddPk, MySqlAlterTableDropPk, LibSQLModifyColumn, MySqlModifyColumn, PgAlterTableCreateCompositePrimaryKeyConvertor, PgAlterTableDeleteCompositePrimaryKeyConvertor, PgAlterTableAlterCompositePrimaryKeyConvertor, MySqlAlterTableCreateCompositePrimaryKeyConvertor, MySqlAlterTableDeleteCompositePrimaryKeyConvertor, MySqlAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetPrimaryKeyConvertor, PgAlterTableAlterColumnDropPrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, PgAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, LibSQLCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MySqlDropIndexConvertor, SQLiteRecreateTableConvertor, LibSQLRecreateTableConvertor, convertors;
|
23033
23109
|
var init_sqlgenerator = __esm({
|
23034
23110
|
"src/sqlgenerator.ts"() {
|
23035
23111
|
"use strict";
|
@@ -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;
|
@@ -23413,20 +23489,22 @@ var init_sqlgenerator = __esm({
|
|
23413
23489
|
}
|
23414
23490
|
convert(st) {
|
23415
23491
|
const { name, values, schema: schema5 } = st;
|
23416
|
-
const
|
23492
|
+
const enumNameWithSchema = schema5 ? `"${schema5}"."${name}"` : `"${name}"`;
|
23417
23493
|
let valuesStatement = "(";
|
23418
23494
|
valuesStatement += values.map((it) => `'${it}'`).join(", ");
|
23419
23495
|
valuesStatement += ")";
|
23420
|
-
let statement =
|
23421
|
-
statement
|
23422
|
-
|
23423
|
-
|
23424
|
-
|
23425
|
-
|
23426
|
-
statement
|
23427
|
-
|
23428
|
-
|
23429
|
-
|
23496
|
+
let statement = `CREATE TYPE ${enumNameWithSchema} AS ENUM${valuesStatement};`;
|
23497
|
+
return statement;
|
23498
|
+
}
|
23499
|
+
};
|
23500
|
+
DropTypeEnumConvertor = class extends Convertor {
|
23501
|
+
can(statement) {
|
23502
|
+
return statement.type === "drop_type_enum";
|
23503
|
+
}
|
23504
|
+
convert(st) {
|
23505
|
+
const { name, schema: schema5 } = st;
|
23506
|
+
const enumNameWithSchema = schema5 ? `"${schema5}"."${name}"` : `"${name}"`;
|
23507
|
+
let statement = `DROP TYPE ${enumNameWithSchema} CASCADE;`;
|
23430
23508
|
return statement;
|
23431
23509
|
}
|
23432
23510
|
};
|
@@ -23435,14 +23513,61 @@ var init_sqlgenerator = __esm({
|
|
23435
23513
|
return statement.type === "alter_type_add_value";
|
23436
23514
|
}
|
23437
23515
|
convert(st) {
|
23438
|
-
const { name, schema: schema5, value } = st;
|
23439
|
-
const
|
23440
|
-
return `ALTER TYPE ${
|
23516
|
+
const { name, schema: schema5, value, before } = st;
|
23517
|
+
const enumNameWithSchema = schema5 ? `"${schema5}"."${name}"` : `"${name}"`;
|
23518
|
+
return `ALTER TYPE ${enumNameWithSchema} ADD VALUE '${value}'${before.length ? ` BEFORE '${before}'` : ""};`;
|
23519
|
+
}
|
23520
|
+
};
|
23521
|
+
AlterTypeSetSchemaConvertor = class extends Convertor {
|
23522
|
+
can(statement) {
|
23523
|
+
return statement.type === "move_type_enum";
|
23524
|
+
}
|
23525
|
+
convert(st) {
|
23526
|
+
const { name, schemaFrom, schemaTo } = st;
|
23527
|
+
const enumNameWithSchema = schemaFrom ? `"${schemaFrom}"."${name}"` : `"${name}"`;
|
23528
|
+
return `ALTER TYPE ${enumNameWithSchema} SET SCHEMA "${schemaTo}";`;
|
23529
|
+
}
|
23530
|
+
};
|
23531
|
+
AlterRenameTypeConvertor = class extends Convertor {
|
23532
|
+
can(statement) {
|
23533
|
+
return statement.type === "rename_type_enum";
|
23534
|
+
}
|
23535
|
+
convert(st) {
|
23536
|
+
const { nameTo, nameFrom, schema: schema5 } = st;
|
23537
|
+
const enumNameWithSchema = schema5 ? `"${schema5}"."${nameFrom}"` : `"${nameFrom}"`;
|
23538
|
+
return `ALTER TYPE ${enumNameWithSchema} RENAME TO "${nameTo}";`;
|
23539
|
+
}
|
23540
|
+
};
|
23541
|
+
AlterTypeDropValueConvertor = class extends Convertor {
|
23542
|
+
can(statement) {
|
23543
|
+
return statement.type === "alter_type_drop_value";
|
23544
|
+
}
|
23545
|
+
convert(st) {
|
23546
|
+
const { columnsWithEnum, name, newValues, schema: schema5 } = st;
|
23547
|
+
const statements = [];
|
23548
|
+
for (const withEnum of columnsWithEnum) {
|
23549
|
+
statements.push(
|
23550
|
+
`ALTER TABLE "${withEnum.schema}"."${withEnum.table}" ALTER COLUMN "${withEnum.column}" SET DATA TYPE text;`
|
23551
|
+
);
|
23552
|
+
}
|
23553
|
+
statements.push(new DropTypeEnumConvertor().convert({ name, schema: schema5, type: "drop_type_enum" }));
|
23554
|
+
statements.push(new CreateTypeEnumConvertor().convert({
|
23555
|
+
name,
|
23556
|
+
schema: schema5,
|
23557
|
+
values: newValues,
|
23558
|
+
type: "create_type_enum"
|
23559
|
+
}));
|
23560
|
+
for (const withEnum of columnsWithEnum) {
|
23561
|
+
statements.push(
|
23562
|
+
`ALTER TABLE "${withEnum.schema}"."${withEnum.table}" ALTER COLUMN "${withEnum.column}" SET DATA TYPE "${schema5}"."${name}" USING "${withEnum.column}"::"${schema5}"."${name}";`
|
23563
|
+
);
|
23564
|
+
}
|
23565
|
+
return statements;
|
23441
23566
|
}
|
23442
23567
|
};
|
23443
23568
|
PgDropTableConvertor = class extends Convertor {
|
23444
|
-
can(statement,
|
23445
|
-
return statement.type === "drop_table" &&
|
23569
|
+
can(statement, dialect4) {
|
23570
|
+
return statement.type === "drop_table" && dialect4 === "postgresql";
|
23446
23571
|
}
|
23447
23572
|
convert(statement) {
|
23448
23573
|
const { tableName, schema: schema5 } = statement;
|
@@ -23451,8 +23576,8 @@ var init_sqlgenerator = __esm({
|
|
23451
23576
|
}
|
23452
23577
|
};
|
23453
23578
|
MySQLDropTableConvertor = class extends Convertor {
|
23454
|
-
can(statement,
|
23455
|
-
return statement.type === "drop_table" &&
|
23579
|
+
can(statement, dialect4) {
|
23580
|
+
return statement.type === "drop_table" && dialect4 === "mysql";
|
23456
23581
|
}
|
23457
23582
|
convert(statement) {
|
23458
23583
|
const { tableName } = statement;
|
@@ -23460,8 +23585,8 @@ var init_sqlgenerator = __esm({
|
|
23460
23585
|
}
|
23461
23586
|
};
|
23462
23587
|
SQLiteDropTableConvertor = class extends Convertor {
|
23463
|
-
can(statement,
|
23464
|
-
return statement.type === "drop_table" && (
|
23588
|
+
can(statement, dialect4) {
|
23589
|
+
return statement.type === "drop_table" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23465
23590
|
}
|
23466
23591
|
convert(statement) {
|
23467
23592
|
const { tableName } = statement;
|
@@ -23469,8 +23594,8 @@ var init_sqlgenerator = __esm({
|
|
23469
23594
|
}
|
23470
23595
|
};
|
23471
23596
|
PgRenameTableConvertor = class extends Convertor {
|
23472
|
-
can(statement,
|
23473
|
-
return statement.type === "rename_table" &&
|
23597
|
+
can(statement, dialect4) {
|
23598
|
+
return statement.type === "rename_table" && dialect4 === "postgresql";
|
23474
23599
|
}
|
23475
23600
|
convert(statement) {
|
23476
23601
|
const { tableNameFrom, tableNameTo, toSchema, fromSchema } = statement;
|
@@ -23480,8 +23605,8 @@ var init_sqlgenerator = __esm({
|
|
23480
23605
|
}
|
23481
23606
|
};
|
23482
23607
|
SqliteRenameTableConvertor = class extends Convertor {
|
23483
|
-
can(statement,
|
23484
|
-
return statement.type === "rename_table" && (
|
23608
|
+
can(statement, dialect4) {
|
23609
|
+
return statement.type === "rename_table" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23485
23610
|
}
|
23486
23611
|
convert(statement) {
|
23487
23612
|
const { tableNameFrom, tableNameTo } = statement;
|
@@ -23489,8 +23614,8 @@ var init_sqlgenerator = __esm({
|
|
23489
23614
|
}
|
23490
23615
|
};
|
23491
23616
|
MySqlRenameTableConvertor = class extends Convertor {
|
23492
|
-
can(statement,
|
23493
|
-
return statement.type === "rename_table" &&
|
23617
|
+
can(statement, dialect4) {
|
23618
|
+
return statement.type === "rename_table" && dialect4 === "mysql";
|
23494
23619
|
}
|
23495
23620
|
convert(statement) {
|
23496
23621
|
const { tableNameFrom, tableNameTo } = statement;
|
@@ -23498,8 +23623,8 @@ var init_sqlgenerator = __esm({
|
|
23498
23623
|
}
|
23499
23624
|
};
|
23500
23625
|
PgAlterTableRenameColumnConvertor = class extends Convertor {
|
23501
|
-
can(statement,
|
23502
|
-
return statement.type === "alter_table_rename_column" &&
|
23626
|
+
can(statement, dialect4) {
|
23627
|
+
return statement.type === "alter_table_rename_column" && dialect4 === "postgresql";
|
23503
23628
|
}
|
23504
23629
|
convert(statement) {
|
23505
23630
|
const { tableName, oldColumnName, newColumnName, schema: schema5 } = statement;
|
@@ -23508,8 +23633,8 @@ var init_sqlgenerator = __esm({
|
|
23508
23633
|
}
|
23509
23634
|
};
|
23510
23635
|
MySqlAlterTableRenameColumnConvertor = class extends Convertor {
|
23511
|
-
can(statement,
|
23512
|
-
return statement.type === "alter_table_rename_column" &&
|
23636
|
+
can(statement, dialect4) {
|
23637
|
+
return statement.type === "alter_table_rename_column" && dialect4 === "mysql";
|
23513
23638
|
}
|
23514
23639
|
convert(statement) {
|
23515
23640
|
const { tableName, oldColumnName, newColumnName } = statement;
|
@@ -23517,8 +23642,8 @@ var init_sqlgenerator = __esm({
|
|
23517
23642
|
}
|
23518
23643
|
};
|
23519
23644
|
SQLiteAlterTableRenameColumnConvertor = class extends Convertor {
|
23520
|
-
can(statement,
|
23521
|
-
return statement.type === "alter_table_rename_column" && (
|
23645
|
+
can(statement, dialect4) {
|
23646
|
+
return statement.type === "alter_table_rename_column" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23522
23647
|
}
|
23523
23648
|
convert(statement) {
|
23524
23649
|
const { tableName, oldColumnName, newColumnName } = statement;
|
@@ -23526,8 +23651,8 @@ var init_sqlgenerator = __esm({
|
|
23526
23651
|
}
|
23527
23652
|
};
|
23528
23653
|
PgAlterTableDropColumnConvertor = class extends Convertor {
|
23529
|
-
can(statement,
|
23530
|
-
return statement.type === "alter_table_drop_column" &&
|
23654
|
+
can(statement, dialect4) {
|
23655
|
+
return statement.type === "alter_table_drop_column" && dialect4 === "postgresql";
|
23531
23656
|
}
|
23532
23657
|
convert(statement) {
|
23533
23658
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -23536,8 +23661,8 @@ var init_sqlgenerator = __esm({
|
|
23536
23661
|
}
|
23537
23662
|
};
|
23538
23663
|
MySqlAlterTableDropColumnConvertor = class extends Convertor {
|
23539
|
-
can(statement,
|
23540
|
-
return statement.type === "alter_table_drop_column" &&
|
23664
|
+
can(statement, dialect4) {
|
23665
|
+
return statement.type === "alter_table_drop_column" && dialect4 === "mysql";
|
23541
23666
|
}
|
23542
23667
|
convert(statement) {
|
23543
23668
|
const { tableName, columnName } = statement;
|
@@ -23545,8 +23670,8 @@ var init_sqlgenerator = __esm({
|
|
23545
23670
|
}
|
23546
23671
|
};
|
23547
23672
|
SQLiteAlterTableDropColumnConvertor = class extends Convertor {
|
23548
|
-
can(statement,
|
23549
|
-
return statement.type === "alter_table_drop_column" && (
|
23673
|
+
can(statement, dialect4) {
|
23674
|
+
return statement.type === "alter_table_drop_column" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23550
23675
|
}
|
23551
23676
|
convert(statement) {
|
23552
23677
|
const { tableName, columnName } = statement;
|
@@ -23554,8 +23679,8 @@ var init_sqlgenerator = __esm({
|
|
23554
23679
|
}
|
23555
23680
|
};
|
23556
23681
|
PgAlterTableAddColumnConvertor = class extends Convertor {
|
23557
|
-
can(statement,
|
23558
|
-
return statement.type === "alter_table_add_column" &&
|
23682
|
+
can(statement, dialect4) {
|
23683
|
+
return statement.type === "alter_table_add_column" && dialect4 === "postgresql";
|
23559
23684
|
}
|
23560
23685
|
convert(statement) {
|
23561
23686
|
const { tableName, column: column7, schema: schema5 } = statement;
|
@@ -23574,8 +23699,8 @@ var init_sqlgenerator = __esm({
|
|
23574
23699
|
}
|
23575
23700
|
};
|
23576
23701
|
MySqlAlterTableAddColumnConvertor = class extends Convertor {
|
23577
|
-
can(statement,
|
23578
|
-
return statement.type === "alter_table_add_column" &&
|
23702
|
+
can(statement, dialect4) {
|
23703
|
+
return statement.type === "alter_table_add_column" && dialect4 === "mysql";
|
23579
23704
|
}
|
23580
23705
|
convert(statement) {
|
23581
23706
|
const { tableName, column: column7 } = statement;
|
@@ -23598,8 +23723,8 @@ var init_sqlgenerator = __esm({
|
|
23598
23723
|
}
|
23599
23724
|
};
|
23600
23725
|
SQLiteAlterTableAddColumnConvertor = class extends Convertor {
|
23601
|
-
can(statement,
|
23602
|
-
return statement.type === "sqlite_alter_table_add_column" && (
|
23726
|
+
can(statement, dialect4) {
|
23727
|
+
return statement.type === "sqlite_alter_table_add_column" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23603
23728
|
}
|
23604
23729
|
convert(statement) {
|
23605
23730
|
const { tableName, column: column7, referenceData } = statement;
|
@@ -23614,8 +23739,8 @@ var init_sqlgenerator = __esm({
|
|
23614
23739
|
}
|
23615
23740
|
};
|
23616
23741
|
PgAlterTableAlterColumnSetTypeConvertor = class extends Convertor {
|
23617
|
-
can(statement,
|
23618
|
-
return statement.type === "alter_table_alter_column_set_type" &&
|
23742
|
+
can(statement, dialect4) {
|
23743
|
+
return statement.type === "alter_table_alter_column_set_type" && dialect4 === "postgresql";
|
23619
23744
|
}
|
23620
23745
|
convert(statement) {
|
23621
23746
|
const { tableName, columnName, newDataType, schema: schema5 } = statement;
|
@@ -23624,8 +23749,8 @@ var init_sqlgenerator = __esm({
|
|
23624
23749
|
}
|
23625
23750
|
};
|
23626
23751
|
PgAlterTableAlterColumnSetDefaultConvertor = class extends Convertor {
|
23627
|
-
can(statement,
|
23628
|
-
return statement.type === "alter_table_alter_column_set_default" &&
|
23752
|
+
can(statement, dialect4) {
|
23753
|
+
return statement.type === "alter_table_alter_column_set_default" && dialect4 === "postgresql";
|
23629
23754
|
}
|
23630
23755
|
convert(statement) {
|
23631
23756
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -23634,8 +23759,8 @@ var init_sqlgenerator = __esm({
|
|
23634
23759
|
}
|
23635
23760
|
};
|
23636
23761
|
PgAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
|
23637
|
-
can(statement,
|
23638
|
-
return statement.type === "alter_table_alter_column_drop_default" &&
|
23762
|
+
can(statement, dialect4) {
|
23763
|
+
return statement.type === "alter_table_alter_column_drop_default" && dialect4 === "postgresql";
|
23639
23764
|
}
|
23640
23765
|
convert(statement) {
|
23641
23766
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -23644,8 +23769,8 @@ var init_sqlgenerator = __esm({
|
|
23644
23769
|
}
|
23645
23770
|
};
|
23646
23771
|
PgAlterTableAlterColumnDropGeneratedConvertor = class extends Convertor {
|
23647
|
-
can(statement,
|
23648
|
-
return statement.type === "alter_table_alter_column_drop_generated" &&
|
23772
|
+
can(statement, dialect4) {
|
23773
|
+
return statement.type === "alter_table_alter_column_drop_generated" && dialect4 === "postgresql";
|
23649
23774
|
}
|
23650
23775
|
convert(statement) {
|
23651
23776
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -23654,8 +23779,8 @@ var init_sqlgenerator = __esm({
|
|
23654
23779
|
}
|
23655
23780
|
};
|
23656
23781
|
PgAlterTableAlterColumnSetExpressionConvertor = class extends Convertor {
|
23657
|
-
can(statement,
|
23658
|
-
return statement.type === "alter_table_alter_column_set_generated" &&
|
23782
|
+
can(statement, dialect4) {
|
23783
|
+
return statement.type === "alter_table_alter_column_set_generated" && dialect4 === "postgresql";
|
23659
23784
|
}
|
23660
23785
|
convert(statement) {
|
23661
23786
|
const {
|
@@ -23692,8 +23817,8 @@ var init_sqlgenerator = __esm({
|
|
23692
23817
|
}
|
23693
23818
|
};
|
23694
23819
|
PgAlterTableAlterColumnAlterrGeneratedConvertor = class extends Convertor {
|
23695
|
-
can(statement,
|
23696
|
-
return statement.type === "alter_table_alter_column_alter_generated" &&
|
23820
|
+
can(statement, dialect4) {
|
23821
|
+
return statement.type === "alter_table_alter_column_alter_generated" && dialect4 === "postgresql";
|
23697
23822
|
}
|
23698
23823
|
convert(statement) {
|
23699
23824
|
const {
|
@@ -23730,8 +23855,8 @@ var init_sqlgenerator = __esm({
|
|
23730
23855
|
}
|
23731
23856
|
};
|
23732
23857
|
SqliteAlterTableAlterColumnDropGeneratedConvertor = class extends Convertor {
|
23733
|
-
can(statement,
|
23734
|
-
return statement.type === "alter_table_alter_column_drop_generated" && (
|
23858
|
+
can(statement, dialect4) {
|
23859
|
+
return statement.type === "alter_table_alter_column_drop_generated" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23735
23860
|
}
|
23736
23861
|
convert(statement) {
|
23737
23862
|
const {
|
@@ -23771,8 +23896,8 @@ var init_sqlgenerator = __esm({
|
|
23771
23896
|
}
|
23772
23897
|
};
|
23773
23898
|
SqliteAlterTableAlterColumnSetExpressionConvertor = class extends Convertor {
|
23774
|
-
can(statement,
|
23775
|
-
return statement.type === "alter_table_alter_column_set_generated" && (
|
23899
|
+
can(statement, dialect4) {
|
23900
|
+
return statement.type === "alter_table_alter_column_set_generated" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23776
23901
|
}
|
23777
23902
|
convert(statement) {
|
23778
23903
|
const {
|
@@ -23812,8 +23937,8 @@ var init_sqlgenerator = __esm({
|
|
23812
23937
|
}
|
23813
23938
|
};
|
23814
23939
|
SqliteAlterTableAlterColumnAlterGeneratedConvertor = class extends Convertor {
|
23815
|
-
can(statement,
|
23816
|
-
return statement.type === "alter_table_alter_column_alter_generated" && (
|
23940
|
+
can(statement, dialect4) {
|
23941
|
+
return statement.type === "alter_table_alter_column_alter_generated" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23817
23942
|
}
|
23818
23943
|
convert(statement) {
|
23819
23944
|
const {
|
@@ -23853,8 +23978,8 @@ var init_sqlgenerator = __esm({
|
|
23853
23978
|
}
|
23854
23979
|
};
|
23855
23980
|
MySqlAlterTableAlterColumnAlterrGeneratedConvertor = class extends Convertor {
|
23856
|
-
can(statement,
|
23857
|
-
return statement.type === "alter_table_alter_column_alter_generated" &&
|
23981
|
+
can(statement, dialect4) {
|
23982
|
+
return statement.type === "alter_table_alter_column_alter_generated" && dialect4 === "mysql";
|
23858
23983
|
}
|
23859
23984
|
convert(statement) {
|
23860
23985
|
const {
|
@@ -23891,24 +24016,24 @@ var init_sqlgenerator = __esm({
|
|
23891
24016
|
}
|
23892
24017
|
};
|
23893
24018
|
MySqlAlterTableAddPk = class extends Convertor {
|
23894
|
-
can(statement,
|
23895
|
-
return statement.type === "alter_table_alter_column_set_pk" &&
|
24019
|
+
can(statement, dialect4) {
|
24020
|
+
return statement.type === "alter_table_alter_column_set_pk" && dialect4 === "mysql";
|
23896
24021
|
}
|
23897
24022
|
convert(statement) {
|
23898
24023
|
return `ALTER TABLE \`${statement.tableName}\` ADD PRIMARY KEY (\`${statement.columnName}\`);`;
|
23899
24024
|
}
|
23900
24025
|
};
|
23901
24026
|
MySqlAlterTableDropPk = class extends Convertor {
|
23902
|
-
can(statement,
|
23903
|
-
return statement.type === "alter_table_alter_column_drop_pk" &&
|
24027
|
+
can(statement, dialect4) {
|
24028
|
+
return statement.type === "alter_table_alter_column_drop_pk" && dialect4 === "mysql";
|
23904
24029
|
}
|
23905
24030
|
convert(statement) {
|
23906
24031
|
return `ALTER TABLE \`${statement.tableName}\` DROP PRIMARY KEY`;
|
23907
24032
|
}
|
23908
24033
|
};
|
23909
24034
|
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") &&
|
24035
|
+
can(statement, dialect4) {
|
24036
|
+
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
24037
|
}
|
23913
24038
|
convert(statement, json2) {
|
23914
24039
|
const { tableName, columnName } = statement;
|
@@ -23968,8 +24093,8 @@ var init_sqlgenerator = __esm({
|
|
23968
24093
|
}
|
23969
24094
|
};
|
23970
24095
|
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") &&
|
24096
|
+
can(statement, dialect4) {
|
24097
|
+
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
24098
|
}
|
23974
24099
|
convert(statement) {
|
23975
24100
|
var _a, _b, _c, _d, _e, _f, _g;
|
@@ -24106,8 +24231,8 @@ var init_sqlgenerator = __esm({
|
|
24106
24231
|
}
|
24107
24232
|
};
|
24108
24233
|
PgAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
|
24109
|
-
can(statement,
|
24110
|
-
return statement.type === "create_composite_pk" &&
|
24234
|
+
can(statement, dialect4) {
|
24235
|
+
return statement.type === "create_composite_pk" && dialect4 === "postgresql";
|
24111
24236
|
}
|
24112
24237
|
convert(statement) {
|
24113
24238
|
const { name, columns } = PgSquasher.unsquashPK(statement.data);
|
@@ -24116,8 +24241,8 @@ var init_sqlgenerator = __esm({
|
|
24116
24241
|
}
|
24117
24242
|
};
|
24118
24243
|
PgAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
|
24119
|
-
can(statement,
|
24120
|
-
return statement.type === "delete_composite_pk" &&
|
24244
|
+
can(statement, dialect4) {
|
24245
|
+
return statement.type === "delete_composite_pk" && dialect4 === "postgresql";
|
24121
24246
|
}
|
24122
24247
|
convert(statement) {
|
24123
24248
|
const { name, columns } = PgSquasher.unsquashPK(statement.data);
|
@@ -24126,8 +24251,8 @@ var init_sqlgenerator = __esm({
|
|
24126
24251
|
}
|
24127
24252
|
};
|
24128
24253
|
PgAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
|
24129
|
-
can(statement,
|
24130
|
-
return statement.type === "alter_composite_pk" &&
|
24254
|
+
can(statement, dialect4) {
|
24255
|
+
return statement.type === "alter_composite_pk" && dialect4 === "postgresql";
|
24131
24256
|
}
|
24132
24257
|
convert(statement) {
|
24133
24258
|
const { name, columns } = PgSquasher.unsquashPK(statement.old);
|
@@ -24140,8 +24265,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24140
24265
|
}
|
24141
24266
|
};
|
24142
24267
|
MySqlAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
|
24143
|
-
can(statement,
|
24144
|
-
return statement.type === "create_composite_pk" &&
|
24268
|
+
can(statement, dialect4) {
|
24269
|
+
return statement.type === "create_composite_pk" && dialect4 === "mysql";
|
24145
24270
|
}
|
24146
24271
|
convert(statement) {
|
24147
24272
|
const { name, columns } = MySqlSquasher.unsquashPK(statement.data);
|
@@ -24149,8 +24274,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24149
24274
|
}
|
24150
24275
|
};
|
24151
24276
|
MySqlAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
|
24152
|
-
can(statement,
|
24153
|
-
return statement.type === "delete_composite_pk" &&
|
24277
|
+
can(statement, dialect4) {
|
24278
|
+
return statement.type === "delete_composite_pk" && dialect4 === "mysql";
|
24154
24279
|
}
|
24155
24280
|
convert(statement) {
|
24156
24281
|
const { name, columns } = MySqlSquasher.unsquashPK(statement.data);
|
@@ -24158,8 +24283,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24158
24283
|
}
|
24159
24284
|
};
|
24160
24285
|
MySqlAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
|
24161
|
-
can(statement,
|
24162
|
-
return statement.type === "alter_composite_pk" &&
|
24286
|
+
can(statement, dialect4) {
|
24287
|
+
return statement.type === "alter_composite_pk" && dialect4 === "mysql";
|
24163
24288
|
}
|
24164
24289
|
convert(statement) {
|
24165
24290
|
const { name, columns } = MySqlSquasher.unsquashPK(statement.old);
|
@@ -24170,8 +24295,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24170
24295
|
}
|
24171
24296
|
};
|
24172
24297
|
PgAlterTableAlterColumnSetPrimaryKeyConvertor = class extends Convertor {
|
24173
|
-
can(statement,
|
24174
|
-
return statement.type === "alter_table_alter_column_set_pk" &&
|
24298
|
+
can(statement, dialect4) {
|
24299
|
+
return statement.type === "alter_table_alter_column_set_pk" && dialect4 === "postgresql";
|
24175
24300
|
}
|
24176
24301
|
convert(statement) {
|
24177
24302
|
const { tableName, columnName } = statement;
|
@@ -24180,8 +24305,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24180
24305
|
}
|
24181
24306
|
};
|
24182
24307
|
PgAlterTableAlterColumnDropPrimaryKeyConvertor = class extends Convertor {
|
24183
|
-
can(statement,
|
24184
|
-
return statement.type === "alter_table_alter_column_drop_pk" &&
|
24308
|
+
can(statement, dialect4) {
|
24309
|
+
return statement.type === "alter_table_alter_column_drop_pk" && dialect4 === "postgresql";
|
24185
24310
|
}
|
24186
24311
|
convert(statement) {
|
24187
24312
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -24204,8 +24329,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24204
24329
|
}
|
24205
24330
|
};
|
24206
24331
|
PgAlterTableAlterColumnSetNotNullConvertor = class extends Convertor {
|
24207
|
-
can(statement,
|
24208
|
-
return statement.type === "alter_table_alter_column_set_notnull" &&
|
24332
|
+
can(statement, dialect4) {
|
24333
|
+
return statement.type === "alter_table_alter_column_set_notnull" && dialect4 === "postgresql";
|
24209
24334
|
}
|
24210
24335
|
convert(statement) {
|
24211
24336
|
const { tableName, columnName } = statement;
|
@@ -24214,8 +24339,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24214
24339
|
}
|
24215
24340
|
};
|
24216
24341
|
PgAlterTableAlterColumnDropNotNullConvertor = class extends Convertor {
|
24217
|
-
can(statement,
|
24218
|
-
return statement.type === "alter_table_alter_column_drop_notnull" &&
|
24342
|
+
can(statement, dialect4) {
|
24343
|
+
return statement.type === "alter_table_alter_column_drop_notnull" && dialect4 === "postgresql";
|
24219
24344
|
}
|
24220
24345
|
convert(statement) {
|
24221
24346
|
const { tableName, columnName } = statement;
|
@@ -24224,8 +24349,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24224
24349
|
}
|
24225
24350
|
};
|
24226
24351
|
PgCreateForeignKeyConvertor = class extends Convertor {
|
24227
|
-
can(statement,
|
24228
|
-
return statement.type === "create_reference" &&
|
24352
|
+
can(statement, dialect4) {
|
24353
|
+
return statement.type === "create_reference" && dialect4 === "postgresql";
|
24229
24354
|
}
|
24230
24355
|
convert(statement) {
|
24231
24356
|
const {
|
@@ -24254,8 +24379,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24254
24379
|
}
|
24255
24380
|
};
|
24256
24381
|
LibSQLCreateForeignKeyConvertor = class extends Convertor {
|
24257
|
-
can(statement,
|
24258
|
-
return statement.type === "create_reference" &&
|
24382
|
+
can(statement, dialect4) {
|
24383
|
+
return statement.type === "create_reference" && dialect4 === "turso";
|
24259
24384
|
}
|
24260
24385
|
convert(statement, json2, action) {
|
24261
24386
|
const { columnsFrom, columnsTo, tableFrom, onDelete, onUpdate, tableTo } = action === "push" ? SQLiteSquasher.unsquashPushFK(statement.data) : SQLiteSquasher.unsquashFK(statement.data);
|
@@ -24271,8 +24396,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24271
24396
|
}
|
24272
24397
|
};
|
24273
24398
|
MySqlCreateForeignKeyConvertor = class extends Convertor {
|
24274
|
-
can(statement,
|
24275
|
-
return statement.type === "create_reference" &&
|
24399
|
+
can(statement, dialect4) {
|
24400
|
+
return statement.type === "create_reference" && dialect4 === "mysql";
|
24276
24401
|
}
|
24277
24402
|
convert(statement) {
|
24278
24403
|
const {
|
@@ -24292,8 +24417,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24292
24417
|
}
|
24293
24418
|
};
|
24294
24419
|
PgAlterForeignKeyConvertor = class extends Convertor {
|
24295
|
-
can(statement,
|
24296
|
-
return statement.type === "alter_reference" &&
|
24420
|
+
can(statement, dialect4) {
|
24421
|
+
return statement.type === "alter_reference" && dialect4 === "postgresql";
|
24297
24422
|
}
|
24298
24423
|
convert(statement) {
|
24299
24424
|
const newFk = PgSquasher.unsquashFK(statement.data);
|
@@ -24317,8 +24442,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24317
24442
|
}
|
24318
24443
|
};
|
24319
24444
|
PgDeleteForeignKeyConvertor = class extends Convertor {
|
24320
|
-
can(statement,
|
24321
|
-
return statement.type === "delete_reference" &&
|
24445
|
+
can(statement, dialect4) {
|
24446
|
+
return statement.type === "delete_reference" && dialect4 === "postgresql";
|
24322
24447
|
}
|
24323
24448
|
convert(statement) {
|
24324
24449
|
const tableFrom = statement.tableName;
|
@@ -24329,8 +24454,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24329
24454
|
}
|
24330
24455
|
};
|
24331
24456
|
MySqlDeleteForeignKeyConvertor = class extends Convertor {
|
24332
|
-
can(statement,
|
24333
|
-
return statement.type === "delete_reference" &&
|
24457
|
+
can(statement, dialect4) {
|
24458
|
+
return statement.type === "delete_reference" && dialect4 === "mysql";
|
24334
24459
|
}
|
24335
24460
|
convert(statement) {
|
24336
24461
|
const tableFrom = statement.tableName;
|
@@ -24340,8 +24465,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24340
24465
|
}
|
24341
24466
|
};
|
24342
24467
|
CreatePgIndexConvertor = class extends Convertor {
|
24343
|
-
can(statement,
|
24344
|
-
return statement.type === "create_index_pg" &&
|
24468
|
+
can(statement, dialect4) {
|
24469
|
+
return statement.type === "create_index_pg" && dialect4 === "postgresql";
|
24345
24470
|
}
|
24346
24471
|
convert(statement) {
|
24347
24472
|
const {
|
@@ -24372,8 +24497,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24372
24497
|
}
|
24373
24498
|
};
|
24374
24499
|
CreateMySqlIndexConvertor = class extends Convertor {
|
24375
|
-
can(statement,
|
24376
|
-
return statement.type === "create_index" &&
|
24500
|
+
can(statement, dialect4) {
|
24501
|
+
return statement.type === "create_index" && dialect4 === "mysql";
|
24377
24502
|
}
|
24378
24503
|
convert(statement) {
|
24379
24504
|
const { name, columns, isUnique } = MySqlSquasher.unsquashIdx(
|
@@ -24388,8 +24513,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24388
24513
|
}
|
24389
24514
|
};
|
24390
24515
|
CreateSqliteIndexConvertor = class extends Convertor {
|
24391
|
-
can(statement,
|
24392
|
-
return statement.type === "create_index" && (
|
24516
|
+
can(statement, dialect4) {
|
24517
|
+
return statement.type === "create_index" && (dialect4 === "sqlite" || dialect4 === "turso");
|
24393
24518
|
}
|
24394
24519
|
convert(statement) {
|
24395
24520
|
const { name, columns, isUnique, where } = SQLiteSquasher.unsquashIdx(
|
@@ -24405,8 +24530,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24405
24530
|
}
|
24406
24531
|
};
|
24407
24532
|
PgDropIndexConvertor = class extends Convertor {
|
24408
|
-
can(statement,
|
24409
|
-
return statement.type === "drop_index" &&
|
24533
|
+
can(statement, dialect4) {
|
24534
|
+
return statement.type === "drop_index" && dialect4 === "postgresql";
|
24410
24535
|
}
|
24411
24536
|
convert(statement) {
|
24412
24537
|
const { name } = PgSquasher.unsquashIdx(statement.data);
|
@@ -24414,8 +24539,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24414
24539
|
}
|
24415
24540
|
};
|
24416
24541
|
PgCreateSchemaConvertor = class extends Convertor {
|
24417
|
-
can(statement,
|
24418
|
-
return statement.type === "create_schema" &&
|
24542
|
+
can(statement, dialect4) {
|
24543
|
+
return statement.type === "create_schema" && dialect4 === "postgresql";
|
24419
24544
|
}
|
24420
24545
|
convert(statement) {
|
24421
24546
|
const { name } = statement;
|
@@ -24424,8 +24549,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24424
24549
|
}
|
24425
24550
|
};
|
24426
24551
|
PgRenameSchemaConvertor = class extends Convertor {
|
24427
|
-
can(statement,
|
24428
|
-
return statement.type === "rename_schema" &&
|
24552
|
+
can(statement, dialect4) {
|
24553
|
+
return statement.type === "rename_schema" && dialect4 === "postgresql";
|
24429
24554
|
}
|
24430
24555
|
convert(statement) {
|
24431
24556
|
const { from, to } = statement;
|
@@ -24434,8 +24559,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24434
24559
|
}
|
24435
24560
|
};
|
24436
24561
|
PgDropSchemaConvertor = class extends Convertor {
|
24437
|
-
can(statement,
|
24438
|
-
return statement.type === "drop_schema" &&
|
24562
|
+
can(statement, dialect4) {
|
24563
|
+
return statement.type === "drop_schema" && dialect4 === "postgresql";
|
24439
24564
|
}
|
24440
24565
|
convert(statement) {
|
24441
24566
|
const { name } = statement;
|
@@ -24444,8 +24569,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24444
24569
|
}
|
24445
24570
|
};
|
24446
24571
|
PgAlterTableSetSchemaConvertor = class extends Convertor {
|
24447
|
-
can(statement,
|
24448
|
-
return statement.type === "alter_table_set_schema" &&
|
24572
|
+
can(statement, dialect4) {
|
24573
|
+
return statement.type === "alter_table_set_schema" && dialect4 === "postgresql";
|
24449
24574
|
}
|
24450
24575
|
convert(statement) {
|
24451
24576
|
const { tableName, schemaFrom, schemaTo } = statement;
|
@@ -24454,8 +24579,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24454
24579
|
}
|
24455
24580
|
};
|
24456
24581
|
PgAlterTableSetNewSchemaConvertor = class extends Convertor {
|
24457
|
-
can(statement,
|
24458
|
-
return statement.type === "alter_table_set_new_schema" &&
|
24582
|
+
can(statement, dialect4) {
|
24583
|
+
return statement.type === "alter_table_set_new_schema" && dialect4 === "postgresql";
|
24459
24584
|
}
|
24460
24585
|
convert(statement) {
|
24461
24586
|
const { tableName, to, from } = statement;
|
@@ -24465,8 +24590,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24465
24590
|
}
|
24466
24591
|
};
|
24467
24592
|
PgAlterTableRemoveFromSchemaConvertor = class extends Convertor {
|
24468
|
-
can(statement,
|
24469
|
-
return statement.type === "alter_table_remove_from_schema" &&
|
24593
|
+
can(statement, dialect4) {
|
24594
|
+
return statement.type === "alter_table_remove_from_schema" && dialect4 === "postgresql";
|
24470
24595
|
}
|
24471
24596
|
convert(statement) {
|
24472
24597
|
const { tableName, schema: schema5 } = statement;
|
@@ -24476,8 +24601,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24476
24601
|
}
|
24477
24602
|
};
|
24478
24603
|
SqliteDropIndexConvertor = class extends Convertor {
|
24479
|
-
can(statement,
|
24480
|
-
return statement.type === "drop_index" && (
|
24604
|
+
can(statement, dialect4) {
|
24605
|
+
return statement.type === "drop_index" && (dialect4 === "sqlite" || dialect4 === "turso");
|
24481
24606
|
}
|
24482
24607
|
convert(statement) {
|
24483
24608
|
const { name } = PgSquasher.unsquashIdx(statement.data);
|
@@ -24485,8 +24610,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24485
24610
|
}
|
24486
24611
|
};
|
24487
24612
|
MySqlDropIndexConvertor = class extends Convertor {
|
24488
|
-
can(statement,
|
24489
|
-
return statement.type === "drop_index" &&
|
24613
|
+
can(statement, dialect4) {
|
24614
|
+
return statement.type === "drop_index" && dialect4 === "mysql";
|
24490
24615
|
}
|
24491
24616
|
convert(statement) {
|
24492
24617
|
const { name } = MySqlSquasher.unsquashIdx(statement.data);
|
@@ -24494,8 +24619,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24494
24619
|
}
|
24495
24620
|
};
|
24496
24621
|
SQLiteRecreateTableConvertor = class extends Convertor {
|
24497
|
-
can(statement,
|
24498
|
-
return statement.type === "recreate_table" &&
|
24622
|
+
can(statement, dialect4) {
|
24623
|
+
return statement.type === "recreate_table" && dialect4 === "sqlite";
|
24499
24624
|
}
|
24500
24625
|
convert(statement) {
|
24501
24626
|
const { tableName, columns, compositePKs, referenceData } = statement;
|
@@ -24536,8 +24661,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24536
24661
|
}
|
24537
24662
|
};
|
24538
24663
|
LibSQLRecreateTableConvertor = class extends Convertor {
|
24539
|
-
can(statement,
|
24540
|
-
return statement.type === "recreate_table" &&
|
24664
|
+
can(statement, dialect4) {
|
24665
|
+
return statement.type === "recreate_table" && dialect4 === "turso";
|
24541
24666
|
}
|
24542
24667
|
convert(statement) {
|
24543
24668
|
const { tableName, columns, compositePKs, referenceData } = statement;
|
@@ -24584,6 +24709,11 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24584
24709
|
convertors.push(new SQLiteRecreateTableConvertor());
|
24585
24710
|
convertors.push(new LibSQLRecreateTableConvertor());
|
24586
24711
|
convertors.push(new CreateTypeEnumConvertor());
|
24712
|
+
convertors.push(new DropTypeEnumConvertor());
|
24713
|
+
convertors.push(new AlterTypeAddValueConvertor());
|
24714
|
+
convertors.push(new AlterTypeSetSchemaConvertor());
|
24715
|
+
convertors.push(new AlterRenameTypeConvertor());
|
24716
|
+
convertors.push(new AlterTypeDropValueConvertor());
|
24587
24717
|
convertors.push(new CreatePgSequenceConvertor());
|
24588
24718
|
convertors.push(new DropPgSequenceConvertor());
|
24589
24719
|
convertors.push(new RenamePgSequenceConvertor());
|
@@ -24615,7 +24745,6 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24615
24745
|
convertors.push(new PgDropIndexConvertor());
|
24616
24746
|
convertors.push(new SqliteDropIndexConvertor());
|
24617
24747
|
convertors.push(new MySqlDropIndexConvertor());
|
24618
|
-
convertors.push(new AlterTypeAddValueConvertor());
|
24619
24748
|
convertors.push(new PgAlterTableAlterColumnSetPrimaryKeyConvertor());
|
24620
24749
|
convertors.push(new PgAlterTableAlterColumnDropPrimaryKeyConvertor());
|
24621
24750
|
convertors.push(new PgAlterTableAlterColumnSetNotNullConvertor());
|
@@ -24917,7 +25046,7 @@ var init_sqlitePushUtils = __esm({
|
|
24917
25046
|
});
|
24918
25047
|
|
24919
25048
|
// src/jsonStatements.ts
|
24920
|
-
var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareLibSQLCreateReferencesJson, prepareDropReferencesJson, prepareLibSQLDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql;
|
25049
|
+
var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumValues, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareLibSQLCreateReferencesJson, prepareDropReferencesJson, prepareLibSQLDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql;
|
24921
25050
|
var init_jsonStatements = __esm({
|
24922
25051
|
"src/jsonStatements.ts"() {
|
24923
25052
|
"use strict";
|
@@ -25007,6 +25136,28 @@ var init_jsonStatements = __esm({
|
|
25007
25136
|
};
|
25008
25137
|
});
|
25009
25138
|
};
|
25139
|
+
prepareDropEnumValues = (name, schema5, removedValues, json2) => {
|
25140
|
+
if (!removedValues.length)
|
25141
|
+
return [];
|
25142
|
+
const affectedColumns = [];
|
25143
|
+
for (const tableKey2 in json2.tables) {
|
25144
|
+
const table4 = json2.tables[tableKey2];
|
25145
|
+
for (const columnKey in table4.columns) {
|
25146
|
+
const column7 = table4.columns[columnKey];
|
25147
|
+
if (column7.type === name && column7.typeSchema === schema5) {
|
25148
|
+
affectedColumns.push({ schema: table4.schema || "public", table: table4.name, column: column7.name });
|
25149
|
+
}
|
25150
|
+
}
|
25151
|
+
}
|
25152
|
+
return [{
|
25153
|
+
type: "alter_type_drop_value",
|
25154
|
+
name,
|
25155
|
+
schema: schema5,
|
25156
|
+
deletedValues: removedValues,
|
25157
|
+
newValues: json2.enums[`${schema5}.${name}`].values,
|
25158
|
+
columnsWithEnum: affectedColumns
|
25159
|
+
}];
|
25160
|
+
};
|
25010
25161
|
prepareDropEnumJson = (name, schema5) => {
|
25011
25162
|
return {
|
25012
25163
|
type: "drop_type_enum",
|
@@ -27200,6 +27351,9 @@ var init_snapshotsDiffer = __esm({
|
|
27200
27351
|
const jsonAlterEnumsWithAddedValues = typedResult.alteredEnums.map((it) => {
|
27201
27352
|
return prepareAddValuesToEnumJson(it.name, it.schema, it.addedValues);
|
27202
27353
|
}).flat() ?? [];
|
27354
|
+
const jsonAlterEnumsWithDroppedValues = typedResult.alteredEnums.map((it) => {
|
27355
|
+
return prepareDropEnumValues(it.name, it.schema, it.deletedValues, curFull);
|
27356
|
+
}).flat() ?? [];
|
27203
27357
|
const createSequences = createdSequences.map((it) => {
|
27204
27358
|
return prepareCreateSequenceJson(it);
|
27205
27359
|
}) ?? [];
|
@@ -27257,6 +27411,7 @@ var init_snapshotsDiffer = __esm({
|
|
27257
27411
|
jsonStatements.push(...jsonAlteredCompositePKs);
|
27258
27412
|
jsonStatements.push(...jsonAddedUniqueConstraints);
|
27259
27413
|
jsonStatements.push(...jsonAlteredUniqueConstraints);
|
27414
|
+
jsonStatements.push(...jsonAlterEnumsWithDroppedValues);
|
27260
27415
|
jsonStatements.push(...dropEnums);
|
27261
27416
|
jsonStatements.push(...dropSequences);
|
27262
27417
|
jsonStatements.push(...dropSchemas);
|
@@ -29637,6 +29792,7 @@ var init_migrate = __esm({
|
|
29637
29792
|
prepareAndMigratePg = async (config) => {
|
29638
29793
|
const outFolder = config.out;
|
29639
29794
|
const schemaPath = config.schema;
|
29795
|
+
const casing2 = config.casing;
|
29640
29796
|
try {
|
29641
29797
|
assertV1OutFolder(outFolder);
|
29642
29798
|
const { snapshots, journal } = prepareMigrationFolder(
|
@@ -29645,7 +29801,8 @@ var init_migrate = __esm({
|
|
29645
29801
|
);
|
29646
29802
|
const { prev, cur, custom: custom2 } = await preparePgMigrationSnapshot(
|
29647
29803
|
snapshots,
|
29648
|
-
schemaPath
|
29804
|
+
schemaPath,
|
29805
|
+
casing2
|
29649
29806
|
);
|
29650
29807
|
const validatedPrev = pgSchema.parse(prev);
|
29651
29808
|
const validatedCur = pgSchema.parse(cur);
|
@@ -29688,10 +29845,11 @@ var init_migrate = __esm({
|
|
29688
29845
|
console.error(e2);
|
29689
29846
|
}
|
29690
29847
|
};
|
29691
|
-
preparePgPush = async (schemaPath, snapshot, schemaFilter) => {
|
29848
|
+
preparePgPush = async (schemaPath, snapshot, schemaFilter, casing2) => {
|
29692
29849
|
const { prev, cur } = await preparePgDbPushSnapshot(
|
29693
29850
|
snapshot,
|
29694
29851
|
schemaPath,
|
29852
|
+
casing2,
|
29695
29853
|
schemaFilter
|
29696
29854
|
);
|
29697
29855
|
const validatedPrev = pgSchema.parse(prev);
|
@@ -29712,11 +29870,12 @@ var init_migrate = __esm({
|
|
29712
29870
|
);
|
29713
29871
|
return { sqlStatements, statements, squashedPrev, squashedCur };
|
29714
29872
|
};
|
29715
|
-
prepareMySQLPush = async (schemaPath, snapshot) => {
|
29873
|
+
prepareMySQLPush = async (schemaPath, snapshot, casing2) => {
|
29716
29874
|
try {
|
29717
29875
|
const { prev, cur } = await prepareMySqlDbPushSnapshot(
|
29718
29876
|
snapshot,
|
29719
|
-
schemaPath
|
29877
|
+
schemaPath,
|
29878
|
+
casing2
|
29720
29879
|
);
|
29721
29880
|
const validatedPrev = mysqlSchema.parse(prev);
|
29722
29881
|
const validatedCur = mysqlSchema.parse(cur);
|
@@ -29740,12 +29899,14 @@ var init_migrate = __esm({
|
|
29740
29899
|
prepareAndMigrateMysql = async (config) => {
|
29741
29900
|
const outFolder = config.out;
|
29742
29901
|
const schemaPath = config.schema;
|
29902
|
+
const casing2 = config.casing;
|
29743
29903
|
try {
|
29744
29904
|
assertV1OutFolder(outFolder);
|
29745
29905
|
const { snapshots, journal } = prepareMigrationFolder(outFolder, "mysql");
|
29746
29906
|
const { prev, cur, custom: custom2 } = await prepareMySqlMigrationSnapshot(
|
29747
29907
|
snapshots,
|
29748
|
-
schemaPath
|
29908
|
+
schemaPath,
|
29909
|
+
casing2
|
29749
29910
|
);
|
29750
29911
|
const validatedPrev = mysqlSchema.parse(prev);
|
29751
29912
|
const validatedCur = mysqlSchema.parse(cur);
|
@@ -29789,12 +29950,14 @@ var init_migrate = __esm({
|
|
29789
29950
|
prepareAndMigrateSqlite = async (config) => {
|
29790
29951
|
const outFolder = config.out;
|
29791
29952
|
const schemaPath = config.schema;
|
29953
|
+
const casing2 = config.casing;
|
29792
29954
|
try {
|
29793
29955
|
assertV1OutFolder(outFolder);
|
29794
29956
|
const { snapshots, journal } = prepareMigrationFolder(outFolder, "sqlite");
|
29795
29957
|
const { prev, cur, custom: custom2 } = await prepareSqliteMigrationSnapshot(
|
29796
29958
|
snapshots,
|
29797
|
-
schemaPath
|
29959
|
+
schemaPath,
|
29960
|
+
casing2
|
29798
29961
|
);
|
29799
29962
|
const validatedPrev = sqliteSchema.parse(prev);
|
29800
29963
|
const validatedCur = sqliteSchema.parse(cur);
|
@@ -29840,12 +30003,14 @@ var init_migrate = __esm({
|
|
29840
30003
|
prepareAndMigrateLibSQL = async (config) => {
|
29841
30004
|
const outFolder = config.out;
|
29842
30005
|
const schemaPath = config.schema;
|
30006
|
+
const casing2 = config.casing;
|
29843
30007
|
try {
|
29844
30008
|
assertV1OutFolder(outFolder);
|
29845
30009
|
const { snapshots, journal } = prepareMigrationFolder(outFolder, "sqlite");
|
29846
30010
|
const { prev, cur, custom: custom2 } = await prepareSqliteMigrationSnapshot(
|
29847
30011
|
snapshots,
|
29848
|
-
schemaPath
|
30012
|
+
schemaPath,
|
30013
|
+
casing2
|
29849
30014
|
);
|
29850
30015
|
const validatedPrev = sqliteSchema.parse(prev);
|
29851
30016
|
const validatedCur = sqliteSchema.parse(cur);
|
@@ -29888,8 +30053,8 @@ var init_migrate = __esm({
|
|
29888
30053
|
console.error(e2);
|
29889
30054
|
}
|
29890
30055
|
};
|
29891
|
-
prepareSQLitePush = async (schemaPath, snapshot) => {
|
29892
|
-
const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath);
|
30056
|
+
prepareSQLitePush = async (schemaPath, snapshot, casing2) => {
|
30057
|
+
const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath, casing2);
|
29893
30058
|
const validatedPrev = sqliteSchema.parse(prev);
|
29894
30059
|
const validatedCur = sqliteSchema.parse(cur);
|
29895
30060
|
const squashedPrev = squashSqliteScheme(validatedPrev, "push");
|
@@ -29911,8 +30076,8 @@ var init_migrate = __esm({
|
|
29911
30076
|
meta: _meta
|
29912
30077
|
};
|
29913
30078
|
};
|
29914
|
-
prepareLibSQLPush = async (schemaPath, snapshot) => {
|
29915
|
-
const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath);
|
30079
|
+
prepareLibSQLPush = async (schemaPath, snapshot, casing2) => {
|
30080
|
+
const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath, casing2);
|
29916
30081
|
const validatedPrev = sqliteSchema.parse(prev);
|
29917
30082
|
const validatedCur = sqliteSchema.parse(cur);
|
29918
30083
|
const squashedPrev = squashSqliteScheme(validatedPrev, "push");
|
@@ -56234,9 +56399,9 @@ var require_dist_cjs46 = __commonJS({
|
|
56234
56399
|
}
|
56235
56400
|
});
|
56236
56401
|
|
56237
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/auth/httpAuthSchemeProvider.js
|
56402
|
+
// ../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
56403
|
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) {
|
56404
|
+
"../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
56405
|
"use strict";
|
56241
56406
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
56242
56407
|
exports2.resolveHttpAuthSchemeConfig = exports2.defaultSSOOIDCHttpAuthSchemeProvider = exports2.defaultSSOOIDCHttpAuthSchemeParametersProvider = void 0;
|
@@ -56303,9 +56468,9 @@ var require_httpAuthSchemeProvider3 = __commonJS({
|
|
56303
56468
|
}
|
56304
56469
|
});
|
56305
56470
|
|
56306
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/package.json
|
56471
|
+
// ../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
56472
|
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) {
|
56473
|
+
"../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
56474
|
module2.exports = {
|
56310
56475
|
name: "@aws-sdk/client-sso-oidc",
|
56311
56476
|
description: "AWS SDK for JavaScript Sso Oidc Client for Node.js, Browser and React Native",
|
@@ -56409,9 +56574,9 @@ var require_package4 = __commonJS({
|
|
56409
56574
|
}
|
56410
56575
|
});
|
56411
56576
|
|
56412
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/ruleset.js
|
56577
|
+
// ../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
56578
|
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) {
|
56579
|
+
"../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
56580
|
"use strict";
|
56416
56581
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
56417
56582
|
exports2.ruleSet = void 0;
|
@@ -56444,9 +56609,9 @@ var require_ruleset2 = __commonJS({
|
|
56444
56609
|
}
|
56445
56610
|
});
|
56446
56611
|
|
56447
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/endpointResolver.js
|
56612
|
+
// ../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
56613
|
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) {
|
56614
|
+
"../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
56615
|
"use strict";
|
56451
56616
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
56452
56617
|
exports2.defaultEndpointResolver = void 0;
|
@@ -56464,9 +56629,9 @@ var require_endpointResolver2 = __commonJS({
|
|
56464
56629
|
}
|
56465
56630
|
});
|
56466
56631
|
|
56467
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.shared.js
|
56632
|
+
// ../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
56633
|
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) {
|
56634
|
+
"../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
56635
|
"use strict";
|
56471
56636
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
56472
56637
|
exports2.getRuntimeConfig = void 0;
|
@@ -56510,9 +56675,9 @@ var require_runtimeConfig_shared2 = __commonJS({
|
|
56510
56675
|
}
|
56511
56676
|
});
|
56512
56677
|
|
56513
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.js
|
56678
|
+
// ../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
56679
|
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) {
|
56680
|
+
"../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
56681
|
"use strict";
|
56517
56682
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
56518
56683
|
exports2.getRuntimeConfig = void 0;
|
@@ -56563,9 +56728,9 @@ var require_runtimeConfig2 = __commonJS({
|
|
56563
56728
|
}
|
56564
56729
|
});
|
56565
56730
|
|
56566
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js
|
56731
|
+
// ../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
56732
|
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) {
|
56733
|
+
"../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
56734
|
"use strict";
|
56570
56735
|
var __defProp3 = Object.defineProperty;
|
56571
56736
|
var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
|
@@ -57911,9 +58076,9 @@ Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.ht
|
|
57911
58076
|
}
|
57912
58077
|
});
|
57913
58078
|
|
57914
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58079
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthSchemeProvider.js
|
57915
58080
|
var require_httpAuthSchemeProvider4 = __commonJS({
|
57916
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58081
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthSchemeProvider.js"(exports2) {
|
57917
58082
|
"use strict";
|
57918
58083
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
57919
58084
|
exports2.resolveHttpAuthSchemeConfig = exports2.resolveStsAuthConfig = exports2.defaultSTSHttpAuthSchemeProvider = exports2.defaultSTSHttpAuthSchemeParametersProvider = void 0;
|
@@ -57983,9 +58148,9 @@ var require_httpAuthSchemeProvider4 = __commonJS({
|
|
57983
58148
|
}
|
57984
58149
|
});
|
57985
58150
|
|
57986
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58151
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/EndpointParameters.js
|
57987
58152
|
var require_EndpointParameters = __commonJS({
|
57988
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58153
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/EndpointParameters.js"(exports2) {
|
57989
58154
|
"use strict";
|
57990
58155
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
57991
58156
|
exports2.commonParams = exports2.resolveClientEndpointParameters = void 0;
|
@@ -58009,9 +58174,9 @@ var require_EndpointParameters = __commonJS({
|
|
58009
58174
|
}
|
58010
58175
|
});
|
58011
58176
|
|
58012
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58177
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/package.json
|
58013
58178
|
var require_package5 = __commonJS({
|
58014
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58179
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/package.json"(exports2, module2) {
|
58015
58180
|
module2.exports = {
|
58016
58181
|
name: "@aws-sdk/client-sts",
|
58017
58182
|
description: "AWS SDK for JavaScript Sts Client for Node.js, Browser and React Native",
|
@@ -58117,9 +58282,9 @@ var require_package5 = __commonJS({
|
|
58117
58282
|
}
|
58118
58283
|
});
|
58119
58284
|
|
58120
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58285
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/ruleset.js
|
58121
58286
|
var require_ruleset3 = __commonJS({
|
58122
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58287
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/ruleset.js"(exports2) {
|
58123
58288
|
"use strict";
|
58124
58289
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58125
58290
|
exports2.ruleSet = void 0;
|
@@ -58164,9 +58329,9 @@ var require_ruleset3 = __commonJS({
|
|
58164
58329
|
}
|
58165
58330
|
});
|
58166
58331
|
|
58167
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58332
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js
|
58168
58333
|
var require_endpointResolver3 = __commonJS({
|
58169
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58334
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js"(exports2) {
|
58170
58335
|
"use strict";
|
58171
58336
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58172
58337
|
exports2.defaultEndpointResolver = void 0;
|
@@ -58184,9 +58349,9 @@ var require_endpointResolver3 = __commonJS({
|
|
58184
58349
|
}
|
58185
58350
|
});
|
58186
58351
|
|
58187
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58352
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.shared.js
|
58188
58353
|
var require_runtimeConfig_shared3 = __commonJS({
|
58189
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58354
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.shared.js"(exports2) {
|
58190
58355
|
"use strict";
|
58191
58356
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58192
58357
|
exports2.getRuntimeConfig = void 0;
|
@@ -58230,9 +58395,9 @@ var require_runtimeConfig_shared3 = __commonJS({
|
|
58230
58395
|
}
|
58231
58396
|
});
|
58232
58397
|
|
58233
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58398
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js
|
58234
58399
|
var require_runtimeConfig3 = __commonJS({
|
58235
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58400
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js"(exports2) {
|
58236
58401
|
"use strict";
|
58237
58402
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58238
58403
|
exports2.getRuntimeConfig = void 0;
|
@@ -58296,9 +58461,9 @@ var require_runtimeConfig3 = __commonJS({
|
|
58296
58461
|
}
|
58297
58462
|
});
|
58298
58463
|
|
58299
|
-
// ../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/auth/httpAuthExtensionConfiguration.js
|
58300
58465
|
var require_httpAuthExtensionConfiguration = __commonJS({
|
58301
|
-
"../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/auth/httpAuthExtensionConfiguration.js"(exports2) {
|
58302
58467
|
"use strict";
|
58303
58468
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58304
58469
|
exports2.resolveHttpAuthRuntimeConfig = exports2.getHttpAuthExtensionConfiguration = void 0;
|
@@ -58344,9 +58509,9 @@ var require_httpAuthExtensionConfiguration = __commonJS({
|
|
58344
58509
|
}
|
58345
58510
|
});
|
58346
58511
|
|
58347
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58512
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeExtensions.js
|
58348
58513
|
var require_runtimeExtensions = __commonJS({
|
58349
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58514
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeExtensions.js"(exports2) {
|
58350
58515
|
"use strict";
|
58351
58516
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58352
58517
|
exports2.resolveRuntimeExtensions = void 0;
|
@@ -58375,9 +58540,9 @@ var require_runtimeExtensions = __commonJS({
|
|
58375
58540
|
}
|
58376
58541
|
});
|
58377
58542
|
|
58378
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58543
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js
|
58379
58544
|
var require_STSClient = __commonJS({
|
58380
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58545
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js"(exports2) {
|
58381
58546
|
"use strict";
|
58382
58547
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58383
58548
|
exports2.STSClient = exports2.__Client = void 0;
|
@@ -58439,9 +58604,9 @@ var require_STSClient = __commonJS({
|
|
58439
58604
|
}
|
58440
58605
|
});
|
58441
58606
|
|
58442
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58607
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/index.js
|
58443
58608
|
var require_dist_cjs50 = __commonJS({
|
58444
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58609
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/index.js"(exports2, module2) {
|
58445
58610
|
"use strict";
|
58446
58611
|
var __defProp3 = Object.defineProperty;
|
58447
58612
|
var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
|
@@ -62599,7 +62764,7 @@ var init_studio2 = __esm({
|
|
62599
62764
|
});
|
62600
62765
|
};
|
62601
62766
|
prepareServer = async ({
|
62602
|
-
dialect:
|
62767
|
+
dialect: dialect4,
|
62603
62768
|
driver: driver2,
|
62604
62769
|
proxy,
|
62605
62770
|
customDefaults,
|
@@ -62649,7 +62814,7 @@ var init_studio2 = __esm({
|
|
62649
62814
|
}));
|
62650
62815
|
return c.json({
|
62651
62816
|
version: "6",
|
62652
|
-
dialect:
|
62817
|
+
dialect: dialect4,
|
62653
62818
|
driver: driver2,
|
62654
62819
|
schemaFiles,
|
62655
62820
|
customDefaults: preparedDefaults,
|
@@ -78956,11 +79121,13 @@ var init_pgIntrospect = __esm({
|
|
78956
79121
|
});
|
78957
79122
|
|
78958
79123
|
// src/introspect-sqlite.ts
|
78959
|
-
var sqliteImportsList, indexName3, objToStatement2, relations, escapeColumnKey, withCasing, schemaToTypeScript, isCyclic, isSelf, mapColumnDefault, column4, createTableColumns, createTableIndexes, createTableUniques, createTablePKs, createTableFKs;
|
79124
|
+
var import_casing3, sqliteImportsList, indexName3, objToStatement2, relations, escapeColumnKey, withCasing, dbColumnName, schemaToTypeScript, isCyclic, isSelf, mapColumnDefault, column4, createTableColumns, createTableIndexes, createTableUniques, createTablePKs, createTableFKs;
|
78960
79125
|
var init_introspect_sqlite = __esm({
|
78961
79126
|
"src/introspect-sqlite.ts"() {
|
78962
79127
|
"use strict";
|
79128
|
+
import_casing3 = require("drizzle-orm/casing");
|
78963
79129
|
init_utils3();
|
79130
|
+
init_global();
|
78964
79131
|
sqliteImportsList = /* @__PURE__ */ new Set([
|
78965
79132
|
"sqliteTable",
|
78966
79133
|
"integer",
|
@@ -78998,6 +79165,15 @@ var init_introspect_sqlite = __esm({
|
|
78998
79165
|
}
|
78999
79166
|
return value;
|
79000
79167
|
};
|
79168
|
+
dbColumnName = ({ name, casing: casing2, withMode = false }) => {
|
79169
|
+
if (casing2 === "preserve") {
|
79170
|
+
return "";
|
79171
|
+
}
|
79172
|
+
if (casing2 === "camel") {
|
79173
|
+
return (0, import_casing3.toCamelCase)(name) === name ? "" : withMode ? `"${name}", ` : `"${name}"`;
|
79174
|
+
}
|
79175
|
+
assertUnreachable(casing2);
|
79176
|
+
};
|
79001
79177
|
schemaToTypeScript = (schema5, casing2) => {
|
79002
79178
|
Object.values(schema5.tables).forEach((table4) => {
|
79003
79179
|
Object.values(table4.foreignKeys).forEach((fk4) => {
|
@@ -79117,13 +79293,14 @@ var init_introspect_sqlite = __esm({
|
|
79117
79293
|
};
|
79118
79294
|
column4 = (type, name, defaultValue, autoincrement, casing2) => {
|
79119
79295
|
let lowered = type;
|
79296
|
+
casing2 = casing2;
|
79120
79297
|
if (lowered === "integer") {
|
79121
|
-
let out = `${withCasing(name, casing2)}: integer(
|
79298
|
+
let out = `${withCasing(name, casing2)}: integer(${dbColumnName({ name, casing: casing2 })})`;
|
79122
79299
|
out += typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault(defaultValue)})` : "";
|
79123
79300
|
return out;
|
79124
79301
|
}
|
79125
79302
|
if (lowered === "real") {
|
79126
|
-
let out = `${withCasing(name, casing2)}: real(
|
79303
|
+
let out = `${withCasing(name, casing2)}: real(${dbColumnName({ name, casing: casing2 })})`;
|
79127
79304
|
out += defaultValue ? `.default(${mapColumnDefault(defaultValue)})` : "";
|
79128
79305
|
return out;
|
79129
79306
|
}
|
@@ -79131,20 +79308,20 @@ var init_introspect_sqlite = __esm({
|
|
79131
79308
|
const match2 = lowered.match(/\d+/);
|
79132
79309
|
let out;
|
79133
79310
|
if (match2) {
|
79134
|
-
out = `${withCasing(name, casing2)}: text(
|
79311
|
+
out = `${withCasing(name, casing2)}: text(${dbColumnName({ name, casing: casing2, withMode: true })}{ length: ${match2[0]} })`;
|
79135
79312
|
} else {
|
79136
|
-
out = `${withCasing(name, casing2)}: text(
|
79313
|
+
out = `${withCasing(name, casing2)}: text(${dbColumnName({ name, casing: casing2 })})`;
|
79137
79314
|
}
|
79138
79315
|
out += defaultValue ? `.default("${mapColumnDefault(defaultValue)}")` : "";
|
79139
79316
|
return out;
|
79140
79317
|
}
|
79141
79318
|
if (lowered === "blob") {
|
79142
|
-
let out = `${withCasing(name, casing2)}: blob(
|
79319
|
+
let out = `${withCasing(name, casing2)}: blob(${dbColumnName({ name, casing: casing2 })})`;
|
79143
79320
|
out += defaultValue ? `.default(${mapColumnDefault(defaultValue)})` : "";
|
79144
79321
|
return out;
|
79145
79322
|
}
|
79146
79323
|
if (lowered === "numeric") {
|
79147
|
-
let out = `${withCasing(name, casing2)}: numeric(
|
79324
|
+
let out = `${withCasing(name, casing2)}: numeric(${dbColumnName({ name, casing: casing2 })})`;
|
79148
79325
|
out += defaultValue ? `.default(${mapColumnDefault(defaultValue)})` : "";
|
79149
79326
|
return out;
|
79150
79327
|
}
|
@@ -79368,13 +79545,13 @@ var init_push = __esm({
|
|
79368
79545
|
init_mysqlPushUtils();
|
79369
79546
|
init_pgPushUtils();
|
79370
79547
|
init_sqlitePushUtils();
|
79371
|
-
mysqlPush = async (schemaPath, credentials2, tablesFilter, strict, verbose, force) => {
|
79548
|
+
mysqlPush = async (schemaPath, credentials2, tablesFilter, strict, verbose, force, casing2) => {
|
79372
79549
|
const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
79373
79550
|
const { mysqlPushIntrospect: mysqlPushIntrospect2 } = await Promise.resolve().then(() => (init_mysqlIntrospect(), mysqlIntrospect_exports));
|
79374
79551
|
const { db, database } = await connectToMySQL2(credentials2);
|
79375
79552
|
const { schema: schema5 } = await mysqlPushIntrospect2(db, database, tablesFilter);
|
79376
79553
|
const { prepareMySQLPush: prepareMySQLPush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
79377
|
-
const statements = await prepareMySQLPush2(schemaPath, schema5);
|
79554
|
+
const statements = await prepareMySQLPush2(schemaPath, schema5, casing2);
|
79378
79555
|
const filteredStatements = filterStatements(
|
79379
79556
|
statements.statements ?? [],
|
79380
79557
|
statements.validatedCur,
|
@@ -79469,13 +79646,13 @@ var init_push = __esm({
|
|
79469
79646
|
console.log(e2);
|
79470
79647
|
}
|
79471
79648
|
};
|
79472
|
-
pgPush = async (schemaPath, verbose, strict, credentials2, tablesFilter, schemasFilter, force) => {
|
79649
|
+
pgPush = async (schemaPath, verbose, strict, credentials2, tablesFilter, schemasFilter, force, casing2) => {
|
79473
79650
|
const { preparePostgresDB: preparePostgresDB2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
79474
79651
|
const { pgPushIntrospect: pgPushIntrospect2 } = await Promise.resolve().then(() => (init_pgIntrospect(), pgIntrospect_exports));
|
79475
79652
|
const db = await preparePostgresDB2(credentials2);
|
79476
79653
|
const { schema: schema5 } = await pgPushIntrospect2(db, tablesFilter, schemasFilter);
|
79477
79654
|
const { preparePgPush: preparePgPush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
79478
|
-
const statements = await preparePgPush2(schemaPath, schema5, schemasFilter);
|
79655
|
+
const statements = await preparePgPush2(schemaPath, schema5, schemasFilter, casing2);
|
79479
79656
|
try {
|
79480
79657
|
if (statements.sqlStatements.length === 0) {
|
79481
79658
|
(0, import_hanji11.render)(`[${source_default.blue("i")}] No changes detected`);
|
@@ -79543,13 +79720,13 @@ var init_push = __esm({
|
|
79543
79720
|
console.error(e2);
|
79544
79721
|
}
|
79545
79722
|
};
|
79546
|
-
sqlitePush = async (schemaPath, verbose, strict, credentials2, tablesFilter, force) => {
|
79723
|
+
sqlitePush = async (schemaPath, verbose, strict, credentials2, tablesFilter, force, casing2) => {
|
79547
79724
|
const { connectToSQLite: connectToSQLite2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
79548
79725
|
const { sqlitePushIntrospect: sqlitePushIntrospect2 } = await Promise.resolve().then(() => (init_sqliteIntrospect(), sqliteIntrospect_exports));
|
79549
79726
|
const db = await connectToSQLite2(credentials2);
|
79550
79727
|
const { schema: schema5 } = await sqlitePushIntrospect2(db, tablesFilter);
|
79551
79728
|
const { prepareSQLitePush: prepareSQLitePush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
79552
|
-
const statements = await prepareSQLitePush2(schemaPath, schema5);
|
79729
|
+
const statements = await prepareSQLitePush2(schemaPath, schema5, casing2);
|
79553
79730
|
if (statements.sqlStatements.length === 0) {
|
79554
79731
|
(0, import_hanji11.render)(`
|
79555
79732
|
[${source_default.blue("i")}] No changes detected`);
|
@@ -79631,13 +79808,13 @@ var init_push = __esm({
|
|
79631
79808
|
}
|
79632
79809
|
}
|
79633
79810
|
};
|
79634
|
-
libSQLPush = async (schemaPath, verbose, strict, credentials2, tablesFilter, force) => {
|
79811
|
+
libSQLPush = async (schemaPath, verbose, strict, credentials2, tablesFilter, force, casing2) => {
|
79635
79812
|
const { connectToLibSQL: connectToLibSQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
79636
79813
|
const { sqlitePushIntrospect: sqlitePushIntrospect2 } = await Promise.resolve().then(() => (init_sqliteIntrospect(), sqliteIntrospect_exports));
|
79637
79814
|
const db = await connectToLibSQL2(credentials2);
|
79638
79815
|
const { schema: schema5 } = await sqlitePushIntrospect2(db, tablesFilter);
|
79639
79816
|
const { prepareLibSQLPush: prepareLibSQLPush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
79640
|
-
const statements = await prepareLibSQLPush2(schemaPath, schema5);
|
79817
|
+
const statements = await prepareLibSQLPush2(schemaPath, schema5, casing2);
|
79641
79818
|
if (statements.sqlStatements.length === 0) {
|
79642
79819
|
(0, import_hanji11.render)(`
|
79643
79820
|
[${source_default.blue("i")}] No changes detected`);
|
@@ -80067,11 +80244,13 @@ var require_pluralize = __commonJS({
|
|
80067
80244
|
});
|
80068
80245
|
|
80069
80246
|
// 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;
|
80247
|
+
var import_casing4, mysqlImportsList, objToStatement22, timeConfig, binaryConfig, importsPatch, relations2, escapeColumnKey2, prepareCasing, dbColumnName2, schemaToTypeScript2, isCyclic2, isSelf2, mapColumnDefault2, mapColumnDefaultForJson, column5, createTableColumns2, createTableIndexes2, createTableUniques2, createTablePKs2, createTableFKs2;
|
80071
80248
|
var init_introspect_mysql = __esm({
|
80072
80249
|
"src/introspect-mysql.ts"() {
|
80073
80250
|
"use strict";
|
80251
|
+
import_casing4 = require("drizzle-orm/casing");
|
80074
80252
|
init_utils3();
|
80253
|
+
init_global();
|
80075
80254
|
init_mysqlSerializer();
|
80076
80255
|
mysqlImportsList = /* @__PURE__ */ new Set([
|
80077
80256
|
"mysqlTable",
|
@@ -80151,7 +80330,16 @@ var init_introspect_mysql = __esm({
|
|
80151
80330
|
if (casing2 === "camel") {
|
80152
80331
|
return escapeColumnKey2(value.camelCase());
|
80153
80332
|
}
|
80154
|
-
|
80333
|
+
assertUnreachable(casing2);
|
80334
|
+
};
|
80335
|
+
dbColumnName2 = ({ name, casing: casing2, withMode = false }) => {
|
80336
|
+
if (casing2 === "preserve") {
|
80337
|
+
return "";
|
80338
|
+
}
|
80339
|
+
if (casing2 === "camel") {
|
80340
|
+
return (0, import_casing4.toCamelCase)(name) === name ? "" : withMode ? `"${name}", ` : `"${name}"`;
|
80341
|
+
}
|
80342
|
+
assertUnreachable(casing2);
|
80155
80343
|
};
|
80156
80344
|
schemaToTypeScript2 = (schema5, casing2) => {
|
80157
80345
|
const withCasing4 = prepareCasing(casing2);
|
@@ -80212,6 +80400,7 @@ var init_introspect_mysql = __esm({
|
|
80212
80400
|
Object.values(table4.columns),
|
80213
80401
|
Object.values(table4.foreignKeys),
|
80214
80402
|
withCasing4,
|
80403
|
+
casing2,
|
80215
80404
|
table4.name,
|
80216
80405
|
schema5
|
80217
80406
|
);
|
@@ -80291,51 +80480,51 @@ import { sql } from "drizzle-orm"
|
|
80291
80480
|
}
|
80292
80481
|
return defaultValue;
|
80293
80482
|
};
|
80294
|
-
column5 = (type, name, casing2, defaultValue, autoincrement, onUpdate, isExpression) => {
|
80483
|
+
column5 = (type, name, casing2, rawCasing, defaultValue, autoincrement, onUpdate, isExpression) => {
|
80295
80484
|
let lowered = type;
|
80296
80485
|
if (!type.startsWith("enum(")) {
|
80297
80486
|
lowered = type.toLowerCase();
|
80298
80487
|
}
|
80299
80488
|
if (lowered === "serial") {
|
80300
|
-
return `${casing2(name)}: serial(
|
80489
|
+
return `${casing2(name)}: serial(${dbColumnName2({ name, casing: rawCasing })})`;
|
80301
80490
|
}
|
80302
80491
|
if (lowered.startsWith("int")) {
|
80303
80492
|
const isUnsigned = lowered.startsWith("int unsigned");
|
80304
|
-
let out = `${casing2(name)}: int(
|
80493
|
+
let out = `${casing2(name)}: int(${dbColumnName2({ name, casing: rawCasing, withMode: isUnsigned })}${isUnsigned ? "{ unsigned: true }" : ""})`;
|
80305
80494
|
out += autoincrement ? `.autoincrement()` : "";
|
80306
80495
|
out += typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80307
80496
|
return out;
|
80308
80497
|
}
|
80309
80498
|
if (lowered.startsWith("tinyint")) {
|
80310
80499
|
const isUnsigned = lowered.startsWith("tinyint unsigned");
|
80311
|
-
let out = `${casing2(name)}: tinyint(
|
80500
|
+
let out = `${casing2(name)}: tinyint(${dbColumnName2({ name, casing: rawCasing, withMode: isUnsigned })}${isUnsigned ? ", { unsigned: true }" : ""})`;
|
80312
80501
|
out += autoincrement ? `.autoincrement()` : "";
|
80313
80502
|
out += typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80314
80503
|
return out;
|
80315
80504
|
}
|
80316
80505
|
if (lowered.startsWith("smallint")) {
|
80317
80506
|
const isUnsigned = lowered.startsWith("smallint unsigned");
|
80318
|
-
let out = `${casing2(name)}: smallint(
|
80507
|
+
let out = `${casing2(name)}: smallint(${dbColumnName2({ name, casing: rawCasing, withMode: isUnsigned })}${isUnsigned ? ", { unsigned: true }" : ""})`;
|
80319
80508
|
out += autoincrement ? `.autoincrement()` : "";
|
80320
80509
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80321
80510
|
return out;
|
80322
80511
|
}
|
80323
80512
|
if (lowered.startsWith("mediumint")) {
|
80324
80513
|
const isUnsigned = lowered.startsWith("mediumint unsigned");
|
80325
|
-
let out = `${casing2(name)}: mediumint(
|
80514
|
+
let out = `${casing2(name)}: mediumint(${dbColumnName2({ name, casing: rawCasing, withMode: isUnsigned })}${isUnsigned ? ", { unsigned: true }" : ""})`;
|
80326
80515
|
out += autoincrement ? `.autoincrement()` : "";
|
80327
80516
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80328
80517
|
return out;
|
80329
80518
|
}
|
80330
80519
|
if (lowered.startsWith("bigint")) {
|
80331
80520
|
const isUnsigned = lowered.startsWith("bigint unsigned");
|
80332
|
-
let out = `${casing2(name)}: bigint(
|
80521
|
+
let out = `${casing2(name)}: bigint(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ mode: "number"${isUnsigned ? ", unsigned: true" : ""} })`;
|
80333
80522
|
out += autoincrement ? `.autoincrement()` : "";
|
80334
80523
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80335
80524
|
return out;
|
80336
80525
|
}
|
80337
80526
|
if (lowered === "boolean") {
|
80338
|
-
let out = `${casing2(name)}: boolean(
|
80527
|
+
let out = `${casing2(name)}: boolean(${dbColumnName2({ name, casing: rawCasing })})`;
|
80339
80528
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80340
80529
|
return out;
|
80341
80530
|
}
|
@@ -80345,17 +80534,18 @@ import { sql } from "drizzle-orm"
|
|
80345
80534
|
const [precision, scale] = lowered.slice(7, lowered.length - 1).split(",");
|
80346
80535
|
params = { precision, scale };
|
80347
80536
|
}
|
80348
|
-
|
80537
|
+
const timeConfigParams = params ? timeConfig(params) : void 0;
|
80538
|
+
let out = params ? `${casing2(name)}: double(${dbColumnName2({ name, casing: rawCasing, withMode: timeConfigParams !== void 0 })}${timeConfig(params)})` : `${casing2(name)}: double(${dbColumnName2({ name, casing: rawCasing })})`;
|
80349
80539
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80350
80540
|
return out;
|
80351
80541
|
}
|
80352
80542
|
if (lowered === "float") {
|
80353
|
-
let out = `${casing2(name)}: float(
|
80543
|
+
let out = `${casing2(name)}: float(${dbColumnName2({ name, casing: rawCasing })})`;
|
80354
80544
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80355
80545
|
return out;
|
80356
80546
|
}
|
80357
80547
|
if (lowered === "real") {
|
80358
|
-
let out = `${casing2(name)}: real(
|
80548
|
+
let out = `${casing2(name)}: real(${dbColumnName2({ name, casing: rawCasing })})`;
|
80359
80549
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80360
80550
|
return out;
|
80361
80551
|
}
|
@@ -80364,7 +80554,7 @@ import { sql } from "drizzle-orm"
|
|
80364
80554
|
let fsp = lowered.length > keyLength ? Number(lowered.substring(keyLength, lowered.length - 1)) : null;
|
80365
80555
|
fsp = fsp ? fsp : null;
|
80366
80556
|
const params = timeConfig({ fsp, mode: "'string'" });
|
80367
|
-
let out = params ? `${casing2(name)}: timestamp(
|
80557
|
+
let out = params ? `${casing2(name)}: timestamp(${dbColumnName2({ name, casing: rawCasing, withMode: params !== void 0 })}${params})` : `${casing2(name)}: timestamp(${dbColumnName2({ name, casing: rawCasing })})`;
|
80368
80558
|
defaultValue = defaultValue === "now()" || defaultValue === "(CURRENT_TIMESTAMP)" ? ".defaultNow()" : defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80369
80559
|
out += defaultValue;
|
80370
80560
|
let onUpdateNow = onUpdate ? ".onUpdateNow()" : "";
|
@@ -80376,7 +80566,7 @@ import { sql } from "drizzle-orm"
|
|
80376
80566
|
let fsp = lowered.length > keyLength ? Number(lowered.substring(keyLength, lowered.length - 1)) : null;
|
80377
80567
|
fsp = fsp ? fsp : null;
|
80378
80568
|
const params = timeConfig({ fsp });
|
80379
|
-
let out = params ? `${casing2(name)}: time(
|
80569
|
+
let out = params ? `${casing2(name)}: time(${dbColumnName2({ name, casing: rawCasing, withMode: params !== void 0 })}${params})` : `${casing2(name)}: time(${dbColumnName2({ name, casing: rawCasing })})`;
|
80380
80570
|
defaultValue = defaultValue === "now()" ? ".defaultNow()" : defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80381
80571
|
out += defaultValue;
|
80382
80572
|
return out;
|
@@ -80385,45 +80575,45 @@ import { sql } from "drizzle-orm"
|
|
80385
80575
|
let out = `// you can use { mode: 'date' }, if you want to have Date as type for this column
|
80386
80576
|
${casing2(
|
80387
80577
|
name
|
80388
|
-
)}: date(
|
80578
|
+
)}: date(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ mode: 'string' })`;
|
80389
80579
|
defaultValue = defaultValue === "now()" ? ".defaultNow()" : defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80390
80580
|
out += defaultValue;
|
80391
80581
|
return out;
|
80392
80582
|
}
|
80393
80583
|
if (lowered === "text") {
|
80394
|
-
let out = `${casing2(name)}: text(
|
80584
|
+
let out = `${casing2(name)}: text(${dbColumnName2({ name, casing: rawCasing })})`;
|
80395
80585
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80396
80586
|
return out;
|
80397
80587
|
}
|
80398
80588
|
if (lowered === "tinytext") {
|
80399
|
-
let out = `${casing2(name)}: tinytext(
|
80589
|
+
let out = `${casing2(name)}: tinytext(${dbColumnName2({ name, casing: rawCasing })})`;
|
80400
80590
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80401
80591
|
return out;
|
80402
80592
|
}
|
80403
80593
|
if (lowered === "mediumtext") {
|
80404
|
-
let out = `${casing2(name)}: mediumtext(
|
80594
|
+
let out = `${casing2(name)}: mediumtext(${dbColumnName2({ name, casing: rawCasing })})`;
|
80405
80595
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80406
80596
|
return out;
|
80407
80597
|
}
|
80408
80598
|
if (lowered === "longtext") {
|
80409
|
-
let out = `${casing2(name)}: longtext(
|
80599
|
+
let out = `${casing2(name)}: longtext(${dbColumnName2({ name, casing: rawCasing })})`;
|
80410
80600
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80411
80601
|
return out;
|
80412
80602
|
}
|
80413
80603
|
if (lowered === "year") {
|
80414
|
-
let out = `${casing2(name)}: year(
|
80604
|
+
let out = `${casing2(name)}: year(${dbColumnName2({ name, casing: rawCasing })})`;
|
80415
80605
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80416
80606
|
return out;
|
80417
80607
|
}
|
80418
80608
|
if (lowered === "json") {
|
80419
|
-
let out = `${casing2(name)}: json(
|
80609
|
+
let out = `${casing2(name)}: json(${dbColumnName2({ name, casing: rawCasing })})`;
|
80420
80610
|
out += defaultValue ? `.default(${mapColumnDefaultForJson(defaultValue)})` : "";
|
80421
80611
|
return out;
|
80422
80612
|
}
|
80423
80613
|
if (lowered.startsWith("varchar")) {
|
80424
80614
|
let out = `${casing2(
|
80425
80615
|
name
|
80426
|
-
)}: varchar(
|
80616
|
+
)}: varchar(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ length: ${lowered.substring(
|
80427
80617
|
"varchar".length + 1,
|
80428
80618
|
lowered.length - 1
|
80429
80619
|
)} })`;
|
@@ -80433,7 +80623,7 @@ import { sql } from "drizzle-orm"
|
|
80433
80623
|
if (lowered.startsWith("char")) {
|
80434
80624
|
let out = `${casing2(
|
80435
80625
|
name
|
80436
|
-
)}: char(
|
80626
|
+
)}: char(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ length: ${lowered.substring(
|
80437
80627
|
"char".length + 1,
|
80438
80628
|
lowered.length - 1
|
80439
80629
|
)} })`;
|
@@ -80446,10 +80636,10 @@ import { sql } from "drizzle-orm"
|
|
80446
80636
|
const fsp = lowered.startsWith("datetime(") ? lowered.substring("datetime".length + 1, lowered.length - 1) : void 0;
|
80447
80637
|
out = fsp ? `${casing2(
|
80448
80638
|
name
|
80449
|
-
)}: datetime(
|
80639
|
+
)}: datetime(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ mode: 'string', fsp: ${lowered.substring(
|
80450
80640
|
"datetime".length + 1,
|
80451
80641
|
lowered.length - 1
|
80452
|
-
)} })` : `${casing2(name)}: datetime(
|
80642
|
+
)} })` : `${casing2(name)}: datetime(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ mode: 'string'})`;
|
80453
80643
|
defaultValue = defaultValue === "now()" ? ".defaultNow()" : defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80454
80644
|
out += defaultValue;
|
80455
80645
|
return out;
|
@@ -80460,7 +80650,8 @@ import { sql } from "drizzle-orm"
|
|
80460
80650
|
const [precision, scale] = lowered.slice(8, lowered.length - 1).split(",");
|
80461
80651
|
params = { precision, scale };
|
80462
80652
|
}
|
80463
|
-
|
80653
|
+
const timeConfigParams = params ? timeConfig(params) : void 0;
|
80654
|
+
let out = params ? `${casing2(name)}: decimal(${dbColumnName2({ name, casing: rawCasing, withMode: timeConfigParams !== void 0 })}${timeConfigParams})` : `${casing2(name)}: decimal(${dbColumnName2({ name, casing: rawCasing })})`;
|
80464
80655
|
defaultValue = typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80465
80656
|
out += defaultValue;
|
80466
80657
|
return out;
|
@@ -80470,14 +80661,14 @@ import { sql } from "drizzle-orm"
|
|
80470
80661
|
let length = lowered.length > keyLength ? Number(lowered.substring(keyLength, lowered.length - 1)) : null;
|
80471
80662
|
length = length ? length : null;
|
80472
80663
|
const params = binaryConfig({ length });
|
80473
|
-
let out = params ? `${casing2(name)}: binary(
|
80664
|
+
let out = params ? `${casing2(name)}: binary(${dbColumnName2({ name, casing: rawCasing, withMode: params !== void 0 })}${params})` : `${casing2(name)}: binary(${dbColumnName2({ name, casing: rawCasing })})`;
|
80474
80665
|
defaultValue = defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80475
80666
|
out += defaultValue;
|
80476
80667
|
return out;
|
80477
80668
|
}
|
80478
80669
|
if (lowered.startsWith("enum")) {
|
80479
80670
|
const values = lowered.substring("enum".length + 1, lowered.length - 1);
|
80480
|
-
let out = `${casing2(name)}: mysqlEnum(
|
80671
|
+
let out = `${casing2(name)}: mysqlEnum(${dbColumnName2({ name, casing: rawCasing, withMode: true })}[${values}])`;
|
80481
80672
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80482
80673
|
return out;
|
80483
80674
|
}
|
@@ -80486,7 +80677,7 @@ import { sql } from "drizzle-orm"
|
|
80486
80677
|
let length = lowered.length > keyLength ? Number(lowered.substring(keyLength, lowered.length - 1)) : null;
|
80487
80678
|
length = length ? length : null;
|
80488
80679
|
const params = binaryConfig({ length });
|
80489
|
-
let out = params ? `${casing2(name)}: varbinary(
|
80680
|
+
let out = params ? `${casing2(name)}: varbinary(${dbColumnName2({ name, casing: rawCasing, withMode: params !== void 0 })}${params})` : `${casing2(name)}: varbinary(${dbColumnName2({ name, casing: rawCasing })})`;
|
80490
80681
|
defaultValue = defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80491
80682
|
out += defaultValue;
|
80492
80683
|
return out;
|
@@ -80495,7 +80686,7 @@ import { sql } from "drizzle-orm"
|
|
80495
80686
|
return `// Warning: Can't parse ${type} from database
|
80496
80687
|
// ${type}Type: ${type}("${name}")`;
|
80497
80688
|
};
|
80498
|
-
createTableColumns2 = (columns, fks, casing2, tableName, schema5) => {
|
80689
|
+
createTableColumns2 = (columns, fks, casing2, rawCasing, tableName, schema5) => {
|
80499
80690
|
let statement = "";
|
80500
80691
|
const oneColumnsFKs = Object.values(fks).filter((it) => {
|
80501
80692
|
return !isSelf2(it);
|
@@ -80513,6 +80704,7 @@ import { sql } from "drizzle-orm"
|
|
80513
80704
|
it.type,
|
80514
80705
|
it.name,
|
80515
80706
|
casing2,
|
80707
|
+
rawCasing,
|
80516
80708
|
it.default,
|
80517
80709
|
it.autoincrement,
|
80518
80710
|
it.onUpdate,
|
@@ -80643,13 +80835,14 @@ function generateIdentityParams(identity) {
|
|
80643
80835
|
}
|
80644
80836
|
return `.generatedByDefaultAsIdentity(${paramsObj})`;
|
80645
80837
|
}
|
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;
|
80838
|
+
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
80839
|
var init_introspect_pg = __esm({
|
80648
80840
|
"src/introspect-pg.ts"() {
|
80649
80841
|
"use strict";
|
80650
80842
|
import_drizzle_orm9 = require("drizzle-orm");
|
80651
80843
|
import_relations = require("drizzle-orm/relations");
|
80652
80844
|
init_utils3();
|
80845
|
+
import_casing5 = require("drizzle-orm/casing");
|
80653
80846
|
init_vector();
|
80654
80847
|
init_global();
|
80655
80848
|
init_pgSerializer();
|
@@ -80775,6 +80968,15 @@ var init_introspect_pg = __esm({
|
|
80775
80968
|
}
|
80776
80969
|
assertUnreachable(casing2);
|
80777
80970
|
};
|
80971
|
+
dbColumnName3 = ({ name, casing: casing2, withMode = false }) => {
|
80972
|
+
if (casing2 === "preserve") {
|
80973
|
+
return "";
|
80974
|
+
}
|
80975
|
+
if (casing2 === "camel") {
|
80976
|
+
return (0, import_casing5.toCamelCase)(name) === name ? "" : withMode ? `"${name}", ` : `"${name}"`;
|
80977
|
+
}
|
80978
|
+
assertUnreachable(casing2);
|
80979
|
+
};
|
80778
80980
|
paramNameFor = (name, schema5) => {
|
80779
80981
|
const schemaSuffix = schema5 && schema5 !== "public" ? `In${schema5.capitalise()}` : "";
|
80780
80982
|
return `${name}${schemaSuffix}`;
|
@@ -81070,49 +81272,49 @@ var init_introspect_pg = __esm({
|
|
81070
81272
|
let out = `${withCasing2(name, casing2)}: ${withCasing2(
|
81071
81273
|
paramNameFor(type.replace("[]", ""), typeSchema),
|
81072
81274
|
casing2
|
81073
|
-
)}(
|
81275
|
+
)}(${dbColumnName3({ name, casing: casing2 })})`;
|
81074
81276
|
return out;
|
81075
81277
|
}
|
81076
81278
|
if (lowered.startsWith("serial")) {
|
81077
|
-
return `${withCasing2(name, casing2)}: serial(
|
81279
|
+
return `${withCasing2(name, casing2)}: serial(${dbColumnName3({ name, casing: casing2 })})`;
|
81078
81280
|
}
|
81079
81281
|
if (lowered.startsWith("smallserial")) {
|
81080
|
-
return `${withCasing2(name, casing2)}: smallserial(
|
81282
|
+
return `${withCasing2(name, casing2)}: smallserial(${dbColumnName3({ name, casing: casing2 })})`;
|
81081
81283
|
}
|
81082
81284
|
if (lowered.startsWith("bigserial")) {
|
81083
81285
|
return `${withCasing2(
|
81084
81286
|
name,
|
81085
81287
|
casing2
|
81086
|
-
)}: bigserial(
|
81288
|
+
)}: bigserial(${dbColumnName3({ name, casing: casing2, withMode: true })}{ mode: "bigint" })`;
|
81087
81289
|
}
|
81088
81290
|
if (lowered.startsWith("integer")) {
|
81089
|
-
let out = `${withCasing2(name, casing2)}: integer(
|
81291
|
+
let out = `${withCasing2(name, casing2)}: integer(${dbColumnName3({ name, casing: casing2 })})`;
|
81090
81292
|
return out;
|
81091
81293
|
}
|
81092
81294
|
if (lowered.startsWith("smallint")) {
|
81093
|
-
let out = `${withCasing2(name, casing2)}: smallint(
|
81295
|
+
let out = `${withCasing2(name, casing2)}: smallint(${dbColumnName3({ name, casing: casing2 })})`;
|
81094
81296
|
return out;
|
81095
81297
|
}
|
81096
81298
|
if (lowered.startsWith("bigint")) {
|
81097
81299
|
let out = `// You can use { mode: "bigint" } if numbers are exceeding js number limitations
|
81098
81300
|
`;
|
81099
|
-
out += `${withCasing2(name, casing2)}: bigint(
|
81301
|
+
out += `${withCasing2(name, casing2)}: bigint(${dbColumnName3({ name, casing: casing2, withMode: true })}{ mode: "number" })`;
|
81100
81302
|
return out;
|
81101
81303
|
}
|
81102
81304
|
if (lowered.startsWith("boolean")) {
|
81103
|
-
let out = `${withCasing2(name, casing2)}: boolean(
|
81305
|
+
let out = `${withCasing2(name, casing2)}: boolean(${dbColumnName3({ name, casing: casing2 })})`;
|
81104
81306
|
return out;
|
81105
81307
|
}
|
81106
81308
|
if (lowered.startsWith("double precision")) {
|
81107
|
-
let out = `${withCasing2(name, casing2)}: doublePrecision(
|
81309
|
+
let out = `${withCasing2(name, casing2)}: doublePrecision(${dbColumnName3({ name, casing: casing2 })})`;
|
81108
81310
|
return out;
|
81109
81311
|
}
|
81110
81312
|
if (lowered.startsWith("real")) {
|
81111
|
-
let out = `${withCasing2(name, casing2)}: real(
|
81313
|
+
let out = `${withCasing2(name, casing2)}: real(${dbColumnName3({ name, casing: casing2 })})`;
|
81112
81314
|
return out;
|
81113
81315
|
}
|
81114
81316
|
if (lowered.startsWith("uuid")) {
|
81115
|
-
let out = `${withCasing2(name, casing2)}: uuid(
|
81317
|
+
let out = `${withCasing2(name, casing2)}: uuid(${dbColumnName3({ name, casing: casing2 })})`;
|
81116
81318
|
return out;
|
81117
81319
|
}
|
81118
81320
|
if (lowered.startsWith("numeric")) {
|
@@ -81121,7 +81323,7 @@ var init_introspect_pg = __esm({
|
|
81121
81323
|
const [precision, scale] = lowered.slice(8, lowered.length - 1).split(",");
|
81122
81324
|
params = { precision, scale };
|
81123
81325
|
}
|
81124
|
-
let out = params ? `${withCasing2(name, casing2)}: numeric(
|
81326
|
+
let out = params ? `${withCasing2(name, casing2)}: numeric(${dbColumnName3({ name, casing: casing2, withMode: true })}${timeConfig2(params)})` : `${withCasing2(name, casing2)}: numeric(${dbColumnName3({ name, casing: casing2 })})`;
|
81125
81327
|
return out;
|
81126
81328
|
}
|
81127
81329
|
if (lowered.startsWith("timestamp")) {
|
@@ -81135,7 +81337,7 @@ var init_introspect_pg = __esm({
|
|
81135
81337
|
withTimezone,
|
81136
81338
|
mode: "'string'"
|
81137
81339
|
});
|
81138
|
-
let out = params ? `${withCasing2(name, casing2)}: timestamp(
|
81340
|
+
let out = params ? `${withCasing2(name, casing2)}: timestamp(${dbColumnName3({ name, casing: casing2, withMode: true })}${params})` : `${withCasing2(name, casing2)}: timestamp(${dbColumnName3({ name, casing: casing2 })})`;
|
81139
81341
|
return out;
|
81140
81342
|
}
|
81141
81343
|
if (lowered.startsWith("time")) {
|
@@ -81145,44 +81347,44 @@ var init_introspect_pg = __esm({
|
|
81145
81347
|
) : null;
|
81146
81348
|
precision = precision ? precision : null;
|
81147
81349
|
const params = timeConfig2({ precision, withTimezone });
|
81148
|
-
let out = params ? `${withCasing2(name, casing2)}: time(
|
81350
|
+
let out = params ? `${withCasing2(name, casing2)}: time(${dbColumnName3({ name, casing: casing2, withMode: true })}${params})` : `${withCasing2(name, casing2)}: time(${dbColumnName3({ name, casing: casing2 })})`;
|
81149
81351
|
return out;
|
81150
81352
|
}
|
81151
81353
|
if (lowered.startsWith("interval")) {
|
81152
81354
|
const params = intervalConfig(lowered);
|
81153
|
-
let out = params ? `${withCasing2(name, casing2)}: interval(
|
81355
|
+
let out = params ? `${withCasing2(name, casing2)}: interval(${dbColumnName3({ name, casing: casing2, withMode: true })}${params})` : `${withCasing2(name, casing2)}: interval(${dbColumnName3({ name, casing: casing2 })})`;
|
81154
81356
|
return out;
|
81155
81357
|
}
|
81156
81358
|
if (lowered === "date") {
|
81157
|
-
let out = `${withCasing2(name, casing2)}: date(
|
81359
|
+
let out = `${withCasing2(name, casing2)}: date(${dbColumnName3({ name, casing: casing2 })})`;
|
81158
81360
|
return out;
|
81159
81361
|
}
|
81160
81362
|
if (lowered.startsWith("text")) {
|
81161
|
-
let out = `${withCasing2(name, casing2)}: text(
|
81363
|
+
let out = `${withCasing2(name, casing2)}: text(${dbColumnName3({ name, casing: casing2 })})`;
|
81162
81364
|
return out;
|
81163
81365
|
}
|
81164
81366
|
if (lowered.startsWith("jsonb")) {
|
81165
|
-
let out = `${withCasing2(name, casing2)}: jsonb(
|
81367
|
+
let out = `${withCasing2(name, casing2)}: jsonb(${dbColumnName3({ name, casing: casing2 })})`;
|
81166
81368
|
return out;
|
81167
81369
|
}
|
81168
81370
|
if (lowered.startsWith("json")) {
|
81169
|
-
let out = `${withCasing2(name, casing2)}: json(
|
81371
|
+
let out = `${withCasing2(name, casing2)}: json(${dbColumnName3({ name, casing: casing2 })})`;
|
81170
81372
|
return out;
|
81171
81373
|
}
|
81172
81374
|
if (lowered.startsWith("inet")) {
|
81173
|
-
let out = `${withCasing2(name, casing2)}: inet(
|
81375
|
+
let out = `${withCasing2(name, casing2)}: inet(${dbColumnName3({ name, casing: casing2 })})`;
|
81174
81376
|
return out;
|
81175
81377
|
}
|
81176
81378
|
if (lowered.startsWith("cidr")) {
|
81177
|
-
let out = `${withCasing2(name, casing2)}: cidr(
|
81379
|
+
let out = `${withCasing2(name, casing2)}: cidr(${dbColumnName3({ name, casing: casing2 })})`;
|
81178
81380
|
return out;
|
81179
81381
|
}
|
81180
81382
|
if (lowered.startsWith("macaddr8")) {
|
81181
|
-
let out = `${withCasing2(name, casing2)}: macaddr8(
|
81383
|
+
let out = `${withCasing2(name, casing2)}: macaddr8(${dbColumnName3({ name, casing: casing2 })})`;
|
81182
81384
|
return out;
|
81183
81385
|
}
|
81184
81386
|
if (lowered.startsWith("macaddr")) {
|
81185
|
-
let out = `${withCasing2(name, casing2)}: macaddr(
|
81387
|
+
let out = `${withCasing2(name, casing2)}: macaddr(${dbColumnName3({ name, casing: casing2 })})`;
|
81186
81388
|
return out;
|
81187
81389
|
}
|
81188
81390
|
if (lowered.startsWith("varchar")) {
|
@@ -81191,21 +81393,21 @@ var init_introspect_pg = __esm({
|
|
81191
81393
|
out = `${withCasing2(
|
81192
81394
|
name,
|
81193
81395
|
casing2
|
81194
|
-
)}: varchar(
|
81396
|
+
)}: varchar(${dbColumnName3({ name, casing: casing2, withMode: true })}{ length: ${lowered.substring(
|
81195
81397
|
8,
|
81196
81398
|
lowered.length - 1
|
81197
81399
|
)} })`;
|
81198
81400
|
} else {
|
81199
|
-
out = `${withCasing2(name, casing2)}: varchar(
|
81401
|
+
out = `${withCasing2(name, casing2)}: varchar(${dbColumnName3({ name, casing: casing2 })})`;
|
81200
81402
|
}
|
81201
81403
|
return out;
|
81202
81404
|
}
|
81203
81405
|
if (lowered.startsWith("point")) {
|
81204
|
-
let out = `${withCasing2(name, casing2)}: point(
|
81406
|
+
let out = `${withCasing2(name, casing2)}: point(${dbColumnName3({ name, casing: casing2 })})`;
|
81205
81407
|
return out;
|
81206
81408
|
}
|
81207
81409
|
if (lowered.startsWith("line")) {
|
81208
|
-
let out = `${withCasing2(name, casing2)}: point(
|
81410
|
+
let out = `${withCasing2(name, casing2)}: point(${dbColumnName3({ name, casing: casing2 })})`;
|
81209
81411
|
return out;
|
81210
81412
|
}
|
81211
81413
|
if (lowered.startsWith("geometry")) {
|
@@ -81214,14 +81416,14 @@ var init_introspect_pg = __esm({
|
|
81214
81416
|
if (lowered.length !== 8) {
|
81215
81417
|
const geometryOptions = lowered.slice(9, -1).split(",");
|
81216
81418
|
if (geometryOptions.length === 1 && geometryOptions[0] !== "") {
|
81217
|
-
out = `${withCasing2(name, casing2)}: geometry(
|
81419
|
+
out = `${withCasing2(name, casing2)}: geometry(${dbColumnName3({ name, casing: casing2, withMode: true })}{ type: "${geometryOptions[0]}" })`;
|
81218
81420
|
} else if (geometryOptions.length === 2) {
|
81219
|
-
out = `${withCasing2(name, casing2)}: geometry(
|
81421
|
+
out = `${withCasing2(name, casing2)}: geometry(${dbColumnName3({ name, casing: casing2, withMode: true })}{ type: "${geometryOptions[0]}", srid: ${geometryOptions[1]} })`;
|
81220
81422
|
} else {
|
81221
81423
|
isGeoUnknown = true;
|
81222
81424
|
}
|
81223
81425
|
} else {
|
81224
|
-
out = `${withCasing2(name, casing2)}: geometry(
|
81426
|
+
out = `${withCasing2(name, casing2)}: geometry(${dbColumnName3({ name, casing: casing2 })})`;
|
81225
81427
|
}
|
81226
81428
|
if (isGeoUnknown) {
|
81227
81429
|
let unknown2 = `// TODO: failed to parse geometry type because found more than 2 options inside geometry function '${type}'
|
@@ -81238,12 +81440,12 @@ var init_introspect_pg = __esm({
|
|
81238
81440
|
out = `${withCasing2(
|
81239
81441
|
name,
|
81240
81442
|
casing2
|
81241
|
-
)}: vector(
|
81443
|
+
)}: vector(${dbColumnName3({ name, casing: casing2, withMode: true })}{ dimensions: ${lowered.substring(
|
81242
81444
|
7,
|
81243
81445
|
lowered.length - 1
|
81244
81446
|
)} })`;
|
81245
81447
|
} else {
|
81246
|
-
out = `${withCasing2(name, casing2)}: vector(
|
81448
|
+
out = `${withCasing2(name, casing2)}: vector(${dbColumnName3({ name, casing: casing2 })})`;
|
81247
81449
|
}
|
81248
81450
|
return out;
|
81249
81451
|
}
|
@@ -81253,12 +81455,12 @@ var init_introspect_pg = __esm({
|
|
81253
81455
|
out = `${withCasing2(
|
81254
81456
|
name,
|
81255
81457
|
casing2
|
81256
|
-
)}: char(
|
81458
|
+
)}: char(${dbColumnName3({ name, casing: casing2, withMode: true })}{ length: ${lowered.substring(
|
81257
81459
|
5,
|
81258
81460
|
lowered.length - 1
|
81259
81461
|
)} })`;
|
81260
81462
|
} else {
|
81261
|
-
out = `${withCasing2(name, casing2)}: char(
|
81463
|
+
out = `${withCasing2(name, casing2)}: char(${dbColumnName3({ name, casing: casing2 })})`;
|
81262
81464
|
}
|
81263
81465
|
return out;
|
81264
81466
|
}
|
@@ -83356,9 +83558,9 @@ init_source();
|
|
83356
83558
|
|
83357
83559
|
// src/cli/commands/check.ts
|
83358
83560
|
init_utils();
|
83359
|
-
var checkHandler = (out,
|
83360
|
-
const { snapshots } = prepareOutFolder(out,
|
83361
|
-
const report = validateWithReport(snapshots,
|
83561
|
+
var checkHandler = (out, dialect4) => {
|
83562
|
+
const { snapshots } = prepareOutFolder(out, dialect4);
|
83563
|
+
const report = validateWithReport(snapshots, dialect4);
|
83362
83564
|
if (report.nonLatest.length > 0) {
|
83363
83565
|
console.log(
|
83364
83566
|
report.nonLatest.map((it) => {
|
@@ -84645,12 +84847,14 @@ var optionBreakpoints = boolean().desc(
|
|
84645
84847
|
`Prepare SQL statements with breakpoints`
|
84646
84848
|
);
|
84647
84849
|
var optionDriver = string().enum(...drivers).desc("Database driver");
|
84850
|
+
var optionCasing = string().enum("camelCase", "snake_case").desc("Casing for serialization");
|
84648
84851
|
var generate = command({
|
84649
84852
|
name: "generate",
|
84650
84853
|
options: {
|
84651
84854
|
config: optionConfig,
|
84652
84855
|
dialect: optionDialect,
|
84653
84856
|
driver: optionDriver,
|
84857
|
+
casing: optionCasing,
|
84654
84858
|
schema: string().desc("Path to a schema file or folder"),
|
84655
84859
|
out: optionOut,
|
84656
84860
|
name: string().desc("Migration file name"),
|
@@ -84663,7 +84867,7 @@ var generate = command({
|
|
84663
84867
|
"generate",
|
84664
84868
|
opts,
|
84665
84869
|
["prefix", "name", "custom"],
|
84666
|
-
["driver", "breakpoints", "schema", "out", "dialect"]
|
84870
|
+
["driver", "breakpoints", "schema", "out", "dialect", "casing"]
|
84667
84871
|
);
|
84668
84872
|
return prepareGenerateConfig(opts, from);
|
84669
84873
|
},
|
@@ -84676,17 +84880,17 @@ var generate = command({
|
|
84676
84880
|
prepareAndMigrateSqlite: prepareAndMigrateSqlite2,
|
84677
84881
|
prepareAndMigrateLibSQL: prepareAndMigrateLibSQL2
|
84678
84882
|
} = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
84679
|
-
const
|
84680
|
-
if (
|
84883
|
+
const dialect4 = opts.dialect;
|
84884
|
+
if (dialect4 === "postgresql") {
|
84681
84885
|
await prepareAndMigratePg2(opts);
|
84682
|
-
} else if (
|
84886
|
+
} else if (dialect4 === "mysql") {
|
84683
84887
|
await prepareAndMigrateMysql2(opts);
|
84684
|
-
} else if (
|
84888
|
+
} else if (dialect4 === "sqlite") {
|
84685
84889
|
await prepareAndMigrateSqlite2(opts);
|
84686
|
-
} else if (
|
84890
|
+
} else if (dialect4 === "turso") {
|
84687
84891
|
await prepareAndMigrateLibSQL2(opts);
|
84688
84892
|
} else {
|
84689
|
-
assertUnreachable(
|
84893
|
+
assertUnreachable(dialect4);
|
84690
84894
|
}
|
84691
84895
|
}
|
84692
84896
|
});
|
@@ -84701,9 +84905,9 @@ var migrate = command({
|
|
84701
84905
|
handler: async (opts) => {
|
84702
84906
|
await assertOrmCoreVersion();
|
84703
84907
|
await assertPackages("drizzle-orm");
|
84704
|
-
const { dialect:
|
84908
|
+
const { dialect: dialect4, schema: schema5, table: table4, out, credentials: credentials2 } = opts;
|
84705
84909
|
try {
|
84706
|
-
if (
|
84910
|
+
if (dialect4 === "postgresql") {
|
84707
84911
|
if ("driver" in credentials2) {
|
84708
84912
|
const { driver: driver2 } = credentials2;
|
84709
84913
|
if (driver2 === "aws-data-api") {
|
@@ -84734,7 +84938,7 @@ var migrate = command({
|
|
84734
84938
|
migrationsSchema: schema5
|
84735
84939
|
})
|
84736
84940
|
);
|
84737
|
-
} else if (
|
84941
|
+
} else if (dialect4 === "mysql") {
|
84738
84942
|
const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
84739
84943
|
const { migrate: migrate2 } = await connectToMySQL2(credentials2);
|
84740
84944
|
await (0, import_hanji13.renderWithTask)(
|
@@ -84745,7 +84949,7 @@ var migrate = command({
|
|
84745
84949
|
migrationsSchema: schema5
|
84746
84950
|
})
|
84747
84951
|
);
|
84748
|
-
} else if (
|
84952
|
+
} else if (dialect4 === "sqlite") {
|
84749
84953
|
const { connectToSQLite: connectToSQLite2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
84750
84954
|
const { migrate: migrate2 } = await connectToSQLite2(credentials2);
|
84751
84955
|
await (0, import_hanji13.renderWithTask)(
|
@@ -84756,7 +84960,7 @@ var migrate = command({
|
|
84756
84960
|
migrationsSchema: schema5
|
84757
84961
|
})
|
84758
84962
|
);
|
84759
|
-
} else if (
|
84963
|
+
} else if (dialect4 === "turso") {
|
84760
84964
|
const { connectToLibSQL: connectToLibSQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
84761
84965
|
const { migrate: migrate2 } = await connectToLibSQL2(credentials2);
|
84762
84966
|
await (0, import_hanji13.renderWithTask)(
|
@@ -84768,7 +84972,7 @@ var migrate = command({
|
|
84768
84972
|
})
|
84769
84973
|
);
|
84770
84974
|
} else {
|
84771
|
-
assertUnreachable(
|
84975
|
+
assertUnreachable(dialect4);
|
84772
84976
|
}
|
84773
84977
|
} catch (e2) {
|
84774
84978
|
console.error(e2);
|
@@ -84802,6 +85006,7 @@ var push = command({
|
|
84802
85006
|
options: {
|
84803
85007
|
config: optionConfig,
|
84804
85008
|
dialect: optionDialect,
|
85009
|
+
casing: optionCasing,
|
84805
85010
|
schema: string().desc("Path to a schema file or folder"),
|
84806
85011
|
...optionsFilters,
|
84807
85012
|
...optionsDatabaseCredentials,
|
@@ -84830,7 +85035,8 @@ var push = command({
|
|
84830
85035
|
"authToken",
|
84831
85036
|
"schemaFilters",
|
84832
85037
|
"extensionsFilters",
|
84833
|
-
"tablesFilter"
|
85038
|
+
"tablesFilter",
|
85039
|
+
"casing"
|
84834
85040
|
]
|
84835
85041
|
);
|
84836
85042
|
return preparePushConfig(opts, from);
|
@@ -84839,17 +85045,18 @@ var push = command({
|
|
84839
85045
|
await assertPackages("drizzle-orm");
|
84840
85046
|
await assertOrmCoreVersion();
|
84841
85047
|
const {
|
84842
|
-
dialect:
|
85048
|
+
dialect: dialect4,
|
84843
85049
|
schemaPath,
|
84844
85050
|
strict,
|
84845
85051
|
verbose,
|
84846
85052
|
credentials: credentials2,
|
84847
85053
|
tablesFilter,
|
84848
85054
|
schemasFilter,
|
84849
|
-
force
|
85055
|
+
force,
|
85056
|
+
casing: casing2
|
84850
85057
|
} = config;
|
84851
85058
|
try {
|
84852
|
-
if (
|
85059
|
+
if (dialect4 === "mysql") {
|
84853
85060
|
const { mysqlPush: mysqlPush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
|
84854
85061
|
await mysqlPush2(
|
84855
85062
|
schemaPath,
|
@@ -84857,9 +85064,10 @@ var push = command({
|
|
84857
85064
|
tablesFilter,
|
84858
85065
|
strict,
|
84859
85066
|
verbose,
|
84860
|
-
force
|
85067
|
+
force,
|
85068
|
+
casing2
|
84861
85069
|
);
|
84862
|
-
} else if (
|
85070
|
+
} else if (dialect4 === "postgresql") {
|
84863
85071
|
if ("driver" in credentials2) {
|
84864
85072
|
const { driver: driver2 } = credentials2;
|
84865
85073
|
if (driver2 === "aws-data-api") {
|
@@ -84888,9 +85096,10 @@ var push = command({
|
|
84888
85096
|
credentials2,
|
84889
85097
|
tablesFilter,
|
84890
85098
|
schemasFilter,
|
84891
|
-
force
|
85099
|
+
force,
|
85100
|
+
casing2
|
84892
85101
|
);
|
84893
|
-
} else if (
|
85102
|
+
} else if (dialect4 === "sqlite") {
|
84894
85103
|
const { sqlitePush: sqlitePush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
|
84895
85104
|
await sqlitePush2(
|
84896
85105
|
schemaPath,
|
@@ -84898,9 +85107,10 @@ var push = command({
|
|
84898
85107
|
strict,
|
84899
85108
|
credentials2,
|
84900
85109
|
tablesFilter,
|
84901
|
-
force
|
85110
|
+
force,
|
85111
|
+
casing2
|
84902
85112
|
);
|
84903
|
-
} else if (
|
85113
|
+
} else if (dialect4 === "turso") {
|
84904
85114
|
const { libSQLPush: libSQLPush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
|
84905
85115
|
await libSQLPush2(
|
84906
85116
|
schemaPath,
|
@@ -84908,10 +85118,11 @@ var push = command({
|
|
84908
85118
|
strict,
|
84909
85119
|
credentials2,
|
84910
85120
|
tablesFilter,
|
84911
|
-
force
|
85121
|
+
force,
|
85122
|
+
casing2
|
84912
85123
|
);
|
84913
85124
|
} else {
|
84914
|
-
assertUnreachable(
|
85125
|
+
assertUnreachable(dialect4);
|
84915
85126
|
}
|
84916
85127
|
} catch (e2) {
|
84917
85128
|
console.error(e2);
|
@@ -84932,8 +85143,8 @@ var check = command({
|
|
84932
85143
|
},
|
84933
85144
|
handler: async (config) => {
|
84934
85145
|
await assertOrmCoreVersion();
|
84935
|
-
const { out, dialect:
|
84936
|
-
checkHandler(out,
|
85146
|
+
const { out, dialect: dialect4 } = config;
|
85147
|
+
checkHandler(out, dialect4);
|
84937
85148
|
console.log("Everything's fine \u{1F436}\u{1F525}");
|
84938
85149
|
}
|
84939
85150
|
});
|
@@ -84950,15 +85161,15 @@ var up = command({
|
|
84950
85161
|
},
|
84951
85162
|
handler: async (config) => {
|
84952
85163
|
await assertOrmCoreVersion();
|
84953
|
-
const { out, dialect:
|
85164
|
+
const { out, dialect: dialect4 } = config;
|
84954
85165
|
await assertPackages("drizzle-orm");
|
84955
|
-
if (
|
85166
|
+
if (dialect4 === "postgresql") {
|
84956
85167
|
upPgHandler(out);
|
84957
85168
|
}
|
84958
|
-
if (
|
85169
|
+
if (dialect4 === "mysql") {
|
84959
85170
|
upMysqlHandler(out);
|
84960
85171
|
}
|
84961
|
-
if (
|
85172
|
+
if (dialect4 === "sqlite" || dialect4 === "turso") {
|
84962
85173
|
upSqliteHandler(out);
|
84963
85174
|
}
|
84964
85175
|
}
|
@@ -85005,7 +85216,7 @@ var pull = command({
|
|
85005
85216
|
await assertPackages("drizzle-orm");
|
85006
85217
|
await assertOrmCoreVersion();
|
85007
85218
|
const {
|
85008
|
-
dialect:
|
85219
|
+
dialect: dialect4,
|
85009
85220
|
credentials: credentials2,
|
85010
85221
|
out,
|
85011
85222
|
casing: casing2,
|
@@ -85022,7 +85233,7 @@ var pull = command({
|
|
85022
85233
|
);
|
85023
85234
|
console.log();
|
85024
85235
|
try {
|
85025
|
-
if (
|
85236
|
+
if (dialect4 === "postgresql") {
|
85026
85237
|
if ("driver" in credentials2) {
|
85027
85238
|
const { driver: driver2 } = credentials2;
|
85028
85239
|
if (driver2 === "aws-data-api") {
|
@@ -85053,7 +85264,7 @@ var pull = command({
|
|
85053
85264
|
schemasFilter,
|
85054
85265
|
prefix2
|
85055
85266
|
);
|
85056
|
-
} else if (
|
85267
|
+
} else if (dialect4 === "mysql") {
|
85057
85268
|
const { introspectMysql: introspectMysql2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
|
85058
85269
|
await introspectMysql2(
|
85059
85270
|
casing2,
|
@@ -85063,7 +85274,7 @@ var pull = command({
|
|
85063
85274
|
tablesFilter,
|
85064
85275
|
prefix2
|
85065
85276
|
);
|
85066
|
-
} else if (
|
85277
|
+
} else if (dialect4 === "sqlite") {
|
85067
85278
|
const { introspectSqlite: introspectSqlite2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
|
85068
85279
|
await introspectSqlite2(
|
85069
85280
|
casing2,
|
@@ -85073,7 +85284,7 @@ var pull = command({
|
|
85073
85284
|
tablesFilter,
|
85074
85285
|
prefix2
|
85075
85286
|
);
|
85076
|
-
} else if (
|
85287
|
+
} else if (dialect4 === "turso") {
|
85077
85288
|
const { introspectLibSQL: introspectLibSQL2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
|
85078
85289
|
await introspectLibSQL2(
|
85079
85290
|
casing2,
|
@@ -85084,7 +85295,7 @@ var pull = command({
|
|
85084
85295
|
prefix2
|
85085
85296
|
);
|
85086
85297
|
} else {
|
85087
|
-
assertUnreachable(
|
85298
|
+
assertUnreachable(dialect4);
|
85088
85299
|
}
|
85089
85300
|
} catch (e2) {
|
85090
85301
|
console.error(e2);
|
@@ -85122,7 +85333,7 @@ var studio = command({
|
|
85122
85333
|
await assertPackages("drizzle-orm");
|
85123
85334
|
assertStudioNodeVersion();
|
85124
85335
|
const {
|
85125
|
-
dialect:
|
85336
|
+
dialect: dialect4,
|
85126
85337
|
schema: schemaPath,
|
85127
85338
|
port,
|
85128
85339
|
host,
|
@@ -85138,7 +85349,7 @@ var studio = command({
|
|
85138
85349
|
} = await Promise.resolve().then(() => (init_studio2(), studio_exports));
|
85139
85350
|
let setup;
|
85140
85351
|
try {
|
85141
|
-
if (
|
85352
|
+
if (dialect4 === "postgresql") {
|
85142
85353
|
if ("driver" in credentials2) {
|
85143
85354
|
const { driver: driver2 } = credentials2;
|
85144
85355
|
if (driver2 === "aws-data-api") {
|
@@ -85161,17 +85372,17 @@ var studio = command({
|
|
85161
85372
|
}
|
85162
85373
|
const { schema: schema5, relations: relations4, files } = schemaPath ? await preparePgSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
|
85163
85374
|
setup = await drizzleForPostgres2(credentials2, schema5, relations4, files);
|
85164
|
-
} else if (
|
85375
|
+
} else if (dialect4 === "mysql") {
|
85165
85376
|
const { schema: schema5, relations: relations4, files } = schemaPath ? await prepareMySqlSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
|
85166
85377
|
setup = await drizzleForMySQL2(credentials2, schema5, relations4, files);
|
85167
|
-
} else if (
|
85378
|
+
} else if (dialect4 === "sqlite") {
|
85168
85379
|
const { schema: schema5, relations: relations4, files } = schemaPath ? await prepareSQLiteSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
|
85169
85380
|
setup = await drizzleForSQLite2(credentials2, schema5, relations4, files);
|
85170
|
-
} else if (
|
85381
|
+
} else if (dialect4 === "turso") {
|
85171
85382
|
const { schema: schema5, relations: relations4, files } = schemaPath ? await prepareSQLiteSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
|
85172
85383
|
setup = await drizzleForLibSQL(credentials2, schema5, relations4, files);
|
85173
85384
|
} else {
|
85174
|
-
assertUnreachable(
|
85385
|
+
assertUnreachable(dialect4);
|
85175
85386
|
}
|
85176
85387
|
const { prepareServer: prepareServer2 } = await Promise.resolve().then(() => (init_studio2(), studio_exports));
|
85177
85388
|
const server = await prepareServer2(setup);
|
@@ -85222,7 +85433,7 @@ init_utils2();
|
|
85222
85433
|
var version2 = async () => {
|
85223
85434
|
const { npmVersion } = await ormCoreVersions();
|
85224
85435
|
const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
|
85225
|
-
const envVersion = "0.25.0-
|
85436
|
+
const envVersion = "0.25.0-1f15bfd";
|
85226
85437
|
const kitVersion = envVersion ? `v${envVersion}` : "--";
|
85227
85438
|
const versions = `drizzle-kit: ${kitVersion}
|
85228
85439
|
${ormVersion}`;
|