drizzle-kit 0.25.0-b75016b → 0.25.0-bab5208
Sign up to get free protection for your applications and to get access to all the features.
- package/api.d.mts +4 -99
- package/api.d.ts +4 -99
- package/api.js +1476 -2278
- package/api.mjs +1476 -2278
- package/bin.cjs +587 -1343
- package/common-DYjgLS6u.d.mts +8 -0
- package/common-DYjgLS6u.d.ts +8 -0
- package/index.d.mts +2 -12
- package/index.d.ts +2 -12
- package/package.json +2 -2
- package/utils.js +11 -21
- package/utils.mjs +10 -21
package/bin.cjs
CHANGED
@@ -1075,7 +1075,7 @@ var require_hanji = __commonJS({
|
|
1075
1075
|
});
|
1076
1076
|
|
1077
1077
|
// src/cli/views.ts
|
1078
|
-
var import_hanji, warning, err, info, grey, error, schema, isRenamePromptItem, ResolveColumnSelect, tableKey,
|
1078
|
+
var import_hanji, warning, err, info, grey, error, schema, isRenamePromptItem, ResolveColumnSelect, tableKey, ResolveSelect, ResolveSchemasSelect, Spinner, IntrospectProgress, MigrateProgress, ProgressView, DropMigrationView, trimmedRange;
|
1079
1079
|
var init_views = __esm({
|
1080
1080
|
"src/cli/views.ts"() {
|
1081
1081
|
"use strict";
|
@@ -1178,53 +1178,6 @@ Is ${source_default.bold.blue(
|
|
1178
1178
|
tableKey = (it) => {
|
1179
1179
|
return it.schema === "public" || !it.schema ? it.name : `${it.schema}.${it.name}`;
|
1180
1180
|
};
|
1181
|
-
ResolveSelectNamed = class extends import_hanji.Prompt {
|
1182
|
-
constructor(base, data, entityType) {
|
1183
|
-
super();
|
1184
|
-
this.base = base;
|
1185
|
-
this.entityType = entityType;
|
1186
|
-
this.on("attach", (terminal) => terminal.toggleCursor("hide"));
|
1187
|
-
this.state = new import_hanji.SelectState(data);
|
1188
|
-
this.state.bind(this);
|
1189
|
-
this.base = base;
|
1190
|
-
}
|
1191
|
-
render(status) {
|
1192
|
-
if (status === "submitted" || status === "aborted") {
|
1193
|
-
return "";
|
1194
|
-
}
|
1195
|
-
const key = this.base.name;
|
1196
|
-
let text = `
|
1197
|
-
Is ${source_default.bold.blue(key)} ${this.entityType} created or renamed from another ${this.entityType}?
|
1198
|
-
`;
|
1199
|
-
const isSelectedRenamed = isRenamePromptItem(
|
1200
|
-
this.state.items[this.state.selectedIdx]
|
1201
|
-
);
|
1202
|
-
const selectedPrefix = isSelectedRenamed ? source_default.yellow("\u276F ") : source_default.green("\u276F ");
|
1203
|
-
const labelLength = this.state.items.filter((it) => isRenamePromptItem(it)).map((_2) => {
|
1204
|
-
const it = _2;
|
1205
|
-
const keyFrom = it.from.name;
|
1206
|
-
return key.length + 3 + keyFrom.length;
|
1207
|
-
}).reduce((a, b) => {
|
1208
|
-
if (a > b) {
|
1209
|
-
return a;
|
1210
|
-
}
|
1211
|
-
return b;
|
1212
|
-
}, 0);
|
1213
|
-
const entityType = this.entityType;
|
1214
|
-
this.state.items.forEach((it, idx) => {
|
1215
|
-
const isSelected = idx === this.state.selectedIdx;
|
1216
|
-
const isRenamed = isRenamePromptItem(it);
|
1217
|
-
const title = isRenamed ? `${it.from.name} \u203A ${it.to.name}`.padEnd(labelLength, " ") : it.name.padEnd(labelLength, " ");
|
1218
|
-
const label = isRenamed ? `${source_default.yellow("~")} ${title} ${source_default.gray(`rename ${entityType}`)}` : `${source_default.green("+")} ${title} ${source_default.gray(`create ${entityType}`)}`;
|
1219
|
-
text += isSelected ? `${selectedPrefix}${label}` : ` ${label}`;
|
1220
|
-
text += idx != this.state.items.length - 1 ? "\n" : "";
|
1221
|
-
});
|
1222
|
-
return text;
|
1223
|
-
}
|
1224
|
-
result() {
|
1225
|
-
return this.state.items[this.state.selectedIdx];
|
1226
|
-
}
|
1227
|
-
};
|
1228
1181
|
ResolveSelect = class extends import_hanji.Prompt {
|
1229
1182
|
constructor(base, data, entityType) {
|
1230
1183
|
super();
|
@@ -1783,8 +1736,8 @@ var init_lib = __esm({
|
|
1783
1736
|
return void 0;
|
1784
1737
|
};
|
1785
1738
|
util2.isInteger = typeof Number.isInteger === "function" ? (val2) => Number.isInteger(val2) : (val2) => typeof val2 === "number" && isFinite(val2) && Math.floor(val2) === val2;
|
1786
|
-
function joinValues(
|
1787
|
-
return
|
1739
|
+
function joinValues(array, separator = " | ") {
|
1740
|
+
return array.map((val2) => typeof val2 === "string" ? `'${val2}'` : val2).join(separator);
|
1788
1741
|
}
|
1789
1742
|
util2.joinValues = joinValues;
|
1790
1743
|
util2.jsonStringifyReplacer = (_2, value) => {
|
@@ -5753,7 +5706,7 @@ var init_vector = __esm({
|
|
5753
5706
|
});
|
5754
5707
|
|
5755
5708
|
// src/serializer/pgSchema.ts
|
5756
|
-
var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn, index2, indexV4, indexV5, indexV6, fk2, sequenceSchema,
|
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;
|
5757
5710
|
var init_pgSchema = __esm({
|
5758
5711
|
"src/serializer/pgSchema.ts"() {
|
5759
5712
|
"use strict";
|
@@ -5885,12 +5838,6 @@ var init_pgSchema = __esm({
|
|
5885
5838
|
cycle: booleanType().optional(),
|
5886
5839
|
schema: stringType()
|
5887
5840
|
}).strict();
|
5888
|
-
roleSchema = objectType({
|
5889
|
-
name: stringType(),
|
5890
|
-
createDb: booleanType().optional(),
|
5891
|
-
createRole: booleanType().optional(),
|
5892
|
-
inherit: booleanType().optional()
|
5893
|
-
}).strict();
|
5894
5841
|
sequenceSquashed = objectType({
|
5895
5842
|
name: stringType(),
|
5896
5843
|
schema: stringType(),
|
@@ -5954,14 +5901,6 @@ var init_pgSchema = __esm({
|
|
5954
5901
|
columns: stringType().array(),
|
5955
5902
|
nullsNotDistinct: booleanType()
|
5956
5903
|
}).strict();
|
5957
|
-
policy = objectType({
|
5958
|
-
name: stringType(),
|
5959
|
-
as: enumType(["PERMISSIVE", "RESTRICTIVE"]).optional(),
|
5960
|
-
for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
|
5961
|
-
to: stringType().array().optional(),
|
5962
|
-
using: stringType().optional(),
|
5963
|
-
withCheck: stringType().optional()
|
5964
|
-
}).strict();
|
5965
5904
|
tableV42 = objectType({
|
5966
5905
|
name: stringType(),
|
5967
5906
|
schema: stringType(),
|
@@ -6003,8 +5942,7 @@ var init_pgSchema = __esm({
|
|
6003
5942
|
indexes: recordType(stringType(), index2),
|
6004
5943
|
foreignKeys: recordType(stringType(), fk2),
|
6005
5944
|
compositePrimaryKeys: recordType(stringType(), compositePK2),
|
6006
|
-
uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
|
6007
|
-
policies: recordType(stringType(), policy).default({})
|
5945
|
+
uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
|
6008
5946
|
}).strict();
|
6009
5947
|
schemaHash2 = objectType({
|
6010
5948
|
id: stringType(),
|
@@ -6098,7 +6036,6 @@ var init_pgSchema = __esm({
|
|
6098
6036
|
enums: recordType(stringType(), enumSchema),
|
6099
6037
|
schemas: recordType(stringType(), stringType()),
|
6100
6038
|
sequences: recordType(stringType(), sequenceSchema).default({}),
|
6101
|
-
roles: recordType(stringType(), roleSchema).default({}),
|
6102
6039
|
_meta: objectType({
|
6103
6040
|
schemas: recordType(stringType(), stringType()),
|
6104
6041
|
tables: recordType(stringType(), stringType()),
|
@@ -6113,8 +6050,7 @@ var init_pgSchema = __esm({
|
|
6113
6050
|
indexes: recordType(stringType(), stringType()),
|
6114
6051
|
foreignKeys: recordType(stringType(), stringType()),
|
6115
6052
|
compositePrimaryKeys: recordType(stringType(), stringType()),
|
6116
|
-
uniqueConstraints: recordType(stringType(), stringType())
|
6117
|
-
policies: recordType(stringType(), stringType())
|
6053
|
+
uniqueConstraints: recordType(stringType(), stringType())
|
6118
6054
|
}).strict();
|
6119
6055
|
tableSquashedV42 = objectType({
|
6120
6056
|
name: stringType(),
|
@@ -6143,8 +6079,7 @@ var init_pgSchema = __esm({
|
|
6143
6079
|
tables: recordType(stringType(), tableSquashed2),
|
6144
6080
|
enums: recordType(stringType(), enumSchema),
|
6145
6081
|
schemas: recordType(stringType(), stringType()),
|
6146
|
-
sequences: recordType(stringType(), sequenceSquashed)
|
6147
|
-
roles: recordType(stringType(), roleSchema).default({})
|
6082
|
+
sequences: recordType(stringType(), sequenceSquashed)
|
6148
6083
|
}).strict();
|
6149
6084
|
pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
|
6150
6085
|
pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
|
@@ -6227,25 +6162,6 @@ var init_pgSchema = __esm({
|
|
6227
6162
|
squashFK: (fk4) => {
|
6228
6163
|
return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${fk4.onUpdate ?? ""};${fk4.onDelete ?? ""};${fk4.schemaTo || "public"}`;
|
6229
6164
|
},
|
6230
|
-
squashPolicy: (policy2) => {
|
6231
|
-
var _a;
|
6232
|
-
return `${policy2.name}--${policy2.as}--${policy2.for}--${(_a = policy2.to) == null ? void 0 : _a.join(",")}--${policy2.using}--${policy2.withCheck}`;
|
6233
|
-
},
|
6234
|
-
unsquashPolicy: (policy2) => {
|
6235
|
-
const splitted = policy2.split("--");
|
6236
|
-
return {
|
6237
|
-
name: splitted[0],
|
6238
|
-
as: splitted[1],
|
6239
|
-
for: splitted[2],
|
6240
|
-
to: splitted[3].split(","),
|
6241
|
-
using: splitted[4] !== "undefined" ? splitted[4] : void 0,
|
6242
|
-
withCheck: splitted[5] !== "undefined" ? splitted[5] : void 0
|
6243
|
-
};
|
6244
|
-
},
|
6245
|
-
squashPolicyPush: (policy2) => {
|
6246
|
-
var _a;
|
6247
|
-
return `${policy2.name}--${policy2.as}--${policy2.for}--${(_a = policy2.to) == null ? void 0 : _a.join(",")}`;
|
6248
|
-
},
|
6249
6165
|
squashPK: (pk) => {
|
6250
6166
|
return `${pk.columns.join(",")};${pk.name}`;
|
6251
6167
|
},
|
@@ -6348,9 +6264,6 @@ var init_pgSchema = __esm({
|
|
6348
6264
|
return PgSquasher.squashUnique(unq);
|
6349
6265
|
}
|
6350
6266
|
);
|
6351
|
-
const squashedPolicies = mapValues(it[1].policies, (policy2) => {
|
6352
|
-
return action === "push" ? PgSquasher.squashPolicyPush(policy2) : PgSquasher.squashPolicy(policy2);
|
6353
|
-
});
|
6354
6267
|
return [
|
6355
6268
|
it[0],
|
6356
6269
|
{
|
@@ -6360,8 +6273,7 @@ var init_pgSchema = __esm({
|
|
6360
6273
|
indexes: squashedIndexes,
|
6361
6274
|
foreignKeys: squashedFKs,
|
6362
6275
|
compositePrimaryKeys: squashedPKs,
|
6363
|
-
uniqueConstraints: squashedUniqueConstraints
|
6364
|
-
policies: squashedPolicies
|
6276
|
+
uniqueConstraints: squashedUniqueConstraints
|
6365
6277
|
}
|
6366
6278
|
];
|
6367
6279
|
})
|
@@ -6384,8 +6296,7 @@ var init_pgSchema = __esm({
|
|
6384
6296
|
tables: mappedTables,
|
6385
6297
|
enums: json.enums,
|
6386
6298
|
schemas: json.schemas,
|
6387
|
-
sequences: mappedSequences
|
6388
|
-
roles: json.roles
|
6299
|
+
sequences: mappedSequences
|
6389
6300
|
};
|
6390
6301
|
};
|
6391
6302
|
dryPg = pgSchema.parse({
|
@@ -6680,11 +6591,17 @@ function findAddedAndRemoved(columnNames1, columnNames2) {
|
|
6680
6591
|
const removedColumns = columnNames1.filter((it) => !set2.has(it));
|
6681
6592
|
return { addedColumns, removedColumns };
|
6682
6593
|
}
|
6683
|
-
|
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;
|
6684
6600
|
var init_utils = __esm({
|
6685
6601
|
"src/utils.ts"() {
|
6686
6602
|
"use strict";
|
6687
6603
|
init_source();
|
6604
|
+
import_casing = require("drizzle-orm/casing");
|
6688
6605
|
import_fs = require("fs");
|
6689
6606
|
import_path = require("path");
|
6690
6607
|
import_url = require("url");
|
@@ -6714,27 +6631,27 @@ var init_utils = __esm({
|
|
6714
6631
|
process.exit(1);
|
6715
6632
|
}
|
6716
6633
|
};
|
6717
|
-
dryJournal = (
|
6634
|
+
dryJournal = (dialect4) => {
|
6718
6635
|
return {
|
6719
6636
|
version: snapshotVersion,
|
6720
|
-
dialect:
|
6637
|
+
dialect: dialect4,
|
6721
6638
|
entries: []
|
6722
6639
|
};
|
6723
6640
|
};
|
6724
|
-
prepareOutFolder = (out,
|
6641
|
+
prepareOutFolder = (out, dialect4) => {
|
6725
6642
|
const meta = (0, import_path.join)(out, "meta");
|
6726
6643
|
const journalPath = (0, import_path.join)(meta, "_journal.json");
|
6727
6644
|
if (!(0, import_fs.existsSync)((0, import_path.join)(out, "meta"))) {
|
6728
6645
|
(0, import_fs.mkdirSync)(meta, { recursive: true });
|
6729
|
-
(0, import_fs.writeFileSync)(journalPath, JSON.stringify(dryJournal(
|
6646
|
+
(0, import_fs.writeFileSync)(journalPath, JSON.stringify(dryJournal(dialect4)));
|
6730
6647
|
}
|
6731
6648
|
const journal = JSON.parse((0, import_fs.readFileSync)(journalPath).toString());
|
6732
6649
|
const snapshots = (0, import_fs.readdirSync)(meta).filter((it) => !it.startsWith("_")).map((it) => (0, import_path.join)(meta, it));
|
6733
6650
|
snapshots.sort();
|
6734
6651
|
return { meta, snapshots, journal };
|
6735
6652
|
};
|
6736
|
-
validatorForDialect = (
|
6737
|
-
switch (
|
6653
|
+
validatorForDialect = (dialect4) => {
|
6654
|
+
switch (dialect4) {
|
6738
6655
|
case "postgresql":
|
6739
6656
|
return { validator: backwardCompatiblePgSchema, version: 7 };
|
6740
6657
|
case "sqlite":
|
@@ -6745,8 +6662,8 @@ var init_utils = __esm({
|
|
6745
6662
|
return { validator: backwardCompatibleMysqlSchema, version: 5 };
|
6746
6663
|
}
|
6747
6664
|
};
|
6748
|
-
validateWithReport = (snapshots,
|
6749
|
-
const { validator: validator2, version: version3 } = validatorForDialect(
|
6665
|
+
validateWithReport = (snapshots, dialect4) => {
|
6666
|
+
const { validator: validator2, version: version3 } = validatorForDialect(dialect4);
|
6750
6667
|
const result = snapshots.reduce(
|
6751
6668
|
(accum, it) => {
|
6752
6669
|
const raw2 = JSON.parse((0, import_fs.readFileSync)(`./${it}`).toString());
|
@@ -6787,9 +6704,9 @@ var init_utils = __esm({
|
|
6787
6704
|
);
|
6788
6705
|
return result;
|
6789
6706
|
};
|
6790
|
-
prepareMigrationFolder = (outFolder = "drizzle",
|
6791
|
-
const { snapshots, journal } = prepareOutFolder(outFolder,
|
6792
|
-
const report = validateWithReport(snapshots,
|
6707
|
+
prepareMigrationFolder = (outFolder = "drizzle", dialect4) => {
|
6708
|
+
const { snapshots, journal } = prepareOutFolder(outFolder, dialect4);
|
6709
|
+
const report = validateWithReport(snapshots, dialect4);
|
6793
6710
|
if (report.nonLatest.length > 0) {
|
6794
6711
|
console.log(
|
6795
6712
|
report.nonLatest.map((it) => {
|
@@ -10679,10 +10596,10 @@ var require_inflight = __commonJS({
|
|
10679
10596
|
}
|
10680
10597
|
function slice(args) {
|
10681
10598
|
var length = args.length;
|
10682
|
-
var
|
10599
|
+
var array = [];
|
10683
10600
|
for (var i2 = 0; i2 < length; i2++)
|
10684
|
-
|
10685
|
-
return
|
10601
|
+
array[i2] = args[i2];
|
10602
|
+
return array;
|
10686
10603
|
}
|
10687
10604
|
}
|
10688
10605
|
});
|
@@ -11339,7 +11256,7 @@ var init_outputs = __esm({
|
|
11339
11256
|
});
|
11340
11257
|
|
11341
11258
|
// src/cli/validations/common.ts
|
11342
|
-
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;
|
11343
11260
|
var init_common = __esm({
|
11344
11261
|
"src/cli/validations/common.ts"() {
|
11345
11262
|
"use strict";
|
@@ -11383,6 +11300,8 @@ var init_common = __esm({
|
|
11383
11300
|
{
|
11384
11301
|
const _2 = "";
|
11385
11302
|
}
|
11303
|
+
casingTypes = ["snake_case", "camelCase"];
|
11304
|
+
casingType = enumType(casingTypes);
|
11386
11305
|
sqliteDriver = unionType(sqliteDriversLiterals);
|
11387
11306
|
postgresDriver = unionType(postgresqlDriversLiterals);
|
11388
11307
|
driver = unionType([sqliteDriver, postgresDriver]);
|
@@ -11401,7 +11320,8 @@ var init_common = __esm({
|
|
11401
11320
|
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
11402
11321
|
schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
|
11403
11322
|
migrations: configMigrations,
|
11404
|
-
dbCredentials: anyType().optional()
|
11323
|
+
dbCredentials: anyType().optional(),
|
11324
|
+
casing: casingType.optional()
|
11405
11325
|
}).passthrough();
|
11406
11326
|
casing = unionType([literalType("camel"), literalType("preserve")]).default(
|
11407
11327
|
"camel"
|
@@ -11483,6 +11403,7 @@ var init_cli = __esm({
|
|
11483
11403
|
}).strict();
|
11484
11404
|
pushParams = objectType({
|
11485
11405
|
dialect: dialect3,
|
11406
|
+
casing: casingType.optional(),
|
11486
11407
|
schema: unionType([stringType(), stringType().array()]),
|
11487
11408
|
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
11488
11409
|
schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
|
@@ -11501,13 +11422,6 @@ var init_cli = __esm({
|
|
11501
11422
|
breakpoints: booleanType().optional().default(true),
|
11502
11423
|
migrations: objectType({
|
11503
11424
|
prefix: prefix.optional().default("index")
|
11504
|
-
}).optional(),
|
11505
|
-
entities: objectType({
|
11506
|
-
roles: booleanType().or(objectType({
|
11507
|
-
provider: stringType().optional(),
|
11508
|
-
include: stringType().array().optional(),
|
11509
|
-
exclude: stringType().array().optional()
|
11510
|
-
})).optional().default(false)
|
11511
11425
|
}).optional()
|
11512
11426
|
}).passthrough();
|
11513
11427
|
configCheck = objectType({
|
@@ -17506,11 +17420,11 @@ var init_utils4 = __esm({
|
|
17506
17420
|
prepareGenerateConfig = async (options, from) => {
|
17507
17421
|
var _a;
|
17508
17422
|
const config = from === "config" ? await drizzleConfigFromFile(options.config) : options;
|
17509
|
-
const { schema: schema5, out, breakpoints, dialect:
|
17510
|
-
if (!schema5 || !
|
17423
|
+
const { schema: schema5, out, breakpoints, dialect: dialect4, driver: driver2, casing: casing2 } = config;
|
17424
|
+
if (!schema5 || !dialect4) {
|
17511
17425
|
console.log(error("Please provide required params:"));
|
17512
17426
|
console.log(wrapParam("schema", schema5));
|
17513
|
-
console.log(wrapParam("dialect",
|
17427
|
+
console.log(wrapParam("dialect", dialect4));
|
17514
17428
|
console.log(wrapParam("out", out, true));
|
17515
17429
|
process.exit(1);
|
17516
17430
|
}
|
@@ -17521,14 +17435,15 @@ var init_utils4 = __esm({
|
|
17521
17435
|
}
|
17522
17436
|
const prefix2 = ("migrations" in config ? (_a = config.migrations) == null ? void 0 : _a.prefix : options.prefix) || "index";
|
17523
17437
|
return {
|
17524
|
-
dialect:
|
17438
|
+
dialect: dialect4,
|
17525
17439
|
name: options.name,
|
17526
17440
|
custom: options.custom || false,
|
17527
17441
|
prefix: prefix2,
|
17528
17442
|
breakpoints: breakpoints || true,
|
17529
17443
|
schema: schema5,
|
17530
17444
|
out: out || "drizzle",
|
17531
|
-
bundle: driver2 === "expo"
|
17445
|
+
bundle: driver2 === "expo",
|
17446
|
+
casing: casing2
|
17532
17447
|
};
|
17533
17448
|
};
|
17534
17449
|
flattenDatabaseCredentials = (config) => {
|
@@ -17595,6 +17510,7 @@ var init_utils4 = __esm({
|
|
17595
17510
|
verbose: config.verbose ?? false,
|
17596
17511
|
force: options.force ?? false,
|
17597
17512
|
credentials: parsed2.data,
|
17513
|
+
casing: config.casing,
|
17598
17514
|
tablesFilter,
|
17599
17515
|
schemasFilter
|
17600
17516
|
};
|
@@ -17612,6 +17528,7 @@ var init_utils4 = __esm({
|
|
17612
17528
|
verbose: config.verbose ?? false,
|
17613
17529
|
force: options.force ?? false,
|
17614
17530
|
credentials: parsed2.data,
|
17531
|
+
casing: config.casing,
|
17615
17532
|
tablesFilter,
|
17616
17533
|
schemasFilter
|
17617
17534
|
};
|
@@ -17629,6 +17546,7 @@ var init_utils4 = __esm({
|
|
17629
17546
|
verbose: config.verbose ?? false,
|
17630
17547
|
force: options.force ?? false,
|
17631
17548
|
credentials: parsed2.data,
|
17549
|
+
casing: config.casing,
|
17632
17550
|
tablesFilter,
|
17633
17551
|
schemasFilter
|
17634
17552
|
};
|
@@ -17646,6 +17564,7 @@ var init_utils4 = __esm({
|
|
17646
17564
|
verbose: config.verbose ?? false,
|
17647
17565
|
force: options.force ?? false,
|
17648
17566
|
credentials: parsed2.data,
|
17567
|
+
casing: config.casing,
|
17649
17568
|
tablesFilter,
|
17650
17569
|
schemasFilter
|
17651
17570
|
};
|
@@ -17664,11 +17583,11 @@ var init_utils4 = __esm({
|
|
17664
17583
|
process.exit(1);
|
17665
17584
|
}
|
17666
17585
|
const config = parsed.data;
|
17667
|
-
const
|
17586
|
+
const dialect4 = config.dialect;
|
17668
17587
|
const tablesFilterConfig = config.tablesFilter;
|
17669
17588
|
const tablesFilter = tablesFilterConfig ? typeof tablesFilterConfig === "string" ? [tablesFilterConfig] : tablesFilterConfig : [];
|
17670
17589
|
if (config.extensionsFilters) {
|
17671
|
-
if (config.extensionsFilters.includes("postgis") &&
|
17590
|
+
if (config.extensionsFilters.includes("postgis") && dialect4 === "postgresql") {
|
17672
17591
|
tablesFilter.push(
|
17673
17592
|
...["!geography_columns", "!geometry_columns", "!spatial_ref_sys"]
|
17674
17593
|
);
|
@@ -17676,7 +17595,7 @@ var init_utils4 = __esm({
|
|
17676
17595
|
}
|
17677
17596
|
const schemasFilterConfig = config.schemaFilter;
|
17678
17597
|
const schemasFilter = schemasFilterConfig ? typeof schemasFilterConfig === "string" ? [schemasFilterConfig] : schemasFilterConfig : [];
|
17679
|
-
if (
|
17598
|
+
if (dialect4 === "postgresql") {
|
17680
17599
|
const parsed2 = postgresCredentials.safeParse(config);
|
17681
17600
|
if (!parsed2.success) {
|
17682
17601
|
printConfigConnectionIssues3(config);
|
@@ -17690,11 +17609,10 @@ var init_utils4 = __esm({
|
|
17690
17609
|
credentials: parsed2.data,
|
17691
17610
|
tablesFilter,
|
17692
17611
|
schemasFilter,
|
17693
|
-
prefix: ((_a = config.migrations) == null ? void 0 : _a.prefix) || "index"
|
17694
|
-
entities: config.entities
|
17612
|
+
prefix: ((_a = config.migrations) == null ? void 0 : _a.prefix) || "index"
|
17695
17613
|
};
|
17696
17614
|
}
|
17697
|
-
if (
|
17615
|
+
if (dialect4 === "mysql") {
|
17698
17616
|
const parsed2 = mysqlCredentials.safeParse(config);
|
17699
17617
|
if (!parsed2.success) {
|
17700
17618
|
printConfigConnectionIssues2(config);
|
@@ -17708,11 +17626,10 @@ var init_utils4 = __esm({
|
|
17708
17626
|
credentials: parsed2.data,
|
17709
17627
|
tablesFilter,
|
17710
17628
|
schemasFilter,
|
17711
|
-
prefix: ((_b = config.migrations) == null ? void 0 : _b.prefix) || "index"
|
17712
|
-
entities: config.entities
|
17629
|
+
prefix: ((_b = config.migrations) == null ? void 0 : _b.prefix) || "index"
|
17713
17630
|
};
|
17714
17631
|
}
|
17715
|
-
if (
|
17632
|
+
if (dialect4 === "sqlite") {
|
17716
17633
|
const parsed2 = sqliteCredentials.safeParse(config);
|
17717
17634
|
if (!parsed2.success) {
|
17718
17635
|
printConfigConnectionIssues4(config, "pull");
|
@@ -17726,18 +17643,17 @@ var init_utils4 = __esm({
|
|
17726
17643
|
credentials: parsed2.data,
|
17727
17644
|
tablesFilter,
|
17728
17645
|
schemasFilter,
|
17729
|
-
prefix: ((_c = config.migrations) == null ? void 0 : _c.prefix) || "index"
|
17730
|
-
entities: config.entities
|
17646
|
+
prefix: ((_c = config.migrations) == null ? void 0 : _c.prefix) || "index"
|
17731
17647
|
};
|
17732
17648
|
}
|
17733
|
-
if (
|
17649
|
+
if (dialect4 === "turso") {
|
17734
17650
|
const parsed2 = libSQLCredentials.safeParse(config);
|
17735
17651
|
if (!parsed2.success) {
|
17736
17652
|
printConfigConnectionIssues(config, "pull");
|
17737
17653
|
process.exit(1);
|
17738
17654
|
}
|
17739
17655
|
return {
|
17740
|
-
dialect:
|
17656
|
+
dialect: dialect4,
|
17741
17657
|
out: config.out,
|
17742
17658
|
breakpoints: config.breakpoints,
|
17743
17659
|
casing: config.casing,
|
@@ -17747,7 +17663,7 @@ var init_utils4 = __esm({
|
|
17747
17663
|
prefix: ((_d = config.migrations) == null ? void 0 : _d.prefix) || "index"
|
17748
17664
|
};
|
17749
17665
|
}
|
17750
|
-
assertUnreachable(
|
17666
|
+
assertUnreachable(dialect4);
|
17751
17667
|
};
|
17752
17668
|
prepareStudioConfig = async (options) => {
|
17753
17669
|
const params = studioCliParams.parse(options);
|
@@ -17764,9 +17680,9 @@ var init_utils4 = __esm({
|
|
17764
17680
|
process.exit(1);
|
17765
17681
|
}
|
17766
17682
|
const { host, port } = params;
|
17767
|
-
const { dialect:
|
17683
|
+
const { dialect: dialect4, schema: schema5 } = result.data;
|
17768
17684
|
const flattened = flattenDatabaseCredentials(config);
|
17769
|
-
if (
|
17685
|
+
if (dialect4 === "postgresql") {
|
17770
17686
|
const parsed = postgresCredentials.safeParse(flattened);
|
17771
17687
|
if (!parsed.success) {
|
17772
17688
|
printConfigConnectionIssues3(flattened);
|
@@ -17774,14 +17690,14 @@ var init_utils4 = __esm({
|
|
17774
17690
|
}
|
17775
17691
|
const credentials2 = parsed.data;
|
17776
17692
|
return {
|
17777
|
-
dialect:
|
17693
|
+
dialect: dialect4,
|
17778
17694
|
schema: schema5,
|
17779
17695
|
host,
|
17780
17696
|
port,
|
17781
17697
|
credentials: credentials2
|
17782
17698
|
};
|
17783
17699
|
}
|
17784
|
-
if (
|
17700
|
+
if (dialect4 === "mysql") {
|
17785
17701
|
const parsed = mysqlCredentials.safeParse(flattened);
|
17786
17702
|
if (!parsed.success) {
|
17787
17703
|
printConfigConnectionIssues2(flattened);
|
@@ -17789,14 +17705,14 @@ var init_utils4 = __esm({
|
|
17789
17705
|
}
|
17790
17706
|
const credentials2 = parsed.data;
|
17791
17707
|
return {
|
17792
|
-
dialect:
|
17708
|
+
dialect: dialect4,
|
17793
17709
|
schema: schema5,
|
17794
17710
|
host,
|
17795
17711
|
port,
|
17796
17712
|
credentials: credentials2
|
17797
17713
|
};
|
17798
17714
|
}
|
17799
|
-
if (
|
17715
|
+
if (dialect4 === "sqlite") {
|
17800
17716
|
const parsed = sqliteCredentials.safeParse(flattened);
|
17801
17717
|
if (!parsed.success) {
|
17802
17718
|
printConfigConnectionIssues4(flattened, "studio");
|
@@ -17804,14 +17720,14 @@ var init_utils4 = __esm({
|
|
17804
17720
|
}
|
17805
17721
|
const credentials2 = parsed.data;
|
17806
17722
|
return {
|
17807
|
-
dialect:
|
17723
|
+
dialect: dialect4,
|
17808
17724
|
schema: schema5,
|
17809
17725
|
host,
|
17810
17726
|
port,
|
17811
17727
|
credentials: credentials2
|
17812
17728
|
};
|
17813
17729
|
}
|
17814
|
-
if (
|
17730
|
+
if (dialect4 === "turso") {
|
17815
17731
|
const parsed = libSQLCredentials.safeParse(flattened);
|
17816
17732
|
if (!parsed.success) {
|
17817
17733
|
printConfigConnectionIssues(flattened, "studio");
|
@@ -17819,14 +17735,14 @@ var init_utils4 = __esm({
|
|
17819
17735
|
}
|
17820
17736
|
const credentials2 = parsed.data;
|
17821
17737
|
return {
|
17822
|
-
dialect:
|
17738
|
+
dialect: dialect4,
|
17823
17739
|
schema: schema5,
|
17824
17740
|
host,
|
17825
17741
|
port,
|
17826
17742
|
credentials: credentials2
|
17827
17743
|
};
|
17828
17744
|
}
|
17829
|
-
assertUnreachable(
|
17745
|
+
assertUnreachable(dialect4);
|
17830
17746
|
};
|
17831
17747
|
migrateConfig = objectType({
|
17832
17748
|
dialect: dialect3,
|
@@ -17841,10 +17757,10 @@ var init_utils4 = __esm({
|
|
17841
17757
|
console.log(wrapParam("dialect", config.dialect));
|
17842
17758
|
process.exit(1);
|
17843
17759
|
}
|
17844
|
-
const { dialect:
|
17760
|
+
const { dialect: dialect4, out } = parsed.data;
|
17845
17761
|
const { schema: schema5, table: table4 } = parsed.data.migrations || {};
|
17846
17762
|
const flattened = flattenDatabaseCredentials(config);
|
17847
|
-
if (
|
17763
|
+
if (dialect4 === "postgresql") {
|
17848
17764
|
const parsed2 = postgresCredentials.safeParse(flattened);
|
17849
17765
|
if (!parsed2.success) {
|
17850
17766
|
printConfigConnectionIssues3(flattened);
|
@@ -17852,14 +17768,14 @@ var init_utils4 = __esm({
|
|
17852
17768
|
}
|
17853
17769
|
const credentials2 = parsed2.data;
|
17854
17770
|
return {
|
17855
|
-
dialect:
|
17771
|
+
dialect: dialect4,
|
17856
17772
|
out,
|
17857
17773
|
credentials: credentials2,
|
17858
17774
|
schema: schema5,
|
17859
17775
|
table: table4
|
17860
17776
|
};
|
17861
17777
|
}
|
17862
|
-
if (
|
17778
|
+
if (dialect4 === "mysql") {
|
17863
17779
|
const parsed2 = mysqlCredentials.safeParse(flattened);
|
17864
17780
|
if (!parsed2.success) {
|
17865
17781
|
printConfigConnectionIssues2(flattened);
|
@@ -17867,14 +17783,14 @@ var init_utils4 = __esm({
|
|
17867
17783
|
}
|
17868
17784
|
const credentials2 = parsed2.data;
|
17869
17785
|
return {
|
17870
|
-
dialect:
|
17786
|
+
dialect: dialect4,
|
17871
17787
|
out,
|
17872
17788
|
credentials: credentials2,
|
17873
17789
|
schema: schema5,
|
17874
17790
|
table: table4
|
17875
17791
|
};
|
17876
17792
|
}
|
17877
|
-
if (
|
17793
|
+
if (dialect4 === "sqlite") {
|
17878
17794
|
const parsed2 = sqliteCredentials.safeParse(flattened);
|
17879
17795
|
if (!parsed2.success) {
|
17880
17796
|
printConfigConnectionIssues4(flattened, "migrate");
|
@@ -17882,14 +17798,14 @@ var init_utils4 = __esm({
|
|
17882
17798
|
}
|
17883
17799
|
const credentials2 = parsed2.data;
|
17884
17800
|
return {
|
17885
|
-
dialect:
|
17801
|
+
dialect: dialect4,
|
17886
17802
|
out,
|
17887
17803
|
credentials: credentials2,
|
17888
17804
|
schema: schema5,
|
17889
17805
|
table: table4
|
17890
17806
|
};
|
17891
17807
|
}
|
17892
|
-
if (
|
17808
|
+
if (dialect4 === "turso") {
|
17893
17809
|
const parsed2 = libSQLCredentials.safeParse(flattened);
|
17894
17810
|
if (!parsed2.success) {
|
17895
17811
|
printConfigConnectionIssues(flattened, "migrate");
|
@@ -17897,14 +17813,14 @@ var init_utils4 = __esm({
|
|
17897
17813
|
}
|
17898
17814
|
const credentials2 = parsed2.data;
|
17899
17815
|
return {
|
17900
|
-
dialect:
|
17816
|
+
dialect: dialect4,
|
17901
17817
|
out,
|
17902
17818
|
credentials: credentials2,
|
17903
17819
|
schema: schema5,
|
17904
17820
|
table: table4
|
17905
17821
|
};
|
17906
17822
|
}
|
17907
|
-
assertUnreachable(
|
17823
|
+
assertUnreachable(dialect4);
|
17908
17824
|
};
|
17909
17825
|
drizzleConfigFromFile = async (configPath) => {
|
17910
17826
|
const prefix2 = process.env.TEST_CONFIG_PATH_PREFIX || "";
|
@@ -17933,6 +17849,7 @@ var init_utils4 = __esm({
|
|
17933
17849
|
unregister();
|
17934
17850
|
const res = configCommonSchema.safeParse(content);
|
17935
17851
|
if (!res.success) {
|
17852
|
+
console.log(res.error);
|
17936
17853
|
if (!("dialect" in content)) {
|
17937
17854
|
console.log(error("Please specify 'dialect' param in config file"));
|
17938
17855
|
}
|
@@ -18005,7 +17922,7 @@ function clearDefaults(defaultValue, collate) {
|
|
18005
17922
|
return `(${resultDefault})`;
|
18006
17923
|
}
|
18007
17924
|
}
|
18008
|
-
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;
|
18009
17926
|
var init_mysqlSerializer = __esm({
|
18010
17927
|
"src/serializer/mysqlSerializer.ts"() {
|
18011
17928
|
"use strict";
|
@@ -18015,12 +17932,13 @@ var init_mysqlSerializer = __esm({
|
|
18015
17932
|
import_mysql_core2 = require("drizzle-orm/mysql-core");
|
18016
17933
|
import_mysql_core3 = require("drizzle-orm/mysql-core");
|
18017
17934
|
init_outputs();
|
17935
|
+
init_utils();
|
18018
17936
|
init_serializer();
|
18019
|
-
dialect4 = new import_mysql_core2.MySqlDialect();
|
18020
17937
|
indexName = (tableName, columns) => {
|
18021
17938
|
return `${tableName}_${columns.join("_")}_index`;
|
18022
17939
|
};
|
18023
|
-
generateMySqlSnapshot = (tables) => {
|
17940
|
+
generateMySqlSnapshot = (tables, casing2) => {
|
17941
|
+
const dialect4 = new import_mysql_core2.MySqlDialect({ casing: casing2 });
|
18024
17942
|
const result = {};
|
18025
17943
|
const internal = { tables: {}, indexes: {} };
|
18026
17944
|
for (const table4 of tables) {
|
@@ -18039,12 +17957,13 @@ var init_mysqlSerializer = __esm({
|
|
18039
17957
|
const primaryKeysObject = {};
|
18040
17958
|
const uniqueConstraintObject = {};
|
18041
17959
|
columns.forEach((column7) => {
|
17960
|
+
const name = getColumnCasing(column7, casing2);
|
18042
17961
|
const notNull = column7.notNull;
|
18043
17962
|
const sqlTypeLowered = column7.getSQLType().toLowerCase();
|
18044
17963
|
const autoIncrement = typeof column7.autoIncrement === "undefined" ? false : column7.autoIncrement;
|
18045
17964
|
const generated = column7.generated;
|
18046
17965
|
const columnToSet = {
|
18047
|
-
name
|
17966
|
+
name,
|
18048
17967
|
type: column7.getSQLType(),
|
18049
17968
|
primaryKey: false,
|
18050
17969
|
// If field is autoincrement it's notNull by default
|
@@ -18058,9 +17977,9 @@ var init_mysqlSerializer = __esm({
|
|
18058
17977
|
} : void 0
|
18059
17978
|
};
|
18060
17979
|
if (column7.primary) {
|
18061
|
-
primaryKeysObject[`${tableName}_${
|
18062
|
-
name: `${tableName}_${
|
18063
|
-
columns: [
|
17980
|
+
primaryKeysObject[`${tableName}_${name}`] = {
|
17981
|
+
name: `${tableName}_${name}`,
|
17982
|
+
columns: [name]
|
18064
17983
|
};
|
18065
17984
|
}
|
18066
17985
|
if (column7.isUnique) {
|
@@ -18074,7 +17993,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18074
17993
|
The unique constraint ${source_default.underline.blue(
|
18075
17994
|
column7.uniqueName
|
18076
17995
|
)} on the ${source_default.underline.blue(
|
18077
|
-
|
17996
|
+
name
|
18078
17997
|
)} column is confilcting with a unique constraint name already defined for ${source_default.underline.blue(
|
18079
17998
|
existingUnique.columns.join(",")
|
18080
17999
|
)} columns
|
@@ -18089,7 +18008,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18089
18008
|
}
|
18090
18009
|
if (column7.default !== void 0) {
|
18091
18010
|
if ((0, import_drizzle_orm2.is)(column7.default, import_drizzle_orm3.SQL)) {
|
18092
|
-
columnToSet.default = sqlToStr(column7.default);
|
18011
|
+
columnToSet.default = sqlToStr(column7.default, casing2);
|
18093
18012
|
} else {
|
18094
18013
|
if (typeof column7.default === "string") {
|
18095
18014
|
columnToSet.default = `'${column7.default}'`;
|
@@ -18111,20 +18030,27 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18111
18030
|
}
|
18112
18031
|
}
|
18113
18032
|
}
|
18114
|
-
columnsObject[
|
18033
|
+
columnsObject[name] = columnToSet;
|
18115
18034
|
});
|
18116
18035
|
primaryKeys.map((pk) => {
|
18117
|
-
const
|
18118
|
-
|
18119
|
-
|
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,
|
18120
18046
|
columns: columnNames
|
18121
18047
|
};
|
18122
18048
|
for (const column7 of pk.columns) {
|
18123
|
-
columnsObject[column7
|
18049
|
+
columnsObject[getColumnCasing(column7, casing2)].notNull = true;
|
18124
18050
|
}
|
18125
18051
|
});
|
18126
18052
|
uniqueConstraints == null ? void 0 : uniqueConstraints.map((unq) => {
|
18127
|
-
const columnNames = unq.columns.map((c) => c
|
18053
|
+
const columnNames = unq.columns.map((c) => getColumnCasing(c, casing2));
|
18128
18054
|
const name = unq.name ?? (0, import_mysql_core2.uniqueKeyName)(table4, columnNames);
|
18129
18055
|
const existingUnique = uniqueConstraintObject[name];
|
18130
18056
|
if (typeof existingUnique !== "undefined") {
|
@@ -18152,15 +18078,25 @@ The unique constraint ${source_default.underline.blue(
|
|
18152
18078
|
};
|
18153
18079
|
});
|
18154
18080
|
const fks = foreignKeys.map((fk4) => {
|
18155
|
-
const name = fk4.getName();
|
18156
18081
|
const tableFrom = tableName;
|
18157
18082
|
const onDelete = fk4.onDelete ?? "no action";
|
18158
18083
|
const onUpdate = fk4.onUpdate ?? "no action";
|
18159
18084
|
const reference = fk4.reference();
|
18160
18085
|
const referenceFT = reference.foreignTable;
|
18161
18086
|
const tableTo = (0, import_drizzle_orm2.getTableName)(referenceFT);
|
18162
|
-
const
|
18163
|
-
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
|
+
}
|
18164
18100
|
return {
|
18165
18101
|
name,
|
18166
18102
|
tableFrom,
|
@@ -18200,7 +18136,7 @@ The unique constraint ${source_default.underline.blue(
|
|
18200
18136
|
}
|
18201
18137
|
return sql;
|
18202
18138
|
} else {
|
18203
|
-
return `${it
|
18139
|
+
return `${getColumnCasing(it, casing2)}`;
|
18204
18140
|
}
|
18205
18141
|
});
|
18206
18142
|
if (value.config.unique) {
|
@@ -18563,7 +18499,6 @@ var init_pgImports = __esm({
|
|
18563
18499
|
const enums = [];
|
18564
18500
|
const schemas = [];
|
18565
18501
|
const sequences = [];
|
18566
|
-
const roles = [];
|
18567
18502
|
const i0values = Object.values(exports2);
|
18568
18503
|
i0values.forEach((t2) => {
|
18569
18504
|
if ((0, import_pg_core.isPgEnum)(t2)) {
|
@@ -18579,18 +18514,14 @@ var init_pgImports = __esm({
|
|
18579
18514
|
if ((0, import_pg_core.isPgSequence)(t2)) {
|
18580
18515
|
sequences.push(t2);
|
18581
18516
|
}
|
18582
|
-
if ((0, import_drizzle_orm4.is)(t2, import_pg_core.PgRole)) {
|
18583
|
-
roles.push(t2);
|
18584
|
-
}
|
18585
18517
|
});
|
18586
|
-
return { tables, enums, schemas, sequences
|
18518
|
+
return { tables, enums, schemas, sequences };
|
18587
18519
|
};
|
18588
18520
|
prepareFromPgImports = async (imports) => {
|
18589
18521
|
let tables = [];
|
18590
18522
|
let enums = [];
|
18591
18523
|
let schemas = [];
|
18592
18524
|
let sequences = [];
|
18593
|
-
let roles = [];
|
18594
18525
|
const { unregister } = await safeRegister();
|
18595
18526
|
for (let i2 = 0; i2 < imports.length; i2++) {
|
18596
18527
|
const it = imports[i2];
|
@@ -18600,10 +18531,9 @@ var init_pgImports = __esm({
|
|
18600
18531
|
enums.push(...prepared.enums);
|
18601
18532
|
schemas.push(...prepared.schemas);
|
18602
18533
|
sequences.push(...prepared.sequences);
|
18603
|
-
roles.push(...prepared.roles);
|
18604
18534
|
}
|
18605
18535
|
unregister();
|
18606
|
-
return { tables: Array.from(new Set(tables)), enums, schemas, sequences
|
18536
|
+
return { tables: Array.from(new Set(tables)), enums, schemas, sequences };
|
18607
18537
|
};
|
18608
18538
|
}
|
18609
18539
|
});
|
@@ -18611,11 +18541,9 @@ var init_pgImports = __esm({
|
|
18611
18541
|
// src/serializer/pgSerializer.ts
|
18612
18542
|
var pgSerializer_exports = {};
|
18613
18543
|
__export(pgSerializer_exports, {
|
18614
|
-
buildArrayString: () => buildArrayString,
|
18615
18544
|
fromDatabase: () => fromDatabase2,
|
18616
18545
|
generatePgSnapshot: () => generatePgSnapshot,
|
18617
|
-
indexName: () => indexName2
|
18618
|
-
minRangeForIdentityBasedOn: () => minRangeForIdentityBasedOn
|
18546
|
+
indexName: () => indexName2
|
18619
18547
|
});
|
18620
18548
|
function stringFromIdentityProperty(field) {
|
18621
18549
|
return typeof field === "string" ? field : typeof field === "undefined" ? void 0 : String(field);
|
@@ -18629,9 +18557,9 @@ function minRangeForIdentityBasedOn(columnType) {
|
|
18629
18557
|
function stringFromDatabaseIdentityProperty(field) {
|
18630
18558
|
return typeof field === "string" ? field : typeof field === "undefined" ? void 0 : typeof field === "bigint" ? field.toString() : String(field);
|
18631
18559
|
}
|
18632
|
-
function buildArrayString(
|
18560
|
+
function buildArrayString(array, sqlType) {
|
18633
18561
|
sqlType = sqlType.split("[")[0];
|
18634
|
-
const values =
|
18562
|
+
const values = array.map((value) => {
|
18635
18563
|
if (typeof value === "number" || typeof value === "bigint") {
|
18636
18564
|
return value.toString();
|
18637
18565
|
} else if (typeof value === "boolean") {
|
@@ -18653,41 +18581,7 @@ function buildArrayString(array2, sqlType) {
|
|
18653
18581
|
}).join(",");
|
18654
18582
|
return `{${values}}`;
|
18655
18583
|
}
|
18656
|
-
|
18657
|
-
let useRoles = false;
|
18658
|
-
const includeRoles = [];
|
18659
|
-
const excludeRoles = [];
|
18660
|
-
if (entities && entities.roles) {
|
18661
|
-
if (typeof entities.roles === "object") {
|
18662
|
-
if (entities.roles.provider) {
|
18663
|
-
if (entities.roles.provider === "supabase") {
|
18664
|
-
excludeRoles.push(...[
|
18665
|
-
"anon",
|
18666
|
-
"authenticator",
|
18667
|
-
"authenticated",
|
18668
|
-
"service_role",
|
18669
|
-
"supabase_auth_admin",
|
18670
|
-
"supabase_storage_admin",
|
18671
|
-
"dashboard_user",
|
18672
|
-
"supabase_admin"
|
18673
|
-
]);
|
18674
|
-
} else if (entities.roles.provider === "neon") {
|
18675
|
-
excludeRoles.push(...["authenticated", "anonymous"]);
|
18676
|
-
}
|
18677
|
-
}
|
18678
|
-
if (entities.roles.include) {
|
18679
|
-
includeRoles.push(...entities.roles.include);
|
18680
|
-
}
|
18681
|
-
if (entities.roles.exclude) {
|
18682
|
-
excludeRoles.push(...entities.roles.exclude);
|
18683
|
-
}
|
18684
|
-
} else {
|
18685
|
-
useRoles = entities.roles;
|
18686
|
-
}
|
18687
|
-
}
|
18688
|
-
return { useRoles, includeRoles, excludeRoles };
|
18689
|
-
}
|
18690
|
-
var import_drizzle_orm5, import_pg_core2, import_pg_core3, dialect5, indexName2, generatePgSnapshot, trimChar, fromDatabase2, defaultForColumn;
|
18584
|
+
var import_drizzle_orm5, import_pg_core2, import_pg_core3, indexName2, generatePgSnapshot, trimChar, fromDatabase2, defaultForColumn;
|
18691
18585
|
var init_pgSerializer = __esm({
|
18692
18586
|
"src/serializer/pgSerializer.ts"() {
|
18693
18587
|
"use strict";
|
@@ -18699,15 +18593,14 @@ var init_pgSerializer = __esm({
|
|
18699
18593
|
init_outputs();
|
18700
18594
|
init_utils();
|
18701
18595
|
init_serializer();
|
18702
|
-
dialect5 = new import_pg_core2.PgDialect();
|
18703
18596
|
indexName2 = (tableName, columns) => {
|
18704
18597
|
return `${tableName}_${columns.join("_")}_index`;
|
18705
18598
|
};
|
18706
|
-
generatePgSnapshot = (tables, enums, schemas, sequences,
|
18599
|
+
generatePgSnapshot = (tables, enums, schemas, sequences, casing2, schemaFilter) => {
|
18707
18600
|
var _a, _b, _c, _d, _e, _f;
|
18601
|
+
const dialect4 = new import_pg_core2.PgDialect({ casing: casing2 });
|
18708
18602
|
const result = {};
|
18709
18603
|
const sequencesToReturn = {};
|
18710
|
-
const rolesToReturn = {};
|
18711
18604
|
const indexesInSchema = {};
|
18712
18605
|
for (const table4 of tables) {
|
18713
18606
|
const {
|
@@ -18718,8 +18611,7 @@ var init_pgSerializer = __esm({
|
|
18718
18611
|
checks,
|
18719
18612
|
schema: schema5,
|
18720
18613
|
primaryKeys,
|
18721
|
-
uniqueConstraints
|
18722
|
-
policies
|
18614
|
+
uniqueConstraints
|
18723
18615
|
} = (0, import_pg_core3.getTableConfig)(table4);
|
18724
18616
|
if (schemaFilter && !schemaFilter.includes(schema5 ?? "public")) {
|
18725
18617
|
continue;
|
@@ -18729,9 +18621,9 @@ var init_pgSerializer = __esm({
|
|
18729
18621
|
const foreignKeysObject = {};
|
18730
18622
|
const primaryKeysObject = {};
|
18731
18623
|
const uniqueConstraintObject = {};
|
18732
|
-
const policiesObject = {};
|
18733
18624
|
columns.forEach((column7) => {
|
18734
18625
|
var _a2, _b2, _c2, _d2, _e2, _f2;
|
18626
|
+
const name = getColumnCasing(column7, casing2);
|
18735
18627
|
const notNull = column7.notNull;
|
18736
18628
|
const primaryKey = column7.primary;
|
18737
18629
|
const sqlTypeLowered = column7.getSQLType().toLowerCase();
|
@@ -18744,18 +18636,18 @@ var init_pgSerializer = __esm({
|
|
18744
18636
|
const startWith = stringFromIdentityProperty((_d2 = identity == null ? void 0 : identity.sequenceOptions) == null ? void 0 : _d2.startWith) ?? (parseFloat(increment) < 0 ? maxValue : minValue);
|
18745
18637
|
const cache = stringFromIdentityProperty((_e2 = identity == null ? void 0 : identity.sequenceOptions) == null ? void 0 : _e2.cache) ?? "1";
|
18746
18638
|
const columnToSet = {
|
18747
|
-
name
|
18639
|
+
name,
|
18748
18640
|
type: column7.getSQLType(),
|
18749
18641
|
typeSchema,
|
18750
18642
|
primaryKey,
|
18751
18643
|
notNull,
|
18752
18644
|
generated: generated ? {
|
18753
|
-
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,
|
18754
18646
|
type: "stored"
|
18755
18647
|
} : void 0,
|
18756
18648
|
identity: identity ? {
|
18757
18649
|
type: identity.type,
|
18758
|
-
name: identity.sequenceName ?? `${tableName}_${
|
18650
|
+
name: identity.sequenceName ?? `${tableName}_${name}_seq`,
|
18759
18651
|
schema: schema5 ?? "public",
|
18760
18652
|
increment,
|
18761
18653
|
startWith,
|
@@ -18776,7 +18668,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18776
18668
|
The unique constraint ${source_default.underline.blue(
|
18777
18669
|
column7.uniqueName
|
18778
18670
|
)} on the ${source_default.underline.blue(
|
18779
|
-
|
18671
|
+
name
|
18780
18672
|
)} column is confilcting with a unique constraint name already defined for ${source_default.underline.blue(
|
18781
18673
|
existingUnique.columns.join(",")
|
18782
18674
|
)} columns
|
@@ -18792,7 +18684,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18792
18684
|
}
|
18793
18685
|
if (column7.default !== void 0) {
|
18794
18686
|
if ((0, import_drizzle_orm5.is)(column7.default, import_drizzle_orm5.SQL)) {
|
18795
|
-
columnToSet.default = sqlToStr(column7.default);
|
18687
|
+
columnToSet.default = sqlToStr(column7.default, casing2);
|
18796
18688
|
} else {
|
18797
18689
|
if (typeof column7.default === "string") {
|
18798
18690
|
columnToSet.default = `'${column7.default}'`;
|
@@ -18820,17 +18712,24 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18820
18712
|
}
|
18821
18713
|
}
|
18822
18714
|
}
|
18823
|
-
columnsObject[
|
18715
|
+
columnsObject[name] = columnToSet;
|
18824
18716
|
});
|
18825
18717
|
primaryKeys.map((pk) => {
|
18826
|
-
const
|
18827
|
-
|
18828
|
-
|
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,
|
18829
18728
|
columns: columnNames
|
18830
18729
|
};
|
18831
18730
|
});
|
18832
18731
|
uniqueConstraints == null ? void 0 : uniqueConstraints.map((unq) => {
|
18833
|
-
const columnNames = unq.columns.map((c) => c
|
18732
|
+
const columnNames = unq.columns.map((c) => getColumnCasing(c, casing2));
|
18834
18733
|
const name = unq.name ?? (0, import_pg_core2.uniqueKeyName)(table4, columnNames);
|
18835
18734
|
const existingUnique = uniqueConstraintObject[name];
|
18836
18735
|
if (typeof existingUnique !== "undefined") {
|
@@ -18857,15 +18756,25 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18857
18756
|
};
|
18858
18757
|
});
|
18859
18758
|
const fks = foreignKeys.map((fk4) => {
|
18860
|
-
const name = fk4.getName();
|
18861
18759
|
const tableFrom = tableName;
|
18862
18760
|
const onDelete = fk4.onDelete;
|
18863
18761
|
const onUpdate = fk4.onUpdate;
|
18864
18762
|
const reference = fk4.reference();
|
18865
18763
|
const tableTo = (0, import_drizzle_orm5.getTableName)(reference.foreignTable);
|
18866
18764
|
const schemaTo = (0, import_pg_core3.getTableConfig)(reference.foreignTable).schema;
|
18867
|
-
const
|
18868
|
-
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
|
+
}
|
18869
18778
|
return {
|
18870
18779
|
name,
|
18871
18780
|
tableFrom,
|
@@ -18891,19 +18800,20 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
18891
18800
|
${withStyle.errorWarning(
|
18892
18801
|
`Please specify an index name in ${(0, import_drizzle_orm5.getTableName)(
|
18893
18802
|
value.config.table
|
18894
|
-
)} 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.`
|
18895
18804
|
)}`
|
18896
18805
|
);
|
18897
18806
|
process.exit(1);
|
18898
18807
|
}
|
18899
18808
|
}
|
18900
18809
|
it = it;
|
18810
|
+
const name2 = getColumnCasing(it, casing2);
|
18901
18811
|
if (!(0, import_drizzle_orm5.is)(it, import_drizzle_orm5.SQL) && it.type === "PgVector" && typeof it.indexConfig.opClass === "undefined") {
|
18902
18812
|
console.log(
|
18903
18813
|
`
|
18904
18814
|
${withStyle.errorWarning(
|
18905
18815
|
`You are specifying an index on the ${source_default.blueBright(
|
18906
|
-
|
18816
|
+
name2
|
18907
18817
|
)} column inside the ${source_default.blueBright(
|
18908
18818
|
tableName
|
18909
18819
|
)} table with the ${source_default.blueBright(
|
@@ -18913,7 +18823,7 @@ ${withStyle.errorWarning(
|
|
18913
18823
|
)}].
|
18914
18824
|
|
18915
18825
|
You can specify it using current syntax: ${source_default.underline(
|
18916
|
-
`index("${value.config.name}").using("${value.config.method}", table.${
|
18826
|
+
`index("${value.config.name}").using("${value.config.method}", table.${name2}.op("${vectorOps[0]}"))`
|
18917
18827
|
)}
|
18918
18828
|
|
18919
18829
|
You can check the "pg_vector" docs for more info: https://github.com/pgvector/pgvector?tab=readme-ov-file#indexing
|
@@ -18922,7 +18832,7 @@ You can check the "pg_vector" docs for more info: https://github.com/pgvector/pg
|
|
18922
18832
|
);
|
18923
18833
|
process.exit(1);
|
18924
18834
|
}
|
18925
|
-
indexColumnNames.push(
|
18835
|
+
indexColumnNames.push(name2);
|
18926
18836
|
});
|
18927
18837
|
const name = value.config.name ? value.config.name : indexName2(tableName, indexColumnNames);
|
18928
18838
|
let indexColumns = columns2.map(
|
@@ -18930,7 +18840,7 @@ You can check the "pg_vector" docs for more info: https://github.com/pgvector/pg
|
|
18930
18840
|
var _a2, _b2, _c2, _d2, _e2;
|
18931
18841
|
if ((0, import_drizzle_orm5.is)(it, import_drizzle_orm5.SQL)) {
|
18932
18842
|
return {
|
18933
|
-
expression:
|
18843
|
+
expression: dialect4.sqlToQuery(it, "indexes").sql,
|
18934
18844
|
asc: true,
|
18935
18845
|
isExpression: true,
|
18936
18846
|
nulls: "last"
|
@@ -18938,7 +18848,7 @@ You can check the "pg_vector" docs for more info: https://github.com/pgvector/pg
|
|
18938
18848
|
} else {
|
18939
18849
|
it = it;
|
18940
18850
|
return {
|
18941
|
-
expression: it
|
18851
|
+
expression: getColumnCasing(it, casing2),
|
18942
18852
|
isExpression: false,
|
18943
18853
|
asc: ((_a2 = it.indexConfig) == null ? void 0 : _a2.order) === "asc",
|
18944
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",
|
@@ -18969,41 +18879,12 @@ ${withStyle.errorWarning(
|
|
18969
18879
|
name,
|
18970
18880
|
columns: indexColumns,
|
18971
18881
|
isUnique: value.config.unique ?? false,
|
18972
|
-
where: value.config.where ?
|
18882
|
+
where: value.config.where ? dialect4.sqlToQuery(value.config.where).sql : void 0,
|
18973
18883
|
concurrently: value.config.concurrently ?? false,
|
18974
18884
|
method: value.config.method ?? "btree",
|
18975
18885
|
with: value.config.with ?? {}
|
18976
18886
|
};
|
18977
18887
|
});
|
18978
|
-
policies.forEach((policy2) => {
|
18979
|
-
var _a2, _b2;
|
18980
|
-
const mappedTo = [];
|
18981
|
-
if (!policy2.to) {
|
18982
|
-
mappedTo.push("public");
|
18983
|
-
} else {
|
18984
|
-
if (policy2.to && typeof policy2.to === "string") {
|
18985
|
-
mappedTo.push(policy2.to);
|
18986
|
-
} else if (policy2.to && (0, import_drizzle_orm5.is)(policy2.to, import_pg_core2.PgRole)) {
|
18987
|
-
mappedTo.push(policy2.to.name);
|
18988
|
-
} else if (policy2.to && Array.isArray(policy2.to)) {
|
18989
|
-
policy2.to.forEach((it) => {
|
18990
|
-
if (typeof it === "string") {
|
18991
|
-
mappedTo.push(it);
|
18992
|
-
} else if ((0, import_drizzle_orm5.is)(it, import_pg_core2.PgRole)) {
|
18993
|
-
mappedTo.push(it.name);
|
18994
|
-
}
|
18995
|
-
});
|
18996
|
-
}
|
18997
|
-
}
|
18998
|
-
policiesObject[policy2.name] = {
|
18999
|
-
name: policy2.name,
|
19000
|
-
as: ((_a2 = policy2.as) == null ? void 0 : _a2.toUpperCase()) ?? "PERMISSIVE",
|
19001
|
-
for: ((_b2 = policy2.for) == null ? void 0 : _b2.toUpperCase()) ?? "ALL",
|
19002
|
-
to: mappedTo.sort(),
|
19003
|
-
using: (0, import_drizzle_orm5.is)(policy2.using, import_drizzle_orm5.SQL) ? dialect5.sqlToQuery(policy2.using).sql : void 0,
|
19004
|
-
withCheck: (0, import_drizzle_orm5.is)(policy2.withCheck, import_drizzle_orm5.SQL) ? dialect5.sqlToQuery(policy2.withCheck).sql : void 0
|
19005
|
-
};
|
19006
|
-
});
|
19007
18888
|
const tableKey2 = `${schema5 ?? "public"}.${tableName}`;
|
19008
18889
|
result[tableKey2] = {
|
19009
18890
|
name: tableName,
|
@@ -19012,8 +18893,7 @@ ${withStyle.errorWarning(
|
|
19012
18893
|
indexes: indexesObject,
|
19013
18894
|
foreignKeys: foreignKeysObject,
|
19014
18895
|
compositePrimaryKeys: primaryKeysObject,
|
19015
|
-
uniqueConstraints: uniqueConstraintObject
|
19016
|
-
policies: policiesObject
|
18896
|
+
uniqueConstraints: uniqueConstraintObject
|
19017
18897
|
};
|
19018
18898
|
}
|
19019
18899
|
for (const sequence of sequences) {
|
@@ -19037,16 +18917,6 @@ ${withStyle.errorWarning(
|
|
19037
18917
|
} else {
|
19038
18918
|
}
|
19039
18919
|
}
|
19040
|
-
for (const role of roles) {
|
19041
|
-
if (!role._existing) {
|
19042
|
-
rolesToReturn[role.name] = {
|
19043
|
-
name: role.name,
|
19044
|
-
createDb: role.createDb === void 0 ? false : role.createDb,
|
19045
|
-
createRole: role.createRole === void 0 ? false : role.createRole,
|
19046
|
-
inherit: role.inherit === void 0 ? true : role.inherit
|
19047
|
-
};
|
19048
|
-
}
|
19049
|
-
}
|
19050
18920
|
const enumsToReturn = enums.reduce((map, obj) => {
|
19051
18921
|
const enumSchema3 = obj.schema || "public";
|
19052
18922
|
const key = `${enumSchema3}.${obj.enumName}`;
|
@@ -19073,7 +18943,6 @@ ${withStyle.errorWarning(
|
|
19073
18943
|
enums: enumsToReturn,
|
19074
18944
|
schemas: schemasObject,
|
19075
18945
|
sequences: sequencesToReturn,
|
19076
|
-
roles: rolesToReturn,
|
19077
18946
|
_meta: {
|
19078
18947
|
schemas: {},
|
19079
18948
|
tables: {},
|
@@ -19090,7 +18959,7 @@ ${withStyle.errorWarning(
|
|
19090
18959
|
--end;
|
19091
18960
|
return start > 0 || end < str.length ? str.substring(start, end) : str.toString();
|
19092
18961
|
};
|
19093
|
-
fromDatabase2 = async (db, tablesFilter = () => true, schemaFilters,
|
18962
|
+
fromDatabase2 = async (db, tablesFilter = () => true, schemaFilters, progressCallback) => {
|
19094
18963
|
const result = {};
|
19095
18964
|
const internals = { tables: {} };
|
19096
18965
|
const where = schemaFilters.map((t2) => `table_schema = '${t2}'`).join(" or ");
|
@@ -19172,55 +19041,6 @@ ${withStyle.errorWarning(
|
|
19172
19041
|
if (progressCallback) {
|
19173
19042
|
progressCallback("enums", Object.keys(enumsToReturn).length, "done");
|
19174
19043
|
}
|
19175
|
-
const allRoles = await db.query(
|
19176
|
-
`SELECT rolname, rolinherit, rolcreatedb, rolcreaterole FROM pg_roles;`
|
19177
|
-
);
|
19178
|
-
const rolesToReturn = {};
|
19179
|
-
const preparedRoles = prepareRoles(entities);
|
19180
|
-
if (preparedRoles.useRoles || !(preparedRoles.includeRoles.length === 0 && preparedRoles.excludeRoles.length === 0)) {
|
19181
|
-
for (const dbRole of allRoles) {
|
19182
|
-
if (preparedRoles.useRoles) {
|
19183
|
-
rolesToReturn[dbRole.rolname] = {
|
19184
|
-
createDb: dbRole.rolcreatedb,
|
19185
|
-
createRole: dbRole.rolcreatedb,
|
19186
|
-
inherit: dbRole.rolinherit,
|
19187
|
-
name: dbRole.rolname
|
19188
|
-
};
|
19189
|
-
} else {
|
19190
|
-
if (preparedRoles.includeRoles.length === 0 && preparedRoles.excludeRoles.length === 0)
|
19191
|
-
continue;
|
19192
|
-
if (preparedRoles.includeRoles.includes(dbRole.rolname) && preparedRoles.excludeRoles.includes(dbRole.rolname))
|
19193
|
-
continue;
|
19194
|
-
if (preparedRoles.excludeRoles.includes(dbRole.rolname))
|
19195
|
-
continue;
|
19196
|
-
if (!preparedRoles.includeRoles.includes(dbRole.rolname))
|
19197
|
-
continue;
|
19198
|
-
rolesToReturn[dbRole.rolname] = {
|
19199
|
-
createDb: dbRole.rolcreatedb,
|
19200
|
-
createRole: dbRole.rolcreaterole,
|
19201
|
-
inherit: dbRole.rolinherit,
|
19202
|
-
name: dbRole.rolname
|
19203
|
-
};
|
19204
|
-
}
|
19205
|
-
}
|
19206
|
-
}
|
19207
|
-
const wherePolicies = schemaFilters.map((t2) => `schemaname = '${t2}'`).join(" or ");
|
19208
|
-
const policiesByTable = {};
|
19209
|
-
const allPolicies = await db.query(`SELECT schemaname, tablename, policyname as name, permissive as "as", roles as to, cmd as for, qual as using, with_check as "withCheck" FROM pg_policies${wherePolicies === "" ? "" : ` WHERE ${wherePolicies}`};`);
|
19210
|
-
for (const dbPolicy of allPolicies) {
|
19211
|
-
const { tablename, schemaname, to, withCheck, using, ...rest } = dbPolicy;
|
19212
|
-
const tableForPolicy = policiesByTable[`${schemaname}.${tablename}`];
|
19213
|
-
const parsedTo = to === "{}" ? [] : to.substring(1, to.length - 1).split(/\s*,\s*/g).sort();
|
19214
|
-
const parsedWithCheck = withCheck === null ? void 0 : withCheck;
|
19215
|
-
const parsedUsing = using === null ? void 0 : using;
|
19216
|
-
if (tableForPolicy) {
|
19217
|
-
tableForPolicy[dbPolicy.name] = { ...rest, to: parsedTo };
|
19218
|
-
} else {
|
19219
|
-
policiesByTable[`${schemaname}.${tablename}`] = {
|
19220
|
-
[dbPolicy.name]: { ...rest, to: parsedTo, withCheck: parsedWithCheck, using: parsedUsing }
|
19221
|
-
};
|
19222
|
-
}
|
19223
|
-
}
|
19224
19044
|
const sequencesInColumns = [];
|
19225
19045
|
const all = allTables.map((row) => {
|
19226
19046
|
return new Promise(async (res, rej) => {
|
@@ -19617,8 +19437,7 @@ ${withStyle.errorWarning(
|
|
19617
19437
|
indexes: indexToReturn,
|
19618
19438
|
foreignKeys: foreignKeysToReturn,
|
19619
19439
|
compositePrimaryKeys: primaryKeys,
|
19620
|
-
uniqueConstraints: uniqueConstrains
|
19621
|
-
policies: policiesByTable[`${tableSchema}.${tableName}`] ?? {}
|
19440
|
+
uniqueConstraints: uniqueConstrains
|
19622
19441
|
};
|
19623
19442
|
} catch (e2) {
|
19624
19443
|
rej(e2);
|
@@ -19645,7 +19464,6 @@ ${withStyle.errorWarning(
|
|
19645
19464
|
enums: enumsToReturn,
|
19646
19465
|
schemas: schemasObject,
|
19647
19466
|
sequences: sequencesToReturn,
|
19648
|
-
roles: rolesToReturn,
|
19649
19467
|
_meta: {
|
19650
19468
|
schemas: {},
|
19651
19469
|
tables: {},
|
@@ -19830,7 +19648,7 @@ function extractGeneratedColumns(input) {
|
|
19830
19648
|
}
|
19831
19649
|
return columns;
|
19832
19650
|
}
|
19833
|
-
var import_drizzle_orm7, import_sqlite_core2,
|
19651
|
+
var import_drizzle_orm7, import_sqlite_core2, generateSqliteSnapshot, fromDatabase3;
|
19834
19652
|
var init_sqliteSerializer = __esm({
|
19835
19653
|
"src/serializer/sqliteSerializer.ts"() {
|
19836
19654
|
"use strict";
|
@@ -19838,9 +19656,10 @@ var init_sqliteSerializer = __esm({
|
|
19838
19656
|
import_drizzle_orm7 = require("drizzle-orm");
|
19839
19657
|
import_sqlite_core2 = require("drizzle-orm/sqlite-core");
|
19840
19658
|
init_outputs();
|
19659
|
+
init_utils();
|
19841
19660
|
init_serializer();
|
19842
|
-
|
19843
|
-
|
19661
|
+
generateSqliteSnapshot = (tables, casing2) => {
|
19662
|
+
const dialect4 = new import_sqlite_core2.SQLiteSyncDialect({ casing: casing2 });
|
19844
19663
|
const result = {};
|
19845
19664
|
const internal = { indexes: {} };
|
19846
19665
|
for (const table4 of tables) {
|
@@ -19858,28 +19677,29 @@ var init_sqliteSerializer = __esm({
|
|
19858
19677
|
uniqueConstraints
|
19859
19678
|
} = (0, import_sqlite_core2.getTableConfig)(table4);
|
19860
19679
|
columns.forEach((column7) => {
|
19680
|
+
const name = getColumnCasing(column7, casing2);
|
19861
19681
|
const notNull = column7.notNull;
|
19862
19682
|
const primaryKey = column7.primary;
|
19863
19683
|
const generated = column7.generated;
|
19864
19684
|
const columnToSet = {
|
19865
|
-
name
|
19685
|
+
name,
|
19866
19686
|
type: column7.getSQLType(),
|
19867
19687
|
primaryKey,
|
19868
19688
|
notNull,
|
19869
19689
|
autoincrement: (0, import_drizzle_orm7.is)(column7, import_sqlite_core2.SQLiteBaseInteger) ? column7.autoIncrement : false,
|
19870
19690
|
generated: generated ? {
|
19871
|
-
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})`,
|
19872
19692
|
type: generated.mode ?? "virtual"
|
19873
19693
|
} : void 0
|
19874
19694
|
};
|
19875
19695
|
if (column7.default !== void 0) {
|
19876
19696
|
if ((0, import_drizzle_orm7.is)(column7.default, import_drizzle_orm7.SQL)) {
|
19877
|
-
columnToSet.default = sqlToStr(column7.default);
|
19697
|
+
columnToSet.default = sqlToStr(column7.default, casing2);
|
19878
19698
|
} else {
|
19879
19699
|
columnToSet.default = typeof column7.default === "string" ? `'${column7.default}'` : typeof column7.default === "object" || Array.isArray(column7.default) ? `'${JSON.stringify(column7.default)}'` : column7.default;
|
19880
19700
|
}
|
19881
19701
|
}
|
19882
|
-
columnsObject[
|
19702
|
+
columnsObject[name] = columnToSet;
|
19883
19703
|
if (column7.isUnique) {
|
19884
19704
|
const existingUnique = indexesObject[column7.uniqueName];
|
19885
19705
|
if (typeof existingUnique !== "undefined") {
|
@@ -19891,7 +19711,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
19891
19711
|
The unique constraint ${source_default.underline.blue(
|
19892
19712
|
column7.uniqueName
|
19893
19713
|
)} on the ${source_default.underline.blue(
|
19894
|
-
|
19714
|
+
name
|
19895
19715
|
)} column is confilcting with a unique constraint name already defined for ${source_default.underline.blue(
|
19896
19716
|
existingUnique.columns.join(",")
|
19897
19717
|
)} columns
|
@@ -19907,15 +19727,25 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
19907
19727
|
}
|
19908
19728
|
});
|
19909
19729
|
const foreignKeys = tableForeignKeys.map((fk4) => {
|
19910
|
-
const name = fk4.getName();
|
19911
19730
|
const tableFrom = tableName;
|
19912
19731
|
const onDelete = fk4.onDelete ?? "no action";
|
19913
19732
|
const onUpdate = fk4.onUpdate ?? "no action";
|
19914
19733
|
const reference = fk4.reference();
|
19915
19734
|
const referenceFT = reference.foreignTable;
|
19916
19735
|
const tableTo = (0, import_drizzle_orm7.getTableName)(referenceFT);
|
19917
|
-
const
|
19918
|
-
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
|
+
}
|
19919
19749
|
return {
|
19920
19750
|
name,
|
19921
19751
|
tableFrom,
|
@@ -19935,7 +19765,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
19935
19765
|
let indexColumns = columns2.map((it) => {
|
19936
19766
|
var _a;
|
19937
19767
|
if ((0, import_drizzle_orm7.is)(it, import_drizzle_orm7.SQL)) {
|
19938
|
-
const sql =
|
19768
|
+
const sql = dialect4.sqlToQuery(it, "indexes").sql;
|
19939
19769
|
if (typeof internal.indexes[name] === "undefined") {
|
19940
19770
|
internal.indexes[name] = {
|
19941
19771
|
columns: {
|
@@ -19955,13 +19785,13 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
19955
19785
|
}
|
19956
19786
|
return sql;
|
19957
19787
|
} else {
|
19958
|
-
return it
|
19788
|
+
return getColumnCasing(it, casing2);
|
19959
19789
|
}
|
19960
19790
|
});
|
19961
19791
|
let where = void 0;
|
19962
19792
|
if (value.config.where !== void 0) {
|
19963
19793
|
if ((0, import_drizzle_orm7.is)(value.config.where, import_drizzle_orm7.SQL)) {
|
19964
|
-
where =
|
19794
|
+
where = dialect4.sqlToQuery(value.config.where).sql;
|
19965
19795
|
}
|
19966
19796
|
}
|
19967
19797
|
indexesObject[name] = {
|
@@ -19972,7 +19802,7 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
19972
19802
|
};
|
19973
19803
|
});
|
19974
19804
|
uniqueConstraints == null ? void 0 : uniqueConstraints.map((unq) => {
|
19975
|
-
const columnNames = unq.columns.map((c) => c
|
19805
|
+
const columnNames = unq.columns.map((c) => getColumnCasing(c, casing2));
|
19976
19806
|
const name = unq.name ?? (0, import_sqlite_core2.uniqueKeyName)(table4, columnNames);
|
19977
19807
|
const existingUnique = indexesObject[name];
|
19978
19808
|
if (typeof existingUnique !== "undefined") {
|
@@ -20002,12 +19832,20 @@ The unique constraint ${source_default.underline.blue(
|
|
20002
19832
|
});
|
20003
19833
|
primaryKeys.forEach((it) => {
|
20004
19834
|
if (it.columns.length > 1) {
|
20005
|
-
|
20006
|
-
|
20007
|
-
|
19835
|
+
const originalColumnNames = it.columns.map((c) => c.name);
|
19836
|
+
const columnNames = it.columns.map((c) => getColumnCasing(c, casing2));
|
19837
|
+
let name = it.getName();
|
19838
|
+
if (casing2 !== void 0) {
|
19839
|
+
for (let i2 = 0; i2 < originalColumnNames.length; i2++) {
|
19840
|
+
name = name.replace(originalColumnNames[i2], columnNames[i2]);
|
19841
|
+
}
|
19842
|
+
}
|
19843
|
+
primaryKeysObject[name] = {
|
19844
|
+
columns: columnNames,
|
19845
|
+
name
|
20008
19846
|
};
|
20009
19847
|
} else {
|
20010
|
-
columnsObject[it.columns[0]
|
19848
|
+
columnsObject[getColumnCasing(it.columns[0], casing2)].primaryKey = true;
|
20011
19849
|
}
|
20012
19850
|
});
|
20013
19851
|
result[tableName] = {
|
@@ -20252,16 +20090,17 @@ WHERE
|
|
20252
20090
|
});
|
20253
20091
|
|
20254
20092
|
// src/serializer/index.ts
|
20255
|
-
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;
|
20256
20094
|
var init_serializer = __esm({
|
20257
20095
|
"src/serializer/index.ts"() {
|
20258
20096
|
"use strict";
|
20259
20097
|
init_source();
|
20098
|
+
import_casing2 = require("drizzle-orm/casing");
|
20260
20099
|
import_fs3 = __toESM(require("fs"));
|
20261
20100
|
glob = __toESM(require_glob());
|
20262
20101
|
import_path3 = __toESM(require("path"));
|
20263
20102
|
init_views();
|
20264
|
-
sqlToStr = (sql) => {
|
20103
|
+
sqlToStr = (sql, casing2) => {
|
20265
20104
|
return sql.toQuery({
|
20266
20105
|
escapeName: () => {
|
20267
20106
|
throw new Error("we don't support params for `sql` default values");
|
@@ -20271,10 +20110,11 @@ var init_serializer = __esm({
|
|
20271
20110
|
},
|
20272
20111
|
escapeString: () => {
|
20273
20112
|
throw new Error("we don't support params for `sql` default values");
|
20274
|
-
}
|
20113
|
+
},
|
20114
|
+
casing: new import_casing2.CasingCache(casing2)
|
20275
20115
|
}).sql;
|
20276
20116
|
};
|
20277
|
-
serializeMySql = async (path5) => {
|
20117
|
+
serializeMySql = async (path5, casing2) => {
|
20278
20118
|
const filenames = prepareFilenames(path5);
|
20279
20119
|
console.log(source_default.gray(`Reading schema files:
|
20280
20120
|
${filenames.join("\n")}
|
@@ -20282,23 +20122,23 @@ ${filenames.join("\n")}
|
|
20282
20122
|
const { prepareFromMySqlImports: prepareFromMySqlImports2 } = await Promise.resolve().then(() => (init_mysqlImports(), mysqlImports_exports));
|
20283
20123
|
const { generateMySqlSnapshot: generateMySqlSnapshot2 } = await Promise.resolve().then(() => (init_mysqlSerializer(), mysqlSerializer_exports));
|
20284
20124
|
const { tables } = await prepareFromMySqlImports2(filenames);
|
20285
|
-
return generateMySqlSnapshot2(tables);
|
20125
|
+
return generateMySqlSnapshot2(tables, casing2);
|
20286
20126
|
};
|
20287
|
-
serializePg = async (path5, schemaFilter) => {
|
20127
|
+
serializePg = async (path5, casing2, schemaFilter) => {
|
20288
20128
|
const filenames = prepareFilenames(path5);
|
20289
20129
|
const { prepareFromPgImports: prepareFromPgImports2 } = await Promise.resolve().then(() => (init_pgImports(), pgImports_exports));
|
20290
20130
|
const { generatePgSnapshot: generatePgSnapshot2 } = await Promise.resolve().then(() => (init_pgSerializer(), pgSerializer_exports));
|
20291
|
-
const { tables, enums, schemas, sequences
|
20131
|
+
const { tables, enums, schemas, sequences } = await prepareFromPgImports2(
|
20292
20132
|
filenames
|
20293
20133
|
);
|
20294
|
-
return generatePgSnapshot2(tables, enums, schemas, sequences,
|
20134
|
+
return generatePgSnapshot2(tables, enums, schemas, sequences, casing2, schemaFilter);
|
20295
20135
|
};
|
20296
|
-
serializeSQLite = async (path5) => {
|
20136
|
+
serializeSQLite = async (path5, casing2) => {
|
20297
20137
|
const filenames = prepareFilenames(path5);
|
20298
20138
|
const { prepareFromSqliteImports: prepareFromSqliteImports2 } = await Promise.resolve().then(() => (init_sqliteImports(), sqliteImports_exports));
|
20299
20139
|
const { generateSqliteSnapshot: generateSqliteSnapshot2 } = await Promise.resolve().then(() => (init_sqliteSerializer(), sqliteSerializer_exports));
|
20300
20140
|
const { tables } = await prepareFromSqliteImports2(filenames);
|
20301
|
-
return generateSqliteSnapshot2(tables);
|
20141
|
+
return generateSqliteSnapshot2(tables, casing2);
|
20302
20142
|
};
|
20303
20143
|
prepareFilenames = (path5) => {
|
20304
20144
|
if (typeof path5 === "string") {
|
@@ -20347,45 +20187,45 @@ var init_migrationPreparator = __esm({
|
|
20347
20187
|
init_mysqlSchema();
|
20348
20188
|
init_pgSchema();
|
20349
20189
|
init_sqliteSchema();
|
20350
|
-
prepareMySqlDbPushSnapshot = async (prev, schemaPath) => {
|
20351
|
-
const serialized = await serializeMySql(schemaPath);
|
20190
|
+
prepareMySqlDbPushSnapshot = async (prev, schemaPath, casing2) => {
|
20191
|
+
const serialized = await serializeMySql(schemaPath, casing2);
|
20352
20192
|
const id = (0, import_crypto.randomUUID)();
|
20353
20193
|
const idPrev = prev.id;
|
20354
|
-
const { version: version3, dialect:
|
20355
|
-
const result = { version: version3, dialect:
|
20194
|
+
const { version: version3, dialect: dialect4, ...rest } = serialized;
|
20195
|
+
const result = { version: version3, dialect: dialect4, id, prevId: idPrev, ...rest };
|
20356
20196
|
return { prev, cur: result };
|
20357
20197
|
};
|
20358
|
-
prepareSQLiteDbPushSnapshot = async (prev, schemaPath) => {
|
20359
|
-
const serialized = await serializeSQLite(schemaPath);
|
20198
|
+
prepareSQLiteDbPushSnapshot = async (prev, schemaPath, casing2) => {
|
20199
|
+
const serialized = await serializeSQLite(schemaPath, casing2);
|
20360
20200
|
const id = (0, import_crypto.randomUUID)();
|
20361
20201
|
const idPrev = prev.id;
|
20362
|
-
const { version: version3, dialect:
|
20202
|
+
const { version: version3, dialect: dialect4, ...rest } = serialized;
|
20363
20203
|
const result = {
|
20364
20204
|
version: version3,
|
20365
|
-
dialect:
|
20205
|
+
dialect: dialect4,
|
20366
20206
|
id,
|
20367
20207
|
prevId: idPrev,
|
20368
20208
|
...rest
|
20369
20209
|
};
|
20370
20210
|
return { prev, cur: result };
|
20371
20211
|
};
|
20372
|
-
preparePgDbPushSnapshot = async (prev, schemaPath, schemaFilter = ["public"]) => {
|
20373
|
-
const serialized = await serializePg(schemaPath, schemaFilter);
|
20212
|
+
preparePgDbPushSnapshot = async (prev, schemaPath, casing2, schemaFilter = ["public"]) => {
|
20213
|
+
const serialized = await serializePg(schemaPath, casing2, schemaFilter);
|
20374
20214
|
const id = (0, import_crypto.randomUUID)();
|
20375
20215
|
const idPrev = prev.id;
|
20376
|
-
const { version: version3, dialect:
|
20377
|
-
const result = { version: version3, dialect:
|
20216
|
+
const { version: version3, dialect: dialect4, ...rest } = serialized;
|
20217
|
+
const result = { version: version3, dialect: dialect4, id, prevId: idPrev, ...rest };
|
20378
20218
|
return { prev, cur: result };
|
20379
20219
|
};
|
20380
|
-
prepareMySqlMigrationSnapshot = async (migrationFolders, schemaPath) => {
|
20220
|
+
prepareMySqlMigrationSnapshot = async (migrationFolders, schemaPath, casing2) => {
|
20381
20221
|
const prevSnapshot = mysqlSchema.parse(
|
20382
20222
|
preparePrevSnapshot(migrationFolders, dryMySql)
|
20383
20223
|
);
|
20384
|
-
const serialized = await serializeMySql(schemaPath);
|
20224
|
+
const serialized = await serializeMySql(schemaPath, casing2);
|
20385
20225
|
const id = (0, import_crypto.randomUUID)();
|
20386
20226
|
const idPrev = prevSnapshot.id;
|
20387
|
-
const { version: version3, dialect:
|
20388
|
-
const result = { version: version3, dialect:
|
20227
|
+
const { version: version3, dialect: dialect4, ...rest } = serialized;
|
20228
|
+
const result = { version: version3, dialect: dialect4, id, prevId: idPrev, ...rest };
|
20389
20229
|
const { id: _ignoredId, prevId: _ignoredPrevId, ...prevRest } = prevSnapshot;
|
20390
20230
|
const custom2 = {
|
20391
20231
|
id,
|
@@ -20394,17 +20234,17 @@ var init_migrationPreparator = __esm({
|
|
20394
20234
|
};
|
20395
20235
|
return { prev: prevSnapshot, cur: result, custom: custom2 };
|
20396
20236
|
};
|
20397
|
-
prepareSqliteMigrationSnapshot = async (snapshots, schemaPath) => {
|
20237
|
+
prepareSqliteMigrationSnapshot = async (snapshots, schemaPath, casing2) => {
|
20398
20238
|
const prevSnapshot = sqliteSchema.parse(
|
20399
20239
|
preparePrevSnapshot(snapshots, drySQLite)
|
20400
20240
|
);
|
20401
|
-
const serialized = await serializeSQLite(schemaPath);
|
20241
|
+
const serialized = await serializeSQLite(schemaPath, casing2);
|
20402
20242
|
const id = (0, import_crypto.randomUUID)();
|
20403
20243
|
const idPrev = prevSnapshot.id;
|
20404
|
-
const { version: version3, dialect:
|
20244
|
+
const { version: version3, dialect: dialect4, ...rest } = serialized;
|
20405
20245
|
const result = {
|
20406
20246
|
version: version3,
|
20407
|
-
dialect:
|
20247
|
+
dialect: dialect4,
|
20408
20248
|
id,
|
20409
20249
|
prevId: idPrev,
|
20410
20250
|
...rest
|
@@ -20424,9 +20264,9 @@ var init_migrationPreparator = __esm({
|
|
20424
20264
|
}) => {
|
20425
20265
|
return { id, prevId: idPrev, ...serialized };
|
20426
20266
|
};
|
20427
|
-
preparePgMigrationSnapshot = async (snapshots, schemaPath) => {
|
20267
|
+
preparePgMigrationSnapshot = async (snapshots, schemaPath, casing2) => {
|
20428
20268
|
const prevSnapshot = pgSchema.parse(preparePrevSnapshot(snapshots, dryPg));
|
20429
|
-
const serialized = await serializePg(schemaPath);
|
20269
|
+
const serialized = await serializePg(schemaPath, casing2);
|
20430
20270
|
const id = (0, import_crypto.randomUUID)();
|
20431
20271
|
const idPrev = prevSnapshot.id;
|
20432
20272
|
const result = { id, prevId: idPrev, ...serialized };
|
@@ -20486,57 +20326,57 @@ var require_heap = __commonJS({
|
|
20486
20326
|
}
|
20487
20327
|
return [].splice.apply(a, [lo, lo - lo].concat(x2)), x2;
|
20488
20328
|
};
|
20489
|
-
heappush = function(
|
20329
|
+
heappush = function(array, item, cmp) {
|
20490
20330
|
if (cmp == null) {
|
20491
20331
|
cmp = defaultCmp;
|
20492
20332
|
}
|
20493
|
-
|
20494
|
-
return _siftdown(
|
20333
|
+
array.push(item);
|
20334
|
+
return _siftdown(array, 0, array.length - 1, cmp);
|
20495
20335
|
};
|
20496
|
-
heappop = function(
|
20336
|
+
heappop = function(array, cmp) {
|
20497
20337
|
var lastelt, returnitem;
|
20498
20338
|
if (cmp == null) {
|
20499
20339
|
cmp = defaultCmp;
|
20500
20340
|
}
|
20501
|
-
lastelt =
|
20502
|
-
if (
|
20503
|
-
returnitem =
|
20504
|
-
|
20505
|
-
_siftup(
|
20341
|
+
lastelt = array.pop();
|
20342
|
+
if (array.length) {
|
20343
|
+
returnitem = array[0];
|
20344
|
+
array[0] = lastelt;
|
20345
|
+
_siftup(array, 0, cmp);
|
20506
20346
|
} else {
|
20507
20347
|
returnitem = lastelt;
|
20508
20348
|
}
|
20509
20349
|
return returnitem;
|
20510
20350
|
};
|
20511
|
-
heapreplace = function(
|
20351
|
+
heapreplace = function(array, item, cmp) {
|
20512
20352
|
var returnitem;
|
20513
20353
|
if (cmp == null) {
|
20514
20354
|
cmp = defaultCmp;
|
20515
20355
|
}
|
20516
|
-
returnitem =
|
20517
|
-
|
20518
|
-
_siftup(
|
20356
|
+
returnitem = array[0];
|
20357
|
+
array[0] = item;
|
20358
|
+
_siftup(array, 0, cmp);
|
20519
20359
|
return returnitem;
|
20520
20360
|
};
|
20521
|
-
heappushpop = function(
|
20361
|
+
heappushpop = function(array, item, cmp) {
|
20522
20362
|
var _ref;
|
20523
20363
|
if (cmp == null) {
|
20524
20364
|
cmp = defaultCmp;
|
20525
20365
|
}
|
20526
|
-
if (
|
20527
|
-
_ref = [
|
20528
|
-
_siftup(
|
20366
|
+
if (array.length && cmp(array[0], item) < 0) {
|
20367
|
+
_ref = [array[0], item], item = _ref[0], array[0] = _ref[1];
|
20368
|
+
_siftup(array, 0, cmp);
|
20529
20369
|
}
|
20530
20370
|
return item;
|
20531
20371
|
};
|
20532
|
-
heapify = function(
|
20372
|
+
heapify = function(array, cmp) {
|
20533
20373
|
var i2, _i, _j, _len, _ref, _ref1, _results, _results1;
|
20534
20374
|
if (cmp == null) {
|
20535
20375
|
cmp = defaultCmp;
|
20536
20376
|
}
|
20537
20377
|
_ref1 = function() {
|
20538
20378
|
_results1 = [];
|
20539
|
-
for (var _j2 = 0, _ref2 = floor(
|
20379
|
+
for (var _j2 = 0, _ref2 = floor(array.length / 2); 0 <= _ref2 ? _j2 < _ref2 : _j2 > _ref2; 0 <= _ref2 ? _j2++ : _j2--) {
|
20540
20380
|
_results1.push(_j2);
|
20541
20381
|
}
|
20542
20382
|
return _results1;
|
@@ -20544,51 +20384,51 @@ var require_heap = __commonJS({
|
|
20544
20384
|
_results = [];
|
20545
20385
|
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
20546
20386
|
i2 = _ref1[_i];
|
20547
|
-
_results.push(_siftup(
|
20387
|
+
_results.push(_siftup(array, i2, cmp));
|
20548
20388
|
}
|
20549
20389
|
return _results;
|
20550
20390
|
};
|
20551
|
-
updateItem = function(
|
20391
|
+
updateItem = function(array, item, cmp) {
|
20552
20392
|
var pos;
|
20553
20393
|
if (cmp == null) {
|
20554
20394
|
cmp = defaultCmp;
|
20555
20395
|
}
|
20556
|
-
pos =
|
20396
|
+
pos = array.indexOf(item);
|
20557
20397
|
if (pos === -1) {
|
20558
20398
|
return;
|
20559
20399
|
}
|
20560
|
-
_siftdown(
|
20561
|
-
return _siftup(
|
20400
|
+
_siftdown(array, 0, pos, cmp);
|
20401
|
+
return _siftup(array, pos, cmp);
|
20562
20402
|
};
|
20563
|
-
nlargest = function(
|
20403
|
+
nlargest = function(array, n, cmp) {
|
20564
20404
|
var elem, result, _i, _len, _ref;
|
20565
20405
|
if (cmp == null) {
|
20566
20406
|
cmp = defaultCmp;
|
20567
20407
|
}
|
20568
|
-
result =
|
20408
|
+
result = array.slice(0, n);
|
20569
20409
|
if (!result.length) {
|
20570
20410
|
return result;
|
20571
20411
|
}
|
20572
20412
|
heapify(result, cmp);
|
20573
|
-
_ref =
|
20413
|
+
_ref = array.slice(n);
|
20574
20414
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
20575
20415
|
elem = _ref[_i];
|
20576
20416
|
heappushpop(result, elem, cmp);
|
20577
20417
|
}
|
20578
20418
|
return result.sort(cmp).reverse();
|
20579
20419
|
};
|
20580
|
-
nsmallest = function(
|
20420
|
+
nsmallest = function(array, n, cmp) {
|
20581
20421
|
var elem, i2, los, result, _i, _j, _len, _ref, _ref1, _results;
|
20582
20422
|
if (cmp == null) {
|
20583
20423
|
cmp = defaultCmp;
|
20584
20424
|
}
|
20585
|
-
if (n * 10 <=
|
20586
|
-
result =
|
20425
|
+
if (n * 10 <= array.length) {
|
20426
|
+
result = array.slice(0, n).sort(cmp);
|
20587
20427
|
if (!result.length) {
|
20588
20428
|
return result;
|
20589
20429
|
}
|
20590
20430
|
los = result[result.length - 1];
|
20591
|
-
_ref =
|
20431
|
+
_ref = array.slice(n);
|
20592
20432
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
20593
20433
|
elem = _ref[_i];
|
20594
20434
|
if (cmp(elem, los) < 0) {
|
@@ -20599,51 +20439,51 @@ var require_heap = __commonJS({
|
|
20599
20439
|
}
|
20600
20440
|
return result;
|
20601
20441
|
}
|
20602
|
-
heapify(
|
20442
|
+
heapify(array, cmp);
|
20603
20443
|
_results = [];
|
20604
|
-
for (i2 = _j = 0, _ref1 = min(n,
|
20605
|
-
_results.push(heappop(
|
20444
|
+
for (i2 = _j = 0, _ref1 = min(n, array.length); 0 <= _ref1 ? _j < _ref1 : _j > _ref1; i2 = 0 <= _ref1 ? ++_j : --_j) {
|
20445
|
+
_results.push(heappop(array, cmp));
|
20606
20446
|
}
|
20607
20447
|
return _results;
|
20608
20448
|
};
|
20609
|
-
_siftdown = function(
|
20449
|
+
_siftdown = function(array, startpos, pos, cmp) {
|
20610
20450
|
var newitem, parent, parentpos;
|
20611
20451
|
if (cmp == null) {
|
20612
20452
|
cmp = defaultCmp;
|
20613
20453
|
}
|
20614
|
-
newitem =
|
20454
|
+
newitem = array[pos];
|
20615
20455
|
while (pos > startpos) {
|
20616
20456
|
parentpos = pos - 1 >> 1;
|
20617
|
-
parent =
|
20457
|
+
parent = array[parentpos];
|
20618
20458
|
if (cmp(newitem, parent) < 0) {
|
20619
|
-
|
20459
|
+
array[pos] = parent;
|
20620
20460
|
pos = parentpos;
|
20621
20461
|
continue;
|
20622
20462
|
}
|
20623
20463
|
break;
|
20624
20464
|
}
|
20625
|
-
return
|
20465
|
+
return array[pos] = newitem;
|
20626
20466
|
};
|
20627
|
-
_siftup = function(
|
20467
|
+
_siftup = function(array, pos, cmp) {
|
20628
20468
|
var childpos, endpos, newitem, rightpos, startpos;
|
20629
20469
|
if (cmp == null) {
|
20630
20470
|
cmp = defaultCmp;
|
20631
20471
|
}
|
20632
|
-
endpos =
|
20472
|
+
endpos = array.length;
|
20633
20473
|
startpos = pos;
|
20634
|
-
newitem =
|
20474
|
+
newitem = array[pos];
|
20635
20475
|
childpos = 2 * pos + 1;
|
20636
20476
|
while (childpos < endpos) {
|
20637
20477
|
rightpos = childpos + 1;
|
20638
|
-
if (rightpos < endpos && !(cmp(
|
20478
|
+
if (rightpos < endpos && !(cmp(array[childpos], array[rightpos]) < 0)) {
|
20639
20479
|
childpos = rightpos;
|
20640
20480
|
}
|
20641
|
-
|
20481
|
+
array[pos] = array[childpos];
|
20642
20482
|
pos = childpos;
|
20643
20483
|
childpos = 2 * pos + 1;
|
20644
20484
|
}
|
20645
|
-
|
20646
|
-
return _siftdown(
|
20485
|
+
array[pos] = newitem;
|
20486
|
+
return _siftdown(array, startpos, pos, cmp);
|
20647
20487
|
};
|
20648
20488
|
Heap = function() {
|
20649
20489
|
Heap2.push = heappush;
|
@@ -22556,12 +22396,12 @@ var require_lib = __commonJS({
|
|
22556
22396
|
}
|
22557
22397
|
return bestMatch;
|
22558
22398
|
}
|
22559
|
-
scalarize(
|
22399
|
+
scalarize(array, originals, fuzzyOriginals) {
|
22560
22400
|
const fuzzyMatches = [];
|
22561
22401
|
if (fuzzyOriginals) {
|
22562
22402
|
const keyScores = {};
|
22563
|
-
for (let index4 = 0; index4 <
|
22564
|
-
const item =
|
22403
|
+
for (let index4 = 0; index4 < array.length; index4++) {
|
22404
|
+
const item = array[index4];
|
22565
22405
|
if (this.isScalar(item)) {
|
22566
22406
|
continue;
|
22567
22407
|
}
|
@@ -22575,8 +22415,8 @@ var require_lib = __commonJS({
|
|
22575
22415
|
}
|
22576
22416
|
}
|
22577
22417
|
const result = [];
|
22578
|
-
for (let index4 = 0; index4 <
|
22579
|
-
const item =
|
22418
|
+
for (let index4 = 0; index4 < array.length; index4++) {
|
22419
|
+
const item = array[index4];
|
22580
22420
|
if (this.isScalar(item)) {
|
22581
22421
|
result.push(item);
|
22582
22422
|
} else {
|
@@ -22798,37 +22638,6 @@ function diffColumns(left, right) {
|
|
22798
22638
|
);
|
22799
22639
|
return alteredTables;
|
22800
22640
|
}
|
22801
|
-
function diffPolicies(left, right) {
|
22802
|
-
left = JSON.parse(JSON.stringify(left));
|
22803
|
-
right = JSON.parse(JSON.stringify(right));
|
22804
|
-
const result = (0, import_json_diff.diff)(left, right) ?? {};
|
22805
|
-
const alteredTables = Object.fromEntries(
|
22806
|
-
Object.entries(result).filter((it) => {
|
22807
|
-
return !(it[0].includes("__added") || it[0].includes("__deleted"));
|
22808
|
-
}).map((tableEntry) => {
|
22809
|
-
const deletedPolicies = Object.entries(tableEntry[1].policies ?? {}).filter((it) => {
|
22810
|
-
return it[0].endsWith("__deleted");
|
22811
|
-
}).map((it) => {
|
22812
|
-
return it[1];
|
22813
|
-
});
|
22814
|
-
const addedPolicies = Object.entries(tableEntry[1].policies ?? {}).filter((it) => {
|
22815
|
-
return it[0].endsWith("__added");
|
22816
|
-
}).map((it) => {
|
22817
|
-
return it[1];
|
22818
|
-
});
|
22819
|
-
tableEntry[1].policies = {
|
22820
|
-
added: addedPolicies,
|
22821
|
-
deleted: deletedPolicies
|
22822
|
-
};
|
22823
|
-
const table4 = left[tableEntry[0]];
|
22824
|
-
return [
|
22825
|
-
tableEntry[0],
|
22826
|
-
{ name: table4.name, schema: table4.schema, ...tableEntry[1] }
|
22827
|
-
];
|
22828
|
-
})
|
22829
|
-
);
|
22830
|
-
return alteredTables;
|
22831
|
-
}
|
22832
22641
|
function applyJsonDiff(json1, json2) {
|
22833
22642
|
json1 = JSON.parse(JSON.stringify(json1));
|
22834
22643
|
json2 = JSON.parse(JSON.stringify(json2));
|
@@ -22838,7 +22647,6 @@ function applyJsonDiff(json1, json2) {
|
|
22838
22647
|
difference.tables = difference.tables || {};
|
22839
22648
|
difference.enums = difference.enums || {};
|
22840
22649
|
difference.sequences = difference.sequences || {};
|
22841
|
-
difference.roles = difference.roles || {};
|
22842
22650
|
const schemaKeys = Object.keys(difference.schemas);
|
22843
22651
|
for (let key of schemaKeys) {
|
22844
22652
|
if (key.endsWith("__added") || key.endsWith("__deleted")) {
|
@@ -22894,10 +22702,6 @@ function applyJsonDiff(json1, json2) {
|
|
22894
22702
|
const alteredSequences = sequencesEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted")) && "values" in it[1]).map((it) => {
|
22895
22703
|
return json2.sequences[it[0]];
|
22896
22704
|
});
|
22897
|
-
const rolesEntries = Object.entries(difference.roles);
|
22898
|
-
const alteredRoles = rolesEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted"))).map((it) => {
|
22899
|
-
return json2.roles[it[0]];
|
22900
|
-
});
|
22901
22705
|
const alteredTablesWithColumns = Object.values(difference.tables).map(
|
22902
22706
|
(table4) => {
|
22903
22707
|
return findAlternationsInTable(table4);
|
@@ -22906,8 +22710,7 @@ function applyJsonDiff(json1, json2) {
|
|
22906
22710
|
return {
|
22907
22711
|
alteredTablesWithColumns,
|
22908
22712
|
alteredEnums,
|
22909
|
-
alteredSequences
|
22910
|
-
alteredRoles
|
22713
|
+
alteredSequences
|
22911
22714
|
};
|
22912
22715
|
}
|
22913
22716
|
var import_json_diff, mapArraysDiff, findAlternationsInTable, alternationsInColumn;
|
@@ -22967,21 +22770,6 @@ var init_jsonDiffer = __esm({
|
|
22967
22770
|
return !it[0].endsWith("__deleted") && !it[0].endsWith("__added");
|
22968
22771
|
})
|
22969
22772
|
);
|
22970
|
-
const deletedPolicies = Object.fromEntries(
|
22971
|
-
Object.entries(table4.policies__deleted || {}).concat(
|
22972
|
-
Object.entries(table4.policies || {}).filter((it) => it[0].includes("__deleted"))
|
22973
|
-
).map((entry) => [entry[0].replace("__deleted", ""), entry[1]])
|
22974
|
-
);
|
22975
|
-
const addedPolicies = Object.fromEntries(
|
22976
|
-
Object.entries(table4.policies__added || {}).concat(
|
22977
|
-
Object.entries(table4.policies || {}).filter((it) => it[0].includes("__added"))
|
22978
|
-
).map((entry) => [entry[0].replace("__added", ""), entry[1]])
|
22979
|
-
);
|
22980
|
-
const alteredPolicies = Object.fromEntries(
|
22981
|
-
Object.entries(table4.policies || {}).filter((it) => {
|
22982
|
-
return !it[0].endsWith("__deleted") && !it[0].endsWith("__added");
|
22983
|
-
})
|
22984
|
-
);
|
22985
22773
|
const deletedForeignKeys = Object.fromEntries(
|
22986
22774
|
Object.entries(table4.foreignKeys__deleted || {}).concat(
|
22987
22775
|
Object.entries(table4.foreignKeys || {}).filter((it) => it[0].includes("__deleted"))
|
@@ -23043,10 +22831,7 @@ var init_jsonDiffer = __esm({
|
|
23043
22831
|
alteredCompositePKs,
|
23044
22832
|
addedUniqueConstraints,
|
23045
22833
|
deletedUniqueConstraints,
|
23046
|
-
alteredUniqueConstraints
|
23047
|
-
deletedPolicies,
|
23048
|
-
addedPolicies,
|
23049
|
-
alteredPolicies
|
22834
|
+
alteredUniqueConstraints
|
23050
22835
|
};
|
23051
22836
|
};
|
23052
22837
|
alternationsInColumn = (column7) => {
|
@@ -23307,10 +23092,10 @@ var init_jsonDiffer = __esm({
|
|
23307
23092
|
});
|
23308
23093
|
|
23309
23094
|
// src/sqlgenerator.ts
|
23310
|
-
function fromJson(statements,
|
23095
|
+
function fromJson(statements, dialect4, action, json2) {
|
23311
23096
|
const result = statements.flatMap((statement) => {
|
23312
23097
|
const filtered = convertors.filter((it) => {
|
23313
|
-
return it.can(statement,
|
23098
|
+
return it.can(statement, dialect4);
|
23314
23099
|
});
|
23315
23100
|
const convertor = filtered.length === 1 ? filtered[0] : void 0;
|
23316
23101
|
if (!convertor) {
|
@@ -23320,7 +23105,7 @@ function fromJson(statements, dialect7, action, json2) {
|
|
23320
23105
|
}).filter((it) => it !== "");
|
23321
23106
|
return result;
|
23322
23107
|
}
|
23323
|
-
var pgNativeTypes, isPgNativeType, Convertor,
|
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;
|
23324
23109
|
var init_sqlgenerator = __esm({
|
23325
23110
|
"src/sqlgenerator.ts"() {
|
23326
23111
|
"use strict";
|
@@ -23377,110 +23162,12 @@ var init_sqlgenerator = __esm({
|
|
23377
23162
|
};
|
23378
23163
|
Convertor = class {
|
23379
23164
|
};
|
23380
|
-
PgCreateRoleConvertor = class extends Convertor {
|
23381
|
-
can(statement, dialect7) {
|
23382
|
-
return statement.type === "create_role" && dialect7 === "postgresql";
|
23383
|
-
}
|
23384
|
-
convert(statement) {
|
23385
|
-
return `CREATE ROLE "${statement.name}"${statement.values.createDb || statement.values.createRole || !statement.values.inherit ? ` WITH${statement.values.createDb ? " CREATEDB" : ""}${statement.values.createRole ? " CREATEROLE" : ""}${statement.values.inherit ? "" : " NOINHERIT"}` : ""};`;
|
23386
|
-
}
|
23387
|
-
};
|
23388
|
-
PgDropRoleConvertor = class extends Convertor {
|
23389
|
-
can(statement, dialect7) {
|
23390
|
-
return statement.type === "drop_role" && dialect7 === "postgresql";
|
23391
|
-
}
|
23392
|
-
convert(statement) {
|
23393
|
-
return `DROP ROLE "${statement.name}";`;
|
23394
|
-
}
|
23395
|
-
};
|
23396
|
-
PgRenameRoleConvertor = class extends Convertor {
|
23397
|
-
can(statement, dialect7) {
|
23398
|
-
return statement.type === "rename_role" && dialect7 === "postgresql";
|
23399
|
-
}
|
23400
|
-
convert(statement) {
|
23401
|
-
return `ALTER ROLE "${statement.nameFrom}" RENAME TO "${statement.nameTo}";`;
|
23402
|
-
}
|
23403
|
-
};
|
23404
|
-
PgAlterRoleConvertor = class extends Convertor {
|
23405
|
-
can(statement, dialect7) {
|
23406
|
-
return statement.type === "alter_role" && dialect7 === "postgresql";
|
23407
|
-
}
|
23408
|
-
convert(statement) {
|
23409
|
-
return `ALTER ROLE "${statement.name}"${` WITH${statement.values.createDb ? " CREATEDB" : " NOCREATEDB"}${statement.values.createRole ? " CREATEROLE" : " NOCREATEROLE"}${statement.values.inherit ? " INHERIT" : " NOINHERIT"}`};`;
|
23410
|
-
}
|
23411
|
-
};
|
23412
|
-
PgCreatePolicyConvertor = class extends Convertor {
|
23413
|
-
can(statement, dialect7) {
|
23414
|
-
return statement.type === "create_policy" && dialect7 === "postgresql";
|
23415
|
-
}
|
23416
|
-
convert(statement) {
|
23417
|
-
var _a, _b, _c;
|
23418
|
-
const policy2 = statement.data;
|
23419
|
-
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
|
23420
|
-
const usingPart = policy2.using ? ` USING (${policy2.using})` : "";
|
23421
|
-
const withCheckPart = policy2.withCheck ? ` WITH CHECK (${policy2.withCheck})` : "";
|
23422
|
-
const policyToPart = (_a = policy2.to) == null ? void 0 : _a.map(
|
23423
|
-
(v) => ["current_user", "current_role", "session_user", "public"].includes(v) ? v : `"${v}"`
|
23424
|
-
).join(", ");
|
23425
|
-
return `CREATE POLICY "${policy2.name}" ON ${tableNameWithSchema} AS ${(_b = policy2.as) == null ? void 0 : _b.toUpperCase()} FOR ${(_c = policy2.for) == null ? void 0 : _c.toUpperCase()} TO ${policyToPart}${usingPart}${withCheckPart};`;
|
23426
|
-
}
|
23427
|
-
};
|
23428
|
-
PgDropPolicyConvertor = class extends Convertor {
|
23429
|
-
can(statement, dialect7) {
|
23430
|
-
return statement.type === "drop_policy" && dialect7 === "postgresql";
|
23431
|
-
}
|
23432
|
-
convert(statement) {
|
23433
|
-
const policy2 = statement.data;
|
23434
|
-
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
|
23435
|
-
return `DROP POLICY "${policy2.name}" ON ${tableNameWithSchema} CASCADE;`;
|
23436
|
-
}
|
23437
|
-
};
|
23438
|
-
PgRenamePolicyConvertor = class extends Convertor {
|
23439
|
-
can(statement, dialect7) {
|
23440
|
-
return statement.type === "rename_policy" && dialect7 === "postgresql";
|
23441
|
-
}
|
23442
|
-
convert(statement) {
|
23443
|
-
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
|
23444
|
-
return `ALTER POLICY "${statement.oldName}" ON ${tableNameWithSchema} RENAME TO "${statement.newName}";`;
|
23445
|
-
}
|
23446
|
-
};
|
23447
|
-
PgAlterPolicyConvertor = class extends Convertor {
|
23448
|
-
can(statement, dialect7) {
|
23449
|
-
return statement.type === "alter_policy" && dialect7 === "postgresql";
|
23450
|
-
}
|
23451
|
-
convert(statement) {
|
23452
|
-
const newPolicy = PgSquasher.unsquashPolicy(statement.newData);
|
23453
|
-
const oldPolicy = PgSquasher.unsquashPolicy(statement.oldData);
|
23454
|
-
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
|
23455
|
-
const usingPart = newPolicy.using ? ` USING (${newPolicy.using})` : oldPolicy.using ? ` USING (${oldPolicy.using})` : "";
|
23456
|
-
const withCheckPart = newPolicy.withCheck ? ` WITH CHECK (${newPolicy.withCheck})` : oldPolicy.withCheck ? ` WITH CHECK (${oldPolicy.withCheck})` : "";
|
23457
|
-
return `ALTER POLICY "${oldPolicy.name}" ON ${tableNameWithSchema} TO ${newPolicy.to}${usingPart}${withCheckPart};`;
|
23458
|
-
}
|
23459
|
-
};
|
23460
|
-
PgEnableRlsConvertor = class extends Convertor {
|
23461
|
-
can(statement, dialect7) {
|
23462
|
-
return statement.type === "enable_rls" && dialect7 === "postgresql";
|
23463
|
-
}
|
23464
|
-
convert(statement) {
|
23465
|
-
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
|
23466
|
-
return `ALTER TABLE ${tableNameWithSchema} ENABLE ROW LEVEL SECURITY;`;
|
23467
|
-
}
|
23468
|
-
};
|
23469
|
-
PgDisableRlsConvertor = class extends Convertor {
|
23470
|
-
can(statement, dialect7) {
|
23471
|
-
return statement.type === "disable_rls" && dialect7 === "postgresql";
|
23472
|
-
}
|
23473
|
-
convert(statement) {
|
23474
|
-
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
|
23475
|
-
return `ALTER TABLE ${tableNameWithSchema} DISABLE ROW LEVEL SECURITY;`;
|
23476
|
-
}
|
23477
|
-
};
|
23478
23165
|
PgCreateTableConvertor = class extends Convertor {
|
23479
|
-
can(statement,
|
23480
|
-
return statement.type === "create_table" &&
|
23166
|
+
can(statement, dialect4) {
|
23167
|
+
return statement.type === "create_table" && dialect4 === "postgresql";
|
23481
23168
|
}
|
23482
23169
|
convert(st) {
|
23483
|
-
const { tableName, schema: schema5, columns, compositePKs, uniqueConstraints
|
23170
|
+
const { tableName, schema: schema5, columns, compositePKs, uniqueConstraints } = st;
|
23484
23171
|
let statement = "";
|
23485
23172
|
const name = schema5 ? `"${schema5}"."${tableName}"` : `"${tableName}"`;
|
23486
23173
|
statement += `CREATE TABLE IF NOT EXISTS ${name} (
|
@@ -23517,17 +23204,12 @@ var init_sqlgenerator = __esm({
|
|
23517
23204
|
);`;
|
23518
23205
|
statement += `
|
23519
23206
|
`;
|
23520
|
-
|
23521
|
-
type: "enable_rls",
|
23522
|
-
tableName,
|
23523
|
-
schema: schema5
|
23524
|
-
});
|
23525
|
-
return [statement, ...policies && policies.length > 0 ? [enableRls] : []];
|
23207
|
+
return statement;
|
23526
23208
|
}
|
23527
23209
|
};
|
23528
23210
|
MySqlCreateTableConvertor = class extends Convertor {
|
23529
|
-
can(statement,
|
23530
|
-
return statement.type === "create_table" &&
|
23211
|
+
can(statement, dialect4) {
|
23212
|
+
return statement.type === "create_table" && dialect4 === "mysql";
|
23531
23213
|
}
|
23532
23214
|
convert(st) {
|
23533
23215
|
var _a, _b;
|
@@ -23577,8 +23259,8 @@ var init_sqlgenerator = __esm({
|
|
23577
23259
|
}
|
23578
23260
|
};
|
23579
23261
|
SQLiteCreateTableConvertor = class extends Convertor {
|
23580
|
-
can(statement,
|
23581
|
-
return statement.type === "sqlite_create_table" && (
|
23262
|
+
can(statement, dialect4) {
|
23263
|
+
return statement.type === "sqlite_create_table" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23582
23264
|
}
|
23583
23265
|
convert(st) {
|
23584
23266
|
const {
|
@@ -23640,8 +23322,8 @@ var init_sqlgenerator = __esm({
|
|
23640
23322
|
}
|
23641
23323
|
};
|
23642
23324
|
PgAlterTableAlterColumnSetGenerated = class extends Convertor {
|
23643
|
-
can(statement,
|
23644
|
-
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";
|
23645
23327
|
}
|
23646
23328
|
convert(statement) {
|
23647
23329
|
const { identity, tableName, columnName, schema: schema5 } = statement;
|
@@ -23653,8 +23335,8 @@ var init_sqlgenerator = __esm({
|
|
23653
23335
|
}
|
23654
23336
|
};
|
23655
23337
|
PgAlterTableAlterColumnDropGenerated = class extends Convertor {
|
23656
|
-
can(statement,
|
23657
|
-
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";
|
23658
23340
|
}
|
23659
23341
|
convert(statement) {
|
23660
23342
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -23663,8 +23345,8 @@ var init_sqlgenerator = __esm({
|
|
23663
23345
|
}
|
23664
23346
|
};
|
23665
23347
|
PgAlterTableAlterColumnAlterGenerated = class extends Convertor {
|
23666
|
-
can(statement,
|
23667
|
-
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";
|
23668
23350
|
}
|
23669
23351
|
convert(statement) {
|
23670
23352
|
const { identity, oldIdentity, tableName, columnName, schema: schema5 } = statement;
|
@@ -23711,8 +23393,8 @@ var init_sqlgenerator = __esm({
|
|
23711
23393
|
}
|
23712
23394
|
};
|
23713
23395
|
PgAlterTableAddUniqueConstraintConvertor = class extends Convertor {
|
23714
|
-
can(statement,
|
23715
|
-
return statement.type === "create_unique_constraint" &&
|
23396
|
+
can(statement, dialect4) {
|
23397
|
+
return statement.type === "create_unique_constraint" && dialect4 === "postgresql";
|
23716
23398
|
}
|
23717
23399
|
convert(statement) {
|
23718
23400
|
const unsquashed = PgSquasher.unsquashUnique(statement.data);
|
@@ -23721,8 +23403,8 @@ var init_sqlgenerator = __esm({
|
|
23721
23403
|
}
|
23722
23404
|
};
|
23723
23405
|
PgAlterTableDropUniqueConstraintConvertor = class extends Convertor {
|
23724
|
-
can(statement,
|
23725
|
-
return statement.type === "delete_unique_constraint" &&
|
23406
|
+
can(statement, dialect4) {
|
23407
|
+
return statement.type === "delete_unique_constraint" && dialect4 === "postgresql";
|
23726
23408
|
}
|
23727
23409
|
convert(statement) {
|
23728
23410
|
const unsquashed = PgSquasher.unsquashUnique(statement.data);
|
@@ -23731,8 +23413,8 @@ var init_sqlgenerator = __esm({
|
|
23731
23413
|
}
|
23732
23414
|
};
|
23733
23415
|
MySQLAlterTableAddUniqueConstraintConvertor = class extends Convertor {
|
23734
|
-
can(statement,
|
23735
|
-
return statement.type === "create_unique_constraint" &&
|
23416
|
+
can(statement, dialect4) {
|
23417
|
+
return statement.type === "create_unique_constraint" && dialect4 === "mysql";
|
23736
23418
|
}
|
23737
23419
|
convert(statement) {
|
23738
23420
|
const unsquashed = MySqlSquasher.unsquashUnique(statement.data);
|
@@ -23740,8 +23422,8 @@ var init_sqlgenerator = __esm({
|
|
23740
23422
|
}
|
23741
23423
|
};
|
23742
23424
|
MySQLAlterTableDropUniqueConstraintConvertor = class extends Convertor {
|
23743
|
-
can(statement,
|
23744
|
-
return statement.type === "delete_unique_constraint" &&
|
23425
|
+
can(statement, dialect4) {
|
23426
|
+
return statement.type === "delete_unique_constraint" && dialect4 === "mysql";
|
23745
23427
|
}
|
23746
23428
|
convert(statement) {
|
23747
23429
|
const unsquashed = MySqlSquasher.unsquashUnique(statement.data);
|
@@ -23749,8 +23431,8 @@ var init_sqlgenerator = __esm({
|
|
23749
23431
|
}
|
23750
23432
|
};
|
23751
23433
|
CreatePgSequenceConvertor = class extends Convertor {
|
23752
|
-
can(statement,
|
23753
|
-
return statement.type === "create_sequence" &&
|
23434
|
+
can(statement, dialect4) {
|
23435
|
+
return statement.type === "create_sequence" && dialect4 === "postgresql";
|
23754
23436
|
}
|
23755
23437
|
convert(st) {
|
23756
23438
|
const { name, values, schema: schema5 } = st;
|
@@ -23759,8 +23441,8 @@ var init_sqlgenerator = __esm({
|
|
23759
23441
|
}
|
23760
23442
|
};
|
23761
23443
|
DropPgSequenceConvertor = class extends Convertor {
|
23762
|
-
can(statement,
|
23763
|
-
return statement.type === "drop_sequence" &&
|
23444
|
+
can(statement, dialect4) {
|
23445
|
+
return statement.type === "drop_sequence" && dialect4 === "postgresql";
|
23764
23446
|
}
|
23765
23447
|
convert(st) {
|
23766
23448
|
const { name, schema: schema5 } = st;
|
@@ -23769,8 +23451,8 @@ var init_sqlgenerator = __esm({
|
|
23769
23451
|
}
|
23770
23452
|
};
|
23771
23453
|
RenamePgSequenceConvertor = class extends Convertor {
|
23772
|
-
can(statement,
|
23773
|
-
return statement.type === "rename_sequence" &&
|
23454
|
+
can(statement, dialect4) {
|
23455
|
+
return statement.type === "rename_sequence" && dialect4 === "postgresql";
|
23774
23456
|
}
|
23775
23457
|
convert(st) {
|
23776
23458
|
const { nameFrom, nameTo, schema: schema5 } = st;
|
@@ -23780,8 +23462,8 @@ var init_sqlgenerator = __esm({
|
|
23780
23462
|
}
|
23781
23463
|
};
|
23782
23464
|
MovePgSequenceConvertor = class extends Convertor {
|
23783
|
-
can(statement,
|
23784
|
-
return statement.type === "move_sequence" &&
|
23465
|
+
can(statement, dialect4) {
|
23466
|
+
return statement.type === "move_sequence" && dialect4 === "postgresql";
|
23785
23467
|
}
|
23786
23468
|
convert(st) {
|
23787
23469
|
const { schemaFrom, schemaTo, name } = st;
|
@@ -23791,8 +23473,8 @@ var init_sqlgenerator = __esm({
|
|
23791
23473
|
}
|
23792
23474
|
};
|
23793
23475
|
AlterPgSequenceConvertor = class extends Convertor {
|
23794
|
-
can(statement,
|
23795
|
-
return statement.type === "alter_sequence" &&
|
23476
|
+
can(statement, dialect4) {
|
23477
|
+
return statement.type === "alter_sequence" && dialect4 === "postgresql";
|
23796
23478
|
}
|
23797
23479
|
convert(st) {
|
23798
23480
|
const { name, schema: schema5, values } = st;
|
@@ -23835,30 +23517,18 @@ var init_sqlgenerator = __esm({
|
|
23835
23517
|
}
|
23836
23518
|
};
|
23837
23519
|
PgDropTableConvertor = class extends Convertor {
|
23838
|
-
can(statement,
|
23839
|
-
return statement.type === "drop_table" &&
|
23520
|
+
can(statement, dialect4) {
|
23521
|
+
return statement.type === "drop_table" && dialect4 === "postgresql";
|
23840
23522
|
}
|
23841
23523
|
convert(statement) {
|
23842
|
-
const { tableName, schema: schema5
|
23524
|
+
const { tableName, schema: schema5 } = statement;
|
23843
23525
|
const tableNameWithSchema = schema5 ? `"${schema5}"."${tableName}"` : `"${tableName}"`;
|
23844
|
-
|
23845
|
-
const droppedPolicies = (policies == null ? void 0 : policies.map((p2) => {
|
23846
|
-
return dropPolicyConvertor.convert({
|
23847
|
-
type: "drop_policy",
|
23848
|
-
tableName,
|
23849
|
-
data: PgSquasher.unsquashPolicy(p2),
|
23850
|
-
schema: schema5
|
23851
|
-
});
|
23852
|
-
})) ?? [];
|
23853
|
-
return [
|
23854
|
-
...droppedPolicies,
|
23855
|
-
`DROP TABLE ${tableNameWithSchema};`
|
23856
|
-
];
|
23526
|
+
return `DROP TABLE ${tableNameWithSchema};`;
|
23857
23527
|
}
|
23858
23528
|
};
|
23859
23529
|
MySQLDropTableConvertor = class extends Convertor {
|
23860
|
-
can(statement,
|
23861
|
-
return statement.type === "drop_table" &&
|
23530
|
+
can(statement, dialect4) {
|
23531
|
+
return statement.type === "drop_table" && dialect4 === "mysql";
|
23862
23532
|
}
|
23863
23533
|
convert(statement) {
|
23864
23534
|
const { tableName } = statement;
|
@@ -23866,8 +23536,8 @@ var init_sqlgenerator = __esm({
|
|
23866
23536
|
}
|
23867
23537
|
};
|
23868
23538
|
SQLiteDropTableConvertor = class extends Convertor {
|
23869
|
-
can(statement,
|
23870
|
-
return statement.type === "drop_table" && (
|
23539
|
+
can(statement, dialect4) {
|
23540
|
+
return statement.type === "drop_table" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23871
23541
|
}
|
23872
23542
|
convert(statement) {
|
23873
23543
|
const { tableName } = statement;
|
@@ -23875,8 +23545,8 @@ var init_sqlgenerator = __esm({
|
|
23875
23545
|
}
|
23876
23546
|
};
|
23877
23547
|
PgRenameTableConvertor = class extends Convertor {
|
23878
|
-
can(statement,
|
23879
|
-
return statement.type === "rename_table" &&
|
23548
|
+
can(statement, dialect4) {
|
23549
|
+
return statement.type === "rename_table" && dialect4 === "postgresql";
|
23880
23550
|
}
|
23881
23551
|
convert(statement) {
|
23882
23552
|
const { tableNameFrom, tableNameTo, toSchema, fromSchema } = statement;
|
@@ -23886,8 +23556,8 @@ var init_sqlgenerator = __esm({
|
|
23886
23556
|
}
|
23887
23557
|
};
|
23888
23558
|
SqliteRenameTableConvertor = class extends Convertor {
|
23889
|
-
can(statement,
|
23890
|
-
return statement.type === "rename_table" && (
|
23559
|
+
can(statement, dialect4) {
|
23560
|
+
return statement.type === "rename_table" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23891
23561
|
}
|
23892
23562
|
convert(statement) {
|
23893
23563
|
const { tableNameFrom, tableNameTo } = statement;
|
@@ -23895,8 +23565,8 @@ var init_sqlgenerator = __esm({
|
|
23895
23565
|
}
|
23896
23566
|
};
|
23897
23567
|
MySqlRenameTableConvertor = class extends Convertor {
|
23898
|
-
can(statement,
|
23899
|
-
return statement.type === "rename_table" &&
|
23568
|
+
can(statement, dialect4) {
|
23569
|
+
return statement.type === "rename_table" && dialect4 === "mysql";
|
23900
23570
|
}
|
23901
23571
|
convert(statement) {
|
23902
23572
|
const { tableNameFrom, tableNameTo } = statement;
|
@@ -23904,8 +23574,8 @@ var init_sqlgenerator = __esm({
|
|
23904
23574
|
}
|
23905
23575
|
};
|
23906
23576
|
PgAlterTableRenameColumnConvertor = class extends Convertor {
|
23907
|
-
can(statement,
|
23908
|
-
return statement.type === "alter_table_rename_column" &&
|
23577
|
+
can(statement, dialect4) {
|
23578
|
+
return statement.type === "alter_table_rename_column" && dialect4 === "postgresql";
|
23909
23579
|
}
|
23910
23580
|
convert(statement) {
|
23911
23581
|
const { tableName, oldColumnName, newColumnName, schema: schema5 } = statement;
|
@@ -23914,8 +23584,8 @@ var init_sqlgenerator = __esm({
|
|
23914
23584
|
}
|
23915
23585
|
};
|
23916
23586
|
MySqlAlterTableRenameColumnConvertor = class extends Convertor {
|
23917
|
-
can(statement,
|
23918
|
-
return statement.type === "alter_table_rename_column" &&
|
23587
|
+
can(statement, dialect4) {
|
23588
|
+
return statement.type === "alter_table_rename_column" && dialect4 === "mysql";
|
23919
23589
|
}
|
23920
23590
|
convert(statement) {
|
23921
23591
|
const { tableName, oldColumnName, newColumnName } = statement;
|
@@ -23923,8 +23593,8 @@ var init_sqlgenerator = __esm({
|
|
23923
23593
|
}
|
23924
23594
|
};
|
23925
23595
|
SQLiteAlterTableRenameColumnConvertor = class extends Convertor {
|
23926
|
-
can(statement,
|
23927
|
-
return statement.type === "alter_table_rename_column" && (
|
23596
|
+
can(statement, dialect4) {
|
23597
|
+
return statement.type === "alter_table_rename_column" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23928
23598
|
}
|
23929
23599
|
convert(statement) {
|
23930
23600
|
const { tableName, oldColumnName, newColumnName } = statement;
|
@@ -23932,8 +23602,8 @@ var init_sqlgenerator = __esm({
|
|
23932
23602
|
}
|
23933
23603
|
};
|
23934
23604
|
PgAlterTableDropColumnConvertor = class extends Convertor {
|
23935
|
-
can(statement,
|
23936
|
-
return statement.type === "alter_table_drop_column" &&
|
23605
|
+
can(statement, dialect4) {
|
23606
|
+
return statement.type === "alter_table_drop_column" && dialect4 === "postgresql";
|
23937
23607
|
}
|
23938
23608
|
convert(statement) {
|
23939
23609
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -23942,8 +23612,8 @@ var init_sqlgenerator = __esm({
|
|
23942
23612
|
}
|
23943
23613
|
};
|
23944
23614
|
MySqlAlterTableDropColumnConvertor = class extends Convertor {
|
23945
|
-
can(statement,
|
23946
|
-
return statement.type === "alter_table_drop_column" &&
|
23615
|
+
can(statement, dialect4) {
|
23616
|
+
return statement.type === "alter_table_drop_column" && dialect4 === "mysql";
|
23947
23617
|
}
|
23948
23618
|
convert(statement) {
|
23949
23619
|
const { tableName, columnName } = statement;
|
@@ -23951,8 +23621,8 @@ var init_sqlgenerator = __esm({
|
|
23951
23621
|
}
|
23952
23622
|
};
|
23953
23623
|
SQLiteAlterTableDropColumnConvertor = class extends Convertor {
|
23954
|
-
can(statement,
|
23955
|
-
return statement.type === "alter_table_drop_column" && (
|
23624
|
+
can(statement, dialect4) {
|
23625
|
+
return statement.type === "alter_table_drop_column" && (dialect4 === "sqlite" || dialect4 === "turso");
|
23956
23626
|
}
|
23957
23627
|
convert(statement) {
|
23958
23628
|
const { tableName, columnName } = statement;
|
@@ -23960,8 +23630,8 @@ var init_sqlgenerator = __esm({
|
|
23960
23630
|
}
|
23961
23631
|
};
|
23962
23632
|
PgAlterTableAddColumnConvertor = class extends Convertor {
|
23963
|
-
can(statement,
|
23964
|
-
return statement.type === "alter_table_add_column" &&
|
23633
|
+
can(statement, dialect4) {
|
23634
|
+
return statement.type === "alter_table_add_column" && dialect4 === "postgresql";
|
23965
23635
|
}
|
23966
23636
|
convert(statement) {
|
23967
23637
|
const { tableName, column: column7, schema: schema5 } = statement;
|
@@ -23980,8 +23650,8 @@ var init_sqlgenerator = __esm({
|
|
23980
23650
|
}
|
23981
23651
|
};
|
23982
23652
|
MySqlAlterTableAddColumnConvertor = class extends Convertor {
|
23983
|
-
can(statement,
|
23984
|
-
return statement.type === "alter_table_add_column" &&
|
23653
|
+
can(statement, dialect4) {
|
23654
|
+
return statement.type === "alter_table_add_column" && dialect4 === "mysql";
|
23985
23655
|
}
|
23986
23656
|
convert(statement) {
|
23987
23657
|
const { tableName, column: column7 } = statement;
|
@@ -24004,8 +23674,8 @@ var init_sqlgenerator = __esm({
|
|
24004
23674
|
}
|
24005
23675
|
};
|
24006
23676
|
SQLiteAlterTableAddColumnConvertor = class extends Convertor {
|
24007
|
-
can(statement,
|
24008
|
-
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");
|
24009
23679
|
}
|
24010
23680
|
convert(statement) {
|
24011
23681
|
const { tableName, column: column7, referenceData } = statement;
|
@@ -24020,8 +23690,8 @@ var init_sqlgenerator = __esm({
|
|
24020
23690
|
}
|
24021
23691
|
};
|
24022
23692
|
PgAlterTableAlterColumnSetTypeConvertor = class extends Convertor {
|
24023
|
-
can(statement,
|
24024
|
-
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";
|
24025
23695
|
}
|
24026
23696
|
convert(statement) {
|
24027
23697
|
const { tableName, columnName, newDataType, schema: schema5 } = statement;
|
@@ -24030,8 +23700,8 @@ var init_sqlgenerator = __esm({
|
|
24030
23700
|
}
|
24031
23701
|
};
|
24032
23702
|
PgAlterTableAlterColumnSetDefaultConvertor = class extends Convertor {
|
24033
|
-
can(statement,
|
24034
|
-
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";
|
24035
23705
|
}
|
24036
23706
|
convert(statement) {
|
24037
23707
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -24040,8 +23710,8 @@ var init_sqlgenerator = __esm({
|
|
24040
23710
|
}
|
24041
23711
|
};
|
24042
23712
|
PgAlterTableAlterColumnDropDefaultConvertor = class extends Convertor {
|
24043
|
-
can(statement,
|
24044
|
-
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";
|
24045
23715
|
}
|
24046
23716
|
convert(statement) {
|
24047
23717
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -24050,8 +23720,8 @@ var init_sqlgenerator = __esm({
|
|
24050
23720
|
}
|
24051
23721
|
};
|
24052
23722
|
PgAlterTableAlterColumnDropGeneratedConvertor = class extends Convertor {
|
24053
|
-
can(statement,
|
24054
|
-
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";
|
24055
23725
|
}
|
24056
23726
|
convert(statement) {
|
24057
23727
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -24060,8 +23730,8 @@ var init_sqlgenerator = __esm({
|
|
24060
23730
|
}
|
24061
23731
|
};
|
24062
23732
|
PgAlterTableAlterColumnSetExpressionConvertor = class extends Convertor {
|
24063
|
-
can(statement,
|
24064
|
-
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";
|
24065
23735
|
}
|
24066
23736
|
convert(statement) {
|
24067
23737
|
const {
|
@@ -24098,8 +23768,8 @@ var init_sqlgenerator = __esm({
|
|
24098
23768
|
}
|
24099
23769
|
};
|
24100
23770
|
PgAlterTableAlterColumnAlterrGeneratedConvertor = class extends Convertor {
|
24101
|
-
can(statement,
|
24102
|
-
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";
|
24103
23773
|
}
|
24104
23774
|
convert(statement) {
|
24105
23775
|
const {
|
@@ -24136,8 +23806,8 @@ var init_sqlgenerator = __esm({
|
|
24136
23806
|
}
|
24137
23807
|
};
|
24138
23808
|
SqliteAlterTableAlterColumnDropGeneratedConvertor = class extends Convertor {
|
24139
|
-
can(statement,
|
24140
|
-
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");
|
24141
23811
|
}
|
24142
23812
|
convert(statement) {
|
24143
23813
|
const {
|
@@ -24177,8 +23847,8 @@ var init_sqlgenerator = __esm({
|
|
24177
23847
|
}
|
24178
23848
|
};
|
24179
23849
|
SqliteAlterTableAlterColumnSetExpressionConvertor = class extends Convertor {
|
24180
|
-
can(statement,
|
24181
|
-
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");
|
24182
23852
|
}
|
24183
23853
|
convert(statement) {
|
24184
23854
|
const {
|
@@ -24218,8 +23888,8 @@ var init_sqlgenerator = __esm({
|
|
24218
23888
|
}
|
24219
23889
|
};
|
24220
23890
|
SqliteAlterTableAlterColumnAlterGeneratedConvertor = class extends Convertor {
|
24221
|
-
can(statement,
|
24222
|
-
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");
|
24223
23893
|
}
|
24224
23894
|
convert(statement) {
|
24225
23895
|
const {
|
@@ -24259,8 +23929,8 @@ var init_sqlgenerator = __esm({
|
|
24259
23929
|
}
|
24260
23930
|
};
|
24261
23931
|
MySqlAlterTableAlterColumnAlterrGeneratedConvertor = class extends Convertor {
|
24262
|
-
can(statement,
|
24263
|
-
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";
|
24264
23934
|
}
|
24265
23935
|
convert(statement) {
|
24266
23936
|
const {
|
@@ -24297,24 +23967,24 @@ var init_sqlgenerator = __esm({
|
|
24297
23967
|
}
|
24298
23968
|
};
|
24299
23969
|
MySqlAlterTableAddPk = class extends Convertor {
|
24300
|
-
can(statement,
|
24301
|
-
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";
|
24302
23972
|
}
|
24303
23973
|
convert(statement) {
|
24304
23974
|
return `ALTER TABLE \`${statement.tableName}\` ADD PRIMARY KEY (\`${statement.columnName}\`);`;
|
24305
23975
|
}
|
24306
23976
|
};
|
24307
23977
|
MySqlAlterTableDropPk = class extends Convertor {
|
24308
|
-
can(statement,
|
24309
|
-
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";
|
24310
23980
|
}
|
24311
23981
|
convert(statement) {
|
24312
23982
|
return `ALTER TABLE \`${statement.tableName}\` DROP PRIMARY KEY`;
|
24313
23983
|
}
|
24314
23984
|
};
|
24315
23985
|
LibSQLModifyColumn = class extends Convertor {
|
24316
|
-
can(statement,
|
24317
|
-
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";
|
24318
23988
|
}
|
24319
23989
|
convert(statement, json2) {
|
24320
23990
|
const { tableName, columnName } = statement;
|
@@ -24374,8 +24044,8 @@ var init_sqlgenerator = __esm({
|
|
24374
24044
|
}
|
24375
24045
|
};
|
24376
24046
|
MySqlModifyColumn = class extends Convertor {
|
24377
|
-
can(statement,
|
24378
|
-
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";
|
24379
24049
|
}
|
24380
24050
|
convert(statement) {
|
24381
24051
|
var _a, _b, _c, _d, _e, _f, _g;
|
@@ -24512,8 +24182,8 @@ var init_sqlgenerator = __esm({
|
|
24512
24182
|
}
|
24513
24183
|
};
|
24514
24184
|
PgAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
|
24515
|
-
can(statement,
|
24516
|
-
return statement.type === "create_composite_pk" &&
|
24185
|
+
can(statement, dialect4) {
|
24186
|
+
return statement.type === "create_composite_pk" && dialect4 === "postgresql";
|
24517
24187
|
}
|
24518
24188
|
convert(statement) {
|
24519
24189
|
const { name, columns } = PgSquasher.unsquashPK(statement.data);
|
@@ -24522,8 +24192,8 @@ var init_sqlgenerator = __esm({
|
|
24522
24192
|
}
|
24523
24193
|
};
|
24524
24194
|
PgAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
|
24525
|
-
can(statement,
|
24526
|
-
return statement.type === "delete_composite_pk" &&
|
24195
|
+
can(statement, dialect4) {
|
24196
|
+
return statement.type === "delete_composite_pk" && dialect4 === "postgresql";
|
24527
24197
|
}
|
24528
24198
|
convert(statement) {
|
24529
24199
|
const { name, columns } = PgSquasher.unsquashPK(statement.data);
|
@@ -24532,8 +24202,8 @@ var init_sqlgenerator = __esm({
|
|
24532
24202
|
}
|
24533
24203
|
};
|
24534
24204
|
PgAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
|
24535
|
-
can(statement,
|
24536
|
-
return statement.type === "alter_composite_pk" &&
|
24205
|
+
can(statement, dialect4) {
|
24206
|
+
return statement.type === "alter_composite_pk" && dialect4 === "postgresql";
|
24537
24207
|
}
|
24538
24208
|
convert(statement) {
|
24539
24209
|
const { name, columns } = PgSquasher.unsquashPK(statement.old);
|
@@ -24546,8 +24216,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24546
24216
|
}
|
24547
24217
|
};
|
24548
24218
|
MySqlAlterTableCreateCompositePrimaryKeyConvertor = class extends Convertor {
|
24549
|
-
can(statement,
|
24550
|
-
return statement.type === "create_composite_pk" &&
|
24219
|
+
can(statement, dialect4) {
|
24220
|
+
return statement.type === "create_composite_pk" && dialect4 === "mysql";
|
24551
24221
|
}
|
24552
24222
|
convert(statement) {
|
24553
24223
|
const { name, columns } = MySqlSquasher.unsquashPK(statement.data);
|
@@ -24555,8 +24225,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24555
24225
|
}
|
24556
24226
|
};
|
24557
24227
|
MySqlAlterTableDeleteCompositePrimaryKeyConvertor = class extends Convertor {
|
24558
|
-
can(statement,
|
24559
|
-
return statement.type === "delete_composite_pk" &&
|
24228
|
+
can(statement, dialect4) {
|
24229
|
+
return statement.type === "delete_composite_pk" && dialect4 === "mysql";
|
24560
24230
|
}
|
24561
24231
|
convert(statement) {
|
24562
24232
|
const { name, columns } = MySqlSquasher.unsquashPK(statement.data);
|
@@ -24564,8 +24234,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24564
24234
|
}
|
24565
24235
|
};
|
24566
24236
|
MySqlAlterTableAlterCompositePrimaryKeyConvertor = class extends Convertor {
|
24567
|
-
can(statement,
|
24568
|
-
return statement.type === "alter_composite_pk" &&
|
24237
|
+
can(statement, dialect4) {
|
24238
|
+
return statement.type === "alter_composite_pk" && dialect4 === "mysql";
|
24569
24239
|
}
|
24570
24240
|
convert(statement) {
|
24571
24241
|
const { name, columns } = MySqlSquasher.unsquashPK(statement.old);
|
@@ -24576,8 +24246,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24576
24246
|
}
|
24577
24247
|
};
|
24578
24248
|
PgAlterTableAlterColumnSetPrimaryKeyConvertor = class extends Convertor {
|
24579
|
-
can(statement,
|
24580
|
-
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";
|
24581
24251
|
}
|
24582
24252
|
convert(statement) {
|
24583
24253
|
const { tableName, columnName } = statement;
|
@@ -24586,8 +24256,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24586
24256
|
}
|
24587
24257
|
};
|
24588
24258
|
PgAlterTableAlterColumnDropPrimaryKeyConvertor = class extends Convertor {
|
24589
|
-
can(statement,
|
24590
|
-
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";
|
24591
24261
|
}
|
24592
24262
|
convert(statement) {
|
24593
24263
|
const { tableName, columnName, schema: schema5 } = statement;
|
@@ -24610,8 +24280,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24610
24280
|
}
|
24611
24281
|
};
|
24612
24282
|
PgAlterTableAlterColumnSetNotNullConvertor = class extends Convertor {
|
24613
|
-
can(statement,
|
24614
|
-
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";
|
24615
24285
|
}
|
24616
24286
|
convert(statement) {
|
24617
24287
|
const { tableName, columnName } = statement;
|
@@ -24620,8 +24290,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24620
24290
|
}
|
24621
24291
|
};
|
24622
24292
|
PgAlterTableAlterColumnDropNotNullConvertor = class extends Convertor {
|
24623
|
-
can(statement,
|
24624
|
-
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";
|
24625
24295
|
}
|
24626
24296
|
convert(statement) {
|
24627
24297
|
const { tableName, columnName } = statement;
|
@@ -24630,8 +24300,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24630
24300
|
}
|
24631
24301
|
};
|
24632
24302
|
PgCreateForeignKeyConvertor = class extends Convertor {
|
24633
|
-
can(statement,
|
24634
|
-
return statement.type === "create_reference" &&
|
24303
|
+
can(statement, dialect4) {
|
24304
|
+
return statement.type === "create_reference" && dialect4 === "postgresql";
|
24635
24305
|
}
|
24636
24306
|
convert(statement) {
|
24637
24307
|
const {
|
@@ -24660,8 +24330,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24660
24330
|
}
|
24661
24331
|
};
|
24662
24332
|
LibSQLCreateForeignKeyConvertor = class extends Convertor {
|
24663
|
-
can(statement,
|
24664
|
-
return statement.type === "create_reference" &&
|
24333
|
+
can(statement, dialect4) {
|
24334
|
+
return statement.type === "create_reference" && dialect4 === "turso";
|
24665
24335
|
}
|
24666
24336
|
convert(statement, json2, action) {
|
24667
24337
|
const { columnsFrom, columnsTo, tableFrom, onDelete, onUpdate, tableTo } = action === "push" ? SQLiteSquasher.unsquashPushFK(statement.data) : SQLiteSquasher.unsquashFK(statement.data);
|
@@ -24677,8 +24347,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24677
24347
|
}
|
24678
24348
|
};
|
24679
24349
|
MySqlCreateForeignKeyConvertor = class extends Convertor {
|
24680
|
-
can(statement,
|
24681
|
-
return statement.type === "create_reference" &&
|
24350
|
+
can(statement, dialect4) {
|
24351
|
+
return statement.type === "create_reference" && dialect4 === "mysql";
|
24682
24352
|
}
|
24683
24353
|
convert(statement) {
|
24684
24354
|
const {
|
@@ -24698,8 +24368,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24698
24368
|
}
|
24699
24369
|
};
|
24700
24370
|
PgAlterForeignKeyConvertor = class extends Convertor {
|
24701
|
-
can(statement,
|
24702
|
-
return statement.type === "alter_reference" &&
|
24371
|
+
can(statement, dialect4) {
|
24372
|
+
return statement.type === "alter_reference" && dialect4 === "postgresql";
|
24703
24373
|
}
|
24704
24374
|
convert(statement) {
|
24705
24375
|
const newFk = PgSquasher.unsquashFK(statement.data);
|
@@ -24723,8 +24393,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24723
24393
|
}
|
24724
24394
|
};
|
24725
24395
|
PgDeleteForeignKeyConvertor = class extends Convertor {
|
24726
|
-
can(statement,
|
24727
|
-
return statement.type === "delete_reference" &&
|
24396
|
+
can(statement, dialect4) {
|
24397
|
+
return statement.type === "delete_reference" && dialect4 === "postgresql";
|
24728
24398
|
}
|
24729
24399
|
convert(statement) {
|
24730
24400
|
const tableFrom = statement.tableName;
|
@@ -24735,8 +24405,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24735
24405
|
}
|
24736
24406
|
};
|
24737
24407
|
MySqlDeleteForeignKeyConvertor = class extends Convertor {
|
24738
|
-
can(statement,
|
24739
|
-
return statement.type === "delete_reference" &&
|
24408
|
+
can(statement, dialect4) {
|
24409
|
+
return statement.type === "delete_reference" && dialect4 === "mysql";
|
24740
24410
|
}
|
24741
24411
|
convert(statement) {
|
24742
24412
|
const tableFrom = statement.tableName;
|
@@ -24746,8 +24416,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24746
24416
|
}
|
24747
24417
|
};
|
24748
24418
|
CreatePgIndexConvertor = class extends Convertor {
|
24749
|
-
can(statement,
|
24750
|
-
return statement.type === "create_index_pg" &&
|
24419
|
+
can(statement, dialect4) {
|
24420
|
+
return statement.type === "create_index_pg" && dialect4 === "postgresql";
|
24751
24421
|
}
|
24752
24422
|
convert(statement) {
|
24753
24423
|
const {
|
@@ -24778,8 +24448,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24778
24448
|
}
|
24779
24449
|
};
|
24780
24450
|
CreateMySqlIndexConvertor = class extends Convertor {
|
24781
|
-
can(statement,
|
24782
|
-
return statement.type === "create_index" &&
|
24451
|
+
can(statement, dialect4) {
|
24452
|
+
return statement.type === "create_index" && dialect4 === "mysql";
|
24783
24453
|
}
|
24784
24454
|
convert(statement) {
|
24785
24455
|
const { name, columns, isUnique } = MySqlSquasher.unsquashIdx(
|
@@ -24794,8 +24464,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24794
24464
|
}
|
24795
24465
|
};
|
24796
24466
|
CreateSqliteIndexConvertor = class extends Convertor {
|
24797
|
-
can(statement,
|
24798
|
-
return statement.type === "create_index" && (
|
24467
|
+
can(statement, dialect4) {
|
24468
|
+
return statement.type === "create_index" && (dialect4 === "sqlite" || dialect4 === "turso");
|
24799
24469
|
}
|
24800
24470
|
convert(statement) {
|
24801
24471
|
const { name, columns, isUnique, where } = SQLiteSquasher.unsquashIdx(
|
@@ -24811,8 +24481,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24811
24481
|
}
|
24812
24482
|
};
|
24813
24483
|
PgDropIndexConvertor = class extends Convertor {
|
24814
|
-
can(statement,
|
24815
|
-
return statement.type === "drop_index" &&
|
24484
|
+
can(statement, dialect4) {
|
24485
|
+
return statement.type === "drop_index" && dialect4 === "postgresql";
|
24816
24486
|
}
|
24817
24487
|
convert(statement) {
|
24818
24488
|
const { name } = PgSquasher.unsquashIdx(statement.data);
|
@@ -24820,8 +24490,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24820
24490
|
}
|
24821
24491
|
};
|
24822
24492
|
PgCreateSchemaConvertor = class extends Convertor {
|
24823
|
-
can(statement,
|
24824
|
-
return statement.type === "create_schema" &&
|
24493
|
+
can(statement, dialect4) {
|
24494
|
+
return statement.type === "create_schema" && dialect4 === "postgresql";
|
24825
24495
|
}
|
24826
24496
|
convert(statement) {
|
24827
24497
|
const { name } = statement;
|
@@ -24830,8 +24500,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24830
24500
|
}
|
24831
24501
|
};
|
24832
24502
|
PgRenameSchemaConvertor = class extends Convertor {
|
24833
|
-
can(statement,
|
24834
|
-
return statement.type === "rename_schema" &&
|
24503
|
+
can(statement, dialect4) {
|
24504
|
+
return statement.type === "rename_schema" && dialect4 === "postgresql";
|
24835
24505
|
}
|
24836
24506
|
convert(statement) {
|
24837
24507
|
const { from, to } = statement;
|
@@ -24840,8 +24510,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24840
24510
|
}
|
24841
24511
|
};
|
24842
24512
|
PgDropSchemaConvertor = class extends Convertor {
|
24843
|
-
can(statement,
|
24844
|
-
return statement.type === "drop_schema" &&
|
24513
|
+
can(statement, dialect4) {
|
24514
|
+
return statement.type === "drop_schema" && dialect4 === "postgresql";
|
24845
24515
|
}
|
24846
24516
|
convert(statement) {
|
24847
24517
|
const { name } = statement;
|
@@ -24850,8 +24520,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24850
24520
|
}
|
24851
24521
|
};
|
24852
24522
|
PgAlterTableSetSchemaConvertor = class extends Convertor {
|
24853
|
-
can(statement,
|
24854
|
-
return statement.type === "alter_table_set_schema" &&
|
24523
|
+
can(statement, dialect4) {
|
24524
|
+
return statement.type === "alter_table_set_schema" && dialect4 === "postgresql";
|
24855
24525
|
}
|
24856
24526
|
convert(statement) {
|
24857
24527
|
const { tableName, schemaFrom, schemaTo } = statement;
|
@@ -24860,8 +24530,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24860
24530
|
}
|
24861
24531
|
};
|
24862
24532
|
PgAlterTableSetNewSchemaConvertor = class extends Convertor {
|
24863
|
-
can(statement,
|
24864
|
-
return statement.type === "alter_table_set_new_schema" &&
|
24533
|
+
can(statement, dialect4) {
|
24534
|
+
return statement.type === "alter_table_set_new_schema" && dialect4 === "postgresql";
|
24865
24535
|
}
|
24866
24536
|
convert(statement) {
|
24867
24537
|
const { tableName, to, from } = statement;
|
@@ -24871,8 +24541,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24871
24541
|
}
|
24872
24542
|
};
|
24873
24543
|
PgAlterTableRemoveFromSchemaConvertor = class extends Convertor {
|
24874
|
-
can(statement,
|
24875
|
-
return statement.type === "alter_table_remove_from_schema" &&
|
24544
|
+
can(statement, dialect4) {
|
24545
|
+
return statement.type === "alter_table_remove_from_schema" && dialect4 === "postgresql";
|
24876
24546
|
}
|
24877
24547
|
convert(statement) {
|
24878
24548
|
const { tableName, schema: schema5 } = statement;
|
@@ -24882,8 +24552,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24882
24552
|
}
|
24883
24553
|
};
|
24884
24554
|
SqliteDropIndexConvertor = class extends Convertor {
|
24885
|
-
can(statement,
|
24886
|
-
return statement.type === "drop_index" && (
|
24555
|
+
can(statement, dialect4) {
|
24556
|
+
return statement.type === "drop_index" && (dialect4 === "sqlite" || dialect4 === "turso");
|
24887
24557
|
}
|
24888
24558
|
convert(statement) {
|
24889
24559
|
const { name } = PgSquasher.unsquashIdx(statement.data);
|
@@ -24891,8 +24561,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24891
24561
|
}
|
24892
24562
|
};
|
24893
24563
|
MySqlDropIndexConvertor = class extends Convertor {
|
24894
|
-
can(statement,
|
24895
|
-
return statement.type === "drop_index" &&
|
24564
|
+
can(statement, dialect4) {
|
24565
|
+
return statement.type === "drop_index" && dialect4 === "mysql";
|
24896
24566
|
}
|
24897
24567
|
convert(statement) {
|
24898
24568
|
const { name } = MySqlSquasher.unsquashIdx(statement.data);
|
@@ -24900,8 +24570,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24900
24570
|
}
|
24901
24571
|
};
|
24902
24572
|
SQLiteRecreateTableConvertor = class extends Convertor {
|
24903
|
-
can(statement,
|
24904
|
-
return statement.type === "recreate_table" &&
|
24573
|
+
can(statement, dialect4) {
|
24574
|
+
return statement.type === "recreate_table" && dialect4 === "sqlite";
|
24905
24575
|
}
|
24906
24576
|
convert(statement) {
|
24907
24577
|
const { tableName, columns, compositePKs, referenceData } = statement;
|
@@ -24942,8 +24612,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
24942
24612
|
}
|
24943
24613
|
};
|
24944
24614
|
LibSQLRecreateTableConvertor = class extends Convertor {
|
24945
|
-
can(statement,
|
24946
|
-
return statement.type === "recreate_table" &&
|
24615
|
+
can(statement, dialect4) {
|
24616
|
+
return statement.type === "recreate_table" && dialect4 === "turso";
|
24947
24617
|
}
|
24948
24618
|
convert(statement) {
|
24949
24619
|
const { tableName, columns, compositePKs, referenceData } = statement;
|
@@ -25028,16 +24698,6 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
25028
24698
|
convertors.push(new PgAlterTableAlterColumnDropNotNullConvertor());
|
25029
24699
|
convertors.push(new PgAlterTableAlterColumnSetDefaultConvertor());
|
25030
24700
|
convertors.push(new PgAlterTableAlterColumnDropDefaultConvertor());
|
25031
|
-
convertors.push(new PgAlterPolicyConvertor());
|
25032
|
-
convertors.push(new PgCreatePolicyConvertor());
|
25033
|
-
convertors.push(new PgDropPolicyConvertor());
|
25034
|
-
convertors.push(new PgRenamePolicyConvertor());
|
25035
|
-
convertors.push(new PgEnableRlsConvertor());
|
25036
|
-
convertors.push(new PgDisableRlsConvertor());
|
25037
|
-
convertors.push(new PgDropRoleConvertor());
|
25038
|
-
convertors.push(new PgAlterRoleConvertor());
|
25039
|
-
convertors.push(new PgCreateRoleConvertor());
|
25040
|
-
convertors.push(new PgRenameRoleConvertor());
|
25041
24701
|
convertors.push(new PgAlterTableAlterColumnSetExpressionConvertor());
|
25042
24702
|
convertors.push(new PgAlterTableAlterColumnDropGeneratedConvertor());
|
25043
24703
|
convertors.push(new PgAlterTableAlterColumnAlterrGeneratedConvertor());
|
@@ -25333,7 +24993,7 @@ var init_sqlitePushUtils = __esm({
|
|
25333
24993
|
});
|
25334
24994
|
|
25335
24995
|
// src/jsonStatements.ts
|
25336
|
-
var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson,
|
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;
|
25337
24997
|
var init_jsonStatements = __esm({
|
25338
24998
|
"src/jsonStatements.ts"() {
|
25339
24999
|
"use strict";
|
@@ -25344,7 +25004,7 @@ var init_jsonStatements = __esm({
|
|
25344
25004
|
init_pgSchema();
|
25345
25005
|
init_sqliteSchema();
|
25346
25006
|
preparePgCreateTableJson = (table4, json2) => {
|
25347
|
-
const { name, schema: schema5, columns, compositePrimaryKeys, uniqueConstraints
|
25007
|
+
const { name, schema: schema5, columns, compositePrimaryKeys, uniqueConstraints } = table4;
|
25348
25008
|
const tableKey2 = `${schema5 || "public"}.${name}`;
|
25349
25009
|
const compositePkName = Object.values(compositePrimaryKeys).length > 0 ? json2.tables[tableKey2].compositePrimaryKeys[`${PgSquasher.unsquashPK(Object.values(compositePrimaryKeys)[0]).name}`].name : "";
|
25350
25010
|
return {
|
@@ -25354,8 +25014,7 @@ var init_jsonStatements = __esm({
|
|
25354
25014
|
columns: Object.values(columns),
|
25355
25015
|
compositePKs: Object.values(compositePrimaryKeys),
|
25356
25016
|
compositePkName,
|
25357
|
-
uniqueConstraints: Object.values(uniqueConstraints)
|
25358
|
-
policies: Object.values(policies)
|
25017
|
+
uniqueConstraints: Object.values(uniqueConstraints)
|
25359
25018
|
};
|
25360
25019
|
};
|
25361
25020
|
prepareMySqlCreateTableJson = (table4, json2, internals) => {
|
@@ -25393,8 +25052,7 @@ var init_jsonStatements = __esm({
|
|
25393
25052
|
return {
|
25394
25053
|
type: "drop_table",
|
25395
25054
|
tableName: table4.name,
|
25396
|
-
schema: table4.schema
|
25397
|
-
policies: table4.policies ? Object.values(table4.policies) : []
|
25055
|
+
schema: table4.schema
|
25398
25056
|
};
|
25399
25057
|
};
|
25400
25058
|
prepareRenameTableJson = (tableFrom, tableTo) => {
|
@@ -25491,41 +25149,6 @@ var init_jsonStatements = __esm({
|
|
25491
25149
|
schema: schema5
|
25492
25150
|
};
|
25493
25151
|
};
|
25494
|
-
prepareCreateRoleJson = (role) => {
|
25495
|
-
return {
|
25496
|
-
type: "create_role",
|
25497
|
-
name: role.name,
|
25498
|
-
values: {
|
25499
|
-
createDb: role.createDb,
|
25500
|
-
createRole: role.createRole,
|
25501
|
-
inherit: role.inherit
|
25502
|
-
}
|
25503
|
-
};
|
25504
|
-
};
|
25505
|
-
prepareAlterRoleJson = (role) => {
|
25506
|
-
return {
|
25507
|
-
type: "alter_role",
|
25508
|
-
name: role.name,
|
25509
|
-
values: {
|
25510
|
-
createDb: role.createDb,
|
25511
|
-
createRole: role.createRole,
|
25512
|
-
inherit: role.inherit
|
25513
|
-
}
|
25514
|
-
};
|
25515
|
-
};
|
25516
|
-
prepareDropRoleJson = (name) => {
|
25517
|
-
return {
|
25518
|
-
type: "drop_role",
|
25519
|
-
name
|
25520
|
-
};
|
25521
|
-
};
|
25522
|
-
prepareRenameRoleJson = (nameFrom, nameTo) => {
|
25523
|
-
return {
|
25524
|
-
type: "rename_role",
|
25525
|
-
nameFrom,
|
25526
|
-
nameTo
|
25527
|
-
};
|
25528
|
-
};
|
25529
25152
|
prepareCreateSchemasJson = (values) => {
|
25530
25153
|
return values.map((it) => {
|
25531
25154
|
return {
|
@@ -26426,46 +26049,6 @@ var init_jsonStatements = __esm({
|
|
26426
26049
|
}
|
26427
26050
|
return [...dropPkStatements, ...setPkStatements, ...statements];
|
26428
26051
|
};
|
26429
|
-
prepareRenamePolicyJsons = (tableName, schema5, renames) => {
|
26430
|
-
return renames.map((it) => {
|
26431
|
-
return {
|
26432
|
-
type: "rename_policy",
|
26433
|
-
tableName,
|
26434
|
-
oldName: it.from.name,
|
26435
|
-
newName: it.to.name,
|
26436
|
-
schema: schema5
|
26437
|
-
};
|
26438
|
-
});
|
26439
|
-
};
|
26440
|
-
prepareCreatePolicyJsons = (tableName, schema5, policies) => {
|
26441
|
-
return policies.map((it) => {
|
26442
|
-
return {
|
26443
|
-
type: "create_policy",
|
26444
|
-
tableName,
|
26445
|
-
data: it,
|
26446
|
-
schema: schema5
|
26447
|
-
};
|
26448
|
-
});
|
26449
|
-
};
|
26450
|
-
prepareDropPolicyJsons = (tableName, schema5, policies) => {
|
26451
|
-
return policies.map((it) => {
|
26452
|
-
return {
|
26453
|
-
type: "drop_policy",
|
26454
|
-
tableName,
|
26455
|
-
data: it,
|
26456
|
-
schema: schema5
|
26457
|
-
};
|
26458
|
-
});
|
26459
|
-
};
|
26460
|
-
prepareAlterPolicyJson = (tableName, schema5, oldPolicy, newPolicy) => {
|
26461
|
-
return {
|
26462
|
-
type: "alter_policy",
|
26463
|
-
tableName,
|
26464
|
-
oldData: oldPolicy,
|
26465
|
-
newData: newPolicy,
|
26466
|
-
schema: schema5
|
26467
|
-
};
|
26468
|
-
};
|
26469
26052
|
preparePgCreateIndexesJson = (tableName, schema5, indexes, fullSchema, action) => {
|
26470
26053
|
if (action === "push") {
|
26471
26054
|
return Object.values(indexes).map((indexData) => {
|
@@ -27139,8 +26722,7 @@ var init_snapshotsDiffer = __esm({
|
|
27139
26722
|
indexes: recordType(stringType(), stringType()),
|
27140
26723
|
foreignKeys: recordType(stringType(), stringType()),
|
27141
26724
|
compositePrimaryKeys: recordType(stringType(), stringType()).default({}),
|
27142
|
-
uniqueConstraints: recordType(stringType(), stringType()).default({})
|
27143
|
-
policies: recordType(stringType(), stringType()).default({})
|
26725
|
+
uniqueConstraints: recordType(stringType(), stringType()).default({})
|
27144
26726
|
}).strict();
|
27145
26727
|
alteredTableScheme = objectType({
|
27146
26728
|
name: stringType(),
|
@@ -27181,22 +26763,12 @@ var init_snapshotsDiffer = __esm({
|
|
27181
26763
|
__new: stringType(),
|
27182
26764
|
__old: stringType()
|
27183
26765
|
})
|
27184
|
-
),
|
27185
|
-
addedPolicies: recordType(stringType(), stringType()),
|
27186
|
-
deletedPolicies: recordType(stringType(), stringType()),
|
27187
|
-
alteredPolicies: recordType(
|
27188
|
-
stringType(),
|
27189
|
-
objectType({
|
27190
|
-
__new: stringType(),
|
27191
|
-
__old: stringType()
|
27192
|
-
})
|
27193
26766
|
)
|
27194
26767
|
}).strict();
|
27195
26768
|
diffResultScheme = objectType({
|
27196
26769
|
alteredTablesWithColumns: alteredTableScheme.array(),
|
27197
26770
|
alteredEnums: changedEnumSchema.array(),
|
27198
|
-
alteredSequences: sequenceSquashed.array()
|
27199
|
-
alteredRoles: roleSchema.array()
|
26771
|
+
alteredSequences: sequenceSquashed.array()
|
27200
26772
|
}).strict();
|
27201
26773
|
diffResultSchemeMysql = objectType({
|
27202
26774
|
alteredTablesWithColumns: alteredTableScheme.array(),
|
@@ -27251,7 +26823,7 @@ var init_snapshotsDiffer = __esm({
|
|
27251
26823
|
}
|
27252
26824
|
return column7;
|
27253
26825
|
};
|
27254
|
-
applyPgSnapshotsDiff = async (json1, json2, schemasResolver2, enumsResolver2, sequencesResolver2,
|
26826
|
+
applyPgSnapshotsDiff = async (json1, json2, schemasResolver2, enumsResolver2, sequencesResolver2, tablesResolver2, columnsResolver2, prevFull, curFull, action) => {
|
27255
26827
|
const schemasDiff = diffSchemasOrTables(json1.schemas, json2.schemas);
|
27256
26828
|
const {
|
27257
26829
|
created: createdSchemas,
|
@@ -27401,47 +26973,6 @@ var init_snapshotsDiffer = __esm({
|
|
27401
26973
|
return [tableKey2, tableValue];
|
27402
26974
|
}
|
27403
26975
|
);
|
27404
|
-
const rolesDiff = diffSchemasOrTables(
|
27405
|
-
schemasPatchedSnap1.roles,
|
27406
|
-
json2.roles
|
27407
|
-
);
|
27408
|
-
const {
|
27409
|
-
created: createdRoles,
|
27410
|
-
deleted: deletedRoles,
|
27411
|
-
renamed: renamedRoles
|
27412
|
-
} = await roleResolver2({
|
27413
|
-
created: rolesDiff.added,
|
27414
|
-
deleted: rolesDiff.deleted
|
27415
|
-
});
|
27416
|
-
schemasPatchedSnap1.roles = mapEntries(
|
27417
|
-
schemasPatchedSnap1.roles,
|
27418
|
-
(_2, it) => {
|
27419
|
-
const { name } = nameChangeFor(it, renamedRoles);
|
27420
|
-
it.name = name;
|
27421
|
-
return [name, it];
|
27422
|
-
}
|
27423
|
-
);
|
27424
|
-
const rolesChangeMap = renamedRoles.reduce(
|
27425
|
-
(acc, it) => {
|
27426
|
-
acc[it.from.name] = {
|
27427
|
-
nameFrom: it.from.name,
|
27428
|
-
nameTo: it.to.name
|
27429
|
-
};
|
27430
|
-
return acc;
|
27431
|
-
},
|
27432
|
-
{}
|
27433
|
-
);
|
27434
|
-
schemasPatchedSnap1.roles = mapEntries(
|
27435
|
-
schemasPatchedSnap1.roles,
|
27436
|
-
(roleKey, roleValue) => {
|
27437
|
-
const key = roleKey;
|
27438
|
-
const change = rolesChangeMap[key];
|
27439
|
-
if (change) {
|
27440
|
-
roleValue.name = change.nameTo;
|
27441
|
-
}
|
27442
|
-
return [roleKey, roleValue];
|
27443
|
-
}
|
27444
|
-
);
|
27445
26976
|
const tablesDiff = diffSchemasOrTables(
|
27446
26977
|
schemasPatchedSnap1.tables,
|
27447
26978
|
json2.tables
|
@@ -27520,65 +27051,6 @@ var init_snapshotsDiffer = __esm({
|
|
27520
27051
|
return [tableKey2, tableValue];
|
27521
27052
|
}
|
27522
27053
|
);
|
27523
|
-
const policyRes = diffPolicies(tablesPatchedSnap1.tables, json2.tables);
|
27524
|
-
const policyRenames = [];
|
27525
|
-
const policyCreates = [];
|
27526
|
-
const policyDeletes = [];
|
27527
|
-
for (let entry of Object.values(policyRes)) {
|
27528
|
-
const { renamed, created, deleted } = await policyResolver2({
|
27529
|
-
tableName: entry.name,
|
27530
|
-
schema: entry.schema,
|
27531
|
-
deleted: entry.policies.deleted.map(PgSquasher.unsquashPolicy),
|
27532
|
-
created: entry.policies.added.map(PgSquasher.unsquashPolicy)
|
27533
|
-
});
|
27534
|
-
if (created.length > 0) {
|
27535
|
-
policyCreates.push({
|
27536
|
-
table: entry.name,
|
27537
|
-
schema: entry.schema,
|
27538
|
-
columns: created
|
27539
|
-
});
|
27540
|
-
}
|
27541
|
-
if (deleted.length > 0) {
|
27542
|
-
policyDeletes.push({
|
27543
|
-
table: entry.name,
|
27544
|
-
schema: entry.schema,
|
27545
|
-
columns: deleted
|
27546
|
-
});
|
27547
|
-
}
|
27548
|
-
if (renamed.length > 0) {
|
27549
|
-
policyRenames.push({
|
27550
|
-
table: entry.name,
|
27551
|
-
schema: entry.schema,
|
27552
|
-
renames: renamed
|
27553
|
-
});
|
27554
|
-
}
|
27555
|
-
}
|
27556
|
-
const policyRenamesDict = columnRenames.reduce(
|
27557
|
-
(acc, it) => {
|
27558
|
-
acc[`${it.schema || "public"}.${it.table}`] = it.renames;
|
27559
|
-
return acc;
|
27560
|
-
},
|
27561
|
-
{}
|
27562
|
-
);
|
27563
|
-
const policyPatchedSnap1 = copy(tablesPatchedSnap1);
|
27564
|
-
policyPatchedSnap1.tables = mapEntries(
|
27565
|
-
policyPatchedSnap1.tables,
|
27566
|
-
(tableKey2, tableValue) => {
|
27567
|
-
const patchedPolicies = mapKeys(
|
27568
|
-
tableValue.policies,
|
27569
|
-
(policyKey, policy2) => {
|
27570
|
-
const rens = policyRenamesDict[`${tableValue.schema || "public"}.${tableValue.name}`] || [];
|
27571
|
-
const newName = columnChangeFor(policyKey, rens);
|
27572
|
-
const unsquashedPolicy = PgSquasher.unsquashPolicy(policy2);
|
27573
|
-
unsquashedPolicy.name = newName;
|
27574
|
-
policy2 = PgSquasher.squashPolicy(unsquashedPolicy);
|
27575
|
-
return newName;
|
27576
|
-
}
|
27577
|
-
);
|
27578
|
-
tableValue.policies = patchedPolicies;
|
27579
|
-
return [tableKey2, tableValue];
|
27580
|
-
}
|
27581
|
-
);
|
27582
27054
|
const diffResult = applyJsonDiff(columnsPatchedSnap1, json2);
|
27583
27055
|
const typedResult = diffResultScheme.parse(diffResult);
|
27584
27056
|
const jsonStatements = [];
|
@@ -27734,99 +27206,7 @@ var init_snapshotsDiffer = __esm({
|
|
27734
27206
|
it.deletedIndexes || {}
|
27735
27207
|
);
|
27736
27208
|
}).flat();
|
27737
|
-
const jsonCreatePoliciesStatements = [];
|
27738
|
-
const jsonDropPoliciesStatements = [];
|
27739
|
-
const jsonAlterPoliciesStatements = [];
|
27740
|
-
const jsonRenamePoliciesStatements = [];
|
27741
|
-
const jsonEnableRLSStatements = [];
|
27742
|
-
const jsonDisableRLSStatements = [];
|
27743
|
-
for (let it of policyRenames) {
|
27744
|
-
jsonRenamePoliciesStatements.push(
|
27745
|
-
...prepareRenamePolicyJsons(it.table, it.schema, it.renames)
|
27746
|
-
);
|
27747
|
-
}
|
27748
|
-
for (const it of policyCreates) {
|
27749
|
-
jsonCreatePoliciesStatements.push(
|
27750
|
-
...prepareCreatePolicyJsons(
|
27751
|
-
it.table,
|
27752
|
-
it.schema,
|
27753
|
-
it.columns
|
27754
|
-
)
|
27755
|
-
);
|
27756
|
-
}
|
27757
|
-
for (const it of policyDeletes) {
|
27758
|
-
jsonDropPoliciesStatements.push(
|
27759
|
-
...prepareDropPolicyJsons(
|
27760
|
-
it.table,
|
27761
|
-
it.schema,
|
27762
|
-
it.columns
|
27763
|
-
)
|
27764
|
-
);
|
27765
|
-
}
|
27766
27209
|
alteredTables.forEach((it) => {
|
27767
|
-
Object.keys(it.alteredPolicies).forEach((policyName) => {
|
27768
|
-
const newPolicy = PgSquasher.unsquashPolicy(it.alteredPolicies[policyName].__new);
|
27769
|
-
const oldPolicy = PgSquasher.unsquashPolicy(it.alteredPolicies[policyName].__old);
|
27770
|
-
if (newPolicy.as !== oldPolicy.as) {
|
27771
|
-
jsonDropPoliciesStatements.push(
|
27772
|
-
...prepareDropPolicyJsons(
|
27773
|
-
it.name,
|
27774
|
-
it.schema,
|
27775
|
-
[oldPolicy]
|
27776
|
-
)
|
27777
|
-
);
|
27778
|
-
jsonCreatePoliciesStatements.push(
|
27779
|
-
...prepareCreatePolicyJsons(
|
27780
|
-
it.name,
|
27781
|
-
it.schema,
|
27782
|
-
[newPolicy]
|
27783
|
-
)
|
27784
|
-
);
|
27785
|
-
return;
|
27786
|
-
}
|
27787
|
-
if (newPolicy.for !== oldPolicy.for) {
|
27788
|
-
jsonDropPoliciesStatements.push(
|
27789
|
-
...prepareDropPolicyJsons(
|
27790
|
-
it.name,
|
27791
|
-
it.schema,
|
27792
|
-
[oldPolicy]
|
27793
|
-
)
|
27794
|
-
);
|
27795
|
-
jsonCreatePoliciesStatements.push(
|
27796
|
-
...prepareCreatePolicyJsons(
|
27797
|
-
it.name,
|
27798
|
-
it.schema,
|
27799
|
-
[newPolicy]
|
27800
|
-
)
|
27801
|
-
);
|
27802
|
-
return;
|
27803
|
-
}
|
27804
|
-
jsonAlterPoliciesStatements.push(
|
27805
|
-
prepareAlterPolicyJson(
|
27806
|
-
it.name,
|
27807
|
-
it.schema,
|
27808
|
-
it.alteredPolicies[policyName].__old,
|
27809
|
-
it.alteredPolicies[policyName].__new
|
27810
|
-
)
|
27811
|
-
);
|
27812
|
-
});
|
27813
|
-
for (const table4 of Object.values(json2.tables)) {
|
27814
|
-
const policiesInCurrentState = Object.keys(table4.policies);
|
27815
|
-
const tableInPreviousState = columnsPatchedSnap1.tables[`${table4.schema === "" ? "public" : table4.schema}.${table4.name}`];
|
27816
|
-
const policiesInPreviousState = tableInPreviousState ? Object.keys(tableInPreviousState.policies) : [];
|
27817
|
-
if (policiesInPreviousState.length === 0 && policiesInCurrentState.length > 0) {
|
27818
|
-
jsonEnableRLSStatements.push({ type: "enable_rls", tableName: table4.name, schema: table4.schema });
|
27819
|
-
}
|
27820
|
-
if (policiesInPreviousState.length > 0 && policiesInCurrentState.length === 0) {
|
27821
|
-
jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
|
27822
|
-
}
|
27823
|
-
}
|
27824
|
-
for (const table4 of Object.values(columnsPatchedSnap1.tables)) {
|
27825
|
-
const tableInCurrentState = json2.tables[`${table4.schema === "" ? "public" : table4.schema}.${table4.name}`];
|
27826
|
-
if (tableInCurrentState === void 0) {
|
27827
|
-
jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
|
27828
|
-
}
|
27829
|
-
}
|
27830
27210
|
const droppedIndexes = Object.keys(it.alteredIndexes).reduce(
|
27831
27211
|
(current, item) => {
|
27832
27212
|
current[item] = it.alteredIndexes[item].__old;
|
@@ -27911,18 +27291,6 @@ var init_snapshotsDiffer = __esm({
|
|
27911
27291
|
const jsonAlterSequences = typedResult.alteredSequences.map((it) => {
|
27912
27292
|
return prepareAlterSequenceJson(it);
|
27913
27293
|
}).flat() ?? [];
|
27914
|
-
const createRoles = createdRoles.map((it) => {
|
27915
|
-
return prepareCreateRoleJson(it);
|
27916
|
-
}) ?? [];
|
27917
|
-
const dropRoles = deletedRoles.map((it) => {
|
27918
|
-
return prepareDropRoleJson(it.name);
|
27919
|
-
});
|
27920
|
-
const renameRoles = renamedRoles.map((it) => {
|
27921
|
-
return prepareRenameRoleJson(it.from.name, it.to.name);
|
27922
|
-
});
|
27923
|
-
const jsonAlterRoles = typedResult.alteredRoles.map((it) => {
|
27924
|
-
return prepareAlterRoleJson(it);
|
27925
|
-
}).flat() ?? [];
|
27926
27294
|
const createSchemas = prepareCreateSchemasJson(
|
27927
27295
|
createdSchemas.map((it) => it.name)
|
27928
27296
|
);
|
@@ -27935,11 +27303,6 @@ var init_snapshotsDiffer = __esm({
|
|
27935
27303
|
const createTables = createdTables.map((it) => {
|
27936
27304
|
return preparePgCreateTableJson(it, curFull);
|
27937
27305
|
});
|
27938
|
-
jsonCreatePoliciesStatements.push(...[].concat(
|
27939
|
-
...createdTables.map(
|
27940
|
-
(it) => prepareCreatePolicyJsons(it.name, it.schema, Object.values(it.policies).map(PgSquasher.unsquashPolicy))
|
27941
|
-
)
|
27942
|
-
));
|
27943
27306
|
jsonStatements.push(...createSchemas);
|
27944
27307
|
jsonStatements.push(...renameSchemas);
|
27945
27308
|
jsonStatements.push(...createEnums);
|
@@ -27950,13 +27313,7 @@ var init_snapshotsDiffer = __esm({
|
|
27950
27313
|
jsonStatements.push(...moveSequences);
|
27951
27314
|
jsonStatements.push(...renameSequences);
|
27952
27315
|
jsonStatements.push(...jsonAlterSequences);
|
27953
|
-
jsonStatements.push(...renameRoles);
|
27954
|
-
jsonStatements.push(...dropRoles);
|
27955
|
-
jsonStatements.push(...createRoles);
|
27956
|
-
jsonStatements.push(...jsonAlterRoles);
|
27957
27316
|
jsonStatements.push(...createTables);
|
27958
|
-
jsonStatements.push(...jsonEnableRLSStatements);
|
27959
|
-
jsonStatements.push(...jsonDisableRLSStatements);
|
27960
27317
|
jsonStatements.push(...jsonDropTables);
|
27961
27318
|
jsonStatements.push(...jsonSetTableSchemas);
|
27962
27319
|
jsonStatements.push(...jsonRenameTables);
|
@@ -27976,10 +27333,6 @@ var init_snapshotsDiffer = __esm({
|
|
27976
27333
|
jsonStatements.push(...jsonAlteredCompositePKs);
|
27977
27334
|
jsonStatements.push(...jsonAddedUniqueConstraints);
|
27978
27335
|
jsonStatements.push(...jsonAlteredUniqueConstraints);
|
27979
|
-
jsonStatements.push(...jsonRenamePoliciesStatements);
|
27980
|
-
jsonStatements.push(...jsonDropPoliciesStatements);
|
27981
|
-
jsonStatements.push(...jsonCreatePoliciesStatements);
|
27982
|
-
jsonStatements.push(...jsonAlterPoliciesStatements);
|
27983
27336
|
jsonStatements.push(...dropEnums);
|
27984
27337
|
jsonStatements.push(...dropSequences);
|
27985
27338
|
jsonStatements.push(...dropSchemas);
|
@@ -30243,7 +29596,6 @@ __export(migrate_exports, {
|
|
30243
29596
|
columnsResolver: () => columnsResolver,
|
30244
29597
|
embeddedMigrations: () => embeddedMigrations,
|
30245
29598
|
enumsResolver: () => enumsResolver,
|
30246
|
-
policyResolver: () => policyResolver,
|
30247
29599
|
prepareAndMigrateLibSQL: () => prepareAndMigrateLibSQL,
|
30248
29600
|
prepareAndMigrateMysql: () => prepareAndMigrateMysql,
|
30249
29601
|
prepareAndMigratePg: () => prepareAndMigratePg,
|
@@ -30254,16 +29606,14 @@ __export(migrate_exports, {
|
|
30254
29606
|
prepareSQLitePush: () => prepareSQLitePush,
|
30255
29607
|
prepareSnapshotFolderName: () => prepareSnapshotFolderName,
|
30256
29608
|
promptColumnsConflicts: () => promptColumnsConflicts,
|
30257
|
-
promptNamedConflict: () => promptNamedConflict,
|
30258
29609
|
promptNamedWithSchemasConflict: () => promptNamedWithSchemasConflict,
|
30259
29610
|
promptSchemasConflict: () => promptSchemasConflict,
|
30260
|
-
roleResolver: () => roleResolver,
|
30261
29611
|
schemasResolver: () => schemasResolver,
|
30262
29612
|
sequencesResolver: () => sequencesResolver,
|
30263
29613
|
tablesResolver: () => tablesResolver,
|
30264
29614
|
writeResult: () => writeResult
|
30265
29615
|
});
|
30266
|
-
var import_fs5, import_hanji3, import_path4, schemasResolver, tablesResolver, sequencesResolver,
|
29616
|
+
var import_fs5, import_hanji3, import_path4, schemasResolver, tablesResolver, sequencesResolver, enumsResolver, columnsResolver, prepareAndMigratePg, preparePgPush, prepareMySQLPush, prepareAndMigrateMysql, prepareAndMigrateSqlite, prepareAndMigrateLibSQL, prepareSQLitePush, prepareLibSQLPush, promptColumnsConflicts, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT, writeResult, embeddedMigrations, prepareSnapshotFolderName, two;
|
30267
29617
|
var init_migrate = __esm({
|
30268
29618
|
"src/cli/commands/migrate.ts"() {
|
30269
29619
|
"use strict";
|
@@ -30328,32 +29678,6 @@ var init_migrate = __esm({
|
|
30328
29678
|
throw e2;
|
30329
29679
|
}
|
30330
29680
|
};
|
30331
|
-
roleResolver = async (input) => {
|
30332
|
-
const result = await promptNamedConflict(
|
30333
|
-
input.created,
|
30334
|
-
input.deleted,
|
30335
|
-
"role"
|
30336
|
-
);
|
30337
|
-
return {
|
30338
|
-
created: result.created,
|
30339
|
-
deleted: result.deleted,
|
30340
|
-
renamed: result.renamed
|
30341
|
-
};
|
30342
|
-
};
|
30343
|
-
policyResolver = async (input) => {
|
30344
|
-
const result = await promptColumnsConflicts(
|
30345
|
-
input.tableName,
|
30346
|
-
input.created,
|
30347
|
-
input.deleted
|
30348
|
-
);
|
30349
|
-
return {
|
30350
|
-
tableName: input.tableName,
|
30351
|
-
schema: input.schema,
|
30352
|
-
created: result.created,
|
30353
|
-
deleted: result.deleted,
|
30354
|
-
renamed: result.renamed
|
30355
|
-
};
|
30356
|
-
};
|
30357
29681
|
enumsResolver = async (input) => {
|
30358
29682
|
try {
|
30359
29683
|
const { created, deleted, moved, renamed } = await promptNamedWithSchemasConflict(
|
@@ -30389,6 +29713,7 @@ var init_migrate = __esm({
|
|
30389
29713
|
prepareAndMigratePg = async (config) => {
|
30390
29714
|
const outFolder = config.out;
|
30391
29715
|
const schemaPath = config.schema;
|
29716
|
+
const casing2 = config.casing;
|
30392
29717
|
try {
|
30393
29718
|
assertV1OutFolder(outFolder);
|
30394
29719
|
const { snapshots, journal } = prepareMigrationFolder(
|
@@ -30397,7 +29722,8 @@ var init_migrate = __esm({
|
|
30397
29722
|
);
|
30398
29723
|
const { prev, cur, custom: custom2 } = await preparePgMigrationSnapshot(
|
30399
29724
|
snapshots,
|
30400
|
-
schemaPath
|
29725
|
+
schemaPath,
|
29726
|
+
casing2
|
30401
29727
|
);
|
30402
29728
|
const validatedPrev = pgSchema.parse(prev);
|
30403
29729
|
const validatedCur = pgSchema.parse(cur);
|
@@ -30422,8 +29748,6 @@ var init_migrate = __esm({
|
|
30422
29748
|
schemasResolver,
|
30423
29749
|
enumsResolver,
|
30424
29750
|
sequencesResolver,
|
30425
|
-
policyResolver,
|
30426
|
-
roleResolver,
|
30427
29751
|
tablesResolver,
|
30428
29752
|
columnsResolver,
|
30429
29753
|
validatedPrev,
|
@@ -30442,10 +29766,11 @@ var init_migrate = __esm({
|
|
30442
29766
|
console.error(e2);
|
30443
29767
|
}
|
30444
29768
|
};
|
30445
|
-
preparePgPush = async (schemaPath, snapshot, schemaFilter) => {
|
29769
|
+
preparePgPush = async (schemaPath, snapshot, schemaFilter, casing2) => {
|
30446
29770
|
const { prev, cur } = await preparePgDbPushSnapshot(
|
30447
29771
|
snapshot,
|
30448
29772
|
schemaPath,
|
29773
|
+
casing2,
|
30449
29774
|
schemaFilter
|
30450
29775
|
);
|
30451
29776
|
const validatedPrev = pgSchema.parse(prev);
|
@@ -30458,8 +29783,6 @@ var init_migrate = __esm({
|
|
30458
29783
|
schemasResolver,
|
30459
29784
|
enumsResolver,
|
30460
29785
|
sequencesResolver,
|
30461
|
-
policyResolver,
|
30462
|
-
roleResolver,
|
30463
29786
|
tablesResolver,
|
30464
29787
|
columnsResolver,
|
30465
29788
|
validatedPrev,
|
@@ -30468,11 +29791,12 @@ var init_migrate = __esm({
|
|
30468
29791
|
);
|
30469
29792
|
return { sqlStatements, statements, squashedPrev, squashedCur };
|
30470
29793
|
};
|
30471
|
-
prepareMySQLPush = async (schemaPath, snapshot) => {
|
29794
|
+
prepareMySQLPush = async (schemaPath, snapshot, casing2) => {
|
30472
29795
|
try {
|
30473
29796
|
const { prev, cur } = await prepareMySqlDbPushSnapshot(
|
30474
29797
|
snapshot,
|
30475
|
-
schemaPath
|
29798
|
+
schemaPath,
|
29799
|
+
casing2
|
30476
29800
|
);
|
30477
29801
|
const validatedPrev = mysqlSchema.parse(prev);
|
30478
29802
|
const validatedCur = mysqlSchema.parse(cur);
|
@@ -30496,12 +29820,14 @@ var init_migrate = __esm({
|
|
30496
29820
|
prepareAndMigrateMysql = async (config) => {
|
30497
29821
|
const outFolder = config.out;
|
30498
29822
|
const schemaPath = config.schema;
|
29823
|
+
const casing2 = config.casing;
|
30499
29824
|
try {
|
30500
29825
|
assertV1OutFolder(outFolder);
|
30501
29826
|
const { snapshots, journal } = prepareMigrationFolder(outFolder, "mysql");
|
30502
29827
|
const { prev, cur, custom: custom2 } = await prepareMySqlMigrationSnapshot(
|
30503
29828
|
snapshots,
|
30504
|
-
schemaPath
|
29829
|
+
schemaPath,
|
29830
|
+
casing2
|
30505
29831
|
);
|
30506
29832
|
const validatedPrev = mysqlSchema.parse(prev);
|
30507
29833
|
const validatedCur = mysqlSchema.parse(cur);
|
@@ -30545,12 +29871,14 @@ var init_migrate = __esm({
|
|
30545
29871
|
prepareAndMigrateSqlite = async (config) => {
|
30546
29872
|
const outFolder = config.out;
|
30547
29873
|
const schemaPath = config.schema;
|
29874
|
+
const casing2 = config.casing;
|
30548
29875
|
try {
|
30549
29876
|
assertV1OutFolder(outFolder);
|
30550
29877
|
const { snapshots, journal } = prepareMigrationFolder(outFolder, "sqlite");
|
30551
29878
|
const { prev, cur, custom: custom2 } = await prepareSqliteMigrationSnapshot(
|
30552
29879
|
snapshots,
|
30553
|
-
schemaPath
|
29880
|
+
schemaPath,
|
29881
|
+
casing2
|
30554
29882
|
);
|
30555
29883
|
const validatedPrev = sqliteSchema.parse(prev);
|
30556
29884
|
const validatedCur = sqliteSchema.parse(cur);
|
@@ -30596,12 +29924,14 @@ var init_migrate = __esm({
|
|
30596
29924
|
prepareAndMigrateLibSQL = async (config) => {
|
30597
29925
|
const outFolder = config.out;
|
30598
29926
|
const schemaPath = config.schema;
|
29927
|
+
const casing2 = config.casing;
|
30599
29928
|
try {
|
30600
29929
|
assertV1OutFolder(outFolder);
|
30601
29930
|
const { snapshots, journal } = prepareMigrationFolder(outFolder, "sqlite");
|
30602
29931
|
const { prev, cur, custom: custom2 } = await prepareSqliteMigrationSnapshot(
|
30603
29932
|
snapshots,
|
30604
|
-
schemaPath
|
29933
|
+
schemaPath,
|
29934
|
+
casing2
|
30605
29935
|
);
|
30606
29936
|
const validatedPrev = sqliteSchema.parse(prev);
|
30607
29937
|
const validatedCur = sqliteSchema.parse(cur);
|
@@ -30644,8 +29974,8 @@ var init_migrate = __esm({
|
|
30644
29974
|
console.error(e2);
|
30645
29975
|
}
|
30646
29976
|
};
|
30647
|
-
prepareSQLitePush = async (schemaPath, snapshot) => {
|
30648
|
-
const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath);
|
29977
|
+
prepareSQLitePush = async (schemaPath, snapshot, casing2) => {
|
29978
|
+
const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath, casing2);
|
30649
29979
|
const validatedPrev = sqliteSchema.parse(prev);
|
30650
29980
|
const validatedCur = sqliteSchema.parse(cur);
|
30651
29981
|
const squashedPrev = squashSqliteScheme(validatedPrev, "push");
|
@@ -30667,8 +29997,8 @@ var init_migrate = __esm({
|
|
30667
29997
|
meta: _meta
|
30668
29998
|
};
|
30669
29999
|
};
|
30670
|
-
prepareLibSQLPush = async (schemaPath, snapshot) => {
|
30671
|
-
const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath);
|
30000
|
+
prepareLibSQLPush = async (schemaPath, snapshot, casing2) => {
|
30001
|
+
const { prev, cur } = await prepareSQLiteDbPushSnapshot(snapshot, schemaPath, casing2);
|
30672
30002
|
const validatedPrev = sqliteSchema.parse(prev);
|
30673
30003
|
const validatedCur = sqliteSchema.parse(cur);
|
30674
30004
|
const squashedPrev = squashSqliteScheme(validatedPrev, "push");
|
@@ -30740,56 +30070,6 @@ var init_migrate = __esm({
|
|
30740
30070
|
result.deleted.push(...leftMissing);
|
30741
30071
|
return result;
|
30742
30072
|
};
|
30743
|
-
promptNamedConflict = async (newItems, missingItems, entity) => {
|
30744
|
-
if (missingItems.length === 0 || newItems.length === 0) {
|
30745
|
-
return {
|
30746
|
-
created: newItems,
|
30747
|
-
renamed: [],
|
30748
|
-
deleted: missingItems
|
30749
|
-
};
|
30750
|
-
}
|
30751
|
-
const result = { created: [], renamed: [], deleted: [] };
|
30752
|
-
let index4 = 0;
|
30753
|
-
let leftMissing = [...missingItems];
|
30754
|
-
do {
|
30755
|
-
const created = newItems[index4];
|
30756
|
-
const renames = leftMissing.map((it) => {
|
30757
|
-
return { from: it, to: created };
|
30758
|
-
});
|
30759
|
-
const promptData = [created, ...renames];
|
30760
|
-
const { status, data } = await (0, import_hanji3.render)(
|
30761
|
-
new ResolveSelectNamed(created, promptData, entity)
|
30762
|
-
);
|
30763
|
-
if (status === "aborted") {
|
30764
|
-
console.error("ERROR");
|
30765
|
-
process.exit(1);
|
30766
|
-
}
|
30767
|
-
if (isRenamePromptItem(data)) {
|
30768
|
-
console.log(
|
30769
|
-
`${source_default.yellow("~")} ${data.from.name} \u203A ${data.to.name} ${source_default.gray(
|
30770
|
-
`${entity} will be renamed/moved`
|
30771
|
-
)}`
|
30772
|
-
);
|
30773
|
-
if (data.from.name !== data.to.name) {
|
30774
|
-
result.renamed.push(data);
|
30775
|
-
}
|
30776
|
-
delete leftMissing[leftMissing.indexOf(data.from)];
|
30777
|
-
leftMissing = leftMissing.filter(Boolean);
|
30778
|
-
} else {
|
30779
|
-
console.log(
|
30780
|
-
`${source_default.green("+")} ${data.name} ${source_default.gray(
|
30781
|
-
`${entity} will be created`
|
30782
|
-
)}`
|
30783
|
-
);
|
30784
|
-
result.created.push(created);
|
30785
|
-
}
|
30786
|
-
index4 += 1;
|
30787
|
-
} while (index4 < newItems.length);
|
30788
|
-
console.log(source_default.gray(`--- all ${entity} conflicts resolved ---
|
30789
|
-
`));
|
30790
|
-
result.deleted.push(...leftMissing);
|
30791
|
-
return result;
|
30792
|
-
};
|
30793
30073
|
promptNamedWithSchemasConflict = async (newItems, missingItems, entity) => {
|
30794
30074
|
if (missingItems.length === 0 || newItems.length === 0) {
|
30795
30075
|
return {
|
@@ -39618,9 +38898,9 @@ var init_body2 = __esm({
|
|
39618
38898
|
// ../node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/headers.js
|
39619
38899
|
function fromRawHeaders(headers = []) {
|
39620
38900
|
return new Headers2(
|
39621
|
-
headers.reduce((result, value, index4,
|
38901
|
+
headers.reduce((result, value, index4, array) => {
|
39622
38902
|
if (index4 % 2 === 0) {
|
39623
|
-
result.push(
|
38903
|
+
result.push(array.slice(index4, index4 + 2));
|
39624
38904
|
}
|
39625
38905
|
return result;
|
39626
38906
|
}, []).filter(([name, value]) => {
|
@@ -40018,7 +39298,7 @@ function determineRequestsReferrer(request, { referrerURLCallback, referrerOrigi
|
|
40018
39298
|
if (request.referrer === "no-referrer" || request.referrerPolicy === "") {
|
40019
39299
|
return null;
|
40020
39300
|
}
|
40021
|
-
const
|
39301
|
+
const policy = request.referrerPolicy;
|
40022
39302
|
if (request.referrer === "about:client") {
|
40023
39303
|
return "no-referrer";
|
40024
39304
|
}
|
@@ -40035,7 +39315,7 @@ function determineRequestsReferrer(request, { referrerURLCallback, referrerOrigi
|
|
40035
39315
|
referrerOrigin = referrerOriginCallback(referrerOrigin);
|
40036
39316
|
}
|
40037
39317
|
const currentURL = new URL(request.url);
|
40038
|
-
switch (
|
39318
|
+
switch (policy) {
|
40039
39319
|
case "no-referrer":
|
40040
39320
|
return "no-referrer";
|
40041
39321
|
case "origin":
|
@@ -40071,18 +39351,18 @@ function determineRequestsReferrer(request, { referrerURLCallback, referrerOrigi
|
|
40071
39351
|
}
|
40072
39352
|
return referrerURL;
|
40073
39353
|
default:
|
40074
|
-
throw new TypeError(`Invalid referrerPolicy: ${
|
39354
|
+
throw new TypeError(`Invalid referrerPolicy: ${policy}`);
|
40075
39355
|
}
|
40076
39356
|
}
|
40077
39357
|
function parseReferrerPolicyFromHeader(headers) {
|
40078
39358
|
const policyTokens = (headers.get("referrer-policy") || "").split(/[,\s]+/);
|
40079
|
-
let
|
39359
|
+
let policy = "";
|
40080
39360
|
for (const token of policyTokens) {
|
40081
39361
|
if (token && ReferrerPolicy.has(token)) {
|
40082
|
-
|
39362
|
+
policy = token;
|
40083
39363
|
}
|
40084
39364
|
}
|
40085
|
-
return
|
39365
|
+
return policy;
|
40086
39366
|
}
|
40087
39367
|
var import_node_net, ReferrerPolicy, DEFAULT_REFERRER_POLICY;
|
40088
39368
|
var init_referrer = __esm({
|
@@ -60729,7 +60009,7 @@ var require_fromWebToken = __commonJS({
|
|
60729
60009
|
var fromWebToken2 = (init2) => async () => {
|
60730
60010
|
var _a;
|
60731
60011
|
(_a = init2.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-web-identity", "fromWebToken");
|
60732
|
-
const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy
|
60012
|
+
const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds } = init2;
|
60733
60013
|
let { roleAssumerWithWebIdentity } = init2;
|
60734
60014
|
if (!roleAssumerWithWebIdentity) {
|
60735
60015
|
const { getDefaultRoleAssumerWithWebIdentity } = await Promise.resolve().then(() => __importStar2(require_dist_cjs50()));
|
@@ -60745,7 +60025,7 @@ var require_fromWebToken = __commonJS({
|
|
60745
60025
|
WebIdentityToken: webIdentityToken,
|
60746
60026
|
ProviderId: providerId,
|
60747
60027
|
PolicyArns: policyArns,
|
60748
|
-
Policy:
|
60028
|
+
Policy: policy,
|
60749
60029
|
DurationSeconds: durationSeconds
|
60750
60030
|
});
|
60751
60031
|
};
|
@@ -63405,7 +62685,7 @@ var init_studio2 = __esm({
|
|
63405
62685
|
});
|
63406
62686
|
};
|
63407
62687
|
prepareServer = async ({
|
63408
|
-
dialect:
|
62688
|
+
dialect: dialect4,
|
63409
62689
|
driver: driver2,
|
63410
62690
|
proxy,
|
63411
62691
|
customDefaults,
|
@@ -63455,7 +62735,7 @@ var init_studio2 = __esm({
|
|
63455
62735
|
}));
|
63456
62736
|
return c.json({
|
63457
62737
|
version: "6",
|
63458
|
-
dialect:
|
62738
|
+
dialect: dialect4,
|
63459
62739
|
driver: driver2,
|
63460
62740
|
schemaFiles,
|
63461
62741
|
customDefaults: preparedDefaults,
|
@@ -64209,13 +63489,13 @@ var require_event_stream = __commonJS({
|
|
64209
63489
|
es.writeArray = function(done) {
|
64210
63490
|
if ("function" !== typeof done)
|
64211
63491
|
throw new Error("function writeArray (done): done must be function");
|
64212
|
-
var a = new Stream3(),
|
63492
|
+
var a = new Stream3(), array = [], isDone = false;
|
64213
63493
|
a.write = function(l) {
|
64214
|
-
|
63494
|
+
array.push(l);
|
64215
63495
|
};
|
64216
63496
|
a.end = function() {
|
64217
63497
|
isDone = true;
|
64218
|
-
done(null,
|
63498
|
+
done(null, array);
|
64219
63499
|
};
|
64220
63500
|
a.writable = true;
|
64221
63501
|
a.readable = false;
|
@@ -64223,23 +63503,23 @@ var require_event_stream = __commonJS({
|
|
64223
63503
|
a.writable = a.readable = false;
|
64224
63504
|
if (isDone)
|
64225
63505
|
return;
|
64226
|
-
done(new Error("destroyed before end"),
|
63506
|
+
done(new Error("destroyed before end"), array);
|
64227
63507
|
};
|
64228
63508
|
return a;
|
64229
63509
|
};
|
64230
|
-
es.readArray = function(
|
63510
|
+
es.readArray = function(array) {
|
64231
63511
|
var stream = new Stream3(), i2 = 0, paused = false, ended = false;
|
64232
63512
|
stream.readable = true;
|
64233
63513
|
stream.writable = false;
|
64234
|
-
if (!Array.isArray(
|
63514
|
+
if (!Array.isArray(array))
|
64235
63515
|
throw new Error("event-stream.read expects an array");
|
64236
63516
|
stream.resume = function() {
|
64237
63517
|
if (ended)
|
64238
63518
|
return;
|
64239
63519
|
paused = false;
|
64240
|
-
var l =
|
63520
|
+
var l = array.length;
|
64241
63521
|
while (i2 < l && !paused && !ended) {
|
64242
|
-
stream.emit("data",
|
63522
|
+
stream.emit("data", array[i2++]);
|
64243
63523
|
}
|
64244
63524
|
if (i2 == l && !ended)
|
64245
63525
|
ended = true, stream.readable = false, stream.emit("end");
|
@@ -67864,8 +67144,8 @@ var require_utils4 = __commonJS({
|
|
67864
67144
|
"use strict";
|
67865
67145
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
67866
67146
|
exports2.string = exports2.stream = exports2.pattern = exports2.path = exports2.fs = exports2.errno = exports2.array = void 0;
|
67867
|
-
var
|
67868
|
-
exports2.array =
|
67147
|
+
var array = require_array();
|
67148
|
+
exports2.array = array;
|
67869
67149
|
var errno = require_errno();
|
67870
67150
|
exports2.errno = errno;
|
67871
67151
|
var fs9 = require_fs2();
|
@@ -79723,7 +79003,7 @@ var init_pgIntrospect = __esm({
|
|
79723
79003
|
init_global();
|
79724
79004
|
init_pgSerializer();
|
79725
79005
|
init_views();
|
79726
|
-
pgPushIntrospect = async (db, filters, schemaFilters
|
79006
|
+
pgPushIntrospect = async (db, filters, schemaFilters) => {
|
79727
79007
|
const matchers = filters.map((it) => {
|
79728
79008
|
return new Minimatch(it);
|
79729
79009
|
});
|
@@ -79752,7 +79032,7 @@ var init_pgIntrospect = __esm({
|
|
79752
79032
|
);
|
79753
79033
|
const res = await (0, import_hanji9.renderWithTask)(
|
79754
79034
|
progress,
|
79755
|
-
fromDatabase2(db, filter2, schemaFilters
|
79035
|
+
fromDatabase2(db, filter2, schemaFilters)
|
79756
79036
|
);
|
79757
79037
|
const schema5 = { id: originUUID, prevId: "", ...res };
|
79758
79038
|
const { internal, ...schemaWithoutInternals } = schema5;
|
@@ -79762,11 +79042,11 @@ var init_pgIntrospect = __esm({
|
|
79762
79042
|
});
|
79763
79043
|
|
79764
79044
|
// src/introspect-sqlite.ts
|
79765
|
-
var
|
79045
|
+
var import_casing3, sqliteImportsList, indexName3, objToStatement2, relations, escapeColumnKey, withCasing, dbColumnName, schemaToTypeScript, isCyclic, isSelf, mapColumnDefault, column4, createTableColumns, createTableIndexes, createTableUniques, createTablePKs, createTableFKs;
|
79766
79046
|
var init_introspect_sqlite = __esm({
|
79767
79047
|
"src/introspect-sqlite.ts"() {
|
79768
79048
|
"use strict";
|
79769
|
-
|
79049
|
+
import_casing3 = require("drizzle-orm/casing");
|
79770
79050
|
init_utils3();
|
79771
79051
|
init_global();
|
79772
79052
|
sqliteImportsList = /* @__PURE__ */ new Set([
|
@@ -79811,7 +79091,7 @@ var init_introspect_sqlite = __esm({
|
|
79811
79091
|
return "";
|
79812
79092
|
}
|
79813
79093
|
if (casing2 === "camel") {
|
79814
|
-
return (0,
|
79094
|
+
return (0, import_casing3.toCamelCase)(name) === name ? "" : withMode ? `"${name}", ` : `"${name}"`;
|
79815
79095
|
}
|
79816
79096
|
assertUnreachable(casing2);
|
79817
79097
|
};
|
@@ -80186,13 +79466,13 @@ var init_push = __esm({
|
|
80186
79466
|
init_mysqlPushUtils();
|
80187
79467
|
init_pgPushUtils();
|
80188
79468
|
init_sqlitePushUtils();
|
80189
|
-
mysqlPush = async (schemaPath, credentials2, tablesFilter, strict, verbose, force) => {
|
79469
|
+
mysqlPush = async (schemaPath, credentials2, tablesFilter, strict, verbose, force, casing2) => {
|
80190
79470
|
const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
80191
79471
|
const { mysqlPushIntrospect: mysqlPushIntrospect2 } = await Promise.resolve().then(() => (init_mysqlIntrospect(), mysqlIntrospect_exports));
|
80192
79472
|
const { db, database } = await connectToMySQL2(credentials2);
|
80193
79473
|
const { schema: schema5 } = await mysqlPushIntrospect2(db, database, tablesFilter);
|
80194
79474
|
const { prepareMySQLPush: prepareMySQLPush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
80195
|
-
const statements = await prepareMySQLPush2(schemaPath, schema5);
|
79475
|
+
const statements = await prepareMySQLPush2(schemaPath, schema5, casing2);
|
80196
79476
|
const filteredStatements = filterStatements(
|
80197
79477
|
statements.statements ?? [],
|
80198
79478
|
statements.validatedCur,
|
@@ -80287,13 +79567,13 @@ var init_push = __esm({
|
|
80287
79567
|
console.log(e2);
|
80288
79568
|
}
|
80289
79569
|
};
|
80290
|
-
pgPush = async (schemaPath, verbose, strict, credentials2, tablesFilter, schemasFilter,
|
79570
|
+
pgPush = async (schemaPath, verbose, strict, credentials2, tablesFilter, schemasFilter, force, casing2) => {
|
80291
79571
|
const { preparePostgresDB: preparePostgresDB2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
80292
79572
|
const { pgPushIntrospect: pgPushIntrospect2 } = await Promise.resolve().then(() => (init_pgIntrospect(), pgIntrospect_exports));
|
80293
79573
|
const db = await preparePostgresDB2(credentials2);
|
80294
|
-
const { schema: schema5 } = await pgPushIntrospect2(db, tablesFilter, schemasFilter
|
79574
|
+
const { schema: schema5 } = await pgPushIntrospect2(db, tablesFilter, schemasFilter);
|
80295
79575
|
const { preparePgPush: preparePgPush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
80296
|
-
const statements = await preparePgPush2(schemaPath, schema5, schemasFilter);
|
79576
|
+
const statements = await preparePgPush2(schemaPath, schema5, schemasFilter, casing2);
|
80297
79577
|
try {
|
80298
79578
|
if (statements.sqlStatements.length === 0) {
|
80299
79579
|
(0, import_hanji11.render)(`[${source_default.blue("i")}] No changes detected`);
|
@@ -80361,13 +79641,13 @@ var init_push = __esm({
|
|
80361
79641
|
console.error(e2);
|
80362
79642
|
}
|
80363
79643
|
};
|
80364
|
-
sqlitePush = async (schemaPath, verbose, strict, credentials2, tablesFilter, force) => {
|
79644
|
+
sqlitePush = async (schemaPath, verbose, strict, credentials2, tablesFilter, force, casing2) => {
|
80365
79645
|
const { connectToSQLite: connectToSQLite2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
80366
79646
|
const { sqlitePushIntrospect: sqlitePushIntrospect2 } = await Promise.resolve().then(() => (init_sqliteIntrospect(), sqliteIntrospect_exports));
|
80367
79647
|
const db = await connectToSQLite2(credentials2);
|
80368
79648
|
const { schema: schema5 } = await sqlitePushIntrospect2(db, tablesFilter);
|
80369
79649
|
const { prepareSQLitePush: prepareSQLitePush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
80370
|
-
const statements = await prepareSQLitePush2(schemaPath, schema5);
|
79650
|
+
const statements = await prepareSQLitePush2(schemaPath, schema5, casing2);
|
80371
79651
|
if (statements.sqlStatements.length === 0) {
|
80372
79652
|
(0, import_hanji11.render)(`
|
80373
79653
|
[${source_default.blue("i")}] No changes detected`);
|
@@ -80449,13 +79729,13 @@ var init_push = __esm({
|
|
80449
79729
|
}
|
80450
79730
|
}
|
80451
79731
|
};
|
80452
|
-
libSQLPush = async (schemaPath, verbose, strict, credentials2, tablesFilter, force) => {
|
79732
|
+
libSQLPush = async (schemaPath, verbose, strict, credentials2, tablesFilter, force, casing2) => {
|
80453
79733
|
const { connectToLibSQL: connectToLibSQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
80454
79734
|
const { sqlitePushIntrospect: sqlitePushIntrospect2 } = await Promise.resolve().then(() => (init_sqliteIntrospect(), sqliteIntrospect_exports));
|
80455
79735
|
const db = await connectToLibSQL2(credentials2);
|
80456
79736
|
const { schema: schema5 } = await sqlitePushIntrospect2(db, tablesFilter);
|
80457
79737
|
const { prepareLibSQLPush: prepareLibSQLPush2 } = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
80458
|
-
const statements = await prepareLibSQLPush2(schemaPath, schema5);
|
79738
|
+
const statements = await prepareLibSQLPush2(schemaPath, schema5, casing2);
|
80459
79739
|
if (statements.sqlStatements.length === 0) {
|
80460
79740
|
(0, import_hanji11.render)(`
|
80461
79741
|
[${source_default.blue("i")}] No changes detected`);
|
@@ -80885,11 +80165,11 @@ var require_pluralize = __commonJS({
|
|
80885
80165
|
});
|
80886
80166
|
|
80887
80167
|
// src/introspect-mysql.ts
|
80888
|
-
var
|
80168
|
+
var import_casing4, mysqlImportsList, objToStatement22, timeConfig, binaryConfig, importsPatch, relations2, escapeColumnKey2, prepareCasing, dbColumnName2, schemaToTypeScript2, isCyclic2, isSelf2, mapColumnDefault2, mapColumnDefaultForJson, column5, createTableColumns2, createTableIndexes2, createTableUniques2, createTablePKs2, createTableFKs2;
|
80889
80169
|
var init_introspect_mysql = __esm({
|
80890
80170
|
"src/introspect-mysql.ts"() {
|
80891
80171
|
"use strict";
|
80892
|
-
|
80172
|
+
import_casing4 = require("drizzle-orm/casing");
|
80893
80173
|
init_utils3();
|
80894
80174
|
init_global();
|
80895
80175
|
init_mysqlSerializer();
|
@@ -80978,7 +80258,7 @@ var init_introspect_mysql = __esm({
|
|
80978
80258
|
return "";
|
80979
80259
|
}
|
80980
80260
|
if (casing2 === "camel") {
|
80981
|
-
return (0,
|
80261
|
+
return (0, import_casing4.toCamelCase)(name) === name ? "" : withMode ? `"${name}", ` : `"${name}"`;
|
80982
80262
|
}
|
80983
80263
|
assertUnreachable(casing2);
|
80984
80264
|
};
|
@@ -81476,14 +80756,14 @@ function generateIdentityParams(identity) {
|
|
81476
80756
|
}
|
81477
80757
|
return `.generatedByDefaultAsIdentity(${paramsObj})`;
|
81478
80758
|
}
|
81479
|
-
var import_drizzle_orm9, import_relations,
|
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;
|
81480
80760
|
var init_introspect_pg = __esm({
|
81481
80761
|
"src/introspect-pg.ts"() {
|
81482
80762
|
"use strict";
|
81483
80763
|
import_drizzle_orm9 = require("drizzle-orm");
|
81484
80764
|
import_relations = require("drizzle-orm/relations");
|
81485
80765
|
init_utils3();
|
81486
|
-
|
80766
|
+
import_casing5 = require("drizzle-orm/casing");
|
81487
80767
|
init_vector();
|
81488
80768
|
init_global();
|
81489
80769
|
init_pgSerializer();
|
@@ -81614,7 +80894,7 @@ var init_introspect_pg = __esm({
|
|
81614
80894
|
return "";
|
81615
80895
|
}
|
81616
80896
|
if (casing2 === "camel") {
|
81617
|
-
return (0,
|
80897
|
+
return (0, import_casing5.toCamelCase)(name) === name ? "" : withMode ? `"${name}", ` : `"${name}"`;
|
81618
80898
|
}
|
81619
80899
|
assertUnreachable(casing2);
|
81620
80900
|
};
|
@@ -81654,9 +80934,6 @@ var init_introspect_pg = __esm({
|
|
81654
80934
|
const uniqueImports = Object.values(it.uniqueConstraints).map(
|
81655
80935
|
(it2) => "unique"
|
81656
80936
|
);
|
81657
|
-
const policiesImports = Object.values(it.policies).map(
|
81658
|
-
(it2) => "pgPolicy"
|
81659
|
-
);
|
81660
80937
|
if (it.schema && it.schema !== "public" && it.schema !== "") {
|
81661
80938
|
res.pg.push("pgSchema");
|
81662
80939
|
}
|
@@ -81664,7 +80941,6 @@ var init_introspect_pg = __esm({
|
|
81664
80941
|
res.pg.push(...fkImpots);
|
81665
80942
|
res.pg.push(...pkImports);
|
81666
80943
|
res.pg.push(...uniqueImports);
|
81667
|
-
res.pg.push(...policiesImports);
|
81668
80944
|
const columnImports = Object.values(it.columns).map((col) => {
|
81669
80945
|
let patched = (importsPatch2[col.type] || col.type).replace("[]", "");
|
81670
80946
|
patched = patched === "double precision" ? "doublePrecision" : patched;
|
@@ -81698,9 +80974,6 @@ var init_introspect_pg = __esm({
|
|
81698
80974
|
imports.pg.push("pgEnum");
|
81699
80975
|
}
|
81700
80976
|
});
|
81701
|
-
if (Object.keys(schema5.roles).length > 0) {
|
81702
|
-
imports.pg.push("pgRole");
|
81703
|
-
}
|
81704
80977
|
const enumStatements = Object.values(schema5.enums).map((it) => {
|
81705
80978
|
const enumSchema3 = schemas[it.schema];
|
81706
80979
|
const paramName = paramNameFor(it.name, enumSchema3);
|
@@ -81736,16 +81009,9 @@ var init_introspect_pg = __esm({
|
|
81736
81009
|
}
|
81737
81010
|
return `export const ${withCasing2(paramName, casing2)} = ${func}("${it.name}"${params ? `, { ${params.trimChar(",")} }` : ""})
|
81738
81011
|
`;
|
81739
|
-
}).join("").concat("");
|
81012
|
+
}).join("").concat("\n");
|
81740
81013
|
const schemaStatements = Object.entries(schemas).map((it) => {
|
81741
81014
|
return `export const ${it[1]} = pgSchema("${it[0]}");
|
81742
|
-
`;
|
81743
|
-
}).join("");
|
81744
|
-
const rolesNameToTsKey = {};
|
81745
|
-
const rolesStatements = Object.entries(schema5.roles).map((it) => {
|
81746
|
-
const fields = it[1];
|
81747
|
-
rolesNameToTsKey[fields.name] = it[0];
|
81748
|
-
return `export const ${withCasing2(it[0], casing2)} = pgRole("${fields.name}", ${!fields.createDb && !fields.createRole && fields.inherit ? "" : `${`, { ${fields.createDb ? `createDb: true,` : ""}${fields.createRole ? ` createRole: true,` : ""}${!fields.inherit ? ` inherit: false ` : ""}`.trimChar(",")}}`} );
|
81749
81015
|
`;
|
81750
81016
|
}).join("");
|
81751
81017
|
const tableStatements = Object.values(schema5.tables).map((table4) => {
|
@@ -81764,8 +81030,8 @@ var init_introspect_pg = __esm({
|
|
81764
81030
|
schema5.internal
|
81765
81031
|
);
|
81766
81032
|
statement += "}";
|
81767
|
-
if (Object.keys(table4.indexes).length > 0 || Object.values(table4.foreignKeys).length > 0 || Object.
|
81768
|
-
statement += "
|
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) {
|
81034
|
+
statement += ",\n";
|
81769
81035
|
statement += "(table) => {\n";
|
81770
81036
|
statement += " return {\n";
|
81771
81037
|
statement += createTableIndexes3(
|
@@ -81782,11 +81048,6 @@ var init_introspect_pg = __esm({
|
|
81782
81048
|
Object.values(table4.uniqueConstraints),
|
81783
81049
|
casing2
|
81784
81050
|
);
|
81785
|
-
statement += createTablePolicies(
|
81786
|
-
Object.values(table4.policies),
|
81787
|
-
casing2,
|
81788
|
-
rolesNameToTsKey
|
81789
|
-
);
|
81790
81051
|
statement += " }\n";
|
81791
81052
|
statement += "}";
|
81792
81053
|
}
|
@@ -81797,14 +81058,14 @@ var init_introspect_pg = __esm({
|
|
81797
81058
|
const importsTs = `import { ${uniquePgImports.join(
|
81798
81059
|
", "
|
81799
81060
|
)} } from "drizzle-orm/pg-core"
|
81800
|
-
import { sql } from "drizzle-orm"
|
81061
|
+
import { sql } from "drizzle-orm"
|
81801
81062
|
|
81802
81063
|
`;
|
81803
81064
|
let decalrations = schemaStatements;
|
81804
|
-
decalrations += rolesStatements;
|
81805
81065
|
decalrations += enumStatements;
|
81806
81066
|
decalrations += sequencesStatements;
|
81807
|
-
decalrations +=
|
81067
|
+
decalrations += "\n";
|
81068
|
+
decalrations += tableStatements.join("\n\n");
|
81808
81069
|
const file = importsTs + decalrations;
|
81809
81070
|
const schemaEntry = `
|
81810
81071
|
{
|
@@ -82235,23 +81496,6 @@ import { sql } from "drizzle-orm"
|
|
82235
81496
|
}).join(", ")}]${it.name ? `, name: "${it.name}"` : ""}}`;
|
82236
81497
|
statement += ")";
|
82237
81498
|
statement += `,
|
82238
|
-
`;
|
82239
|
-
});
|
82240
|
-
return statement;
|
82241
|
-
};
|
82242
|
-
createTablePolicies = (policies, casing2, rolesNameToTsKey = {}) => {
|
82243
|
-
let statement = "";
|
82244
|
-
policies.forEach((it) => {
|
82245
|
-
var _a, _b, _c;
|
82246
|
-
const idxKey = withCasing2(it.name, casing2);
|
82247
|
-
const mappedItTo = (_a = it.to) == null ? void 0 : _a.map((v) => {
|
82248
|
-
return rolesNameToTsKey[v] ? withCasing2(rolesNameToTsKey[v], casing2) : `"${v}"`;
|
82249
|
-
});
|
82250
|
-
statement += ` ${idxKey}: `;
|
82251
|
-
statement += "pgPolicy(";
|
82252
|
-
statement += `"${it.name}", { `;
|
82253
|
-
statement += `as: "${(_b = it.as) == null ? void 0 : _b.toLowerCase()}", for: "${(_c = it.for) == null ? void 0 : _c.toLowerCase()}", to: [${mappedItTo == null ? void 0 : mappedItTo.join(", ")}]${it.using ? `, using: sql\`${it.using}\`` : ""}${it.withCheck ? `, withCheck: sql\`${it.withCheck}\` ` : ""}`;
|
82254
|
-
statement += ` }),
|
82255
81499
|
`;
|
82256
81500
|
});
|
82257
81501
|
return statement;
|
@@ -82329,7 +81573,7 @@ var init_introspect = __esm({
|
|
82329
81573
|
init_utils();
|
82330
81574
|
init_views();
|
82331
81575
|
init_migrate();
|
82332
|
-
introspectPostgres = async (casing2, out, breakpoints, credentials2, tablesFilter, schemasFilter, prefix2
|
81576
|
+
introspectPostgres = async (casing2, out, breakpoints, credentials2, tablesFilter, schemasFilter, prefix2) => {
|
82333
81577
|
const { preparePostgresDB: preparePostgresDB2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
82334
81578
|
const db = await preparePostgresDB2(credentials2);
|
82335
81579
|
const matchers = tablesFilter.map((it) => {
|
@@ -82357,15 +81601,9 @@ var init_introspect = __esm({
|
|
82357
81601
|
const progress = new IntrospectProgress(true);
|
82358
81602
|
const res = await (0, import_hanji12.renderWithTask)(
|
82359
81603
|
progress,
|
82360
|
-
fromDatabase2(
|
82361
|
-
|
82362
|
-
|
82363
|
-
schemasFilter,
|
82364
|
-
entities,
|
82365
|
-
(stage, count, status) => {
|
82366
|
-
progress.update(stage, count, status);
|
82367
|
-
}
|
82368
|
-
)
|
81604
|
+
fromDatabase2(db, filter2, schemasFilter, (stage, count, status) => {
|
81605
|
+
progress.update(stage, count, status);
|
81606
|
+
})
|
82369
81607
|
);
|
82370
81608
|
const schema5 = { id: originUUID, prevId: "", ...res };
|
82371
81609
|
const ts = schemaToTypeScript3(schema5, casing2);
|
@@ -82384,7 +81622,6 @@ var init_introspect = __esm({
|
|
82384
81622
|
schemasResolver,
|
82385
81623
|
enumsResolver,
|
82386
81624
|
sequencesResolver,
|
82387
|
-
policyResolver,
|
82388
81625
|
tablesResolver,
|
82389
81626
|
columnsResolver,
|
82390
81627
|
dryPg,
|
@@ -84242,9 +83479,9 @@ init_source();
|
|
84242
83479
|
|
84243
83480
|
// src/cli/commands/check.ts
|
84244
83481
|
init_utils();
|
84245
|
-
var checkHandler = (out,
|
84246
|
-
const { snapshots } = prepareOutFolder(out,
|
84247
|
-
const report = validateWithReport(snapshots,
|
83482
|
+
var checkHandler = (out, dialect4) => {
|
83483
|
+
const { snapshots } = prepareOutFolder(out, dialect4);
|
83484
|
+
const report = validateWithReport(snapshots, dialect4);
|
84248
83485
|
if (report.nonLatest.length > 0) {
|
84249
83486
|
console.log(
|
84250
83487
|
report.nonLatest.map((it) => {
|
@@ -85531,12 +84768,14 @@ var optionBreakpoints = boolean().desc(
|
|
85531
84768
|
`Prepare SQL statements with breakpoints`
|
85532
84769
|
);
|
85533
84770
|
var optionDriver = string().enum(...drivers).desc("Database driver");
|
84771
|
+
var optionCasing = string().enum("camelCase", "snake_case").desc("Casing for serialization");
|
85534
84772
|
var generate = command({
|
85535
84773
|
name: "generate",
|
85536
84774
|
options: {
|
85537
84775
|
config: optionConfig,
|
85538
84776
|
dialect: optionDialect,
|
85539
84777
|
driver: optionDriver,
|
84778
|
+
casing: optionCasing,
|
85540
84779
|
schema: string().desc("Path to a schema file or folder"),
|
85541
84780
|
out: optionOut,
|
85542
84781
|
name: string().desc("Migration file name"),
|
@@ -85549,7 +84788,7 @@ var generate = command({
|
|
85549
84788
|
"generate",
|
85550
84789
|
opts,
|
85551
84790
|
["prefix", "name", "custom"],
|
85552
|
-
["driver", "breakpoints", "schema", "out", "dialect"]
|
84791
|
+
["driver", "breakpoints", "schema", "out", "dialect", "casing"]
|
85553
84792
|
);
|
85554
84793
|
return prepareGenerateConfig(opts, from);
|
85555
84794
|
},
|
@@ -85562,17 +84801,17 @@ var generate = command({
|
|
85562
84801
|
prepareAndMigrateSqlite: prepareAndMigrateSqlite2,
|
85563
84802
|
prepareAndMigrateLibSQL: prepareAndMigrateLibSQL2
|
85564
84803
|
} = await Promise.resolve().then(() => (init_migrate(), migrate_exports));
|
85565
|
-
const
|
85566
|
-
if (
|
84804
|
+
const dialect4 = opts.dialect;
|
84805
|
+
if (dialect4 === "postgresql") {
|
85567
84806
|
await prepareAndMigratePg2(opts);
|
85568
|
-
} else if (
|
84807
|
+
} else if (dialect4 === "mysql") {
|
85569
84808
|
await prepareAndMigrateMysql2(opts);
|
85570
|
-
} else if (
|
84809
|
+
} else if (dialect4 === "sqlite") {
|
85571
84810
|
await prepareAndMigrateSqlite2(opts);
|
85572
|
-
} else if (
|
84811
|
+
} else if (dialect4 === "turso") {
|
85573
84812
|
await prepareAndMigrateLibSQL2(opts);
|
85574
84813
|
} else {
|
85575
|
-
assertUnreachable(
|
84814
|
+
assertUnreachable(dialect4);
|
85576
84815
|
}
|
85577
84816
|
}
|
85578
84817
|
});
|
@@ -85587,9 +84826,9 @@ var migrate = command({
|
|
85587
84826
|
handler: async (opts) => {
|
85588
84827
|
await assertOrmCoreVersion();
|
85589
84828
|
await assertPackages("drizzle-orm");
|
85590
|
-
const { dialect:
|
84829
|
+
const { dialect: dialect4, schema: schema5, table: table4, out, credentials: credentials2 } = opts;
|
85591
84830
|
try {
|
85592
|
-
if (
|
84831
|
+
if (dialect4 === "postgresql") {
|
85593
84832
|
if ("driver" in credentials2) {
|
85594
84833
|
const { driver: driver2 } = credentials2;
|
85595
84834
|
if (driver2 === "aws-data-api") {
|
@@ -85620,7 +84859,7 @@ var migrate = command({
|
|
85620
84859
|
migrationsSchema: schema5
|
85621
84860
|
})
|
85622
84861
|
);
|
85623
|
-
} else if (
|
84862
|
+
} else if (dialect4 === "mysql") {
|
85624
84863
|
const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
85625
84864
|
const { migrate: migrate2 } = await connectToMySQL2(credentials2);
|
85626
84865
|
await (0, import_hanji13.renderWithTask)(
|
@@ -85631,7 +84870,7 @@ var migrate = command({
|
|
85631
84870
|
migrationsSchema: schema5
|
85632
84871
|
})
|
85633
84872
|
);
|
85634
|
-
} else if (
|
84873
|
+
} else if (dialect4 === "sqlite") {
|
85635
84874
|
const { connectToSQLite: connectToSQLite2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
85636
84875
|
const { migrate: migrate2 } = await connectToSQLite2(credentials2);
|
85637
84876
|
await (0, import_hanji13.renderWithTask)(
|
@@ -85642,7 +84881,7 @@ var migrate = command({
|
|
85642
84881
|
migrationsSchema: schema5
|
85643
84882
|
})
|
85644
84883
|
);
|
85645
|
-
} else if (
|
84884
|
+
} else if (dialect4 === "turso") {
|
85646
84885
|
const { connectToLibSQL: connectToLibSQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
|
85647
84886
|
const { migrate: migrate2 } = await connectToLibSQL2(credentials2);
|
85648
84887
|
await (0, import_hanji13.renderWithTask)(
|
@@ -85654,7 +84893,7 @@ var migrate = command({
|
|
85654
84893
|
})
|
85655
84894
|
);
|
85656
84895
|
} else {
|
85657
|
-
assertUnreachable(
|
84896
|
+
assertUnreachable(dialect4);
|
85658
84897
|
}
|
85659
84898
|
} catch (e2) {
|
85660
84899
|
console.error(e2);
|
@@ -85688,6 +84927,7 @@ var push = command({
|
|
85688
84927
|
options: {
|
85689
84928
|
config: optionConfig,
|
85690
84929
|
dialect: optionDialect,
|
84930
|
+
casing: optionCasing,
|
85691
84931
|
schema: string().desc("Path to a schema file or folder"),
|
85692
84932
|
...optionsFilters,
|
85693
84933
|
...optionsDatabaseCredentials,
|
@@ -85716,7 +84956,8 @@ var push = command({
|
|
85716
84956
|
"authToken",
|
85717
84957
|
"schemaFilters",
|
85718
84958
|
"extensionsFilters",
|
85719
|
-
"tablesFilter"
|
84959
|
+
"tablesFilter",
|
84960
|
+
"casing"
|
85720
84961
|
]
|
85721
84962
|
);
|
85722
84963
|
return preparePushConfig(opts, from);
|
@@ -85725,17 +84966,18 @@ var push = command({
|
|
85725
84966
|
await assertPackages("drizzle-orm");
|
85726
84967
|
await assertOrmCoreVersion();
|
85727
84968
|
const {
|
85728
|
-
dialect:
|
84969
|
+
dialect: dialect4,
|
85729
84970
|
schemaPath,
|
85730
84971
|
strict,
|
85731
84972
|
verbose,
|
85732
84973
|
credentials: credentials2,
|
85733
84974
|
tablesFilter,
|
85734
84975
|
schemasFilter,
|
85735
|
-
force
|
84976
|
+
force,
|
84977
|
+
casing: casing2
|
85736
84978
|
} = config;
|
85737
84979
|
try {
|
85738
|
-
if (
|
84980
|
+
if (dialect4 === "mysql") {
|
85739
84981
|
const { mysqlPush: mysqlPush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
|
85740
84982
|
await mysqlPush2(
|
85741
84983
|
schemaPath,
|
@@ -85743,9 +84985,10 @@ var push = command({
|
|
85743
84985
|
tablesFilter,
|
85744
84986
|
strict,
|
85745
84987
|
verbose,
|
85746
|
-
force
|
84988
|
+
force,
|
84989
|
+
casing2
|
85747
84990
|
);
|
85748
|
-
} else if (
|
84991
|
+
} else if (dialect4 === "postgresql") {
|
85749
84992
|
if ("driver" in credentials2) {
|
85750
84993
|
const { driver: driver2 } = credentials2;
|
85751
84994
|
if (driver2 === "aws-data-api") {
|
@@ -85774,9 +85017,10 @@ var push = command({
|
|
85774
85017
|
credentials2,
|
85775
85018
|
tablesFilter,
|
85776
85019
|
schemasFilter,
|
85777
|
-
force
|
85020
|
+
force,
|
85021
|
+
casing2
|
85778
85022
|
);
|
85779
|
-
} else if (
|
85023
|
+
} else if (dialect4 === "sqlite") {
|
85780
85024
|
const { sqlitePush: sqlitePush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
|
85781
85025
|
await sqlitePush2(
|
85782
85026
|
schemaPath,
|
@@ -85784,9 +85028,10 @@ var push = command({
|
|
85784
85028
|
strict,
|
85785
85029
|
credentials2,
|
85786
85030
|
tablesFilter,
|
85787
|
-
force
|
85031
|
+
force,
|
85032
|
+
casing2
|
85788
85033
|
);
|
85789
|
-
} else if (
|
85034
|
+
} else if (dialect4 === "turso") {
|
85790
85035
|
const { libSQLPush: libSQLPush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
|
85791
85036
|
await libSQLPush2(
|
85792
85037
|
schemaPath,
|
@@ -85794,10 +85039,11 @@ var push = command({
|
|
85794
85039
|
strict,
|
85795
85040
|
credentials2,
|
85796
85041
|
tablesFilter,
|
85797
|
-
force
|
85042
|
+
force,
|
85043
|
+
casing2
|
85798
85044
|
);
|
85799
85045
|
} else {
|
85800
|
-
assertUnreachable(
|
85046
|
+
assertUnreachable(dialect4);
|
85801
85047
|
}
|
85802
85048
|
} catch (e2) {
|
85803
85049
|
console.error(e2);
|
@@ -85818,8 +85064,8 @@ var check = command({
|
|
85818
85064
|
},
|
85819
85065
|
handler: async (config) => {
|
85820
85066
|
await assertOrmCoreVersion();
|
85821
|
-
const { out, dialect:
|
85822
|
-
checkHandler(out,
|
85067
|
+
const { out, dialect: dialect4 } = config;
|
85068
|
+
checkHandler(out, dialect4);
|
85823
85069
|
console.log("Everything's fine \u{1F436}\u{1F525}");
|
85824
85070
|
}
|
85825
85071
|
});
|
@@ -85836,15 +85082,15 @@ var up = command({
|
|
85836
85082
|
},
|
85837
85083
|
handler: async (config) => {
|
85838
85084
|
await assertOrmCoreVersion();
|
85839
|
-
const { out, dialect:
|
85085
|
+
const { out, dialect: dialect4 } = config;
|
85840
85086
|
await assertPackages("drizzle-orm");
|
85841
|
-
if (
|
85087
|
+
if (dialect4 === "postgresql") {
|
85842
85088
|
upPgHandler(out);
|
85843
85089
|
}
|
85844
|
-
if (
|
85090
|
+
if (dialect4 === "mysql") {
|
85845
85091
|
upMysqlHandler(out);
|
85846
85092
|
}
|
85847
|
-
if (
|
85093
|
+
if (dialect4 === "sqlite" || dialect4 === "turso") {
|
85848
85094
|
upSqliteHandler(out);
|
85849
85095
|
}
|
85850
85096
|
}
|
@@ -85891,15 +85137,14 @@ var pull = command({
|
|
85891
85137
|
await assertPackages("drizzle-orm");
|
85892
85138
|
await assertOrmCoreVersion();
|
85893
85139
|
const {
|
85894
|
-
dialect:
|
85140
|
+
dialect: dialect4,
|
85895
85141
|
credentials: credentials2,
|
85896
85142
|
out,
|
85897
85143
|
casing: casing2,
|
85898
85144
|
breakpoints,
|
85899
85145
|
tablesFilter,
|
85900
85146
|
schemasFilter,
|
85901
|
-
prefix: prefix2
|
85902
|
-
entities
|
85147
|
+
prefix: prefix2
|
85903
85148
|
} = config;
|
85904
85149
|
(0, import_fs13.mkdirSync)(out, { recursive: true });
|
85905
85150
|
console.log(
|
@@ -85909,7 +85154,7 @@ var pull = command({
|
|
85909
85154
|
);
|
85910
85155
|
console.log();
|
85911
85156
|
try {
|
85912
|
-
if (
|
85157
|
+
if (dialect4 === "postgresql") {
|
85913
85158
|
if ("driver" in credentials2) {
|
85914
85159
|
const { driver: driver2 } = credentials2;
|
85915
85160
|
if (driver2 === "aws-data-api") {
|
@@ -85938,10 +85183,9 @@ var pull = command({
|
|
85938
85183
|
credentials2,
|
85939
85184
|
tablesFilter,
|
85940
85185
|
schemasFilter,
|
85941
|
-
prefix2
|
85942
|
-
entities
|
85186
|
+
prefix2
|
85943
85187
|
);
|
85944
|
-
} else if (
|
85188
|
+
} else if (dialect4 === "mysql") {
|
85945
85189
|
const { introspectMysql: introspectMysql2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
|
85946
85190
|
await introspectMysql2(
|
85947
85191
|
casing2,
|
@@ -85951,7 +85195,7 @@ var pull = command({
|
|
85951
85195
|
tablesFilter,
|
85952
85196
|
prefix2
|
85953
85197
|
);
|
85954
|
-
} else if (
|
85198
|
+
} else if (dialect4 === "sqlite") {
|
85955
85199
|
const { introspectSqlite: introspectSqlite2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
|
85956
85200
|
await introspectSqlite2(
|
85957
85201
|
casing2,
|
@@ -85961,7 +85205,7 @@ var pull = command({
|
|
85961
85205
|
tablesFilter,
|
85962
85206
|
prefix2
|
85963
85207
|
);
|
85964
|
-
} else if (
|
85208
|
+
} else if (dialect4 === "turso") {
|
85965
85209
|
const { introspectLibSQL: introspectLibSQL2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
|
85966
85210
|
await introspectLibSQL2(
|
85967
85211
|
casing2,
|
@@ -85972,7 +85216,7 @@ var pull = command({
|
|
85972
85216
|
prefix2
|
85973
85217
|
);
|
85974
85218
|
} else {
|
85975
|
-
assertUnreachable(
|
85219
|
+
assertUnreachable(dialect4);
|
85976
85220
|
}
|
85977
85221
|
} catch (e2) {
|
85978
85222
|
console.error(e2);
|
@@ -86010,7 +85254,7 @@ var studio = command({
|
|
86010
85254
|
await assertPackages("drizzle-orm");
|
86011
85255
|
assertStudioNodeVersion();
|
86012
85256
|
const {
|
86013
|
-
dialect:
|
85257
|
+
dialect: dialect4,
|
86014
85258
|
schema: schemaPath,
|
86015
85259
|
port,
|
86016
85260
|
host,
|
@@ -86026,7 +85270,7 @@ var studio = command({
|
|
86026
85270
|
} = await Promise.resolve().then(() => (init_studio2(), studio_exports));
|
86027
85271
|
let setup;
|
86028
85272
|
try {
|
86029
|
-
if (
|
85273
|
+
if (dialect4 === "postgresql") {
|
86030
85274
|
if ("driver" in credentials2) {
|
86031
85275
|
const { driver: driver2 } = credentials2;
|
86032
85276
|
if (driver2 === "aws-data-api") {
|
@@ -86049,17 +85293,17 @@ var studio = command({
|
|
86049
85293
|
}
|
86050
85294
|
const { schema: schema5, relations: relations4, files } = schemaPath ? await preparePgSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
|
86051
85295
|
setup = await drizzleForPostgres2(credentials2, schema5, relations4, files);
|
86052
|
-
} else if (
|
85296
|
+
} else if (dialect4 === "mysql") {
|
86053
85297
|
const { schema: schema5, relations: relations4, files } = schemaPath ? await prepareMySqlSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
|
86054
85298
|
setup = await drizzleForMySQL2(credentials2, schema5, relations4, files);
|
86055
|
-
} else if (
|
85299
|
+
} else if (dialect4 === "sqlite") {
|
86056
85300
|
const { schema: schema5, relations: relations4, files } = schemaPath ? await prepareSQLiteSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
|
86057
85301
|
setup = await drizzleForSQLite2(credentials2, schema5, relations4, files);
|
86058
|
-
} else if (
|
85302
|
+
} else if (dialect4 === "turso") {
|
86059
85303
|
const { schema: schema5, relations: relations4, files } = schemaPath ? await prepareSQLiteSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
|
86060
85304
|
setup = await drizzleForLibSQL(credentials2, schema5, relations4, files);
|
86061
85305
|
} else {
|
86062
|
-
assertUnreachable(
|
85306
|
+
assertUnreachable(dialect4);
|
86063
85307
|
}
|
86064
85308
|
const { prepareServer: prepareServer2 } = await Promise.resolve().then(() => (init_studio2(), studio_exports));
|
86065
85309
|
const server = await prepareServer2(setup);
|
@@ -86110,7 +85354,7 @@ init_utils2();
|
|
86110
85354
|
var version2 = async () => {
|
86111
85355
|
const { npmVersion } = await ormCoreVersions();
|
86112
85356
|
const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
|
86113
|
-
const envVersion = "0.25.0-
|
85357
|
+
const envVersion = "0.25.0-bab5208";
|
86114
85358
|
const kitVersion = envVersion ? `v${envVersion}` : "--";
|
86115
85359
|
const versions = `drizzle-kit: ${kitVersion}
|
86116
85360
|
${ormVersion}`;
|