drizzle-kit 0.25.0-5a1c5d3 → 0.25.0-665fa03
Sign up to get free protection for your applications and to get access to all the features.
- package/api.d.mts +4 -85
- package/api.d.ts +4 -85
- package/api.js +14670 -88379
- package/api.mjs +14670 -88376
- package/bin.cjs +697 -1219
- 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 +14 -24
- package/utils.mjs +13 -24
package/bin.cjs
CHANGED
@@ -1315,11 +1315,6 @@ Is ${source_default.bold.blue(
|
|
1315
1315
|
count: 0,
|
1316
1316
|
name: "foreign keys",
|
1317
1317
|
status: "fetching"
|
1318
|
-
},
|
1319
|
-
checks: {
|
1320
|
-
count: 0,
|
1321
|
-
name: "check constraints",
|
1322
|
-
status: "fetching"
|
1323
1318
|
}
|
1324
1319
|
};
|
1325
1320
|
this.formatCount = (count) => {
|
@@ -1357,7 +1352,6 @@ Is ${source_default.bold.blue(
|
|
1357
1352
|
info2 += this.hasEnums ? this.statusText(spin, this.state.enums) : "";
|
1358
1353
|
info2 += this.statusText(spin, this.state.indexes);
|
1359
1354
|
info2 += this.statusText(spin, this.state.fks);
|
1360
|
-
info2 += this.statusText(spin, this.state.checks);
|
1361
1355
|
return info2;
|
1362
1356
|
}
|
1363
1357
|
};
|
@@ -5427,7 +5421,7 @@ var init_lib = __esm({
|
|
5427
5421
|
});
|
5428
5422
|
|
5429
5423
|
// src/serializer/mysqlSchema.ts
|
5430
|
-
var index, fk, column, tableV3, compositePK, uniqueConstraint,
|
5424
|
+
var index, fk, column, tableV3, compositePK, uniqueConstraint, tableV4, table, kitInternals, dialect, schemaHash, schemaInternalV3, schemaInternalV4, schemaInternalV5, schemaInternal, schemaV3, schemaV4, schemaV5, schema2, tableSquashedV4, tableSquashed, schemaSquashed, schemaSquashedV4, MySqlSquasher, squashMysqlScheme, mysqlSchema, mysqlSchemaV5, mysqlSchemaSquashed, backwardCompatibleMysqlSchema, dryMySql;
|
5431
5425
|
var init_mysqlSchema = __esm({
|
5432
5426
|
"src/serializer/mysqlSchema.ts"() {
|
5433
5427
|
"use strict";
|
@@ -5477,10 +5471,6 @@ var init_mysqlSchema = __esm({
|
|
5477
5471
|
name: stringType(),
|
5478
5472
|
columns: stringType().array()
|
5479
5473
|
}).strict();
|
5480
|
-
checkConstraint = objectType({
|
5481
|
-
name: stringType(),
|
5482
|
-
value: stringType()
|
5483
|
-
}).strict();
|
5484
5474
|
tableV4 = objectType({
|
5485
5475
|
name: stringType(),
|
5486
5476
|
schema: stringType().optional(),
|
@@ -5494,8 +5484,7 @@ var init_mysqlSchema = __esm({
|
|
5494
5484
|
indexes: recordType(stringType(), index),
|
5495
5485
|
foreignKeys: recordType(stringType(), fk),
|
5496
5486
|
compositePrimaryKeys: recordType(stringType(), compositePK),
|
5497
|
-
uniqueConstraints: recordType(stringType(), uniqueConstraint).default({})
|
5498
|
-
checkConstraint: recordType(stringType(), checkConstraint).default({})
|
5487
|
+
uniqueConstraints: recordType(stringType(), uniqueConstraint).default({})
|
5499
5488
|
}).strict();
|
5500
5489
|
kitInternals = objectType({
|
5501
5490
|
tables: recordType(
|
@@ -5572,8 +5561,7 @@ var init_mysqlSchema = __esm({
|
|
5572
5561
|
indexes: recordType(stringType(), stringType()),
|
5573
5562
|
foreignKeys: recordType(stringType(), stringType()),
|
5574
5563
|
compositePrimaryKeys: recordType(stringType(), stringType()),
|
5575
|
-
uniqueConstraints: recordType(stringType(), stringType()).default({})
|
5576
|
-
checkConstraints: recordType(stringType(), stringType()).default({})
|
5564
|
+
uniqueConstraints: recordType(stringType(), stringType()).default({})
|
5577
5565
|
}).strict();
|
5578
5566
|
schemaSquashed = objectType({
|
5579
5567
|
version: literalType("5"),
|
@@ -5640,13 +5628,6 @@ var init_mysqlSchema = __esm({
|
|
5640
5628
|
onDelete
|
5641
5629
|
});
|
5642
5630
|
return result;
|
5643
|
-
},
|
5644
|
-
squashCheck: (input) => {
|
5645
|
-
return `${input.name};${input.value}`;
|
5646
|
-
},
|
5647
|
-
unsquashCheck: (input) => {
|
5648
|
-
const [name, value] = input.split(";");
|
5649
|
-
return { name, value };
|
5650
5631
|
}
|
5651
5632
|
};
|
5652
5633
|
squashMysqlScheme = (json) => {
|
@@ -5667,9 +5648,6 @@ var init_mysqlSchema = __esm({
|
|
5667
5648
|
return MySqlSquasher.squashUnique(unq);
|
5668
5649
|
}
|
5669
5650
|
);
|
5670
|
-
const squashedCheckConstraints = mapValues(it[1].checkConstraint, (check2) => {
|
5671
|
-
return MySqlSquasher.squashCheck(check2);
|
5672
|
-
});
|
5673
5651
|
return [
|
5674
5652
|
it[0],
|
5675
5653
|
{
|
@@ -5678,8 +5656,7 @@ var init_mysqlSchema = __esm({
|
|
5678
5656
|
indexes: squashedIndexes,
|
5679
5657
|
foreignKeys: squashedFKs,
|
5680
5658
|
compositePrimaryKeys: squashedPKs,
|
5681
|
-
uniqueConstraints: squashedUniqueConstraints
|
5682
|
-
checkConstraints: squashedCheckConstraints
|
5659
|
+
uniqueConstraints: squashedUniqueConstraints
|
5683
5660
|
}
|
5684
5661
|
];
|
5685
5662
|
})
|
@@ -5729,7 +5706,7 @@ var init_vector = __esm({
|
|
5729
5706
|
});
|
5730
5707
|
|
5731
5708
|
// src/serializer/pgSchema.ts
|
5732
|
-
var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn, index2, indexV4, indexV5, indexV6, fk2, sequenceSchema, sequenceSquashed, columnV7, column2,
|
5709
|
+
var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn, index2, indexV4, indexV5, indexV6, fk2, sequenceSchema, sequenceSquashed, columnV7, column2, columnSquashed, tableV32, compositePK2, uniqueConstraint2, tableV42, tableV5, tableV6, tableV7, table2, schemaHash2, kitInternals2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaInternalV6, pgSchemaExternal, pgSchemaInternalV7, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashedV6, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchemaV6, pgSchemaV7, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg;
|
5733
5710
|
var init_pgSchema = __esm({
|
5734
5711
|
"src/serializer/pgSchema.ts"() {
|
5735
5712
|
"use strict";
|
@@ -5893,10 +5870,6 @@ var init_pgSchema = __esm({
|
|
5893
5870
|
}).optional(),
|
5894
5871
|
identity: sequenceSchema.merge(objectType({ type: enumType(["always", "byDefault"]) })).optional()
|
5895
5872
|
}).strict();
|
5896
|
-
checkConstraint2 = objectType({
|
5897
|
-
name: stringType(),
|
5898
|
-
value: stringType()
|
5899
|
-
}).strict();
|
5900
5873
|
columnSquashed = objectType({
|
5901
5874
|
name: stringType(),
|
5902
5875
|
type: stringType(),
|
@@ -5969,8 +5942,7 @@ var init_pgSchema = __esm({
|
|
5969
5942
|
indexes: recordType(stringType(), index2),
|
5970
5943
|
foreignKeys: recordType(stringType(), fk2),
|
5971
5944
|
compositePrimaryKeys: recordType(stringType(), compositePK2),
|
5972
|
-
uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
|
5973
|
-
checkConstraints: recordType(stringType(), checkConstraint2).default({})
|
5945
|
+
uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
|
5974
5946
|
}).strict();
|
5975
5947
|
schemaHash2 = objectType({
|
5976
5948
|
id: stringType(),
|
@@ -6078,8 +6050,7 @@ var init_pgSchema = __esm({
|
|
6078
6050
|
indexes: recordType(stringType(), stringType()),
|
6079
6051
|
foreignKeys: recordType(stringType(), stringType()),
|
6080
6052
|
compositePrimaryKeys: recordType(stringType(), stringType()),
|
6081
|
-
uniqueConstraints: recordType(stringType(), stringType())
|
6082
|
-
checkConstraints: recordType(stringType(), stringType())
|
6053
|
+
uniqueConstraints: recordType(stringType(), stringType())
|
6083
6054
|
}).strict();
|
6084
6055
|
tableSquashedV42 = objectType({
|
6085
6056
|
name: stringType(),
|
@@ -6261,16 +6232,6 @@ var init_pgSchema = __esm({
|
|
6261
6232
|
cache: splitted[6] !== "undefined" ? splitted[6] : void 0,
|
6262
6233
|
cycle: splitted[7] === "true"
|
6263
6234
|
};
|
6264
|
-
},
|
6265
|
-
squashCheck: (check2) => {
|
6266
|
-
return `${check2.name};${check2.value}`;
|
6267
|
-
},
|
6268
|
-
unsquashCheck: (input) => {
|
6269
|
-
const [
|
6270
|
-
name,
|
6271
|
-
value
|
6272
|
-
] = input.split(";");
|
6273
|
-
return { name, value };
|
6274
6235
|
}
|
6275
6236
|
};
|
6276
6237
|
squashPgScheme = (json, action) => {
|
@@ -6303,12 +6264,6 @@ var init_pgSchema = __esm({
|
|
6303
6264
|
return PgSquasher.squashUnique(unq);
|
6304
6265
|
}
|
6305
6266
|
);
|
6306
|
-
const squashedChecksContraints = mapValues(
|
6307
|
-
it[1].checkConstraints,
|
6308
|
-
(check2) => {
|
6309
|
-
return PgSquasher.squashCheck(check2);
|
6310
|
-
}
|
6311
|
-
);
|
6312
6267
|
return [
|
6313
6268
|
it[0],
|
6314
6269
|
{
|
@@ -6318,8 +6273,7 @@ var init_pgSchema = __esm({
|
|
6318
6273
|
indexes: squashedIndexes,
|
6319
6274
|
foreignKeys: squashedFKs,
|
6320
6275
|
compositePrimaryKeys: squashedPKs,
|
6321
|
-
uniqueConstraints: squashedUniqueConstraints
|
6322
|
-
checkConstraints: squashedChecksContraints
|
6276
|
+
uniqueConstraints: squashedUniqueConstraints
|
6323
6277
|
}
|
6324
6278
|
];
|
6325
6279
|
})
|
@@ -6364,7 +6318,7 @@ var init_pgSchema = __esm({
|
|
6364
6318
|
});
|
6365
6319
|
|
6366
6320
|
// src/serializer/sqliteSchema.ts
|
6367
|
-
var index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3,
|
6321
|
+
var index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3, table3, dialect2, schemaHash3, schemaInternalV32, schemaInternalV42, schemaInternalV52, kitInternals3, latestVersion, schemaInternal2, schemaV32, schemaV42, schemaV52, schema3, tableSquashed3, schemaSquashed2, SQLiteSquasher, squashSqliteScheme, drySQLite, sqliteSchemaV5, sqliteSchema, SQLiteSchemaSquashed, backwardCompatibleSqliteSchema;
|
6368
6322
|
var init_sqliteSchema = __esm({
|
6369
6323
|
"src/serializer/sqliteSchema.ts"() {
|
6370
6324
|
"use strict";
|
@@ -6411,18 +6365,13 @@ var init_sqliteSchema = __esm({
|
|
6411
6365
|
name: stringType(),
|
6412
6366
|
columns: stringType().array()
|
6413
6367
|
}).strict();
|
6414
|
-
checkConstraint3 = objectType({
|
6415
|
-
name: stringType(),
|
6416
|
-
value: stringType()
|
6417
|
-
}).strict();
|
6418
6368
|
table3 = objectType({
|
6419
6369
|
name: stringType(),
|
6420
6370
|
columns: recordType(stringType(), column3),
|
6421
6371
|
indexes: recordType(stringType(), index3),
|
6422
6372
|
foreignKeys: recordType(stringType(), fk3),
|
6423
6373
|
compositePrimaryKeys: recordType(stringType(), compositePK3),
|
6424
|
-
uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({})
|
6425
|
-
checkConstraints: recordType(stringType(), checkConstraint3).default({})
|
6374
|
+
uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({})
|
6426
6375
|
}).strict();
|
6427
6376
|
dialect2 = enumType(["sqlite"]);
|
6428
6377
|
schemaHash3 = objectType({
|
@@ -6484,8 +6433,7 @@ var init_sqliteSchema = __esm({
|
|
6484
6433
|
indexes: recordType(stringType(), stringType()),
|
6485
6434
|
foreignKeys: recordType(stringType(), stringType()),
|
6486
6435
|
compositePrimaryKeys: recordType(stringType(), stringType()),
|
6487
|
-
uniqueConstraints: recordType(stringType(), stringType()).default({})
|
6488
|
-
checkConstraints: recordType(stringType(), stringType()).default({})
|
6436
|
+
uniqueConstraints: recordType(stringType(), stringType()).default({})
|
6489
6437
|
}).strict();
|
6490
6438
|
schemaSquashed2 = objectType({
|
6491
6439
|
version: latestVersion,
|
@@ -6567,16 +6515,6 @@ var init_sqliteSchema = __esm({
|
|
6567
6515
|
},
|
6568
6516
|
unsquashPK: (pk) => {
|
6569
6517
|
return pk.split(",");
|
6570
|
-
},
|
6571
|
-
squashCheck: (check2) => {
|
6572
|
-
return `${check2.name};${check2.value}`;
|
6573
|
-
},
|
6574
|
-
unsquashCheck: (input) => {
|
6575
|
-
const [
|
6576
|
-
name,
|
6577
|
-
value
|
6578
|
-
] = input.split(";");
|
6579
|
-
return { name, value };
|
6580
6518
|
}
|
6581
6519
|
};
|
6582
6520
|
squashSqliteScheme = (json, action) => {
|
@@ -6603,12 +6541,6 @@ var init_sqliteSchema = __esm({
|
|
6603
6541
|
return SQLiteSquasher.squashUnique(unq);
|
6604
6542
|
}
|
6605
6543
|
);
|
6606
|
-
const squashedCheckConstraints = mapValues(
|
6607
|
-
it[1].checkConstraints,
|
6608
|
-
(check2) => {
|
6609
|
-
return SQLiteSquasher.squashCheck(check2);
|
6610
|
-
}
|
6611
|
-
);
|
6612
6544
|
return [
|
6613
6545
|
it[0],
|
6614
6546
|
{
|
@@ -6617,8 +6549,7 @@ var init_sqliteSchema = __esm({
|
|
6617
6549
|
indexes: squashedIndexes,
|
6618
6550
|
foreignKeys: squashedFKs,
|
6619
6551
|
compositePrimaryKeys: squashedPKs,
|
6620
|
-
uniqueConstraints: squashedUniqueConstraints
|
6621
|
-
checkConstraints: squashedCheckConstraints
|
6552
|
+
uniqueConstraints: squashedUniqueConstraints
|
6622
6553
|
}
|
6623
6554
|
];
|
6624
6555
|
})
|
@@ -6660,11 +6591,17 @@ function findAddedAndRemoved(columnNames1, columnNames2) {
|
|
6660
6591
|
const removedColumns = columnNames1.filter((it) => !set2.has(it));
|
6661
6592
|
return { addedColumns, removedColumns };
|
6662
6593
|
}
|
6663
|
-
|
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;
|
6664
6600
|
var init_utils = __esm({
|
6665
6601
|
"src/utils.ts"() {
|
6666
6602
|
"use strict";
|
6667
6603
|
init_source();
|
6604
|
+
import_casing = require("drizzle-orm/casing");
|
6668
6605
|
import_fs = require("fs");
|
6669
6606
|
import_path = require("path");
|
6670
6607
|
import_url = require("url");
|
@@ -6694,27 +6631,27 @@ var init_utils = __esm({
|
|
6694
6631
|
process.exit(1);
|
6695
6632
|
}
|
6696
6633
|
};
|
6697
|
-
dryJournal = (
|
6634
|
+
dryJournal = (dialect4) => {
|
6698
6635
|
return {
|
6699
6636
|
version: snapshotVersion,
|
6700
|
-
dialect:
|
6637
|
+
dialect: dialect4,
|
6701
6638
|
entries: []
|
6702
6639
|
};
|
6703
6640
|
};
|
6704
|
-
prepareOutFolder = (out,
|
6641
|
+
prepareOutFolder = (out, dialect4) => {
|
6705
6642
|
const meta = (0, import_path.join)(out, "meta");
|
6706
6643
|
const journalPath = (0, import_path.join)(meta, "_journal.json");
|
6707
6644
|
if (!(0, import_fs.existsSync)((0, import_path.join)(out, "meta"))) {
|
6708
6645
|
(0, import_fs.mkdirSync)(meta, { recursive: true });
|
6709
|
-
(0, import_fs.writeFileSync)(journalPath, JSON.stringify(dryJournal(
|
6646
|
+
(0, import_fs.writeFileSync)(journalPath, JSON.stringify(dryJournal(dialect4)));
|
6710
6647
|
}
|
6711
6648
|
const journal = JSON.parse((0, import_fs.readFileSync)(journalPath).toString());
|
6712
6649
|
const snapshots = (0, import_fs.readdirSync)(meta).filter((it) => !it.startsWith("_")).map((it) => (0, import_path.join)(meta, it));
|
6713
6650
|
snapshots.sort();
|
6714
6651
|
return { meta, snapshots, journal };
|
6715
6652
|
};
|
6716
|
-
validatorForDialect = (
|
6717
|
-
switch (
|
6653
|
+
validatorForDialect = (dialect4) => {
|
6654
|
+
switch (dialect4) {
|
6718
6655
|
case "postgresql":
|
6719
6656
|
return { validator: backwardCompatiblePgSchema, version: 7 };
|
6720
6657
|
case "sqlite":
|
@@ -6725,8 +6662,8 @@ var init_utils = __esm({
|
|
6725
6662
|
return { validator: backwardCompatibleMysqlSchema, version: 5 };
|
6726
6663
|
}
|
6727
6664
|
};
|
6728
|
-
validateWithReport = (snapshots,
|
6729
|
-
const { validator: validator2, version: version3 } = validatorForDialect(
|
6665
|
+
validateWithReport = (snapshots, dialect4) => {
|
6666
|
+
const { validator: validator2, version: version3 } = validatorForDialect(dialect4);
|
6730
6667
|
const result = snapshots.reduce(
|
6731
6668
|
(accum, it) => {
|
6732
6669
|
const raw2 = JSON.parse((0, import_fs.readFileSync)(`./${it}`).toString());
|
@@ -6767,9 +6704,9 @@ var init_utils = __esm({
|
|
6767
6704
|
);
|
6768
6705
|
return result;
|
6769
6706
|
};
|
6770
|
-
prepareMigrationFolder = (outFolder = "drizzle",
|
6771
|
-
const { snapshots, journal } = prepareOutFolder(outFolder,
|
6772
|
-
const report = validateWithReport(snapshots,
|
6707
|
+
prepareMigrationFolder = (outFolder = "drizzle", dialect4) => {
|
6708
|
+
const { snapshots, journal } = prepareOutFolder(outFolder, dialect4);
|
6709
|
+
const report = validateWithReport(snapshots, dialect4);
|
6773
6710
|
if (report.nonLatest.length > 0) {
|
6774
6711
|
console.log(
|
6775
6712
|
report.nonLatest.map((it) => {
|
@@ -11319,7 +11256,7 @@ var init_outputs = __esm({
|
|
11319
11256
|
});
|
11320
11257
|
|
11321
11258
|
// src/cli/validations/common.ts
|
11322
|
-
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;
|
11323
11260
|
var init_common = __esm({
|
11324
11261
|
"src/cli/validations/common.ts"() {
|
11325
11262
|
"use strict";
|
@@ -11363,6 +11300,8 @@ var init_common = __esm({
|
|
11363
11300
|
{
|
11364
11301
|
const _2 = "";
|
11365
11302
|
}
|
11303
|
+
casingTypes = ["snake_case", "camelCase"];
|
11304
|
+
casingType = enumType(casingTypes);
|
11366
11305
|
sqliteDriver = unionType(sqliteDriversLiterals);
|
11367
11306
|
postgresDriver = unionType(postgresqlDriversLiterals);
|
11368
11307
|
driver = unionType([sqliteDriver, postgresDriver]);
|
@@ -11381,7 +11320,8 @@ var init_common = __esm({
|
|
11381
11320
|
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
11382
11321
|
schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
|
11383
11322
|
migrations: configMigrations,
|
11384
|
-
dbCredentials: anyType().optional()
|
11323
|
+
dbCredentials: anyType().optional(),
|
11324
|
+
casing: casingType.optional()
|
11385
11325
|
}).passthrough();
|
11386
11326
|
casing = unionType([literalType("camel"), literalType("preserve")]).default(
|
11387
11327
|
"camel"
|
@@ -11463,6 +11403,7 @@ var init_cli = __esm({
|
|
11463
11403
|
}).strict();
|
11464
11404
|
pushParams = objectType({
|
11465
11405
|
dialect: dialect3,
|
11406
|
+
casing: casingType.optional(),
|
11466
11407
|
schema: unionType([stringType(), stringType().array()]),
|
11467
11408
|
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
11468
11409
|
schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
|
@@ -17479,11 +17420,11 @@ var init_utils4 = __esm({
|
|
17479
17420
|
prepareGenerateConfig = async (options, from) => {
|
17480
17421
|
var _a;
|
17481
17422
|
const config = from === "config" ? await drizzleConfigFromFile(options.config) : options;
|
17482
|
-
const { schema: schema5, out, breakpoints, dialect:
|
17483
|
-
if (!schema5 || !
|
17423
|
+
const { schema: schema5, out, breakpoints, dialect: dialect4, driver: driver2, casing: casing2 } = config;
|
17424
|
+
if (!schema5 || !dialect4) {
|
17484
17425
|
console.log(error("Please provide required params:"));
|
17485
17426
|
console.log(wrapParam("schema", schema5));
|
17486
|
-
console.log(wrapParam("dialect",
|
17427
|
+
console.log(wrapParam("dialect", dialect4));
|
17487
17428
|
console.log(wrapParam("out", out, true));
|
17488
17429
|
process.exit(1);
|
17489
17430
|
}
|
@@ -17494,14 +17435,15 @@ var init_utils4 = __esm({
|
|
17494
17435
|
}
|
17495
17436
|
const prefix2 = ("migrations" in config ? (_a = config.migrations) == null ? void 0 : _a.prefix : options.prefix) || "index";
|
17496
17437
|
return {
|
17497
|
-
dialect:
|
17438
|
+
dialect: dialect4,
|
17498
17439
|
name: options.name,
|
17499
17440
|
custom: options.custom || false,
|
17500
17441
|
prefix: prefix2,
|
17501
17442
|
breakpoints: breakpoints || true,
|
17502
17443
|
schema: schema5,
|
17503
17444
|
out: out || "drizzle",
|
17504
|
-
bundle: driver2 === "expo"
|
17445
|
+
bundle: driver2 === "expo",
|
17446
|
+
casing: casing2
|
17505
17447
|
};
|
17506
17448
|
};
|
17507
17449
|
flattenDatabaseCredentials = (config) => {
|
@@ -17568,6 +17510,7 @@ var init_utils4 = __esm({
|
|
17568
17510
|
verbose: config.verbose ?? false,
|
17569
17511
|
force: options.force ?? false,
|
17570
17512
|
credentials: parsed2.data,
|
17513
|
+
casing: config.casing,
|
17571
17514
|
tablesFilter,
|
17572
17515
|
schemasFilter
|
17573
17516
|
};
|
@@ -17585,6 +17528,7 @@ var init_utils4 = __esm({
|
|
17585
17528
|
verbose: config.verbose ?? false,
|
17586
17529
|
force: options.force ?? false,
|
17587
17530
|
credentials: parsed2.data,
|
17531
|
+
casing: config.casing,
|
17588
17532
|
tablesFilter,
|
17589
17533
|
schemasFilter
|
17590
17534
|
};
|
@@ -17602,6 +17546,7 @@ var init_utils4 = __esm({
|
|
17602
17546
|
verbose: config.verbose ?? false,
|
17603
17547
|
force: options.force ?? false,
|
17604
17548
|
credentials: parsed2.data,
|
17549
|
+
casing: config.casing,
|
17605
17550
|
tablesFilter,
|
17606
17551
|
schemasFilter
|
17607
17552
|
};
|
@@ -17619,6 +17564,7 @@ var init_utils4 = __esm({
|
|
17619
17564
|
verbose: config.verbose ?? false,
|
17620
17565
|
force: options.force ?? false,
|
17621
17566
|
credentials: parsed2.data,
|
17567
|
+
casing: config.casing,
|
17622
17568
|
tablesFilter,
|
17623
17569
|
schemasFilter
|
17624
17570
|
};
|
@@ -17637,11 +17583,11 @@ var init_utils4 = __esm({
|
|
17637
17583
|
process.exit(1);
|
17638
17584
|
}
|
17639
17585
|
const config = parsed.data;
|
17640
|
-
const
|
17586
|
+
const dialect4 = config.dialect;
|
17641
17587
|
const tablesFilterConfig = config.tablesFilter;
|
17642
17588
|
const tablesFilter = tablesFilterConfig ? typeof tablesFilterConfig === "string" ? [tablesFilterConfig] : tablesFilterConfig : [];
|
17643
17589
|
if (config.extensionsFilters) {
|
17644
|
-
if (config.extensionsFilters.includes("postgis") &&
|
17590
|
+
if (config.extensionsFilters.includes("postgis") && dialect4 === "postgresql") {
|
17645
17591
|
tablesFilter.push(
|
17646
17592
|
...["!geography_columns", "!geometry_columns", "!spatial_ref_sys"]
|
17647
17593
|
);
|
@@ -17649,7 +17595,7 @@ var init_utils4 = __esm({
|
|
17649
17595
|
}
|
17650
17596
|
const schemasFilterConfig = config.schemaFilter;
|
17651
17597
|
const schemasFilter = schemasFilterConfig ? typeof schemasFilterConfig === "string" ? [schemasFilterConfig] : schemasFilterConfig : [];
|
17652
|
-
if (
|
17598
|
+
if (dialect4 === "postgresql") {
|
17653
17599
|
const parsed2 = postgresCredentials.safeParse(config);
|
17654
17600
|
if (!parsed2.success) {
|
17655
17601
|
printConfigConnectionIssues3(config);
|
@@ -17666,7 +17612,7 @@ var init_utils4 = __esm({
|
|
17666
17612
|
prefix: ((_a = config.migrations) == null ? void 0 : _a.prefix) || "index"
|
17667
17613
|
};
|
17668
17614
|
}
|
17669
|
-
if (
|
17615
|
+
if (dialect4 === "mysql") {
|
17670
17616
|
const parsed2 = mysqlCredentials.safeParse(config);
|
17671
17617
|
if (!parsed2.success) {
|
17672
17618
|
printConfigConnectionIssues2(config);
|
@@ -17683,7 +17629,7 @@ var init_utils4 = __esm({
|
|
17683
17629
|
prefix: ((_b = config.migrations) == null ? void 0 : _b.prefix) || "index"
|
17684
17630
|
};
|
17685
17631
|
}
|
17686
|
-
if (
|
17632
|
+
if (dialect4 === "sqlite") {
|
17687
17633
|
const parsed2 = sqliteCredentials.safeParse(config);
|
17688
17634
|
if (!parsed2.success) {
|
17689
17635
|
printConfigConnectionIssues4(config, "pull");
|
@@ -17700,14 +17646,14 @@ var init_utils4 = __esm({
|
|
17700
17646
|
prefix: ((_c = config.migrations) == null ? void 0 : _c.prefix) || "index"
|
17701
17647
|
};
|
17702
17648
|
}
|
17703
|
-
if (
|
17649
|
+
if (dialect4 === "turso") {
|
17704
17650
|
const parsed2 = libSQLCredentials.safeParse(config);
|
17705
17651
|
if (!parsed2.success) {
|
17706
17652
|
printConfigConnectionIssues(config, "pull");
|
17707
17653
|
process.exit(1);
|
17708
17654
|
}
|
17709
17655
|
return {
|
17710
|
-
dialect:
|
17656
|
+
dialect: dialect4,
|
17711
17657
|
out: config.out,
|
17712
17658
|
breakpoints: config.breakpoints,
|
17713
17659
|
casing: config.casing,
|
@@ -17717,7 +17663,7 @@ var init_utils4 = __esm({
|
|
17717
17663
|
prefix: ((_d = config.migrations) == null ? void 0 : _d.prefix) || "index"
|
17718
17664
|
};
|
17719
17665
|
}
|
17720
|
-
assertUnreachable(
|
17666
|
+
assertUnreachable(dialect4);
|
17721
17667
|
};
|
17722
17668
|
prepareStudioConfig = async (options) => {
|
17723
17669
|
const params = studioCliParams.parse(options);
|
@@ -17734,9 +17680,9 @@ var init_utils4 = __esm({
|
|
17734
17680
|
process.exit(1);
|
17735
17681
|
}
|
17736
17682
|
const { host, port } = params;
|
17737
|
-
const { dialect:
|
17683
|
+
const { dialect: dialect4, schema: schema5 } = result.data;
|
17738
17684
|
const flattened = flattenDatabaseCredentials(config);
|
17739
|
-
if (
|
17685
|
+
if (dialect4 === "postgresql") {
|
17740
17686
|
const parsed = postgresCredentials.safeParse(flattened);
|
17741
17687
|
if (!parsed.success) {
|
17742
17688
|
printConfigConnectionIssues3(flattened);
|
@@ -17744,14 +17690,14 @@ var init_utils4 = __esm({
|
|
17744
17690
|
}
|
17745
17691
|
const credentials2 = parsed.data;
|
17746
17692
|
return {
|
17747
|
-
dialect:
|
17693
|
+
dialect: dialect4,
|
17748
17694
|
schema: schema5,
|
17749
17695
|
host,
|
17750
17696
|
port,
|
17751
17697
|
credentials: credentials2
|
17752
17698
|
};
|
17753
17699
|
}
|
17754
|
-
if (
|
17700
|
+
if (dialect4 === "mysql") {
|
17755
17701
|
const parsed = mysqlCredentials.safeParse(flattened);
|
17756
17702
|
if (!parsed.success) {
|
17757
17703
|
printConfigConnectionIssues2(flattened);
|
@@ -17759,14 +17705,14 @@ var init_utils4 = __esm({
|
|
17759
17705
|
}
|
17760
17706
|
const credentials2 = parsed.data;
|
17761
17707
|
return {
|
17762
|
-
dialect:
|
17708
|
+
dialect: dialect4,
|
17763
17709
|
schema: schema5,
|
17764
17710
|
host,
|
17765
17711
|
port,
|
17766
17712
|
credentials: credentials2
|
17767
17713
|
};
|
17768
17714
|
}
|
17769
|
-
if (
|
17715
|
+
if (dialect4 === "sqlite") {
|
17770
17716
|
const parsed = sqliteCredentials.safeParse(flattened);
|
17771
17717
|
if (!parsed.success) {
|
17772
17718
|
printConfigConnectionIssues4(flattened, "studio");
|
@@ -17774,14 +17720,14 @@ var init_utils4 = __esm({
|
|
17774
17720
|
}
|
17775
17721
|
const credentials2 = parsed.data;
|
17776
17722
|
return {
|
17777
|
-
dialect:
|
17723
|
+
dialect: dialect4,
|
17778
17724
|
schema: schema5,
|
17779
17725
|
host,
|
17780
17726
|
port,
|
17781
17727
|
credentials: credentials2
|
17782
17728
|
};
|
17783
17729
|
}
|
17784
|
-
if (
|
17730
|
+
if (dialect4 === "turso") {
|
17785
17731
|
const parsed = libSQLCredentials.safeParse(flattened);
|
17786
17732
|
if (!parsed.success) {
|
17787
17733
|
printConfigConnectionIssues(flattened, "studio");
|
@@ -17789,14 +17735,14 @@ var init_utils4 = __esm({
|
|
17789
17735
|
}
|
17790
17736
|
const credentials2 = parsed.data;
|
17791
17737
|
return {
|
17792
|
-
dialect:
|
17738
|
+
dialect: dialect4,
|
17793
17739
|
schema: schema5,
|
17794
17740
|
host,
|
17795
17741
|
port,
|
17796
17742
|
credentials: credentials2
|
17797
17743
|
};
|
17798
17744
|
}
|
17799
|
-
assertUnreachable(
|
17745
|
+
assertUnreachable(dialect4);
|
17800
17746
|
};
|
17801
17747
|
migrateConfig = objectType({
|
17802
17748
|
dialect: dialect3,
|
@@ -17811,10 +17757,10 @@ var init_utils4 = __esm({
|
|
17811
17757
|
console.log(wrapParam("dialect", config.dialect));
|
17812
17758
|
process.exit(1);
|
17813
17759
|
}
|
17814
|
-
const { dialect:
|
17760
|
+
const { dialect: dialect4, out } = parsed.data;
|
17815
17761
|
const { schema: schema5, table: table4 } = parsed.data.migrations || {};
|
17816
17762
|
const flattened = flattenDatabaseCredentials(config);
|
17817
|
-
if (
|
17763
|
+
if (dialect4 === "postgresql") {
|
17818
17764
|
const parsed2 = postgresCredentials.safeParse(flattened);
|
17819
17765
|
if (!parsed2.success) {
|
17820
17766
|
printConfigConnectionIssues3(flattened);
|
@@ -17822,14 +17768,14 @@ var init_utils4 = __esm({
|
|
17822
17768
|
}
|
17823
17769
|
const credentials2 = parsed2.data;
|
17824
17770
|
return {
|
17825
|
-
dialect:
|
17771
|
+
dialect: dialect4,
|
17826
17772
|
out,
|
17827
17773
|
credentials: credentials2,
|
17828
17774
|
schema: schema5,
|
17829
17775
|
table: table4
|
17830
17776
|
};
|
17831
17777
|
}
|
17832
|
-
if (
|
17778
|
+
if (dialect4 === "mysql") {
|
17833
17779
|
const parsed2 = mysqlCredentials.safeParse(flattened);
|
17834
17780
|
if (!parsed2.success) {
|
17835
17781
|
printConfigConnectionIssues2(flattened);
|
@@ -17837,14 +17783,14 @@ var init_utils4 = __esm({
|
|
17837
17783
|
}
|
17838
17784
|
const credentials2 = parsed2.data;
|
17839
17785
|
return {
|
17840
|
-
dialect:
|
17786
|
+
dialect: dialect4,
|
17841
17787
|
out,
|
17842
17788
|
credentials: credentials2,
|
17843
17789
|
schema: schema5,
|
17844
17790
|
table: table4
|
17845
17791
|
};
|
17846
17792
|
}
|
17847
|
-
if (
|
17793
|
+
if (dialect4 === "sqlite") {
|
17848
17794
|
const parsed2 = sqliteCredentials.safeParse(flattened);
|
17849
17795
|
if (!parsed2.success) {
|
17850
17796
|
printConfigConnectionIssues4(flattened, "migrate");
|
@@ -17852,14 +17798,14 @@ var init_utils4 = __esm({
|
|
17852
17798
|
}
|
17853
17799
|
const credentials2 = parsed2.data;
|
17854
17800
|
return {
|
17855
|
-
dialect:
|
17801
|
+
dialect: dialect4,
|
17856
17802
|
out,
|
17857
17803
|
credentials: credentials2,
|
17858
17804
|
schema: schema5,
|
17859
17805
|
table: table4
|
17860
17806
|
};
|
17861
17807
|
}
|
17862
|
-
if (
|
17808
|
+
if (dialect4 === "turso") {
|
17863
17809
|
const parsed2 = libSQLCredentials.safeParse(flattened);
|
17864
17810
|
if (!parsed2.success) {
|
17865
17811
|
printConfigConnectionIssues(flattened, "migrate");
|
@@ -17867,14 +17813,14 @@ var init_utils4 = __esm({
|
|
17867
17813
|
}
|
17868
17814
|
const credentials2 = parsed2.data;
|
17869
17815
|
return {
|
17870
|
-
dialect:
|
17816
|
+
dialect: dialect4,
|
17871
17817
|
out,
|
17872
17818
|
credentials: credentials2,
|
17873
17819
|
schema: schema5,
|
17874
17820
|
table: table4
|
17875
17821
|
};
|
17876
17822
|
}
|
17877
|
-
assertUnreachable(
|
17823
|
+
assertUnreachable(dialect4);
|
17878
17824
|
};
|
17879
17825
|
drizzleConfigFromFile = async (configPath) => {
|
17880
17826
|
const prefix2 = process.env.TEST_CONFIG_PATH_PREFIX || "";
|
@@ -17903,6 +17849,7 @@ var init_utils4 = __esm({
|
|
17903
17849
|
unregister();
|
17904
17850
|
const res = configCommonSchema.safeParse(content);
|
17905
17851
|
if (!res.success) {
|
17852
|
+
console.log(res.error);
|
17906
17853
|
if (!("dialect" in content)) {
|
17907
17854
|
console.log(error("Please specify 'dialect' param in config file"));
|
17908
17855
|
}
|
@@ -17975,7 +17922,7 @@ function clearDefaults(defaultValue, collate) {
|
|
17975
17922
|
return `(${resultDefault})`;
|
17976
17923
|
}
|
17977
17924
|
}
|
17978
|
-
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;
|
17979
17926
|
var init_mysqlSerializer = __esm({
|
17980
17927
|
"src/serializer/mysqlSerializer.ts"() {
|
17981
17928
|
"use strict";
|
@@ -17985,12 +17932,13 @@ var init_mysqlSerializer = __esm({
|
|
17985
17932
|
import_mysql_core2 = require("drizzle-orm/mysql-core");
|
17986
17933
|
import_mysql_core3 = require("drizzle-orm/mysql-core");
|
17987
17934
|
init_outputs();
|
17935
|
+
init_utils();
|
17988
17936
|
init_serializer();
|
17989
|
-
dialect4 = new import_mysql_core2.MySqlDialect();
|
17990
17937
|
indexName = (tableName, columns) => {
|
17991
17938
|
return `${tableName}_${columns.join("_")}_index`;
|
17992
17939
|
};
|
17993
|
-
generateMySqlSnapshot = (tables) => {
|
17940
|
+
generateMySqlSnapshot = (tables, casing2) => {
|
17941
|
+
const dialect4 = new import_mysql_core2.MySqlDialect({ casing: casing2 });
|
17994
17942
|
const result = {};
|
17995
17943
|
const internal = { tables: {}, indexes: {} };
|
17996
17944
|
for (const table4 of tables) {
|
@@ -18000,7 +17948,6 @@ var init_mysqlSerializer = __esm({
|
|
18000
17948
|
indexes,
|
18001
17949
|
foreignKeys,
|
18002
17950
|
schema: schema5,
|
18003
|
-
checks,
|
18004
17951
|
primaryKeys,
|
18005
17952
|
uniqueConstraints
|
18006
17953
|
} = (0, import_mysql_core3.getTableConfig)(table4);
|
@@ -18009,15 +17956,14 @@ var init_mysqlSerializer = __esm({
|
|
18009
17956
|
const foreignKeysObject = {};
|
18010
17957
|
const primaryKeysObject = {};
|
18011
17958
|
const uniqueConstraintObject = {};
|
18012
|
-
const checkConstraintObject = {};
|
18013
|
-
let checksInTable = {};
|
18014
17959
|
columns.forEach((column7) => {
|
17960
|
+
const name = getColumnCasing(column7, casing2);
|
18015
17961
|
const notNull = column7.notNull;
|
18016
17962
|
const sqlTypeLowered = column7.getSQLType().toLowerCase();
|
18017
17963
|
const autoIncrement = typeof column7.autoIncrement === "undefined" ? false : column7.autoIncrement;
|
18018
17964
|
const generated = column7.generated;
|
18019
17965
|
const columnToSet = {
|
18020
|
-
name
|
17966
|
+
name,
|
18021
17967
|
type: column7.getSQLType(),
|
18022
17968
|
primaryKey: false,
|
18023
17969
|
// If field is autoincrement it's notNull by default
|
@@ -18031,9 +17977,9 @@ var init_mysqlSerializer = __esm({
|
|
18031
17977
|
} : void 0
|
18032
17978
|
};
|
18033
17979
|
if (column7.primary) {
|
18034
|
-
primaryKeysObject[`${tableName}_${
|
18035
|
-
name: `${tableName}_${
|
18036
|
-
columns: [
|
17980
|
+
primaryKeysObject[`${tableName}_${name}`] = {
|
17981
|
+
name: `${tableName}_${name}`,
|
17982
|
+
columns: [name]
|
18037
17983
|
};
|
18038
17984
|
}
|
18039
17985
|
if (column7.isUnique) {
|
@@ -18047,7 +17993,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18047
17993
|
The unique constraint ${source_default.underline.blue(
|
18048
17994
|
column7.uniqueName
|
18049
17995
|
)} on the ${source_default.underline.blue(
|
18050
|
-
|
17996
|
+
name
|
18051
17997
|
)} column is confilcting with a unique constraint name already defined for ${source_default.underline.blue(
|
18052
17998
|
existingUnique.columns.join(",")
|
18053
17999
|
)} columns
|
@@ -18062,7 +18008,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18062
18008
|
}
|
18063
18009
|
if (column7.default !== void 0) {
|
18064
18010
|
if ((0, import_drizzle_orm2.is)(column7.default, import_drizzle_orm3.SQL)) {
|
18065
|
-
columnToSet.default = sqlToStr(column7.default);
|
18011
|
+
columnToSet.default = sqlToStr(column7.default, casing2);
|
18066
18012
|
} else {
|
18067
18013
|
if (typeof column7.default === "string") {
|
18068
18014
|
columnToSet.default = `'${column7.default}'`;
|
@@ -18084,20 +18030,27 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18084
18030
|
}
|
18085
18031
|
}
|
18086
18032
|
}
|
18087
|
-
columnsObject[
|
18033
|
+
columnsObject[name] = columnToSet;
|
18088
18034
|
});
|
18089
18035
|
primaryKeys.map((pk) => {
|
18090
|
-
const
|
18091
|
-
|
18092
|
-
|
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,
|
18093
18046
|
columns: columnNames
|
18094
18047
|
};
|
18095
18048
|
for (const column7 of pk.columns) {
|
18096
|
-
columnsObject[column7
|
18049
|
+
columnsObject[getColumnCasing(column7, casing2)].notNull = true;
|
18097
18050
|
}
|
18098
18051
|
});
|
18099
18052
|
uniqueConstraints == null ? void 0 : uniqueConstraints.map((unq) => {
|
18100
|
-
const columnNames = unq.columns.map((c) => c
|
18053
|
+
const columnNames = unq.columns.map((c) => getColumnCasing(c, casing2));
|
18101
18054
|
const name = unq.name ?? (0, import_mysql_core2.uniqueKeyName)(table4, columnNames);
|
18102
18055
|
const existingUnique = uniqueConstraintObject[name];
|
18103
18056
|
if (typeof existingUnique !== "undefined") {
|
@@ -18125,15 +18078,25 @@ The unique constraint ${source_default.underline.blue(
|
|
18125
18078
|
};
|
18126
18079
|
});
|
18127
18080
|
const fks = foreignKeys.map((fk4) => {
|
18128
|
-
const name = fk4.getName();
|
18129
18081
|
const tableFrom = tableName;
|
18130
18082
|
const onDelete = fk4.onDelete ?? "no action";
|
18131
18083
|
const onUpdate = fk4.onUpdate ?? "no action";
|
18132
18084
|
const reference = fk4.reference();
|
18133
18085
|
const referenceFT = reference.foreignTable;
|
18134
18086
|
const tableTo = (0, import_drizzle_orm2.getTableName)(referenceFT);
|
18135
|
-
const
|
18136
|
-
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
|
+
}
|
18137
18100
|
return {
|
18138
18101
|
name,
|
18139
18102
|
tableFrom,
|
@@ -18173,7 +18136,7 @@ The unique constraint ${source_default.underline.blue(
|
|
18173
18136
|
}
|
18174
18137
|
return sql;
|
18175
18138
|
} else {
|
18176
|
-
return `${it
|
18139
|
+
return `${getColumnCasing(it, casing2)}`;
|
18177
18140
|
}
|
18178
18141
|
});
|
18179
18142
|
if (value.config.unique) {
|
@@ -18224,32 +18187,6 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
18224
18187
|
lock: value.config.lock
|
18225
18188
|
};
|
18226
18189
|
});
|
18227
|
-
checks.forEach((check2) => {
|
18228
|
-
check2;
|
18229
|
-
const checkName = check2.name;
|
18230
|
-
if (typeof checksInTable[tableName] !== "undefined") {
|
18231
|
-
if (checksInTable[tableName].includes(check2.name)) {
|
18232
|
-
console.log(
|
18233
|
-
`
|
18234
|
-
${withStyle.errorWarning(
|
18235
|
-
`We've found duplicated check constraint name in ${source_default.underline.blue(
|
18236
|
-
tableName
|
18237
|
-
)}. Please rename your check constraint in the ${source_default.underline.blue(
|
18238
|
-
tableName
|
18239
|
-
)} table`
|
18240
|
-
)}`
|
18241
|
-
);
|
18242
|
-
process.exit(1);
|
18243
|
-
}
|
18244
|
-
checksInTable[tableName].push(checkName);
|
18245
|
-
} else {
|
18246
|
-
checksInTable[tableName] = [check2.name];
|
18247
|
-
}
|
18248
|
-
checkConstraintObject[checkName] = {
|
18249
|
-
name: checkName,
|
18250
|
-
value: dialect4.sqlToQuery(check2.value).sql
|
18251
|
-
};
|
18252
|
-
});
|
18253
18190
|
if (!schema5) {
|
18254
18191
|
result[tableName] = {
|
18255
18192
|
name: tableName,
|
@@ -18257,8 +18194,7 @@ ${withStyle.errorWarning(
|
|
18257
18194
|
indexes: indexesObject,
|
18258
18195
|
foreignKeys: foreignKeysObject,
|
18259
18196
|
compositePrimaryKeys: primaryKeysObject,
|
18260
|
-
uniqueConstraints: uniqueConstraintObject
|
18261
|
-
checkConstraint: checkConstraintObject
|
18197
|
+
uniqueConstraints: uniqueConstraintObject
|
18262
18198
|
};
|
18263
18199
|
}
|
18264
18200
|
}
|
@@ -18285,7 +18221,6 @@ ${withStyle.errorWarning(
|
|
18285
18221
|
let tablesCount = /* @__PURE__ */ new Set();
|
18286
18222
|
let indexesCount = 0;
|
18287
18223
|
let foreignKeysCount = 0;
|
18288
|
-
let checksCount = 0;
|
18289
18224
|
const idxs = await db.query(
|
18290
18225
|
`select * from INFORMATION_SCHEMA.STATISTICS
|
18291
18226
|
WHERE INFORMATION_SCHEMA.STATISTICS.TABLE_SCHEMA = '${inputSchema}' and INFORMATION_SCHEMA.STATISTICS.INDEX_NAME != 'PRIMARY';`
|
@@ -18381,8 +18316,7 @@ ${withStyle.errorWarning(
|
|
18381
18316
|
compositePrimaryKeys: {},
|
18382
18317
|
indexes: {},
|
18383
18318
|
foreignKeys: {},
|
18384
|
-
uniqueConstraints: {}
|
18385
|
-
checkConstraint: {}
|
18319
|
+
uniqueConstraints: {}
|
18386
18320
|
};
|
18387
18321
|
} else {
|
18388
18322
|
result[tableName].columns[columnName] = newColumn;
|
@@ -18533,38 +18467,6 @@ ${withStyle.errorWarning(
|
|
18533
18467
|
progressCallback("indexes", indexesCount, "done");
|
18534
18468
|
progressCallback("enums", 0, "done");
|
18535
18469
|
}
|
18536
|
-
const checkConstraints = await db.query(
|
18537
|
-
`SELECT
|
18538
|
-
tc.table_name,
|
18539
|
-
tc.constraint_name,
|
18540
|
-
cc.check_clause
|
18541
|
-
FROM
|
18542
|
-
information_schema.table_constraints tc
|
18543
|
-
JOIN
|
18544
|
-
information_schema.check_constraints cc
|
18545
|
-
ON tc.constraint_name = cc.constraint_name
|
18546
|
-
WHERE
|
18547
|
-
tc.constraint_schema = '${inputSchema}'
|
18548
|
-
AND
|
18549
|
-
tc.constraint_type = 'CHECK';`
|
18550
|
-
);
|
18551
|
-
checksCount += checkConstraints.length;
|
18552
|
-
if (progressCallback) {
|
18553
|
-
progressCallback("checks", checksCount, "fetching");
|
18554
|
-
}
|
18555
|
-
for (const checkConstraintRow of checkConstraints) {
|
18556
|
-
const constraintName = checkConstraintRow["CONSTRAINT_NAME"];
|
18557
|
-
const constraintValue = checkConstraintRow["CHECK_CLAUSE"];
|
18558
|
-
const tableName = checkConstraintRow["TABLE_NAME"];
|
18559
|
-
const tableInResult = result[tableName];
|
18560
|
-
tableInResult.checkConstraint[constraintName] = {
|
18561
|
-
name: constraintName,
|
18562
|
-
value: constraintValue
|
18563
|
-
};
|
18564
|
-
}
|
18565
|
-
if (progressCallback) {
|
18566
|
-
progressCallback("checks", checksCount, "done");
|
18567
|
-
}
|
18568
18470
|
return {
|
18569
18471
|
version: "5",
|
18570
18472
|
dialect: "mysql",
|
@@ -18679,7 +18581,7 @@ function buildArrayString(array, sqlType) {
|
|
18679
18581
|
}).join(",");
|
18680
18582
|
return `{${values}}`;
|
18681
18583
|
}
|
18682
|
-
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;
|
18683
18585
|
var init_pgSerializer = __esm({
|
18684
18586
|
"src/serializer/pgSerializer.ts"() {
|
18685
18587
|
"use strict";
|
@@ -18691,17 +18593,16 @@ var init_pgSerializer = __esm({
|
|
18691
18593
|
init_outputs();
|
18692
18594
|
init_utils();
|
18693
18595
|
init_serializer();
|
18694
|
-
dialect5 = new import_pg_core2.PgDialect();
|
18695
18596
|
indexName2 = (tableName, columns) => {
|
18696
18597
|
return `${tableName}_${columns.join("_")}_index`;
|
18697
18598
|
};
|
18698
|
-
generatePgSnapshot = (tables, enums, schemas, sequences, schemaFilter) => {
|
18599
|
+
generatePgSnapshot = (tables, enums, schemas, sequences, casing2, schemaFilter) => {
|
18699
18600
|
var _a, _b, _c, _d, _e, _f;
|
18601
|
+
const dialect4 = new import_pg_core2.PgDialect({ casing: casing2 });
|
18700
18602
|
const result = {};
|
18701
18603
|
const sequencesToReturn = {};
|
18702
18604
|
const indexesInSchema = {};
|
18703
18605
|
for (const table4 of tables) {
|
18704
|
-
const checksInTable = {};
|
18705
18606
|
const {
|
18706
18607
|
name: tableName,
|
18707
18608
|
columns,
|
@@ -18717,12 +18618,12 @@ var init_pgSerializer = __esm({
|
|
18717
18618
|
}
|
18718
18619
|
const columnsObject = {};
|
18719
18620
|
const indexesObject = {};
|
18720
|
-
const checksObject = {};
|
18721
18621
|
const foreignKeysObject = {};
|
18722
18622
|
const primaryKeysObject = {};
|
18723
18623
|
const uniqueConstraintObject = {};
|
18724
18624
|
columns.forEach((column7) => {
|
18725
18625
|
var _a2, _b2, _c2, _d2, _e2, _f2;
|
18626
|
+
const name = getColumnCasing(column7, casing2);
|
18726
18627
|
const notNull = column7.notNull;
|
18727
18628
|
const primaryKey = column7.primary;
|
18728
18629
|
const sqlTypeLowered = column7.getSQLType().toLowerCase();
|
@@ -18735,18 +18636,18 @@ var init_pgSerializer = __esm({
|
|
18735
18636
|
const startWith = stringFromIdentityProperty((_d2 = identity == null ? void 0 : identity.sequenceOptions) == null ? void 0 : _d2.startWith) ?? (parseFloat(increment) < 0 ? maxValue : minValue);
|
18736
18637
|
const cache = stringFromIdentityProperty((_e2 = identity == null ? void 0 : identity.sequenceOptions) == null ? void 0 : _e2.cache) ?? "1";
|
18737
18638
|
const columnToSet = {
|
18738
|
-
name
|
18639
|
+
name,
|
18739
18640
|
type: column7.getSQLType(),
|
18740
18641
|
typeSchema,
|
18741
18642
|
primaryKey,
|
18742
18643
|
notNull,
|
18743
18644
|
generated: generated ? {
|
18744
|
-
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,
|
18745
18646
|
type: "stored"
|
18746
18647
|
} : void 0,
|
18747
18648
|
identity: identity ? {
|
18748
18649
|
type: identity.type,
|
18749
|
-
name: identity.sequenceName ?? `${tableName}_${
|
18650
|
+
name: identity.sequenceName ?? `${tableName}_${name}_seq`,
|
18750
18651
|
schema: schema5 ?? "public",
|
18751
18652
|
increment,
|
18752
18653
|
startWith,
|
@@ -18767,7 +18668,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18767
18668
|
The unique constraint ${source_default.underline.blue(
|
18768
18669
|
column7.uniqueName
|
18769
18670
|
)} on the ${source_default.underline.blue(
|
18770
|
-
|
18671
|
+
name
|
18771
18672
|
)} column is confilcting with a unique constraint name already defined for ${source_default.underline.blue(
|
18772
18673
|
existingUnique.columns.join(",")
|
18773
18674
|
)} columns
|
@@ -18783,7 +18684,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18783
18684
|
}
|
18784
18685
|
if (column7.default !== void 0) {
|
18785
18686
|
if ((0, import_drizzle_orm5.is)(column7.default, import_drizzle_orm5.SQL)) {
|
18786
|
-
columnToSet.default = sqlToStr(column7.default);
|
18687
|
+
columnToSet.default = sqlToStr(column7.default, casing2);
|
18787
18688
|
} else {
|
18788
18689
|
if (typeof column7.default === "string") {
|
18789
18690
|
columnToSet.default = `'${column7.default}'`;
|
@@ -18811,17 +18712,24 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18811
18712
|
}
|
18812
18713
|
}
|
18813
18714
|
}
|
18814
|
-
columnsObject[
|
18715
|
+
columnsObject[name] = columnToSet;
|
18815
18716
|
});
|
18816
18717
|
primaryKeys.map((pk) => {
|
18817
|
-
const
|
18818
|
-
|
18819
|
-
|
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,
|
18820
18728
|
columns: columnNames
|
18821
18729
|
};
|
18822
18730
|
});
|
18823
18731
|
uniqueConstraints == null ? void 0 : uniqueConstraints.map((unq) => {
|
18824
|
-
const columnNames = unq.columns.map((c) => c
|
18732
|
+
const columnNames = unq.columns.map((c) => getColumnCasing(c, casing2));
|
18825
18733
|
const name = unq.name ?? (0, import_pg_core2.uniqueKeyName)(table4, columnNames);
|
18826
18734
|
const existingUnique = uniqueConstraintObject[name];
|
18827
18735
|
if (typeof existingUnique !== "undefined") {
|
@@ -18848,15 +18756,25 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18848
18756
|
};
|
18849
18757
|
});
|
18850
18758
|
const fks = foreignKeys.map((fk4) => {
|
18851
|
-
const name = fk4.getName();
|
18852
18759
|
const tableFrom = tableName;
|
18853
18760
|
const onDelete = fk4.onDelete;
|
18854
18761
|
const onUpdate = fk4.onUpdate;
|
18855
18762
|
const reference = fk4.reference();
|
18856
18763
|
const tableTo = (0, import_drizzle_orm5.getTableName)(reference.foreignTable);
|
18857
18764
|
const schemaTo = (0, import_pg_core3.getTableConfig)(reference.foreignTable).schema;
|
18858
|
-
const
|
18859
|
-
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
|
+
}
|
18860
18778
|
return {
|
18861
18779
|
name,
|
18862
18780
|
tableFrom,
|
@@ -18882,19 +18800,20 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18882
18800
|
${withStyle.errorWarning(
|
18883
18801
|
`Please specify an index name in ${(0, import_drizzle_orm5.getTableName)(
|
18884
18802
|
value.config.table
|
18885
|
-
)} 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.`
|
18886
18804
|
)}`
|
18887
18805
|
);
|
18888
18806
|
process.exit(1);
|
18889
18807
|
}
|
18890
18808
|
}
|
18891
18809
|
it = it;
|
18810
|
+
const name2 = getColumnCasing(it, casing2);
|
18892
18811
|
if (!(0, import_drizzle_orm5.is)(it, import_drizzle_orm5.SQL) && it.type === "PgVector" && typeof it.indexConfig.opClass === "undefined") {
|
18893
18812
|
console.log(
|
18894
18813
|
`
|
18895
18814
|
${withStyle.errorWarning(
|
18896
18815
|
`You are specifying an index on the ${source_default.blueBright(
|
18897
|
-
|
18816
|
+
name2
|
18898
18817
|
)} column inside the ${source_default.blueBright(
|
18899
18818
|
tableName
|
18900
18819
|
)} table with the ${source_default.blueBright(
|
@@ -18904,7 +18823,7 @@ ${withStyle.errorWarning(
|
|
18904
18823
|
)}].
|
18905
18824
|
|
18906
18825
|
You can specify it using current syntax: ${source_default.underline(
|
18907
|
-
`index("${value.config.name}").using("${value.config.method}", table.${
|
18826
|
+
`index("${value.config.name}").using("${value.config.method}", table.${name2}.op("${vectorOps[0]}"))`
|
18908
18827
|
)}
|
18909
18828
|
|
18910
18829
|
You can check the "pg_vector" docs for more info: https://github.com/pgvector/pgvector?tab=readme-ov-file#indexing
|
@@ -18913,7 +18832,7 @@ You can check the "pg_vector" docs for more info: https://github.com/pgvector/pg
|
|
18913
18832
|
);
|
18914
18833
|
process.exit(1);
|
18915
18834
|
}
|
18916
|
-
indexColumnNames.push(
|
18835
|
+
indexColumnNames.push(name2);
|
18917
18836
|
});
|
18918
18837
|
const name = value.config.name ? value.config.name : indexName2(tableName, indexColumnNames);
|
18919
18838
|
let indexColumns = columns2.map(
|
@@ -18921,7 +18840,7 @@ You can check the "pg_vector" docs for more info: https://github.com/pgvector/pg
|
|
18921
18840
|
var _a2, _b2, _c2, _d2, _e2;
|
18922
18841
|
if ((0, import_drizzle_orm5.is)(it, import_drizzle_orm5.SQL)) {
|
18923
18842
|
return {
|
18924
|
-
expression:
|
18843
|
+
expression: dialect4.sqlToQuery(it, "indexes").sql,
|
18925
18844
|
asc: true,
|
18926
18845
|
isExpression: true,
|
18927
18846
|
nulls: "last"
|
@@ -18929,7 +18848,7 @@ You can check the "pg_vector" docs for more info: https://github.com/pgvector/pg
|
|
18929
18848
|
} else {
|
18930
18849
|
it = it;
|
18931
18850
|
return {
|
18932
|
-
expression: it
|
18851
|
+
expression: getColumnCasing(it, casing2),
|
18933
18852
|
isExpression: false,
|
18934
18853
|
asc: ((_a2 = it.indexConfig) == null ? void 0 : _a2.order) === "asc",
|
18935
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",
|
@@ -18960,39 +18879,12 @@ ${withStyle.errorWarning(
|
|
18960
18879
|
name,
|
18961
18880
|
columns: indexColumns,
|
18962
18881
|
isUnique: value.config.unique ?? false,
|
18963
|
-
where: value.config.where ?
|
18882
|
+
where: value.config.where ? dialect4.sqlToQuery(value.config.where).sql : void 0,
|
18964
18883
|
concurrently: value.config.concurrently ?? false,
|
18965
18884
|
method: value.config.method ?? "btree",
|
18966
18885
|
with: value.config.with ?? {}
|
18967
18886
|
};
|
18968
18887
|
});
|
18969
|
-
checks.forEach((check2) => {
|
18970
|
-
const checkName = check2.name;
|
18971
|
-
if (typeof checksInTable[`"${schema5 ?? "public"}"."${tableName}"`] !== "undefined") {
|
18972
|
-
if (checksInTable[`"${schema5 ?? "public"}"."${tableName}"`].includes(check2.name)) {
|
18973
|
-
console.log(
|
18974
|
-
`
|
18975
|
-
${withStyle.errorWarning(
|
18976
|
-
`We've found duplicated check constraint name across ${source_default.underline.blue(
|
18977
|
-
schema5 ?? "public"
|
18978
|
-
)} schema in ${source_default.underline.blue(
|
18979
|
-
tableName
|
18980
|
-
)}. Please rename your check constraint in either the ${source_default.underline.blue(
|
18981
|
-
tableName
|
18982
|
-
)} table or the table with the duplicated check contraint name`
|
18983
|
-
)}`
|
18984
|
-
);
|
18985
|
-
process.exit(1);
|
18986
|
-
}
|
18987
|
-
checksInTable[`"${schema5 ?? "public"}"."${tableName}"`].push(checkName);
|
18988
|
-
} else {
|
18989
|
-
checksInTable[`"${schema5 ?? "public"}"."${tableName}"`] = [check2.name];
|
18990
|
-
}
|
18991
|
-
checksObject[checkName] = {
|
18992
|
-
name: checkName,
|
18993
|
-
value: dialect5.sqlToQuery(check2.value).sql
|
18994
|
-
};
|
18995
|
-
});
|
18996
18888
|
const tableKey2 = `${schema5 ?? "public"}.${tableName}`;
|
18997
18889
|
result[tableKey2] = {
|
18998
18890
|
name: tableName,
|
@@ -19001,8 +18893,7 @@ ${withStyle.errorWarning(
|
|
19001
18893
|
indexes: indexesObject,
|
19002
18894
|
foreignKeys: foreignKeysObject,
|
19003
18895
|
compositePrimaryKeys: primaryKeysObject,
|
19004
|
-
uniqueConstraints: uniqueConstraintObject
|
19005
|
-
checkConstraints: checksObject
|
18896
|
+
uniqueConstraints: uniqueConstraintObject
|
19006
18897
|
};
|
19007
18898
|
}
|
19008
18899
|
for (const sequence of sequences) {
|
@@ -19093,7 +18984,6 @@ ${withStyle.errorWarning(
|
|
19093
18984
|
let indexesCount = 0;
|
19094
18985
|
let foreignKeysCount = 0;
|
19095
18986
|
let tableCount = 0;
|
19096
|
-
let checksCount = 0;
|
19097
18987
|
const sequencesToReturn = {};
|
19098
18988
|
const seqWhere = schemaFilters.map((t2) => `schemaname = '${t2}'`).join(" or ");
|
19099
18989
|
const allSequences = await db.query(
|
@@ -19165,8 +19055,7 @@ ${withStyle.errorWarning(
|
|
19165
19055
|
const indexToReturn = {};
|
19166
19056
|
const foreignKeysToReturn = {};
|
19167
19057
|
const primaryKeys = {};
|
19168
|
-
const
|
19169
|
-
const checkConstraints = {};
|
19058
|
+
const uniqueConstrains = {};
|
19170
19059
|
const tableResponse = await db.query(
|
19171
19060
|
`SELECT a.attrelid::regclass::text, a.attname, is_nullable, a.attndims as array_dimensions
|
19172
19061
|
, CASE WHEN a.atttypid = ANY ('{int,int8,int2}'::regtype[])
|
@@ -19204,97 +19093,55 @@ ${withStyle.errorWarning(
|
|
19204
19093
|
ORDER BY a.attnum;`
|
19205
19094
|
);
|
19206
19095
|
const tableConstraints = await db.query(
|
19207
|
-
`SELECT c.column_name,
|
19208
|
-
|
19209
|
-
|
19210
|
-
|
19211
|
-
|
19212
|
-
|
19213
|
-
FROM information_schema.table_constraints tc
|
19214
|
-
JOIN information_schema.constraint_column_usage AS ccu
|
19215
|
-
USING (constraint_schema, constraint_name)
|
19216
|
-
JOIN information_schema.columns AS c
|
19217
|
-
ON c.table_schema = tc.constraint_schema
|
19218
|
-
AND tc.table_name = c.table_name
|
19219
|
-
AND ccu.column_name = c.column_name
|
19220
|
-
JOIN pg_constraint con
|
19221
|
-
ON con.conname = tc.constraint_name
|
19222
|
-
AND con.conrelid = (
|
19223
|
-
SELECT oid
|
19224
|
-
FROM pg_class
|
19225
|
-
WHERE relname = tc.table_name
|
19226
|
-
AND relnamespace = (
|
19227
|
-
SELECT oid
|
19228
|
-
FROM pg_namespace
|
19229
|
-
WHERE nspname = tc.constraint_schema
|
19230
|
-
)
|
19231
|
-
)
|
19232
|
-
WHERE tc.table_name = '${tableName}' AND tc.constraint_schema = '${tableSchema}';`
|
19096
|
+
`SELECT c.column_name, c.data_type, constraint_type, constraint_name, constraint_schema
|
19097
|
+
FROM information_schema.table_constraints tc
|
19098
|
+
JOIN information_schema.constraint_column_usage AS ccu USING (constraint_schema, constraint_name)
|
19099
|
+
JOIN information_schema.columns AS c ON c.table_schema = tc.constraint_schema
|
19100
|
+
AND tc.table_name = c.table_name AND ccu.column_name = c.column_name
|
19101
|
+
WHERE tc.table_name = '${tableName}' and constraint_schema = '${tableSchema}';`
|
19233
19102
|
);
|
19234
|
-
const tableChecks = await db.query(`SELECT
|
19235
|
-
tc.constraint_name,
|
19236
|
-
tc.constraint_type,
|
19237
|
-
pg_get_constraintdef(con.oid) AS constraint_definition
|
19238
|
-
FROM
|
19239
|
-
information_schema.table_constraints AS tc
|
19240
|
-
JOIN pg_constraint AS con
|
19241
|
-
ON tc.constraint_name = con.conname
|
19242
|
-
AND con.conrelid = (
|
19243
|
-
SELECT oid
|
19244
|
-
FROM pg_class
|
19245
|
-
WHERE relname = tc.table_name
|
19246
|
-
AND relnamespace = (
|
19247
|
-
SELECT oid
|
19248
|
-
FROM pg_namespace
|
19249
|
-
WHERE nspname = tc.constraint_schema
|
19250
|
-
)
|
19251
|
-
)
|
19252
|
-
WHERE
|
19253
|
-
tc.table_name = '${tableName}'
|
19254
|
-
AND tc.constraint_schema = '${tableSchema}'
|
19255
|
-
AND tc.constraint_type = 'CHECK';`);
|
19256
19103
|
columnsCount += tableResponse.length;
|
19257
19104
|
if (progressCallback) {
|
19258
19105
|
progressCallback("columns", columnsCount, "fetching");
|
19259
19106
|
}
|
19260
19107
|
const tableForeignKeys = await db.query(
|
19261
19108
|
`SELECT
|
19262
|
-
|
19263
|
-
|
19264
|
-
|
19265
|
-
|
19266
|
-
|
19267
|
-
|
19268
|
-
|
19269
|
-
|
19270
|
-
|
19271
|
-
|
19272
|
-
|
19273
|
-
|
19274
|
-
|
19275
|
-
|
19276
|
-
|
19277
|
-
|
19278
|
-
|
19279
|
-
|
19280
|
-
|
19281
|
-
|
19282
|
-
|
19283
|
-
|
19284
|
-
|
19285
|
-
|
19286
|
-
|
19287
|
-
|
19288
|
-
|
19289
|
-
|
19290
|
-
|
19291
|
-
|
19292
|
-
|
19293
|
-
|
19294
|
-
|
19295
|
-
|
19296
|
-
|
19297
|
-
|
19109
|
+
con.contype AS constraint_type,
|
19110
|
+
nsp.nspname AS constraint_schema,
|
19111
|
+
con.conname AS constraint_name,
|
19112
|
+
rel.relname AS table_name,
|
19113
|
+
att.attname AS column_name,
|
19114
|
+
fnsp.nspname AS foreign_table_schema,
|
19115
|
+
frel.relname AS foreign_table_name,
|
19116
|
+
fatt.attname AS foreign_column_name,
|
19117
|
+
CASE con.confupdtype
|
19118
|
+
WHEN 'a' THEN 'NO ACTION'
|
19119
|
+
WHEN 'r' THEN 'RESTRICT'
|
19120
|
+
WHEN 'n' THEN 'SET NULL'
|
19121
|
+
WHEN 'c' THEN 'CASCADE'
|
19122
|
+
WHEN 'd' THEN 'SET DEFAULT'
|
19123
|
+
END AS update_rule,
|
19124
|
+
CASE con.confdeltype
|
19125
|
+
WHEN 'a' THEN 'NO ACTION'
|
19126
|
+
WHEN 'r' THEN 'RESTRICT'
|
19127
|
+
WHEN 'n' THEN 'SET NULL'
|
19128
|
+
WHEN 'c' THEN 'CASCADE'
|
19129
|
+
WHEN 'd' THEN 'SET DEFAULT'
|
19130
|
+
END AS delete_rule
|
19131
|
+
FROM
|
19132
|
+
pg_catalog.pg_constraint con
|
19133
|
+
JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid
|
19134
|
+
JOIN pg_catalog.pg_namespace nsp ON nsp.oid = con.connamespace
|
19135
|
+
LEFT JOIN pg_catalog.pg_attribute att ON att.attnum = ANY (con.conkey)
|
19136
|
+
AND att.attrelid = con.conrelid
|
19137
|
+
LEFT JOIN pg_catalog.pg_class frel ON frel.oid = con.confrelid
|
19138
|
+
LEFT JOIN pg_catalog.pg_namespace fnsp ON fnsp.oid = frel.relnamespace
|
19139
|
+
LEFT JOIN pg_catalog.pg_attribute fatt ON fatt.attnum = ANY (con.confkey)
|
19140
|
+
AND fatt.attrelid = con.confrelid
|
19141
|
+
WHERE
|
19142
|
+
nsp.nspname = '${tableSchema}'
|
19143
|
+
AND rel.relname = '${tableName}'
|
19144
|
+
AND con.contype IN ('f');`
|
19298
19145
|
);
|
19299
19146
|
foreignKeysCount += tableForeignKeys.length;
|
19300
19147
|
if (progressCallback) {
|
@@ -19336,29 +19183,16 @@ ${withStyle.errorWarning(
|
|
19336
19183
|
for (const unqs of uniqueConstrainsRows) {
|
19337
19184
|
const columnName = unqs.column_name;
|
19338
19185
|
const constraintName = unqs.constraint_name;
|
19339
|
-
if (typeof
|
19340
|
-
|
19186
|
+
if (typeof uniqueConstrains[constraintName] !== "undefined") {
|
19187
|
+
uniqueConstrains[constraintName].columns.push(columnName);
|
19341
19188
|
} else {
|
19342
|
-
|
19189
|
+
uniqueConstrains[constraintName] = {
|
19343
19190
|
columns: [columnName],
|
19344
19191
|
nullsNotDistinct: false,
|
19345
19192
|
name: constraintName
|
19346
19193
|
};
|
19347
19194
|
}
|
19348
19195
|
}
|
19349
|
-
checksCount += tableChecks.length;
|
19350
|
-
if (progressCallback) {
|
19351
|
-
progressCallback("checks", checksCount, "fetching");
|
19352
|
-
}
|
19353
|
-
for (const checks of tableChecks) {
|
19354
|
-
let checkValue = checks.constraint_definition;
|
19355
|
-
const constraintName = checks.constraint_name;
|
19356
|
-
checkValue = checkValue.replace(/^CHECK\s*\(\(/, "").replace(/\)\)\s*$/, "");
|
19357
|
-
checkConstraints[constraintName] = {
|
19358
|
-
name: constraintName,
|
19359
|
-
value: checkValue
|
19360
|
-
};
|
19361
|
-
}
|
19362
19196
|
for (const columnResponse of tableResponse) {
|
19363
19197
|
const columnName = columnResponse.attname;
|
19364
19198
|
const columnAdditionalDT = columnResponse.additional_dt;
|
@@ -19483,7 +19317,7 @@ ${withStyle.errorWarning(
|
|
19483
19317
|
schema: tableSchema
|
19484
19318
|
} : void 0
|
19485
19319
|
};
|
19486
|
-
if (identityName) {
|
19320
|
+
if (identityName && typeof identityName === "string") {
|
19487
19321
|
delete sequencesToReturn[`${tableSchema}.${identityName.startsWith('"') && identityName.endsWith('"') ? identityName.slice(1, -1) : identityName}`];
|
19488
19322
|
delete sequencesToReturn[identityName];
|
19489
19323
|
}
|
@@ -19603,8 +19437,7 @@ ${withStyle.errorWarning(
|
|
19603
19437
|
indexes: indexToReturn,
|
19604
19438
|
foreignKeys: foreignKeysToReturn,
|
19605
19439
|
compositePrimaryKeys: primaryKeys,
|
19606
|
-
uniqueConstraints
|
19607
|
-
checkConstraints
|
19440
|
+
uniqueConstraints: uniqueConstrains
|
19608
19441
|
};
|
19609
19442
|
} catch (e2) {
|
19610
19443
|
rej(e2);
|
@@ -19622,7 +19455,6 @@ ${withStyle.errorWarning(
|
|
19622
19455
|
progressCallback("columns", columnsCount, "done");
|
19623
19456
|
progressCallback("indexes", indexesCount, "done");
|
19624
19457
|
progressCallback("fks", foreignKeysCount, "done");
|
19625
|
-
progressCallback("checks", checksCount, "done");
|
19626
19458
|
}
|
19627
19459
|
const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
|
19628
19460
|
return {
|
@@ -19816,7 +19648,7 @@ function extractGeneratedColumns(input) {
|
|
19816
19648
|
}
|
19817
19649
|
return columns;
|
19818
19650
|
}
|
19819
|
-
var import_drizzle_orm7, import_sqlite_core2,
|
19651
|
+
var import_drizzle_orm7, import_sqlite_core2, generateSqliteSnapshot, fromDatabase3;
|
19820
19652
|
var init_sqliteSerializer = __esm({
|
19821
19653
|
"src/serializer/sqliteSerializer.ts"() {
|
19822
19654
|
"use strict";
|
@@ -19824,9 +19656,10 @@ var init_sqliteSerializer = __esm({
|
|
19824
19656
|
import_drizzle_orm7 = require("drizzle-orm");
|
19825
19657
|
import_sqlite_core2 = require("drizzle-orm/sqlite-core");
|
19826
19658
|
init_outputs();
|
19659
|
+
init_utils();
|
19827
19660
|
init_serializer();
|
19828
|
-
|
19829
|
-
|
19661
|
+
generateSqliteSnapshot = (tables, casing2) => {
|
19662
|
+
const dialect4 = new import_sqlite_core2.SQLiteSyncDialect({ casing: casing2 });
|
19830
19663
|
const result = {};
|
19831
19664
|
const internal = { indexes: {} };
|
19832
19665
|
for (const table4 of tables) {
|
@@ -19835,40 +19668,38 @@ var init_sqliteSerializer = __esm({
|
|
19835
19668
|
const foreignKeysObject = {};
|
19836
19669
|
const primaryKeysObject = {};
|
19837
19670
|
const uniqueConstraintObject = {};
|
19838
|
-
const checkConstraintObject = {};
|
19839
|
-
const checksInTable = {};
|
19840
19671
|
const {
|
19841
19672
|
name: tableName,
|
19842
19673
|
columns,
|
19843
19674
|
indexes,
|
19844
|
-
checks,
|
19845
19675
|
foreignKeys: tableForeignKeys,
|
19846
19676
|
primaryKeys,
|
19847
19677
|
uniqueConstraints
|
19848
19678
|
} = (0, import_sqlite_core2.getTableConfig)(table4);
|
19849
19679
|
columns.forEach((column7) => {
|
19680
|
+
const name = getColumnCasing(column7, casing2);
|
19850
19681
|
const notNull = column7.notNull;
|
19851
19682
|
const primaryKey = column7.primary;
|
19852
19683
|
const generated = column7.generated;
|
19853
19684
|
const columnToSet = {
|
19854
|
-
name
|
19685
|
+
name,
|
19855
19686
|
type: column7.getSQLType(),
|
19856
19687
|
primaryKey,
|
19857
19688
|
notNull,
|
19858
19689
|
autoincrement: (0, import_drizzle_orm7.is)(column7, import_sqlite_core2.SQLiteBaseInteger) ? column7.autoIncrement : false,
|
19859
19690
|
generated: generated ? {
|
19860
|
-
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})`,
|
19861
19692
|
type: generated.mode ?? "virtual"
|
19862
19693
|
} : void 0
|
19863
19694
|
};
|
19864
19695
|
if (column7.default !== void 0) {
|
19865
19696
|
if ((0, import_drizzle_orm7.is)(column7.default, import_drizzle_orm7.SQL)) {
|
19866
|
-
columnToSet.default = sqlToStr(column7.default);
|
19697
|
+
columnToSet.default = sqlToStr(column7.default, casing2);
|
19867
19698
|
} else {
|
19868
19699
|
columnToSet.default = typeof column7.default === "string" ? `'${column7.default}'` : typeof column7.default === "object" || Array.isArray(column7.default) ? `'${JSON.stringify(column7.default)}'` : column7.default;
|
19869
19700
|
}
|
19870
19701
|
}
|
19871
|
-
columnsObject[
|
19702
|
+
columnsObject[name] = columnToSet;
|
19872
19703
|
if (column7.isUnique) {
|
19873
19704
|
const existingUnique = indexesObject[column7.uniqueName];
|
19874
19705
|
if (typeof existingUnique !== "undefined") {
|
@@ -19880,7 +19711,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
19880
19711
|
The unique constraint ${source_default.underline.blue(
|
19881
19712
|
column7.uniqueName
|
19882
19713
|
)} on the ${source_default.underline.blue(
|
19883
|
-
|
19714
|
+
name
|
19884
19715
|
)} column is confilcting with a unique constraint name already defined for ${source_default.underline.blue(
|
19885
19716
|
existingUnique.columns.join(",")
|
19886
19717
|
)} columns
|
@@ -19896,15 +19727,25 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
19896
19727
|
}
|
19897
19728
|
});
|
19898
19729
|
const foreignKeys = tableForeignKeys.map((fk4) => {
|
19899
|
-
const name = fk4.getName();
|
19900
19730
|
const tableFrom = tableName;
|
19901
19731
|
const onDelete = fk4.onDelete ?? "no action";
|
19902
19732
|
const onUpdate = fk4.onUpdate ?? "no action";
|
19903
19733
|
const reference = fk4.reference();
|
19904
19734
|
const referenceFT = reference.foreignTable;
|
19905
19735
|
const tableTo = (0, import_drizzle_orm7.getTableName)(referenceFT);
|
19906
|
-
const
|
19907
|
-
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
|
+
}
|
19908
19749
|
return {
|
19909
19750
|
name,
|
19910
19751
|
tableFrom,
|
@@ -19924,7 +19765,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
19924
19765
|
let indexColumns = columns2.map((it) => {
|
19925
19766
|
var _a;
|
19926
19767
|
if ((0, import_drizzle_orm7.is)(it, import_drizzle_orm7.SQL)) {
|
19927
|
-
const sql =
|
19768
|
+
const sql = dialect4.sqlToQuery(it, "indexes").sql;
|
19928
19769
|
if (typeof internal.indexes[name] === "undefined") {
|
19929
19770
|
internal.indexes[name] = {
|
19930
19771
|
columns: {
|
@@ -19944,13 +19785,13 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
19944
19785
|
}
|
19945
19786
|
return sql;
|
19946
19787
|
} else {
|
19947
|
-
return it
|
19788
|
+
return getColumnCasing(it, casing2);
|
19948
19789
|
}
|
19949
19790
|
});
|
19950
19791
|
let where = void 0;
|
19951
19792
|
if (value.config.where !== void 0) {
|
19952
19793
|
if ((0, import_drizzle_orm7.is)(value.config.where, import_drizzle_orm7.SQL)) {
|
19953
|
-
where =
|
19794
|
+
where = dialect4.sqlToQuery(value.config.where).sql;
|
19954
19795
|
}
|
19955
19796
|
}
|
19956
19797
|
indexesObject[name] = {
|
@@ -19961,7 +19802,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
19961
19802
|
};
|
19962
19803
|
});
|
19963
19804
|
uniqueConstraints == null ? void 0 : uniqueConstraints.map((unq) => {
|
19964
|
-
const columnNames = unq.columns.map((c) => c
|
19805
|
+
const columnNames = unq.columns.map((c) => getColumnCasing(c, casing2));
|
19965
19806
|
const name = unq.name ?? (0, import_sqlite_core2.uniqueKeyName)(table4, columnNames);
|
19966
19807
|
const existingUnique = indexesObject[name];
|
19967
19808
|
if (typeof existingUnique !== "undefined") {
|
@@ -19991,38 +19832,21 @@ The unique constraint ${source_default.underline.blue(
|
|
19991
19832
|
});
|
19992
19833
|
primaryKeys.forEach((it) => {
|
19993
19834
|
if (it.columns.length > 1) {
|
19994
|
-
|
19995
|
-
|
19996
|
-
|
19997
|
-
|
19998
|
-
|
19999
|
-
|
20000
|
-
|
20001
|
-
});
|
20002
|
-
checks.forEach((check2) => {
|
20003
|
-
const checkName = check2.name;
|
20004
|
-
if (typeof checksInTable[tableName] !== "undefined") {
|
20005
|
-
if (checksInTable[tableName].includes(check2.name)) {
|
20006
|
-
console.log(
|
20007
|
-
`
|
20008
|
-
${withStyle.errorWarning(
|
20009
|
-
`We've found duplicated check constraint name in ${source_default.underline.blue(
|
20010
|
-
tableName
|
20011
|
-
)}. Please rename your check constraint in the ${source_default.underline.blue(
|
20012
|
-
tableName
|
20013
|
-
)} table`
|
20014
|
-
)}`
|
20015
|
-
);
|
20016
|
-
process.exit(1);
|
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
|
+
}
|
20017
19842
|
}
|
20018
|
-
|
19843
|
+
primaryKeysObject[name] = {
|
19844
|
+
columns: columnNames,
|
19845
|
+
name
|
19846
|
+
};
|
20019
19847
|
} else {
|
20020
|
-
|
19848
|
+
columnsObject[getColumnCasing(it.columns[0], casing2)].primaryKey = true;
|
20021
19849
|
}
|
20022
|
-
checkConstraintObject[checkName] = {
|
20023
|
-
name: checkName,
|
20024
|
-
value: dialect6.sqlToQuery(check2.value).sql
|
20025
|
-
};
|
20026
19850
|
});
|
20027
19851
|
result[tableName] = {
|
20028
19852
|
name: tableName,
|
@@ -20030,8 +19854,7 @@ ${withStyle.errorWarning(
|
|
20030
19854
|
indexes: indexesObject,
|
20031
19855
|
foreignKeys: foreignKeysObject,
|
20032
19856
|
compositePrimaryKeys: primaryKeysObject,
|
20033
|
-
uniqueConstraints: uniqueConstraintObject
|
20034
|
-
checkConstraints: checkConstraintObject
|
19857
|
+
uniqueConstraints: uniqueConstraintObject
|
20035
19858
|
};
|
20036
19859
|
}
|
20037
19860
|
return {
|
@@ -20078,7 +19901,6 @@ ${withStyle.errorWarning(
|
|
20078
19901
|
let tablesCount = /* @__PURE__ */ new Set();
|
20079
19902
|
let indexesCount = 0;
|
20080
19903
|
let foreignKeysCount = 0;
|
20081
|
-
let checksCount = 0;
|
20082
19904
|
const tableToPk = {};
|
20083
19905
|
let tableToGeneratedColumnsInfo = {};
|
20084
19906
|
for (const column7 of columns) {
|
@@ -20137,8 +19959,7 @@ ${withStyle.errorWarning(
|
|
20137
19959
|
compositePrimaryKeys: {},
|
20138
19960
|
indexes: {},
|
20139
19961
|
foreignKeys: {},
|
20140
|
-
uniqueConstraints: {}
|
20141
|
-
checkConstraints: {}
|
19962
|
+
uniqueConstraints: {}
|
20142
19963
|
};
|
20143
19964
|
} else {
|
20144
19965
|
result[tableName].columns[columnName] = newColumn;
|
@@ -20254,57 +20075,6 @@ WHERE
|
|
20254
20075
|
progressCallback("indexes", indexesCount, "done");
|
20255
20076
|
progressCallback("enums", 0, "done");
|
20256
20077
|
}
|
20257
|
-
const namedCheckPattern = /CONSTRAINT\s*["']?(\w+)["']?\s*CHECK\s*\((.*?)\)/gi;
|
20258
|
-
const unnamedCheckPattern = /CHECK\s*\((.*?)\)/gi;
|
20259
|
-
let checkCounter = 0;
|
20260
|
-
const checkConstraints = {};
|
20261
|
-
const checks = await db.query(`SELECT name as "tableName", sql as "sql"
|
20262
|
-
FROM sqlite_master
|
20263
|
-
WHERE type = 'table' AND name != 'sqlite_sequence';`);
|
20264
|
-
for (const check2 of checks) {
|
20265
|
-
if (!tablesFilter(check2.tableName))
|
20266
|
-
continue;
|
20267
|
-
const { tableName, sql } = check2;
|
20268
|
-
let namedChecks = [...sql.matchAll(namedCheckPattern)];
|
20269
|
-
if (namedChecks.length > 0) {
|
20270
|
-
namedChecks.forEach(([_2, checkName, checkValue]) => {
|
20271
|
-
checkConstraints[checkName] = {
|
20272
|
-
name: checkName,
|
20273
|
-
value: checkValue.trim()
|
20274
|
-
};
|
20275
|
-
});
|
20276
|
-
} else {
|
20277
|
-
let unnamedChecks = [...sql.matchAll(unnamedCheckPattern)];
|
20278
|
-
unnamedChecks.forEach(([_2, checkValue]) => {
|
20279
|
-
let checkName = `${tableName}_check_${++checkCounter}`;
|
20280
|
-
checkConstraints[checkName] = {
|
20281
|
-
name: checkName,
|
20282
|
-
value: checkValue.trim()
|
20283
|
-
};
|
20284
|
-
});
|
20285
|
-
}
|
20286
|
-
checksCount += Object.values(checkConstraints).length;
|
20287
|
-
if (progressCallback) {
|
20288
|
-
progressCallback("checks", checksCount, "fetching");
|
20289
|
-
}
|
20290
|
-
const table4 = result[tableName];
|
20291
|
-
if (!table4) {
|
20292
|
-
result[tableName] = {
|
20293
|
-
name: tableName,
|
20294
|
-
columns: {},
|
20295
|
-
compositePrimaryKeys: {},
|
20296
|
-
indexes: {},
|
20297
|
-
foreignKeys: {},
|
20298
|
-
uniqueConstraints: {},
|
20299
|
-
checkConstraints
|
20300
|
-
};
|
20301
|
-
} else {
|
20302
|
-
result[tableName].checkConstraints = checkConstraints;
|
20303
|
-
}
|
20304
|
-
}
|
20305
|
-
if (progressCallback) {
|
20306
|
-
progressCallback("checks", checksCount, "done");
|
20307
|
-
}
|
20308
20078
|
return {
|
20309
20079
|
version: "6",
|
20310
20080
|
dialect: "sqlite",
|
@@ -20320,16 +20090,17 @@ WHERE
|
|
20320
20090
|
});
|
20321
20091
|
|
20322
20092
|
// src/serializer/index.ts
|
20323
|
-
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;
|
20324
20094
|
var init_serializer = __esm({
|
20325
20095
|
"src/serializer/index.ts"() {
|
20326
20096
|
"use strict";
|
20327
20097
|
init_source();
|
20098
|
+
import_casing2 = require("drizzle-orm/casing");
|
20328
20099
|
import_fs3 = __toESM(require("fs"));
|
20329
20100
|
glob = __toESM(require_glob());
|
20330
20101
|
import_path3 = __toESM(require("path"));
|
20331
20102
|
init_views();
|
20332
|
-
sqlToStr = (sql) => {
|
20103
|
+
sqlToStr = (sql, casing2) => {
|
20333
20104
|
return sql.toQuery({
|
20334
20105
|
escapeName: () => {
|
20335
20106
|
throw new Error("we don't support params for `sql` default values");
|
@@ -20339,10 +20110,11 @@ var init_serializer = __esm({
|
|
20339
20110
|
},
|
20340
20111
|
escapeString: () => {
|
20341
20112
|
throw new Error("we don't support params for `sql` default values");
|
20342
|
-
}
|
20113
|
+
},
|
20114
|
+
casing: new import_casing2.CasingCache(casing2)
|
20343
20115
|
}).sql;
|
20344
20116
|
};
|
20345
|
-
serializeMySql = async (path5) => {
|
20117
|
+
serializeMySql = async (path5, casing2) => {
|
20346
20118
|
const filenames = prepareFilenames(path5);
|
20347
20119
|
console.log(source_default.gray(`Reading schema files:
|
20348
20120
|
${filenames.join("\n")}
|
@@ -20350,23 +20122,23 @@ ${filenames.join("\n")}
|
|
20350
20122
|
const { prepareFromMySqlImports: prepareFromMySqlImports2 } = await Promise.resolve().then(() => (init_mysqlImports(), mysqlImports_exports));
|
20351
20123
|
const { generateMySqlSnapshot: generateMySqlSnapshot2 } = await Promise.resolve().then(() => (init_mysqlSerializer(), mysqlSerializer_exports));
|
20352
20124
|
const { tables } = await prepareFromMySqlImports2(filenames);
|
20353
|
-
return generateMySqlSnapshot2(tables);
|
20125
|
+
return generateMySqlSnapshot2(tables, casing2);
|
20354
20126
|
};
|
20355
|
-
serializePg = async (path5, schemaFilter) => {
|
20127
|
+
serializePg = async (path5, casing2, schemaFilter) => {
|
20356
20128
|
const filenames = prepareFilenames(path5);
|
20357
20129
|
const { prepareFromPgImports: prepareFromPgImports2 } = await Promise.resolve().then(() => (init_pgImports(), pgImports_exports));
|
20358
20130
|
const { generatePgSnapshot: generatePgSnapshot2 } = await Promise.resolve().then(() => (init_pgSerializer(), pgSerializer_exports));
|
20359
20131
|
const { tables, enums, schemas, sequences } = await prepareFromPgImports2(
|
20360
20132
|
filenames
|
20361
20133
|
);
|
20362
|
-
return generatePgSnapshot2(tables, enums, schemas, sequences, schemaFilter);
|
20134
|
+
return generatePgSnapshot2(tables, enums, schemas, sequences, casing2, schemaFilter);
|
20363
20135
|
};
|
20364
|
-
serializeSQLite = async (path5) => {
|
20136
|
+
serializeSQLite = async (path5, casing2) => {
|
20365
20137
|
const filenames = prepareFilenames(path5);
|
20366
20138
|
const { prepareFromSqliteImports: prepareFromSqliteImports2 } = await Promise.resolve().then(() => (init_sqliteImports(), sqliteImports_exports));
|
20367
20139
|
const { generateSqliteSnapshot: generateSqliteSnapshot2 } = await Promise.resolve().then(() => (init_sqliteSerializer(), sqliteSerializer_exports));
|
20368
20140
|
const { tables } = await prepareFromSqliteImports2(filenames);
|
20369
|
-
return generateSqliteSnapshot2(tables);
|
20141
|
+
return generateSqliteSnapshot2(tables, casing2);
|
20370
20142
|
};
|
20371
20143
|
prepareFilenames = (path5) => {
|
20372
20144
|
if (typeof path5 === "string") {
|
@@ -20415,45 +20187,45 @@ var init_migrationPreparator = __esm({
|
|
20415
20187
|
init_mysqlSchema();
|
20416
20188
|
init_pgSchema();
|
20417
20189
|
init_sqliteSchema();
|
20418
|
-
prepareMySqlDbPushSnapshot = async (prev, schemaPath) => {
|
20419
|
-
const serialized = await serializeMySql(schemaPath);
|
20190
|
+
prepareMySqlDbPushSnapshot = async (prev, schemaPath, casing2) => {
|
20191
|
+
const serialized = await serializeMySql(schemaPath, casing2);
|
20420
20192
|
const id = (0, import_crypto.randomUUID)();
|
20421
20193
|
const idPrev = prev.id;
|
20422
|
-
const { version: version3, dialect:
|
20423
|
-
const result = { version: version3, dialect:
|
20194
|
+
const { version: version3, dialect: dialect4, ...rest } = serialized;
|
20195
|
+
const result = { version: version3, dialect: dialect4, id, prevId: idPrev, ...rest };
|
20424
20196
|
return { prev, cur: result };
|
20425
20197
|
};
|
20426
|
-
prepareSQLiteDbPushSnapshot = async (prev, schemaPath) => {
|
20427
|
-
const serialized = await serializeSQLite(schemaPath);
|
20198
|
+
prepareSQLiteDbPushSnapshot = async (prev, schemaPath, casing2) => {
|
20199
|
+
const serialized = await serializeSQLite(schemaPath, casing2);
|
20428
20200
|
const id = (0, import_crypto.randomUUID)();
|
20429
20201
|
const idPrev = prev.id;
|
20430
|
-
const { version: version3, dialect:
|
20202
|
+
const { version: version3, dialect: dialect4, ...rest } = serialized;
|
20431
20203
|
const result = {
|
20432
20204
|
version: version3,
|
20433
|
-
dialect:
|
20205
|
+
dialect: dialect4,
|
20434
20206
|
id,
|
20435
20207
|
prevId: idPrev,
|
20436
20208
|
...rest
|
20437
20209
|
};
|
20438
20210
|
return { prev, cur: result };
|
20439
20211
|
};
|
20440
|
-
preparePgDbPushSnapshot = async (prev, schemaPath, schemaFilter = ["public"]) => {
|
20441
|
-
const serialized = await serializePg(schemaPath, schemaFilter);
|
20212
|
+
preparePgDbPushSnapshot = async (prev, schemaPath, casing2, schemaFilter = ["public"]) => {
|
20213
|
+
const serialized = await serializePg(schemaPath, casing2, schemaFilter);
|
20442
20214
|
const id = (0, import_crypto.randomUUID)();
|
20443
20215
|
const idPrev = prev.id;
|
20444
|
-
const { version: version3, dialect:
|
20445
|
-
const result = { version: version3, dialect:
|
20216
|
+
const { version: version3, dialect: dialect4, ...rest } = serialized;
|
20217
|
+
const result = { version: version3, dialect: dialect4, id, prevId: idPrev, ...rest };
|
20446
20218
|
return { prev, cur: result };
|
20447
20219
|
};
|
20448
|
-
prepareMySqlMigrationSnapshot = async (migrationFolders, schemaPath) => {
|
20220
|
+
prepareMySqlMigrationSnapshot = async (migrationFolders, schemaPath, casing2) => {
|
20449
20221
|
const prevSnapshot = mysqlSchema.parse(
|
20450
20222
|
preparePrevSnapshot(migrationFolders, dryMySql)
|
20451
20223
|
);
|
20452
|
-
const serialized = await serializeMySql(schemaPath);
|
20224
|
+
const serialized = await serializeMySql(schemaPath, casing2);
|
20453
20225
|
const id = (0, import_crypto.randomUUID)();
|
20454
20226
|
const idPrev = prevSnapshot.id;
|
20455
|
-
const { version: version3, dialect:
|
20456
|
-
const result = { version: version3, dialect:
|
20227
|
+
const { version: version3, dialect: dialect4, ...rest } = serialized;
|
20228
|
+
const result = { version: version3, dialect: dialect4, id, prevId: idPrev, ...rest };
|
20457
20229
|
const { id: _ignoredId, prevId: _ignoredPrevId, ...prevRest } = prevSnapshot;
|
20458
20230
|
const custom2 = {
|
20459
20231
|
id,
|
@@ -20462,17 +20234,17 @@ var init_migrationPreparator = __esm({
|
|
20462
20234
|
};
|
20463
20235
|
return { prev: prevSnapshot, cur: result, custom: custom2 };
|
20464
20236
|
};
|
20465
|
-
prepareSqliteMigrationSnapshot = async (snapshots, schemaPath) => {
|
20237
|
+
prepareSqliteMigrationSnapshot = async (snapshots, schemaPath, casing2) => {
|
20466
20238
|
const prevSnapshot = sqliteSchema.parse(
|
20467
20239
|
preparePrevSnapshot(snapshots, drySQLite)
|
20468
20240
|
);
|
20469
|
-
const serialized = await serializeSQLite(schemaPath);
|
20241
|
+
const serialized = await serializeSQLite(schemaPath, casing2);
|
20470
20242
|
const id = (0, import_crypto.randomUUID)();
|
20471
20243
|
const idPrev = prevSnapshot.id;
|
20472
|
-
const { version: version3, dialect:
|
20244
|
+
const { version: version3, dialect: dialect4, ...rest } = serialized;
|
20473
20245
|
const result = {
|
20474
20246
|
version: version3,
|
20475
|
-
dialect:
|
20247
|
+
dialect: dialect4,
|
20476
20248
|
id,
|
20477
20249
|
prevId: idPrev,
|
20478
20250
|
...rest
|
@@ -20492,9 +20264,9 @@ var init_migrationPreparator = __esm({
|
|
20492
20264
|
}) => {
|
20493
20265
|
return { id, prevId: idPrev, ...serialized };
|
20494
20266
|
};
|
20495
|
-
preparePgMigrationSnapshot = async (snapshots, schemaPath) => {
|
20267
|
+
preparePgMigrationSnapshot = async (snapshots, schemaPath, casing2) => {
|
20496
20268
|
const prevSnapshot = pgSchema.parse(preparePrevSnapshot(snapshots, dryPg));
|
20497
|
-
const serialized = await serializePg(schemaPath);
|
20269
|
+
const serialized = await serializePg(schemaPath, casing2);
|
20498
20270
|
const id = (0, import_crypto.randomUUID)();
|
20499
20271
|
const idPrev = prevSnapshot.id;
|
20500
20272
|
const result = { id, prevId: idPrev, ...serialized };
|
@@ -23043,21 +22815,6 @@ var init_jsonDiffer = __esm({
|
|
23043
22815
|
return !it[0].endsWith("__deleted") && !it[0].endsWith("__added");
|
23044
22816
|
})
|
23045
22817
|
);
|
23046
|
-
const addedCheckConstraints = Object.fromEntries(
|
23047
|
-
Object.entries(table4.checkConstraints || {}).filter((it) => {
|
23048
|
-
return it[0].endsWith("__added");
|
23049
|
-
})
|
23050
|
-
);
|
23051
|
-
const deletedCheckConstraints = Object.fromEntries(
|
23052
|
-
Object.entries(table4.checkConstraints || {}).filter((it) => {
|
23053
|
-
return it[0].endsWith("__deleted");
|
23054
|
-
})
|
23055
|
-
);
|
23056
|
-
const alteredCheckConstraints = Object.fromEntries(
|
23057
|
-
Object.entries(table4.checkConstraints || {}).filter((it) => {
|
23058
|
-
return !it[0].endsWith("__deleted") && !it[0].endsWith("__added");
|
23059
|
-
})
|
23060
|
-
);
|
23061
22818
|
const mappedAltered = altered.map((it) => alternationsInColumn(it)).filter(Boolean);
|
23062
22819
|
return {
|
23063
22820
|
name: table4.name,
|
@@ -23074,10 +22831,7 @@ var init_jsonDiffer = __esm({
|
|
23074
22831
|
alteredCompositePKs,
|
23075
22832
|
addedUniqueConstraints,
|
23076
22833
|
deletedUniqueConstraints,
|
23077
|
-
alteredUniqueConstraints
|
23078
|
-
addedCheckConstraints,
|
23079
|
-
deletedCheckConstraints,
|
23080
|
-
alteredCheckConstraints
|
22834
|
+
alteredUniqueConstraints
|
23081
22835
|
};
|
23082
22836
|
};
|
23083
22837
|
alternationsInColumn = (column7) => {
|
@@ -23331,32 +23085,6 @@ var init_jsonDiffer = __esm({
|
|
23331
23085
|
};
|
23332
23086
|
}
|
23333
23087
|
return it;
|
23334
|
-
}).map((it) => {
|
23335
|
-
if ("" in it) {
|
23336
|
-
return {
|
23337
|
-
...it,
|
23338
|
-
autoincrement: {
|
23339
|
-
type: "changed",
|
23340
|
-
old: it.autoincrement.__old,
|
23341
|
-
new: it.autoincrement.__new
|
23342
|
-
}
|
23343
|
-
};
|
23344
|
-
}
|
23345
|
-
if ("autoincrement__added" in it) {
|
23346
|
-
const { autoincrement__added, ...others } = it;
|
23347
|
-
return {
|
23348
|
-
...others,
|
23349
|
-
autoincrement: { type: "added", value: it.autoincrement__added }
|
23350
|
-
};
|
23351
|
-
}
|
23352
|
-
if ("autoincrement__deleted" in it) {
|
23353
|
-
const { autoincrement__deleted, ...others } = it;
|
23354
|
-
return {
|
23355
|
-
...others,
|
23356
|
-
autoincrement: { type: "deleted", value: it.autoincrement__deleted }
|
23357
|
-
};
|
23358
|
-
}
|
23359
|
-
return it;
|
23360
23088
|
}).filter(Boolean);
|
23361
23089
|
return result[0];
|
23362
23090
|
};
|
@@ -23364,10 +23092,10 @@ var init_jsonDiffer = __esm({
|
|
23364
23092
|
});
|
23365
23093
|
|
23366
23094
|
// src/sqlgenerator.ts
|
23367
|
-
function fromJson(statements,
|
23095
|
+
function fromJson(statements, dialect4, action, json2) {
|
23368
23096
|
const result = statements.flatMap((statement) => {
|
23369
23097
|
const filtered = convertors.filter((it) => {
|
23370
|
-
return it.can(statement,
|
23098
|
+
return it.can(statement, dialect4);
|
23371
23099
|
});
|
23372
23100
|
const convertor = filtered.length === 1 ? filtered[0] : void 0;
|
23373
23101
|
if (!convertor) {
|
@@ -23377,7 +23105,7 @@ function fromJson(statements, dialect7, action, json2) {
|
|
23377
23105
|
}).filter((it) => it !== "");
|
23378
23106
|
return result;
|
23379
23107
|
}
|
23380
|
-
var pgNativeTypes, isPgNativeType, Convertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, PgAlterTableAlterColumnSetGenerated, PgAlterTableAlterColumnDropGenerated, PgAlterTableAlterColumnAlterGenerated, PgAlterTableAddUniqueConstraintConvertor, PgAlterTableDropUniqueConstraintConvertor,
|
23108
|
+
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;
|
23381
23109
|
var init_sqlgenerator = __esm({
|
23382
23110
|
"src/sqlgenerator.ts"() {
|
23383
23111
|
"use strict";
|
@@ -23435,11 +23163,11 @@ var init_sqlgenerator = __esm({
|
|
23435
23163
|
Convertor = class {
|
23436
23164
|
};
|
23437
23165
|
PgCreateTableConvertor = class extends Convertor {
|
23438
|
-
can(statement,
|
23439
|
-
return statement.type === "create_table" &&
|
23166
|
+
can(statement, dialect4) {
|
23167
|
+
return statement.type === "create_table" && dialect4 === "postgresql";
|
23440
23168
|
}
|
23441
23169
|
convert(st) {
|
23442
|
-
const { tableName, schema: schema5, columns, compositePKs, uniqueConstraints
|
23170
|
+
const { tableName, schema: schema5, columns, compositePKs, uniqueConstraints } = st;
|
23443
23171
|
let statement = "";
|
23444
23172
|
const name = schema5 ? `"${schema5}"."${tableName}"` : `"${tableName}"`;
|
23445
23173
|
statement += `CREATE TABLE IF NOT EXISTS ${name} (
|
@@ -23472,13 +23200,6 @@ var init_sqlgenerator = __esm({
|
|
23472
23200
|
statement += ` CONSTRAINT "${unsquashedUnique.name}" UNIQUE${unsquashedUnique.nullsNotDistinct ? " NULLS NOT DISTINCT" : ""}("${unsquashedUnique.columns.join(`","`)}")`;
|
23473
23201
|
}
|
23474
23202
|
}
|
23475
|
-
if (typeof checkConstraints !== "undefined" && checkConstraints.length > 0) {
|
23476
|
-
for (const checkConstraint4 of checkConstraints) {
|
23477
|
-
statement += ",\n";
|
23478
|
-
const unsquashedCheck = PgSquasher.unsquashCheck(checkConstraint4);
|
23479
|
-
statement += ` CONSTRAINT "${unsquashedCheck.name}" CHECK (${unsquashedCheck.value})`;
|
23480
|
-
}
|
23481
|
-
}
|
23482
23203
|
statement += `
|
23483
23204
|
);`;
|
23484
23205
|
statement += `
|
@@ -23487,8 +23208,8 @@ var init_sqlgenerator = __esm({
|
|
23487
23208
|
}
|
23488
23209
|
};
|
23489
23210
|
MySqlCreateTableConvertor = class extends Convertor {
|
23490
|
-
can(statement,
|
23491
|
-
return statement.type === "create_table" &&
|
23211
|
+
can(statement, dialect4) {
|
23212
|
+
return statement.type === "create_table" && dialect4 === "mysql";
|
23492
23213
|
}
|
23493
23214
|
convert(st) {
|
23494
23215
|
var _a, _b;
|
@@ -23496,7 +23217,6 @@ var init_sqlgenerator = __esm({
|
|
23496
23217
|
tableName,
|
23497
23218
|
columns,
|
23498
23219
|
schema: schema5,
|
23499
|
-
checkConstraints,
|
23500
23220
|
compositePKs,
|
23501
23221
|
uniqueConstraints,
|
23502
23222
|
internals
|
@@ -23531,13 +23251,6 @@ var init_sqlgenerator = __esm({
|
|
23531
23251
|
statement += ` CONSTRAINT \`${unsquashedUnique.name}\` UNIQUE(${uniqueString})`;
|
23532
23252
|
}
|
23533
23253
|
}
|
23534
|
-
if (typeof checkConstraints !== "undefined" && checkConstraints.length > 0) {
|
23535
|
-
for (const checkConstraint4 of checkConstraints) {
|
23536
|
-
statement += ",\n";
|
23537
|
-
const unsquashedCheck = MySqlSquasher.unsquashCheck(checkConstraint4);
|
23538
|
-
statement += ` CONSTRAINT \`${unsquashedCheck.name}\` CHECK(${unsquashedCheck.value})`;
|
23539
|
-
}
|
23540
|
-
}
|
23541
23254
|
statement += `
|
23542
23255
|
);`;
|
23543
23256
|
statement += `
|
@@ -23546,8 +23259,8 @@ var init_sqlgenerator = __esm({
|
|
23546
23259
|
}
|
23547
23260
|
};
|
23548
23261
|
SQLiteCreateTableConvertor = class extends Convertor {
|
23549
|
-
can(statement,
|
23550
|
-
return statement.type === "sqlite_create_table" && (
|
23262
|
+
can(statement, dialect4) {
|
23263
|
+
return statement.type === "sqlite_create_table" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23551
23264
|
}
|
23552
23265
|
convert(st) {
|
23553
23266
|
const {
|
@@ -23555,8 +23268,7 @@ var init_sqlgenerator = __esm({
|
|
23555
23268
|
columns,
|
23556
23269
|
referenceData,
|
23557
23270
|
compositePKs,
|
23558
|
-
uniqueConstraints
|
23559
|
-
checkConstraints
|
23271
|
+
uniqueConstraints
|
23560
23272
|
} = st;
|
23561
23273
|
let statement = "";
|
23562
23274
|
statement += `CREATE TABLE \`${tableName}\` (
|
@@ -23597,17 +23309,10 @@ var init_sqlgenerator = __esm({
|
|
23597
23309
|
if (typeof uniqueConstraints !== "undefined" && uniqueConstraints.length > 0) {
|
23598
23310
|
for (const uniqueConstraint4 of uniqueConstraints) {
|
23599
23311
|
statement += ",\n";
|
23600
|
-
const unsquashedUnique =
|
23312
|
+
const unsquashedUnique = MySqlSquasher.unsquashUnique(uniqueConstraint4);
|
23601
23313
|
statement += ` CONSTRAINT ${unsquashedUnique.name} UNIQUE(\`${unsquashedUnique.columns.join(`\`,\``)}\`)`;
|
23602
23314
|
}
|
23603
23315
|
}
|
23604
|
-
if (typeof checkConstraints !== "undefined" && checkConstraints.length > 0) {
|
23605
|
-
for (const check2 of checkConstraints) {
|
23606
|
-
statement += ",\n";
|
23607
|
-
const { value, name } = SQLiteSquasher.unsquashCheck(check2);
|
23608
|
-
statement += ` CONSTRAINT "${name}" CHECK(${value})`;
|
23609
|
-
}
|
23610
|
-
}
|
23611
23316
|
statement += `
|
23612
23317
|
`;
|
23613
23318
|
statement += `);`;
|
@@ -23617,8 +23322,8 @@ var init_sqlgenerator = __esm({
|
|
23617
23322
|
}
|
23618
23323
|
};
|
23619
23324
|
PgAlterTableAlterColumnSetGenerated = class extends Convertor {
|
23620
|
-
can(statement,
|
23621
|
-
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";
|
23622
23327
|
}
|
23623
23328
|
convert(statement) {
|
23624
23329
|
const { identity, tableName, columnName, schema: schema5 } = statement;
|
@@ -23630,8 +23335,8 @@ var init_sqlgenerator = __esm({
|
|
23630
23335
|
}
|
23631
23336
|
};
|
23632
23337
|
PgAlterTableAlterColumnDropGenerated = class extends Convertor {
|
23633
|
-
can(statement,
|
23634
|
-
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";
|
23635
23340
|
}
|
23636
23341
|
convert(statement) {
|
23637
23342
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -23640,8 +23345,8 @@ var init_sqlgenerator = __esm({
|
|
23640
23345
|
}
|
23641
23346
|
};
|
23642
23347
|
PgAlterTableAlterColumnAlterGenerated = class extends Convertor {
|
23643
|
-
can(statement,
|
23644
|
-
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";
|
23645
23350
|
}
|
23646
23351
|
convert(statement) {
|
23647
23352
|
const { identity, oldIdentity, tableName, columnName, schema: schema5 } = statement;
|
@@ -23688,8 +23393,8 @@ var init_sqlgenerator = __esm({
|
|
23688
23393
|
}
|
23689
23394
|
};
|
23690
23395
|
PgAlterTableAddUniqueConstraintConvertor = class extends Convertor {
|
23691
|
-
can(statement,
|
23692
|
-
return statement.type === "create_unique_constraint" &&
|
23396
|
+
can(statement, dialect4) {
|
23397
|
+
return statement.type === "create_unique_constraint" && dialect4 === "postgresql";
|
23693
23398
|
}
|
23694
23399
|
convert(statement) {
|
23695
23400
|
const unsquashed = PgSquasher.unsquashUnique(statement.data);
|
@@ -23698,8 +23403,8 @@ var init_sqlgenerator = __esm({
|
|
23698
23403
|
}
|
23699
23404
|
};
|
23700
23405
|
PgAlterTableDropUniqueConstraintConvertor = class extends Convertor {
|
23701
|
-
can(statement,
|
23702
|
-
return statement.type === "delete_unique_constraint" &&
|
23406
|
+
can(statement, dialect4) {
|
23407
|
+
return statement.type === "delete_unique_constraint" && dialect4 === "postgresql";
|
23703
23408
|
}
|
23704
23409
|
convert(statement) {
|
23705
23410
|
const unsquashed = PgSquasher.unsquashUnique(statement.data);
|
@@ -23707,28 +23412,9 @@ var init_sqlgenerator = __esm({
|
|
23707
23412
|
return `ALTER TABLE ${tableNameWithSchema} DROP CONSTRAINT "${unsquashed.name}";`;
|
23708
23413
|
}
|
23709
23414
|
};
|
23710
|
-
PgAlterTableAddCheckConstraintConvertor = class extends Convertor {
|
23711
|
-
can(statement, dialect7) {
|
23712
|
-
return statement.type === "create_check_constraint" && dialect7 === "postgresql";
|
23713
|
-
}
|
23714
|
-
convert(statement) {
|
23715
|
-
const unsquashed = PgSquasher.unsquashCheck(statement.data);
|
23716
|
-
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
|
23717
|
-
return `ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${unsquashed.name}" CHECK (${unsquashed.value});`;
|
23718
|
-
}
|
23719
|
-
};
|
23720
|
-
PgAlterTableDeleteCheckConstraintConvertor = class extends Convertor {
|
23721
|
-
can(statement, dialect7) {
|
23722
|
-
return statement.type === "delete_check_constraint" && dialect7 === "postgresql";
|
23723
|
-
}
|
23724
|
-
convert(statement) {
|
23725
|
-
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
|
23726
|
-
return `ALTER TABLE ${tableNameWithSchema} DROP CONSTRAINT "${statement.constraintName}";`;
|
23727
|
-
}
|
23728
|
-
};
|
23729
23415
|
MySQLAlterTableAddUniqueConstraintConvertor = class extends Convertor {
|
23730
|
-
can(statement,
|
23731
|
-
return statement.type === "create_unique_constraint" &&
|
23416
|
+
can(statement, dialect4) {
|
23417
|
+
return statement.type === "create_unique_constraint" && dialect4 === "mysql";
|
23732
23418
|
}
|
23733
23419
|
convert(statement) {
|
23734
23420
|
const unsquashed = MySqlSquasher.unsquashUnique(statement.data);
|
@@ -23736,36 +23422,17 @@ var init_sqlgenerator = __esm({
|
|
23736
23422
|
}
|
23737
23423
|
};
|
23738
23424
|
MySQLAlterTableDropUniqueConstraintConvertor = class extends Convertor {
|
23739
|
-
can(statement,
|
23740
|
-
return statement.type === "delete_unique_constraint" &&
|
23425
|
+
can(statement, dialect4) {
|
23426
|
+
return statement.type === "delete_unique_constraint" && dialect4 === "mysql";
|
23741
23427
|
}
|
23742
23428
|
convert(statement) {
|
23743
23429
|
const unsquashed = MySqlSquasher.unsquashUnique(statement.data);
|
23744
23430
|
return `ALTER TABLE \`${statement.tableName}\` DROP INDEX \`${unsquashed.name}\`;`;
|
23745
23431
|
}
|
23746
23432
|
};
|
23747
|
-
MySqlAlterTableAddCheckConstraintConvertor = class extends Convertor {
|
23748
|
-
can(statement, dialect7) {
|
23749
|
-
return statement.type === "create_check_constraint" && dialect7 === "mysql";
|
23750
|
-
}
|
23751
|
-
convert(statement) {
|
23752
|
-
const unsquashed = MySqlSquasher.unsquashCheck(statement.data);
|
23753
|
-
const { tableName } = statement;
|
23754
|
-
return `ALTER TABLE \`${tableName}\` ADD CONSTRAINT \`${unsquashed.name}\` CHECK (${unsquashed.value});`;
|
23755
|
-
}
|
23756
|
-
};
|
23757
|
-
MySqlAlterTableDeleteCheckConstraintConvertor = class extends Convertor {
|
23758
|
-
can(statement, dialect7) {
|
23759
|
-
return statement.type === "delete_check_constraint" && dialect7 === "mysql";
|
23760
|
-
}
|
23761
|
-
convert(statement) {
|
23762
|
-
const { tableName } = statement;
|
23763
|
-
return `ALTER TABLE \`${tableName}\` DROP CONSTRAINT \`${statement.constraintName}\`;`;
|
23764
|
-
}
|
23765
|
-
};
|
23766
23433
|
CreatePgSequenceConvertor = class extends Convertor {
|
23767
|
-
can(statement,
|
23768
|
-
return statement.type === "create_sequence" &&
|
23434
|
+
can(statement, dialect4) {
|
23435
|
+
return statement.type === "create_sequence" && dialect4 === "postgresql";
|
23769
23436
|
}
|
23770
23437
|
convert(st) {
|
23771
23438
|
const { name, values, schema: schema5 } = st;
|
@@ -23774,8 +23441,8 @@ var init_sqlgenerator = __esm({
|
|
23774
23441
|
}
|
23775
23442
|
};
|
23776
23443
|
DropPgSequenceConvertor = class extends Convertor {
|
23777
|
-
can(statement,
|
23778
|
-
return statement.type === "drop_sequence" &&
|
23444
|
+
can(statement, dialect4) {
|
23445
|
+
return statement.type === "drop_sequence" && dialect4 === "postgresql";
|
23779
23446
|
}
|
23780
23447
|
convert(st) {
|
23781
23448
|
const { name, schema: schema5 } = st;
|
@@ -23784,8 +23451,8 @@ var init_sqlgenerator = __esm({
|
|
23784
23451
|
}
|
23785
23452
|
};
|
23786
23453
|
RenamePgSequenceConvertor = class extends Convertor {
|
23787
|
-
can(statement,
|
23788
|
-
return statement.type === "rename_sequence" &&
|
23454
|
+
can(statement, dialect4) {
|
23455
|
+
return statement.type === "rename_sequence" && dialect4 === "postgresql";
|
23789
23456
|
}
|
23790
23457
|
convert(st) {
|
23791
23458
|
const { nameFrom, nameTo, schema: schema5 } = st;
|
@@ -23795,8 +23462,8 @@ var init_sqlgenerator = __esm({
|
|
23795
23462
|
}
|
23796
23463
|
};
|
23797
23464
|
MovePgSequenceConvertor = class extends Convertor {
|
23798
|
-
can(statement,
|
23799
|
-
return statement.type === "move_sequence" &&
|
23465
|
+
can(statement, dialect4) {
|
23466
|
+
return statement.type === "move_sequence" && dialect4 === "postgresql";
|
23800
23467
|
}
|
23801
23468
|
convert(st) {
|
23802
23469
|
const { schemaFrom, schemaTo, name } = st;
|
@@ -23806,8 +23473,8 @@ var init_sqlgenerator = __esm({
|
|
23806
23473
|
}
|
23807
23474
|
};
|
23808
23475
|
AlterPgSequenceConvertor = class extends Convertor {
|
23809
|
-
can(statement,
|
23810
|
-
return statement.type === "alter_sequence" &&
|
23476
|
+
can(statement, dialect4) {
|
23477
|
+
return statement.type === "alter_sequence" && dialect4 === "postgresql";
|
23811
23478
|
}
|
23812
23479
|
convert(st) {
|
23813
23480
|
const { name, schema: schema5, values } = st;
|
@@ -23850,8 +23517,8 @@ var init_sqlgenerator = __esm({
|
|
23850
23517
|
}
|
23851
23518
|
};
|
23852
23519
|
PgDropTableConvertor = class extends Convertor {
|
23853
|
-
can(statement,
|
23854
|
-
return statement.type === "drop_table" &&
|
23520
|
+
can(statement, dialect4) {
|
23521
|
+
return statement.type === "drop_table" && dialect4 === "postgresql";
|
23855
23522
|
}
|
23856
23523
|
convert(statement) {
|
23857
23524
|
const { tableName, schema: schema5 } = statement;
|
@@ -23860,8 +23527,8 @@ var init_sqlgenerator = __esm({
|
|
23860
23527
|
}
|
23861
23528
|
};
|
23862
23529
|
MySQLDropTableConvertor = class extends Convertor {
|
23863
|
-
can(statement,
|
23864
|
-
return statement.type === "drop_table" &&
|
23530
|
+
can(statement, dialect4) {
|
23531
|
+
return statement.type === "drop_table" && dialect4 === "mysql";
|
23865
23532
|
}
|
23866
23533
|
convert(statement) {
|
23867
23534
|
const { tableName } = statement;
|
@@ -23869,8 +23536,8 @@ var init_sqlgenerator = __esm({
|
|
23869
23536
|
}
|
23870
23537
|
};
|
23871
23538
|
SQLiteDropTableConvertor = class extends Convertor {
|
23872
|
-
can(statement,
|
23873
|
-
return statement.type === "drop_table" && (
|
23539
|
+
can(statement, dialect4) {
|
23540
|
+
return statement.type === "drop_table" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23874
23541
|
}
|
23875
23542
|
convert(statement) {
|
23876
23543
|
const { tableName } = statement;
|
@@ -23878,8 +23545,8 @@ var init_sqlgenerator = __esm({
|
|
23878
23545
|
}
|
23879
23546
|
};
|
23880
23547
|
PgRenameTableConvertor = class extends Convertor {
|
23881
|
-
can(statement,
|
23882
|
-
return statement.type === "rename_table" &&
|
23548
|
+
can(statement, dialect4) {
|
23549
|
+
return statement.type === "rename_table" && dialect4 === "postgresql";
|
23883
23550
|
}
|
23884
23551
|
convert(statement) {
|
23885
23552
|
const { tableNameFrom, tableNameTo, toSchema, fromSchema } = statement;
|
@@ -23889,8 +23556,8 @@ var init_sqlgenerator = __esm({
|
|
23889
23556
|
}
|
23890
23557
|
};
|
23891
23558
|
SqliteRenameTableConvertor = class extends Convertor {
|
23892
|
-
can(statement,
|
23893
|
-
return statement.type === "rename_table" && (
|
23559
|
+
can(statement, dialect4) {
|
23560
|
+
return statement.type === "rename_table" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23894
23561
|
}
|
23895
23562
|
convert(statement) {
|
23896
23563
|
const { tableNameFrom, tableNameTo } = statement;
|
@@ -23898,8 +23565,8 @@ var init_sqlgenerator = __esm({
|
|
23898
23565
|
}
|
23899
23566
|
};
|
23900
23567
|
MySqlRenameTableConvertor = class extends Convertor {
|
23901
|
-
can(statement,
|
23902
|
-
return statement.type === "rename_table" &&
|
23568
|
+
can(statement, dialect4) {
|
23569
|
+
return statement.type === "rename_table" && dialect4 === "mysql";
|
23903
23570
|
}
|
23904
23571
|
convert(statement) {
|
23905
23572
|
const { tableNameFrom, tableNameTo } = statement;
|
@@ -23907,8 +23574,8 @@ var init_sqlgenerator = __esm({
|
|
23907
23574
|
}
|
23908
23575
|
};
|
23909
23576
|
PgAlterTableRenameColumnConvertor = class extends Convertor {
|
23910
|
-
can(statement,
|
23911
|
-
return statement.type === "alter_table_rename_column" &&
|
23577
|
+
can(statement, dialect4) {
|
23578
|
+
return statement.type === "alter_table_rename_column" && dialect4 === "postgresql";
|
23912
23579
|
}
|
23913
23580
|
convert(statement) {
|
23914
23581
|
const { tableName, oldColumnName, newColumnName, schema: schema5 } = statement;
|
@@ -23917,8 +23584,8 @@ var init_sqlgenerator = __esm({
|
|
23917
23584
|
}
|
23918
23585
|
};
|
23919
23586
|
MySqlAlterTableRenameColumnConvertor = class extends Convertor {
|
23920
|
-
can(statement,
|
23921
|
-
return statement.type === "alter_table_rename_column" &&
|
23587
|
+
can(statement, dialect4) {
|
23588
|
+
return statement.type === "alter_table_rename_column" && dialect4 === "mysql";
|
23922
23589
|
}
|
23923
23590
|
convert(statement) {
|
23924
23591
|
const { tableName, oldColumnName, newColumnName } = statement;
|
@@ -23926,8 +23593,8 @@ var init_sqlgenerator = __esm({
|
|
23926
23593
|
}
|
23927
23594
|
};
|
23928
23595
|
SQLiteAlterTableRenameColumnConvertor = class extends Convertor {
|
23929
|
-
can(statement,
|
23930
|
-
return statement.type === "alter_table_rename_column" && (
|
23596
|
+
can(statement, dialect4) {
|
23597
|
+
return statement.type === "alter_table_rename_column" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23931
23598
|
}
|
23932
23599
|
convert(statement) {
|
23933
23600
|
const { tableName, oldColumnName, newColumnName } = statement;
|
@@ -23935,8 +23602,8 @@ var init_sqlgenerator = __esm({
|
|
23935
23602
|
}
|
23936
23603
|
};
|
23937
23604
|
PgAlterTableDropColumnConvertor = class extends Convertor {
|
23938
|
-
can(statement,
|
23939
|
-
return statement.type === "alter_table_drop_column" &&
|
23605
|
+
can(statement, dialect4) {
|
23606
|
+
return statement.type === "alter_table_drop_column" && dialect4 === "postgresql";
|
23940
23607
|
}
|
23941
23608
|
convert(statement) {
|
23942
23609
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -23945,8 +23612,8 @@ var init_sqlgenerator = __esm({
|
|
23945
23612
|
}
|
23946
23613
|
};
|
23947
23614
|
MySqlAlterTableDropColumnConvertor = class extends Convertor {
|
23948
|
-
can(statement,
|
23949
|
-
return statement.type === "alter_table_drop_column" &&
|
23615
|
+
can(statement, dialect4) {
|
23616
|
+
return statement.type === "alter_table_drop_column" && dialect4 === "mysql";
|
23950
23617
|
}
|
23951
23618
|
convert(statement) {
|
23952
23619
|
const { tableName, columnName } = statement;
|
@@ -23954,8 +23621,8 @@ var init_sqlgenerator = __esm({
|
|
23954
23621
|
}
|
23955
23622
|
};
|
23956
23623
|
SQLiteAlterTableDropColumnConvertor = class extends Convertor {
|
23957
|
-
can(statement,
|
23958
|
-
return statement.type === "alter_table_drop_column" && (
|
23624
|
+
can(statement, dialect4) {
|
23625
|
+
return statement.type === "alter_table_drop_column" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23959
23626
|
}
|
23960
23627
|
convert(statement) {
|
23961
23628
|
const { tableName, columnName } = statement;
|
@@ -23963,8 +23630,8 @@ var init_sqlgenerator = __esm({
|
|
23963
23630
|
}
|
23964
23631
|
};
|
23965
23632
|
PgAlterTableAddColumnConvertor = class extends Convertor {
|
23966
|
-
can(statement,
|
23967
|
-
return statement.type === "alter_table_add_column" &&
|
23633
|
+
can(statement, dialect4) {
|
23634
|
+
return statement.type === "alter_table_add_column" && dialect4 === "postgresql";
|
23968
23635
|
}
|
23969
23636
|
convert(statement) {
|
23970
23637
|
const { tableName, column: column7, schema: schema5 } = statement;
|
@@ -23983,8 +23650,8 @@ var init_sqlgenerator = __esm({
|
|
23983
23650
|
}
|
23984
23651
|
};
|
23985
23652
|
MySqlAlterTableAddColumnConvertor = class extends Convertor {
|
23986
|
-
can(statement,
|
23987
|
-
return statement.type === "alter_table_add_column" &&
|
23653
|
+
can(statement, dialect4) {
|
23654
|
+
return statement.type === "alter_table_add_column" && dialect4 === "mysql";
|
23988
23655
|
}
|
23989
23656
|
convert(statement) {
|
23990
23657
|
const { tableName, column: column7 } = statement;
|
@@ -24007,8 +23674,8 @@ var init_sqlgenerator = __esm({
|
|
24007
23674
|
}
|
24008
23675
|
};
|
24009
23676
|
SQLiteAlterTableAddColumnConvertor = class extends Convertor {
|
24010
|
-
can(statement,
|
24011
|
-
return statement.type === "sqlite_alter_table_add_column" && (
|
23677
|
+
can(statement, dialect4) {
|
23678
|
+
return statement.type === "sqlite_alter_table_add_column" && (dialect4 === "sqlite" || dialect4 === "turso");
|
24012
23679
|
}
|
24013
23680
|
convert(statement) {
|
24014
23681
|
const { tableName, column: column7, referenceData } = statement;
|
@@ -24023,8 +23690,8 @@ var init_sqlgenerator = __esm({
|
|
24023
23690
|
}
|
24024
23691
|
};
|
24025
23692
|
PgAlterTableAlterColumnSetTypeConvertor = class extends Convertor {
|
24026
|
-
can(statement,
|
24027
|
-
return statement.type === "alter_table_alter_column_set_type" &&
|
23693
|
+
can(statement, dialect4) {
|
23694
|
+
return statement.type === "alter_table_alter_column_set_type" && dialect4 === "postgresql";
|
24028
23695
|
}
|
24029
23696
|
convert(statement) {
|
24030
23697
|
const { tableName, columnName, newDataType, schema: schema5 } = statement;
|
@@ -24033,8 +23700,8 @@ var init_sqlgenerator = __esm({
|
|
24033
23700
|
}
|
24034
23701
|
};
|
24035
23702
|
PgAlterTableAlterColumnSetDefaultConvertor = class extends Convertor {
|
24036
|
-
can(statement,
|
24037
|
-
return statement.type === "alter_table_alter_column_set_default" &&
|
23703
|
+
can(statement, dialect4) {
|
23704
|
+
return statement.type === "alter_table_alter_column_set_default" && dialect4 === "postgresql";
|
24038
23705
|
}
|
24039
23706
|
convert(statement) {
|
24040
23707
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -24043,8 +23710,8 @@ var init_sqlgenerator = __esm({
|
|
24043
23710
|
}
|
24044
23711
|
};
|
24045
23712
|
PgAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
|
24046
|
-
can(statement,
|
24047
|
-
return statement.type === "alter_table_alter_column_drop_default" &&
|
23713
|
+
can(statement, dialect4) {
|
23714
|
+
return statement.type === "alter_table_alter_column_drop_default" && dialect4 === "postgresql";
|
24048
23715
|
}
|
24049
23716
|
convert(statement) {
|
24050
23717
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -24053,8 +23720,8 @@ var init_sqlgenerator = __esm({
|
|
24053
23720
|
}
|
24054
23721
|
};
|
24055
23722
|
PgAlterTableAlterColumnDropGeneratedConvertor = class extends Convertor {
|
24056
|
-
can(statement,
|
24057
|
-
return statement.type === "alter_table_alter_column_drop_generated" &&
|
23723
|
+
can(statement, dialect4) {
|
23724
|
+
return statement.type === "alter_table_alter_column_drop_generated" && dialect4 === "postgresql";
|
24058
23725
|
}
|
24059
23726
|
convert(statement) {
|
24060
23727
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -24063,8 +23730,8 @@ var init_sqlgenerator = __esm({
|
|
24063
23730
|
}
|
24064
23731
|
};
|
24065
23732
|
PgAlterTableAlterColumnSetExpressionConvertor = class extends Convertor {
|
24066
|
-
can(statement,
|
24067
|
-
return statement.type === "alter_table_alter_column_set_generated" &&
|
23733
|
+
can(statement, dialect4) {
|
23734
|
+
return statement.type === "alter_table_alter_column_set_generated" && dialect4 === "postgresql";
|
24068
23735
|
}
|
24069
23736
|
convert(statement) {
|
24070
23737
|
const {
|
@@ -24101,8 +23768,8 @@ var init_sqlgenerator = __esm({
|
|
24101
23768
|
}
|
24102
23769
|
};
|
24103
23770
|
PgAlterTableAlterColumnAlterrGeneratedConvertor = class extends Convertor {
|
24104
|
-
can(statement,
|
24105
|
-
return statement.type === "alter_table_alter_column_alter_generated" &&
|
23771
|
+
can(statement, dialect4) {
|
23772
|
+
return statement.type === "alter_table_alter_column_alter_generated" && dialect4 === "postgresql";
|
24106
23773
|
}
|
24107
23774
|
convert(statement) {
|
24108
23775
|
const {
|
@@ -24139,8 +23806,8 @@ var init_sqlgenerator = __esm({
|
|
24139
23806
|
}
|
24140
23807
|
};
|
24141
23808
|
SqliteAlterTableAlterColumnDropGeneratedConvertor = class extends Convertor {
|
24142
|
-
can(statement,
|
24143
|
-
return statement.type === "alter_table_alter_column_drop_generated" && (
|
23809
|
+
can(statement, dialect4) {
|
23810
|
+
return statement.type === "alter_table_alter_column_drop_generated" && (dialect4 === "sqlite" || dialect4 === "turso");
|
24144
23811
|
}
|
24145
23812
|
convert(statement) {
|
24146
23813
|
const {
|
@@ -24180,8 +23847,8 @@ var init_sqlgenerator = __esm({
|
|
24180
23847
|
}
|
24181
23848
|
};
|
24182
23849
|
SqliteAlterTableAlterColumnSetExpressionConvertor = class extends Convertor {
|
24183
|
-
can(statement,
|
24184
|
-
return statement.type === "alter_table_alter_column_set_generated" && (
|
23850
|
+
can(statement, dialect4) {
|
23851
|
+
return statement.type === "alter_table_alter_column_set_generated" && (dialect4 === "sqlite" || dialect4 === "turso");
|
24185
23852
|
}
|
24186
23853
|
convert(statement) {
|
24187
23854
|
const {
|
@@ -24221,8 +23888,8 @@ var init_sqlgenerator = __esm({
|
|
24221
23888
|
}
|
24222
23889
|
};
|
24223
23890
|
SqliteAlterTableAlterColumnAlterGeneratedConvertor = class extends Convertor {
|
24224
|
-
can(statement,
|
24225
|
-
return statement.type === "alter_table_alter_column_alter_generated" && (
|
23891
|
+
can(statement, dialect4) {
|
23892
|
+
return statement.type === "alter_table_alter_column_alter_generated" && (dialect4 === "sqlite" || dialect4 === "turso");
|
24226
23893
|
}
|
24227
23894
|
convert(statement) {
|
24228
23895
|
const {
|
@@ -24262,8 +23929,8 @@ var init_sqlgenerator = __esm({
|
|
24262
23929
|
}
|
24263
23930
|
};
|
24264
23931
|
MySqlAlterTableAlterColumnAlterrGeneratedConvertor = class extends Convertor {
|
24265
|
-
can(statement,
|
24266
|
-
return statement.type === "alter_table_alter_column_alter_generated" &&
|
23932
|
+
can(statement, dialect4) {
|
23933
|
+
return statement.type === "alter_table_alter_column_alter_generated" && dialect4 === "mysql";
|
24267
23934
|
}
|
24268
23935
|
convert(statement) {
|
24269
23936
|
const {
|
@@ -24300,24 +23967,24 @@ var init_sqlgenerator = __esm({
|
|
24300
23967
|
}
|
24301
23968
|
};
|
24302
23969
|
MySqlAlterTableAddPk = class extends Convertor {
|
24303
|
-
can(statement,
|
24304
|
-
return statement.type === "alter_table_alter_column_set_pk" &&
|
23970
|
+
can(statement, dialect4) {
|
23971
|
+
return statement.type === "alter_table_alter_column_set_pk" && dialect4 === "mysql";
|
24305
23972
|
}
|
24306
23973
|
convert(statement) {
|
24307
23974
|
return `ALTER TABLE \`${statement.tableName}\` ADD PRIMARY KEY (\`${statement.columnName}\`);`;
|
24308
23975
|
}
|
24309
23976
|
};
|
24310
23977
|
MySqlAlterTableDropPk = class extends Convertor {
|
24311
|
-
can(statement,
|
24312
|
-
return statement.type === "alter_table_alter_column_drop_pk" &&
|
23978
|
+
can(statement, dialect4) {
|
23979
|
+
return statement.type === "alter_table_alter_column_drop_pk" && dialect4 === "mysql";
|
24313
23980
|
}
|
24314
23981
|
convert(statement) {
|
24315
23982
|
return `ALTER TABLE \`${statement.tableName}\` DROP PRIMARY KEY`;
|
24316
23983
|
}
|
24317
23984
|
};
|
24318
23985
|
LibSQLModifyColumn = class extends Convertor {
|
24319
|
-
can(statement,
|
24320
|
-
return (statement.type === "alter_table_alter_column_set_type" || statement.type === "alter_table_alter_column_drop_notnull" || statement.type === "alter_table_alter_column_set_notnull" || statement.type === "alter_table_alter_column_set_default" || statement.type === "alter_table_alter_column_drop_default"
|
23986
|
+
can(statement, dialect4) {
|
23987
|
+
return (statement.type === "alter_table_alter_column_set_type" || statement.type === "alter_table_alter_column_drop_notnull" || statement.type === "alter_table_alter_column_set_notnull" || statement.type === "alter_table_alter_column_set_default" || statement.type === "alter_table_alter_column_drop_default") && dialect4 === "turso";
|
24321
23988
|
}
|
24322
23989
|
convert(statement, json2) {
|
24323
23990
|
const { tableName, columnName } = statement;
|
@@ -24377,8 +24044,8 @@ var init_sqlgenerator = __esm({
|
|
24377
24044
|
}
|
24378
24045
|
};
|
24379
24046
|
MySqlModifyColumn = class extends Convertor {
|
24380
|
-
can(statement,
|
24381
|
-
return (statement.type === "alter_table_alter_column_set_type" || statement.type === "alter_table_alter_column_set_notnull" || statement.type === "alter_table_alter_column_drop_notnull" || statement.type === "alter_table_alter_column_drop_on_update" || statement.type === "alter_table_alter_column_set_on_update" || statement.type === "alter_table_alter_column_set_autoincrement" || statement.type === "alter_table_alter_column_drop_autoincrement" || statement.type === "alter_table_alter_column_set_default" || statement.type === "alter_table_alter_column_drop_default" || statement.type === "alter_table_alter_column_set_generated" || statement.type === "alter_table_alter_column_drop_generated") &&
|
24047
|
+
can(statement, dialect4) {
|
24048
|
+
return (statement.type === "alter_table_alter_column_set_type" || statement.type === "alter_table_alter_column_set_notnull" || statement.type === "alter_table_alter_column_drop_notnull" || statement.type === "alter_table_alter_column_drop_on_update" || statement.type === "alter_table_alter_column_set_on_update" || statement.type === "alter_table_alter_column_set_autoincrement" || statement.type === "alter_table_alter_column_drop_autoincrement" || statement.type === "alter_table_alter_column_set_default" || statement.type === "alter_table_alter_column_drop_default" || statement.type === "alter_table_alter_column_set_generated" || statement.type === "alter_table_alter_column_drop_generated") && dialect4 === "mysql";
|
24382
24049
|
}
|
24383
24050
|
convert(statement) {
|
24384
24051
|
var _a, _b, _c, _d, _e, _f, _g;
|
@@ -24515,8 +24182,8 @@ var init_sqlgenerator = __esm({
|
|
24515
24182
|
}
|
24516
24183
|
};
|
24517
24184
|
PgAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
|
24518
|
-
can(statement,
|
24519
|
-
return statement.type === "create_composite_pk" &&
|
24185
|
+
can(statement, dialect4) {
|
24186
|
+
return statement.type === "create_composite_pk" && dialect4 === "postgresql";
|
24520
24187
|
}
|
24521
24188
|
convert(statement) {
|
24522
24189
|
const { name, columns } = PgSquasher.unsquashPK(statement.data);
|
@@ -24525,8 +24192,8 @@ var init_sqlgenerator = __esm({
|
|
24525
24192
|
}
|
24526
24193
|
};
|
24527
24194
|
PgAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
|
24528
|
-
can(statement,
|
24529
|
-
return statement.type === "delete_composite_pk" &&
|
24195
|
+
can(statement, dialect4) {
|
24196
|
+
return statement.type === "delete_composite_pk" && dialect4 === "postgresql";
|
24530
24197
|
}
|
24531
24198
|
convert(statement) {
|
24532
24199
|
const { name, columns } = PgSquasher.unsquashPK(statement.data);
|
@@ -24535,8 +24202,8 @@ var init_sqlgenerator = __esm({
|
|
24535
24202
|
}
|
24536
24203
|
};
|
24537
24204
|
PgAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
|
24538
|
-
can(statement,
|
24539
|
-
return statement.type === "alter_composite_pk" &&
|
24205
|
+
can(statement, dialect4) {
|
24206
|
+
return statement.type === "alter_composite_pk" && dialect4 === "postgresql";
|
24540
24207
|
}
|
24541
24208
|
convert(statement) {
|
24542
24209
|
const { name, columns } = PgSquasher.unsquashPK(statement.old);
|
@@ -24549,8 +24216,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24549
24216
|
}
|
24550
24217
|
};
|
24551
24218
|
MySqlAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
|
24552
|
-
can(statement,
|
24553
|
-
return statement.type === "create_composite_pk" &&
|
24219
|
+
can(statement, dialect4) {
|
24220
|
+
return statement.type === "create_composite_pk" && dialect4 === "mysql";
|
24554
24221
|
}
|
24555
24222
|
convert(statement) {
|
24556
24223
|
const { name, columns } = MySqlSquasher.unsquashPK(statement.data);
|
@@ -24558,8 +24225,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24558
24225
|
}
|
24559
24226
|
};
|
24560
24227
|
MySqlAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
|
24561
|
-
can(statement,
|
24562
|
-
return statement.type === "delete_composite_pk" &&
|
24228
|
+
can(statement, dialect4) {
|
24229
|
+
return statement.type === "delete_composite_pk" && dialect4 === "mysql";
|
24563
24230
|
}
|
24564
24231
|
convert(statement) {
|
24565
24232
|
const { name, columns } = MySqlSquasher.unsquashPK(statement.data);
|
@@ -24567,8 +24234,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24567
24234
|
}
|
24568
24235
|
};
|
24569
24236
|
MySqlAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
|
24570
|
-
can(statement,
|
24571
|
-
return statement.type === "alter_composite_pk" &&
|
24237
|
+
can(statement, dialect4) {
|
24238
|
+
return statement.type === "alter_composite_pk" && dialect4 === "mysql";
|
24572
24239
|
}
|
24573
24240
|
convert(statement) {
|
24574
24241
|
const { name, columns } = MySqlSquasher.unsquashPK(statement.old);
|
@@ -24579,8 +24246,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24579
24246
|
}
|
24580
24247
|
};
|
24581
24248
|
PgAlterTableAlterColumnSetPrimaryKeyConvertor = class extends Convertor {
|
24582
|
-
can(statement,
|
24583
|
-
return statement.type === "alter_table_alter_column_set_pk" &&
|
24249
|
+
can(statement, dialect4) {
|
24250
|
+
return statement.type === "alter_table_alter_column_set_pk" && dialect4 === "postgresql";
|
24584
24251
|
}
|
24585
24252
|
convert(statement) {
|
24586
24253
|
const { tableName, columnName } = statement;
|
@@ -24589,8 +24256,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24589
24256
|
}
|
24590
24257
|
};
|
24591
24258
|
PgAlterTableAlterColumnDropPrimaryKeyConvertor = class extends Convertor {
|
24592
|
-
can(statement,
|
24593
|
-
return statement.type === "alter_table_alter_column_drop_pk" &&
|
24259
|
+
can(statement, dialect4) {
|
24260
|
+
return statement.type === "alter_table_alter_column_drop_pk" && dialect4 === "postgresql";
|
24594
24261
|
}
|
24595
24262
|
convert(statement) {
|
24596
24263
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -24613,8 +24280,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24613
24280
|
}
|
24614
24281
|
};
|
24615
24282
|
PgAlterTableAlterColumnSetNotNullConvertor = class extends Convertor {
|
24616
|
-
can(statement,
|
24617
|
-
return statement.type === "alter_table_alter_column_set_notnull" &&
|
24283
|
+
can(statement, dialect4) {
|
24284
|
+
return statement.type === "alter_table_alter_column_set_notnull" && dialect4 === "postgresql";
|
24618
24285
|
}
|
24619
24286
|
convert(statement) {
|
24620
24287
|
const { tableName, columnName } = statement;
|
@@ -24623,8 +24290,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24623
24290
|
}
|
24624
24291
|
};
|
24625
24292
|
PgAlterTableAlterColumnDropNotNullConvertor = class extends Convertor {
|
24626
|
-
can(statement,
|
24627
|
-
return statement.type === "alter_table_alter_column_drop_notnull" &&
|
24293
|
+
can(statement, dialect4) {
|
24294
|
+
return statement.type === "alter_table_alter_column_drop_notnull" && dialect4 === "postgresql";
|
24628
24295
|
}
|
24629
24296
|
convert(statement) {
|
24630
24297
|
const { tableName, columnName } = statement;
|
@@ -24633,8 +24300,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24633
24300
|
}
|
24634
24301
|
};
|
24635
24302
|
PgCreateForeignKeyConvertor = class extends Convertor {
|
24636
|
-
can(statement,
|
24637
|
-
return statement.type === "create_reference" &&
|
24303
|
+
can(statement, dialect4) {
|
24304
|
+
return statement.type === "create_reference" && dialect4 === "postgresql";
|
24638
24305
|
}
|
24639
24306
|
convert(statement) {
|
24640
24307
|
const {
|
@@ -24663,8 +24330,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24663
24330
|
}
|
24664
24331
|
};
|
24665
24332
|
LibSQLCreateForeignKeyConvertor = class extends Convertor {
|
24666
|
-
can(statement,
|
24667
|
-
return statement.type === "create_reference" &&
|
24333
|
+
can(statement, dialect4) {
|
24334
|
+
return statement.type === "create_reference" && dialect4 === "turso";
|
24668
24335
|
}
|
24669
24336
|
convert(statement, json2, action) {
|
24670
24337
|
const { columnsFrom, columnsTo, tableFrom, onDelete, onUpdate, tableTo } = action === "push" ? SQLiteSquasher.unsquashPushFK(statement.data) : SQLiteSquasher.unsquashFK(statement.data);
|
@@ -24680,8 +24347,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24680
24347
|
}
|
24681
24348
|
};
|
24682
24349
|
MySqlCreateForeignKeyConvertor = class extends Convertor {
|
24683
|
-
can(statement,
|
24684
|
-
return statement.type === "create_reference" &&
|
24350
|
+
can(statement, dialect4) {
|
24351
|
+
return statement.type === "create_reference" && dialect4 === "mysql";
|
24685
24352
|
}
|
24686
24353
|
convert(statement) {
|
24687
24354
|
const {
|
@@ -24701,8 +24368,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24701
24368
|
}
|
24702
24369
|
};
|
24703
24370
|
PgAlterForeignKeyConvertor = class extends Convertor {
|
24704
|
-
can(statement,
|
24705
|
-
return statement.type === "alter_reference" &&
|
24371
|
+
can(statement, dialect4) {
|
24372
|
+
return statement.type === "alter_reference" && dialect4 === "postgresql";
|
24706
24373
|
}
|
24707
24374
|
convert(statement) {
|
24708
24375
|
const newFk = PgSquasher.unsquashFK(statement.data);
|
@@ -24726,8 +24393,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24726
24393
|
}
|
24727
24394
|
};
|
24728
24395
|
PgDeleteForeignKeyConvertor = class extends Convertor {
|
24729
|
-
can(statement,
|
24730
|
-
return statement.type === "delete_reference" &&
|
24396
|
+
can(statement, dialect4) {
|
24397
|
+
return statement.type === "delete_reference" && dialect4 === "postgresql";
|
24731
24398
|
}
|
24732
24399
|
convert(statement) {
|
24733
24400
|
const tableFrom = statement.tableName;
|
@@ -24738,8 +24405,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24738
24405
|
}
|
24739
24406
|
};
|
24740
24407
|
MySqlDeleteForeignKeyConvertor = class extends Convertor {
|
24741
|
-
can(statement,
|
24742
|
-
return statement.type === "delete_reference" &&
|
24408
|
+
can(statement, dialect4) {
|
24409
|
+
return statement.type === "delete_reference" && dialect4 === "mysql";
|
24743
24410
|
}
|
24744
24411
|
convert(statement) {
|
24745
24412
|
const tableFrom = statement.tableName;
|
@@ -24749,8 +24416,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24749
24416
|
}
|
24750
24417
|
};
|
24751
24418
|
CreatePgIndexConvertor = class extends Convertor {
|
24752
|
-
can(statement,
|
24753
|
-
return statement.type === "create_index_pg" &&
|
24419
|
+
can(statement, dialect4) {
|
24420
|
+
return statement.type === "create_index_pg" && dialect4 === "postgresql";
|
24754
24421
|
}
|
24755
24422
|
convert(statement) {
|
24756
24423
|
const {
|
@@ -24781,8 +24448,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24781
24448
|
}
|
24782
24449
|
};
|
24783
24450
|
CreateMySqlIndexConvertor = class extends Convertor {
|
24784
|
-
can(statement,
|
24785
|
-
return statement.type === "create_index" &&
|
24451
|
+
can(statement, dialect4) {
|
24452
|
+
return statement.type === "create_index" && dialect4 === "mysql";
|
24786
24453
|
}
|
24787
24454
|
convert(statement) {
|
24788
24455
|
const { name, columns, isUnique } = MySqlSquasher.unsquashIdx(
|
@@ -24797,8 +24464,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24797
24464
|
}
|
24798
24465
|
};
|
24799
24466
|
CreateSqliteIndexConvertor = class extends Convertor {
|
24800
|
-
can(statement,
|
24801
|
-
return statement.type === "create_index" && (
|
24467
|
+
can(statement, dialect4) {
|
24468
|
+
return statement.type === "create_index" && (dialect4 === "sqlite" || dialect4 === "turso");
|
24802
24469
|
}
|
24803
24470
|
convert(statement) {
|
24804
24471
|
const { name, columns, isUnique, where } = SQLiteSquasher.unsquashIdx(
|
@@ -24814,8 +24481,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24814
24481
|
}
|
24815
24482
|
};
|
24816
24483
|
PgDropIndexConvertor = class extends Convertor {
|
24817
|
-
can(statement,
|
24818
|
-
return statement.type === "drop_index" &&
|
24484
|
+
can(statement, dialect4) {
|
24485
|
+
return statement.type === "drop_index" && dialect4 === "postgresql";
|
24819
24486
|
}
|
24820
24487
|
convert(statement) {
|
24821
24488
|
const { name } = PgSquasher.unsquashIdx(statement.data);
|
@@ -24823,8 +24490,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24823
24490
|
}
|
24824
24491
|
};
|
24825
24492
|
PgCreateSchemaConvertor = class extends Convertor {
|
24826
|
-
can(statement,
|
24827
|
-
return statement.type === "create_schema" &&
|
24493
|
+
can(statement, dialect4) {
|
24494
|
+
return statement.type === "create_schema" && dialect4 === "postgresql";
|
24828
24495
|
}
|
24829
24496
|
convert(statement) {
|
24830
24497
|
const { name } = statement;
|
@@ -24833,8 +24500,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24833
24500
|
}
|
24834
24501
|
};
|
24835
24502
|
PgRenameSchemaConvertor = class extends Convertor {
|
24836
|
-
can(statement,
|
24837
|
-
return statement.type === "rename_schema" &&
|
24503
|
+
can(statement, dialect4) {
|
24504
|
+
return statement.type === "rename_schema" && dialect4 === "postgresql";
|
24838
24505
|
}
|
24839
24506
|
convert(statement) {
|
24840
24507
|
const { from, to } = statement;
|
@@ -24843,8 +24510,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24843
24510
|
}
|
24844
24511
|
};
|
24845
24512
|
PgDropSchemaConvertor = class extends Convertor {
|
24846
|
-
can(statement,
|
24847
|
-
return statement.type === "drop_schema" &&
|
24513
|
+
can(statement, dialect4) {
|
24514
|
+
return statement.type === "drop_schema" && dialect4 === "postgresql";
|
24848
24515
|
}
|
24849
24516
|
convert(statement) {
|
24850
24517
|
const { name } = statement;
|
@@ -24853,8 +24520,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24853
24520
|
}
|
24854
24521
|
};
|
24855
24522
|
PgAlterTableSetSchemaConvertor = class extends Convertor {
|
24856
|
-
can(statement,
|
24857
|
-
return statement.type === "alter_table_set_schema" &&
|
24523
|
+
can(statement, dialect4) {
|
24524
|
+
return statement.type === "alter_table_set_schema" && dialect4 === "postgresql";
|
24858
24525
|
}
|
24859
24526
|
convert(statement) {
|
24860
24527
|
const { tableName, schemaFrom, schemaTo } = statement;
|
@@ -24863,8 +24530,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24863
24530
|
}
|
24864
24531
|
};
|
24865
24532
|
PgAlterTableSetNewSchemaConvertor = class extends Convertor {
|
24866
|
-
can(statement,
|
24867
|
-
return statement.type === "alter_table_set_new_schema" &&
|
24533
|
+
can(statement, dialect4) {
|
24534
|
+
return statement.type === "alter_table_set_new_schema" && dialect4 === "postgresql";
|
24868
24535
|
}
|
24869
24536
|
convert(statement) {
|
24870
24537
|
const { tableName, to, from } = statement;
|
@@ -24874,8 +24541,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24874
24541
|
}
|
24875
24542
|
};
|
24876
24543
|
PgAlterTableRemoveFromSchemaConvertor = class extends Convertor {
|
24877
|
-
can(statement,
|
24878
|
-
return statement.type === "alter_table_remove_from_schema" &&
|
24544
|
+
can(statement, dialect4) {
|
24545
|
+
return statement.type === "alter_table_remove_from_schema" && dialect4 === "postgresql";
|
24879
24546
|
}
|
24880
24547
|
convert(statement) {
|
24881
24548
|
const { tableName, schema: schema5 } = statement;
|
@@ -24885,8 +24552,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24885
24552
|
}
|
24886
24553
|
};
|
24887
24554
|
SqliteDropIndexConvertor = class extends Convertor {
|
24888
|
-
can(statement,
|
24889
|
-
return statement.type === "drop_index" && (
|
24555
|
+
can(statement, dialect4) {
|
24556
|
+
return statement.type === "drop_index" && (dialect4 === "sqlite" || dialect4 === "turso");
|
24890
24557
|
}
|
24891
24558
|
convert(statement) {
|
24892
24559
|
const { name } = PgSquasher.unsquashIdx(statement.data);
|
@@ -24894,8 +24561,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24894
24561
|
}
|
24895
24562
|
};
|
24896
24563
|
MySqlDropIndexConvertor = class extends Convertor {
|
24897
|
-
can(statement,
|
24898
|
-
return statement.type === "drop_index" &&
|
24564
|
+
can(statement, dialect4) {
|
24565
|
+
return statement.type === "drop_index" && dialect4 === "mysql";
|
24899
24566
|
}
|
24900
24567
|
convert(statement) {
|
24901
24568
|
const { name } = MySqlSquasher.unsquashIdx(statement.data);
|
@@ -24903,26 +24570,22 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24903
24570
|
}
|
24904
24571
|
};
|
24905
24572
|
SQLiteRecreateTableConvertor = class extends Convertor {
|
24906
|
-
can(statement,
|
24907
|
-
return statement.type === "recreate_table" &&
|
24573
|
+
can(statement, dialect4) {
|
24574
|
+
return statement.type === "recreate_table" && dialect4 === "sqlite";
|
24908
24575
|
}
|
24909
24576
|
convert(statement) {
|
24910
|
-
const { tableName, columns, compositePKs, referenceData
|
24577
|
+
const { tableName, columns, compositePKs, referenceData } = statement;
|
24911
24578
|
const columnNames = columns.map((it) => `"${it.name}"`).join(", ");
|
24912
24579
|
const newTableName = `__new_${tableName}`;
|
24913
24580
|
const sqlStatements = [];
|
24914
24581
|
sqlStatements.push(`PRAGMA foreign_keys=OFF;`);
|
24915
|
-
const mappedCheckConstraints = checkConstraints.map(
|
24916
|
-
(it) => it.replaceAll(`"${tableName}".`, `"${newTableName}".`).replaceAll(`\`${tableName}\`.`, `\`${newTableName}\`.`).replaceAll(`${tableName}.`, `${newTableName}.`).replaceAll(`'${tableName}'.`, `'${newTableName}'.`)
|
24917
|
-
);
|
24918
24582
|
sqlStatements.push(
|
24919
24583
|
new SQLiteCreateTableConvertor().convert({
|
24920
24584
|
type: "sqlite_create_table",
|
24921
24585
|
tableName: newTableName,
|
24922
24586
|
columns,
|
24923
24587
|
referenceData,
|
24924
|
-
compositePKs
|
24925
|
-
checkConstraints: mappedCheckConstraints
|
24588
|
+
compositePKs
|
24926
24589
|
})
|
24927
24590
|
);
|
24928
24591
|
sqlStatements.push(
|
@@ -24949,17 +24612,14 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24949
24612
|
}
|
24950
24613
|
};
|
24951
24614
|
LibSQLRecreateTableConvertor = class extends Convertor {
|
24952
|
-
can(statement,
|
24953
|
-
return statement.type === "recreate_table" &&
|
24615
|
+
can(statement, dialect4) {
|
24616
|
+
return statement.type === "recreate_table" && dialect4 === "turso";
|
24954
24617
|
}
|
24955
24618
|
convert(statement) {
|
24956
|
-
const { tableName, columns, compositePKs, referenceData
|
24619
|
+
const { tableName, columns, compositePKs, referenceData } = statement;
|
24957
24620
|
const columnNames = columns.map((it) => `"${it.name}"`).join(", ");
|
24958
24621
|
const newTableName = `__new_${tableName}`;
|
24959
24622
|
const sqlStatements = [];
|
24960
|
-
const mappedCheckConstraints = checkConstraints.map(
|
24961
|
-
(it) => it.replaceAll(`"${tableName}".`, `"${newTableName}".`).replaceAll(`\`${tableName}\`.`, `\`${newTableName}\`.`).replaceAll(`${tableName}.`, `${newTableName}.`).replaceAll(`'${tableName}'.`, `\`${newTableName}\`.`)
|
24962
|
-
);
|
24963
24623
|
sqlStatements.push(`PRAGMA foreign_keys=OFF;`);
|
24964
24624
|
sqlStatements.push(
|
24965
24625
|
new SQLiteCreateTableConvertor().convert({
|
@@ -24967,8 +24627,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24967
24627
|
tableName: newTableName,
|
24968
24628
|
columns,
|
24969
24629
|
referenceData,
|
24970
|
-
compositePKs
|
24971
|
-
checkConstraints: mappedCheckConstraints
|
24630
|
+
compositePKs
|
24972
24631
|
})
|
24973
24632
|
);
|
24974
24633
|
sqlStatements.push(
|
@@ -25024,10 +24683,6 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
25024
24683
|
convertors.push(new PgAlterTableAlterColumnSetTypeConvertor());
|
25025
24684
|
convertors.push(new PgAlterTableAddUniqueConstraintConvertor());
|
25026
24685
|
convertors.push(new PgAlterTableDropUniqueConstraintConvertor());
|
25027
|
-
convertors.push(new PgAlterTableAddCheckConstraintConvertor());
|
25028
|
-
convertors.push(new PgAlterTableDeleteCheckConstraintConvertor());
|
25029
|
-
convertors.push(new MySqlAlterTableAddCheckConstraintConvertor());
|
25030
|
-
convertors.push(new MySqlAlterTableDeleteCheckConstraintConvertor());
|
25031
24686
|
convertors.push(new MySQLAlterTableAddUniqueConstraintConvertor());
|
25032
24687
|
convertors.push(new MySQLAlterTableDropUniqueConstraintConvertor());
|
25033
24688
|
convertors.push(new CreatePgIndexConvertor());
|
@@ -25119,10 +24774,6 @@ var init_sqlitePushUtils = __esm({
|
|
25119
24774
|
const compositePKs = Object.values(
|
25120
24775
|
json.tables[tableName].compositePrimaryKeys
|
25121
24776
|
).map((it) => SQLiteSquasher.unsquashPK(it));
|
25122
|
-
const checkConstraints = Object.values(json.tables[tableName].checkConstraints);
|
25123
|
-
const mappedCheckConstraints = checkConstraints.map(
|
25124
|
-
(it) => it.replaceAll(`"${tableName}".`, `"${newTableName}".`).replaceAll(`\`${tableName}\`.`, `\`${newTableName}\`.`).replaceAll(`${tableName}.`, `${newTableName}.`).replaceAll(`'${tableName}'.`, `\`${newTableName}\`.`)
|
25125
|
-
);
|
25126
24777
|
const fks = referenceData.map((it) => SQLiteSquasher.unsquashPushFK(it));
|
25127
24778
|
statements.push(
|
25128
24779
|
new SQLiteCreateTableConvertor().convert({
|
@@ -25130,8 +24781,7 @@ var init_sqlitePushUtils = __esm({
|
|
25130
24781
|
tableName: newTableName,
|
25131
24782
|
columns: tableColumns,
|
25132
24783
|
referenceData: fks,
|
25133
|
-
compositePKs
|
25134
|
-
checkConstraints: mappedCheckConstraints
|
24784
|
+
compositePKs
|
25135
24785
|
})
|
25136
24786
|
);
|
25137
24787
|
if (!dataLoss) {
|
@@ -25343,7 +24993,7 @@ var init_sqlitePushUtils = __esm({
|
|
25343
24993
|
});
|
25344
24994
|
|
25345
24995
|
// src/jsonStatements.ts
|
25346
|
-
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,
|
24996
|
+
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;
|
25347
24997
|
var init_jsonStatements = __esm({
|
25348
24998
|
"src/jsonStatements.ts"() {
|
25349
24999
|
"use strict";
|
@@ -25354,7 +25004,7 @@ var init_jsonStatements = __esm({
|
|
25354
25004
|
init_pgSchema();
|
25355
25005
|
init_sqliteSchema();
|
25356
25006
|
preparePgCreateTableJson = (table4, json2) => {
|
25357
|
-
const { name, schema: schema5, columns, compositePrimaryKeys, uniqueConstraints
|
25007
|
+
const { name, schema: schema5, columns, compositePrimaryKeys, uniqueConstraints } = table4;
|
25358
25008
|
const tableKey2 = `${schema5 || "public"}.${name}`;
|
25359
25009
|
const compositePkName = Object.values(compositePrimaryKeys).length > 0 ? json2.tables[tableKey2].compositePrimaryKeys[`${PgSquasher.unsquashPK(Object.values(compositePrimaryKeys)[0]).name}`].name : "";
|
25360
25010
|
return {
|
@@ -25364,12 +25014,11 @@ var init_jsonStatements = __esm({
|
|
25364
25014
|
columns: Object.values(columns),
|
25365
25015
|
compositePKs: Object.values(compositePrimaryKeys),
|
25366
25016
|
compositePkName,
|
25367
|
-
uniqueConstraints: Object.values(uniqueConstraints)
|
25368
|
-
checkConstraints: Object.values(checkConstraints)
|
25017
|
+
uniqueConstraints: Object.values(uniqueConstraints)
|
25369
25018
|
};
|
25370
25019
|
};
|
25371
25020
|
prepareMySqlCreateTableJson = (table4, json2, internals) => {
|
25372
|
-
const { name, schema: schema5, columns, compositePrimaryKeys, uniqueConstraints
|
25021
|
+
const { name, schema: schema5, columns, compositePrimaryKeys, uniqueConstraints } = table4;
|
25373
25022
|
return {
|
25374
25023
|
type: "create_table",
|
25375
25024
|
tableName: name,
|
@@ -25378,12 +25027,11 @@ var init_jsonStatements = __esm({
|
|
25378
25027
|
compositePKs: Object.values(compositePrimaryKeys),
|
25379
25028
|
compositePkName: Object.values(compositePrimaryKeys).length > 0 ? json2.tables[name].compositePrimaryKeys[MySqlSquasher.unsquashPK(Object.values(compositePrimaryKeys)[0]).name].name : "",
|
25380
25029
|
uniqueConstraints: Object.values(uniqueConstraints),
|
25381
|
-
internals
|
25382
|
-
checkConstraints: Object.values(checkConstraints)
|
25030
|
+
internals
|
25383
25031
|
};
|
25384
25032
|
};
|
25385
25033
|
prepareSQLiteCreateTable = (table4, action) => {
|
25386
|
-
const { name, columns, uniqueConstraints
|
25034
|
+
const { name, columns, uniqueConstraints } = table4;
|
25387
25035
|
const references2 = Object.values(table4.foreignKeys);
|
25388
25036
|
const composites = Object.values(table4.compositePrimaryKeys).map(
|
25389
25037
|
(it) => SQLiteSquasher.unsquashPK(it)
|
@@ -25397,8 +25045,7 @@ var init_jsonStatements = __esm({
|
|
25397
25045
|
columns: Object.values(columns),
|
25398
25046
|
referenceData: fks,
|
25399
25047
|
compositePKs: composites,
|
25400
|
-
uniqueConstraints: Object.values(uniqueConstraints)
|
25401
|
-
checkConstraints: Object.values(checkConstraints)
|
25048
|
+
uniqueConstraints: Object.values(uniqueConstraints)
|
25402
25049
|
};
|
25403
25050
|
};
|
25404
25051
|
prepareDropTableJson = (table4) => {
|
@@ -26646,26 +26293,6 @@ var init_jsonStatements = __esm({
|
|
26646
26293
|
};
|
26647
26294
|
});
|
26648
26295
|
};
|
26649
|
-
prepareAddCheckConstraint = (tableName, schema5, check2) => {
|
26650
|
-
return Object.values(check2).map((it) => {
|
26651
|
-
return {
|
26652
|
-
type: "create_check_constraint",
|
26653
|
-
tableName,
|
26654
|
-
data: it,
|
26655
|
-
schema: schema5
|
26656
|
-
};
|
26657
|
-
});
|
26658
|
-
};
|
26659
|
-
prepareDeleteCheckConstraint = (tableName, schema5, check2) => {
|
26660
|
-
return Object.values(check2).map((it) => {
|
26661
|
-
return {
|
26662
|
-
type: "delete_check_constraint",
|
26663
|
-
tableName,
|
26664
|
-
constraintName: PgSquasher.unsquashCheck(it).name,
|
26665
|
-
schema: schema5
|
26666
|
-
};
|
26667
|
-
});
|
26668
|
-
};
|
26669
26296
|
prepareAddCompositePrimaryKeyMySql = (tableName, pks, json1, json2) => {
|
26670
26297
|
var _a, _b;
|
26671
26298
|
const res = [];
|
@@ -26716,7 +26343,7 @@ var init_statementCombiner = __esm({
|
|
26716
26343
|
init_jsonStatements();
|
26717
26344
|
init_sqliteSchema();
|
26718
26345
|
prepareLibSQLRecreateTable = (table4, action) => {
|
26719
|
-
const { name, columns, uniqueConstraints, indexes
|
26346
|
+
const { name, columns, uniqueConstraints, indexes } = table4;
|
26720
26347
|
const composites = Object.values(table4.compositePrimaryKeys).map(
|
26721
26348
|
(it) => SQLiteSquasher.unsquashPK(it)
|
26722
26349
|
);
|
@@ -26731,8 +26358,7 @@ var init_statementCombiner = __esm({
|
|
26731
26358
|
columns: Object.values(columns),
|
26732
26359
|
compositePKs: composites,
|
26733
26360
|
referenceData: fks,
|
26734
|
-
uniqueConstraints: Object.values(uniqueConstraints)
|
26735
|
-
checkConstraints: Object.values(checkConstraints)
|
26361
|
+
uniqueConstraints: Object.values(uniqueConstraints)
|
26736
26362
|
}
|
26737
26363
|
];
|
26738
26364
|
if (Object.keys(indexes).length) {
|
@@ -26741,7 +26367,7 @@ var init_statementCombiner = __esm({
|
|
26741
26367
|
return statements;
|
26742
26368
|
};
|
26743
26369
|
prepareSQLiteRecreateTable = (table4, action) => {
|
26744
|
-
const { name, columns, uniqueConstraints, indexes
|
26370
|
+
const { name, columns, uniqueConstraints, indexes } = table4;
|
26745
26371
|
const composites = Object.values(table4.compositePrimaryKeys).map(
|
26746
26372
|
(it) => SQLiteSquasher.unsquashPK(it)
|
26747
26373
|
);
|
@@ -26756,8 +26382,7 @@ var init_statementCombiner = __esm({
|
|
26756
26382
|
columns: Object.values(columns),
|
26757
26383
|
compositePKs: composites,
|
26758
26384
|
referenceData: fks,
|
26759
|
-
uniqueConstraints: Object.values(uniqueConstraints)
|
26760
|
-
checkConstraints: Object.values(checkConstraints)
|
26385
|
+
uniqueConstraints: Object.values(uniqueConstraints)
|
26761
26386
|
}
|
26762
26387
|
];
|
26763
26388
|
if (Object.keys(indexes).length) {
|
@@ -26768,7 +26393,7 @@ var init_statementCombiner = __esm({
|
|
26768
26393
|
libSQLCombineStatements = (statements, json2, action) => {
|
26769
26394
|
const newStatements = {};
|
26770
26395
|
for (const statement of statements) {
|
26771
|
-
if (statement.type === "alter_table_alter_column_drop_autoincrement" || statement.type === "alter_table_alter_column_set_autoincrement" || statement.type === "alter_table_alter_column_drop_pk" || statement.type === "alter_table_alter_column_set_pk" || statement.type === "create_composite_pk" || statement.type === "alter_composite_pk" || statement.type === "delete_composite_pk"
|
26396
|
+
if (statement.type === "alter_table_alter_column_drop_autoincrement" || statement.type === "alter_table_alter_column_set_autoincrement" || statement.type === "alter_table_alter_column_drop_pk" || statement.type === "alter_table_alter_column_set_pk" || statement.type === "create_composite_pk" || statement.type === "alter_composite_pk" || statement.type === "delete_composite_pk") {
|
26772
26397
|
const tableName2 = statement.tableName;
|
26773
26398
|
const statementsForTable2 = newStatements[tableName2];
|
26774
26399
|
if (!statementsForTable2) {
|
@@ -26909,16 +26534,16 @@ var init_statementCombiner = __esm({
|
|
26909
26534
|
sqliteCombineStatements = (statements, json2, action) => {
|
26910
26535
|
const newStatements = {};
|
26911
26536
|
for (const statement of statements) {
|
26912
|
-
if (statement.type === "alter_table_alter_column_set_type" || statement.type === "alter_table_alter_column_set_default" || statement.type === "alter_table_alter_column_drop_default" || statement.type === "alter_table_alter_column_set_notnull" || statement.type === "alter_table_alter_column_drop_notnull" || statement.type === "alter_table_alter_column_drop_autoincrement" || statement.type === "alter_table_alter_column_set_autoincrement" || statement.type === "alter_table_alter_column_drop_pk" || statement.type === "alter_table_alter_column_set_pk" || statement.type === "delete_reference" || statement.type === "alter_reference" || statement.type === "create_composite_pk" || statement.type === "alter_composite_pk" || statement.type === "delete_composite_pk" || statement.type === "create_unique_constraint" || statement.type === "delete_unique_constraint"
|
26537
|
+
if (statement.type === "alter_table_alter_column_set_type" || statement.type === "alter_table_alter_column_set_default" || statement.type === "alter_table_alter_column_drop_default" || statement.type === "alter_table_alter_column_set_notnull" || statement.type === "alter_table_alter_column_drop_notnull" || statement.type === "alter_table_alter_column_drop_autoincrement" || statement.type === "alter_table_alter_column_set_autoincrement" || statement.type === "alter_table_alter_column_drop_pk" || statement.type === "alter_table_alter_column_set_pk" || statement.type === "delete_reference" || statement.type === "alter_reference" || statement.type === "create_composite_pk" || statement.type === "alter_composite_pk" || statement.type === "delete_composite_pk" || statement.type === "create_unique_constraint" || statement.type === "delete_unique_constraint") {
|
26913
26538
|
const tableName2 = statement.tableName;
|
26914
26539
|
const statementsForTable2 = newStatements[tableName2];
|
26915
26540
|
if (!statementsForTable2) {
|
26916
|
-
newStatements[tableName2] =
|
26541
|
+
newStatements[tableName2] = prepareLibSQLRecreateTable(json2.tables[tableName2], action);
|
26917
26542
|
continue;
|
26918
26543
|
}
|
26919
26544
|
if (!statementsForTable2.some(({ type }) => type === "recreate_table")) {
|
26920
26545
|
const wasRename = statementsForTable2.some(({ type }) => type === "rename_table");
|
26921
|
-
const preparedStatements =
|
26546
|
+
const preparedStatements = prepareLibSQLRecreateTable(json2.tables[tableName2], action);
|
26922
26547
|
if (wasRename) {
|
26923
26548
|
newStatements[tableName2].push(...preparedStatements);
|
26924
26549
|
} else {
|
@@ -26932,12 +26557,12 @@ var init_statementCombiner = __esm({
|
|
26932
26557
|
const tableName2 = statement.tableName;
|
26933
26558
|
const statementsForTable2 = newStatements[tableName2];
|
26934
26559
|
if (!statementsForTable2) {
|
26935
|
-
newStatements[tableName2] =
|
26560
|
+
newStatements[tableName2] = prepareLibSQLRecreateTable(json2.tables[tableName2], action);
|
26936
26561
|
continue;
|
26937
26562
|
}
|
26938
26563
|
if (!statementsForTable2.some(({ type }) => type === "recreate_table")) {
|
26939
26564
|
const wasRename = statementsForTable2.some(({ type }) => type === "rename_table");
|
26940
|
-
const preparedStatements =
|
26565
|
+
const preparedStatements = prepareLibSQLRecreateTable(json2.tables[tableName2], action);
|
26941
26566
|
if (wasRename) {
|
26942
26567
|
newStatements[tableName2].push(...preparedStatements);
|
26943
26568
|
} else {
|
@@ -26962,7 +26587,7 @@ var init_statementCombiner = __esm({
|
|
26962
26587
|
}
|
26963
26588
|
if (!statementsForTable2.some(({ type }) => type === "recreate_table")) {
|
26964
26589
|
const wasRename = statementsForTable2.some(({ type }) => type === "rename_table");
|
26965
|
-
const preparedStatements =
|
26590
|
+
const preparedStatements = prepareLibSQLRecreateTable(json2.tables[tableName2], action);
|
26966
26591
|
if (wasRename) {
|
26967
26592
|
newStatements[tableName2].push(...preparedStatements);
|
26968
26593
|
} else {
|
@@ -27097,8 +26722,7 @@ var init_snapshotsDiffer = __esm({
|
|
27097
26722
|
indexes: recordType(stringType(), stringType()),
|
27098
26723
|
foreignKeys: recordType(stringType(), stringType()),
|
27099
26724
|
compositePrimaryKeys: recordType(stringType(), stringType()).default({}),
|
27100
|
-
uniqueConstraints: recordType(stringType(), stringType()).default({})
|
27101
|
-
checkConstraints: recordType(stringType(), stringType()).default({})
|
26725
|
+
uniqueConstraints: recordType(stringType(), stringType()).default({})
|
27102
26726
|
}).strict();
|
27103
26727
|
alteredTableScheme = objectType({
|
27104
26728
|
name: stringType(),
|
@@ -27139,21 +26763,6 @@ var init_snapshotsDiffer = __esm({
|
|
27139
26763
|
__new: stringType(),
|
27140
26764
|
__old: stringType()
|
27141
26765
|
})
|
27142
|
-
),
|
27143
|
-
addedCheckConstraints: recordType(
|
27144
|
-
stringType(),
|
27145
|
-
stringType()
|
27146
|
-
),
|
27147
|
-
deletedCheckConstraints: recordType(
|
27148
|
-
stringType(),
|
27149
|
-
stringType()
|
27150
|
-
),
|
27151
|
-
alteredCheckConstraints: recordType(
|
27152
|
-
stringType(),
|
27153
|
-
objectType({
|
27154
|
-
__new: stringType(),
|
27155
|
-
__old: stringType()
|
27156
|
-
})
|
27157
26766
|
)
|
27158
26767
|
}).strict();
|
27159
26768
|
diffResultScheme = objectType({
|
@@ -27494,8 +27103,6 @@ var init_snapshotsDiffer = __esm({
|
|
27494
27103
|
schemaTo: it.schemaTo || "public"
|
27495
27104
|
});
|
27496
27105
|
}
|
27497
|
-
const jsonDeletedCheckConstraints = [];
|
27498
|
-
const jsonCreatedCheckConstraints = [];
|
27499
27106
|
for (let it of alteredTables) {
|
27500
27107
|
let addedColumns = [];
|
27501
27108
|
for (const addedPkName of Object.keys(it.addedCompositePKs)) {
|
@@ -27535,8 +27142,6 @@ var init_snapshotsDiffer = __esm({
|
|
27535
27142
|
let addedUniqueConstraints = [];
|
27536
27143
|
let deletedUniqueConstraints = [];
|
27537
27144
|
let alteredUniqueConstraints = [];
|
27538
|
-
let createCheckConstraints = [];
|
27539
|
-
let deleteCheckConstraints = [];
|
27540
27145
|
addedUniqueConstraints = prepareAddUniqueConstraintPg(
|
27541
27146
|
it.name,
|
27542
27147
|
it.schema,
|
@@ -27561,24 +27166,6 @@ var init_snapshotsDiffer = __esm({
|
|
27561
27166
|
...prepareDeleteUniqueConstraintPg(it.name, it.schema, deleted)
|
27562
27167
|
);
|
27563
27168
|
}
|
27564
|
-
createCheckConstraints = prepareAddCheckConstraint(it.name, it.schema, it.addedCheckConstraints);
|
27565
|
-
deleteCheckConstraints = prepareDeleteCheckConstraint(
|
27566
|
-
it.name,
|
27567
|
-
it.schema,
|
27568
|
-
it.deletedCheckConstraints
|
27569
|
-
);
|
27570
|
-
if (it.alteredCheckConstraints && action !== "push") {
|
27571
|
-
const added = {};
|
27572
|
-
const deleted = {};
|
27573
|
-
for (const k of Object.keys(it.alteredCheckConstraints)) {
|
27574
|
-
added[k] = it.alteredCheckConstraints[k].__new;
|
27575
|
-
deleted[k] = it.alteredCheckConstraints[k].__old;
|
27576
|
-
}
|
27577
|
-
createCheckConstraints.push(...prepareAddCheckConstraint(it.name, it.schema, added));
|
27578
|
-
deleteCheckConstraints.push(...prepareDeleteCheckConstraint(it.name, it.schema, deleted));
|
27579
|
-
}
|
27580
|
-
jsonCreatedCheckConstraints.push(...createCheckConstraints);
|
27581
|
-
jsonDeletedCheckConstraints.push(...deleteCheckConstraints);
|
27582
27169
|
jsonAddedCompositePKs.push(...addedCompositePKs);
|
27583
27170
|
jsonDeletedCompositePKs.push(...deletedCompositePKs);
|
27584
27171
|
jsonAlteredCompositePKs.push(...alteredCompositePKs);
|
@@ -27732,7 +27319,6 @@ var init_snapshotsDiffer = __esm({
|
|
27732
27319
|
jsonStatements.push(...jsonRenameTables);
|
27733
27320
|
jsonStatements.push(...jsonRenameColumnsStatements);
|
27734
27321
|
jsonStatements.push(...jsonDeletedUniqueConstraints);
|
27735
|
-
jsonStatements.push(...jsonDeletedCheckConstraints);
|
27736
27322
|
jsonStatements.push(...jsonDroppedReferencesForAlteredTables);
|
27737
27323
|
jsonStatements.push(...jsonDropIndexesForAllAlteredTables);
|
27738
27324
|
jsonStatements.push(...jsonDeletedCompositePKs);
|
@@ -27746,7 +27332,6 @@ var init_snapshotsDiffer = __esm({
|
|
27746
27332
|
jsonStatements.push(...jsonDropColumnsStatemets);
|
27747
27333
|
jsonStatements.push(...jsonAlteredCompositePKs);
|
27748
27334
|
jsonStatements.push(...jsonAddedUniqueConstraints);
|
27749
|
-
jsonStatements.push(...jsonCreatedCheckConstraints);
|
27750
27335
|
jsonStatements.push(...jsonAlteredUniqueConstraints);
|
27751
27336
|
jsonStatements.push(...dropEnums);
|
27752
27337
|
jsonStatements.push(...dropSequences);
|
@@ -27910,8 +27495,6 @@ var init_snapshotsDiffer = __esm({
|
|
27910
27495
|
const jsonAddedUniqueConstraints = [];
|
27911
27496
|
const jsonDeletedUniqueConstraints = [];
|
27912
27497
|
const jsonAlteredUniqueConstraints = [];
|
27913
|
-
const jsonCreatedCheckConstraints = [];
|
27914
|
-
const jsonDeletedCheckConstraints = [];
|
27915
27498
|
const jsonRenameColumnsStatements = columnRenames.map((it) => prepareRenameColumns(it.table, "", it.renames)).flat();
|
27916
27499
|
const jsonAddColumnsStatemets = columnCreates.map((it) => _prepareAddColumns(it.table, "", it.columns)).flat();
|
27917
27500
|
const jsonDropColumnsStatemets = columnDeletes.map((it) => _prepareDropColumns(it.table, "", it.columns)).flat();
|
@@ -27950,8 +27533,6 @@ var init_snapshotsDiffer = __esm({
|
|
27950
27533
|
let addedUniqueConstraints = [];
|
27951
27534
|
let deletedUniqueConstraints = [];
|
27952
27535
|
let alteredUniqueConstraints = [];
|
27953
|
-
let createdCheckConstraints = [];
|
27954
|
-
let deletedCheckConstraints = [];
|
27955
27536
|
addedUniqueConstraints = prepareAddUniqueConstraintPg(
|
27956
27537
|
it.name,
|
27957
27538
|
it.schema,
|
@@ -27976,30 +27557,12 @@ var init_snapshotsDiffer = __esm({
|
|
27976
27557
|
...prepareDeleteUniqueConstraintPg(it.name, it.schema, deleted)
|
27977
27558
|
);
|
27978
27559
|
}
|
27979
|
-
createdCheckConstraints = prepareAddCheckConstraint(it.name, it.schema, it.addedCheckConstraints);
|
27980
|
-
deletedCheckConstraints = prepareDeleteCheckConstraint(
|
27981
|
-
it.name,
|
27982
|
-
it.schema,
|
27983
|
-
it.deletedCheckConstraints
|
27984
|
-
);
|
27985
|
-
if (it.alteredCheckConstraints && action !== "push") {
|
27986
|
-
const added = {};
|
27987
|
-
const deleted = {};
|
27988
|
-
for (const k of Object.keys(it.alteredCheckConstraints)) {
|
27989
|
-
added[k] = it.alteredCheckConstraints[k].__new;
|
27990
|
-
deleted[k] = it.alteredCheckConstraints[k].__old;
|
27991
|
-
}
|
27992
|
-
createdCheckConstraints.push(...prepareAddCheckConstraint(it.name, it.schema, added));
|
27993
|
-
deletedCheckConstraints.push(...prepareDeleteCheckConstraint(it.name, it.schema, deleted));
|
27994
|
-
}
|
27995
27560
|
jsonAddedCompositePKs.push(...addedCompositePKs);
|
27996
27561
|
jsonDeletedCompositePKs.push(...deletedCompositePKs);
|
27997
27562
|
jsonAlteredCompositePKs.push(...alteredCompositePKs);
|
27998
27563
|
jsonAddedUniqueConstraints.push(...addedUniqueConstraints);
|
27999
27564
|
jsonDeletedUniqueConstraints.push(...deletedUniqueConstraints);
|
28000
27565
|
jsonAlteredUniqueConstraints.push(...alteredUniqueConstraints);
|
28001
|
-
jsonCreatedCheckConstraints.push(...createdCheckConstraints);
|
28002
|
-
jsonDeletedCheckConstraints.push(...deletedCheckConstraints);
|
28003
27566
|
});
|
28004
27567
|
const rColumns = jsonRenameColumnsStatements.map((it) => {
|
28005
27568
|
const tableName = it.tableName;
|
@@ -28095,7 +27658,6 @@ var init_snapshotsDiffer = __esm({
|
|
28095
27658
|
jsonStatements.push(...jsonRenameTables);
|
28096
27659
|
jsonStatements.push(...jsonRenameColumnsStatements);
|
28097
27660
|
jsonStatements.push(...jsonDeletedUniqueConstraints);
|
28098
|
-
jsonStatements.push(...jsonDeletedCheckConstraints);
|
28099
27661
|
jsonStatements.push(...jsonDroppedReferencesForAlteredTables);
|
28100
27662
|
jsonStatements.push(...jsonDropIndexesForAllAlteredTables);
|
28101
27663
|
jsonStatements.push(...jsonDeletedCompositePKs);
|
@@ -28106,11 +27668,11 @@ var init_snapshotsDiffer = __esm({
|
|
28106
27668
|
jsonStatements.push(...jsonAddColumnsStatemets);
|
28107
27669
|
jsonStatements.push(...jsonCreateReferencesForCreatedTables);
|
28108
27670
|
jsonStatements.push(...jsonCreateIndexesForCreatedTables);
|
28109
|
-
jsonStatements.push(...jsonCreatedCheckConstraints);
|
28110
27671
|
jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
|
28111
27672
|
jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
|
28112
27673
|
jsonStatements.push(...jsonDropColumnsStatemets);
|
28113
27674
|
jsonStatements.push(...jsonAlteredCompositePKs);
|
27675
|
+
jsonStatements.push(...jsonAddedUniqueConstraints);
|
28114
27676
|
jsonStatements.push(...jsonAlteredUniqueConstraints);
|
28115
27677
|
const sqlStatements = fromJson(jsonStatements, "mysql");
|
28116
27678
|
const uniqueSqlStatements = [];
|
@@ -28238,8 +27800,6 @@ var init_snapshotsDiffer = __esm({
|
|
28238
27800
|
const jsonAddedUniqueConstraints = [];
|
28239
27801
|
const jsonDeletedUniqueConstraints = [];
|
28240
27802
|
const jsonAlteredUniqueConstraints = [];
|
28241
|
-
const jsonDeletedCheckConstraints = [];
|
28242
|
-
const jsonCreatedCheckConstraints = [];
|
28243
27803
|
allAltered.forEach((it) => {
|
28244
27804
|
let addedColumns = [];
|
28245
27805
|
for (const addedPkName of Object.keys(it.addedCompositePKs)) {
|
@@ -28296,56 +27856,12 @@ var init_snapshotsDiffer = __esm({
|
|
28296
27856
|
...prepareDeleteUniqueConstraintPg(it.name, it.schema, deleted)
|
28297
27857
|
);
|
28298
27858
|
}
|
28299
|
-
let createdCheckConstraints = [];
|
28300
|
-
let deletedCheckConstraints = [];
|
28301
|
-
addedUniqueConstraints = prepareAddUniqueConstraintPg(
|
28302
|
-
it.name,
|
28303
|
-
it.schema,
|
28304
|
-
it.addedUniqueConstraints
|
28305
|
-
);
|
28306
|
-
deletedUniqueConstraints = prepareDeleteUniqueConstraintPg(
|
28307
|
-
it.name,
|
28308
|
-
it.schema,
|
28309
|
-
it.deletedUniqueConstraints
|
28310
|
-
);
|
28311
|
-
if (it.alteredUniqueConstraints) {
|
28312
|
-
const added = {};
|
28313
|
-
const deleted = {};
|
28314
|
-
for (const k of Object.keys(it.alteredUniqueConstraints)) {
|
28315
|
-
added[k] = it.alteredUniqueConstraints[k].__new;
|
28316
|
-
deleted[k] = it.alteredUniqueConstraints[k].__old;
|
28317
|
-
}
|
28318
|
-
addedUniqueConstraints.push(
|
28319
|
-
...prepareAddUniqueConstraintPg(it.name, it.schema, added)
|
28320
|
-
);
|
28321
|
-
deletedUniqueConstraints.push(
|
28322
|
-
...prepareDeleteUniqueConstraintPg(it.name, it.schema, deleted)
|
28323
|
-
);
|
28324
|
-
}
|
28325
|
-
createdCheckConstraints = prepareAddCheckConstraint(it.name, it.schema, it.addedCheckConstraints);
|
28326
|
-
deletedCheckConstraints = prepareDeleteCheckConstraint(
|
28327
|
-
it.name,
|
28328
|
-
it.schema,
|
28329
|
-
it.deletedCheckConstraints
|
28330
|
-
);
|
28331
|
-
if (it.alteredCheckConstraints && action !== "push") {
|
28332
|
-
const added = {};
|
28333
|
-
const deleted = {};
|
28334
|
-
for (const k of Object.keys(it.alteredCheckConstraints)) {
|
28335
|
-
added[k] = it.alteredCheckConstraints[k].__new;
|
28336
|
-
deleted[k] = it.alteredCheckConstraints[k].__old;
|
28337
|
-
}
|
28338
|
-
createdCheckConstraints.push(...prepareAddCheckConstraint(it.name, it.schema, added));
|
28339
|
-
deletedCheckConstraints.push(...prepareDeleteCheckConstraint(it.name, it.schema, deleted));
|
28340
|
-
}
|
28341
27859
|
jsonAddedCompositePKs.push(...addedCompositePKs);
|
28342
27860
|
jsonDeletedCompositePKs.push(...deletedCompositePKs);
|
28343
27861
|
jsonAlteredCompositePKs.push(...alteredCompositePKs);
|
28344
27862
|
jsonAddedUniqueConstraints.push(...addedUniqueConstraints);
|
28345
27863
|
jsonDeletedUniqueConstraints.push(...deletedUniqueConstraints);
|
28346
27864
|
jsonAlteredUniqueConstraints.push(...alteredUniqueConstraints);
|
28347
|
-
jsonCreatedCheckConstraints.push(...createdCheckConstraints);
|
28348
|
-
jsonDeletedCheckConstraints.push(...deletedCheckConstraints);
|
28349
27865
|
});
|
28350
27866
|
const rColumns = jsonRenameColumnsStatements.map((it) => {
|
28351
27867
|
const tableName = it.tableName;
|
@@ -28430,7 +27946,6 @@ var init_snapshotsDiffer = __esm({
|
|
28430
27946
|
jsonStatements.push(...jsonRenameTables);
|
28431
27947
|
jsonStatements.push(...jsonRenameColumnsStatements);
|
28432
27948
|
jsonStatements.push(...jsonDroppedReferencesForAlteredTables);
|
28433
|
-
jsonStatements.push(...jsonDeletedCheckConstraints);
|
28434
27949
|
jsonStatements.push(...jsonDropIndexesForAllAlteredTables);
|
28435
27950
|
jsonStatements.push(...jsonDeletedCompositePKs);
|
28436
27951
|
jsonStatements.push(...jsonTableAlternations);
|
@@ -28438,7 +27953,6 @@ var init_snapshotsDiffer = __esm({
|
|
28438
27953
|
jsonStatements.push(...jsonAddColumnsStatemets);
|
28439
27954
|
jsonStatements.push(...jsonCreateIndexesForCreatedTables);
|
28440
27955
|
jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
|
28441
|
-
jsonStatements.push(...jsonCreatedCheckConstraints);
|
28442
27956
|
jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
|
28443
27957
|
jsonStatements.push(...jsonDropColumnsStatemets);
|
28444
27958
|
jsonStatements.push(...jsonAlteredCompositePKs);
|
@@ -28582,8 +28096,6 @@ var init_snapshotsDiffer = __esm({
|
|
28582
28096
|
const jsonAddedUniqueConstraints = [];
|
28583
28097
|
const jsonDeletedUniqueConstraints = [];
|
28584
28098
|
const jsonAlteredUniqueConstraints = [];
|
28585
|
-
const jsonDeletedCheckConstraints = [];
|
28586
|
-
const jsonCreatedCheckConstraints = [];
|
28587
28099
|
allAltered.forEach((it) => {
|
28588
28100
|
let addedColumns = [];
|
28589
28101
|
for (const addedPkName of Object.keys(it.addedCompositePKs)) {
|
@@ -28616,8 +28128,6 @@ var init_snapshotsDiffer = __esm({
|
|
28616
28128
|
let addedUniqueConstraints = [];
|
28617
28129
|
let deletedUniqueConstraints = [];
|
28618
28130
|
let alteredUniqueConstraints = [];
|
28619
|
-
let createdCheckConstraints = [];
|
28620
|
-
let deletedCheckConstraints = [];
|
28621
28131
|
addedUniqueConstraints = prepareAddUniqueConstraintPg(
|
28622
28132
|
it.name,
|
28623
28133
|
it.schema,
|
@@ -28642,30 +28152,12 @@ var init_snapshotsDiffer = __esm({
|
|
28642
28152
|
...prepareDeleteUniqueConstraintPg(it.name, it.schema, deleted)
|
28643
28153
|
);
|
28644
28154
|
}
|
28645
|
-
createdCheckConstraints = prepareAddCheckConstraint(it.name, it.schema, it.addedCheckConstraints);
|
28646
|
-
deletedCheckConstraints = prepareDeleteCheckConstraint(
|
28647
|
-
it.name,
|
28648
|
-
it.schema,
|
28649
|
-
it.deletedCheckConstraints
|
28650
|
-
);
|
28651
|
-
if (it.alteredCheckConstraints && action !== "push") {
|
28652
|
-
const added = {};
|
28653
|
-
const deleted = {};
|
28654
|
-
for (const k of Object.keys(it.alteredCheckConstraints)) {
|
28655
|
-
added[k] = it.alteredCheckConstraints[k].__new;
|
28656
|
-
deleted[k] = it.alteredCheckConstraints[k].__old;
|
28657
|
-
}
|
28658
|
-
createdCheckConstraints.push(...prepareAddCheckConstraint(it.name, it.schema, added));
|
28659
|
-
deletedCheckConstraints.push(...prepareDeleteCheckConstraint(it.name, it.schema, deleted));
|
28660
|
-
}
|
28661
28155
|
jsonAddedCompositePKs.push(...addedCompositePKs);
|
28662
28156
|
jsonDeletedCompositePKs.push(...deletedCompositePKs);
|
28663
28157
|
jsonAlteredCompositePKs.push(...alteredCompositePKs);
|
28664
28158
|
jsonAddedUniqueConstraints.push(...addedUniqueConstraints);
|
28665
28159
|
jsonDeletedUniqueConstraints.push(...deletedUniqueConstraints);
|
28666
28160
|
jsonAlteredUniqueConstraints.push(...alteredUniqueConstraints);
|
28667
|
-
jsonCreatedCheckConstraints.push(...createdCheckConstraints);
|
28668
|
-
jsonDeletedCheckConstraints.push(...deletedCheckConstraints);
|
28669
28161
|
});
|
28670
28162
|
const jsonTableAlternations = allAltered.map((it) => {
|
28671
28163
|
return prepareSqliteAlterColumns(it.name, it.schema, it.altered, json2);
|
@@ -28743,7 +28235,6 @@ var init_snapshotsDiffer = __esm({
|
|
28743
28235
|
jsonStatements.push(...jsonRenameTables);
|
28744
28236
|
jsonStatements.push(...jsonRenameColumnsStatements);
|
28745
28237
|
jsonStatements.push(...jsonDroppedReferencesForAlteredTables);
|
28746
|
-
jsonStatements.push(...jsonDeletedCheckConstraints);
|
28747
28238
|
jsonStatements.push(...jsonDropIndexesForAllAlteredTables);
|
28748
28239
|
jsonStatements.push(...jsonDeletedCompositePKs);
|
28749
28240
|
jsonStatements.push(...jsonTableAlternations);
|
@@ -28751,7 +28242,6 @@ var init_snapshotsDiffer = __esm({
|
|
28751
28242
|
jsonStatements.push(...jsonAddColumnsStatemets);
|
28752
28243
|
jsonStatements.push(...jsonCreateIndexesForCreatedTables);
|
28753
28244
|
jsonStatements.push(...jsonCreateIndexesForAllAlteredTables);
|
28754
|
-
jsonStatements.push(...jsonCreatedCheckConstraints);
|
28755
28245
|
jsonStatements.push(...jsonCreatedReferencesForAlteredTables);
|
28756
28246
|
jsonStatements.push(...jsonDropColumnsStatemets);
|
28757
28247
|
jsonStatements.push(...jsonAlteredCompositePKs);
|
@@ -30223,6 +29713,7 @@ var init_migrate = __esm({
|
|
30223
29713
|
prepareAndMigratePg = async (config) => {
|
30224
29714
|
const outFolder = config.out;
|
30225
29715
|
const schemaPath = config.schema;
|
29716
|
+
const casing2 = config.casing;
|
30226
29717
|
try {
|
30227
29718
|
assertV1OutFolder(outFolder);
|
30228
29719
|
const { snapshots, journal } = prepareMigrationFolder(
|
@@ -30231,7 +29722,8 @@ var init_migrate = __esm({
|
|
30231
29722
|
);
|
30232
29723
|
const { prev, cur, custom: custom2 } = await preparePgMigrationSnapshot(
|
30233
29724
|
snapshots,
|
30234
|
-
schemaPath
|
29725
|
+
schemaPath,
|
29726
|
+
casing2
|
30235
29727
|
);
|
30236
29728
|
const validatedPrev = pgSchema.parse(prev);
|
30237
29729
|
const validatedCur = pgSchema.parse(cur);
|
@@ -30274,10 +29766,11 @@ var init_migrate = __esm({
|
|
30274
29766
|
console.error(e2);
|
30275
29767
|
}
|
30276
29768
|
};
|
30277
|
-
preparePgPush = async (schemaPath, snapshot, schemaFilter) => {
|
29769
|
+
preparePgPush = async (schemaPath, snapshot, schemaFilter, casing2) => {
|
30278
29770
|
const { prev, cur } = await preparePgDbPushSnapshot(
|
30279
29771
|
snapshot,
|
30280
29772
|
schemaPath,
|
29773
|
+
casing2,
|
30281
29774
|
schemaFilter
|
30282
29775
|
);
|
30283
29776
|
const validatedPrev = pgSchema.parse(prev);
|
@@ -30298,11 +29791,12 @@ var init_migrate = __esm({
|
|
30298
29791
|
);
|
30299
29792
|
return { sqlStatements, statements, squashedPrev, squashedCur };
|
30300
29793
|
};
|
30301
|
-
prepareMySQLPush = async (schemaPath, snapshot) => {
|
29794
|
+
prepareMySQLPush = async (schemaPath, snapshot, casing2) => {
|
30302
29795
|
try {
|
30303
29796
|
const { prev, cur } = await prepareMySqlDbPushSnapshot(
|
30304
29797
|
snapshot,
|
30305
|
-
schemaPath
|
29798
|
+
schemaPath,
|
29799
|
+
casing2
|
30306
29800
|
);
|
30307
29801
|
const validatedPrev = mysqlSchema.parse(prev);
|
30308
29802
|
const validatedCur = mysqlSchema.parse(cur);
|
@@ -30326,12 +29820,14 @@ var init_migrate = __esm({
|
|
30326
29820
|
prepareAndMigrateMysql = async (config) => {
|
30327
29821
|
const outFolder = config.out;
|
30328
29822
|
const schemaPath = config.schema;
|
29823
|
+
const casing2 = config.casing;
|
30329
29824
|
try {
|
30330
29825
|
assertV1OutFolder(outFolder);
|
30331
29826
|
const { snapshots, journal } = prepareMigrationFolder(outFolder, "mysql");
|
30332
29827
|
const { prev, cur, custom: custom2 } = await prepareMySqlMigrationSnapshot(
|
30333
29828
|
snapshots,
|
30334
|
-
schemaPath
|
29829
|
+
schemaPath,
|
29830
|
+
casing2
|
30335
29831
|
);
|
30336
29832
|
const validatedPrev = mysqlSchema.parse(prev);
|
30337
29833
|
const validatedCur = mysqlSchema.parse(cur);
|
@@ -30375,12 +29871,14 @@ var init_migrate = __esm({
|
|
30375
29871
|
prepareAndMigrateSqlite = async (config) => {
|
30376
29872
|
const outFolder = config.out;
|
30377
29873
|
const schemaPath = config.schema;
|
29874
|
+
const casing2 = config.casing;
|
30378
29875
|
try {
|
30379
29876
|
assertV1OutFolder(outFolder);
|
30380
29877
|
const { snapshots, journal } = prepareMigrationFolder(outFolder, "sqlite");
|
30381
29878
|
const { prev, cur, custom: custom2 } = await prepareSqliteMigrationSnapshot(
|
30382
29879
|
snapshots,
|
30383
|
-
schemaPath
|
29880
|
+
schemaPath,
|
29881
|
+
casing2
|
30384
29882
|
);
|
30385
29883
|
const validatedPrev = sqliteSchema.parse(prev);
|
30386
29884
|
const validatedCur = sqliteSchema.parse(cur);
|
@@ -30426,12 +29924,14 @@ var init_migrate = __esm({
|
|
30426
29924
|
prepareAndMigrateLibSQL = async (config) => {
|
30427
29925
|
const outFolder = config.out;
|
30428
29926
|
const schemaPath = config.schema;
|
29927
|
+
const casing2 = config.casing;
|
30429
29928
|
try {
|
30430
29929
|
assertV1OutFolder(outFolder);
|
30431
29930
|
const { snapshots, journal } = prepareMigrationFolder(outFolder, "sqlite");
|
30432
29931
|
const { prev, cur, custom: custom2 } = await prepareSqliteMigrationSnapshot(
|
30433
29932
|
snapshots,
|
30434
|
-
schemaPath
|
29933
|
+
schemaPath,
|
29934
|
+
casing2
|
30435
29935
|
);
|
30436
29936
|
const validatedPrev = sqliteSchema.parse(prev);
|
30437
29937
|
const validatedCur = sqliteSchema.parse(cur);
|
@@ -30474,8 +29974,8 @@ var init_migrate = __esm({
|
|
30474
29974
|
console.error(e2);
|
30475
29975
|
}
|
30476
29976
|
};
|
30477
|
-
prepareSQLitePush = async (schemaPath, snapshot) => {
|
30478
|
-
const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath);
|
29977
|
+
prepareSQLitePush = async (schemaPath, snapshot, casing2) => {
|
29978
|
+
const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath, casing2);
|
30479
29979
|
const validatedPrev = sqliteSchema.parse(prev);
|
30480
29980
|
const validatedCur = sqliteSchema.parse(cur);
|
30481
29981
|
const squashedPrev = squashSqliteScheme(validatedPrev, "push");
|
@@ -30497,8 +29997,8 @@ var init_migrate = __esm({
|
|
30497
29997
|
meta: _meta
|
30498
29998
|
};
|
30499
29999
|
};
|
30500
|
-
prepareLibSQLPush = async (schemaPath, snapshot) => {
|
30501
|
-
const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath);
|
30000
|
+
prepareLibSQLPush = async (schemaPath, snapshot, casing2) => {
|
30001
|
+
const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath, casing2);
|
30502
30002
|
const validatedPrev = sqliteSchema.parse(prev);
|
30503
30003
|
const validatedCur = sqliteSchema.parse(cur);
|
30504
30004
|
const squashedPrev = squashSqliteScheme(validatedPrev, "push");
|
@@ -56820,9 +56320,9 @@ var require_dist_cjs46 = __commonJS({
|
|
56820
56320
|
}
|
56821
56321
|
});
|
56822
56322
|
|
56823
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/auth/httpAuthSchemeProvider.js
|
56323
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/auth/httpAuthSchemeProvider.js
|
56824
56324
|
var require_httpAuthSchemeProvider3 = __commonJS({
|
56825
|
-
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/auth/httpAuthSchemeProvider.js"(exports2) {
|
56325
|
+
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/auth/httpAuthSchemeProvider.js"(exports2) {
|
56826
56326
|
"use strict";
|
56827
56327
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
56828
56328
|
exports2.resolveHttpAuthSchemeConfig = exports2.defaultSSOOIDCHttpAuthSchemeProvider = exports2.defaultSSOOIDCHttpAuthSchemeParametersProvider = void 0;
|
@@ -56889,9 +56389,9 @@ var require_httpAuthSchemeProvider3 = __commonJS({
|
|
56889
56389
|
}
|
56890
56390
|
});
|
56891
56391
|
|
56892
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/package.json
|
56392
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/package.json
|
56893
56393
|
var require_package4 = __commonJS({
|
56894
|
-
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/package.json"(exports2, module2) {
|
56394
|
+
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/package.json"(exports2, module2) {
|
56895
56395
|
module2.exports = {
|
56896
56396
|
name: "@aws-sdk/client-sso-oidc",
|
56897
56397
|
description: "AWS SDK for JavaScript Sso Oidc Client for Node.js, Browser and React Native",
|
@@ -56995,9 +56495,9 @@ var require_package4 = __commonJS({
|
|
56995
56495
|
}
|
56996
56496
|
});
|
56997
56497
|
|
56998
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/ruleset.js
|
56498
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/ruleset.js
|
56999
56499
|
var require_ruleset2 = __commonJS({
|
57000
|
-
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/ruleset.js"(exports2) {
|
56500
|
+
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/ruleset.js"(exports2) {
|
57001
56501
|
"use strict";
|
57002
56502
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
57003
56503
|
exports2.ruleSet = void 0;
|
@@ -57030,9 +56530,9 @@ var require_ruleset2 = __commonJS({
|
|
57030
56530
|
}
|
57031
56531
|
});
|
57032
56532
|
|
57033
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/endpointResolver.js
|
56533
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/endpointResolver.js
|
57034
56534
|
var require_endpointResolver2 = __commonJS({
|
57035
|
-
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/endpointResolver.js"(exports2) {
|
56535
|
+
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/endpointResolver.js"(exports2) {
|
57036
56536
|
"use strict";
|
57037
56537
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
57038
56538
|
exports2.defaultEndpointResolver = void 0;
|
@@ -57050,9 +56550,9 @@ var require_endpointResolver2 = __commonJS({
|
|
57050
56550
|
}
|
57051
56551
|
});
|
57052
56552
|
|
57053
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.shared.js
|
56553
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.shared.js
|
57054
56554
|
var require_runtimeConfig_shared2 = __commonJS({
|
57055
|
-
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.shared.js"(exports2) {
|
56555
|
+
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.shared.js"(exports2) {
|
57056
56556
|
"use strict";
|
57057
56557
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
57058
56558
|
exports2.getRuntimeConfig = void 0;
|
@@ -57096,9 +56596,9 @@ var require_runtimeConfig_shared2 = __commonJS({
|
|
57096
56596
|
}
|
57097
56597
|
});
|
57098
56598
|
|
57099
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.js
|
56599
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.js
|
57100
56600
|
var require_runtimeConfig2 = __commonJS({
|
57101
|
-
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.js"(exports2) {
|
56601
|
+
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.js"(exports2) {
|
57102
56602
|
"use strict";
|
57103
56603
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
57104
56604
|
exports2.getRuntimeConfig = void 0;
|
@@ -57149,9 +56649,9 @@ var require_runtimeConfig2 = __commonJS({
|
|
57149
56649
|
}
|
57150
56650
|
});
|
57151
56651
|
|
57152
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js
|
56652
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js
|
57153
56653
|
var require_dist_cjs47 = __commonJS({
|
57154
|
-
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js"(exports2, module2) {
|
56654
|
+
"../node_modules/.pnpm/@aws-sdk+client-sso-oidc@3.583.0_@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js"(exports2, module2) {
|
57155
56655
|
"use strict";
|
57156
56656
|
var __defProp3 = Object.defineProperty;
|
57157
56657
|
var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
|
@@ -58497,9 +57997,9 @@ Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.ht
|
|
58497
57997
|
}
|
58498
57998
|
});
|
58499
57999
|
|
58500
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58000
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthSchemeProvider.js
|
58501
58001
|
var require_httpAuthSchemeProvider4 = __commonJS({
|
58502
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58002
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthSchemeProvider.js"(exports2) {
|
58503
58003
|
"use strict";
|
58504
58004
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58505
58005
|
exports2.resolveHttpAuthSchemeConfig = exports2.resolveStsAuthConfig = exports2.defaultSTSHttpAuthSchemeProvider = exports2.defaultSTSHttpAuthSchemeParametersProvider = void 0;
|
@@ -58569,9 +58069,9 @@ var require_httpAuthSchemeProvider4 = __commonJS({
|
|
58569
58069
|
}
|
58570
58070
|
});
|
58571
58071
|
|
58572
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58072
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/EndpointParameters.js
|
58573
58073
|
var require_EndpointParameters = __commonJS({
|
58574
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58074
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/EndpointParameters.js"(exports2) {
|
58575
58075
|
"use strict";
|
58576
58076
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58577
58077
|
exports2.commonParams = exports2.resolveClientEndpointParameters = void 0;
|
@@ -58595,9 +58095,9 @@ var require_EndpointParameters = __commonJS({
|
|
58595
58095
|
}
|
58596
58096
|
});
|
58597
58097
|
|
58598
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58098
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/package.json
|
58599
58099
|
var require_package5 = __commonJS({
|
58600
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58100
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/package.json"(exports2, module2) {
|
58601
58101
|
module2.exports = {
|
58602
58102
|
name: "@aws-sdk/client-sts",
|
58603
58103
|
description: "AWS SDK for JavaScript Sts Client for Node.js, Browser and React Native",
|
@@ -58703,9 +58203,9 @@ var require_package5 = __commonJS({
|
|
58703
58203
|
}
|
58704
58204
|
});
|
58705
58205
|
|
58706
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58206
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/ruleset.js
|
58707
58207
|
var require_ruleset3 = __commonJS({
|
58708
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58208
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/ruleset.js"(exports2) {
|
58709
58209
|
"use strict";
|
58710
58210
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58711
58211
|
exports2.ruleSet = void 0;
|
@@ -58750,9 +58250,9 @@ var require_ruleset3 = __commonJS({
|
|
58750
58250
|
}
|
58751
58251
|
});
|
58752
58252
|
|
58753
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58253
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js
|
58754
58254
|
var require_endpointResolver3 = __commonJS({
|
58755
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58255
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js"(exports2) {
|
58756
58256
|
"use strict";
|
58757
58257
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58758
58258
|
exports2.defaultEndpointResolver = void 0;
|
@@ -58770,9 +58270,9 @@ var require_endpointResolver3 = __commonJS({
|
|
58770
58270
|
}
|
58771
58271
|
});
|
58772
58272
|
|
58773
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58273
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.shared.js
|
58774
58274
|
var require_runtimeConfig_shared3 = __commonJS({
|
58775
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58275
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.shared.js"(exports2) {
|
58776
58276
|
"use strict";
|
58777
58277
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58778
58278
|
exports2.getRuntimeConfig = void 0;
|
@@ -58816,9 +58316,9 @@ var require_runtimeConfig_shared3 = __commonJS({
|
|
58816
58316
|
}
|
58817
58317
|
});
|
58818
58318
|
|
58819
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58319
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js
|
58820
58320
|
var require_runtimeConfig3 = __commonJS({
|
58821
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58321
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeConfig.js"(exports2) {
|
58822
58322
|
"use strict";
|
58823
58323
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58824
58324
|
exports2.getRuntimeConfig = void 0;
|
@@ -58882,9 +58382,9 @@ var require_runtimeConfig3 = __commonJS({
|
|
58882
58382
|
}
|
58883
58383
|
});
|
58884
58384
|
|
58885
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58385
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthExtensionConfiguration.js
|
58886
58386
|
var require_httpAuthExtensionConfiguration = __commonJS({
|
58887
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58387
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/auth/httpAuthExtensionConfiguration.js"(exports2) {
|
58888
58388
|
"use strict";
|
58889
58389
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58890
58390
|
exports2.resolveHttpAuthRuntimeConfig = exports2.getHttpAuthExtensionConfiguration = void 0;
|
@@ -58930,9 +58430,9 @@ var require_httpAuthExtensionConfiguration = __commonJS({
|
|
58930
58430
|
}
|
58931
58431
|
});
|
58932
58432
|
|
58933
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58433
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeExtensions.js
|
58934
58434
|
var require_runtimeExtensions = __commonJS({
|
58935
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58435
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/runtimeExtensions.js"(exports2) {
|
58936
58436
|
"use strict";
|
58937
58437
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58938
58438
|
exports2.resolveRuntimeExtensions = void 0;
|
@@ -58961,9 +58461,9 @@ var require_runtimeExtensions = __commonJS({
|
|
58961
58461
|
}
|
58962
58462
|
});
|
58963
58463
|
|
58964
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58464
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js
|
58965
58465
|
var require_STSClient = __commonJS({
|
58966
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58466
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js"(exports2) {
|
58967
58467
|
"use strict";
|
58968
58468
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
58969
58469
|
exports2.STSClient = exports2.__Client = void 0;
|
@@ -59025,9 +58525,9 @@ var require_STSClient = __commonJS({
|
|
59025
58525
|
}
|
59026
58526
|
});
|
59027
58527
|
|
59028
|
-
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58528
|
+
// ../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/index.js
|
59029
58529
|
var require_dist_cjs50 = __commonJS({
|
59030
|
-
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.
|
58530
|
+
"../node_modules/.pnpm/@aws-sdk+client-sts@3.583.0/node_modules/@aws-sdk/client-sts/dist-cjs/index.js"(exports2, module2) {
|
59031
58531
|
"use strict";
|
59032
58532
|
var __defProp3 = Object.defineProperty;
|
59033
58533
|
var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
|
@@ -63185,7 +62685,7 @@ var init_studio2 = __esm({
|
|
63185
62685
|
});
|
63186
62686
|
};
|
63187
62687
|
prepareServer = async ({
|
63188
|
-
dialect:
|
62688
|
+
dialect: dialect4,
|
63189
62689
|
driver: driver2,
|
63190
62690
|
proxy,
|
63191
62691
|
customDefaults,
|
@@ -63235,7 +62735,7 @@ var init_studio2 = __esm({
|
|
63235
62735
|
}));
|
63236
62736
|
return c.json({
|
63237
62737
|
version: "6",
|
63238
|
-
dialect:
|
62738
|
+
dialect: dialect4,
|
63239
62739
|
driver: driver2,
|
63240
62740
|
schemaFiles,
|
63241
62741
|
customDefaults: preparedDefaults,
|
@@ -77644,19 +77144,14 @@ var init_libSqlPushUtils = __esm({
|
|
77644
77144
|
const compositePKs = Object.values(
|
77645
77145
|
json.tables[tableName].compositePrimaryKeys
|
77646
77146
|
).map((it) => SQLiteSquasher.unsquashPK(it));
|
77647
|
-
const checkConstraints = Object.values(json.tables[tableName].checkConstraints);
|
77648
77147
|
const fks = referenceData.map((it) => SQLiteSquasher.unsquashPushFK(it));
|
77649
|
-
const mappedCheckConstraints = checkConstraints.map(
|
77650
|
-
(it) => it.replaceAll(`"${tableName}".`, `"${newTableName}".`).replaceAll(`\`${tableName}\`.`, `\`${newTableName}\`.`).replaceAll(`${tableName}.`, `${newTableName}.`).replaceAll(`'${tableName}'.`, `\`${newTableName}\`.`)
|
77651
|
-
);
|
77652
77148
|
statements.push(
|
77653
77149
|
new SQLiteCreateTableConvertor().convert({
|
77654
77150
|
type: "sqlite_create_table",
|
77655
77151
|
tableName: newTableName,
|
77656
77152
|
columns: tableColumns,
|
77657
77153
|
referenceData: fks,
|
77658
|
-
compositePKs
|
77659
|
-
checkConstraints: mappedCheckConstraints
|
77154
|
+
compositePKs
|
77660
77155
|
})
|
77661
77156
|
);
|
77662
77157
|
if (!dataLoss) {
|
@@ -79547,11 +79042,13 @@ var init_pgIntrospect = __esm({
|
|
79547
79042
|
});
|
79548
79043
|
|
79549
79044
|
// src/introspect-sqlite.ts
|
79550
|
-
var sqliteImportsList, indexName3, objToStatement2, relations, escapeColumnKey, withCasing, schemaToTypeScript, isCyclic, isSelf, mapColumnDefault, column4, createTableColumns, createTableIndexes, createTableUniques,
|
79045
|
+
var import_casing3, sqliteImportsList, indexName3, objToStatement2, relations, escapeColumnKey, withCasing, dbColumnName, schemaToTypeScript, isCyclic, isSelf, mapColumnDefault, column4, createTableColumns, createTableIndexes, createTableUniques, createTablePKs, createTableFKs;
|
79551
79046
|
var init_introspect_sqlite = __esm({
|
79552
79047
|
"src/introspect-sqlite.ts"() {
|
79553
79048
|
"use strict";
|
79049
|
+
import_casing3 = require("drizzle-orm/casing");
|
79554
79050
|
init_utils3();
|
79051
|
+
init_global();
|
79555
79052
|
sqliteImportsList = /* @__PURE__ */ new Set([
|
79556
79053
|
"sqliteTable",
|
79557
79054
|
"integer",
|
@@ -79589,6 +79086,15 @@ var init_introspect_sqlite = __esm({
|
|
79589
79086
|
}
|
79590
79087
|
return value;
|
79591
79088
|
};
|
79089
|
+
dbColumnName = ({ name, casing: casing2, withMode = false }) => {
|
79090
|
+
if (casing2 === "preserve") {
|
79091
|
+
return "";
|
79092
|
+
}
|
79093
|
+
if (casing2 === "camel") {
|
79094
|
+
return (0, import_casing3.toCamelCase)(name) === name ? "" : withMode ? `"${name}", ` : `"${name}"`;
|
79095
|
+
}
|
79096
|
+
assertUnreachable(casing2);
|
79097
|
+
};
|
79592
79098
|
schemaToTypeScript = (schema5, casing2) => {
|
79593
79099
|
Object.values(schema5.tables).forEach((table4) => {
|
79594
79100
|
Object.values(table4.foreignKeys).forEach((fk4) => {
|
@@ -79606,14 +79112,10 @@ var init_introspect_sqlite = __esm({
|
|
79606
79112
|
const uniqueImports = Object.values(it.uniqueConstraints).map(
|
79607
79113
|
(it2) => "unique"
|
79608
79114
|
);
|
79609
|
-
const checkImports = Object.values(it.checkConstraints).map(
|
79610
|
-
(it2) => "check"
|
79611
|
-
);
|
79612
79115
|
res.sqlite.push(...idxImports);
|
79613
79116
|
res.sqlite.push(...fkImpots);
|
79614
79117
|
res.sqlite.push(...pkImports);
|
79615
79118
|
res.sqlite.push(...uniqueImports);
|
79616
|
-
res.sqlite.push(...checkImports);
|
79617
79119
|
const columnImports = Object.values(it.columns).map((col) => {
|
79618
79120
|
return col.type;
|
79619
79121
|
}).filter((type) => {
|
@@ -79646,7 +79148,7 @@ var init_introspect_sqlite = __esm({
|
|
79646
79148
|
const filteredFKs = Object.values(table4.foreignKeys).filter((it) => {
|
79647
79149
|
return it.columnsFrom.length > 1 || isSelf(it);
|
79648
79150
|
});
|
79649
|
-
if (Object.keys(table4.indexes).length > 0 || filteredFKs.length > 0 || Object.keys(table4.compositePrimaryKeys).length > 0 || Object.keys(table4.uniqueConstraints).length > 0
|
79151
|
+
if (Object.keys(table4.indexes).length > 0 || filteredFKs.length > 0 || Object.keys(table4.compositePrimaryKeys).length > 0 || Object.keys(table4.uniqueConstraints).length > 0) {
|
79650
79152
|
statement += ",\n";
|
79651
79153
|
statement += "(table) => {\n";
|
79652
79154
|
statement += " return {\n";
|
@@ -79664,10 +79166,6 @@ var init_introspect_sqlite = __esm({
|
|
79664
79166
|
Object.values(table4.uniqueConstraints),
|
79665
79167
|
casing2
|
79666
79168
|
);
|
79667
|
-
statement += createTableChecks(
|
79668
|
-
Object.values(table4.checkConstraints),
|
79669
|
-
casing2
|
79670
|
-
);
|
79671
79169
|
statement += " }\n";
|
79672
79170
|
statement += "}";
|
79673
79171
|
}
|
@@ -79716,13 +79214,14 @@ var init_introspect_sqlite = __esm({
|
|
79716
79214
|
};
|
79717
79215
|
column4 = (type, name, defaultValue, autoincrement, casing2) => {
|
79718
79216
|
let lowered = type;
|
79217
|
+
casing2 = casing2;
|
79719
79218
|
if (lowered === "integer") {
|
79720
|
-
let out = `${withCasing(name, casing2)}: integer(
|
79219
|
+
let out = `${withCasing(name, casing2)}: integer(${dbColumnName({ name, casing: casing2 })})`;
|
79721
79220
|
out += typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault(defaultValue)})` : "";
|
79722
79221
|
return out;
|
79723
79222
|
}
|
79724
79223
|
if (lowered === "real") {
|
79725
|
-
let out = `${withCasing(name, casing2)}: real(
|
79224
|
+
let out = `${withCasing(name, casing2)}: real(${dbColumnName({ name, casing: casing2 })})`;
|
79726
79225
|
out += defaultValue ? `.default(${mapColumnDefault(defaultValue)})` : "";
|
79727
79226
|
return out;
|
79728
79227
|
}
|
@@ -79730,20 +79229,20 @@ var init_introspect_sqlite = __esm({
|
|
79730
79229
|
const match2 = lowered.match(/\d+/);
|
79731
79230
|
let out;
|
79732
79231
|
if (match2) {
|
79733
|
-
out = `${withCasing(name, casing2)}: text(
|
79232
|
+
out = `${withCasing(name, casing2)}: text(${dbColumnName({ name, casing: casing2, withMode: true })}{ length: ${match2[0]} })`;
|
79734
79233
|
} else {
|
79735
|
-
out = `${withCasing(name, casing2)}: text(
|
79234
|
+
out = `${withCasing(name, casing2)}: text(${dbColumnName({ name, casing: casing2 })})`;
|
79736
79235
|
}
|
79737
79236
|
out += defaultValue ? `.default("${mapColumnDefault(defaultValue)}")` : "";
|
79738
79237
|
return out;
|
79739
79238
|
}
|
79740
79239
|
if (lowered === "blob") {
|
79741
|
-
let out = `${withCasing(name, casing2)}: blob(
|
79240
|
+
let out = `${withCasing(name, casing2)}: blob(${dbColumnName({ name, casing: casing2 })})`;
|
79742
79241
|
out += defaultValue ? `.default(${mapColumnDefault(defaultValue)})` : "";
|
79743
79242
|
return out;
|
79744
79243
|
}
|
79745
79244
|
if (lowered === "numeric") {
|
79746
|
-
let out = `${withCasing(name, casing2)}: numeric(
|
79245
|
+
let out = `${withCasing(name, casing2)}: numeric(${dbColumnName({ name, casing: casing2 })})`;
|
79747
79246
|
out += defaultValue ? `.default(${mapColumnDefault(defaultValue)})` : "";
|
79748
79247
|
return out;
|
79749
79248
|
}
|
@@ -79818,19 +79317,6 @@ var init_introspect_sqlite = __esm({
|
|
79818
79317
|
statement += `"${it.name}")`;
|
79819
79318
|
statement += `.on(${it.columns.map((it2) => `table.${withCasing(it2, casing2)}`).join(", ")}),`;
|
79820
79319
|
statement += `
|
79821
|
-
`;
|
79822
|
-
});
|
79823
|
-
return statement;
|
79824
|
-
};
|
79825
|
-
createTableChecks = (checks, casing2) => {
|
79826
|
-
let statement = "";
|
79827
|
-
checks.forEach((it) => {
|
79828
|
-
const checkKey = withCasing(it.name, casing2);
|
79829
|
-
statement += ` ${checkKey}: `;
|
79830
|
-
statement += "check(";
|
79831
|
-
statement += `"${it.name}", `;
|
79832
|
-
statement += `sql\`${it.value}\`)`;
|
79833
|
-
statement += `,
|
79834
79320
|
`;
|
79835
79321
|
});
|
79836
79322
|
return statement;
|
@@ -79980,13 +79466,13 @@ var init_push = __esm({
|
|
79980
79466
|
init_mysqlPushUtils();
|
79981
79467
|
init_pgPushUtils();
|
79982
79468
|
init_sqlitePushUtils();
|
79983
|
-
mysqlPush = async (schemaPath, credentials2, tablesFilter, strict, verbose, force) => {
|
79469
|
+
mysqlPush = async (schemaPath, credentials2, tablesFilter, strict, verbose, force, casing2) => {
|
79984
79470
|
const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
79985
79471
|
const { mysqlPushIntrospect: mysqlPushIntrospect2 } = await Promise.resolve().then(() => (init_mysqlIntrospect(), mysqlIntrospect_exports));
|
79986
79472
|
const { db, database } = await connectToMySQL2(credentials2);
|
79987
79473
|
const { schema: schema5 } = await mysqlPushIntrospect2(db, database, tablesFilter);
|
79988
79474
|
const { prepareMySQLPush: prepareMySQLPush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
79989
|
-
const statements = await prepareMySQLPush2(schemaPath, schema5);
|
79475
|
+
const statements = await prepareMySQLPush2(schemaPath, schema5, casing2);
|
79990
79476
|
const filteredStatements = filterStatements(
|
79991
79477
|
statements.statements ?? [],
|
79992
79478
|
statements.validatedCur,
|
@@ -80081,13 +79567,13 @@ var init_push = __esm({
|
|
80081
79567
|
console.log(e2);
|
80082
79568
|
}
|
80083
79569
|
};
|
80084
|
-
pgPush = async (schemaPath, verbose, strict, credentials2, tablesFilter, schemasFilter, force) => {
|
79570
|
+
pgPush = async (schemaPath, verbose, strict, credentials2, tablesFilter, schemasFilter, force, casing2) => {
|
80085
79571
|
const { preparePostgresDB: preparePostgresDB2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
80086
79572
|
const { pgPushIntrospect: pgPushIntrospect2 } = await Promise.resolve().then(() => (init_pgIntrospect(), pgIntrospect_exports));
|
80087
79573
|
const db = await preparePostgresDB2(credentials2);
|
80088
79574
|
const { schema: schema5 } = await pgPushIntrospect2(db, tablesFilter, schemasFilter);
|
80089
79575
|
const { preparePgPush: preparePgPush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
80090
|
-
const statements = await preparePgPush2(schemaPath, schema5, schemasFilter);
|
79576
|
+
const statements = await preparePgPush2(schemaPath, schema5, schemasFilter, casing2);
|
80091
79577
|
try {
|
80092
79578
|
if (statements.sqlStatements.length === 0) {
|
80093
79579
|
(0, import_hanji11.render)(`[${source_default.blue("i")}] No changes detected`);
|
@@ -80155,13 +79641,13 @@ var init_push = __esm({
|
|
80155
79641
|
console.error(e2);
|
80156
79642
|
}
|
80157
79643
|
};
|
80158
|
-
sqlitePush = async (schemaPath, verbose, strict, credentials2, tablesFilter, force) => {
|
79644
|
+
sqlitePush = async (schemaPath, verbose, strict, credentials2, tablesFilter, force, casing2) => {
|
80159
79645
|
const { connectToSQLite: connectToSQLite2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
80160
79646
|
const { sqlitePushIntrospect: sqlitePushIntrospect2 } = await Promise.resolve().then(() => (init_sqliteIntrospect(), sqliteIntrospect_exports));
|
80161
79647
|
const db = await connectToSQLite2(credentials2);
|
80162
79648
|
const { schema: schema5 } = await sqlitePushIntrospect2(db, tablesFilter);
|
80163
79649
|
const { prepareSQLitePush: prepareSQLitePush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
80164
|
-
const statements = await prepareSQLitePush2(schemaPath, schema5);
|
79650
|
+
const statements = await prepareSQLitePush2(schemaPath, schema5, casing2);
|
80165
79651
|
if (statements.sqlStatements.length === 0) {
|
80166
79652
|
(0, import_hanji11.render)(`
|
80167
79653
|
[${source_default.blue("i")}] No changes detected`);
|
@@ -80243,13 +79729,13 @@ var init_push = __esm({
|
|
80243
79729
|
}
|
80244
79730
|
}
|
80245
79731
|
};
|
80246
|
-
libSQLPush = async (schemaPath, verbose, strict, credentials2, tablesFilter, force) => {
|
79732
|
+
libSQLPush = async (schemaPath, verbose, strict, credentials2, tablesFilter, force, casing2) => {
|
80247
79733
|
const { connectToLibSQL: connectToLibSQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
80248
79734
|
const { sqlitePushIntrospect: sqlitePushIntrospect2 } = await Promise.resolve().then(() => (init_sqliteIntrospect(), sqliteIntrospect_exports));
|
80249
79735
|
const db = await connectToLibSQL2(credentials2);
|
80250
79736
|
const { schema: schema5 } = await sqlitePushIntrospect2(db, tablesFilter);
|
80251
79737
|
const { prepareLibSQLPush: prepareLibSQLPush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
80252
|
-
const statements = await prepareLibSQLPush2(schemaPath, schema5);
|
79738
|
+
const statements = await prepareLibSQLPush2(schemaPath, schema5, casing2);
|
80253
79739
|
if (statements.sqlStatements.length === 0) {
|
80254
79740
|
(0, import_hanji11.render)(`
|
80255
79741
|
[${source_default.blue("i")}] No changes detected`);
|
@@ -80679,11 +80165,13 @@ var require_pluralize = __commonJS({
|
|
80679
80165
|
});
|
80680
80166
|
|
80681
80167
|
// src/introspect-mysql.ts
|
80682
|
-
var mysqlImportsList, objToStatement22, timeConfig, binaryConfig, importsPatch, relations2, escapeColumnKey2, prepareCasing, schemaToTypeScript2, isCyclic2, isSelf2, mapColumnDefault2, mapColumnDefaultForJson, column5, createTableColumns2, createTableIndexes2, createTableUniques2,
|
80168
|
+
var import_casing4, mysqlImportsList, objToStatement22, timeConfig, binaryConfig, importsPatch, relations2, escapeColumnKey2, prepareCasing, dbColumnName2, schemaToTypeScript2, isCyclic2, isSelf2, mapColumnDefault2, mapColumnDefaultForJson, column5, createTableColumns2, createTableIndexes2, createTableUniques2, createTablePKs2, createTableFKs2;
|
80683
80169
|
var init_introspect_mysql = __esm({
|
80684
80170
|
"src/introspect-mysql.ts"() {
|
80685
80171
|
"use strict";
|
80172
|
+
import_casing4 = require("drizzle-orm/casing");
|
80686
80173
|
init_utils3();
|
80174
|
+
init_global();
|
80687
80175
|
init_mysqlSerializer();
|
80688
80176
|
mysqlImportsList = /* @__PURE__ */ new Set([
|
80689
80177
|
"mysqlTable",
|
@@ -80763,7 +80251,16 @@ var init_introspect_mysql = __esm({
|
|
80763
80251
|
if (casing2 === "camel") {
|
80764
80252
|
return escapeColumnKey2(value.camelCase());
|
80765
80253
|
}
|
80766
|
-
|
80254
|
+
assertUnreachable(casing2);
|
80255
|
+
};
|
80256
|
+
dbColumnName2 = ({ name, casing: casing2, withMode = false }) => {
|
80257
|
+
if (casing2 === "preserve") {
|
80258
|
+
return "";
|
80259
|
+
}
|
80260
|
+
if (casing2 === "camel") {
|
80261
|
+
return (0, import_casing4.toCamelCase)(name) === name ? "" : withMode ? `"${name}", ` : `"${name}"`;
|
80262
|
+
}
|
80263
|
+
assertUnreachable(casing2);
|
80767
80264
|
};
|
80768
80265
|
schemaToTypeScript2 = (schema5, casing2) => {
|
80769
80266
|
const withCasing4 = prepareCasing(casing2);
|
@@ -80783,14 +80280,10 @@ var init_introspect_mysql = __esm({
|
|
80783
80280
|
const uniqueImports = Object.values(it.uniqueConstraints).map(
|
80784
80281
|
(it2) => "unique"
|
80785
80282
|
);
|
80786
|
-
const checkImports = Object.values(it.checkConstraint).map(
|
80787
|
-
(it2) => "check"
|
80788
|
-
);
|
80789
80283
|
res.mysql.push(...idxImports);
|
80790
80284
|
res.mysql.push(...fkImpots);
|
80791
80285
|
res.mysql.push(...pkImports);
|
80792
80286
|
res.mysql.push(...uniqueImports);
|
80793
|
-
res.mysql.push(...checkImports);
|
80794
80287
|
const columnImports = Object.values(it.columns).map((col) => {
|
80795
80288
|
let patched = importsPatch[col.type] ?? col.type;
|
80796
80289
|
patched = patched.startsWith("varchar(") ? "varchar" : patched;
|
@@ -80828,6 +80321,7 @@ var init_introspect_mysql = __esm({
|
|
80828
80321
|
Object.values(table4.columns),
|
80829
80322
|
Object.values(table4.foreignKeys),
|
80830
80323
|
withCasing4,
|
80324
|
+
casing2,
|
80831
80325
|
table4.name,
|
80832
80326
|
schema5
|
80833
80327
|
);
|
@@ -80835,7 +80329,7 @@ var init_introspect_mysql = __esm({
|
|
80835
80329
|
const filteredFKs = Object.values(table4.foreignKeys).filter((it) => {
|
80836
80330
|
return it.columnsFrom.length > 1 || isSelf2(it);
|
80837
80331
|
});
|
80838
|
-
if (Object.keys(table4.indexes).length > 0 || filteredFKs.length > 0 || Object.keys(table4.compositePrimaryKeys).length > 0 || Object.keys(table4.uniqueConstraints).length > 0
|
80332
|
+
if (Object.keys(table4.indexes).length > 0 || filteredFKs.length > 0 || Object.keys(table4.compositePrimaryKeys).length > 0 || Object.keys(table4.uniqueConstraints).length > 0) {
|
80839
80333
|
statement += ",\n";
|
80840
80334
|
statement += "(table) => {\n";
|
80841
80335
|
statement += " return {\n";
|
@@ -80853,10 +80347,6 @@ var init_introspect_mysql = __esm({
|
|
80853
80347
|
Object.values(table4.uniqueConstraints),
|
80854
80348
|
withCasing4
|
80855
80349
|
);
|
80856
|
-
statement += createTableChecks2(
|
80857
|
-
Object.values(table4.checkConstraint),
|
80858
|
-
withCasing4
|
80859
|
-
);
|
80860
80350
|
statement += " }\n";
|
80861
80351
|
statement += "}";
|
80862
80352
|
}
|
@@ -80911,51 +80401,51 @@ import { sql } from "drizzle-orm"
|
|
80911
80401
|
}
|
80912
80402
|
return defaultValue;
|
80913
80403
|
};
|
80914
|
-
column5 = (type, name, casing2, defaultValue, autoincrement, onUpdate, isExpression) => {
|
80404
|
+
column5 = (type, name, casing2, rawCasing, defaultValue, autoincrement, onUpdate, isExpression) => {
|
80915
80405
|
let lowered = type;
|
80916
80406
|
if (!type.startsWith("enum(")) {
|
80917
80407
|
lowered = type.toLowerCase();
|
80918
80408
|
}
|
80919
80409
|
if (lowered === "serial") {
|
80920
|
-
return `${casing2(name)}: serial(
|
80410
|
+
return `${casing2(name)}: serial(${dbColumnName2({ name, casing: rawCasing })})`;
|
80921
80411
|
}
|
80922
80412
|
if (lowered.startsWith("int")) {
|
80923
80413
|
const isUnsigned = lowered.startsWith("int unsigned");
|
80924
|
-
let out = `${casing2(name)}: int(
|
80414
|
+
let out = `${casing2(name)}: int(${dbColumnName2({ name, casing: rawCasing, withMode: isUnsigned })}${isUnsigned ? "{ unsigned: true }" : ""})`;
|
80925
80415
|
out += autoincrement ? `.autoincrement()` : "";
|
80926
80416
|
out += typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80927
80417
|
return out;
|
80928
80418
|
}
|
80929
80419
|
if (lowered.startsWith("tinyint")) {
|
80930
80420
|
const isUnsigned = lowered.startsWith("tinyint unsigned");
|
80931
|
-
let out = `${casing2(name)}: tinyint(
|
80421
|
+
let out = `${casing2(name)}: tinyint(${dbColumnName2({ name, casing: rawCasing, withMode: isUnsigned })}${isUnsigned ? ", { unsigned: true }" : ""})`;
|
80932
80422
|
out += autoincrement ? `.autoincrement()` : "";
|
80933
80423
|
out += typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80934
80424
|
return out;
|
80935
80425
|
}
|
80936
80426
|
if (lowered.startsWith("smallint")) {
|
80937
80427
|
const isUnsigned = lowered.startsWith("smallint unsigned");
|
80938
|
-
let out = `${casing2(name)}: smallint(
|
80428
|
+
let out = `${casing2(name)}: smallint(${dbColumnName2({ name, casing: rawCasing, withMode: isUnsigned })}${isUnsigned ? ", { unsigned: true }" : ""})`;
|
80939
80429
|
out += autoincrement ? `.autoincrement()` : "";
|
80940
80430
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80941
80431
|
return out;
|
80942
80432
|
}
|
80943
80433
|
if (lowered.startsWith("mediumint")) {
|
80944
80434
|
const isUnsigned = lowered.startsWith("mediumint unsigned");
|
80945
|
-
let out = `${casing2(name)}: mediumint(
|
80435
|
+
let out = `${casing2(name)}: mediumint(${dbColumnName2({ name, casing: rawCasing, withMode: isUnsigned })}${isUnsigned ? ", { unsigned: true }" : ""})`;
|
80946
80436
|
out += autoincrement ? `.autoincrement()` : "";
|
80947
80437
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80948
80438
|
return out;
|
80949
80439
|
}
|
80950
80440
|
if (lowered.startsWith("bigint")) {
|
80951
80441
|
const isUnsigned = lowered.startsWith("bigint unsigned");
|
80952
|
-
let out = `${casing2(name)}: bigint(
|
80442
|
+
let out = `${casing2(name)}: bigint(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ mode: "number"${isUnsigned ? ", unsigned: true" : ""} })`;
|
80953
80443
|
out += autoincrement ? `.autoincrement()` : "";
|
80954
80444
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80955
80445
|
return out;
|
80956
80446
|
}
|
80957
80447
|
if (lowered === "boolean") {
|
80958
|
-
let out = `${casing2(name)}: boolean(
|
80448
|
+
let out = `${casing2(name)}: boolean(${dbColumnName2({ name, casing: rawCasing })})`;
|
80959
80449
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80960
80450
|
return out;
|
80961
80451
|
}
|
@@ -80965,17 +80455,18 @@ import { sql } from "drizzle-orm"
|
|
80965
80455
|
const [precision, scale] = lowered.slice(7, lowered.length - 1).split(",");
|
80966
80456
|
params = { precision, scale };
|
80967
80457
|
}
|
80968
|
-
|
80458
|
+
const timeConfigParams = params ? timeConfig(params) : void 0;
|
80459
|
+
let out = params ? `${casing2(name)}: double(${dbColumnName2({ name, casing: rawCasing, withMode: timeConfigParams !== void 0 })}${timeConfig(params)})` : `${casing2(name)}: double(${dbColumnName2({ name, casing: rawCasing })})`;
|
80969
80460
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80970
80461
|
return out;
|
80971
80462
|
}
|
80972
80463
|
if (lowered === "float") {
|
80973
|
-
let out = `${casing2(name)}: float(
|
80464
|
+
let out = `${casing2(name)}: float(${dbColumnName2({ name, casing: rawCasing })})`;
|
80974
80465
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80975
80466
|
return out;
|
80976
80467
|
}
|
80977
80468
|
if (lowered === "real") {
|
80978
|
-
let out = `${casing2(name)}: real(
|
80469
|
+
let out = `${casing2(name)}: real(${dbColumnName2({ name, casing: rawCasing })})`;
|
80979
80470
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80980
80471
|
return out;
|
80981
80472
|
}
|
@@ -80984,7 +80475,7 @@ import { sql } from "drizzle-orm"
|
|
80984
80475
|
let fsp = lowered.length > keyLength ? Number(lowered.substring(keyLength, lowered.length - 1)) : null;
|
80985
80476
|
fsp = fsp ? fsp : null;
|
80986
80477
|
const params = timeConfig({ fsp, mode: "'string'" });
|
80987
|
-
let out = params ? `${casing2(name)}: timestamp(
|
80478
|
+
let out = params ? `${casing2(name)}: timestamp(${dbColumnName2({ name, casing: rawCasing, withMode: params !== void 0 })}${params})` : `${casing2(name)}: timestamp(${dbColumnName2({ name, casing: rawCasing })})`;
|
80988
80479
|
defaultValue = defaultValue === "now()" || defaultValue === "(CURRENT_TIMESTAMP)" ? ".defaultNow()" : defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
80989
80480
|
out += defaultValue;
|
80990
80481
|
let onUpdateNow = onUpdate ? ".onUpdateNow()" : "";
|
@@ -80996,7 +80487,7 @@ import { sql } from "drizzle-orm"
|
|
80996
80487
|
let fsp = lowered.length > keyLength ? Number(lowered.substring(keyLength, lowered.length - 1)) : null;
|
80997
80488
|
fsp = fsp ? fsp : null;
|
80998
80489
|
const params = timeConfig({ fsp });
|
80999
|
-
let out = params ? `${casing2(name)}: time(
|
80490
|
+
let out = params ? `${casing2(name)}: time(${dbColumnName2({ name, casing: rawCasing, withMode: params !== void 0 })}${params})` : `${casing2(name)}: time(${dbColumnName2({ name, casing: rawCasing })})`;
|
81000
80491
|
defaultValue = defaultValue === "now()" ? ".defaultNow()" : defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
81001
80492
|
out += defaultValue;
|
81002
80493
|
return out;
|
@@ -81005,45 +80496,45 @@ import { sql } from "drizzle-orm"
|
|
81005
80496
|
let out = `// you can use { mode: 'date' }, if you want to have Date as type for this column
|
81006
80497
|
${casing2(
|
81007
80498
|
name
|
81008
|
-
)}: date(
|
80499
|
+
)}: date(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ mode: 'string' })`;
|
81009
80500
|
defaultValue = defaultValue === "now()" ? ".defaultNow()" : defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
81010
80501
|
out += defaultValue;
|
81011
80502
|
return out;
|
81012
80503
|
}
|
81013
80504
|
if (lowered === "text") {
|
81014
|
-
let out = `${casing2(name)}: text(
|
80505
|
+
let out = `${casing2(name)}: text(${dbColumnName2({ name, casing: rawCasing })})`;
|
81015
80506
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
81016
80507
|
return out;
|
81017
80508
|
}
|
81018
80509
|
if (lowered === "tinytext") {
|
81019
|
-
let out = `${casing2(name)}: tinytext(
|
80510
|
+
let out = `${casing2(name)}: tinytext(${dbColumnName2({ name, casing: rawCasing })})`;
|
81020
80511
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
81021
80512
|
return out;
|
81022
80513
|
}
|
81023
80514
|
if (lowered === "mediumtext") {
|
81024
|
-
let out = `${casing2(name)}: mediumtext(
|
80515
|
+
let out = `${casing2(name)}: mediumtext(${dbColumnName2({ name, casing: rawCasing })})`;
|
81025
80516
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
81026
80517
|
return out;
|
81027
80518
|
}
|
81028
80519
|
if (lowered === "longtext") {
|
81029
|
-
let out = `${casing2(name)}: longtext(
|
80520
|
+
let out = `${casing2(name)}: longtext(${dbColumnName2({ name, casing: rawCasing })})`;
|
81030
80521
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
81031
80522
|
return out;
|
81032
80523
|
}
|
81033
80524
|
if (lowered === "year") {
|
81034
|
-
let out = `${casing2(name)}: year(
|
80525
|
+
let out = `${casing2(name)}: year(${dbColumnName2({ name, casing: rawCasing })})`;
|
81035
80526
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
81036
80527
|
return out;
|
81037
80528
|
}
|
81038
80529
|
if (lowered === "json") {
|
81039
|
-
let out = `${casing2(name)}: json(
|
80530
|
+
let out = `${casing2(name)}: json(${dbColumnName2({ name, casing: rawCasing })})`;
|
81040
80531
|
out += defaultValue ? `.default(${mapColumnDefaultForJson(defaultValue)})` : "";
|
81041
80532
|
return out;
|
81042
80533
|
}
|
81043
80534
|
if (lowered.startsWith("varchar")) {
|
81044
80535
|
let out = `${casing2(
|
81045
80536
|
name
|
81046
|
-
)}: varchar(
|
80537
|
+
)}: varchar(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ length: ${lowered.substring(
|
81047
80538
|
"varchar".length + 1,
|
81048
80539
|
lowered.length - 1
|
81049
80540
|
)} })`;
|
@@ -81053,7 +80544,7 @@ import { sql } from "drizzle-orm"
|
|
81053
80544
|
if (lowered.startsWith("char")) {
|
81054
80545
|
let out = `${casing2(
|
81055
80546
|
name
|
81056
|
-
)}: char(
|
80547
|
+
)}: char(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ length: ${lowered.substring(
|
81057
80548
|
"char".length + 1,
|
81058
80549
|
lowered.length - 1
|
81059
80550
|
)} })`;
|
@@ -81066,10 +80557,10 @@ import { sql } from "drizzle-orm"
|
|
81066
80557
|
const fsp = lowered.startsWith("datetime(") ? lowered.substring("datetime".length + 1, lowered.length - 1) : void 0;
|
81067
80558
|
out = fsp ? `${casing2(
|
81068
80559
|
name
|
81069
|
-
)}: datetime(
|
80560
|
+
)}: datetime(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ mode: 'string', fsp: ${lowered.substring(
|
81070
80561
|
"datetime".length + 1,
|
81071
80562
|
lowered.length - 1
|
81072
|
-
)} })` : `${casing2(name)}: datetime(
|
80563
|
+
)} })` : `${casing2(name)}: datetime(${dbColumnName2({ name, casing: rawCasing, withMode: true })}{ mode: 'string'})`;
|
81073
80564
|
defaultValue = defaultValue === "now()" ? ".defaultNow()" : defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
81074
80565
|
out += defaultValue;
|
81075
80566
|
return out;
|
@@ -81080,7 +80571,8 @@ import { sql } from "drizzle-orm"
|
|
81080
80571
|
const [precision, scale] = lowered.slice(8, lowered.length - 1).split(",");
|
81081
80572
|
params = { precision, scale };
|
81082
80573
|
}
|
81083
|
-
|
80574
|
+
const timeConfigParams = params ? timeConfig(params) : void 0;
|
80575
|
+
let out = params ? `${casing2(name)}: decimal(${dbColumnName2({ name, casing: rawCasing, withMode: timeConfigParams !== void 0 })}${timeConfigParams})` : `${casing2(name)}: decimal(${dbColumnName2({ name, casing: rawCasing })})`;
|
81084
80576
|
defaultValue = typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
81085
80577
|
out += defaultValue;
|
81086
80578
|
return out;
|
@@ -81090,14 +80582,14 @@ import { sql } from "drizzle-orm"
|
|
81090
80582
|
let length = lowered.length > keyLength ? Number(lowered.substring(keyLength, lowered.length - 1)) : null;
|
81091
80583
|
length = length ? length : null;
|
81092
80584
|
const params = binaryConfig({ length });
|
81093
|
-
let out = params ? `${casing2(name)}: binary(
|
80585
|
+
let out = params ? `${casing2(name)}: binary(${dbColumnName2({ name, casing: rawCasing, withMode: params !== void 0 })}${params})` : `${casing2(name)}: binary(${dbColumnName2({ name, casing: rawCasing })})`;
|
81094
80586
|
defaultValue = defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
81095
80587
|
out += defaultValue;
|
81096
80588
|
return out;
|
81097
80589
|
}
|
81098
80590
|
if (lowered.startsWith("enum")) {
|
81099
80591
|
const values = lowered.substring("enum".length + 1, lowered.length - 1);
|
81100
|
-
let out = `${casing2(name)}: mysqlEnum(
|
80592
|
+
let out = `${casing2(name)}: mysqlEnum(${dbColumnName2({ name, casing: rawCasing, withMode: true })}[${values}])`;
|
81101
80593
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
81102
80594
|
return out;
|
81103
80595
|
}
|
@@ -81106,7 +80598,7 @@ import { sql } from "drizzle-orm"
|
|
81106
80598
|
let length = lowered.length > keyLength ? Number(lowered.substring(keyLength, lowered.length - 1)) : null;
|
81107
80599
|
length = length ? length : null;
|
81108
80600
|
const params = binaryConfig({ length });
|
81109
|
-
let out = params ? `${casing2(name)}: varbinary(
|
80601
|
+
let out = params ? `${casing2(name)}: varbinary(${dbColumnName2({ name, casing: rawCasing, withMode: params !== void 0 })}${params})` : `${casing2(name)}: varbinary(${dbColumnName2({ name, casing: rawCasing })})`;
|
81110
80602
|
defaultValue = defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
81111
80603
|
out += defaultValue;
|
81112
80604
|
return out;
|
@@ -81115,7 +80607,7 @@ import { sql } from "drizzle-orm"
|
|
81115
80607
|
return `// Warning: Can't parse ${type} from database
|
81116
80608
|
// ${type}Type: ${type}("${name}")`;
|
81117
80609
|
};
|
81118
|
-
createTableColumns2 = (columns, fks, casing2, tableName, schema5) => {
|
80610
|
+
createTableColumns2 = (columns, fks, casing2, rawCasing, tableName, schema5) => {
|
81119
80611
|
let statement = "";
|
81120
80612
|
const oneColumnsFKs = Object.values(fks).filter((it) => {
|
81121
80613
|
return !isSelf2(it);
|
@@ -81133,6 +80625,7 @@ import { sql } from "drizzle-orm"
|
|
81133
80625
|
it.type,
|
81134
80626
|
it.name,
|
81135
80627
|
casing2,
|
80628
|
+
rawCasing,
|
81136
80629
|
it.default,
|
81137
80630
|
it.autoincrement,
|
81138
80631
|
it.onUpdate,
|
@@ -81193,19 +80686,6 @@ import { sql } from "drizzle-orm"
|
|
81193
80686
|
statement += `"${it.name}")`;
|
81194
80687
|
statement += `.on(${it.columns.map((it2) => `table.${casing2(it2)}`).join(", ")}),`;
|
81195
80688
|
statement += `
|
81196
|
-
`;
|
81197
|
-
});
|
81198
|
-
return statement;
|
81199
|
-
};
|
81200
|
-
createTableChecks2 = (checks, casing2) => {
|
81201
|
-
let statement = "";
|
81202
|
-
checks.forEach((it) => {
|
81203
|
-
const checkKey = casing2(it.name);
|
81204
|
-
statement += ` ${checkKey}: `;
|
81205
|
-
statement += "check(";
|
81206
|
-
statement += `"${it.name}", `;
|
81207
|
-
statement += `sql\`${it.value.replace(/`/g, "\\`")}\`)`;
|
81208
|
-
statement += `,
|
81209
80689
|
`;
|
81210
80690
|
});
|
81211
80691
|
return statement;
|
@@ -81276,13 +80756,14 @@ function generateIdentityParams(identity) {
|
|
81276
80756
|
}
|
81277
80757
|
return `.generatedByDefaultAsIdentity(${paramsObj})`;
|
81278
80758
|
}
|
81279
|
-
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,
|
80759
|
+
var import_drizzle_orm9, import_relations, import_casing5, pgImportsList, timeConfig2, possibleIntervals, intervalStrToObj, intervalConfig, mapColumnDefault3, importsPatch2, relations3, escapeColumnKey3, withCasing2, dbColumnName3, paramNameFor, schemaToTypeScript3, isCyclic3, isSelf3, buildArrayDefault, mapDefault, column6, dimensionsInArray, createTableColumns3, createTableIndexes3, createTablePKs3, createTableUniques3, createTableFKs3;
|
81280
80760
|
var init_introspect_pg = __esm({
|
81281
80761
|
"src/introspect-pg.ts"() {
|
81282
80762
|
"use strict";
|
81283
80763
|
import_drizzle_orm9 = require("drizzle-orm");
|
81284
80764
|
import_relations = require("drizzle-orm/relations");
|
81285
80765
|
init_utils3();
|
80766
|
+
import_casing5 = require("drizzle-orm/casing");
|
81286
80767
|
init_vector();
|
81287
80768
|
init_global();
|
81288
80769
|
init_pgSerializer();
|
@@ -81408,6 +80889,15 @@ var init_introspect_pg = __esm({
|
|
81408
80889
|
}
|
81409
80890
|
assertUnreachable(casing2);
|
81410
80891
|
};
|
80892
|
+
dbColumnName3 = ({ name, casing: casing2, withMode = false }) => {
|
80893
|
+
if (casing2 === "preserve") {
|
80894
|
+
return "";
|
80895
|
+
}
|
80896
|
+
if (casing2 === "camel") {
|
80897
|
+
return (0, import_casing5.toCamelCase)(name) === name ? "" : withMode ? `"${name}", ` : `"${name}"`;
|
80898
|
+
}
|
80899
|
+
assertUnreachable(casing2);
|
80900
|
+
};
|
81411
80901
|
paramNameFor = (name, schema5) => {
|
81412
80902
|
const schemaSuffix = schema5 && schema5 !== "public" ? `In${schema5.capitalise()}` : "";
|
81413
80903
|
return `${name}${schemaSuffix}`;
|
@@ -81444,9 +80934,6 @@ var init_introspect_pg = __esm({
|
|
81444
80934
|
const uniqueImports = Object.values(it.uniqueConstraints).map(
|
81445
80935
|
(it2) => "unique"
|
81446
80936
|
);
|
81447
|
-
const checkImports = Object.values(it.checkConstraints).map(
|
81448
|
-
(it2) => "check"
|
81449
|
-
);
|
81450
80937
|
if (it.schema && it.schema !== "public" && it.schema !== "") {
|
81451
80938
|
res.pg.push("pgSchema");
|
81452
80939
|
}
|
@@ -81454,7 +80941,6 @@ var init_introspect_pg = __esm({
|
|
81454
80941
|
res.pg.push(...fkImpots);
|
81455
80942
|
res.pg.push(...pkImports);
|
81456
80943
|
res.pg.push(...uniqueImports);
|
81457
|
-
res.pg.push(...checkImports);
|
81458
80944
|
const columnImports = Object.values(it.columns).map((col) => {
|
81459
80945
|
let patched = (importsPatch2[col.type] || col.type).replace("[]", "");
|
81460
80946
|
patched = patched === "double precision" ? "doublePrecision" : patched;
|
@@ -81544,7 +81030,7 @@ var init_introspect_pg = __esm({
|
|
81544
81030
|
schema5.internal
|
81545
81031
|
);
|
81546
81032
|
statement += "}";
|
81547
|
-
if (Object.keys(table4.indexes).length > 0 || Object.values(table4.foreignKeys).length > 0 || Object.keys(table4.compositePrimaryKeys).length > 0 || Object.keys(table4.uniqueConstraints).length > 0
|
81033
|
+
if (Object.keys(table4.indexes).length > 0 || Object.values(table4.foreignKeys).length > 0 || Object.keys(table4.compositePrimaryKeys).length > 0 || Object.keys(table4.uniqueConstraints).length > 0) {
|
81548
81034
|
statement += ",\n";
|
81549
81035
|
statement += "(table) => {\n";
|
81550
81036
|
statement += " return {\n";
|
@@ -81562,10 +81048,6 @@ var init_introspect_pg = __esm({
|
|
81562
81048
|
Object.values(table4.uniqueConstraints),
|
81563
81049
|
casing2
|
81564
81050
|
);
|
81565
|
-
statement += createTableChecks3(
|
81566
|
-
Object.values(table4.checkConstraints),
|
81567
|
-
casing2
|
81568
|
-
);
|
81569
81051
|
statement += " }\n";
|
81570
81052
|
statement += "}";
|
81571
81053
|
}
|
@@ -81711,49 +81193,49 @@ var init_introspect_pg = __esm({
|
|
81711
81193
|
let out = `${withCasing2(name, casing2)}: ${withCasing2(
|
81712
81194
|
paramNameFor(type.replace("[]", ""), typeSchema),
|
81713
81195
|
casing2
|
81714
|
-
)}(
|
81196
|
+
)}(${dbColumnName3({ name, casing: casing2 })})`;
|
81715
81197
|
return out;
|
81716
81198
|
}
|
81717
81199
|
if (lowered.startsWith("serial")) {
|
81718
|
-
return `${withCasing2(name, casing2)}: serial(
|
81200
|
+
return `${withCasing2(name, casing2)}: serial(${dbColumnName3({ name, casing: casing2 })})`;
|
81719
81201
|
}
|
81720
81202
|
if (lowered.startsWith("smallserial")) {
|
81721
|
-
return `${withCasing2(name, casing2)}: smallserial(
|
81203
|
+
return `${withCasing2(name, casing2)}: smallserial(${dbColumnName3({ name, casing: casing2 })})`;
|
81722
81204
|
}
|
81723
81205
|
if (lowered.startsWith("bigserial")) {
|
81724
81206
|
return `${withCasing2(
|
81725
81207
|
name,
|
81726
81208
|
casing2
|
81727
|
-
)}: bigserial(
|
81209
|
+
)}: bigserial(${dbColumnName3({ name, casing: casing2, withMode: true })}{ mode: "bigint" })`;
|
81728
81210
|
}
|
81729
81211
|
if (lowered.startsWith("integer")) {
|
81730
|
-
let out = `${withCasing2(name, casing2)}: integer(
|
81212
|
+
let out = `${withCasing2(name, casing2)}: integer(${dbColumnName3({ name, casing: casing2 })})`;
|
81731
81213
|
return out;
|
81732
81214
|
}
|
81733
81215
|
if (lowered.startsWith("smallint")) {
|
81734
|
-
let out = `${withCasing2(name, casing2)}: smallint(
|
81216
|
+
let out = `${withCasing2(name, casing2)}: smallint(${dbColumnName3({ name, casing: casing2 })})`;
|
81735
81217
|
return out;
|
81736
81218
|
}
|
81737
81219
|
if (lowered.startsWith("bigint")) {
|
81738
81220
|
let out = `// You can use { mode: "bigint" } if numbers are exceeding js number limitations
|
81739
81221
|
`;
|
81740
|
-
out += `${withCasing2(name, casing2)}: bigint(
|
81222
|
+
out += `${withCasing2(name, casing2)}: bigint(${dbColumnName3({ name, casing: casing2, withMode: true })}{ mode: "number" })`;
|
81741
81223
|
return out;
|
81742
81224
|
}
|
81743
81225
|
if (lowered.startsWith("boolean")) {
|
81744
|
-
let out = `${withCasing2(name, casing2)}: boolean(
|
81226
|
+
let out = `${withCasing2(name, casing2)}: boolean(${dbColumnName3({ name, casing: casing2 })})`;
|
81745
81227
|
return out;
|
81746
81228
|
}
|
81747
81229
|
if (lowered.startsWith("double precision")) {
|
81748
|
-
let out = `${withCasing2(name, casing2)}: doublePrecision(
|
81230
|
+
let out = `${withCasing2(name, casing2)}: doublePrecision(${dbColumnName3({ name, casing: casing2 })})`;
|
81749
81231
|
return out;
|
81750
81232
|
}
|
81751
81233
|
if (lowered.startsWith("real")) {
|
81752
|
-
let out = `${withCasing2(name, casing2)}: real(
|
81234
|
+
let out = `${withCasing2(name, casing2)}: real(${dbColumnName3({ name, casing: casing2 })})`;
|
81753
81235
|
return out;
|
81754
81236
|
}
|
81755
81237
|
if (lowered.startsWith("uuid")) {
|
81756
|
-
let out = `${withCasing2(name, casing2)}: uuid(
|
81238
|
+
let out = `${withCasing2(name, casing2)}: uuid(${dbColumnName3({ name, casing: casing2 })})`;
|
81757
81239
|
return out;
|
81758
81240
|
}
|
81759
81241
|
if (lowered.startsWith("numeric")) {
|
@@ -81762,7 +81244,7 @@ var init_introspect_pg = __esm({
|
|
81762
81244
|
const [precision, scale] = lowered.slice(8, lowered.length - 1).split(",");
|
81763
81245
|
params = { precision, scale };
|
81764
81246
|
}
|
81765
|
-
let out = params ? `${withCasing2(name, casing2)}: numeric(
|
81247
|
+
let out = params ? `${withCasing2(name, casing2)}: numeric(${dbColumnName3({ name, casing: casing2, withMode: true })}${timeConfig2(params)})` : `${withCasing2(name, casing2)}: numeric(${dbColumnName3({ name, casing: casing2 })})`;
|
81766
81248
|
return out;
|
81767
81249
|
}
|
81768
81250
|
if (lowered.startsWith("timestamp")) {
|
@@ -81776,7 +81258,7 @@ var init_introspect_pg = __esm({
|
|
81776
81258
|
withTimezone,
|
81777
81259
|
mode: "'string'"
|
81778
81260
|
});
|
81779
|
-
let out = params ? `${withCasing2(name, casing2)}: timestamp(
|
81261
|
+
let out = params ? `${withCasing2(name, casing2)}: timestamp(${dbColumnName3({ name, casing: casing2, withMode: true })}${params})` : `${withCasing2(name, casing2)}: timestamp(${dbColumnName3({ name, casing: casing2 })})`;
|
81780
81262
|
return out;
|
81781
81263
|
}
|
81782
81264
|
if (lowered.startsWith("time")) {
|
@@ -81786,44 +81268,44 @@ var init_introspect_pg = __esm({
|
|
81786
81268
|
) : null;
|
81787
81269
|
precision = precision ? precision : null;
|
81788
81270
|
const params = timeConfig2({ precision, withTimezone });
|
81789
|
-
let out = params ? `${withCasing2(name, casing2)}: time(
|
81271
|
+
let out = params ? `${withCasing2(name, casing2)}: time(${dbColumnName3({ name, casing: casing2, withMode: true })}${params})` : `${withCasing2(name, casing2)}: time(${dbColumnName3({ name, casing: casing2 })})`;
|
81790
81272
|
return out;
|
81791
81273
|
}
|
81792
81274
|
if (lowered.startsWith("interval")) {
|
81793
81275
|
const params = intervalConfig(lowered);
|
81794
|
-
let out = params ? `${withCasing2(name, casing2)}: interval(
|
81276
|
+
let out = params ? `${withCasing2(name, casing2)}: interval(${dbColumnName3({ name, casing: casing2, withMode: true })}${params})` : `${withCasing2(name, casing2)}: interval(${dbColumnName3({ name, casing: casing2 })})`;
|
81795
81277
|
return out;
|
81796
81278
|
}
|
81797
81279
|
if (lowered === "date") {
|
81798
|
-
let out = `${withCasing2(name, casing2)}: date(
|
81280
|
+
let out = `${withCasing2(name, casing2)}: date(${dbColumnName3({ name, casing: casing2 })})`;
|
81799
81281
|
return out;
|
81800
81282
|
}
|
81801
81283
|
if (lowered.startsWith("text")) {
|
81802
|
-
let out = `${withCasing2(name, casing2)}: text(
|
81284
|
+
let out = `${withCasing2(name, casing2)}: text(${dbColumnName3({ name, casing: casing2 })})`;
|
81803
81285
|
return out;
|
81804
81286
|
}
|
81805
81287
|
if (lowered.startsWith("jsonb")) {
|
81806
|
-
let out = `${withCasing2(name, casing2)}: jsonb(
|
81288
|
+
let out = `${withCasing2(name, casing2)}: jsonb(${dbColumnName3({ name, casing: casing2 })})`;
|
81807
81289
|
return out;
|
81808
81290
|
}
|
81809
81291
|
if (lowered.startsWith("json")) {
|
81810
|
-
let out = `${withCasing2(name, casing2)}: json(
|
81292
|
+
let out = `${withCasing2(name, casing2)}: json(${dbColumnName3({ name, casing: casing2 })})`;
|
81811
81293
|
return out;
|
81812
81294
|
}
|
81813
81295
|
if (lowered.startsWith("inet")) {
|
81814
|
-
let out = `${withCasing2(name, casing2)}: inet(
|
81296
|
+
let out = `${withCasing2(name, casing2)}: inet(${dbColumnName3({ name, casing: casing2 })})`;
|
81815
81297
|
return out;
|
81816
81298
|
}
|
81817
81299
|
if (lowered.startsWith("cidr")) {
|
81818
|
-
let out = `${withCasing2(name, casing2)}: cidr(
|
81300
|
+
let out = `${withCasing2(name, casing2)}: cidr(${dbColumnName3({ name, casing: casing2 })})`;
|
81819
81301
|
return out;
|
81820
81302
|
}
|
81821
81303
|
if (lowered.startsWith("macaddr8")) {
|
81822
|
-
let out = `${withCasing2(name, casing2)}: macaddr8(
|
81304
|
+
let out = `${withCasing2(name, casing2)}: macaddr8(${dbColumnName3({ name, casing: casing2 })})`;
|
81823
81305
|
return out;
|
81824
81306
|
}
|
81825
81307
|
if (lowered.startsWith("macaddr")) {
|
81826
|
-
let out = `${withCasing2(name, casing2)}: macaddr(
|
81308
|
+
let out = `${withCasing2(name, casing2)}: macaddr(${dbColumnName3({ name, casing: casing2 })})`;
|
81827
81309
|
return out;
|
81828
81310
|
}
|
81829
81311
|
if (lowered.startsWith("varchar")) {
|
@@ -81832,21 +81314,21 @@ var init_introspect_pg = __esm({
|
|
81832
81314
|
out = `${withCasing2(
|
81833
81315
|
name,
|
81834
81316
|
casing2
|
81835
|
-
)}: varchar(
|
81317
|
+
)}: varchar(${dbColumnName3({ name, casing: casing2, withMode: true })}{ length: ${lowered.substring(
|
81836
81318
|
8,
|
81837
81319
|
lowered.length - 1
|
81838
81320
|
)} })`;
|
81839
81321
|
} else {
|
81840
|
-
out = `${withCasing2(name, casing2)}: varchar(
|
81322
|
+
out = `${withCasing2(name, casing2)}: varchar(${dbColumnName3({ name, casing: casing2 })})`;
|
81841
81323
|
}
|
81842
81324
|
return out;
|
81843
81325
|
}
|
81844
81326
|
if (lowered.startsWith("point")) {
|
81845
|
-
let out = `${withCasing2(name, casing2)}: point(
|
81327
|
+
let out = `${withCasing2(name, casing2)}: point(${dbColumnName3({ name, casing: casing2 })})`;
|
81846
81328
|
return out;
|
81847
81329
|
}
|
81848
81330
|
if (lowered.startsWith("line")) {
|
81849
|
-
let out = `${withCasing2(name, casing2)}: point(
|
81331
|
+
let out = `${withCasing2(name, casing2)}: point(${dbColumnName3({ name, casing: casing2 })})`;
|
81850
81332
|
return out;
|
81851
81333
|
}
|
81852
81334
|
if (lowered.startsWith("geometry")) {
|
@@ -81855,14 +81337,14 @@ var init_introspect_pg = __esm({
|
|
81855
81337
|
if (lowered.length !== 8) {
|
81856
81338
|
const geometryOptions = lowered.slice(9, -1).split(",");
|
81857
81339
|
if (geometryOptions.length === 1 && geometryOptions[0] !== "") {
|
81858
|
-
out = `${withCasing2(name, casing2)}: geometry(
|
81340
|
+
out = `${withCasing2(name, casing2)}: geometry(${dbColumnName3({ name, casing: casing2, withMode: true })}{ type: "${geometryOptions[0]}" })`;
|
81859
81341
|
} else if (geometryOptions.length === 2) {
|
81860
|
-
out = `${withCasing2(name, casing2)}: geometry(
|
81342
|
+
out = `${withCasing2(name, casing2)}: geometry(${dbColumnName3({ name, casing: casing2, withMode: true })}{ type: "${geometryOptions[0]}", srid: ${geometryOptions[1]} })`;
|
81861
81343
|
} else {
|
81862
81344
|
isGeoUnknown = true;
|
81863
81345
|
}
|
81864
81346
|
} else {
|
81865
|
-
out = `${withCasing2(name, casing2)}: geometry(
|
81347
|
+
out = `${withCasing2(name, casing2)}: geometry(${dbColumnName3({ name, casing: casing2 })})`;
|
81866
81348
|
}
|
81867
81349
|
if (isGeoUnknown) {
|
81868
81350
|
let unknown2 = `// TODO: failed to parse geometry type because found more than 2 options inside geometry function '${type}'
|
@@ -81879,12 +81361,12 @@ var init_introspect_pg = __esm({
|
|
81879
81361
|
out = `${withCasing2(
|
81880
81362
|
name,
|
81881
81363
|
casing2
|
81882
|
-
)}: vector(
|
81364
|
+
)}: vector(${dbColumnName3({ name, casing: casing2, withMode: true })}{ dimensions: ${lowered.substring(
|
81883
81365
|
7,
|
81884
81366
|
lowered.length - 1
|
81885
81367
|
)} })`;
|
81886
81368
|
} else {
|
81887
|
-
out = `${withCasing2(name, casing2)}: vector(
|
81369
|
+
out = `${withCasing2(name, casing2)}: vector(${dbColumnName3({ name, casing: casing2 })})`;
|
81888
81370
|
}
|
81889
81371
|
return out;
|
81890
81372
|
}
|
@@ -81894,12 +81376,12 @@ var init_introspect_pg = __esm({
|
|
81894
81376
|
out = `${withCasing2(
|
81895
81377
|
name,
|
81896
81378
|
casing2
|
81897
|
-
)}: char(
|
81379
|
+
)}: char(${dbColumnName3({ name, casing: casing2, withMode: true })}{ length: ${lowered.substring(
|
81898
81380
|
5,
|
81899
81381
|
lowered.length - 1
|
81900
81382
|
)} })`;
|
81901
81383
|
} else {
|
81902
|
-
out = `${withCasing2(name, casing2)}: char(
|
81384
|
+
out = `${withCasing2(name, casing2)}: char(${dbColumnName3({ name, casing: casing2 })})`;
|
81903
81385
|
}
|
81904
81386
|
return out;
|
81905
81387
|
}
|
@@ -82028,19 +81510,6 @@ var init_introspect_pg = __esm({
|
|
82028
81510
|
statement += `.on(${it.columns.map((it2) => `table.${withCasing2(it2, casing2)}`).join(", ")})`;
|
82029
81511
|
statement += it.nullsNotDistinct ? `.nullsNotDistinct()` : "";
|
82030
81512
|
statement += `,
|
82031
|
-
`;
|
82032
|
-
});
|
82033
|
-
return statement;
|
82034
|
-
};
|
82035
|
-
createTableChecks3 = (checkConstraints, casing2) => {
|
82036
|
-
let statement = "";
|
82037
|
-
checkConstraints.forEach((it) => {
|
82038
|
-
const checkKey = withCasing2(it.name, casing2);
|
82039
|
-
statement += ` ${checkKey}: `;
|
82040
|
-
statement += "check(";
|
82041
|
-
statement += `"${it.name}", `;
|
82042
|
-
statement += `sql\`${it.value}\`)`;
|
82043
|
-
statement += `,
|
82044
81513
|
`;
|
82045
81514
|
});
|
82046
81515
|
return statement;
|
@@ -84010,9 +83479,9 @@ init_source();
|
|
84010
83479
|
|
84011
83480
|
// src/cli/commands/check.ts
|
84012
83481
|
init_utils();
|
84013
|
-
var checkHandler = (out,
|
84014
|
-
const { snapshots } = prepareOutFolder(out,
|
84015
|
-
const report = validateWithReport(snapshots,
|
83482
|
+
var checkHandler = (out, dialect4) => {
|
83483
|
+
const { snapshots } = prepareOutFolder(out, dialect4);
|
83484
|
+
const report = validateWithReport(snapshots, dialect4);
|
84016
83485
|
if (report.nonLatest.length > 0) {
|
84017
83486
|
console.log(
|
84018
83487
|
report.nonLatest.map((it) => {
|
@@ -85299,12 +84768,14 @@ var optionBreakpoints = boolean().desc(
|
|
85299
84768
|
`Prepare SQL statements with breakpoints`
|
85300
84769
|
);
|
85301
84770
|
var optionDriver = string().enum(...drivers).desc("Database driver");
|
84771
|
+
var optionCasing = string().enum("camelCase", "snake_case").desc("Casing for serialization");
|
85302
84772
|
var generate = command({
|
85303
84773
|
name: "generate",
|
85304
84774
|
options: {
|
85305
84775
|
config: optionConfig,
|
85306
84776
|
dialect: optionDialect,
|
85307
84777
|
driver: optionDriver,
|
84778
|
+
casing: optionCasing,
|
85308
84779
|
schema: string().desc("Path to a schema file or folder"),
|
85309
84780
|
out: optionOut,
|
85310
84781
|
name: string().desc("Migration file name"),
|
@@ -85317,7 +84788,7 @@ var generate = command({
|
|
85317
84788
|
"generate",
|
85318
84789
|
opts,
|
85319
84790
|
["prefix", "name", "custom"],
|
85320
|
-
["driver", "breakpoints", "schema", "out", "dialect"]
|
84791
|
+
["driver", "breakpoints", "schema", "out", "dialect", "casing"]
|
85321
84792
|
);
|
85322
84793
|
return prepareGenerateConfig(opts, from);
|
85323
84794
|
},
|
@@ -85330,17 +84801,17 @@ var generate = command({
|
|
85330
84801
|
prepareAndMigrateSqlite: prepareAndMigrateSqlite2,
|
85331
84802
|
prepareAndMigrateLibSQL: prepareAndMigrateLibSQL2
|
85332
84803
|
} = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
85333
|
-
const
|
85334
|
-
if (
|
84804
|
+
const dialect4 = opts.dialect;
|
84805
|
+
if (dialect4 === "postgresql") {
|
85335
84806
|
await prepareAndMigratePg2(opts);
|
85336
|
-
} else if (
|
84807
|
+
} else if (dialect4 === "mysql") {
|
85337
84808
|
await prepareAndMigrateMysql2(opts);
|
85338
|
-
} else if (
|
84809
|
+
} else if (dialect4 === "sqlite") {
|
85339
84810
|
await prepareAndMigrateSqlite2(opts);
|
85340
|
-
} else if (
|
84811
|
+
} else if (dialect4 === "turso") {
|
85341
84812
|
await prepareAndMigrateLibSQL2(opts);
|
85342
84813
|
} else {
|
85343
|
-
assertUnreachable(
|
84814
|
+
assertUnreachable(dialect4);
|
85344
84815
|
}
|
85345
84816
|
}
|
85346
84817
|
});
|
@@ -85355,9 +84826,9 @@ var migrate = command({
|
|
85355
84826
|
handler: async (opts) => {
|
85356
84827
|
await assertOrmCoreVersion();
|
85357
84828
|
await assertPackages("drizzle-orm");
|
85358
|
-
const { dialect:
|
84829
|
+
const { dialect: dialect4, schema: schema5, table: table4, out, credentials: credentials2 } = opts;
|
85359
84830
|
try {
|
85360
|
-
if (
|
84831
|
+
if (dialect4 === "postgresql") {
|
85361
84832
|
if ("driver" in credentials2) {
|
85362
84833
|
const { driver: driver2 } = credentials2;
|
85363
84834
|
if (driver2 === "aws-data-api") {
|
@@ -85388,7 +84859,7 @@ var migrate = command({
|
|
85388
84859
|
migrationsSchema: schema5
|
85389
84860
|
})
|
85390
84861
|
);
|
85391
|
-
} else if (
|
84862
|
+
} else if (dialect4 === "mysql") {
|
85392
84863
|
const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
85393
84864
|
const { migrate: migrate2 } = await connectToMySQL2(credentials2);
|
85394
84865
|
await (0, import_hanji13.renderWithTask)(
|
@@ -85399,7 +84870,7 @@ var migrate = command({
|
|
85399
84870
|
migrationsSchema: schema5
|
85400
84871
|
})
|
85401
84872
|
);
|
85402
|
-
} else if (
|
84873
|
+
} else if (dialect4 === "sqlite") {
|
85403
84874
|
const { connectToSQLite: connectToSQLite2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
85404
84875
|
const { migrate: migrate2 } = await connectToSQLite2(credentials2);
|
85405
84876
|
await (0, import_hanji13.renderWithTask)(
|
@@ -85410,7 +84881,7 @@ var migrate = command({
|
|
85410
84881
|
migrationsSchema: schema5
|
85411
84882
|
})
|
85412
84883
|
);
|
85413
|
-
} else if (
|
84884
|
+
} else if (dialect4 === "turso") {
|
85414
84885
|
const { connectToLibSQL: connectToLibSQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
85415
84886
|
const { migrate: migrate2 } = await connectToLibSQL2(credentials2);
|
85416
84887
|
await (0, import_hanji13.renderWithTask)(
|
@@ -85422,7 +84893,7 @@ var migrate = command({
|
|
85422
84893
|
})
|
85423
84894
|
);
|
85424
84895
|
} else {
|
85425
|
-
assertUnreachable(
|
84896
|
+
assertUnreachable(dialect4);
|
85426
84897
|
}
|
85427
84898
|
} catch (e2) {
|
85428
84899
|
console.error(e2);
|
@@ -85456,6 +84927,7 @@ var push = command({
|
|
85456
84927
|
options: {
|
85457
84928
|
config: optionConfig,
|
85458
84929
|
dialect: optionDialect,
|
84930
|
+
casing: optionCasing,
|
85459
84931
|
schema: string().desc("Path to a schema file or folder"),
|
85460
84932
|
...optionsFilters,
|
85461
84933
|
...optionsDatabaseCredentials,
|
@@ -85484,7 +84956,8 @@ var push = command({
|
|
85484
84956
|
"authToken",
|
85485
84957
|
"schemaFilters",
|
85486
84958
|
"extensionsFilters",
|
85487
|
-
"tablesFilter"
|
84959
|
+
"tablesFilter",
|
84960
|
+
"casing"
|
85488
84961
|
]
|
85489
84962
|
);
|
85490
84963
|
return preparePushConfig(opts, from);
|
@@ -85493,17 +84966,18 @@ var push = command({
|
|
85493
84966
|
await assertPackages("drizzle-orm");
|
85494
84967
|
await assertOrmCoreVersion();
|
85495
84968
|
const {
|
85496
|
-
dialect:
|
84969
|
+
dialect: dialect4,
|
85497
84970
|
schemaPath,
|
85498
84971
|
strict,
|
85499
84972
|
verbose,
|
85500
84973
|
credentials: credentials2,
|
85501
84974
|
tablesFilter,
|
85502
84975
|
schemasFilter,
|
85503
|
-
force
|
84976
|
+
force,
|
84977
|
+
casing: casing2
|
85504
84978
|
} = config;
|
85505
84979
|
try {
|
85506
|
-
if (
|
84980
|
+
if (dialect4 === "mysql") {
|
85507
84981
|
const { mysqlPush: mysqlPush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
|
85508
84982
|
await mysqlPush2(
|
85509
84983
|
schemaPath,
|
@@ -85511,9 +84985,10 @@ var push = command({
|
|
85511
84985
|
tablesFilter,
|
85512
84986
|
strict,
|
85513
84987
|
verbose,
|
85514
|
-
force
|
84988
|
+
force,
|
84989
|
+
casing2
|
85515
84990
|
);
|
85516
|
-
} else if (
|
84991
|
+
} else if (dialect4 === "postgresql") {
|
85517
84992
|
if ("driver" in credentials2) {
|
85518
84993
|
const { driver: driver2 } = credentials2;
|
85519
84994
|
if (driver2 === "aws-data-api") {
|
@@ -85542,9 +85017,10 @@ var push = command({
|
|
85542
85017
|
credentials2,
|
85543
85018
|
tablesFilter,
|
85544
85019
|
schemasFilter,
|
85545
|
-
force
|
85020
|
+
force,
|
85021
|
+
casing2
|
85546
85022
|
);
|
85547
|
-
} else if (
|
85023
|
+
} else if (dialect4 === "sqlite") {
|
85548
85024
|
const { sqlitePush: sqlitePush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
|
85549
85025
|
await sqlitePush2(
|
85550
85026
|
schemaPath,
|
@@ -85552,9 +85028,10 @@ var push = command({
|
|
85552
85028
|
strict,
|
85553
85029
|
credentials2,
|
85554
85030
|
tablesFilter,
|
85555
|
-
force
|
85031
|
+
force,
|
85032
|
+
casing2
|
85556
85033
|
);
|
85557
|
-
} else if (
|
85034
|
+
} else if (dialect4 === "turso") {
|
85558
85035
|
const { libSQLPush: libSQLPush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
|
85559
85036
|
await libSQLPush2(
|
85560
85037
|
schemaPath,
|
@@ -85562,10 +85039,11 @@ var push = command({
|
|
85562
85039
|
strict,
|
85563
85040
|
credentials2,
|
85564
85041
|
tablesFilter,
|
85565
|
-
force
|
85042
|
+
force,
|
85043
|
+
casing2
|
85566
85044
|
);
|
85567
85045
|
} else {
|
85568
|
-
assertUnreachable(
|
85046
|
+
assertUnreachable(dialect4);
|
85569
85047
|
}
|
85570
85048
|
} catch (e2) {
|
85571
85049
|
console.error(e2);
|
@@ -85586,8 +85064,8 @@ var check = command({
|
|
85586
85064
|
},
|
85587
85065
|
handler: async (config) => {
|
85588
85066
|
await assertOrmCoreVersion();
|
85589
|
-
const { out, dialect:
|
85590
|
-
checkHandler(out,
|
85067
|
+
const { out, dialect: dialect4 } = config;
|
85068
|
+
checkHandler(out, dialect4);
|
85591
85069
|
console.log("Everything's fine \u{1F436}\u{1F525}");
|
85592
85070
|
}
|
85593
85071
|
});
|
@@ -85604,15 +85082,15 @@ var up = command({
|
|
85604
85082
|
},
|
85605
85083
|
handler: async (config) => {
|
85606
85084
|
await assertOrmCoreVersion();
|
85607
|
-
const { out, dialect:
|
85085
|
+
const { out, dialect: dialect4 } = config;
|
85608
85086
|
await assertPackages("drizzle-orm");
|
85609
|
-
if (
|
85087
|
+
if (dialect4 === "postgresql") {
|
85610
85088
|
upPgHandler(out);
|
85611
85089
|
}
|
85612
|
-
if (
|
85090
|
+
if (dialect4 === "mysql") {
|
85613
85091
|
upMysqlHandler(out);
|
85614
85092
|
}
|
85615
|
-
if (
|
85093
|
+
if (dialect4 === "sqlite" || dialect4 === "turso") {
|
85616
85094
|
upSqliteHandler(out);
|
85617
85095
|
}
|
85618
85096
|
}
|
@@ -85659,7 +85137,7 @@ var pull = command({
|
|
85659
85137
|
await assertPackages("drizzle-orm");
|
85660
85138
|
await assertOrmCoreVersion();
|
85661
85139
|
const {
|
85662
|
-
dialect:
|
85140
|
+
dialect: dialect4,
|
85663
85141
|
credentials: credentials2,
|
85664
85142
|
out,
|
85665
85143
|
casing: casing2,
|
@@ -85676,7 +85154,7 @@ var pull = command({
|
|
85676
85154
|
);
|
85677
85155
|
console.log();
|
85678
85156
|
try {
|
85679
|
-
if (
|
85157
|
+
if (dialect4 === "postgresql") {
|
85680
85158
|
if ("driver" in credentials2) {
|
85681
85159
|
const { driver: driver2 } = credentials2;
|
85682
85160
|
if (driver2 === "aws-data-api") {
|
@@ -85707,7 +85185,7 @@ var pull = command({
|
|
85707
85185
|
schemasFilter,
|
85708
85186
|
prefix2
|
85709
85187
|
);
|
85710
|
-
} else if (
|
85188
|
+
} else if (dialect4 === "mysql") {
|
85711
85189
|
const { introspectMysql: introspectMysql2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
|
85712
85190
|
await introspectMysql2(
|
85713
85191
|
casing2,
|
@@ -85717,7 +85195,7 @@ var pull = command({
|
|
85717
85195
|
tablesFilter,
|
85718
85196
|
prefix2
|
85719
85197
|
);
|
85720
|
-
} else if (
|
85198
|
+
} else if (dialect4 === "sqlite") {
|
85721
85199
|
const { introspectSqlite: introspectSqlite2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
|
85722
85200
|
await introspectSqlite2(
|
85723
85201
|
casing2,
|
@@ -85727,7 +85205,7 @@ var pull = command({
|
|
85727
85205
|
tablesFilter,
|
85728
85206
|
prefix2
|
85729
85207
|
);
|
85730
|
-
} else if (
|
85208
|
+
} else if (dialect4 === "turso") {
|
85731
85209
|
const { introspectLibSQL: introspectLibSQL2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
|
85732
85210
|
await introspectLibSQL2(
|
85733
85211
|
casing2,
|
@@ -85738,7 +85216,7 @@ var pull = command({
|
|
85738
85216
|
prefix2
|
85739
85217
|
);
|
85740
85218
|
} else {
|
85741
|
-
assertUnreachable(
|
85219
|
+
assertUnreachable(dialect4);
|
85742
85220
|
}
|
85743
85221
|
} catch (e2) {
|
85744
85222
|
console.error(e2);
|
@@ -85776,7 +85254,7 @@ var studio = command({
|
|
85776
85254
|
await assertPackages("drizzle-orm");
|
85777
85255
|
assertStudioNodeVersion();
|
85778
85256
|
const {
|
85779
|
-
dialect:
|
85257
|
+
dialect: dialect4,
|
85780
85258
|
schema: schemaPath,
|
85781
85259
|
port,
|
85782
85260
|
host,
|
@@ -85792,7 +85270,7 @@ var studio = command({
|
|
85792
85270
|
} = await Promise.resolve().then(() => (init_studio2(), studio_exports));
|
85793
85271
|
let setup;
|
85794
85272
|
try {
|
85795
|
-
if (
|
85273
|
+
if (dialect4 === "postgresql") {
|
85796
85274
|
if ("driver" in credentials2) {
|
85797
85275
|
const { driver: driver2 } = credentials2;
|
85798
85276
|
if (driver2 === "aws-data-api") {
|
@@ -85815,17 +85293,17 @@ var studio = command({
|
|
85815
85293
|
}
|
85816
85294
|
const { schema: schema5, relations: relations4, files } = schemaPath ? await preparePgSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
|
85817
85295
|
setup = await drizzleForPostgres2(credentials2, schema5, relations4, files);
|
85818
|
-
} else if (
|
85296
|
+
} else if (dialect4 === "mysql") {
|
85819
85297
|
const { schema: schema5, relations: relations4, files } = schemaPath ? await prepareMySqlSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
|
85820
85298
|
setup = await drizzleForMySQL2(credentials2, schema5, relations4, files);
|
85821
|
-
} else if (
|
85299
|
+
} else if (dialect4 === "sqlite") {
|
85822
85300
|
const { schema: schema5, relations: relations4, files } = schemaPath ? await prepareSQLiteSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
|
85823
85301
|
setup = await drizzleForSQLite2(credentials2, schema5, relations4, files);
|
85824
|
-
} else if (
|
85302
|
+
} else if (dialect4 === "turso") {
|
85825
85303
|
const { schema: schema5, relations: relations4, files } = schemaPath ? await prepareSQLiteSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
|
85826
85304
|
setup = await drizzleForLibSQL(credentials2, schema5, relations4, files);
|
85827
85305
|
} else {
|
85828
|
-
assertUnreachable(
|
85306
|
+
assertUnreachable(dialect4);
|
85829
85307
|
}
|
85830
85308
|
const { prepareServer: prepareServer2 } = await Promise.resolve().then(() => (init_studio2(), studio_exports));
|
85831
85309
|
const server = await prepareServer2(setup);
|
@@ -85876,7 +85354,7 @@ init_utils2();
|
|
85876
85354
|
var version2 = async () => {
|
85877
85355
|
const { npmVersion } = await ormCoreVersions();
|
85878
85356
|
const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
|
85879
|
-
const envVersion = "0.25.0-
|
85357
|
+
const envVersion = "0.25.0-665fa03";
|
85880
85358
|
const kitVersion = envVersion ? `v${envVersion}` : "--";
|
85881
85359
|
const versions = `drizzle-kit: ${kitVersion}
|
85882
85360
|
${ormVersion}`;
|