drizzle-kit 0.16.7 → 0.16.9-139ff3e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2240 -480
- package/package.json +22 -21
package/index.js
CHANGED
|
@@ -613,7 +613,7 @@ var require_command = __commonJS({
|
|
|
613
613
|
"node_modules/.pnpm/commander@9.5.0/node_modules/commander/lib/command.js"(exports) {
|
|
614
614
|
var EventEmitter = require("events").EventEmitter;
|
|
615
615
|
var childProcess = require("child_process");
|
|
616
|
-
var
|
|
616
|
+
var path4 = require("path");
|
|
617
617
|
var fs7 = require("fs");
|
|
618
618
|
var process3 = require("process");
|
|
619
619
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
@@ -1053,10 +1053,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1053
1053
|
let launchWithNode = false;
|
|
1054
1054
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1055
1055
|
function findFile(baseDir, baseName) {
|
|
1056
|
-
const localBin =
|
|
1056
|
+
const localBin = path4.resolve(baseDir, baseName);
|
|
1057
1057
|
if (fs7.existsSync(localBin))
|
|
1058
1058
|
return localBin;
|
|
1059
|
-
if (sourceExt.includes(
|
|
1059
|
+
if (sourceExt.includes(path4.extname(baseName)))
|
|
1060
1060
|
return void 0;
|
|
1061
1061
|
const foundExt = sourceExt.find((ext) => fs7.existsSync(`${localBin}${ext}`));
|
|
1062
1062
|
if (foundExt)
|
|
@@ -1074,19 +1074,19 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1074
1074
|
} catch (err2) {
|
|
1075
1075
|
resolvedScriptPath = this._scriptPath;
|
|
1076
1076
|
}
|
|
1077
|
-
executableDir =
|
|
1077
|
+
executableDir = path4.resolve(path4.dirname(resolvedScriptPath), executableDir);
|
|
1078
1078
|
}
|
|
1079
1079
|
if (executableDir) {
|
|
1080
1080
|
let localFile = findFile(executableDir, executableFile);
|
|
1081
1081
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1082
|
-
const legacyName =
|
|
1082
|
+
const legacyName = path4.basename(this._scriptPath, path4.extname(this._scriptPath));
|
|
1083
1083
|
if (legacyName !== this._name) {
|
|
1084
1084
|
localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
1085
1085
|
}
|
|
1086
1086
|
}
|
|
1087
1087
|
executableFile = localFile || executableFile;
|
|
1088
1088
|
}
|
|
1089
|
-
launchWithNode = sourceExt.includes(
|
|
1089
|
+
launchWithNode = sourceExt.includes(path4.extname(executableFile));
|
|
1090
1090
|
let proc;
|
|
1091
1091
|
if (process3.platform !== "win32") {
|
|
1092
1092
|
if (launchWithNode) {
|
|
@@ -1658,13 +1658,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1658
1658
|
return this;
|
|
1659
1659
|
}
|
|
1660
1660
|
nameFromFilename(filename) {
|
|
1661
|
-
this._name =
|
|
1661
|
+
this._name = path4.basename(filename, path4.extname(filename));
|
|
1662
1662
|
return this;
|
|
1663
1663
|
}
|
|
1664
|
-
executableDir(
|
|
1665
|
-
if (
|
|
1664
|
+
executableDir(path5) {
|
|
1665
|
+
if (path5 === void 0)
|
|
1666
1666
|
return this._executableDir;
|
|
1667
|
-
this._executableDir =
|
|
1667
|
+
this._executableDir = path5;
|
|
1668
1668
|
return this;
|
|
1669
1669
|
}
|
|
1670
1670
|
helpInformation(contextOptions) {
|
|
@@ -2252,8 +2252,8 @@ var init_lib = __esm({
|
|
|
2252
2252
|
};
|
|
2253
2253
|
overrideErrorMap = errorMap;
|
|
2254
2254
|
makeIssue = (params) => {
|
|
2255
|
-
const { data, path:
|
|
2256
|
-
const fullPath = [...
|
|
2255
|
+
const { data, path: path4, errorMaps, issueData } = params;
|
|
2256
|
+
const fullPath = [...path4, ...issueData.path || []];
|
|
2257
2257
|
const fullIssue = {
|
|
2258
2258
|
...issueData,
|
|
2259
2259
|
path: fullPath
|
|
@@ -2335,10 +2335,10 @@ var init_lib = __esm({
|
|
|
2335
2335
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
2336
2336
|
})(errorUtil || (errorUtil = {}));
|
|
2337
2337
|
ParseInputLazyPath = class {
|
|
2338
|
-
constructor(parent, value,
|
|
2338
|
+
constructor(parent, value, path4, key) {
|
|
2339
2339
|
this.parent = parent;
|
|
2340
2340
|
this.data = value;
|
|
2341
|
-
this._path =
|
|
2341
|
+
this._path = path4;
|
|
2342
2342
|
this._key = key;
|
|
2343
2343
|
}
|
|
2344
2344
|
get path() {
|
|
@@ -6232,29 +6232,30 @@ Is ${source_default.bold.blue(
|
|
|
6232
6232
|
this.requestLayout();
|
|
6233
6233
|
}
|
|
6234
6234
|
render() {
|
|
6235
|
-
let
|
|
6235
|
+
let info2 = "";
|
|
6236
6236
|
const spin = this.spinner.value();
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
return
|
|
6237
|
+
info2 += this.statusText(spin, this.state.tables);
|
|
6238
|
+
info2 += this.statusText(spin, this.state.columns);
|
|
6239
|
+
info2 += this.statusText(spin, this.state.enums);
|
|
6240
|
+
info2 += this.statusText(spin, this.state.indexes);
|
|
6241
|
+
info2 += this.statusText(spin, this.state.fks);
|
|
6242
|
+
return info2;
|
|
6243
6243
|
}
|
|
6244
6244
|
};
|
|
6245
6245
|
}
|
|
6246
6246
|
});
|
|
6247
6247
|
|
|
6248
6248
|
// src/global.ts
|
|
6249
|
-
var originUUID;
|
|
6249
|
+
var originUUID, snapshotVersion;
|
|
6250
6250
|
var init_global = __esm({
|
|
6251
6251
|
"src/global.ts"() {
|
|
6252
6252
|
originUUID = "00000000-0000-0000-0000-000000000000";
|
|
6253
|
+
snapshotVersion = "5";
|
|
6253
6254
|
}
|
|
6254
6255
|
});
|
|
6255
6256
|
|
|
6256
6257
|
// src/serializer/mysqlSchema.ts
|
|
6257
|
-
var index, fk, column, tableV3, table, dialect, schemaHash, schemaInternalV3, schemaInternal, schemaV3, schema2, tableSquashed, schemaSquashed, MySqlSquasher, squashMysqlScheme, mysqlSchema, mysqlSchemaV3, backwardCompatibleMysqlSchema, dryMySql;
|
|
6258
|
+
var index, fk, column, tableV3, table, dialect, schemaHash, schemaInternalV3, schemaInternalV4, schemaInternal, schemaV3, schemaV4, schema2, tableSquashed, schemaSquashed, MySqlSquasher, squashMysqlScheme, mysqlSchema, mysqlSchemaV3, backwardCompatibleMysqlSchema, dryMySql;
|
|
6258
6259
|
var init_mysqlSchema = __esm({
|
|
6259
6260
|
"src/serializer/mysqlSchema.ts"() {
|
|
6260
6261
|
init_global();
|
|
@@ -6298,7 +6299,7 @@ var init_mysqlSchema = __esm({
|
|
|
6298
6299
|
indexes: recordType(stringType(), index),
|
|
6299
6300
|
foreignKeys: recordType(stringType(), fk)
|
|
6300
6301
|
}).strict();
|
|
6301
|
-
dialect =
|
|
6302
|
+
dialect = literalType("mysql");
|
|
6302
6303
|
schemaHash = objectType({
|
|
6303
6304
|
id: stringType(),
|
|
6304
6305
|
prevId: stringType()
|
|
@@ -6308,13 +6309,25 @@ var init_mysqlSchema = __esm({
|
|
|
6308
6309
|
dialect,
|
|
6309
6310
|
tables: recordType(stringType(), tableV3)
|
|
6310
6311
|
}).strict();
|
|
6311
|
-
|
|
6312
|
+
schemaInternalV4 = objectType({
|
|
6312
6313
|
version: literalType("4"),
|
|
6313
6314
|
dialect,
|
|
6314
6315
|
tables: recordType(stringType(), table),
|
|
6315
6316
|
schemas: recordType(stringType(), stringType())
|
|
6316
6317
|
}).strict();
|
|
6318
|
+
schemaInternal = objectType({
|
|
6319
|
+
version: literalType("5"),
|
|
6320
|
+
dialect,
|
|
6321
|
+
tables: recordType(stringType(), table),
|
|
6322
|
+
schemas: recordType(stringType(), stringType()),
|
|
6323
|
+
_meta: objectType({
|
|
6324
|
+
schemas: recordType(stringType(), stringType()),
|
|
6325
|
+
tables: recordType(stringType(), stringType()),
|
|
6326
|
+
columns: recordType(stringType(), stringType())
|
|
6327
|
+
})
|
|
6328
|
+
}).strict();
|
|
6317
6329
|
schemaV3 = schemaInternalV3.merge(schemaHash);
|
|
6330
|
+
schemaV4 = schemaInternalV4.merge(schemaHash);
|
|
6318
6331
|
schema2 = schemaInternal.merge(schemaHash);
|
|
6319
6332
|
tableSquashed = objectType({
|
|
6320
6333
|
name: stringType(),
|
|
@@ -6324,7 +6337,7 @@ var init_mysqlSchema = __esm({
|
|
|
6324
6337
|
foreignKeys: recordType(stringType(), stringType())
|
|
6325
6338
|
}).strict();
|
|
6326
6339
|
schemaSquashed = objectType({
|
|
6327
|
-
version: literalType("
|
|
6340
|
+
version: literalType("5"),
|
|
6328
6341
|
dialect,
|
|
6329
6342
|
tables: recordType(stringType(), tableSquashed),
|
|
6330
6343
|
schemas: recordType(stringType(), stringType())
|
|
@@ -6403,20 +6416,25 @@ var init_mysqlSchema = __esm({
|
|
|
6403
6416
|
};
|
|
6404
6417
|
mysqlSchema = schema2;
|
|
6405
6418
|
mysqlSchemaV3 = schemaV3;
|
|
6406
|
-
backwardCompatibleMysqlSchema = unionType([schemaV3, schema2]);
|
|
6419
|
+
backwardCompatibleMysqlSchema = unionType([schemaV3, schemaV4, schema2]);
|
|
6407
6420
|
dryMySql = mysqlSchema.parse({
|
|
6408
|
-
version:
|
|
6421
|
+
version: snapshotVersion,
|
|
6409
6422
|
dialect: "mysql",
|
|
6410
6423
|
id: originUUID,
|
|
6411
6424
|
prevId: "",
|
|
6412
6425
|
tables: {},
|
|
6413
|
-
schemas: {}
|
|
6426
|
+
schemas: {},
|
|
6427
|
+
_meta: {
|
|
6428
|
+
schemas: {},
|
|
6429
|
+
tables: {},
|
|
6430
|
+
columns: {}
|
|
6431
|
+
}
|
|
6414
6432
|
});
|
|
6415
6433
|
}
|
|
6416
6434
|
});
|
|
6417
6435
|
|
|
6418
6436
|
// src/serializer/pgSchema.ts
|
|
6419
|
-
var indexV2, columnV2, tableV2, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, index2, fk2, column2, tableV32, table2, schemaHash2, pgSchemaInternalV3, pgSchemaInternal, tableSquashed2, pgSchemaSquashed, pgSchemaV3, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg;
|
|
6437
|
+
var indexV2, columnV2, tableV2, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, index2, fk2, column2, tableV32, table2, schemaHash2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternal, tableSquashed2, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg;
|
|
6420
6438
|
var init_pgSchema = __esm({
|
|
6421
6439
|
"src/serializer/pgSchema.ts"() {
|
|
6422
6440
|
init_global();
|
|
@@ -6519,17 +6537,29 @@ var init_pgSchema = __esm({
|
|
|
6519
6537
|
});
|
|
6520
6538
|
pgSchemaInternalV3 = objectType({
|
|
6521
6539
|
version: literalType("3"),
|
|
6522
|
-
dialect:
|
|
6540
|
+
dialect: literalType("pg"),
|
|
6523
6541
|
tables: recordType(stringType(), tableV32),
|
|
6524
6542
|
enums: recordType(stringType(), enumSchema)
|
|
6525
6543
|
}).strict();
|
|
6526
|
-
|
|
6544
|
+
pgSchemaInternalV4 = objectType({
|
|
6527
6545
|
version: literalType("4"),
|
|
6528
|
-
dialect:
|
|
6546
|
+
dialect: literalType("pg"),
|
|
6529
6547
|
tables: recordType(stringType(), table2),
|
|
6530
6548
|
enums: recordType(stringType(), enumSchema),
|
|
6531
6549
|
schemas: recordType(stringType(), stringType())
|
|
6532
6550
|
}).strict();
|
|
6551
|
+
pgSchemaInternal = objectType({
|
|
6552
|
+
version: literalType("5"),
|
|
6553
|
+
dialect: literalType("pg"),
|
|
6554
|
+
tables: recordType(stringType(), table2),
|
|
6555
|
+
enums: recordType(stringType(), enumSchema),
|
|
6556
|
+
schemas: recordType(stringType(), stringType()),
|
|
6557
|
+
_meta: objectType({
|
|
6558
|
+
schemas: recordType(stringType(), stringType()),
|
|
6559
|
+
tables: recordType(stringType(), stringType()),
|
|
6560
|
+
columns: recordType(stringType(), stringType())
|
|
6561
|
+
})
|
|
6562
|
+
}).strict();
|
|
6533
6563
|
tableSquashed2 = objectType({
|
|
6534
6564
|
name: stringType(),
|
|
6535
6565
|
schema: stringType(),
|
|
@@ -6538,18 +6568,20 @@ var init_pgSchema = __esm({
|
|
|
6538
6568
|
foreignKeys: recordType(stringType(), stringType())
|
|
6539
6569
|
}).strict();
|
|
6540
6570
|
pgSchemaSquashed = objectType({
|
|
6541
|
-
version: literalType("
|
|
6571
|
+
version: literalType("5"),
|
|
6542
6572
|
dialect: enumType(["pg"]),
|
|
6543
6573
|
tables: recordType(stringType(), tableSquashed2),
|
|
6544
6574
|
enums: recordType(stringType(), enumSchema),
|
|
6545
6575
|
schemas: recordType(stringType(), stringType())
|
|
6546
6576
|
}).strict();
|
|
6547
6577
|
pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
|
|
6578
|
+
pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
|
|
6548
6579
|
pgSchema = pgSchemaInternal.merge(schemaHash2);
|
|
6549
6580
|
backwardCompatiblePgSchema = unionType([
|
|
6550
6581
|
pgSchemaV1,
|
|
6551
6582
|
pgSchemaV2,
|
|
6552
6583
|
pgSchemaV3,
|
|
6584
|
+
pgSchemaV4,
|
|
6553
6585
|
pgSchema
|
|
6554
6586
|
]);
|
|
6555
6587
|
PgSquasher = {
|
|
@@ -6614,7 +6646,7 @@ var init_pgSchema = __esm({
|
|
|
6614
6646
|
})
|
|
6615
6647
|
);
|
|
6616
6648
|
return {
|
|
6617
|
-
version:
|
|
6649
|
+
version: "5",
|
|
6618
6650
|
dialect: json.dialect,
|
|
6619
6651
|
tables: mappedTables,
|
|
6620
6652
|
enums: json.enums,
|
|
@@ -6622,19 +6654,24 @@ var init_pgSchema = __esm({
|
|
|
6622
6654
|
};
|
|
6623
6655
|
};
|
|
6624
6656
|
dryPg = pgSchema.parse({
|
|
6625
|
-
version:
|
|
6657
|
+
version: snapshotVersion,
|
|
6626
6658
|
dialect: "pg",
|
|
6627
6659
|
id: originUUID,
|
|
6628
6660
|
prevId: "",
|
|
6629
6661
|
tables: {},
|
|
6630
6662
|
enums: {},
|
|
6631
|
-
schemas: {}
|
|
6663
|
+
schemas: {},
|
|
6664
|
+
_meta: {
|
|
6665
|
+
schemas: {},
|
|
6666
|
+
tables: {},
|
|
6667
|
+
columns: {}
|
|
6668
|
+
}
|
|
6632
6669
|
});
|
|
6633
6670
|
}
|
|
6634
6671
|
});
|
|
6635
6672
|
|
|
6636
6673
|
// src/serializer/sqliteSchema.ts
|
|
6637
|
-
var index3, fk3, compositePK, column3, tableV33, table3, dialect2, schemaHash3, schemaInternalV32, latestVersion, schemaInternal2, schemaV32, schema3, tableSquashed3, schemaSquashed2, SQLiteSquasher, squashSqliteScheme, drySQLite, sqliteSchemaV3, sqliteSchema, backwardCompatibleSqliteSchema;
|
|
6674
|
+
var index3, fk3, compositePK, column3, tableV33, table3, dialect2, schemaHash3, schemaInternalV32, schemaInternalV42, latestVersion, schemaInternal2, schemaV32, schemaV42, schema3, tableSquashed3, schemaSquashed2, SQLiteSquasher, squashSqliteScheme, drySQLite, sqliteSchemaV3, sqliteSchema, backwardCompatibleSqliteSchema;
|
|
6638
6675
|
var init_sqliteSchema = __esm({
|
|
6639
6676
|
"src/serializer/sqliteSchema.ts"() {
|
|
6640
6677
|
init_global();
|
|
@@ -6690,14 +6727,25 @@ var init_sqliteSchema = __esm({
|
|
|
6690
6727
|
tables: recordType(stringType(), tableV33),
|
|
6691
6728
|
enums: objectType({})
|
|
6692
6729
|
}).strict();
|
|
6693
|
-
|
|
6730
|
+
schemaInternalV42 = objectType({
|
|
6731
|
+
version: literalType("4"),
|
|
6732
|
+
dialect: dialect2,
|
|
6733
|
+
tables: recordType(stringType(), table3),
|
|
6734
|
+
enums: objectType({})
|
|
6735
|
+
}).strict();
|
|
6736
|
+
latestVersion = literalType("5");
|
|
6694
6737
|
schemaInternal2 = objectType({
|
|
6695
6738
|
version: latestVersion,
|
|
6696
6739
|
dialect: dialect2,
|
|
6697
6740
|
tables: recordType(stringType(), table3),
|
|
6698
|
-
enums: objectType({})
|
|
6741
|
+
enums: objectType({}),
|
|
6742
|
+
_meta: objectType({
|
|
6743
|
+
tables: recordType(stringType(), stringType()),
|
|
6744
|
+
columns: recordType(stringType(), stringType())
|
|
6745
|
+
})
|
|
6699
6746
|
}).strict();
|
|
6700
6747
|
schemaV32 = schemaInternalV32.merge(schemaHash3).strict();
|
|
6748
|
+
schemaV42 = schemaInternalV42.merge(schemaHash3).strict();
|
|
6701
6749
|
schema3 = schemaInternal2.merge(schemaHash3).strict();
|
|
6702
6750
|
tableSquashed3 = objectType({
|
|
6703
6751
|
name: stringType(),
|
|
@@ -6792,21 +6840,25 @@ var init_sqliteSchema = __esm({
|
|
|
6792
6840
|
};
|
|
6793
6841
|
};
|
|
6794
6842
|
drySQLite = schema3.parse({
|
|
6795
|
-
version:
|
|
6843
|
+
version: snapshotVersion,
|
|
6796
6844
|
dialect: "sqlite",
|
|
6797
6845
|
id: originUUID,
|
|
6798
6846
|
prevId: "",
|
|
6799
6847
|
tables: {},
|
|
6800
|
-
enums: {}
|
|
6848
|
+
enums: {},
|
|
6849
|
+
_meta: {
|
|
6850
|
+
tables: {},
|
|
6851
|
+
columns: {}
|
|
6852
|
+
}
|
|
6801
6853
|
});
|
|
6802
6854
|
sqliteSchemaV3 = schemaV32;
|
|
6803
6855
|
sqliteSchema = schema3;
|
|
6804
|
-
backwardCompatibleSqliteSchema = unionType([schemaV32, schema3]);
|
|
6856
|
+
backwardCompatibleSqliteSchema = unionType([schemaV32, schemaV42, schema3]);
|
|
6805
6857
|
}
|
|
6806
6858
|
});
|
|
6807
6859
|
|
|
6808
6860
|
// src/utils.ts
|
|
6809
|
-
var import_fs,
|
|
6861
|
+
var import_fs, import_path, assertV1OutFolder, dryJournal, snapshotsPriorV4, prepareOutFolder, mapValues, validatorForDialect, validateWithReport, prepareMigrationFolder, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey;
|
|
6810
6862
|
var init_utils = __esm({
|
|
6811
6863
|
"src/utils.ts"() {
|
|
6812
6864
|
import_fs = require("fs");
|
|
@@ -6815,16 +6867,54 @@ var init_utils = __esm({
|
|
|
6815
6867
|
init_pgSchema();
|
|
6816
6868
|
init_sqliteSchema();
|
|
6817
6869
|
init_source();
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6870
|
+
import_path = require("path");
|
|
6871
|
+
init_global();
|
|
6872
|
+
assertV1OutFolder = (out, dialect6) => {
|
|
6873
|
+
if (!(0, import_fs.existsSync)(out))
|
|
6874
|
+
return;
|
|
6875
|
+
const oldMigrationFolders = (0, import_fs.readdirSync)(out).filter(
|
|
6876
|
+
(it) => it.length === 14 && /^\d+$/.test(it)
|
|
6877
|
+
);
|
|
6878
|
+
if (oldMigrationFolders.length > 0) {
|
|
6879
|
+
console.log(
|
|
6880
|
+
`Your migrations folder format is outdated, please run ${source_default.green.bold(
|
|
6881
|
+
`drizzle-kit up:${dialect6}`
|
|
6882
|
+
)}`
|
|
6883
|
+
);
|
|
6884
|
+
process.exit(1);
|
|
6822
6885
|
}
|
|
6823
|
-
|
|
6886
|
+
};
|
|
6887
|
+
dryJournal = (dialect6) => {
|
|
6888
|
+
return {
|
|
6889
|
+
version: snapshotVersion,
|
|
6890
|
+
dialect: dialect6,
|
|
6891
|
+
entries: []
|
|
6892
|
+
};
|
|
6893
|
+
};
|
|
6894
|
+
snapshotsPriorV4 = (out) => {
|
|
6895
|
+
const oldMigrationFolders = (0, import_fs.readdirSync)(out).filter(
|
|
6824
6896
|
(it) => it.length === 14 && /^\d+$/.test(it)
|
|
6825
6897
|
);
|
|
6826
|
-
|
|
6827
|
-
return
|
|
6898
|
+
oldMigrationFolders.sort();
|
|
6899
|
+
return oldMigrationFolders.map(
|
|
6900
|
+
(it) => {
|
|
6901
|
+
const pathJson = (0, import_path.join)(out, it, "snapshot.json");
|
|
6902
|
+
console.log(pathJson);
|
|
6903
|
+
return pathJson;
|
|
6904
|
+
}
|
|
6905
|
+
);
|
|
6906
|
+
};
|
|
6907
|
+
prepareOutFolder = (out, dialect6) => {
|
|
6908
|
+
const meta = (0, import_path.join)(out, "meta");
|
|
6909
|
+
const journalPath = (0, import_path.join)(meta, "_journal.json");
|
|
6910
|
+
if (!(0, import_fs.existsSync)((0, import_path.join)(out, "meta"))) {
|
|
6911
|
+
(0, import_fs.mkdirSync)(meta, { recursive: true });
|
|
6912
|
+
(0, import_fs.writeFileSync)(journalPath, JSON.stringify(dryJournal(dialect6)));
|
|
6913
|
+
}
|
|
6914
|
+
const journal = JSON.parse((0, import_fs.readFileSync)(journalPath).toString());
|
|
6915
|
+
const snapshots = (0, import_fs.readdirSync)(meta).filter((it) => !it.startsWith("_")).map((it) => (0, import_path.join)(meta, it));
|
|
6916
|
+
snapshots.sort();
|
|
6917
|
+
return { meta, snapshots, journal };
|
|
6828
6918
|
};
|
|
6829
6919
|
mapValues = (obj, map) => {
|
|
6830
6920
|
const result = Object.keys(obj).reduce(function(result2, key) {
|
|
@@ -6836,46 +6926,43 @@ var init_utils = __esm({
|
|
|
6836
6926
|
validatorForDialect = (dialect6) => {
|
|
6837
6927
|
switch (dialect6) {
|
|
6838
6928
|
case "pg":
|
|
6839
|
-
return { validator: backwardCompatiblePgSchema, version:
|
|
6929
|
+
return { validator: backwardCompatiblePgSchema, version: 5 };
|
|
6840
6930
|
case "sqlite":
|
|
6841
6931
|
return { validator: backwardCompatibleSqliteSchema, version: 4 };
|
|
6842
6932
|
case "mysql":
|
|
6843
6933
|
return { validator: backwardCompatibleMysqlSchema, version: 4 };
|
|
6844
6934
|
}
|
|
6845
6935
|
};
|
|
6846
|
-
validateWithReport = (
|
|
6936
|
+
validateWithReport = (snapshots, dialect6) => {
|
|
6847
6937
|
const { validator, version } = validatorForDialect(dialect6);
|
|
6848
|
-
const result =
|
|
6849
|
-
(accum,
|
|
6938
|
+
const result = snapshots.reduce(
|
|
6939
|
+
(accum, it) => {
|
|
6850
6940
|
var _a;
|
|
6851
|
-
const
|
|
6852
|
-
|
|
6853
|
-
(0, import_fs.readFileSync)(`./${root}/${folder}/snapshot.json`).toString()
|
|
6854
|
-
);
|
|
6855
|
-
accum.rawMap[folder] = raw;
|
|
6941
|
+
const raw = JSON.parse((0, import_fs.readFileSync)(`./${it}`).toString());
|
|
6942
|
+
accum.rawMap[it] = raw;
|
|
6856
6943
|
if (raw["version"] && Number(raw["version"]) > version) {
|
|
6857
6944
|
console.log(
|
|
6858
6945
|
info(
|
|
6859
|
-
`${
|
|
6946
|
+
`${it} snapshot is of unsupported version, please update drizzle-kit`
|
|
6860
6947
|
)
|
|
6861
6948
|
);
|
|
6862
6949
|
process.exit(0);
|
|
6863
6950
|
}
|
|
6864
6951
|
const result2 = validator.safeParse(raw);
|
|
6865
6952
|
if (!result2.success) {
|
|
6866
|
-
accum.malformed.push(
|
|
6953
|
+
accum.malformed.push(it);
|
|
6867
6954
|
return accum;
|
|
6868
6955
|
}
|
|
6869
6956
|
const snapshot = result2.data;
|
|
6870
6957
|
if (snapshot.version !== String(version)) {
|
|
6871
|
-
accum.nonLatest.push(
|
|
6958
|
+
accum.nonLatest.push(it);
|
|
6872
6959
|
return accum;
|
|
6873
6960
|
}
|
|
6874
6961
|
const idEntry = (_a = accum.idsMap[snapshot["prevId"]]) != null ? _a : {
|
|
6875
|
-
parent:
|
|
6962
|
+
parent: it,
|
|
6876
6963
|
snapshots: []
|
|
6877
6964
|
};
|
|
6878
|
-
idEntry.snapshots.push(
|
|
6965
|
+
idEntry.snapshots.push(it);
|
|
6879
6966
|
accum.idsMap[snapshot["prevId"]] = idEntry;
|
|
6880
6967
|
return accum;
|
|
6881
6968
|
},
|
|
@@ -6890,9 +6977,8 @@ var init_utils = __esm({
|
|
|
6890
6977
|
return result;
|
|
6891
6978
|
};
|
|
6892
6979
|
prepareMigrationFolder = (outFolder = "drizzle", dialect6) => {
|
|
6893
|
-
const
|
|
6894
|
-
const
|
|
6895
|
-
const report = validateWithReport(root, migrationFolders, dialect6);
|
|
6980
|
+
const { snapshots, journal } = prepareOutFolder(outFolder, dialect6);
|
|
6981
|
+
const report = validateWithReport(snapshots, dialect6);
|
|
6896
6982
|
if (report.nonLatest.length > 0) {
|
|
6897
6983
|
console.log(
|
|
6898
6984
|
report.nonLatest.map((it) => {
|
|
@@ -6923,7 +7009,41 @@ var init_utils = __esm({
|
|
|
6923
7009
|
if (abort) {
|
|
6924
7010
|
process.exit(0);
|
|
6925
7011
|
}
|
|
6926
|
-
return {
|
|
7012
|
+
return { snapshots, journal };
|
|
7013
|
+
};
|
|
7014
|
+
prepareMigrationMeta = (schemas, tables, columns) => {
|
|
7015
|
+
const _meta = {
|
|
7016
|
+
schemas: {},
|
|
7017
|
+
tables: {},
|
|
7018
|
+
columns: {}
|
|
7019
|
+
};
|
|
7020
|
+
schemas.forEach((it) => {
|
|
7021
|
+
const from = schemaRenameKey(it.from);
|
|
7022
|
+
const to = schemaRenameKey(it.to);
|
|
7023
|
+
_meta.schemas[from] = to;
|
|
7024
|
+
});
|
|
7025
|
+
tables.forEach((it) => {
|
|
7026
|
+
const from = tableRenameKey(it.from);
|
|
7027
|
+
const to = tableRenameKey(it.to);
|
|
7028
|
+
_meta.tables[from] = to;
|
|
7029
|
+
});
|
|
7030
|
+
columns.forEach((it) => {
|
|
7031
|
+
const from = columnRenameKey(it.from.table, it.from.schema, it.from.column);
|
|
7032
|
+
const to = columnRenameKey(it.to.table, it.to.schema, it.to.column);
|
|
7033
|
+
_meta.columns[from] = to;
|
|
7034
|
+
});
|
|
7035
|
+
return _meta;
|
|
7036
|
+
};
|
|
7037
|
+
schemaRenameKey = (it) => {
|
|
7038
|
+
return it;
|
|
7039
|
+
};
|
|
7040
|
+
tableRenameKey = (it) => {
|
|
7041
|
+
const out = it.schema ? `"${it.schema}"."${it.name}"` : `"${it.name}"`;
|
|
7042
|
+
return out;
|
|
7043
|
+
};
|
|
7044
|
+
columnRenameKey = (table4, schema4, column5) => {
|
|
7045
|
+
const out = schema4 ? `"${schema4}"."${table4}"."${column5}"` : `"${table4}"."${column5}"`;
|
|
7046
|
+
return out;
|
|
6927
7047
|
};
|
|
6928
7048
|
}
|
|
6929
7049
|
});
|
|
@@ -7841,16 +7961,16 @@ var require_node2 = __commonJS({
|
|
|
7841
7961
|
}
|
|
7842
7962
|
exports2.urlGenerate = urlGenerate;
|
|
7843
7963
|
function normalize(aPath) {
|
|
7844
|
-
var
|
|
7964
|
+
var path4 = aPath;
|
|
7845
7965
|
var url = urlParse(aPath);
|
|
7846
7966
|
if (url) {
|
|
7847
7967
|
if (!url.path) {
|
|
7848
7968
|
return aPath;
|
|
7849
7969
|
}
|
|
7850
|
-
|
|
7970
|
+
path4 = url.path;
|
|
7851
7971
|
}
|
|
7852
|
-
var isAbsolute = exports2.isAbsolute(
|
|
7853
|
-
var parts =
|
|
7972
|
+
var isAbsolute = exports2.isAbsolute(path4);
|
|
7973
|
+
var parts = path4.split(/\/+/);
|
|
7854
7974
|
for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
|
|
7855
7975
|
part = parts[i];
|
|
7856
7976
|
if (part === ".") {
|
|
@@ -7867,18 +7987,18 @@ var require_node2 = __commonJS({
|
|
|
7867
7987
|
}
|
|
7868
7988
|
}
|
|
7869
7989
|
}
|
|
7870
|
-
|
|
7871
|
-
if (
|
|
7872
|
-
|
|
7990
|
+
path4 = parts.join("/");
|
|
7991
|
+
if (path4 === "") {
|
|
7992
|
+
path4 = isAbsolute ? "/" : ".";
|
|
7873
7993
|
}
|
|
7874
7994
|
if (url) {
|
|
7875
|
-
url.path =
|
|
7995
|
+
url.path = path4;
|
|
7876
7996
|
return urlGenerate(url);
|
|
7877
7997
|
}
|
|
7878
|
-
return
|
|
7998
|
+
return path4;
|
|
7879
7999
|
}
|
|
7880
8000
|
exports2.normalize = normalize;
|
|
7881
|
-
function
|
|
8001
|
+
function join22(aRoot, aPath) {
|
|
7882
8002
|
if (aRoot === "") {
|
|
7883
8003
|
aRoot = ".";
|
|
7884
8004
|
}
|
|
@@ -7910,7 +8030,7 @@ var require_node2 = __commonJS({
|
|
|
7910
8030
|
}
|
|
7911
8031
|
return joined;
|
|
7912
8032
|
}
|
|
7913
|
-
exports2.join =
|
|
8033
|
+
exports2.join = join22;
|
|
7914
8034
|
exports2.isAbsolute = function(aPath) {
|
|
7915
8035
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
7916
8036
|
};
|
|
@@ -8083,7 +8203,7 @@ var require_node2 = __commonJS({
|
|
|
8083
8203
|
parsed.path = parsed.path.substring(0, index4 + 1);
|
|
8084
8204
|
}
|
|
8085
8205
|
}
|
|
8086
|
-
sourceURL =
|
|
8206
|
+
sourceURL = join22(urlGenerate(parsed), sourceURL);
|
|
8087
8207
|
}
|
|
8088
8208
|
return normalize(sourceURL);
|
|
8089
8209
|
}
|
|
@@ -9405,7 +9525,7 @@ var require_node2 = __commonJS({
|
|
|
9405
9525
|
});
|
|
9406
9526
|
var require_source_map_support = __commonJS2((exports2, module22) => {
|
|
9407
9527
|
var SourceMapConsumer = require_source_map().SourceMapConsumer;
|
|
9408
|
-
var
|
|
9528
|
+
var path4 = require("path");
|
|
9409
9529
|
var fs32;
|
|
9410
9530
|
try {
|
|
9411
9531
|
fs32 = require("fs");
|
|
@@ -9478,15 +9598,15 @@ var require_node2 = __commonJS({
|
|
|
9478
9598
|
function supportRelativeURL(file, url) {
|
|
9479
9599
|
if (!file)
|
|
9480
9600
|
return url;
|
|
9481
|
-
var dir =
|
|
9601
|
+
var dir = path4.dirname(file);
|
|
9482
9602
|
var match = /^\w+:\/\/[^\/]*/.exec(dir);
|
|
9483
9603
|
var protocol = match ? match[0] : "";
|
|
9484
9604
|
var startPath = dir.slice(protocol.length);
|
|
9485
9605
|
if (protocol && /^\/\w\:/.test(startPath)) {
|
|
9486
9606
|
protocol += "/";
|
|
9487
|
-
return protocol +
|
|
9607
|
+
return protocol + path4.resolve(dir.slice(protocol.length), url).replace(/\\/g, "/");
|
|
9488
9608
|
}
|
|
9489
|
-
return protocol +
|
|
9609
|
+
return protocol + path4.resolve(dir.slice(protocol.length), url);
|
|
9490
9610
|
}
|
|
9491
9611
|
function retrieveSourceMapURL(source) {
|
|
9492
9612
|
var fileData;
|
|
@@ -9939,13 +10059,13 @@ var require_node2 = __commonJS({
|
|
|
9939
10059
|
}
|
|
9940
10060
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
9941
10061
|
try {
|
|
9942
|
-
var
|
|
9943
|
-
var value =
|
|
10062
|
+
var info2 = gen[key](arg);
|
|
10063
|
+
var value = info2.value;
|
|
9944
10064
|
} catch (error2) {
|
|
9945
10065
|
reject(error2);
|
|
9946
10066
|
return;
|
|
9947
10067
|
}
|
|
9948
|
-
if (
|
|
10068
|
+
if (info2.done) {
|
|
9949
10069
|
resolve(value);
|
|
9950
10070
|
} else {
|
|
9951
10071
|
Promise.resolve(value).then(_next, _throw);
|
|
@@ -9973,7 +10093,7 @@ var require_node2 = __commonJS({
|
|
|
9973
10093
|
resolve(data);
|
|
9974
10094
|
});
|
|
9975
10095
|
});
|
|
9976
|
-
var
|
|
10096
|
+
var readFileSync3 = (fp) => {
|
|
9977
10097
|
return _fs.default.readFileSync(fp, "utf8");
|
|
9978
10098
|
};
|
|
9979
10099
|
var pathExists = (fp) => new Promise((resolve) => {
|
|
@@ -10204,7 +10324,7 @@ var require_node2 = __commonJS({
|
|
|
10204
10324
|
data: this.packageJsonCache.get(filepath)[options.packageKey]
|
|
10205
10325
|
};
|
|
10206
10326
|
}
|
|
10207
|
-
const data = this.options.parseJSON(
|
|
10327
|
+
const data = this.options.parseJSON(readFileSync3(filepath));
|
|
10208
10328
|
return {
|
|
10209
10329
|
path: filepath,
|
|
10210
10330
|
data
|
|
@@ -10212,7 +10332,7 @@ var require_node2 = __commonJS({
|
|
|
10212
10332
|
}
|
|
10213
10333
|
return {
|
|
10214
10334
|
path: filepath,
|
|
10215
|
-
data:
|
|
10335
|
+
data: readFileSync3(filepath)
|
|
10216
10336
|
};
|
|
10217
10337
|
}
|
|
10218
10338
|
return {};
|
|
@@ -10281,9 +10401,9 @@ var require_node2 = __commonJS({
|
|
|
10281
10401
|
"use strict";
|
|
10282
10402
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
10283
10403
|
var fs32 = require("fs");
|
|
10284
|
-
function fileExistsSync(
|
|
10404
|
+
function fileExistsSync(path4) {
|
|
10285
10405
|
try {
|
|
10286
|
-
var stats = fs32.statSync(
|
|
10406
|
+
var stats = fs32.statSync(path4);
|
|
10287
10407
|
return stats.isFile();
|
|
10288
10408
|
} catch (err2) {
|
|
10289
10409
|
return false;
|
|
@@ -10297,8 +10417,8 @@ var require_node2 = __commonJS({
|
|
|
10297
10417
|
return require(packageJsonPath);
|
|
10298
10418
|
}
|
|
10299
10419
|
exports2.readJsonFromDiskSync = readJsonFromDiskSync;
|
|
10300
|
-
function readJsonFromDiskAsync(
|
|
10301
|
-
fs32.readFile(
|
|
10420
|
+
function readJsonFromDiskAsync(path4, callback) {
|
|
10421
|
+
fs32.readFile(path4, "utf8", function(err2, result) {
|
|
10302
10422
|
if (err2 || !result) {
|
|
10303
10423
|
return callback();
|
|
10304
10424
|
}
|
|
@@ -10316,15 +10436,15 @@ var require_node2 = __commonJS({
|
|
|
10316
10436
|
});
|
|
10317
10437
|
}
|
|
10318
10438
|
exports2.fileExistsAsync = fileExistsAsync;
|
|
10319
|
-
function removeExtension(
|
|
10320
|
-
return
|
|
10439
|
+
function removeExtension(path4) {
|
|
10440
|
+
return path4.substring(0, path4.lastIndexOf(".")) || path4;
|
|
10321
10441
|
}
|
|
10322
10442
|
exports2.removeExtension = removeExtension;
|
|
10323
10443
|
});
|
|
10324
10444
|
var require_mapping_entry = __commonJS2((exports2) => {
|
|
10325
10445
|
"use strict";
|
|
10326
10446
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
10327
|
-
var
|
|
10447
|
+
var path4 = require("path");
|
|
10328
10448
|
function getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll) {
|
|
10329
10449
|
var sortedKeys = sortByLongestPrefix(Object.keys(paths));
|
|
10330
10450
|
var absolutePaths = [];
|
|
@@ -10333,7 +10453,7 @@ var require_node2 = __commonJS({
|
|
|
10333
10453
|
absolutePaths.push({
|
|
10334
10454
|
pattern: key,
|
|
10335
10455
|
paths: paths[key].map(function(pathToResolve) {
|
|
10336
|
-
return
|
|
10456
|
+
return path4.join(absoluteBaseUrl, pathToResolve);
|
|
10337
10457
|
})
|
|
10338
10458
|
});
|
|
10339
10459
|
}
|
|
@@ -10359,11 +10479,11 @@ var require_node2 = __commonJS({
|
|
|
10359
10479
|
var require_try_path = __commonJS2((exports2) => {
|
|
10360
10480
|
"use strict";
|
|
10361
10481
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
10362
|
-
var
|
|
10482
|
+
var path4 = require("path");
|
|
10363
10483
|
var path_1 = require("path");
|
|
10364
10484
|
var filesystem_1 = require_filesystem();
|
|
10365
10485
|
function getPathsToTry(extensions, absolutePathMappings, requestedModule) {
|
|
10366
|
-
if (!absolutePathMappings || !requestedModule || requestedModule[0] === "." || requestedModule[0] ===
|
|
10486
|
+
if (!absolutePathMappings || !requestedModule || requestedModule[0] === "." || requestedModule[0] === path4.sep) {
|
|
10367
10487
|
return void 0;
|
|
10368
10488
|
}
|
|
10369
10489
|
var pathsToTry = [];
|
|
@@ -10379,9 +10499,9 @@ var require_node2 = __commonJS({
|
|
|
10379
10499
|
}));
|
|
10380
10500
|
pathsToTry.push({
|
|
10381
10501
|
type: "package",
|
|
10382
|
-
path:
|
|
10502
|
+
path: path4.join(physicalPath, "/package.json")
|
|
10383
10503
|
});
|
|
10384
|
-
var indexPath =
|
|
10504
|
+
var indexPath = path4.join(physicalPath, "/index");
|
|
10385
10505
|
pathsToTry.push.apply(pathsToTry, extensions.map(function(e) {
|
|
10386
10506
|
return { type: "index", path: indexPath + e };
|
|
10387
10507
|
}));
|
|
@@ -10428,7 +10548,7 @@ var require_node2 = __commonJS({
|
|
|
10428
10548
|
var require_match_path_sync = __commonJS2((exports2) => {
|
|
10429
10549
|
"use strict";
|
|
10430
10550
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
10431
|
-
var
|
|
10551
|
+
var path4 = require("path");
|
|
10432
10552
|
var Filesystem = require_filesystem();
|
|
10433
10553
|
var MappingEntry = require_mapping_entry();
|
|
10434
10554
|
var TryPath = require_try_path();
|
|
@@ -10470,7 +10590,7 @@ var require_node2 = __commonJS({
|
|
|
10470
10590
|
var mainFieldName = mainFields[index4];
|
|
10471
10591
|
var candidateMapping = packageJson[mainFieldName];
|
|
10472
10592
|
if (candidateMapping && typeof candidateMapping === "string") {
|
|
10473
|
-
var candidateFilePath =
|
|
10593
|
+
var candidateFilePath = path4.join(path4.dirname(packageJsonPath), candidateMapping);
|
|
10474
10594
|
if (fileExists(candidateFilePath)) {
|
|
10475
10595
|
return candidateFilePath;
|
|
10476
10596
|
}
|
|
@@ -10509,7 +10629,7 @@ var require_node2 = __commonJS({
|
|
|
10509
10629
|
var require_match_path_async = __commonJS2((exports2) => {
|
|
10510
10630
|
"use strict";
|
|
10511
10631
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
10512
|
-
var
|
|
10632
|
+
var path4 = require("path");
|
|
10513
10633
|
var TryPath = require_try_path();
|
|
10514
10634
|
var MappingEntry = require_mapping_entry();
|
|
10515
10635
|
var Filesystem = require_filesystem();
|
|
@@ -10560,7 +10680,7 @@ var require_node2 = __commonJS({
|
|
|
10560
10680
|
if (typeof mainFieldMapping !== "string") {
|
|
10561
10681
|
return tryNext();
|
|
10562
10682
|
}
|
|
10563
|
-
var mappedFilePath =
|
|
10683
|
+
var mappedFilePath = path4.join(path4.dirname(packageJsonPath), mainFieldMapping);
|
|
10564
10684
|
fileExistsAsync(mappedFilePath, function(err2, exists) {
|
|
10565
10685
|
if (err2) {
|
|
10566
10686
|
return doneCallback(err2);
|
|
@@ -11780,7 +11900,7 @@ var require_node2 = __commonJS({
|
|
|
11780
11900
|
return t;
|
|
11781
11901
|
};
|
|
11782
11902
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
11783
|
-
var
|
|
11903
|
+
var path4 = require("path");
|
|
11784
11904
|
var fs32 = require("fs");
|
|
11785
11905
|
var JSON5 = require_lib32();
|
|
11786
11906
|
var StripBom = require_strip_bom();
|
|
@@ -11810,43 +11930,43 @@ var require_node2 = __commonJS({
|
|
|
11810
11930
|
}
|
|
11811
11931
|
function resolveConfigPath(cwd, filename) {
|
|
11812
11932
|
if (filename) {
|
|
11813
|
-
var absolutePath = fs32.lstatSync(filename).isDirectory() ?
|
|
11933
|
+
var absolutePath = fs32.lstatSync(filename).isDirectory() ? path4.resolve(filename, "./tsconfig.json") : path4.resolve(cwd, filename);
|
|
11814
11934
|
return absolutePath;
|
|
11815
11935
|
}
|
|
11816
11936
|
if (fs32.statSync(cwd).isFile()) {
|
|
11817
|
-
return
|
|
11937
|
+
return path4.resolve(cwd);
|
|
11818
11938
|
}
|
|
11819
11939
|
var configAbsolutePath = walkForTsConfig(cwd);
|
|
11820
|
-
return configAbsolutePath ?
|
|
11940
|
+
return configAbsolutePath ? path4.resolve(configAbsolutePath) : void 0;
|
|
11821
11941
|
}
|
|
11822
|
-
function walkForTsConfig(directory,
|
|
11823
|
-
if (
|
|
11824
|
-
|
|
11942
|
+
function walkForTsConfig(directory, existsSync4) {
|
|
11943
|
+
if (existsSync4 === void 0) {
|
|
11944
|
+
existsSync4 = fs32.existsSync;
|
|
11825
11945
|
}
|
|
11826
|
-
var configPath =
|
|
11827
|
-
if (
|
|
11946
|
+
var configPath = path4.join(directory, "./tsconfig.json");
|
|
11947
|
+
if (existsSync4(configPath)) {
|
|
11828
11948
|
return configPath;
|
|
11829
11949
|
}
|
|
11830
|
-
var parentDirectory =
|
|
11950
|
+
var parentDirectory = path4.join(directory, "../");
|
|
11831
11951
|
if (directory === parentDirectory) {
|
|
11832
11952
|
return void 0;
|
|
11833
11953
|
}
|
|
11834
|
-
return walkForTsConfig(parentDirectory,
|
|
11954
|
+
return walkForTsConfig(parentDirectory, existsSync4);
|
|
11835
11955
|
}
|
|
11836
11956
|
exports2.walkForTsConfig = walkForTsConfig;
|
|
11837
|
-
function loadTsconfig(configFilePath,
|
|
11838
|
-
if (
|
|
11839
|
-
|
|
11957
|
+
function loadTsconfig(configFilePath, existsSync4, readFileSync3) {
|
|
11958
|
+
if (existsSync4 === void 0) {
|
|
11959
|
+
existsSync4 = fs32.existsSync;
|
|
11840
11960
|
}
|
|
11841
|
-
if (
|
|
11842
|
-
|
|
11961
|
+
if (readFileSync3 === void 0) {
|
|
11962
|
+
readFileSync3 = function(filename) {
|
|
11843
11963
|
return fs32.readFileSync(filename, "utf8");
|
|
11844
11964
|
};
|
|
11845
11965
|
}
|
|
11846
|
-
if (!
|
|
11966
|
+
if (!existsSync4(configFilePath)) {
|
|
11847
11967
|
return void 0;
|
|
11848
11968
|
}
|
|
11849
|
-
var configString =
|
|
11969
|
+
var configString = readFileSync3(configFilePath);
|
|
11850
11970
|
var cleanedJson = StripBom(configString);
|
|
11851
11971
|
var config = JSON5.parse(cleanedJson);
|
|
11852
11972
|
var extendedConfig = config.extends;
|
|
@@ -11854,15 +11974,15 @@ var require_node2 = __commonJS({
|
|
|
11854
11974
|
if (typeof extendedConfig === "string" && extendedConfig.indexOf(".json") === -1) {
|
|
11855
11975
|
extendedConfig += ".json";
|
|
11856
11976
|
}
|
|
11857
|
-
var currentDir =
|
|
11858
|
-
var extendedConfigPath =
|
|
11859
|
-
if (extendedConfig.indexOf("/") !== -1 && extendedConfig.indexOf(".") !== -1 && !
|
|
11860
|
-
extendedConfigPath =
|
|
11977
|
+
var currentDir = path4.dirname(configFilePath);
|
|
11978
|
+
var extendedConfigPath = path4.join(currentDir, extendedConfig);
|
|
11979
|
+
if (extendedConfig.indexOf("/") !== -1 && extendedConfig.indexOf(".") !== -1 && !existsSync4(extendedConfigPath)) {
|
|
11980
|
+
extendedConfigPath = path4.join(currentDir, "node_modules", extendedConfig);
|
|
11861
11981
|
}
|
|
11862
|
-
var base = loadTsconfig(extendedConfigPath,
|
|
11982
|
+
var base = loadTsconfig(extendedConfigPath, existsSync4, readFileSync3) || {};
|
|
11863
11983
|
if (base.compilerOptions && base.compilerOptions.baseUrl) {
|
|
11864
|
-
var extendsDir =
|
|
11865
|
-
base.compilerOptions.baseUrl =
|
|
11984
|
+
var extendsDir = path4.dirname(extendedConfig);
|
|
11985
|
+
base.compilerOptions.baseUrl = path4.join(extendsDir, base.compilerOptions.baseUrl);
|
|
11866
11986
|
}
|
|
11867
11987
|
return __assign({}, base, config, { compilerOptions: __assign({}, base.compilerOptions, config.compilerOptions) });
|
|
11868
11988
|
}
|
|
@@ -12087,7 +12207,7 @@ var require_node2 = __commonJS({
|
|
|
12087
12207
|
"use strict";
|
|
12088
12208
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12089
12209
|
var TsConfigLoader = require_tsconfig_loader();
|
|
12090
|
-
var
|
|
12210
|
+
var path4 = require("path");
|
|
12091
12211
|
var options_1 = require_options();
|
|
12092
12212
|
function loadConfig2(cwd) {
|
|
12093
12213
|
if (cwd === void 0) {
|
|
@@ -12099,7 +12219,7 @@ var require_node2 = __commonJS({
|
|
|
12099
12219
|
function configLoader(_a) {
|
|
12100
12220
|
var cwd = _a.cwd, explicitParams = _a.explicitParams, _b = _a.tsConfigLoader, tsConfigLoader = _b === void 0 ? TsConfigLoader.tsConfigLoader : _b;
|
|
12101
12221
|
if (explicitParams) {
|
|
12102
|
-
var absoluteBaseUrl_1 =
|
|
12222
|
+
var absoluteBaseUrl_1 = path4.isAbsolute(explicitParams.baseUrl) ? explicitParams.baseUrl : path4.join(cwd, explicitParams.baseUrl);
|
|
12103
12223
|
return {
|
|
12104
12224
|
resultType: "success",
|
|
12105
12225
|
configFileAbsolutePath: "",
|
|
@@ -12128,8 +12248,8 @@ var require_node2 = __commonJS({
|
|
|
12128
12248
|
message: "Missing baseUrl in compilerOptions"
|
|
12129
12249
|
};
|
|
12130
12250
|
}
|
|
12131
|
-
var tsConfigDir =
|
|
12132
|
-
var absoluteBaseUrl =
|
|
12251
|
+
var tsConfigDir = path4.dirname(loadResult.tsConfigPath);
|
|
12252
|
+
var absoluteBaseUrl = path4.join(tsConfigDir, loadResult.baseUrl);
|
|
12133
12253
|
return {
|
|
12134
12254
|
resultType: "success",
|
|
12135
12255
|
configFileAbsolutePath: loadResult.tsConfigPath,
|
|
@@ -12330,8 +12450,8 @@ var require_node2 = __commonJS({
|
|
|
12330
12450
|
});
|
|
12331
12451
|
var getOptions = (cwd) => {
|
|
12332
12452
|
var _a, _b, _c, _d;
|
|
12333
|
-
const { data, path:
|
|
12334
|
-
if (
|
|
12453
|
+
const { data, path: path4 } = joycon.loadSync(["tsconfig.json", "jsconfig.json"], cwd);
|
|
12454
|
+
if (path4 && data) {
|
|
12335
12455
|
return {
|
|
12336
12456
|
jsxFactory: (_a = data.compilerOptions) == null ? void 0 : _a.jsxFactory,
|
|
12337
12457
|
jsxFragment: (_b = data.compilerOptions) == null ? void 0 : _b.jsxFragmentFactory,
|
|
@@ -12682,7 +12802,7 @@ __export(pgSerializer_exports, {
|
|
|
12682
12802
|
generatePgSnapshot: () => generatePgSnapshot,
|
|
12683
12803
|
indexName: () => indexName
|
|
12684
12804
|
});
|
|
12685
|
-
var import_pg_core2, import_utils6, import_sql2, import_table2, dialect4, indexName, generatePgSnapshot, fromDatabase;
|
|
12805
|
+
var import_pg_core2, import_utils6, import_sql2, import_table2, dialect4, indexName, generatePgSnapshot, fromDatabase, defaultForColumn;
|
|
12686
12806
|
var init_pgSerializer = __esm({
|
|
12687
12807
|
"src/serializer/pgSerializer.ts"() {
|
|
12688
12808
|
import_pg_core2 = require("drizzle-orm/pg-core");
|
|
@@ -12804,14 +12924,19 @@ var init_pgSerializer = __esm({
|
|
|
12804
12924
|
return map;
|
|
12805
12925
|
}, {});
|
|
12806
12926
|
const schemasObject = Object.fromEntries(
|
|
12807
|
-
schemas.map((it) => [it.schemaName, it.schemaName])
|
|
12927
|
+
schemas.filter((it) => it.schemaName !== "public").map((it) => [it.schemaName, it.schemaName])
|
|
12808
12928
|
);
|
|
12809
12929
|
return {
|
|
12810
|
-
version: "
|
|
12930
|
+
version: "5",
|
|
12811
12931
|
dialect: "pg",
|
|
12812
12932
|
tables: result,
|
|
12813
12933
|
enums: enumsToReturn,
|
|
12814
|
-
schemas: schemasObject
|
|
12934
|
+
schemas: schemasObject,
|
|
12935
|
+
_meta: {
|
|
12936
|
+
schemas: {},
|
|
12937
|
+
tables: {},
|
|
12938
|
+
columns: {}
|
|
12939
|
+
}
|
|
12815
12940
|
};
|
|
12816
12941
|
};
|
|
12817
12942
|
fromDatabase = async (db, progressCallback) => {
|
|
@@ -12819,7 +12944,10 @@ var init_pgSerializer = __esm({
|
|
|
12819
12944
|
const allTables = await db.query(
|
|
12820
12945
|
`SELECT table_schema, table_name FROM information_schema.tables WHERE table_schema = 'public';`
|
|
12821
12946
|
);
|
|
12822
|
-
const schemas = new Set(
|
|
12947
|
+
const schemas = new Set(
|
|
12948
|
+
allTables.rows.map((it) => it.table_schema)
|
|
12949
|
+
);
|
|
12950
|
+
schemas.delete("public");
|
|
12823
12951
|
progressCallback("tables", allTables.rows.length, "done");
|
|
12824
12952
|
let columnsCount = 0;
|
|
12825
12953
|
let indexesCount = 0;
|
|
@@ -12930,7 +13058,7 @@ var init_pgSerializer = __esm({
|
|
|
12930
13058
|
const uniqueKey = tableConstraints.rows.filter(
|
|
12931
13059
|
(mapRow) => columnName === mapRow.column_name && mapRow.constraint_type === "UNIQUE"
|
|
12932
13060
|
);
|
|
12933
|
-
const defaultValue = columnResponse
|
|
13061
|
+
const defaultValue = defaultForColumn(columnResponse);
|
|
12934
13062
|
const isSerial = columnType === "serial";
|
|
12935
13063
|
columnToReturn[columnName] = {
|
|
12936
13064
|
name: columnName,
|
|
@@ -12983,7 +13111,7 @@ var init_pgSerializer = __esm({
|
|
|
12983
13111
|
progressCallback("indexes", indexesCount, "fetching");
|
|
12984
13112
|
result[tableName] = {
|
|
12985
13113
|
name: tableName,
|
|
12986
|
-
schema: tableSchema,
|
|
13114
|
+
schema: tableSchema !== "public" ? tableSchema : "",
|
|
12987
13115
|
columns: columnToReturn,
|
|
12988
13116
|
indexes: indexToReturn,
|
|
12989
13117
|
foreignKeys: foreignKeysToReturn
|
|
@@ -13024,13 +13152,25 @@ var init_pgSerializer = __esm({
|
|
|
13024
13152
|
progressCallback("enums", Object.keys(enumsToReturn).length, "done");
|
|
13025
13153
|
const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
|
|
13026
13154
|
return {
|
|
13027
|
-
version: "
|
|
13155
|
+
version: "5",
|
|
13028
13156
|
dialect: "pg",
|
|
13029
13157
|
tables: result,
|
|
13030
13158
|
enums: enumsToReturn,
|
|
13031
|
-
schemas: schemasObject
|
|
13159
|
+
schemas: schemasObject,
|
|
13160
|
+
_meta: {
|
|
13161
|
+
schemas: {},
|
|
13162
|
+
tables: {},
|
|
13163
|
+
columns: {}
|
|
13164
|
+
}
|
|
13032
13165
|
};
|
|
13033
13166
|
};
|
|
13167
|
+
defaultForColumn = (column5) => {
|
|
13168
|
+
if (column5.data_type === "serial" || column5.data_type === "smallserial" || column5.data_type === "bigserial") {
|
|
13169
|
+
return void 0;
|
|
13170
|
+
}
|
|
13171
|
+
const defaultValue = column5.column_default === null ? void 0 : column5.column_default;
|
|
13172
|
+
return defaultValue;
|
|
13173
|
+
};
|
|
13034
13174
|
}
|
|
13035
13175
|
});
|
|
13036
13176
|
|
|
@@ -13172,12 +13312,12 @@ var init_sqliteSerializer = __esm({
|
|
|
13172
13312
|
});
|
|
13173
13313
|
|
|
13174
13314
|
// src/serializer/index.ts
|
|
13175
|
-
var import_fs2, import_node,
|
|
13315
|
+
var import_fs2, import_node, import_path2, safeRegister, serializeMySql, serializePg, serializeSQLite, prepareFilenames;
|
|
13176
13316
|
var init_serializer = __esm({
|
|
13177
13317
|
"src/serializer/index.ts"() {
|
|
13178
13318
|
import_fs2 = __toESM(require("fs"));
|
|
13179
13319
|
import_node = __toESM(require_node2());
|
|
13180
|
-
|
|
13320
|
+
import_path2 = __toESM(require("path"));
|
|
13181
13321
|
safeRegister = () => {
|
|
13182
13322
|
try {
|
|
13183
13323
|
const { unregister } = (0, import_node.register)({
|
|
@@ -13190,8 +13330,8 @@ var init_serializer = __esm({
|
|
|
13190
13330
|
} };
|
|
13191
13331
|
}
|
|
13192
13332
|
};
|
|
13193
|
-
serializeMySql = (
|
|
13194
|
-
const filenames = prepareFilenames(
|
|
13333
|
+
serializeMySql = (path4) => {
|
|
13334
|
+
const filenames = prepareFilenames(path4);
|
|
13195
13335
|
const { unregister } = safeRegister();
|
|
13196
13336
|
const { prepareFromMySqlImports: prepareFromMySqlImports2 } = (init_mysqlImports(), __toCommonJS(mysqlImports_exports));
|
|
13197
13337
|
const { generateMySqlSnapshot: generateMySqlSnapshot2 } = (init_mysqlSerializer(), __toCommonJS(mysqlSerializer_exports));
|
|
@@ -13199,8 +13339,8 @@ var init_serializer = __esm({
|
|
|
13199
13339
|
unregister();
|
|
13200
13340
|
return generateMySqlSnapshot2(tables, enums, schemas);
|
|
13201
13341
|
};
|
|
13202
|
-
serializePg = (
|
|
13203
|
-
const filenames = prepareFilenames(
|
|
13342
|
+
serializePg = (path4) => {
|
|
13343
|
+
const filenames = prepareFilenames(path4);
|
|
13204
13344
|
const { unregister } = safeRegister();
|
|
13205
13345
|
const { prepareFromPgImports: prepareFromPgImports2 } = (init_pgImports(), __toCommonJS(pgImports_exports));
|
|
13206
13346
|
const { generatePgSnapshot: generatePgSnapshot2 } = (init_pgSerializer(), __toCommonJS(pgSerializer_exports));
|
|
@@ -13208,8 +13348,8 @@ var init_serializer = __esm({
|
|
|
13208
13348
|
unregister();
|
|
13209
13349
|
return generatePgSnapshot2(tables, enums, schemas);
|
|
13210
13350
|
};
|
|
13211
|
-
serializeSQLite = (
|
|
13212
|
-
const filenames = prepareFilenames(
|
|
13351
|
+
serializeSQLite = (path4) => {
|
|
13352
|
+
const filenames = prepareFilenames(path4);
|
|
13213
13353
|
const { unregister } = safeRegister();
|
|
13214
13354
|
const { prepareFromSqliteImports: prepareFromSqliteImports2 } = (init_sqliteImports(), __toCommonJS(sqliteImports_exports));
|
|
13215
13355
|
const { generateSqliteSnapshot: generateSqliteSnapshot2 } = (init_sqliteSerializer(), __toCommonJS(sqliteSerializer_exports));
|
|
@@ -13217,9 +13357,9 @@ var init_serializer = __esm({
|
|
|
13217
13357
|
unregister();
|
|
13218
13358
|
return generateSqliteSnapshot2(tables, enums);
|
|
13219
13359
|
};
|
|
13220
|
-
prepareFilenames = (
|
|
13221
|
-
const fileName = import_fs2.default.lstatSync(
|
|
13222
|
-
const filenames = fileName ? [fileName] : import_fs2.default.readdirSync(
|
|
13360
|
+
prepareFilenames = (path4) => {
|
|
13361
|
+
const fileName = import_fs2.default.lstatSync(path4).isDirectory() ? null : import_path2.default.resolve(path4);
|
|
13362
|
+
const filenames = fileName ? [fileName] : import_fs2.default.readdirSync(path4).map((it) => import_path2.default.join(import_path2.default.resolve(path4), it));
|
|
13223
13363
|
return filenames;
|
|
13224
13364
|
};
|
|
13225
13365
|
}
|
|
@@ -13235,9 +13375,9 @@ var init_migrationPreparator = __esm({
|
|
|
13235
13375
|
init_pgSchema();
|
|
13236
13376
|
init_sqliteSchema();
|
|
13237
13377
|
init_mysqlSchema();
|
|
13238
|
-
prepareMySqlMigrationSnapshot = (migrationFolders,
|
|
13378
|
+
prepareMySqlMigrationSnapshot = (migrationFolders, schemaPath) => {
|
|
13239
13379
|
const prevSnapshot = mysqlSchema.parse(
|
|
13240
|
-
preparePrevSnapshot(
|
|
13380
|
+
preparePrevSnapshot(migrationFolders, dryMySql)
|
|
13241
13381
|
);
|
|
13242
13382
|
const serialized = serializeMySql(schemaPath);
|
|
13243
13383
|
const id = (0, import_crypto.randomUUID)();
|
|
@@ -13246,9 +13386,9 @@ var init_migrationPreparator = __esm({
|
|
|
13246
13386
|
const result = { version, dialect: dialect6, id, prevId: idPrev, ...rest };
|
|
13247
13387
|
return { prev: prevSnapshot, cur: result };
|
|
13248
13388
|
};
|
|
13249
|
-
prepareSqliteMigrationSnapshot = (
|
|
13389
|
+
prepareSqliteMigrationSnapshot = (snapshots, schemaPath) => {
|
|
13250
13390
|
const prevSnapshot = sqliteSchema.parse(
|
|
13251
|
-
preparePrevSnapshot(
|
|
13391
|
+
preparePrevSnapshot(snapshots, drySQLite)
|
|
13252
13392
|
);
|
|
13253
13393
|
const serialized = serializeSQLite(schemaPath);
|
|
13254
13394
|
const id = (0, import_crypto.randomUUID)();
|
|
@@ -13263,10 +13403,8 @@ var init_migrationPreparator = __esm({
|
|
|
13263
13403
|
};
|
|
13264
13404
|
return { prev: prevSnapshot, cur: result };
|
|
13265
13405
|
};
|
|
13266
|
-
preparePgMigrationSnapshot = (
|
|
13267
|
-
const prevSnapshot = pgSchema.parse(
|
|
13268
|
-
preparePrevSnapshot(outFolder, migrationFolders, dryPg)
|
|
13269
|
-
);
|
|
13406
|
+
preparePgMigrationSnapshot = (snapshots, schemaPath) => {
|
|
13407
|
+
const prevSnapshot = pgSchema.parse(preparePrevSnapshot(snapshots, dryPg));
|
|
13270
13408
|
const serialized = serializePg(schemaPath);
|
|
13271
13409
|
const id = (0, import_crypto.randomUUID)();
|
|
13272
13410
|
const idPrev = prevSnapshot.id;
|
|
@@ -13274,16 +13412,13 @@ var init_migrationPreparator = __esm({
|
|
|
13274
13412
|
const result = { version, dialect: dialect6, id, prevId: idPrev, ...rest };
|
|
13275
13413
|
return { prev: prevSnapshot, cur: result };
|
|
13276
13414
|
};
|
|
13277
|
-
preparePrevSnapshot = (
|
|
13278
|
-
const root = outFolder;
|
|
13415
|
+
preparePrevSnapshot = (snapshots, defaultPrev) => {
|
|
13279
13416
|
let prevSnapshot;
|
|
13280
|
-
if (
|
|
13417
|
+
if (snapshots.length === 0) {
|
|
13281
13418
|
prevSnapshot = defaultPrev;
|
|
13282
13419
|
} else {
|
|
13283
|
-
const
|
|
13284
|
-
prevSnapshot = JSON.parse(
|
|
13285
|
-
import_fs3.default.readFileSync(`${root}/${lastSnapshotFolder}/snapshot.json`).toString()
|
|
13286
|
-
);
|
|
13420
|
+
const lastSnapshot = snapshots[snapshots.length - 1];
|
|
13421
|
+
prevSnapshot = JSON.parse(import_fs3.default.readFileSync(lastSnapshot).toString());
|
|
13287
13422
|
}
|
|
13288
13423
|
return prevSnapshot;
|
|
13289
13424
|
};
|
|
@@ -13291,7 +13426,7 @@ var init_migrationPreparator = __esm({
|
|
|
13291
13426
|
});
|
|
13292
13427
|
|
|
13293
13428
|
// src/sqlgenerator.ts
|
|
13294
|
-
var pgNativeTypes, Convertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, CreateTypeEnumConvertor, AlterTypeAddValueConvertor, DropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, SQLiteAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, SqliteAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, SqliteAlterTableAlterColumnDropDefaultConvertor, SqliteAlterTableCreateCompositePrimaryKeyConvertor, SqliteAlterTableDeleteCompositePrimaryKeyConvertor, SqliteAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, SqliteAlterTableAlterColumnSetNotNullConvertor, PgAlterTableAlterColumnDropNotNullConvertor, SqliteAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, SqliteCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, SqliteAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, SqliteDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MysqlCreateSchemaConvertor, MysqlDropSchemaConvertor, MysqlAlterTableSetSchemaConvertor, MysqlAlterTableSetNewSchemaConvertor, MysqlAlterTableRemoveFromSchemaConvertor, convertors, fromJson;
|
|
13429
|
+
var pgNativeTypes, isPgNativeType, Convertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, CreateTypeEnumConvertor, AlterTypeAddValueConvertor, DropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, SQLiteAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, SqliteAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, SqliteAlterTableAlterColumnDropDefaultConvertor, SqliteAlterTableCreateCompositePrimaryKeyConvertor, SqliteAlterTableDeleteCompositePrimaryKeyConvertor, SqliteAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, SqliteAlterTableAlterColumnSetNotNullConvertor, PgAlterTableAlterColumnDropNotNullConvertor, SqliteAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, SqliteCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, SqliteAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, SqliteDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MysqlCreateSchemaConvertor, MysqlDropSchemaConvertor, MysqlAlterTableSetSchemaConvertor, MysqlAlterTableSetNewSchemaConvertor, MysqlAlterTableRemoveFromSchemaConvertor, convertors, fromJson;
|
|
13295
13430
|
var init_sqlgenerator = __esm({
|
|
13296
13431
|
"src/sqlgenerator.ts"() {
|
|
13297
13432
|
init_mysqlSchema();
|
|
@@ -13325,6 +13460,12 @@ var init_sqlgenerator = __esm({
|
|
|
13325
13460
|
"bigserial",
|
|
13326
13461
|
"double precision"
|
|
13327
13462
|
]);
|
|
13463
|
+
isPgNativeType = (it) => {
|
|
13464
|
+
if (pgNativeTypes.has(it))
|
|
13465
|
+
return true;
|
|
13466
|
+
const toCheck = it.replace(/ /g, "");
|
|
13467
|
+
return toCheck.startsWith("varchar(") || toCheck.startsWith("numeric(") || toCheck.startsWith("timestamp(");
|
|
13468
|
+
};
|
|
13328
13469
|
Convertor = class {
|
|
13329
13470
|
};
|
|
13330
13471
|
PgCreateTableConvertor = class extends Convertor {
|
|
@@ -13342,7 +13483,7 @@ var init_sqlgenerator = __esm({
|
|
|
13342
13483
|
const primaryKeyStatement = column5.primaryKey ? "PRIMARY KEY" : "";
|
|
13343
13484
|
const notNullStatement = column5.notNull ? "NOT NULL" : "";
|
|
13344
13485
|
const defaultStatement = column5.default !== void 0 ? `DEFAULT ${column5.default}` : "";
|
|
13345
|
-
const type =
|
|
13486
|
+
const type = isPgNativeType(column5.type) ? column5.type : `"${column5.type}"`;
|
|
13346
13487
|
statement += " " + `"${column5.name}" ${type} ${primaryKeyStatement} ${defaultStatement} ${notNullStatement}`.replace(/ +/g, " ").trim();
|
|
13347
13488
|
statement += (i === columns.length - 1 ? "" : ",") + "\n";
|
|
13348
13489
|
}
|
|
@@ -13472,7 +13613,7 @@ var init_sqlgenerator = __esm({
|
|
|
13472
13613
|
return statement.type === "rename_table" && dialect6 === "pg";
|
|
13473
13614
|
}
|
|
13474
13615
|
convert(statement) {
|
|
13475
|
-
const { tableNameFrom, tableNameTo,
|
|
13616
|
+
const { tableNameFrom, tableNameTo, toSchema: schema4 } = statement;
|
|
13476
13617
|
const from = schema4 ? `"${schema4}"."${tableNameFrom}"` : `"${tableNameFrom}"`;
|
|
13477
13618
|
const to = schema4 ? `"${schema4}"."${tableNameTo}"` : `"${tableNameTo}"`;
|
|
13478
13619
|
return `ALTER TABLE ${from} RENAME TO ${to};`;
|
|
@@ -13561,7 +13702,7 @@ var init_sqlgenerator = __esm({
|
|
|
13561
13702
|
const { tableName, column: column5 } = statement;
|
|
13562
13703
|
const { name, type, notNull } = column5;
|
|
13563
13704
|
const defaultStatement = `${column5.default !== void 0 ? `DEFAULT ${column5.default}` : ""}`;
|
|
13564
|
-
const fixedType =
|
|
13705
|
+
const fixedType = isPgNativeType(column5.type) ? column5.type : `"${column5.type}"`;
|
|
13565
13706
|
const notNullStatement = `${notNull ? "NOT NULL" : ""}`;
|
|
13566
13707
|
return `ALTER TABLE ${tableName} ADD COLUMN "${name}" ${fixedType} ${defaultStatement} ${notNullStatement}`.replace(/ +/g, " ").trim() + ";";
|
|
13567
13708
|
}
|
|
@@ -17138,7 +17279,7 @@ var require_get = __commonJS({
|
|
|
17138
17279
|
return lastId;
|
|
17139
17280
|
},
|
|
17140
17281
|
delete: function(id) {
|
|
17141
|
-
var index4 = 0, set = map, i, args = cache[id], length = args.length,
|
|
17282
|
+
var index4 = 0, set = map, i, args = cache[id], length = args.length, path4 = [];
|
|
17142
17283
|
if (length === 0) {
|
|
17143
17284
|
delete set[length];
|
|
17144
17285
|
} else if (set = set[length]) {
|
|
@@ -17147,7 +17288,7 @@ var require_get = __commonJS({
|
|
|
17147
17288
|
if (i === -1) {
|
|
17148
17289
|
return;
|
|
17149
17290
|
}
|
|
17150
|
-
|
|
17291
|
+
path4.push(set, i);
|
|
17151
17292
|
set = set[1][i];
|
|
17152
17293
|
++index4;
|
|
17153
17294
|
}
|
|
@@ -17158,9 +17299,9 @@ var require_get = __commonJS({
|
|
|
17158
17299
|
id = set[1][i];
|
|
17159
17300
|
set[0].splice(i, 1);
|
|
17160
17301
|
set[1].splice(i, 1);
|
|
17161
|
-
while (!set[0].length &&
|
|
17162
|
-
i =
|
|
17163
|
-
set =
|
|
17302
|
+
while (!set[0].length && path4.length) {
|
|
17303
|
+
i = path4.pop();
|
|
17304
|
+
set = path4.pop();
|
|
17164
17305
|
set[0].splice(i, 1);
|
|
17165
17306
|
set[1].splice(i, 1);
|
|
17166
17307
|
}
|
|
@@ -17252,13 +17393,13 @@ var require_get_fixed = __commonJS({
|
|
|
17252
17393
|
return lastId;
|
|
17253
17394
|
},
|
|
17254
17395
|
delete: function(id) {
|
|
17255
|
-
var index4 = 0, set = map, i,
|
|
17396
|
+
var index4 = 0, set = map, i, path4 = [], args = cache[id];
|
|
17256
17397
|
while (index4 < length - 1) {
|
|
17257
17398
|
i = indexOf.call(set[0], args[index4]);
|
|
17258
17399
|
if (i === -1) {
|
|
17259
17400
|
return;
|
|
17260
17401
|
}
|
|
17261
|
-
|
|
17402
|
+
path4.push(set, i);
|
|
17262
17403
|
set = set[1][i];
|
|
17263
17404
|
++index4;
|
|
17264
17405
|
}
|
|
@@ -17269,9 +17410,9 @@ var require_get_fixed = __commonJS({
|
|
|
17269
17410
|
id = set[1][i];
|
|
17270
17411
|
set[0].splice(i, 1);
|
|
17271
17412
|
set[1].splice(i, 1);
|
|
17272
|
-
while (!set[0].length &&
|
|
17273
|
-
i =
|
|
17274
|
-
set =
|
|
17413
|
+
while (!set[0].length && path4.length) {
|
|
17414
|
+
i = path4.pop();
|
|
17415
|
+
set = path4.pop();
|
|
17275
17416
|
set[0].splice(i, 1);
|
|
17276
17417
|
set[1].splice(i, 1);
|
|
17277
17418
|
}
|
|
@@ -18836,7 +18977,7 @@ var require_bare = __commonJS({
|
|
|
18836
18977
|
var sgr = require_sgr();
|
|
18837
18978
|
var supportsColor2 = require_supports_color2();
|
|
18838
18979
|
var mods = sgr.mods;
|
|
18839
|
-
var
|
|
18980
|
+
var join4 = Array.prototype.join;
|
|
18840
18981
|
var defineProperty = Object.defineProperty;
|
|
18841
18982
|
var max = Math.max;
|
|
18842
18983
|
var min = Math.min;
|
|
@@ -18890,7 +19031,7 @@ var require_bare = __commonJS({
|
|
|
18890
19031
|
getFn = function() {
|
|
18891
19032
|
return setPrototypeOf(
|
|
18892
19033
|
function self2() {
|
|
18893
|
-
var start = "", end = "", msg =
|
|
19034
|
+
var start = "", end = "", msg = join4.call(arguments, " "), conf = self2._cliColorData, hasAnsi = sgr.hasCSI(msg);
|
|
18894
19035
|
forEach(
|
|
18895
19036
|
conf,
|
|
18896
19037
|
function(mod, key) {
|
|
@@ -20321,7 +20462,7 @@ function diffForRenamedTable(t1, t2) {
|
|
|
20321
20462
|
t1.name = t2.name;
|
|
20322
20463
|
const diffed = (0, import_json_diff.diff)(t1, t2) || {};
|
|
20323
20464
|
diffed.name = t2.name;
|
|
20324
|
-
return findAlternationsInTable(diffed);
|
|
20465
|
+
return findAlternationsInTable(diffed, t2.schema);
|
|
20325
20466
|
}
|
|
20326
20467
|
function diffForRenamedColumn(t1, t2) {
|
|
20327
20468
|
const renamed = { ...t1, name: t2.name };
|
|
@@ -20335,6 +20476,10 @@ function applyJsonDiff(json1, json2) {
|
|
|
20335
20476
|
json2 = JSON.parse(JSON.stringify(json2));
|
|
20336
20477
|
const rawDiff = (0, import_json_diff.diff)(json1, json2);
|
|
20337
20478
|
const difference = rawDiff;
|
|
20479
|
+
const tableToSchema = Object.entries(json2.tables).reduce((res, it) => {
|
|
20480
|
+
res[it[0]] = it[1].schema;
|
|
20481
|
+
return res;
|
|
20482
|
+
}, {});
|
|
20338
20483
|
if (!difference)
|
|
20339
20484
|
return {};
|
|
20340
20485
|
difference.tables = (_a = difference.tables) != null ? _a : {};
|
|
@@ -20364,7 +20509,7 @@ function applyJsonDiff(json1, json2) {
|
|
|
20364
20509
|
const schemasEntries = Object.entries(difference.schemas);
|
|
20365
20510
|
const addedSchemas = schemasEntries.filter((it) => it[0].endsWith("__added")).map((it) => it[1]);
|
|
20366
20511
|
const deletedSchemas = schemasEntries.filter((it) => it[0].endsWith("__deleted")).map((it) => it[1]);
|
|
20367
|
-
const alteredTablesWithColumns = alteredTables.map((table4) => findAlternationsInTable(table4));
|
|
20512
|
+
const alteredTablesWithColumns = alteredTables.map((table4) => findAlternationsInTable(table4, tableToSchema[table4.name]));
|
|
20368
20513
|
return {
|
|
20369
20514
|
addedTables,
|
|
20370
20515
|
deletedTables,
|
|
@@ -20381,10 +20526,13 @@ var init_jsonDiffer = __esm({
|
|
|
20381
20526
|
"src/jsonDiffer.js"() {
|
|
20382
20527
|
import_json_diff = __toESM(require_lib());
|
|
20383
20528
|
"use-strict";
|
|
20384
|
-
findAlternationsInTable = (table4) => {
|
|
20529
|
+
findAlternationsInTable = (table4, tableSchema) => {
|
|
20385
20530
|
var _a;
|
|
20386
20531
|
const columns = (_a = table4.columns) != null ? _a : {};
|
|
20387
|
-
let schema4
|
|
20532
|
+
let schema4 = {
|
|
20533
|
+
type: "none",
|
|
20534
|
+
value: tableSchema
|
|
20535
|
+
};
|
|
20388
20536
|
if ("schema" in table4) {
|
|
20389
20537
|
if (table4.schema.__new) {
|
|
20390
20538
|
schema4 = { type: "changed", old: table4.schema.__old, new: table4.schema.__new };
|
|
@@ -20521,7 +20669,8 @@ var init_jsonStatements = __esm({
|
|
|
20521
20669
|
prepareDropTableJson = (table4) => {
|
|
20522
20670
|
return {
|
|
20523
20671
|
type: "drop_table",
|
|
20524
|
-
tableName: table4.name
|
|
20672
|
+
tableName: table4.name,
|
|
20673
|
+
schema: table4.schema
|
|
20525
20674
|
};
|
|
20526
20675
|
};
|
|
20527
20676
|
prepareRenameTableJson = (tableFrom, tableTo) => {
|
|
@@ -20574,20 +20723,21 @@ var init_jsonStatements = __esm({
|
|
|
20574
20723
|
};
|
|
20575
20724
|
});
|
|
20576
20725
|
};
|
|
20577
|
-
prepareRenameColumns = (tableName, pairs) => {
|
|
20726
|
+
prepareRenameColumns = (tableName, schema4, pairs) => {
|
|
20578
20727
|
return pairs.map((it) => {
|
|
20579
20728
|
return {
|
|
20580
20729
|
type: "alter_table_rename_column",
|
|
20581
20730
|
tableName,
|
|
20582
20731
|
oldColumnName: it.from.name,
|
|
20583
|
-
newColumnName: it.to.name
|
|
20732
|
+
newColumnName: it.to.name,
|
|
20733
|
+
schema: schema4
|
|
20584
20734
|
};
|
|
20585
20735
|
});
|
|
20586
20736
|
};
|
|
20587
|
-
prepareAlterTableColumnsJson = (tableName, deleted, added, altered, addedFk, dialect6) => {
|
|
20737
|
+
prepareAlterTableColumnsJson = (tableName, schema4, deleted, added, altered, addedFk, dialect6) => {
|
|
20588
20738
|
const addColumns = [];
|
|
20589
|
-
const dropColumns = _prepareDropColumns(tableName, deleted);
|
|
20590
|
-
const alterColumns = _prepareAlterColumns(tableName, altered);
|
|
20739
|
+
const dropColumns = _prepareDropColumns(tableName, schema4, deleted);
|
|
20740
|
+
const alterColumns = _prepareAlterColumns(tableName, schema4, altered);
|
|
20591
20741
|
if (dialect6 === "sqlite") {
|
|
20592
20742
|
let jsonCreateFKStatements = Object.values(addedFk);
|
|
20593
20743
|
const sqliteAddColumns = _prepareSQLiteAddColumns(
|
|
@@ -20597,25 +20747,27 @@ var init_jsonStatements = __esm({
|
|
|
20597
20747
|
);
|
|
20598
20748
|
addColumns.push(...sqliteAddColumns);
|
|
20599
20749
|
} else {
|
|
20600
|
-
addColumns.push(..._prepareAddColumns(tableName, added));
|
|
20750
|
+
addColumns.push(..._prepareAddColumns(tableName, schema4, added));
|
|
20601
20751
|
}
|
|
20602
20752
|
return { addColumns, dropColumns, alterColumns };
|
|
20603
20753
|
};
|
|
20604
|
-
_prepareDropColumns = (taleName, columns) => {
|
|
20754
|
+
_prepareDropColumns = (taleName, schema4, columns) => {
|
|
20605
20755
|
return columns.map((it) => {
|
|
20606
20756
|
return {
|
|
20607
20757
|
type: "alter_table_drop_column",
|
|
20608
20758
|
tableName: taleName,
|
|
20609
|
-
columnName: it.name
|
|
20759
|
+
columnName: it.name,
|
|
20760
|
+
schema: schema4
|
|
20610
20761
|
};
|
|
20611
20762
|
});
|
|
20612
20763
|
};
|
|
20613
|
-
_prepareAddColumns = (tableName, columns) => {
|
|
20764
|
+
_prepareAddColumns = (tableName, schema4, columns) => {
|
|
20614
20765
|
return columns.map((it) => {
|
|
20615
20766
|
return {
|
|
20616
20767
|
type: "alter_table_add_column",
|
|
20617
20768
|
tableName,
|
|
20618
|
-
column: it
|
|
20769
|
+
column: it,
|
|
20770
|
+
schema: schema4
|
|
20619
20771
|
};
|
|
20620
20772
|
});
|
|
20621
20773
|
};
|
|
@@ -20635,7 +20787,7 @@ var init_jsonStatements = __esm({
|
|
|
20635
20787
|
};
|
|
20636
20788
|
});
|
|
20637
20789
|
};
|
|
20638
|
-
_prepareAlterColumns = (tableName, columns) => {
|
|
20790
|
+
_prepareAlterColumns = (tableName, schema4, columns) => {
|
|
20639
20791
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
20640
20792
|
let statements = [];
|
|
20641
20793
|
for (const column5 of columns) {
|
|
@@ -20645,7 +20797,8 @@ var init_jsonStatements = __esm({
|
|
|
20645
20797
|
type: "alter_table_rename_column",
|
|
20646
20798
|
tableName,
|
|
20647
20799
|
oldColumnName: column5.name.old,
|
|
20648
|
-
newColumnName: column5.name.new
|
|
20800
|
+
newColumnName: column5.name.new,
|
|
20801
|
+
schema: schema4
|
|
20649
20802
|
});
|
|
20650
20803
|
}
|
|
20651
20804
|
if (((_a = column5.type) == null ? void 0 : _a.type) === "changed") {
|
|
@@ -20653,7 +20806,8 @@ var init_jsonStatements = __esm({
|
|
|
20653
20806
|
type: "alter_table_alter_column_set_type",
|
|
20654
20807
|
tableName,
|
|
20655
20808
|
columnName,
|
|
20656
|
-
newDataType: column5.type.new
|
|
20809
|
+
newDataType: column5.type.new,
|
|
20810
|
+
schema: schema4
|
|
20657
20811
|
});
|
|
20658
20812
|
}
|
|
20659
20813
|
if (((_b = column5.default) == null ? void 0 : _b.type) === "added") {
|
|
@@ -20661,7 +20815,8 @@ var init_jsonStatements = __esm({
|
|
|
20661
20815
|
type: "alter_table_alter_column_set_default",
|
|
20662
20816
|
tableName,
|
|
20663
20817
|
columnName,
|
|
20664
|
-
newDefaultValue: column5.default.value
|
|
20818
|
+
newDefaultValue: column5.default.value,
|
|
20819
|
+
schema: schema4
|
|
20665
20820
|
});
|
|
20666
20821
|
}
|
|
20667
20822
|
if (((_c = column5.default) == null ? void 0 : _c.type) === "changed") {
|
|
@@ -20669,21 +20824,24 @@ var init_jsonStatements = __esm({
|
|
|
20669
20824
|
type: "alter_table_alter_column_set_default",
|
|
20670
20825
|
tableName,
|
|
20671
20826
|
columnName,
|
|
20672
|
-
newDefaultValue: column5.default.new
|
|
20827
|
+
newDefaultValue: column5.default.new,
|
|
20828
|
+
schema: schema4
|
|
20673
20829
|
});
|
|
20674
20830
|
}
|
|
20675
20831
|
if (((_d = column5.default) == null ? void 0 : _d.type) === "deleted") {
|
|
20676
20832
|
statements.push({
|
|
20677
20833
|
type: "alter_table_alter_column_drop_default",
|
|
20678
20834
|
tableName,
|
|
20679
|
-
columnName
|
|
20835
|
+
columnName,
|
|
20836
|
+
schema: schema4
|
|
20680
20837
|
});
|
|
20681
20838
|
}
|
|
20682
20839
|
if (((_e = column5.notNull) == null ? void 0 : _e.type) === "added") {
|
|
20683
20840
|
statements.push({
|
|
20684
20841
|
type: "alter_table_alter_column_set_notnull",
|
|
20685
20842
|
tableName,
|
|
20686
|
-
columnName
|
|
20843
|
+
columnName,
|
|
20844
|
+
schema: schema4
|
|
20687
20845
|
});
|
|
20688
20846
|
}
|
|
20689
20847
|
if (((_f = column5.notNull) == null ? void 0 : _f.type) === "changed") {
|
|
@@ -20691,62 +20849,69 @@ var init_jsonStatements = __esm({
|
|
|
20691
20849
|
statements.push({
|
|
20692
20850
|
type,
|
|
20693
20851
|
tableName,
|
|
20694
|
-
columnName
|
|
20852
|
+
columnName,
|
|
20853
|
+
schema: schema4
|
|
20695
20854
|
});
|
|
20696
20855
|
}
|
|
20697
20856
|
if (((_g = column5.notNull) == null ? void 0 : _g.type) === "deleted") {
|
|
20698
20857
|
statements.push({
|
|
20699
20858
|
type: "alter_table_alter_column_drop_notnull",
|
|
20700
20859
|
tableName,
|
|
20701
|
-
columnName
|
|
20860
|
+
columnName,
|
|
20861
|
+
schema: schema4
|
|
20702
20862
|
});
|
|
20703
20863
|
}
|
|
20704
20864
|
}
|
|
20705
20865
|
return statements;
|
|
20706
20866
|
};
|
|
20707
|
-
prepareCreateIndexesJson = (tableName, indexes) => {
|
|
20867
|
+
prepareCreateIndexesJson = (tableName, schema4, indexes) => {
|
|
20708
20868
|
return Object.values(indexes).map((indexData) => {
|
|
20709
20869
|
return {
|
|
20710
20870
|
type: "create_index",
|
|
20711
20871
|
tableName,
|
|
20712
|
-
data: indexData
|
|
20872
|
+
data: indexData,
|
|
20873
|
+
schema: schema4
|
|
20713
20874
|
};
|
|
20714
20875
|
});
|
|
20715
20876
|
};
|
|
20716
|
-
prepareCreateReferencesJson = (tableName, foreignKeys) => {
|
|
20877
|
+
prepareCreateReferencesJson = (tableName, schema4, foreignKeys) => {
|
|
20717
20878
|
return Object.values(foreignKeys).map((fkData) => {
|
|
20718
20879
|
return {
|
|
20719
20880
|
type: "create_reference",
|
|
20720
20881
|
tableName,
|
|
20721
|
-
data: fkData
|
|
20882
|
+
data: fkData,
|
|
20883
|
+
schema: schema4
|
|
20722
20884
|
};
|
|
20723
20885
|
});
|
|
20724
20886
|
};
|
|
20725
|
-
prepareDropReferencesJson = (tableName, foreignKeys) => {
|
|
20887
|
+
prepareDropReferencesJson = (tableName, schema4, foreignKeys) => {
|
|
20726
20888
|
return Object.values(foreignKeys).map((fkData) => {
|
|
20727
20889
|
return {
|
|
20728
20890
|
type: "delete_reference",
|
|
20729
20891
|
tableName,
|
|
20730
|
-
data: fkData
|
|
20892
|
+
data: fkData,
|
|
20893
|
+
schema: schema4
|
|
20731
20894
|
};
|
|
20732
20895
|
});
|
|
20733
20896
|
};
|
|
20734
|
-
prepareAlterReferencesJson = (tableName, foreignKeys) => {
|
|
20897
|
+
prepareAlterReferencesJson = (tableName, schema4, foreignKeys) => {
|
|
20735
20898
|
return Object.values(foreignKeys).map((fkData) => {
|
|
20736
20899
|
return {
|
|
20737
20900
|
type: "alter_reference",
|
|
20738
20901
|
tableName,
|
|
20739
20902
|
data: fkData.__new,
|
|
20740
|
-
oldFkey: fkData.__old
|
|
20903
|
+
oldFkey: fkData.__old,
|
|
20904
|
+
schema: schema4
|
|
20741
20905
|
};
|
|
20742
20906
|
});
|
|
20743
20907
|
};
|
|
20744
|
-
prepareDropIndexesJson = (tableName, indexes) => {
|
|
20908
|
+
prepareDropIndexesJson = (tableName, schema4, indexes) => {
|
|
20745
20909
|
return Object.values(indexes).map((indexData) => {
|
|
20746
20910
|
return {
|
|
20747
20911
|
type: "drop_index",
|
|
20748
20912
|
tableName,
|
|
20749
|
-
data: indexData
|
|
20913
|
+
data: indexData,
|
|
20914
|
+
schema: schema4
|
|
20750
20915
|
};
|
|
20751
20916
|
});
|
|
20752
20917
|
};
|
|
@@ -20782,13 +20947,14 @@ var init_jsonStatements = __esm({
|
|
|
20782
20947
|
});
|
|
20783
20948
|
|
|
20784
20949
|
// src/snapshotsDiffer.ts
|
|
20785
|
-
var makeChanged, makeSelfOrChanged, makePatched, columnSchema, alteredColumnSchema, enumSchema2, changedEnumSchema, tableScheme, alteredTableScheme, diffResultScheme, applySnapshotsDiff;
|
|
20950
|
+
var makeChanged, makeSelfOrChanged, makePatched, makeSelfOrPatched, valueFromSelfOrPatchedNew, columnSchema, alteredColumnSchema, enumSchema2, changedEnumSchema, tableScheme, alteredTableScheme, diffResultScheme, applySnapshotsDiff;
|
|
20786
20951
|
var init_snapshotsDiffer = __esm({
|
|
20787
20952
|
"src/snapshotsDiffer.ts"() {
|
|
20788
20953
|
init_sqlgenerator();
|
|
20789
20954
|
init_lib();
|
|
20790
20955
|
init_jsonDiffer();
|
|
20791
20956
|
init_jsonStatements();
|
|
20957
|
+
init_utils();
|
|
20792
20958
|
makeChanged = (schema4) => {
|
|
20793
20959
|
return objectType({
|
|
20794
20960
|
type: enumType(["changed"]),
|
|
@@ -20809,20 +20975,53 @@ var init_snapshotsDiffer = __esm({
|
|
|
20809
20975
|
makePatched = (schema4) => {
|
|
20810
20976
|
return unionType([
|
|
20811
20977
|
objectType({
|
|
20812
|
-
type:
|
|
20978
|
+
type: literalType("added"),
|
|
20813
20979
|
value: schema4
|
|
20814
20980
|
}),
|
|
20815
20981
|
objectType({
|
|
20816
|
-
type:
|
|
20982
|
+
type: literalType("deleted"),
|
|
20817
20983
|
value: schema4
|
|
20818
20984
|
}),
|
|
20819
20985
|
objectType({
|
|
20820
|
-
type:
|
|
20986
|
+
type: literalType("changed"),
|
|
20987
|
+
old: schema4,
|
|
20988
|
+
new: schema4
|
|
20989
|
+
})
|
|
20990
|
+
]);
|
|
20991
|
+
};
|
|
20992
|
+
makeSelfOrPatched = (schema4) => {
|
|
20993
|
+
return unionType([
|
|
20994
|
+
objectType({
|
|
20995
|
+
type: literalType("none"),
|
|
20996
|
+
value: schema4
|
|
20997
|
+
}),
|
|
20998
|
+
objectType({
|
|
20999
|
+
type: literalType("added"),
|
|
21000
|
+
value: schema4
|
|
21001
|
+
}),
|
|
21002
|
+
objectType({
|
|
21003
|
+
type: literalType("deleted"),
|
|
21004
|
+
value: schema4
|
|
21005
|
+
}),
|
|
21006
|
+
objectType({
|
|
21007
|
+
type: literalType("changed"),
|
|
20821
21008
|
old: schema4,
|
|
20822
21009
|
new: schema4
|
|
20823
21010
|
})
|
|
20824
21011
|
]);
|
|
20825
21012
|
};
|
|
21013
|
+
valueFromSelfOrPatchedNew = (it) => {
|
|
21014
|
+
switch (it.type) {
|
|
21015
|
+
case "none":
|
|
21016
|
+
return it.value;
|
|
21017
|
+
case "added":
|
|
21018
|
+
return it.value;
|
|
21019
|
+
case "deleted":
|
|
21020
|
+
return it.value;
|
|
21021
|
+
case "changed":
|
|
21022
|
+
return it.new;
|
|
21023
|
+
}
|
|
21024
|
+
};
|
|
20826
21025
|
columnSchema = objectType({
|
|
20827
21026
|
name: stringType(),
|
|
20828
21027
|
type: stringType(),
|
|
@@ -20835,7 +21034,7 @@ var init_snapshotsDiffer = __esm({
|
|
|
20835
21034
|
alteredColumnSchema = objectType({
|
|
20836
21035
|
name: makeSelfOrChanged(stringType()),
|
|
20837
21036
|
type: makeChanged(stringType()).optional(),
|
|
20838
|
-
default: makePatched(
|
|
21037
|
+
default: makePatched(anyType()).optional(),
|
|
20839
21038
|
notNull: makePatched(booleanType()).optional()
|
|
20840
21039
|
}).strict();
|
|
20841
21040
|
enumSchema2 = objectType({
|
|
@@ -20857,7 +21056,7 @@ var init_snapshotsDiffer = __esm({
|
|
|
20857
21056
|
}).strict();
|
|
20858
21057
|
alteredTableScheme = objectType({
|
|
20859
21058
|
name: stringType(),
|
|
20860
|
-
schema:
|
|
21059
|
+
schema: makeSelfOrPatched(stringType()),
|
|
20861
21060
|
deleted: columnSchema.array(),
|
|
20862
21061
|
added: columnSchema.array(),
|
|
20863
21062
|
altered: alteredColumnSchema.array(),
|
|
@@ -20892,25 +21091,32 @@ var init_snapshotsDiffer = __esm({
|
|
|
20892
21091
|
addedSchemas: stringType().array(),
|
|
20893
21092
|
deletedSchemas: stringType().array()
|
|
20894
21093
|
}).strict();
|
|
20895
|
-
applySnapshotsDiff = async (json1, json2, dialect6,
|
|
21094
|
+
applySnapshotsDiff = async (json1, json2, dialect6, schemasResolver2, tablesResolver2, columnsResolver2) => {
|
|
20896
21095
|
var _a, _b, _c, _d;
|
|
20897
21096
|
const diffResult = applyJsonDiff(json1, json2);
|
|
20898
21097
|
if (Object.keys(diffResult).length === 0) {
|
|
20899
|
-
return "";
|
|
21098
|
+
return { statements: [], sql: "" };
|
|
20900
21099
|
}
|
|
20901
21100
|
const typedResult = diffResultScheme.parse(diffResult);
|
|
20902
21101
|
const {
|
|
20903
21102
|
created: createdSchemas,
|
|
20904
21103
|
deleted: deletedSchemas,
|
|
20905
21104
|
renamed: renamedSchemas
|
|
20906
|
-
} = await
|
|
21105
|
+
} = await schemasResolver2({
|
|
20907
21106
|
created: typedResult.addedSchemas.map((it) => ({ name: it })),
|
|
20908
21107
|
deleted: typedResult.deletedSchemas.map((it) => ({ name: it }))
|
|
20909
21108
|
});
|
|
20910
|
-
const { created, deleted, renamed } = await
|
|
21109
|
+
const { created, deleted, renamed } = await tablesResolver2({
|
|
20911
21110
|
created: typedResult.addedTables,
|
|
20912
21111
|
deleted: typedResult.deletedTables
|
|
20913
21112
|
});
|
|
21113
|
+
const rSchemas = renamedSchemas.map((it) => ({
|
|
21114
|
+
from: it.from.name,
|
|
21115
|
+
to: it.to.name
|
|
21116
|
+
}));
|
|
21117
|
+
const rTables = renamed.map((it) => {
|
|
21118
|
+
return { from: it.from, to: it.to };
|
|
21119
|
+
});
|
|
20914
21120
|
const jsonStatements = [];
|
|
20915
21121
|
const jsonSQLiteCreateTables = created.map((it) => {
|
|
20916
21122
|
return prepareSQLiteCreateTable(it);
|
|
@@ -20919,7 +21125,7 @@ var init_snapshotsDiffer = __esm({
|
|
|
20919
21125
|
return prepareCreateTableJson(it);
|
|
20920
21126
|
});
|
|
20921
21127
|
const jsonCreateIndexesForCreatedTables = created.map((it) => {
|
|
20922
|
-
return prepareCreateIndexesJson(it.name, it.indexes);
|
|
21128
|
+
return prepareCreateIndexesJson(it.name, it.schema, it.indexes);
|
|
20923
21129
|
}).flat();
|
|
20924
21130
|
const jsonDropTables = deleted.map((it) => {
|
|
20925
21131
|
return prepareDropTableJson(it);
|
|
@@ -20936,13 +21142,14 @@ var init_snapshotsDiffer = __esm({
|
|
|
20936
21142
|
const jsonRenameColumnsStatements = [];
|
|
20937
21143
|
const allAlteredResolved = [];
|
|
20938
21144
|
for (const table4 of allAltered) {
|
|
20939
|
-
const result = await
|
|
21145
|
+
const result = await columnsResolver2({
|
|
20940
21146
|
tableName: table4.name,
|
|
20941
21147
|
created: table4.added,
|
|
20942
21148
|
deleted: table4.deleted
|
|
20943
21149
|
});
|
|
21150
|
+
const schema4 = valueFromSelfOrPatchedNew(table4.schema);
|
|
20944
21151
|
jsonRenameColumnsStatements.push(
|
|
20945
|
-
...prepareRenameColumns(table4.name, result.renamed)
|
|
21152
|
+
...prepareRenameColumns(table4.name, schema4, result.renamed)
|
|
20946
21153
|
);
|
|
20947
21154
|
const renamedColumnsAltered = result.renamed.map(
|
|
20948
21155
|
(it) => alteredColumnSchema.parse(diffForRenamedColumn(it.from, it.to))
|
|
@@ -20984,7 +21191,7 @@ var init_snapshotsDiffer = __esm({
|
|
|
20984
21191
|
it.name,
|
|
20985
21192
|
it.alteredCompositePKs
|
|
20986
21193
|
);
|
|
20987
|
-
if (it.schema) {
|
|
21194
|
+
if (it.schema && typeof it.schema !== "string") {
|
|
20988
21195
|
switch (it.schema.type) {
|
|
20989
21196
|
case "added": {
|
|
20990
21197
|
jsonSetTableSchemas.push({
|
|
@@ -21017,38 +21224,56 @@ var init_snapshotsDiffer = __esm({
|
|
|
21017
21224
|
jsonDeletedCompositePKs.push(...deletedCompositePKs);
|
|
21018
21225
|
jsonAlteredCompositePKs.push(...alteredCompositePKs);
|
|
21019
21226
|
});
|
|
21227
|
+
const rColumns = jsonRenameColumnsStatements.map((it) => {
|
|
21228
|
+
const tableName = it.tableName;
|
|
21229
|
+
const schema4 = it.schema;
|
|
21230
|
+
return {
|
|
21231
|
+
from: { schema: schema4, table: tableName, column: it.oldColumnName },
|
|
21232
|
+
to: { schema: schema4, table: tableName, column: it.newColumnName }
|
|
21233
|
+
};
|
|
21234
|
+
});
|
|
21020
21235
|
const jsonTableAlternations = allAlteredResolved.map((it) => {
|
|
21236
|
+
const schema4 = valueFromSelfOrPatchedNew(it.schema);
|
|
21021
21237
|
return prepareAlterTableColumnsJson(
|
|
21022
21238
|
it.name,
|
|
21239
|
+
schema4,
|
|
21023
21240
|
it.deleted,
|
|
21024
21241
|
it.added,
|
|
21025
21242
|
it.altered,
|
|
21026
21243
|
it.addedForeignKeys,
|
|
21027
21244
|
dialect6
|
|
21028
21245
|
);
|
|
21029
|
-
}).flat().reduce(
|
|
21030
|
-
res
|
|
21031
|
-
|
|
21032
|
-
|
|
21033
|
-
|
|
21034
|
-
|
|
21246
|
+
}).flat().reduce(
|
|
21247
|
+
(res, it) => {
|
|
21248
|
+
res.createColumns.push(...it.addColumns);
|
|
21249
|
+
res.dropColumns.push(...it.dropColumns);
|
|
21250
|
+
res.alterColumns.push(...it.alterColumns);
|
|
21251
|
+
return res;
|
|
21252
|
+
},
|
|
21253
|
+
{ createColumns: [], dropColumns: [], alterColumns: [] }
|
|
21254
|
+
);
|
|
21035
21255
|
const jsonCreateIndexesForAllAlteredTables = allAltered.map((it) => {
|
|
21036
|
-
|
|
21256
|
+
const schema4 = valueFromSelfOrPatchedNew(it.schema);
|
|
21257
|
+
return prepareCreateIndexesJson(it.name, schema4, it.addedIndexes || {});
|
|
21037
21258
|
}).flat();
|
|
21038
21259
|
const jsonDropIndexesForAllAlteredTables = allAltered.map((it) => {
|
|
21039
|
-
|
|
21260
|
+
const schema4 = valueFromSelfOrPatchedNew(it.schema);
|
|
21261
|
+
return prepareDropIndexesJson(it.name, schema4, it.deletedIndexes || {});
|
|
21040
21262
|
}).flat();
|
|
21041
21263
|
const jsonCreateReferencesForCreatedTables = created.map((it) => {
|
|
21042
|
-
return prepareCreateReferencesJson(it.name, it.foreignKeys);
|
|
21264
|
+
return prepareCreateReferencesJson(it.name, it.schema, it.foreignKeys);
|
|
21043
21265
|
}).flat();
|
|
21044
21266
|
const jsonReferencesForAllAlteredTables = allAltered.map((it) => {
|
|
21045
|
-
const
|
|
21267
|
+
const schema4 = valueFromSelfOrPatchedNew(it.schema);
|
|
21268
|
+
const forAdded = dialect6 !== "sqlite" ? prepareCreateReferencesJson(it.name, schema4, it.addedForeignKeys) : [];
|
|
21046
21269
|
const forAltered = prepareDropReferencesJson(
|
|
21047
21270
|
it.name,
|
|
21271
|
+
schema4,
|
|
21048
21272
|
it.deletedForeignKeys
|
|
21049
21273
|
);
|
|
21050
21274
|
const alteredFKs = prepareAlterReferencesJson(
|
|
21051
21275
|
it.name,
|
|
21276
|
+
schema4,
|
|
21052
21277
|
it.alteredForeignKeys
|
|
21053
21278
|
);
|
|
21054
21279
|
return [...forAdded, ...forAltered, ...alteredFKs];
|
|
@@ -21110,11 +21335,1333 @@ var init_snapshotsDiffer = __esm({
|
|
|
21110
21335
|
jsonStatements.push(...jsonRemoveTableFromSchemas);
|
|
21111
21336
|
jsonStatements.push(...dropSchemas);
|
|
21112
21337
|
const sqlStatements = fromJson(jsonStatements, dialect6);
|
|
21113
|
-
|
|
21338
|
+
const _meta = prepareMigrationMeta(rSchemas, rTables, rColumns);
|
|
21339
|
+
return { statements: jsonStatements, sql: sqlStatements.join("\n"), _meta };
|
|
21114
21340
|
};
|
|
21115
21341
|
}
|
|
21116
21342
|
});
|
|
21117
21343
|
|
|
21344
|
+
// src/utils/words.ts
|
|
21345
|
+
var prepareMigrationMetadata, adjectives, heroes;
|
|
21346
|
+
var init_words = __esm({
|
|
21347
|
+
"src/utils/words.ts"() {
|
|
21348
|
+
prepareMigrationMetadata = (idx) => {
|
|
21349
|
+
const prefix = idx.toFixed(0).padStart(4, "0");
|
|
21350
|
+
const suffix = `${adjectives.random()}_${heroes.random()}`;
|
|
21351
|
+
const tag = `${prefix}_${suffix}`;
|
|
21352
|
+
return { prefix, suffix, tag };
|
|
21353
|
+
};
|
|
21354
|
+
adjectives = [
|
|
21355
|
+
"abandoned",
|
|
21356
|
+
"aberrant",
|
|
21357
|
+
"abnormal",
|
|
21358
|
+
"absent",
|
|
21359
|
+
"absurd",
|
|
21360
|
+
"acoustic",
|
|
21361
|
+
"adorable",
|
|
21362
|
+
"amazing",
|
|
21363
|
+
"ambiguous",
|
|
21364
|
+
"ambitious",
|
|
21365
|
+
"amused",
|
|
21366
|
+
"amusing",
|
|
21367
|
+
"ancient",
|
|
21368
|
+
"aromatic",
|
|
21369
|
+
"aspiring",
|
|
21370
|
+
"awesome",
|
|
21371
|
+
"bent",
|
|
21372
|
+
"big",
|
|
21373
|
+
"bitter",
|
|
21374
|
+
"bizarre",
|
|
21375
|
+
"black",
|
|
21376
|
+
"blue",
|
|
21377
|
+
"blushing",
|
|
21378
|
+
"bored",
|
|
21379
|
+
"boring",
|
|
21380
|
+
"bouncy",
|
|
21381
|
+
"brainy",
|
|
21382
|
+
"brave",
|
|
21383
|
+
"breezy",
|
|
21384
|
+
"brief",
|
|
21385
|
+
"bright",
|
|
21386
|
+
"broad",
|
|
21387
|
+
"broken",
|
|
21388
|
+
"brown",
|
|
21389
|
+
"bumpy",
|
|
21390
|
+
"burly",
|
|
21391
|
+
"busy",
|
|
21392
|
+
"calm",
|
|
21393
|
+
"careful",
|
|
21394
|
+
"careless",
|
|
21395
|
+
"certain",
|
|
21396
|
+
"charming",
|
|
21397
|
+
"cheerful",
|
|
21398
|
+
"chemical",
|
|
21399
|
+
"chief",
|
|
21400
|
+
"chilly",
|
|
21401
|
+
"chubby",
|
|
21402
|
+
"chunky",
|
|
21403
|
+
"clammy",
|
|
21404
|
+
"classy",
|
|
21405
|
+
"clean",
|
|
21406
|
+
"clear",
|
|
21407
|
+
"clever",
|
|
21408
|
+
"cloudy",
|
|
21409
|
+
"closed",
|
|
21410
|
+
"clumsy",
|
|
21411
|
+
"cold",
|
|
21412
|
+
"colorful",
|
|
21413
|
+
"colossal",
|
|
21414
|
+
"common",
|
|
21415
|
+
"complete",
|
|
21416
|
+
"complex",
|
|
21417
|
+
"concerned",
|
|
21418
|
+
"condemned",
|
|
21419
|
+
"confused",
|
|
21420
|
+
"conscious",
|
|
21421
|
+
"cooing",
|
|
21422
|
+
"cool",
|
|
21423
|
+
"crazy",
|
|
21424
|
+
"cuddly",
|
|
21425
|
+
"cultured",
|
|
21426
|
+
"curious",
|
|
21427
|
+
"curly",
|
|
21428
|
+
"curved",
|
|
21429
|
+
"curvy",
|
|
21430
|
+
"cute",
|
|
21431
|
+
"cynical",
|
|
21432
|
+
"daffy",
|
|
21433
|
+
"daily",
|
|
21434
|
+
"damp",
|
|
21435
|
+
"dapper",
|
|
21436
|
+
"dark",
|
|
21437
|
+
"dashing",
|
|
21438
|
+
"dazzling",
|
|
21439
|
+
"dear",
|
|
21440
|
+
"deep",
|
|
21441
|
+
"demonic",
|
|
21442
|
+
"dizzy",
|
|
21443
|
+
"dry",
|
|
21444
|
+
"dusty",
|
|
21445
|
+
"eager",
|
|
21446
|
+
"early",
|
|
21447
|
+
"easy",
|
|
21448
|
+
"elite",
|
|
21449
|
+
"eminent",
|
|
21450
|
+
"empty",
|
|
21451
|
+
"equal",
|
|
21452
|
+
"even",
|
|
21453
|
+
"exotic",
|
|
21454
|
+
"fair",
|
|
21455
|
+
"faithful",
|
|
21456
|
+
"familiar",
|
|
21457
|
+
"famous",
|
|
21458
|
+
"fancy",
|
|
21459
|
+
"fantastic",
|
|
21460
|
+
"far",
|
|
21461
|
+
"fast",
|
|
21462
|
+
"fat",
|
|
21463
|
+
"faulty",
|
|
21464
|
+
"fearless",
|
|
21465
|
+
"fine",
|
|
21466
|
+
"first",
|
|
21467
|
+
"fixed",
|
|
21468
|
+
"flaky",
|
|
21469
|
+
"flashy",
|
|
21470
|
+
"flat",
|
|
21471
|
+
"flawless",
|
|
21472
|
+
"flimsy",
|
|
21473
|
+
"flippant",
|
|
21474
|
+
"flowery",
|
|
21475
|
+
"fluffy",
|
|
21476
|
+
"foamy",
|
|
21477
|
+
"free",
|
|
21478
|
+
"freezing",
|
|
21479
|
+
"fresh",
|
|
21480
|
+
"friendly",
|
|
21481
|
+
"funny",
|
|
21482
|
+
"furry",
|
|
21483
|
+
"futuristic",
|
|
21484
|
+
"fuzzy",
|
|
21485
|
+
"giant",
|
|
21486
|
+
"gifted",
|
|
21487
|
+
"gigantic",
|
|
21488
|
+
"glamorous",
|
|
21489
|
+
"glorious",
|
|
21490
|
+
"glossy",
|
|
21491
|
+
"good",
|
|
21492
|
+
"goofy",
|
|
21493
|
+
"gorgeous",
|
|
21494
|
+
"graceful",
|
|
21495
|
+
"gray",
|
|
21496
|
+
"great",
|
|
21497
|
+
"greedy",
|
|
21498
|
+
"green",
|
|
21499
|
+
"grey",
|
|
21500
|
+
"groovy",
|
|
21501
|
+
"handy",
|
|
21502
|
+
"happy",
|
|
21503
|
+
"hard",
|
|
21504
|
+
"harsh",
|
|
21505
|
+
"heavy",
|
|
21506
|
+
"hesitant",
|
|
21507
|
+
"high",
|
|
21508
|
+
"hot",
|
|
21509
|
+
"huge",
|
|
21510
|
+
"icy",
|
|
21511
|
+
"illegal",
|
|
21512
|
+
"jazzy",
|
|
21513
|
+
"jittery",
|
|
21514
|
+
"keen",
|
|
21515
|
+
"kind",
|
|
21516
|
+
"known",
|
|
21517
|
+
"lame",
|
|
21518
|
+
"large",
|
|
21519
|
+
"last",
|
|
21520
|
+
"late",
|
|
21521
|
+
"lazy",
|
|
21522
|
+
"lean",
|
|
21523
|
+
"left",
|
|
21524
|
+
"legal",
|
|
21525
|
+
"lethal",
|
|
21526
|
+
"light",
|
|
21527
|
+
"little",
|
|
21528
|
+
"lively",
|
|
21529
|
+
"living",
|
|
21530
|
+
"lonely",
|
|
21531
|
+
"long",
|
|
21532
|
+
"loose",
|
|
21533
|
+
"loud",
|
|
21534
|
+
"lovely",
|
|
21535
|
+
"loving",
|
|
21536
|
+
"low",
|
|
21537
|
+
"lowly",
|
|
21538
|
+
"lucky",
|
|
21539
|
+
"lumpy",
|
|
21540
|
+
"lush",
|
|
21541
|
+
"luxuriant",
|
|
21542
|
+
"lying",
|
|
21543
|
+
"lyrical",
|
|
21544
|
+
"magenta",
|
|
21545
|
+
"magical",
|
|
21546
|
+
"majestic",
|
|
21547
|
+
"many",
|
|
21548
|
+
"massive",
|
|
21549
|
+
"married",
|
|
21550
|
+
"marvelous",
|
|
21551
|
+
"material",
|
|
21552
|
+
"mature",
|
|
21553
|
+
"mean",
|
|
21554
|
+
"medical",
|
|
21555
|
+
"melodic",
|
|
21556
|
+
"melted",
|
|
21557
|
+
"messy",
|
|
21558
|
+
"mighty",
|
|
21559
|
+
"military",
|
|
21560
|
+
"milky",
|
|
21561
|
+
"minor",
|
|
21562
|
+
"misty",
|
|
21563
|
+
"mixed",
|
|
21564
|
+
"moaning",
|
|
21565
|
+
"modern",
|
|
21566
|
+
"motionless",
|
|
21567
|
+
"mushy",
|
|
21568
|
+
"mute",
|
|
21569
|
+
"mysterious",
|
|
21570
|
+
"naive",
|
|
21571
|
+
"nappy",
|
|
21572
|
+
"narrow",
|
|
21573
|
+
"nasty",
|
|
21574
|
+
"natural",
|
|
21575
|
+
"neat",
|
|
21576
|
+
"nebulous",
|
|
21577
|
+
"needy",
|
|
21578
|
+
"nervous",
|
|
21579
|
+
"new",
|
|
21580
|
+
"next",
|
|
21581
|
+
"nice",
|
|
21582
|
+
"nifty",
|
|
21583
|
+
"noisy",
|
|
21584
|
+
"normal",
|
|
21585
|
+
"nostalgic",
|
|
21586
|
+
"nosy",
|
|
21587
|
+
"numerous",
|
|
21588
|
+
"odd",
|
|
21589
|
+
"old",
|
|
21590
|
+
"omniscient",
|
|
21591
|
+
"open",
|
|
21592
|
+
"opposite",
|
|
21593
|
+
"optimal",
|
|
21594
|
+
"orange",
|
|
21595
|
+
"ordinary",
|
|
21596
|
+
"organic",
|
|
21597
|
+
"outgoing",
|
|
21598
|
+
"outstanding",
|
|
21599
|
+
"oval",
|
|
21600
|
+
"overconfident",
|
|
21601
|
+
"overjoyed",
|
|
21602
|
+
"overrated",
|
|
21603
|
+
"pale",
|
|
21604
|
+
"panoramic",
|
|
21605
|
+
"parallel",
|
|
21606
|
+
"parched",
|
|
21607
|
+
"past",
|
|
21608
|
+
"peaceful",
|
|
21609
|
+
"perfect",
|
|
21610
|
+
"perpetual",
|
|
21611
|
+
"petite",
|
|
21612
|
+
"pink",
|
|
21613
|
+
"plain",
|
|
21614
|
+
"polite",
|
|
21615
|
+
"powerful",
|
|
21616
|
+
"premium",
|
|
21617
|
+
"pretty",
|
|
21618
|
+
"previous",
|
|
21619
|
+
"productive",
|
|
21620
|
+
"public",
|
|
21621
|
+
"purple",
|
|
21622
|
+
"puzzling",
|
|
21623
|
+
"quick",
|
|
21624
|
+
"quiet",
|
|
21625
|
+
"rainy",
|
|
21626
|
+
"rapid",
|
|
21627
|
+
"rare",
|
|
21628
|
+
"real",
|
|
21629
|
+
"red",
|
|
21630
|
+
"redundant",
|
|
21631
|
+
"reflective",
|
|
21632
|
+
"regular",
|
|
21633
|
+
"remarkable",
|
|
21634
|
+
"rich",
|
|
21635
|
+
"right",
|
|
21636
|
+
"robust",
|
|
21637
|
+
"romantic",
|
|
21638
|
+
"round",
|
|
21639
|
+
"sad",
|
|
21640
|
+
"safe",
|
|
21641
|
+
"salty",
|
|
21642
|
+
"same",
|
|
21643
|
+
"secret",
|
|
21644
|
+
"serious",
|
|
21645
|
+
"shallow",
|
|
21646
|
+
"sharp",
|
|
21647
|
+
"shiny",
|
|
21648
|
+
"shocking",
|
|
21649
|
+
"short",
|
|
21650
|
+
"silent",
|
|
21651
|
+
"silky",
|
|
21652
|
+
"silly",
|
|
21653
|
+
"simple",
|
|
21654
|
+
"skinny",
|
|
21655
|
+
"sleepy",
|
|
21656
|
+
"slim",
|
|
21657
|
+
"slimy",
|
|
21658
|
+
"slippery",
|
|
21659
|
+
"sloppy",
|
|
21660
|
+
"slow",
|
|
21661
|
+
"small",
|
|
21662
|
+
"smart",
|
|
21663
|
+
"smiling",
|
|
21664
|
+
"smooth",
|
|
21665
|
+
"soft",
|
|
21666
|
+
"solid",
|
|
21667
|
+
"sour",
|
|
21668
|
+
"sparkling",
|
|
21669
|
+
"special",
|
|
21670
|
+
"spicy",
|
|
21671
|
+
"spooky",
|
|
21672
|
+
"spotty",
|
|
21673
|
+
"square",
|
|
21674
|
+
"stale",
|
|
21675
|
+
"steady",
|
|
21676
|
+
"steep",
|
|
21677
|
+
"sticky",
|
|
21678
|
+
"stiff",
|
|
21679
|
+
"stormy",
|
|
21680
|
+
"strange",
|
|
21681
|
+
"striped",
|
|
21682
|
+
"strong",
|
|
21683
|
+
"sturdy",
|
|
21684
|
+
"sudden",
|
|
21685
|
+
"superb",
|
|
21686
|
+
"supreme",
|
|
21687
|
+
"sweet",
|
|
21688
|
+
"swift",
|
|
21689
|
+
"talented",
|
|
21690
|
+
"tan",
|
|
21691
|
+
"tearful",
|
|
21692
|
+
"tense",
|
|
21693
|
+
"thankful",
|
|
21694
|
+
"thick",
|
|
21695
|
+
"thin",
|
|
21696
|
+
"third",
|
|
21697
|
+
"tidy",
|
|
21698
|
+
"tiny",
|
|
21699
|
+
"tired",
|
|
21700
|
+
"tiresome",
|
|
21701
|
+
"tough",
|
|
21702
|
+
"tranquil",
|
|
21703
|
+
"tricky",
|
|
21704
|
+
"true",
|
|
21705
|
+
"typical",
|
|
21706
|
+
"uneven",
|
|
21707
|
+
"unique",
|
|
21708
|
+
"unknown",
|
|
21709
|
+
"unusual",
|
|
21710
|
+
"useful",
|
|
21711
|
+
"vengeful",
|
|
21712
|
+
"violet",
|
|
21713
|
+
"volatile",
|
|
21714
|
+
"wakeful",
|
|
21715
|
+
"wandering",
|
|
21716
|
+
"warm",
|
|
21717
|
+
"watery",
|
|
21718
|
+
"wealthy",
|
|
21719
|
+
"wet",
|
|
21720
|
+
"white",
|
|
21721
|
+
"whole",
|
|
21722
|
+
"wide",
|
|
21723
|
+
"wild",
|
|
21724
|
+
"windy",
|
|
21725
|
+
"wise",
|
|
21726
|
+
"wonderful",
|
|
21727
|
+
"wooden",
|
|
21728
|
+
"woozy",
|
|
21729
|
+
"workable",
|
|
21730
|
+
"worried",
|
|
21731
|
+
"worthless",
|
|
21732
|
+
"yellow",
|
|
21733
|
+
"yielding",
|
|
21734
|
+
"young",
|
|
21735
|
+
"youthful",
|
|
21736
|
+
"yummy",
|
|
21737
|
+
"zippy"
|
|
21738
|
+
];
|
|
21739
|
+
heroes = [
|
|
21740
|
+
"aaron_stack",
|
|
21741
|
+
"abomination",
|
|
21742
|
+
"absorbing_man",
|
|
21743
|
+
"adam_destine",
|
|
21744
|
+
"adam_warlock",
|
|
21745
|
+
"agent_brand",
|
|
21746
|
+
"agent_zero",
|
|
21747
|
+
"albert_cleary",
|
|
21748
|
+
"alex_power",
|
|
21749
|
+
"alex_wilder",
|
|
21750
|
+
"alice",
|
|
21751
|
+
"amazoness",
|
|
21752
|
+
"amphibian",
|
|
21753
|
+
"angel",
|
|
21754
|
+
"anita_blake",
|
|
21755
|
+
"annihilus",
|
|
21756
|
+
"anthem",
|
|
21757
|
+
"apocalypse",
|
|
21758
|
+
"aqueduct",
|
|
21759
|
+
"arachne",
|
|
21760
|
+
"archangel",
|
|
21761
|
+
"arclight",
|
|
21762
|
+
"ares",
|
|
21763
|
+
"argent",
|
|
21764
|
+
"avengers",
|
|
21765
|
+
"azazel",
|
|
21766
|
+
"banshee",
|
|
21767
|
+
"baron_strucker",
|
|
21768
|
+
"baron_zemo",
|
|
21769
|
+
"barracuda",
|
|
21770
|
+
"bastion",
|
|
21771
|
+
"beast",
|
|
21772
|
+
"bedlam",
|
|
21773
|
+
"ben_grimm",
|
|
21774
|
+
"ben_parker",
|
|
21775
|
+
"ben_urich",
|
|
21776
|
+
"betty_brant",
|
|
21777
|
+
"betty_ross",
|
|
21778
|
+
"beyonder",
|
|
21779
|
+
"big_bertha",
|
|
21780
|
+
"bill_hollister",
|
|
21781
|
+
"bishop",
|
|
21782
|
+
"black_bird",
|
|
21783
|
+
"black_bolt",
|
|
21784
|
+
"black_cat",
|
|
21785
|
+
"black_crow",
|
|
21786
|
+
"black_knight",
|
|
21787
|
+
"black_panther",
|
|
21788
|
+
"black_queen",
|
|
21789
|
+
"black_tarantula",
|
|
21790
|
+
"black_tom",
|
|
21791
|
+
"black_widow",
|
|
21792
|
+
"blackheart",
|
|
21793
|
+
"blacklash",
|
|
21794
|
+
"blade",
|
|
21795
|
+
"blazing_skull",
|
|
21796
|
+
"blindfold",
|
|
21797
|
+
"blink",
|
|
21798
|
+
"blizzard",
|
|
21799
|
+
"blob",
|
|
21800
|
+
"blockbuster",
|
|
21801
|
+
"blonde_phantom",
|
|
21802
|
+
"bloodaxe",
|
|
21803
|
+
"bloodscream",
|
|
21804
|
+
"bloodstorm",
|
|
21805
|
+
"bloodstrike",
|
|
21806
|
+
"blue_blade",
|
|
21807
|
+
"blue_marvel",
|
|
21808
|
+
"blue_shield",
|
|
21809
|
+
"blur",
|
|
21810
|
+
"boom_boom",
|
|
21811
|
+
"boomer",
|
|
21812
|
+
"boomerang",
|
|
21813
|
+
"bromley",
|
|
21814
|
+
"brood",
|
|
21815
|
+
"brother_voodoo",
|
|
21816
|
+
"bruce_banner",
|
|
21817
|
+
"bucky",
|
|
21818
|
+
"bug",
|
|
21819
|
+
"bulldozer",
|
|
21820
|
+
"bullseye",
|
|
21821
|
+
"bushwacker",
|
|
21822
|
+
"butterfly",
|
|
21823
|
+
"cable",
|
|
21824
|
+
"callisto",
|
|
21825
|
+
"calypso",
|
|
21826
|
+
"cammi",
|
|
21827
|
+
"cannonball",
|
|
21828
|
+
"captain_america",
|
|
21829
|
+
"captain_britain",
|
|
21830
|
+
"captain_cross",
|
|
21831
|
+
"captain_flint",
|
|
21832
|
+
"captain_marvel",
|
|
21833
|
+
"captain_midlands",
|
|
21834
|
+
"captain_stacy",
|
|
21835
|
+
"captain_universe",
|
|
21836
|
+
"cardiac",
|
|
21837
|
+
"caretaker",
|
|
21838
|
+
"cargill",
|
|
21839
|
+
"carlie_cooper",
|
|
21840
|
+
"carmella_unuscione",
|
|
21841
|
+
"carnage",
|
|
21842
|
+
"cassandra_nova",
|
|
21843
|
+
"catseye",
|
|
21844
|
+
"celestials",
|
|
21845
|
+
"centennial",
|
|
21846
|
+
"cerebro",
|
|
21847
|
+
"cerise",
|
|
21848
|
+
"chamber",
|
|
21849
|
+
"chameleon",
|
|
21850
|
+
"champions",
|
|
21851
|
+
"changeling",
|
|
21852
|
+
"charles_xavier",
|
|
21853
|
+
"chat",
|
|
21854
|
+
"chimera",
|
|
21855
|
+
"christian_walker",
|
|
21856
|
+
"chronomancer",
|
|
21857
|
+
"clea",
|
|
21858
|
+
"clint_barton",
|
|
21859
|
+
"cloak",
|
|
21860
|
+
"cobalt_man",
|
|
21861
|
+
"colleen_wing",
|
|
21862
|
+
"colonel_america",
|
|
21863
|
+
"colossus",
|
|
21864
|
+
"corsair",
|
|
21865
|
+
"crusher_hogan",
|
|
21866
|
+
"crystal",
|
|
21867
|
+
"cyclops",
|
|
21868
|
+
"dagger",
|
|
21869
|
+
"daimon_hellstrom",
|
|
21870
|
+
"dakota_north",
|
|
21871
|
+
"daredevil",
|
|
21872
|
+
"dark_beast",
|
|
21873
|
+
"dark_phoenix",
|
|
21874
|
+
"darkhawk",
|
|
21875
|
+
"darkstar",
|
|
21876
|
+
"darwin",
|
|
21877
|
+
"dazzler",
|
|
21878
|
+
"deadpool",
|
|
21879
|
+
"deathbird",
|
|
21880
|
+
"deathstrike",
|
|
21881
|
+
"demogoblin",
|
|
21882
|
+
"devos",
|
|
21883
|
+
"dexter_bennett",
|
|
21884
|
+
"diamondback",
|
|
21885
|
+
"doctor_doom",
|
|
21886
|
+
"doctor_faustus",
|
|
21887
|
+
"doctor_octopus",
|
|
21888
|
+
"doctor_spectrum",
|
|
21889
|
+
"doctor_strange",
|
|
21890
|
+
"domino",
|
|
21891
|
+
"donald_blake",
|
|
21892
|
+
"doomsday",
|
|
21893
|
+
"doorman",
|
|
21894
|
+
"dorian_gray",
|
|
21895
|
+
"dormammu",
|
|
21896
|
+
"dracula",
|
|
21897
|
+
"dragon_lord",
|
|
21898
|
+
"dragon_man",
|
|
21899
|
+
"drax",
|
|
21900
|
+
"dreadnoughts",
|
|
21901
|
+
"dreaming_celestial",
|
|
21902
|
+
"dust",
|
|
21903
|
+
"earthquake",
|
|
21904
|
+
"echo",
|
|
21905
|
+
"eddie_brock",
|
|
21906
|
+
"edwin_jarvis",
|
|
21907
|
+
"ego",
|
|
21908
|
+
"electro",
|
|
21909
|
+
"elektra",
|
|
21910
|
+
"emma_frost",
|
|
21911
|
+
"enchantress",
|
|
21912
|
+
"ender_wiggin",
|
|
21913
|
+
"energizer",
|
|
21914
|
+
"epoch",
|
|
21915
|
+
"eternals",
|
|
21916
|
+
"eternity",
|
|
21917
|
+
"excalibur",
|
|
21918
|
+
"exiles",
|
|
21919
|
+
"exodus",
|
|
21920
|
+
"expediter",
|
|
21921
|
+
"ezekiel",
|
|
21922
|
+
"ezekiel_stane",
|
|
21923
|
+
"fabian_cortez",
|
|
21924
|
+
"falcon",
|
|
21925
|
+
"fallen_one",
|
|
21926
|
+
"famine",
|
|
21927
|
+
"fantastic_four",
|
|
21928
|
+
"fat_cobra",
|
|
21929
|
+
"felicia_hardy",
|
|
21930
|
+
"fenris",
|
|
21931
|
+
"firebird",
|
|
21932
|
+
"firebrand",
|
|
21933
|
+
"firedrake",
|
|
21934
|
+
"firelord",
|
|
21935
|
+
"firestar",
|
|
21936
|
+
"fixer",
|
|
21937
|
+
"flatman",
|
|
21938
|
+
"forge",
|
|
21939
|
+
"forgotten_one",
|
|
21940
|
+
"frank_castle",
|
|
21941
|
+
"franklin_richards",
|
|
21942
|
+
"franklin_storm",
|
|
21943
|
+
"freak",
|
|
21944
|
+
"frightful_four",
|
|
21945
|
+
"frog_thor",
|
|
21946
|
+
"gabe_jones",
|
|
21947
|
+
"galactus",
|
|
21948
|
+
"gambit",
|
|
21949
|
+
"gamma_corps",
|
|
21950
|
+
"gamora",
|
|
21951
|
+
"gargoyle",
|
|
21952
|
+
"garia",
|
|
21953
|
+
"gateway",
|
|
21954
|
+
"gauntlet",
|
|
21955
|
+
"genesis",
|
|
21956
|
+
"george_stacy",
|
|
21957
|
+
"gertrude_yorkes",
|
|
21958
|
+
"ghost_rider",
|
|
21959
|
+
"giant_girl",
|
|
21960
|
+
"giant_man",
|
|
21961
|
+
"gideon",
|
|
21962
|
+
"gladiator",
|
|
21963
|
+
"glorian",
|
|
21964
|
+
"goblin_queen",
|
|
21965
|
+
"golden_guardian",
|
|
21966
|
+
"goliath",
|
|
21967
|
+
"gorgon",
|
|
21968
|
+
"gorilla_man",
|
|
21969
|
+
"grandmaster",
|
|
21970
|
+
"gravity",
|
|
21971
|
+
"green_goblin",
|
|
21972
|
+
"gressill",
|
|
21973
|
+
"grey_gargoyle",
|
|
21974
|
+
"greymalkin",
|
|
21975
|
+
"grim_reaper",
|
|
21976
|
+
"groot",
|
|
21977
|
+
"guardian",
|
|
21978
|
+
"guardsmen",
|
|
21979
|
+
"gunslinger",
|
|
21980
|
+
"gwen_stacy",
|
|
21981
|
+
"hairball",
|
|
21982
|
+
"hammerhead",
|
|
21983
|
+
"hannibal_king",
|
|
21984
|
+
"hardball",
|
|
21985
|
+
"harpoon",
|
|
21986
|
+
"harrier",
|
|
21987
|
+
"harry_osborn",
|
|
21988
|
+
"havok",
|
|
21989
|
+
"hawkeye",
|
|
21990
|
+
"hedge_knight",
|
|
21991
|
+
"hellcat",
|
|
21992
|
+
"hellfire_club",
|
|
21993
|
+
"hellion",
|
|
21994
|
+
"hemingway",
|
|
21995
|
+
"hercules",
|
|
21996
|
+
"hex",
|
|
21997
|
+
"hiroim",
|
|
21998
|
+
"hitman",
|
|
21999
|
+
"hobgoblin",
|
|
22000
|
+
"hulk",
|
|
22001
|
+
"human_cannonball",
|
|
22002
|
+
"human_fly",
|
|
22003
|
+
"human_robot",
|
|
22004
|
+
"human_torch",
|
|
22005
|
+
"husk",
|
|
22006
|
+
"hydra",
|
|
22007
|
+
"iceman",
|
|
22008
|
+
"ikaris",
|
|
22009
|
+
"imperial_guard",
|
|
22010
|
+
"impossible_man",
|
|
22011
|
+
"inertia",
|
|
22012
|
+
"infant_terrible",
|
|
22013
|
+
"inhumans",
|
|
22014
|
+
"ink",
|
|
22015
|
+
"invaders",
|
|
22016
|
+
"invisible_woman",
|
|
22017
|
+
"iron_fist",
|
|
22018
|
+
"iron_lad",
|
|
22019
|
+
"iron_man",
|
|
22020
|
+
"iron_monger",
|
|
22021
|
+
"iron_patriot",
|
|
22022
|
+
"ironclad",
|
|
22023
|
+
"jack_flag",
|
|
22024
|
+
"jack_murdock",
|
|
22025
|
+
"jack_power",
|
|
22026
|
+
"jackal",
|
|
22027
|
+
"jackpot",
|
|
22028
|
+
"james_howlett",
|
|
22029
|
+
"jamie_braddock",
|
|
22030
|
+
"jane_foster",
|
|
22031
|
+
"jasper_sitwell",
|
|
22032
|
+
"jazinda",
|
|
22033
|
+
"jean_grey",
|
|
22034
|
+
"jetstream",
|
|
22035
|
+
"jigsaw",
|
|
22036
|
+
"jimmy_woo",
|
|
22037
|
+
"jocasta",
|
|
22038
|
+
"johnny_blaze",
|
|
22039
|
+
"johnny_storm",
|
|
22040
|
+
"joseph",
|
|
22041
|
+
"joshua_kane",
|
|
22042
|
+
"joystick",
|
|
22043
|
+
"jubilee",
|
|
22044
|
+
"juggernaut",
|
|
22045
|
+
"junta",
|
|
22046
|
+
"justice",
|
|
22047
|
+
"justin_hammer",
|
|
22048
|
+
"kabuki",
|
|
22049
|
+
"kang",
|
|
22050
|
+
"karen_page",
|
|
22051
|
+
"karma",
|
|
22052
|
+
"karnak",
|
|
22053
|
+
"kat_farrell",
|
|
22054
|
+
"kate_bishop",
|
|
22055
|
+
"katie_power",
|
|
22056
|
+
"ken_ellis",
|
|
22057
|
+
"khan",
|
|
22058
|
+
"kid_colt",
|
|
22059
|
+
"killer_shrike",
|
|
22060
|
+
"killmonger",
|
|
22061
|
+
"killraven",
|
|
22062
|
+
"king_bedlam",
|
|
22063
|
+
"king_cobra",
|
|
22064
|
+
"kingpin",
|
|
22065
|
+
"kinsey_walden",
|
|
22066
|
+
"kitty_pryde",
|
|
22067
|
+
"klaw",
|
|
22068
|
+
"komodo",
|
|
22069
|
+
"korath",
|
|
22070
|
+
"korg",
|
|
22071
|
+
"korvac",
|
|
22072
|
+
"kree",
|
|
22073
|
+
"krista_starr",
|
|
22074
|
+
"kronos",
|
|
22075
|
+
"kulan_gath",
|
|
22076
|
+
"kylun",
|
|
22077
|
+
"la_nuit",
|
|
22078
|
+
"lady_bullseye",
|
|
22079
|
+
"lady_deathstrike",
|
|
22080
|
+
"lady_mastermind",
|
|
22081
|
+
"lady_ursula",
|
|
22082
|
+
"lady_vermin",
|
|
22083
|
+
"lake",
|
|
22084
|
+
"landau",
|
|
22085
|
+
"layla_miller",
|
|
22086
|
+
"leader",
|
|
22087
|
+
"leech",
|
|
22088
|
+
"legion",
|
|
22089
|
+
"lenny_balinger",
|
|
22090
|
+
"leo",
|
|
22091
|
+
"leopardon",
|
|
22092
|
+
"leper_queen",
|
|
22093
|
+
"lester",
|
|
22094
|
+
"lethal_legion",
|
|
22095
|
+
"lifeguard",
|
|
22096
|
+
"lightspeed",
|
|
22097
|
+
"lila_cheney",
|
|
22098
|
+
"lilandra",
|
|
22099
|
+
"lilith",
|
|
22100
|
+
"lily_hollister",
|
|
22101
|
+
"lionheart",
|
|
22102
|
+
"living_lightning",
|
|
22103
|
+
"living_mummy",
|
|
22104
|
+
"living_tribunal",
|
|
22105
|
+
"liz_osborn",
|
|
22106
|
+
"lizard",
|
|
22107
|
+
"loa",
|
|
22108
|
+
"lockheed",
|
|
22109
|
+
"lockjaw",
|
|
22110
|
+
"logan",
|
|
22111
|
+
"loki",
|
|
22112
|
+
"loners",
|
|
22113
|
+
"longshot",
|
|
22114
|
+
"lord_hawal",
|
|
22115
|
+
"lord_tyger",
|
|
22116
|
+
"lorna_dane",
|
|
22117
|
+
"luckman",
|
|
22118
|
+
"lucky_pierre",
|
|
22119
|
+
"luke_cage",
|
|
22120
|
+
"luminals",
|
|
22121
|
+
"lyja",
|
|
22122
|
+
"ma_gnuci",
|
|
22123
|
+
"mac_gargan",
|
|
22124
|
+
"mach_iv",
|
|
22125
|
+
"machine_man",
|
|
22126
|
+
"mad_thinker",
|
|
22127
|
+
"madame_hydra",
|
|
22128
|
+
"madame_masque",
|
|
22129
|
+
"madame_web",
|
|
22130
|
+
"maddog",
|
|
22131
|
+
"madelyne_pryor",
|
|
22132
|
+
"madripoor",
|
|
22133
|
+
"madrox",
|
|
22134
|
+
"maelstrom",
|
|
22135
|
+
"maestro",
|
|
22136
|
+
"magdalene",
|
|
22137
|
+
"maggott",
|
|
22138
|
+
"magik",
|
|
22139
|
+
"maginty",
|
|
22140
|
+
"magma",
|
|
22141
|
+
"magneto",
|
|
22142
|
+
"magus",
|
|
22143
|
+
"major_mapleleaf",
|
|
22144
|
+
"makkari",
|
|
22145
|
+
"malcolm_colcord",
|
|
22146
|
+
"malice",
|
|
22147
|
+
"mandarin",
|
|
22148
|
+
"mandrill",
|
|
22149
|
+
"mandroid",
|
|
22150
|
+
"manta",
|
|
22151
|
+
"mantis",
|
|
22152
|
+
"marauders",
|
|
22153
|
+
"maria_hill",
|
|
22154
|
+
"mariko_yashida",
|
|
22155
|
+
"marrow",
|
|
22156
|
+
"marten_broadcloak",
|
|
22157
|
+
"martin_li",
|
|
22158
|
+
"marvel_apes",
|
|
22159
|
+
"marvel_boy",
|
|
22160
|
+
"marvel_zombies",
|
|
22161
|
+
"marvex",
|
|
22162
|
+
"masked_marvel",
|
|
22163
|
+
"masque",
|
|
22164
|
+
"master_chief",
|
|
22165
|
+
"master_mold",
|
|
22166
|
+
"mastermind",
|
|
22167
|
+
"mathemanic",
|
|
22168
|
+
"matthew_murdock",
|
|
22169
|
+
"mattie_franklin",
|
|
22170
|
+
"mauler",
|
|
22171
|
+
"maverick",
|
|
22172
|
+
"maximus",
|
|
22173
|
+
"may_parker",
|
|
22174
|
+
"medusa",
|
|
22175
|
+
"meggan",
|
|
22176
|
+
"meltdown",
|
|
22177
|
+
"menace",
|
|
22178
|
+
"mentallo",
|
|
22179
|
+
"mentor",
|
|
22180
|
+
"mephisto",
|
|
22181
|
+
"mephistopheles",
|
|
22182
|
+
"mercury",
|
|
22183
|
+
"mesmero",
|
|
22184
|
+
"metal_master",
|
|
22185
|
+
"meteorite",
|
|
22186
|
+
"micro/macro",
|
|
22187
|
+
"microbe",
|
|
22188
|
+
"microchip",
|
|
22189
|
+
"micromax",
|
|
22190
|
+
"midnight",
|
|
22191
|
+
"miek",
|
|
22192
|
+
"mikhail_rasputin",
|
|
22193
|
+
"millenium_guard",
|
|
22194
|
+
"mimic",
|
|
22195
|
+
"mindworm",
|
|
22196
|
+
"miracleman",
|
|
22197
|
+
"miss_america",
|
|
22198
|
+
"mister_fear",
|
|
22199
|
+
"mister_sinister",
|
|
22200
|
+
"misty_knight",
|
|
22201
|
+
"mockingbird",
|
|
22202
|
+
"moira_mactaggert",
|
|
22203
|
+
"mojo",
|
|
22204
|
+
"mole_man",
|
|
22205
|
+
"molecule_man",
|
|
22206
|
+
"molly_hayes",
|
|
22207
|
+
"molten_man",
|
|
22208
|
+
"mongoose",
|
|
22209
|
+
"mongu",
|
|
22210
|
+
"monster_badoon",
|
|
22211
|
+
"moon_knight",
|
|
22212
|
+
"moondragon",
|
|
22213
|
+
"moonstone",
|
|
22214
|
+
"morbius",
|
|
22215
|
+
"mordo",
|
|
22216
|
+
"morg",
|
|
22217
|
+
"morgan_stark",
|
|
22218
|
+
"morlocks",
|
|
22219
|
+
"morlun",
|
|
22220
|
+
"morph",
|
|
22221
|
+
"mother_askani",
|
|
22222
|
+
"mulholland_black",
|
|
22223
|
+
"multiple_man",
|
|
22224
|
+
"mysterio",
|
|
22225
|
+
"mystique",
|
|
22226
|
+
"namor",
|
|
22227
|
+
"namora",
|
|
22228
|
+
"namorita",
|
|
22229
|
+
"naoko",
|
|
22230
|
+
"natasha_romanoff",
|
|
22231
|
+
"nebula",
|
|
22232
|
+
"nehzno",
|
|
22233
|
+
"nekra",
|
|
22234
|
+
"nemesis",
|
|
22235
|
+
"network",
|
|
22236
|
+
"newton_destine",
|
|
22237
|
+
"next_avengers",
|
|
22238
|
+
"nextwave",
|
|
22239
|
+
"nick_fury",
|
|
22240
|
+
"nico_minoru",
|
|
22241
|
+
"nicolaos",
|
|
22242
|
+
"night_nurse",
|
|
22243
|
+
"night_thrasher",
|
|
22244
|
+
"nightcrawler",
|
|
22245
|
+
"nighthawk",
|
|
22246
|
+
"nightmare",
|
|
22247
|
+
"nightshade",
|
|
22248
|
+
"nitro",
|
|
22249
|
+
"nocturne",
|
|
22250
|
+
"nomad",
|
|
22251
|
+
"norman_osborn",
|
|
22252
|
+
"norrin_radd",
|
|
22253
|
+
"northstar",
|
|
22254
|
+
"nova",
|
|
22255
|
+
"nuke",
|
|
22256
|
+
"obadiah_stane",
|
|
22257
|
+
"odin",
|
|
22258
|
+
"ogun",
|
|
22259
|
+
"old_lace",
|
|
22260
|
+
"omega_flight",
|
|
22261
|
+
"omega_red",
|
|
22262
|
+
"omega_sentinel",
|
|
22263
|
+
"onslaught",
|
|
22264
|
+
"oracle",
|
|
22265
|
+
"orphan",
|
|
22266
|
+
"otto_octavius",
|
|
22267
|
+
"outlaw_kid",
|
|
22268
|
+
"overlord",
|
|
22269
|
+
"owl",
|
|
22270
|
+
"ozymandias",
|
|
22271
|
+
"paibok",
|
|
22272
|
+
"paladin",
|
|
22273
|
+
"pandemic",
|
|
22274
|
+
"paper_doll",
|
|
22275
|
+
"patch",
|
|
22276
|
+
"patriot",
|
|
22277
|
+
"payback",
|
|
22278
|
+
"penance",
|
|
22279
|
+
"pepper_potts",
|
|
22280
|
+
"pestilence",
|
|
22281
|
+
"pet_avengers",
|
|
22282
|
+
"pete_wisdom",
|
|
22283
|
+
"peter_parker",
|
|
22284
|
+
"peter_quill",
|
|
22285
|
+
"phalanx",
|
|
22286
|
+
"phantom_reporter",
|
|
22287
|
+
"phil_sheldon",
|
|
22288
|
+
"photon",
|
|
22289
|
+
"piledriver",
|
|
22290
|
+
"pixie",
|
|
22291
|
+
"plazm",
|
|
22292
|
+
"polaris",
|
|
22293
|
+
"post",
|
|
22294
|
+
"power_man",
|
|
22295
|
+
"power_pack",
|
|
22296
|
+
"praxagora",
|
|
22297
|
+
"preak",
|
|
22298
|
+
"pretty_boy",
|
|
22299
|
+
"pride",
|
|
22300
|
+
"prima",
|
|
22301
|
+
"princess_powerful",
|
|
22302
|
+
"prism",
|
|
22303
|
+
"prodigy",
|
|
22304
|
+
"proemial_gods",
|
|
22305
|
+
"professor_monster",
|
|
22306
|
+
"proteus",
|
|
22307
|
+
"proudstar",
|
|
22308
|
+
"prowler",
|
|
22309
|
+
"psylocke",
|
|
22310
|
+
"psynapse",
|
|
22311
|
+
"puck",
|
|
22312
|
+
"puff_adder",
|
|
22313
|
+
"puma",
|
|
22314
|
+
"punisher",
|
|
22315
|
+
"puppet_master",
|
|
22316
|
+
"purifiers",
|
|
22317
|
+
"purple_man",
|
|
22318
|
+
"pyro",
|
|
22319
|
+
"quasar",
|
|
22320
|
+
"quasimodo",
|
|
22321
|
+
"queen_noir",
|
|
22322
|
+
"quentin_quire",
|
|
22323
|
+
"quicksilver",
|
|
22324
|
+
"rachel_grey",
|
|
22325
|
+
"radioactive_man",
|
|
22326
|
+
"rafael_vega",
|
|
22327
|
+
"rage",
|
|
22328
|
+
"raider",
|
|
22329
|
+
"randall",
|
|
22330
|
+
"randall_flagg",
|
|
22331
|
+
"random",
|
|
22332
|
+
"rattler",
|
|
22333
|
+
"ravenous",
|
|
22334
|
+
"rawhide_kid",
|
|
22335
|
+
"raza",
|
|
22336
|
+
"reaper",
|
|
22337
|
+
"reavers",
|
|
22338
|
+
"red_ghost",
|
|
22339
|
+
"red_hulk",
|
|
22340
|
+
"red_shift",
|
|
22341
|
+
"red_skull",
|
|
22342
|
+
"red_wolf",
|
|
22343
|
+
"redwing",
|
|
22344
|
+
"reptil",
|
|
22345
|
+
"retro_girl",
|
|
22346
|
+
"revanche",
|
|
22347
|
+
"rhino",
|
|
22348
|
+
"rhodey",
|
|
22349
|
+
"richard_fisk",
|
|
22350
|
+
"rick_jones",
|
|
22351
|
+
"ricochet",
|
|
22352
|
+
"rictor",
|
|
22353
|
+
"riptide",
|
|
22354
|
+
"risque",
|
|
22355
|
+
"robbie_robertson",
|
|
22356
|
+
"robin_chapel",
|
|
22357
|
+
"rocket_raccoon",
|
|
22358
|
+
"rocket_racer",
|
|
22359
|
+
"rockslide",
|
|
22360
|
+
"rogue",
|
|
22361
|
+
"roland_deschain",
|
|
22362
|
+
"romulus",
|
|
22363
|
+
"ronan",
|
|
22364
|
+
"roughhouse",
|
|
22365
|
+
"roulette",
|
|
22366
|
+
"roxanne_simpson",
|
|
22367
|
+
"rumiko_fujikawa",
|
|
22368
|
+
"runaways",
|
|
22369
|
+
"russian",
|
|
22370
|
+
"sabra",
|
|
22371
|
+
"sabretooth",
|
|
22372
|
+
"sage",
|
|
22373
|
+
"sally_floyd",
|
|
22374
|
+
"salo",
|
|
22375
|
+
"sandman",
|
|
22376
|
+
"santa_claus",
|
|
22377
|
+
"saracen",
|
|
22378
|
+
"sasquatch",
|
|
22379
|
+
"satana",
|
|
22380
|
+
"sauron",
|
|
22381
|
+
"scalphunter",
|
|
22382
|
+
"scarecrow",
|
|
22383
|
+
"scarlet_spider",
|
|
22384
|
+
"scarlet_witch",
|
|
22385
|
+
"scorpion",
|
|
22386
|
+
"scourge",
|
|
22387
|
+
"scrambler",
|
|
22388
|
+
"scream",
|
|
22389
|
+
"screwball",
|
|
22390
|
+
"sebastian_shaw",
|
|
22391
|
+
"secret_warriors",
|
|
22392
|
+
"selene",
|
|
22393
|
+
"senator_kelly",
|
|
22394
|
+
"sentinel",
|
|
22395
|
+
"sentinels",
|
|
22396
|
+
"sentry",
|
|
22397
|
+
"ser_duncan",
|
|
22398
|
+
"serpent_society",
|
|
22399
|
+
"sersi",
|
|
22400
|
+
"shadow_king",
|
|
22401
|
+
"shadowcat",
|
|
22402
|
+
"shaman",
|
|
22403
|
+
"shape",
|
|
22404
|
+
"shard",
|
|
22405
|
+
"sharon_carter",
|
|
22406
|
+
"sharon_ventura",
|
|
22407
|
+
"shatterstar",
|
|
22408
|
+
"shen",
|
|
22409
|
+
"sheva_callister",
|
|
22410
|
+
"shinko_yamashiro",
|
|
22411
|
+
"shinobi_shaw",
|
|
22412
|
+
"shiva",
|
|
22413
|
+
"shiver_man",
|
|
22414
|
+
"shocker",
|
|
22415
|
+
"shockwave",
|
|
22416
|
+
"shooting_star",
|
|
22417
|
+
"shotgun",
|
|
22418
|
+
"shriek",
|
|
22419
|
+
"silhouette",
|
|
22420
|
+
"silk_fever",
|
|
22421
|
+
"silver_centurion",
|
|
22422
|
+
"silver_fox",
|
|
22423
|
+
"silver_sable",
|
|
22424
|
+
"silver_samurai",
|
|
22425
|
+
"silver_surfer",
|
|
22426
|
+
"silverclaw",
|
|
22427
|
+
"silvermane",
|
|
22428
|
+
"sinister_six",
|
|
22429
|
+
"sir_ram",
|
|
22430
|
+
"siren",
|
|
22431
|
+
"sister_grimm",
|
|
22432
|
+
"skaar",
|
|
22433
|
+
"skin",
|
|
22434
|
+
"skreet",
|
|
22435
|
+
"skrulls",
|
|
22436
|
+
"skullbuster",
|
|
22437
|
+
"slapstick",
|
|
22438
|
+
"slayback",
|
|
22439
|
+
"sleeper",
|
|
22440
|
+
"sleepwalker",
|
|
22441
|
+
"slipstream",
|
|
22442
|
+
"slyde",
|
|
22443
|
+
"smasher",
|
|
22444
|
+
"smiling_tiger",
|
|
22445
|
+
"snowbird",
|
|
22446
|
+
"solo",
|
|
22447
|
+
"songbird",
|
|
22448
|
+
"spacker_dave",
|
|
22449
|
+
"spectrum",
|
|
22450
|
+
"speed",
|
|
22451
|
+
"speed_demon",
|
|
22452
|
+
"speedball",
|
|
22453
|
+
"spencer_smythe",
|
|
22454
|
+
"sphinx",
|
|
22455
|
+
"spiral",
|
|
22456
|
+
"spirit",
|
|
22457
|
+
"spitfire",
|
|
22458
|
+
"spot",
|
|
22459
|
+
"sprite",
|
|
22460
|
+
"spyke",
|
|
22461
|
+
"squadron_sinister",
|
|
22462
|
+
"squadron_supreme",
|
|
22463
|
+
"squirrel_girl",
|
|
22464
|
+
"star_brand",
|
|
22465
|
+
"starbolt",
|
|
22466
|
+
"stardust",
|
|
22467
|
+
"starfox",
|
|
22468
|
+
"starhawk",
|
|
22469
|
+
"starjammers",
|
|
22470
|
+
"stark_industries",
|
|
22471
|
+
"stature",
|
|
22472
|
+
"steel_serpent",
|
|
22473
|
+
"stellaris",
|
|
22474
|
+
"stepford_cuckoos",
|
|
22475
|
+
"stephen_strange",
|
|
22476
|
+
"steve_rogers",
|
|
22477
|
+
"stick",
|
|
22478
|
+
"stingray",
|
|
22479
|
+
"stone_men",
|
|
22480
|
+
"storm",
|
|
22481
|
+
"stranger",
|
|
22482
|
+
"strong_guy",
|
|
22483
|
+
"stryfe",
|
|
22484
|
+
"sue_storm",
|
|
22485
|
+
"sugar_man",
|
|
22486
|
+
"sumo",
|
|
22487
|
+
"sunfire",
|
|
22488
|
+
"sunset_bain",
|
|
22489
|
+
"sunspot",
|
|
22490
|
+
"supernaut",
|
|
22491
|
+
"supreme_intelligence",
|
|
22492
|
+
"surge",
|
|
22493
|
+
"susan_delgado",
|
|
22494
|
+
"swarm",
|
|
22495
|
+
"sway",
|
|
22496
|
+
"switch",
|
|
22497
|
+
"swordsman",
|
|
22498
|
+
"synch",
|
|
22499
|
+
"tag",
|
|
22500
|
+
"talisman",
|
|
22501
|
+
"talkback",
|
|
22502
|
+
"talon",
|
|
22503
|
+
"talos",
|
|
22504
|
+
"tana_nile",
|
|
22505
|
+
"tarantula",
|
|
22506
|
+
"tarot",
|
|
22507
|
+
"taskmaster",
|
|
22508
|
+
"tattoo",
|
|
22509
|
+
"ted_forrester",
|
|
22510
|
+
"tempest",
|
|
22511
|
+
"tenebrous",
|
|
22512
|
+
"terrax",
|
|
22513
|
+
"terror",
|
|
22514
|
+
"texas_twister",
|
|
22515
|
+
"thaddeus_ross",
|
|
22516
|
+
"thanos",
|
|
22517
|
+
"the_anarchist",
|
|
22518
|
+
"the_call",
|
|
22519
|
+
"the_captain",
|
|
22520
|
+
"the_enforcers",
|
|
22521
|
+
"the_executioner",
|
|
22522
|
+
"the_fallen",
|
|
22523
|
+
"the_fury",
|
|
22524
|
+
"the_hand",
|
|
22525
|
+
"the_hood",
|
|
22526
|
+
"the_hunter",
|
|
22527
|
+
"the_initiative",
|
|
22528
|
+
"the_leader",
|
|
22529
|
+
"the_liberteens",
|
|
22530
|
+
"the_order",
|
|
22531
|
+
"the_phantom",
|
|
22532
|
+
"the_professor",
|
|
22533
|
+
"the_renegades",
|
|
22534
|
+
"the_santerians",
|
|
22535
|
+
"the_spike",
|
|
22536
|
+
"the_stranger",
|
|
22537
|
+
"the_twelve",
|
|
22538
|
+
"the_watchers",
|
|
22539
|
+
"thena",
|
|
22540
|
+
"thing",
|
|
22541
|
+
"thor",
|
|
22542
|
+
"thor_girl",
|
|
22543
|
+
"thunderball",
|
|
22544
|
+
"thunderbird",
|
|
22545
|
+
"thunderbolt",
|
|
22546
|
+
"thunderbolt_ross",
|
|
22547
|
+
"thunderbolts",
|
|
22548
|
+
"thundra",
|
|
22549
|
+
"tiger_shark",
|
|
22550
|
+
"tigra",
|
|
22551
|
+
"timeslip",
|
|
22552
|
+
"tinkerer",
|
|
22553
|
+
"titania",
|
|
22554
|
+
"titanium_man",
|
|
22555
|
+
"toad",
|
|
22556
|
+
"toad_men",
|
|
22557
|
+
"tomas",
|
|
22558
|
+
"tombstone",
|
|
22559
|
+
"tomorrow_man",
|
|
22560
|
+
"tony_stark",
|
|
22561
|
+
"toro",
|
|
22562
|
+
"toxin",
|
|
22563
|
+
"trauma",
|
|
22564
|
+
"triathlon",
|
|
22565
|
+
"trish_tilby",
|
|
22566
|
+
"triton",
|
|
22567
|
+
"true_believers",
|
|
22568
|
+
"turbo",
|
|
22569
|
+
"tusk",
|
|
22570
|
+
"tyger_tiger",
|
|
22571
|
+
"typhoid_mary",
|
|
22572
|
+
"tyrannus",
|
|
22573
|
+
"ulik",
|
|
22574
|
+
"ultimates",
|
|
22575
|
+
"ultimatum",
|
|
22576
|
+
"ultimo",
|
|
22577
|
+
"ultragirl",
|
|
22578
|
+
"ultron",
|
|
22579
|
+
"umar",
|
|
22580
|
+
"unicorn",
|
|
22581
|
+
"union_jack",
|
|
22582
|
+
"unus",
|
|
22583
|
+
"valeria_richards",
|
|
22584
|
+
"valkyrie",
|
|
22585
|
+
"vampiro",
|
|
22586
|
+
"vance_astro",
|
|
22587
|
+
"vanisher",
|
|
22588
|
+
"vapor",
|
|
22589
|
+
"vargas",
|
|
22590
|
+
"vector",
|
|
22591
|
+
"veda",
|
|
22592
|
+
"vengeance",
|
|
22593
|
+
"venom",
|
|
22594
|
+
"venus",
|
|
22595
|
+
"vermin",
|
|
22596
|
+
"vertigo",
|
|
22597
|
+
"victor_mancha",
|
|
22598
|
+
"vin_gonzales",
|
|
22599
|
+
"vindicator",
|
|
22600
|
+
"violations",
|
|
22601
|
+
"viper",
|
|
22602
|
+
"virginia_dare",
|
|
22603
|
+
"vision",
|
|
22604
|
+
"vivisector",
|
|
22605
|
+
"vulcan",
|
|
22606
|
+
"vulture",
|
|
22607
|
+
"wallflower",
|
|
22608
|
+
"wallop",
|
|
22609
|
+
"wallow",
|
|
22610
|
+
"war_machine",
|
|
22611
|
+
"warbird",
|
|
22612
|
+
"warbound",
|
|
22613
|
+
"warhawk",
|
|
22614
|
+
"warlock",
|
|
22615
|
+
"warpath",
|
|
22616
|
+
"warstar",
|
|
22617
|
+
"wasp",
|
|
22618
|
+
"weapon_omega",
|
|
22619
|
+
"wendell_rand",
|
|
22620
|
+
"wendell_vaughn",
|
|
22621
|
+
"wendigo",
|
|
22622
|
+
"whiplash",
|
|
22623
|
+
"whirlwind",
|
|
22624
|
+
"whistler",
|
|
22625
|
+
"white_queen",
|
|
22626
|
+
"white_tiger",
|
|
22627
|
+
"whizzer",
|
|
22628
|
+
"wiccan",
|
|
22629
|
+
"wild_child",
|
|
22630
|
+
"wild_pack",
|
|
22631
|
+
"wildside",
|
|
22632
|
+
"william_stryker",
|
|
22633
|
+
"wilson_fisk",
|
|
22634
|
+
"wind_dancer",
|
|
22635
|
+
"winter_soldier",
|
|
22636
|
+
"wither",
|
|
22637
|
+
"wolf_cub",
|
|
22638
|
+
"wolfpack",
|
|
22639
|
+
"wolfsbane",
|
|
22640
|
+
"wolverine",
|
|
22641
|
+
"wonder_man",
|
|
22642
|
+
"wong",
|
|
22643
|
+
"wraith",
|
|
22644
|
+
"wrecker",
|
|
22645
|
+
"wrecking_crew",
|
|
22646
|
+
"xavin",
|
|
22647
|
+
"xorn",
|
|
22648
|
+
"yellow_claw",
|
|
22649
|
+
"yellowjacket",
|
|
22650
|
+
"young_avengers",
|
|
22651
|
+
"zaladane",
|
|
22652
|
+
"zaran",
|
|
22653
|
+
"zarda",
|
|
22654
|
+
"zarek",
|
|
22655
|
+
"zeigeist",
|
|
22656
|
+
"zemo",
|
|
22657
|
+
"zodiak",
|
|
22658
|
+
"zombie",
|
|
22659
|
+
"zuras",
|
|
22660
|
+
"zzzax"
|
|
22661
|
+
];
|
|
22662
|
+
}
|
|
22663
|
+
});
|
|
22664
|
+
|
|
21118
22665
|
// src/cli/commands/migrate.ts
|
|
21119
22666
|
var migrate_exports = {};
|
|
21120
22667
|
__export(migrate_exports, {
|
|
@@ -21122,15 +22669,16 @@ __export(migrate_exports, {
|
|
|
21122
22669
|
prepareAndMigratePg: () => prepareAndMigratePg,
|
|
21123
22670
|
prepareAndMigrateSqlite: () => prepareAndMigrateSqlite,
|
|
21124
22671
|
prepareSQL: () => prepareSQL,
|
|
21125
|
-
prepareSnapshotFolderName: () => prepareSnapshotFolderName
|
|
22672
|
+
prepareSnapshotFolderName: () => prepareSnapshotFolderName,
|
|
22673
|
+
writeResult: () => writeResult
|
|
21126
22674
|
});
|
|
21127
|
-
var import_fs4,
|
|
22675
|
+
var import_fs4, import_path3, import_hanji2, prepareAndMigratePg, prepareAndMigrateMySql, prepareAndMigrateSqlite, prepareSQL, promptColumnsConflicts, promptTablesConflict, promptSchemasConflict, writeResult, prepareSnapshotFolderName, two;
|
|
21128
22676
|
var init_migrate = __esm({
|
|
21129
22677
|
"src/cli/commands/migrate.ts"() {
|
|
21130
22678
|
import_fs4 = __toESM(require("fs"));
|
|
21131
22679
|
init_migrationPreparator();
|
|
21132
22680
|
init_snapshotsDiffer();
|
|
21133
|
-
|
|
22681
|
+
import_path3 = __toESM(require("path"));
|
|
21134
22682
|
import_hanji2 = __toESM(require_hanji());
|
|
21135
22683
|
init_views();
|
|
21136
22684
|
init_source();
|
|
@@ -21138,68 +22686,68 @@ var init_migrate = __esm({
|
|
|
21138
22686
|
init_sqliteSchema();
|
|
21139
22687
|
init_mysqlSchema();
|
|
21140
22688
|
init_utils();
|
|
22689
|
+
init_words();
|
|
21141
22690
|
prepareAndMigratePg = async (config) => {
|
|
21142
22691
|
const outFolder = config.out;
|
|
21143
22692
|
const schemaPath = config.schema;
|
|
21144
22693
|
try {
|
|
21145
|
-
|
|
21146
|
-
const {
|
|
21147
|
-
|
|
21148
|
-
outFolder,
|
|
21149
|
-
schemaPath
|
|
21150
|
-
);
|
|
22694
|
+
assertV1OutFolder(outFolder, "pg");
|
|
22695
|
+
const { snapshots, journal } = prepareMigrationFolder(outFolder, "pg");
|
|
22696
|
+
const { prev, cur } = preparePgMigrationSnapshot(snapshots, schemaPath);
|
|
21151
22697
|
const validatedPrev = pgSchema.parse(prev);
|
|
21152
22698
|
const validatedCur = pgSchema.parse(cur);
|
|
21153
22699
|
const squashedPrev = squashPgScheme(validatedPrev);
|
|
21154
22700
|
const squashedCur = squashPgScheme(validatedCur);
|
|
21155
|
-
const sql = await prepareSQL(
|
|
21156
|
-
|
|
22701
|
+
const { statements, sql, _meta } = await prepareSQL(
|
|
22702
|
+
squashedPrev,
|
|
22703
|
+
squashedCur,
|
|
22704
|
+
"pg"
|
|
22705
|
+
);
|
|
22706
|
+
writeResult(cur, sql, snapshots.length, journal, _meta, outFolder);
|
|
21157
22707
|
} catch (e) {
|
|
21158
22708
|
console.error(e);
|
|
21159
22709
|
}
|
|
21160
22710
|
};
|
|
21161
|
-
|
|
22711
|
+
prepareAndMigrateMySql = async (config) => {
|
|
21162
22712
|
const outFolder = config.out;
|
|
21163
22713
|
const schemaPath = config.schema;
|
|
21164
22714
|
try {
|
|
21165
|
-
|
|
21166
|
-
const {
|
|
21167
|
-
|
|
21168
|
-
|
|
21169
|
-
|
|
22715
|
+
assertV1OutFolder(outFolder, "mysql");
|
|
22716
|
+
const { snapshots, journal } = prepareMigrationFolder(outFolder, "mysql");
|
|
22717
|
+
const { prev, cur } = prepareMySqlMigrationSnapshot(snapshots, schemaPath);
|
|
22718
|
+
const validatedPrev = mysqlSchema.parse(prev);
|
|
22719
|
+
const validatedCur = mysqlSchema.parse(cur);
|
|
22720
|
+
const squashedPrev = squashMysqlScheme(validatedPrev);
|
|
22721
|
+
const squashedCur = squashMysqlScheme(validatedCur);
|
|
22722
|
+
const { sql, _meta } = await prepareSQL(
|
|
22723
|
+
squashedPrev,
|
|
22724
|
+
squashedCur,
|
|
22725
|
+
"sqlite"
|
|
21170
22726
|
);
|
|
21171
|
-
|
|
21172
|
-
const validatedCur = sqliteSchema.parse(cur);
|
|
21173
|
-
const squashedPrev = squashSqliteScheme(validatedPrev);
|
|
21174
|
-
const squashedCur = squashSqliteScheme(validatedCur);
|
|
21175
|
-
const sql = await prepareSQL(squashedPrev, squashedCur, "sqlite");
|
|
21176
|
-
writeResult(cur, sql, outFolder);
|
|
22727
|
+
writeResult(cur, sql, snapshots.length, journal, _meta, outFolder);
|
|
21177
22728
|
} catch (e) {
|
|
21178
22729
|
console.error(e);
|
|
21179
22730
|
}
|
|
21180
22731
|
};
|
|
21181
|
-
|
|
22732
|
+
prepareAndMigrateSqlite = async (config) => {
|
|
21182
22733
|
const outFolder = config.out;
|
|
21183
22734
|
const schemaPath = config.schema;
|
|
21184
22735
|
try {
|
|
21185
|
-
|
|
21186
|
-
const {
|
|
21187
|
-
|
|
21188
|
-
|
|
21189
|
-
|
|
21190
|
-
);
|
|
21191
|
-
const
|
|
21192
|
-
const
|
|
21193
|
-
|
|
21194
|
-
const squashedCur = squashMysqlScheme(validatedCur);
|
|
21195
|
-
const sql = await prepareSQL(squashedPrev, squashedCur, "mysql");
|
|
21196
|
-
writeResult(cur, sql, outFolder);
|
|
22736
|
+
assertV1OutFolder(outFolder, "sqlite");
|
|
22737
|
+
const { snapshots, journal } = prepareMigrationFolder(outFolder, "sqlite");
|
|
22738
|
+
const { prev, cur } = prepareSqliteMigrationSnapshot(snapshots, schemaPath);
|
|
22739
|
+
const validatedPrev = sqliteSchema.parse(prev);
|
|
22740
|
+
const validatedCur = sqliteSchema.parse(cur);
|
|
22741
|
+
const squashedPrev = squashSqliteScheme(validatedPrev);
|
|
22742
|
+
const squashedCur = squashSqliteScheme(validatedCur);
|
|
22743
|
+
const { sql, _meta } = await prepareSQL(squashedPrev, squashedCur, "mysql");
|
|
22744
|
+
writeResult(cur, sql, snapshots.length, journal, _meta, outFolder);
|
|
21197
22745
|
} catch (e) {
|
|
21198
22746
|
console.error(e);
|
|
21199
22747
|
}
|
|
21200
22748
|
};
|
|
21201
22749
|
prepareSQL = async (prev, cur, dialect6) => {
|
|
21202
|
-
const
|
|
22750
|
+
const schemasResolver2 = async (input) => {
|
|
21203
22751
|
try {
|
|
21204
22752
|
const { created, deleted, renamed } = await promptSchemasConflict(
|
|
21205
22753
|
input.created,
|
|
@@ -21211,7 +22759,7 @@ var init_migrate = __esm({
|
|
|
21211
22759
|
throw e;
|
|
21212
22760
|
}
|
|
21213
22761
|
};
|
|
21214
|
-
const
|
|
22762
|
+
const tablesResolver2 = async (input) => {
|
|
21215
22763
|
try {
|
|
21216
22764
|
const { created, deleted, renamed } = await promptTablesConflict(
|
|
21217
22765
|
input.created,
|
|
@@ -21223,7 +22771,7 @@ var init_migrate = __esm({
|
|
|
21223
22771
|
throw e;
|
|
21224
22772
|
}
|
|
21225
22773
|
};
|
|
21226
|
-
const
|
|
22774
|
+
const columnsResolver2 = async (input) => {
|
|
21227
22775
|
const result = await promptColumnsConflicts(
|
|
21228
22776
|
input.tableName,
|
|
21229
22777
|
input.created,
|
|
@@ -21240,9 +22788,9 @@ var init_migrate = __esm({
|
|
|
21240
22788
|
prev,
|
|
21241
22789
|
cur,
|
|
21242
22790
|
dialect6,
|
|
21243
|
-
|
|
21244
|
-
|
|
21245
|
-
|
|
22791
|
+
schemasResolver2,
|
|
22792
|
+
tablesResolver2,
|
|
22793
|
+
columnsResolver2
|
|
21246
22794
|
);
|
|
21247
22795
|
};
|
|
21248
22796
|
promptColumnsConflicts = async (tableName, newColumns, missingColumns) => {
|
|
@@ -21377,24 +22925,34 @@ var init_migrate = __esm({
|
|
|
21377
22925
|
result.deleted.push(...leftMissing);
|
|
21378
22926
|
return result;
|
|
21379
22927
|
};
|
|
21380
|
-
writeResult = (cur, sql, outFolder) => {
|
|
22928
|
+
writeResult = (cur, sql, idx, journal, _meta, outFolder) => {
|
|
21381
22929
|
console.log(schema(cur));
|
|
21382
22930
|
if (sql.length === 0) {
|
|
21383
22931
|
console.log("No schema changes, nothing to migrate \u{1F634}");
|
|
21384
22932
|
return;
|
|
21385
22933
|
}
|
|
22934
|
+
const { prefix, tag } = prepareMigrationMetadata(idx);
|
|
21386
22935
|
const toSave = JSON.parse(JSON.stringify(cur));
|
|
21387
|
-
|
|
21388
|
-
const
|
|
21389
|
-
|
|
22936
|
+
toSave["_meta"] = _meta;
|
|
22937
|
+
const metaFolderPath = (0, import_path3.join)(outFolder, "meta");
|
|
22938
|
+
const metaJournal = (0, import_path3.join)(metaFolderPath, "_journal.json");
|
|
21390
22939
|
import_fs4.default.writeFileSync(
|
|
21391
|
-
`${
|
|
22940
|
+
(0, import_path3.join)(metaFolderPath, `${prefix}_snapshot.json`),
|
|
21392
22941
|
JSON.stringify(toSave, null, 2)
|
|
21393
22942
|
);
|
|
21394
|
-
|
|
21395
|
-
|
|
21396
|
-
|
|
21397
|
-
|
|
22943
|
+
journal.entries.push({
|
|
22944
|
+
idx,
|
|
22945
|
+
when: +new Date(),
|
|
22946
|
+
tag
|
|
22947
|
+
});
|
|
22948
|
+
import_fs4.default.writeFileSync(metaJournal, JSON.stringify(journal, null, 2));
|
|
22949
|
+
import_fs4.default.writeFileSync(`${outFolder}/${tag}.sql`, sql);
|
|
22950
|
+
(0, import_hanji2.render)(
|
|
22951
|
+
`[${source_default.green(
|
|
22952
|
+
"\u2713"
|
|
22953
|
+
)}] Your SQL migration file \u279C ${source_default.bold.underline.blue(
|
|
22954
|
+
import_path3.default.join(`${outFolder}/${tag}.sql`)
|
|
22955
|
+
)} \u{1F680}`
|
|
21398
22956
|
);
|
|
21399
22957
|
};
|
|
21400
22958
|
prepareSnapshotFolderName = () => {
|
|
@@ -21431,6 +22989,9 @@ var init_utils2 = __esm({
|
|
|
21431
22989
|
return group.toUpperCase().replace("-", "").replace("_", "").replace(" ", "");
|
|
21432
22990
|
});
|
|
21433
22991
|
};
|
|
22992
|
+
Array.prototype.random = function() {
|
|
22993
|
+
return this[~~(Math.random() * this.length)];
|
|
22994
|
+
};
|
|
21434
22995
|
}
|
|
21435
22996
|
});
|
|
21436
22997
|
|
|
@@ -22380,9 +23941,9 @@ var require_pg_types = __commonJS({
|
|
|
22380
23941
|
}
|
|
22381
23942
|
});
|
|
22382
23943
|
|
|
22383
|
-
// node_modules/.pnpm/pg@8.
|
|
23944
|
+
// node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/defaults.js
|
|
22384
23945
|
var require_defaults = __commonJS({
|
|
22385
|
-
"node_modules/.pnpm/pg@8.
|
|
23946
|
+
"node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/defaults.js"(exports, module2) {
|
|
22386
23947
|
"use strict";
|
|
22387
23948
|
module2.exports = {
|
|
22388
23949
|
host: "localhost",
|
|
@@ -22419,9 +23980,9 @@ var require_defaults = __commonJS({
|
|
|
22419
23980
|
}
|
|
22420
23981
|
});
|
|
22421
23982
|
|
|
22422
|
-
// node_modules/.pnpm/pg@8.
|
|
23983
|
+
// node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/utils.js
|
|
22423
23984
|
var require_utils2 = __commonJS({
|
|
22424
|
-
"node_modules/.pnpm/pg@8.
|
|
23985
|
+
"node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/utils.js"(exports, module2) {
|
|
22425
23986
|
"use strict";
|
|
22426
23987
|
var crypto = require("crypto");
|
|
22427
23988
|
var defaults = require_defaults();
|
|
@@ -22557,9 +24118,9 @@ var require_utils2 = __commonJS({
|
|
|
22557
24118
|
}
|
|
22558
24119
|
});
|
|
22559
24120
|
|
|
22560
|
-
// node_modules/.pnpm/pg@8.
|
|
24121
|
+
// node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/sasl.js
|
|
22561
24122
|
var require_sasl = __commonJS({
|
|
22562
|
-
"node_modules/.pnpm/pg@8.
|
|
24123
|
+
"node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/sasl.js"(exports, module2) {
|
|
22563
24124
|
"use strict";
|
|
22564
24125
|
var crypto = require("crypto");
|
|
22565
24126
|
function startSession(mechanisms) {
|
|
@@ -22581,6 +24142,9 @@ var require_sasl = __commonJS({
|
|
|
22581
24142
|
if (typeof password !== "string") {
|
|
22582
24143
|
throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");
|
|
22583
24144
|
}
|
|
24145
|
+
if (password === "") {
|
|
24146
|
+
throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a non-empty string");
|
|
24147
|
+
}
|
|
22584
24148
|
if (typeof serverData !== "string") {
|
|
22585
24149
|
throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a string");
|
|
22586
24150
|
}
|
|
@@ -22591,7 +24155,7 @@ var require_sasl = __commonJS({
|
|
|
22591
24155
|
throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short");
|
|
22592
24156
|
}
|
|
22593
24157
|
var saltBytes = Buffer.from(sv.salt, "base64");
|
|
22594
|
-
var saltedPassword =
|
|
24158
|
+
var saltedPassword = crypto.pbkdf2Sync(password, saltBytes, sv.iteration, 32, "sha256");
|
|
22595
24159
|
var clientKey = hmacSha256(saltedPassword, "Client Key");
|
|
22596
24160
|
var storedKey = sha256(clientKey);
|
|
22597
24161
|
var clientFirstMessageBare = "n=*,r=" + session.clientNonce;
|
|
@@ -22703,15 +24267,6 @@ var require_sasl = __commonJS({
|
|
|
22703
24267
|
function hmacSha256(key, msg) {
|
|
22704
24268
|
return crypto.createHmac("sha256", key).update(msg).digest();
|
|
22705
24269
|
}
|
|
22706
|
-
function Hi(password, saltBytes, iterations) {
|
|
22707
|
-
var ui1 = hmacSha256(password, Buffer.concat([saltBytes, Buffer.from([0, 0, 0, 1])]));
|
|
22708
|
-
var ui = ui1;
|
|
22709
|
-
for (var i = 0; i < iterations - 1; i++) {
|
|
22710
|
-
ui1 = hmacSha256(password, ui1);
|
|
22711
|
-
ui = xorBuffers(ui, ui1);
|
|
22712
|
-
}
|
|
22713
|
-
return ui;
|
|
22714
|
-
}
|
|
22715
24270
|
module2.exports = {
|
|
22716
24271
|
startSession,
|
|
22717
24272
|
continueSession,
|
|
@@ -22826,7 +24381,7 @@ var require_split2 = __commonJS({
|
|
|
22826
24381
|
var require_helper = __commonJS({
|
|
22827
24382
|
"node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/helper.js"(exports, module2) {
|
|
22828
24383
|
"use strict";
|
|
22829
|
-
var
|
|
24384
|
+
var path4 = require("path");
|
|
22830
24385
|
var Stream = require("stream").Stream;
|
|
22831
24386
|
var split = require_split2();
|
|
22832
24387
|
var util2 = require("util");
|
|
@@ -22865,7 +24420,7 @@ var require_helper = __commonJS({
|
|
|
22865
24420
|
};
|
|
22866
24421
|
module2.exports.getFileName = function(rawEnv) {
|
|
22867
24422
|
var env2 = rawEnv || process.env;
|
|
22868
|
-
var file = env2.PGPASSFILE || (isWin ?
|
|
24423
|
+
var file = env2.PGPASSFILE || (isWin ? path4.join(env2.APPDATA || "./", "postgresql", "pgpass.conf") : path4.join(env2.HOME || "./", ".pgpass"));
|
|
22869
24424
|
return file;
|
|
22870
24425
|
};
|
|
22871
24426
|
module2.exports.usePgPass = function(stats, fname) {
|
|
@@ -22992,7 +24547,7 @@ var require_helper = __commonJS({
|
|
|
22992
24547
|
var require_lib2 = __commonJS({
|
|
22993
24548
|
"node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js"(exports, module2) {
|
|
22994
24549
|
"use strict";
|
|
22995
|
-
var
|
|
24550
|
+
var path4 = require("path");
|
|
22996
24551
|
var fs7 = require("fs");
|
|
22997
24552
|
var helper = require_helper();
|
|
22998
24553
|
module2.exports = function(connInfo, cb) {
|
|
@@ -23009,9 +24564,9 @@ var require_lib2 = __commonJS({
|
|
|
23009
24564
|
}
|
|
23010
24565
|
});
|
|
23011
24566
|
|
|
23012
|
-
// node_modules/.pnpm/pg@8.
|
|
24567
|
+
// node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/type-overrides.js
|
|
23013
24568
|
var require_type_overrides = __commonJS({
|
|
23014
|
-
"node_modules/.pnpm/pg@8.
|
|
24569
|
+
"node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/type-overrides.js"(exports, module2) {
|
|
23015
24570
|
"use strict";
|
|
23016
24571
|
var types = require_pg_types();
|
|
23017
24572
|
function TypeOverrides(userTypes) {
|
|
@@ -23129,9 +24684,9 @@ var require_pg_connection_string = __commonJS({
|
|
|
23129
24684
|
}
|
|
23130
24685
|
});
|
|
23131
24686
|
|
|
23132
|
-
// node_modules/.pnpm/pg@8.
|
|
24687
|
+
// node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/connection-parameters.js
|
|
23133
24688
|
var require_connection_parameters = __commonJS({
|
|
23134
|
-
"node_modules/.pnpm/pg@8.
|
|
24689
|
+
"node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/connection-parameters.js"(exports, module2) {
|
|
23135
24690
|
"use strict";
|
|
23136
24691
|
var dns = require("dns");
|
|
23137
24692
|
var defaults = require_defaults();
|
|
@@ -23268,9 +24823,9 @@ var require_connection_parameters = __commonJS({
|
|
|
23268
24823
|
}
|
|
23269
24824
|
});
|
|
23270
24825
|
|
|
23271
|
-
// node_modules/.pnpm/pg@8.
|
|
24826
|
+
// node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/result.js
|
|
23272
24827
|
var require_result = __commonJS({
|
|
23273
|
-
"node_modules/.pnpm/pg@8.
|
|
24828
|
+
"node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/result.js"(exports, module2) {
|
|
23274
24829
|
"use strict";
|
|
23275
24830
|
var types = require_pg_types();
|
|
23276
24831
|
var matchRegexp = /^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/;
|
|
@@ -23353,9 +24908,9 @@ var require_result = __commonJS({
|
|
|
23353
24908
|
}
|
|
23354
24909
|
});
|
|
23355
24910
|
|
|
23356
|
-
// node_modules/.pnpm/pg@8.
|
|
24911
|
+
// node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/query.js
|
|
23357
24912
|
var require_query = __commonJS({
|
|
23358
|
-
"node_modules/.pnpm/pg@8.
|
|
24913
|
+
"node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/query.js"(exports, module2) {
|
|
23359
24914
|
"use strict";
|
|
23360
24915
|
var { EventEmitter } = require("events");
|
|
23361
24916
|
var Result = require_result();
|
|
@@ -23536,9 +25091,9 @@ var require_query = __commonJS({
|
|
|
23536
25091
|
}
|
|
23537
25092
|
});
|
|
23538
25093
|
|
|
23539
|
-
// node_modules/.pnpm/pg-protocol@1.
|
|
25094
|
+
// node_modules/.pnpm/pg-protocol@1.6.0/node_modules/pg-protocol/dist/messages.js
|
|
23540
25095
|
var require_messages = __commonJS({
|
|
23541
|
-
"node_modules/.pnpm/pg-protocol@1.
|
|
25096
|
+
"node_modules/.pnpm/pg-protocol@1.6.0/node_modules/pg-protocol/dist/messages.js"(exports) {
|
|
23542
25097
|
"use strict";
|
|
23543
25098
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23544
25099
|
exports.NoticeMessage = exports.DataRowMessage = exports.CommandCompleteMessage = exports.ReadyForQueryMessage = exports.NotificationResponseMessage = exports.BackendKeyDataMessage = exports.AuthenticationMD5Password = exports.ParameterStatusMessage = exports.ParameterDescriptionMessage = exports.RowDescriptionMessage = exports.Field = exports.CopyResponse = exports.CopyDataMessage = exports.DatabaseError = exports.copyDone = exports.emptyQuery = exports.replicationStart = exports.portalSuspended = exports.noData = exports.closeComplete = exports.bindComplete = exports.parseComplete = void 0;
|
|
@@ -23701,9 +25256,9 @@ var require_messages = __commonJS({
|
|
|
23701
25256
|
}
|
|
23702
25257
|
});
|
|
23703
25258
|
|
|
23704
|
-
// node_modules/.pnpm/pg-protocol@1.
|
|
25259
|
+
// node_modules/.pnpm/pg-protocol@1.6.0/node_modules/pg-protocol/dist/buffer-writer.js
|
|
23705
25260
|
var require_buffer_writer = __commonJS({
|
|
23706
|
-
"node_modules/.pnpm/pg-protocol@1.
|
|
25261
|
+
"node_modules/.pnpm/pg-protocol@1.6.0/node_modules/pg-protocol/dist/buffer-writer.js"(exports) {
|
|
23707
25262
|
"use strict";
|
|
23708
25263
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23709
25264
|
exports.Writer = void 0;
|
|
@@ -23782,9 +25337,9 @@ var require_buffer_writer = __commonJS({
|
|
|
23782
25337
|
}
|
|
23783
25338
|
});
|
|
23784
25339
|
|
|
23785
|
-
// node_modules/.pnpm/pg-protocol@1.
|
|
25340
|
+
// node_modules/.pnpm/pg-protocol@1.6.0/node_modules/pg-protocol/dist/serializer.js
|
|
23786
25341
|
var require_serializer = __commonJS({
|
|
23787
|
-
"node_modules/.pnpm/pg-protocol@1.
|
|
25342
|
+
"node_modules/.pnpm/pg-protocol@1.6.0/node_modules/pg-protocol/dist/serializer.js"(exports) {
|
|
23788
25343
|
"use strict";
|
|
23789
25344
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23790
25345
|
exports.serialize = void 0;
|
|
@@ -23947,9 +25502,9 @@ var require_serializer = __commonJS({
|
|
|
23947
25502
|
}
|
|
23948
25503
|
});
|
|
23949
25504
|
|
|
23950
|
-
// node_modules/.pnpm/pg-protocol@1.
|
|
25505
|
+
// node_modules/.pnpm/pg-protocol@1.6.0/node_modules/pg-protocol/dist/buffer-reader.js
|
|
23951
25506
|
var require_buffer_reader = __commonJS({
|
|
23952
|
-
"node_modules/.pnpm/pg-protocol@1.
|
|
25507
|
+
"node_modules/.pnpm/pg-protocol@1.6.0/node_modules/pg-protocol/dist/buffer-reader.js"(exports) {
|
|
23953
25508
|
"use strict";
|
|
23954
25509
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23955
25510
|
exports.BufferReader = void 0;
|
|
@@ -24002,9 +25557,9 @@ var require_buffer_reader = __commonJS({
|
|
|
24002
25557
|
}
|
|
24003
25558
|
});
|
|
24004
25559
|
|
|
24005
|
-
// node_modules/.pnpm/pg-protocol@1.
|
|
25560
|
+
// node_modules/.pnpm/pg-protocol@1.6.0/node_modules/pg-protocol/dist/parser.js
|
|
24006
25561
|
var require_parser = __commonJS({
|
|
24007
|
-
"node_modules/.pnpm/pg-protocol@1.
|
|
25562
|
+
"node_modules/.pnpm/pg-protocol@1.6.0/node_modules/pg-protocol/dist/parser.js"(exports) {
|
|
24008
25563
|
"use strict";
|
|
24009
25564
|
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
24010
25565
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
@@ -24297,9 +25852,9 @@ var require_parser = __commonJS({
|
|
|
24297
25852
|
}
|
|
24298
25853
|
});
|
|
24299
25854
|
|
|
24300
|
-
// node_modules/.pnpm/pg-protocol@1.
|
|
25855
|
+
// node_modules/.pnpm/pg-protocol@1.6.0/node_modules/pg-protocol/dist/index.js
|
|
24301
25856
|
var require_dist = __commonJS({
|
|
24302
|
-
"node_modules/.pnpm/pg-protocol@1.
|
|
25857
|
+
"node_modules/.pnpm/pg-protocol@1.6.0/node_modules/pg-protocol/dist/index.js"(exports) {
|
|
24303
25858
|
"use strict";
|
|
24304
25859
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24305
25860
|
exports.DatabaseError = exports.serialize = exports.parse = void 0;
|
|
@@ -24321,9 +25876,9 @@ var require_dist = __commonJS({
|
|
|
24321
25876
|
}
|
|
24322
25877
|
});
|
|
24323
25878
|
|
|
24324
|
-
// node_modules/.pnpm/pg@8.
|
|
25879
|
+
// node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/connection.js
|
|
24325
25880
|
var require_connection = __commonJS({
|
|
24326
|
-
"node_modules/.pnpm/pg@8.
|
|
25881
|
+
"node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/connection.js"(exports, module2) {
|
|
24327
25882
|
"use strict";
|
|
24328
25883
|
var net = require("net");
|
|
24329
25884
|
var EventEmitter = require("events").EventEmitter;
|
|
@@ -24336,6 +25891,9 @@ var require_connection = __commonJS({
|
|
|
24336
25891
|
super();
|
|
24337
25892
|
config = config || {};
|
|
24338
25893
|
this.stream = config.stream || new net.Socket();
|
|
25894
|
+
if (typeof this.stream === "function") {
|
|
25895
|
+
this.stream = this.stream(config);
|
|
25896
|
+
}
|
|
24339
25897
|
this._keepAlive = config.keepAlive;
|
|
24340
25898
|
this._keepAliveInitialDelayMillis = config.keepAliveInitialDelayMillis;
|
|
24341
25899
|
this.lastBuffer = false;
|
|
@@ -24464,7 +26022,6 @@ var require_connection = __commonJS({
|
|
|
24464
26022
|
}
|
|
24465
26023
|
sync() {
|
|
24466
26024
|
this._ending = true;
|
|
24467
|
-
this._send(flushBuffer);
|
|
24468
26025
|
this._send(syncBuffer);
|
|
24469
26026
|
}
|
|
24470
26027
|
ref() {
|
|
@@ -24503,12 +26060,11 @@ var require_connection = __commonJS({
|
|
|
24503
26060
|
}
|
|
24504
26061
|
});
|
|
24505
26062
|
|
|
24506
|
-
// node_modules/.pnpm/pg@8.
|
|
26063
|
+
// node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/client.js
|
|
24507
26064
|
var require_client = __commonJS({
|
|
24508
|
-
"node_modules/.pnpm/pg@8.
|
|
26065
|
+
"node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/client.js"(exports, module2) {
|
|
24509
26066
|
"use strict";
|
|
24510
26067
|
var EventEmitter = require("events").EventEmitter;
|
|
24511
|
-
var util2 = require("util");
|
|
24512
26068
|
var utils = require_utils2();
|
|
24513
26069
|
var sasl = require_sasl();
|
|
24514
26070
|
var pgPass = require_lib2();
|
|
@@ -24704,17 +26260,29 @@ var require_client = __commonJS({
|
|
|
24704
26260
|
}
|
|
24705
26261
|
_handleAuthSASL(msg) {
|
|
24706
26262
|
this._checkPgPass(() => {
|
|
24707
|
-
|
|
24708
|
-
|
|
26263
|
+
try {
|
|
26264
|
+
this.saslSession = sasl.startSession(msg.mechanisms);
|
|
26265
|
+
this.connection.sendSASLInitialResponseMessage(this.saslSession.mechanism, this.saslSession.response);
|
|
26266
|
+
} catch (err2) {
|
|
26267
|
+
this.connection.emit("error", err2);
|
|
26268
|
+
}
|
|
24709
26269
|
});
|
|
24710
26270
|
}
|
|
24711
26271
|
_handleAuthSASLContinue(msg) {
|
|
24712
|
-
|
|
24713
|
-
|
|
26272
|
+
try {
|
|
26273
|
+
sasl.continueSession(this.saslSession, this.password, msg.data);
|
|
26274
|
+
this.connection.sendSCRAMClientFinalMessage(this.saslSession.response);
|
|
26275
|
+
} catch (err2) {
|
|
26276
|
+
this.connection.emit("error", err2);
|
|
26277
|
+
}
|
|
24714
26278
|
}
|
|
24715
26279
|
_handleAuthSASLFinal(msg) {
|
|
24716
|
-
|
|
24717
|
-
|
|
26280
|
+
try {
|
|
26281
|
+
sasl.finalizeSession(this.saslSession, msg.data);
|
|
26282
|
+
this.saslSession = null;
|
|
26283
|
+
} catch (err2) {
|
|
26284
|
+
this.connection.emit("error", err2);
|
|
26285
|
+
}
|
|
24718
26286
|
}
|
|
24719
26287
|
_handleBackendKeyData(msg) {
|
|
24720
26288
|
this.processID = msg.processID;
|
|
@@ -24993,9 +26561,9 @@ var require_client = __commonJS({
|
|
|
24993
26561
|
}
|
|
24994
26562
|
});
|
|
24995
26563
|
|
|
24996
|
-
// node_modules/.pnpm/pg-pool@3.5.2_pg@8.
|
|
26564
|
+
// node_modules/.pnpm/pg-pool@3.5.2_pg@8.9.0/node_modules/pg-pool/index.js
|
|
24997
26565
|
var require_pg_pool = __commonJS({
|
|
24998
|
-
"node_modules/.pnpm/pg-pool@3.5.2_pg@8.
|
|
26566
|
+
"node_modules/.pnpm/pg-pool@3.5.2_pg@8.9.0/node_modules/pg-pool/index.js"(exports, module2) {
|
|
24999
26567
|
"use strict";
|
|
25000
26568
|
var EventEmitter = require("events").EventEmitter;
|
|
25001
26569
|
var NOOP = function() {
|
|
@@ -25368,72 +26936,9 @@ var require_pg_pool = __commonJS({
|
|
|
25368
26936
|
}
|
|
25369
26937
|
});
|
|
25370
26938
|
|
|
25371
|
-
// node_modules/.pnpm/pg@8.
|
|
25372
|
-
var require_package = __commonJS({
|
|
25373
|
-
"node_modules/.pnpm/pg@8.8.0/node_modules/pg/package.json"(exports, module2) {
|
|
25374
|
-
module2.exports = {
|
|
25375
|
-
name: "pg",
|
|
25376
|
-
version: "8.8.0",
|
|
25377
|
-
description: "PostgreSQL client - pure javascript & libpq with the same API",
|
|
25378
|
-
keywords: [
|
|
25379
|
-
"database",
|
|
25380
|
-
"libpq",
|
|
25381
|
-
"pg",
|
|
25382
|
-
"postgre",
|
|
25383
|
-
"postgres",
|
|
25384
|
-
"postgresql",
|
|
25385
|
-
"rdbms"
|
|
25386
|
-
],
|
|
25387
|
-
homepage: "https://github.com/brianc/node-postgres",
|
|
25388
|
-
repository: {
|
|
25389
|
-
type: "git",
|
|
25390
|
-
url: "git://github.com/brianc/node-postgres.git",
|
|
25391
|
-
directory: "packages/pg"
|
|
25392
|
-
},
|
|
25393
|
-
author: "Brian Carlson <brian.m.carlson@gmail.com>",
|
|
25394
|
-
main: "./lib",
|
|
25395
|
-
dependencies: {
|
|
25396
|
-
"buffer-writer": "2.0.0",
|
|
25397
|
-
"packet-reader": "1.0.0",
|
|
25398
|
-
"pg-connection-string": "^2.5.0",
|
|
25399
|
-
"pg-pool": "^3.5.2",
|
|
25400
|
-
"pg-protocol": "^1.5.0",
|
|
25401
|
-
"pg-types": "^2.1.0",
|
|
25402
|
-
pgpass: "1.x"
|
|
25403
|
-
},
|
|
25404
|
-
devDependencies: {
|
|
25405
|
-
async: "2.6.4",
|
|
25406
|
-
bluebird: "3.5.2",
|
|
25407
|
-
co: "4.6.0",
|
|
25408
|
-
"pg-copy-streams": "0.3.0"
|
|
25409
|
-
},
|
|
25410
|
-
peerDependencies: {
|
|
25411
|
-
"pg-native": ">=3.0.1"
|
|
25412
|
-
},
|
|
25413
|
-
peerDependenciesMeta: {
|
|
25414
|
-
"pg-native": {
|
|
25415
|
-
optional: true
|
|
25416
|
-
}
|
|
25417
|
-
},
|
|
25418
|
-
scripts: {
|
|
25419
|
-
test: "make test-all"
|
|
25420
|
-
},
|
|
25421
|
-
files: [
|
|
25422
|
-
"lib",
|
|
25423
|
-
"SPONSORS.md"
|
|
25424
|
-
],
|
|
25425
|
-
license: "MIT",
|
|
25426
|
-
engines: {
|
|
25427
|
-
node: ">= 8.0.0"
|
|
25428
|
-
},
|
|
25429
|
-
gitHead: "c99fb2c127ddf8d712500db2c7b9a5491a178655"
|
|
25430
|
-
};
|
|
25431
|
-
}
|
|
25432
|
-
});
|
|
25433
|
-
|
|
25434
|
-
// node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/native/query.js
|
|
26939
|
+
// node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/native/query.js
|
|
25435
26940
|
var require_query2 = __commonJS({
|
|
25436
|
-
"node_modules/.pnpm/pg@8.
|
|
26941
|
+
"node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/native/query.js"(exports, module2) {
|
|
25437
26942
|
"use strict";
|
|
25438
26943
|
var EventEmitter = require("events").EventEmitter;
|
|
25439
26944
|
var util2 = require("util");
|
|
@@ -25572,13 +27077,12 @@ var require_query2 = __commonJS({
|
|
|
25572
27077
|
}
|
|
25573
27078
|
});
|
|
25574
27079
|
|
|
25575
|
-
// node_modules/.pnpm/pg@8.
|
|
27080
|
+
// node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/native/client.js
|
|
25576
27081
|
var require_client2 = __commonJS({
|
|
25577
|
-
"node_modules/.pnpm/pg@8.
|
|
27082
|
+
"node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/native/client.js"(exports, module2) {
|
|
25578
27083
|
"use strict";
|
|
25579
27084
|
var Native = require("pg-native");
|
|
25580
27085
|
var TypeOverrides = require_type_overrides();
|
|
25581
|
-
var pkg = require_package();
|
|
25582
27086
|
var EventEmitter = require("events").EventEmitter;
|
|
25583
27087
|
var util2 = require("util");
|
|
25584
27088
|
var ConnectionParameters = require_connection_parameters();
|
|
@@ -25805,17 +27309,17 @@ var require_client2 = __commonJS({
|
|
|
25805
27309
|
}
|
|
25806
27310
|
});
|
|
25807
27311
|
|
|
25808
|
-
// node_modules/.pnpm/pg@8.
|
|
27312
|
+
// node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/native/index.js
|
|
25809
27313
|
var require_native = __commonJS({
|
|
25810
|
-
"node_modules/.pnpm/pg@8.
|
|
27314
|
+
"node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/native/index.js"(exports, module2) {
|
|
25811
27315
|
"use strict";
|
|
25812
27316
|
module2.exports = require_client2();
|
|
25813
27317
|
}
|
|
25814
27318
|
});
|
|
25815
27319
|
|
|
25816
|
-
// node_modules/.pnpm/pg@8.
|
|
27320
|
+
// node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/index.js
|
|
25817
27321
|
var require_lib3 = __commonJS({
|
|
25818
|
-
"node_modules/.pnpm/pg@8.
|
|
27322
|
+
"node_modules/.pnpm/pg@8.9.0/node_modules/pg/lib/index.js"(exports, module2) {
|
|
25819
27323
|
"use strict";
|
|
25820
27324
|
var Client = require_client();
|
|
25821
27325
|
var defaults = require_defaults();
|
|
@@ -25893,7 +27397,8 @@ var init_introspect = __esm({
|
|
|
25893
27397
|
"interval",
|
|
25894
27398
|
"bigint",
|
|
25895
27399
|
"bigserial",
|
|
25896
|
-
"doublePrecision"
|
|
27400
|
+
"doublePrecision",
|
|
27401
|
+
"uuid"
|
|
25897
27402
|
]);
|
|
25898
27403
|
objToStatement = (json) => {
|
|
25899
27404
|
json = Object.fromEntries(Object.entries(json).filter((it) => it[1]));
|
|
@@ -25970,13 +27475,13 @@ var init_introspect = __esm({
|
|
|
25970
27475
|
return `export const ${it.name.camelCase()} = pgEnum("${it.name}", [${values}])
|
|
25971
27476
|
`;
|
|
25972
27477
|
}).join("").concat("\n");
|
|
25973
|
-
const schemaStatements = Object.entries(schemas).
|
|
27478
|
+
const schemaStatements = Object.entries(schemas).map((it) => {
|
|
25974
27479
|
return `export const ${it[1]} = pgSchema("${it[0]}");
|
|
25975
27480
|
`;
|
|
25976
27481
|
}).join();
|
|
25977
27482
|
const tableStatements = Object.values(schema4.tables).map((table4) => {
|
|
25978
27483
|
const schema5 = schemas[table4.schema];
|
|
25979
|
-
const func = schema5
|
|
27484
|
+
const func = schema5 ? schema5 : "pgTable";
|
|
25980
27485
|
let statement = `export const ${table4.name.camelCase()} = ${func}("${table4.name}", {
|
|
25981
27486
|
`;
|
|
25982
27487
|
statement += createTableColumns(
|
|
@@ -26293,14 +27798,14 @@ var {
|
|
|
26293
27798
|
} = import_index.default;
|
|
26294
27799
|
|
|
26295
27800
|
// src/cli/index.ts
|
|
26296
|
-
var
|
|
27801
|
+
var import_fs9 = __toESM(require("fs"));
|
|
26297
27802
|
init_lib();
|
|
26298
27803
|
|
|
26299
27804
|
// src/cli/commands/check.ts
|
|
26300
27805
|
init_utils();
|
|
26301
27806
|
var checkHandler = (out, dialect6) => {
|
|
26302
|
-
const
|
|
26303
|
-
const report = validateWithReport(
|
|
27807
|
+
const { snapshots } = prepareOutFolder(out, dialect6);
|
|
27808
|
+
const report = validateWithReport(snapshots, dialect6);
|
|
26304
27809
|
if (report.nonLatest.length > 0) {
|
|
26305
27810
|
console.log(
|
|
26306
27811
|
report.nonLatest.map((it) => {
|
|
@@ -26336,7 +27841,7 @@ var checkHandler = (out, dialect6) => {
|
|
|
26336
27841
|
// src/cli/index.ts
|
|
26337
27842
|
var import_hanji4 = __toESM(require_hanji());
|
|
26338
27843
|
init_views();
|
|
26339
|
-
var
|
|
27844
|
+
var import_path7 = __toESM(require("path"));
|
|
26340
27845
|
|
|
26341
27846
|
// src/cli/utils.ts
|
|
26342
27847
|
init_views();
|
|
@@ -26370,8 +27875,8 @@ var assertPgVersion = () => {
|
|
|
26370
27875
|
};
|
|
26371
27876
|
var pgVersions = () => {
|
|
26372
27877
|
try {
|
|
26373
|
-
const {
|
|
26374
|
-
return {
|
|
27878
|
+
const { compatibilityVersion, npmVersion } = require("drizzle-orm/version");
|
|
27879
|
+
return { compatibilityVersion, npmVersion };
|
|
26375
27880
|
} catch (e) {
|
|
26376
27881
|
return {};
|
|
26377
27882
|
}
|
|
@@ -26383,7 +27888,7 @@ init_source();
|
|
|
26383
27888
|
// package.json
|
|
26384
27889
|
var package_default = {
|
|
26385
27890
|
name: "drizzle-kit",
|
|
26386
|
-
version: "0.16.
|
|
27891
|
+
version: "0.16.9",
|
|
26387
27892
|
repository: "https://github.com/drizzle-team/drizzle-kit-mirror",
|
|
26388
27893
|
author: "Alex Blokh <aleksandrblokh@gmail.com>",
|
|
26389
27894
|
license: "MIT",
|
|
@@ -26406,7 +27911,8 @@ var package_default = {
|
|
|
26406
27911
|
test: "ava test",
|
|
26407
27912
|
build: "esbuild ./src/cli/index.ts --bundle --platform=node --target=node10.4 --outfile=./dist/index.js --external:esbuild --external:drizzle-orm-pg --external:drizzle-orm-sqlite --external:drizzle-orm-mysql --external:drizzle-orm --external:pg-native",
|
|
26408
27913
|
pack: "build && package",
|
|
26409
|
-
tsc: "tsc"
|
|
27914
|
+
tsc: "tsc -p tsconfig.build.json",
|
|
27915
|
+
pub: "cp package.json readme.md dist/ && cd dist && npm publish"
|
|
26410
27916
|
},
|
|
26411
27917
|
ava: {
|
|
26412
27918
|
files: [
|
|
@@ -26436,7 +27942,7 @@ var package_default = {
|
|
|
26436
27942
|
"@typescript-eslint/parser": "^5.46.1",
|
|
26437
27943
|
ava: "^5.1.0",
|
|
26438
27944
|
dockerode: "^3.3.4",
|
|
26439
|
-
"drizzle-orm": "0.17.
|
|
27945
|
+
"drizzle-orm": "0.17.6",
|
|
26440
27946
|
esbuild: "^0.15.7",
|
|
26441
27947
|
"esbuild-register": "^3.3.3",
|
|
26442
27948
|
eslint: "^8.29.0",
|
|
@@ -26461,32 +27967,28 @@ init_utils();
|
|
|
26461
27967
|
init_source();
|
|
26462
27968
|
var import_crypto2 = require("crypto");
|
|
26463
27969
|
var import_fs5 = require("fs");
|
|
26464
|
-
var import_path3 = __toESM(require("path"));
|
|
26465
27970
|
init_global();
|
|
26466
27971
|
init_pgSchema();
|
|
26467
27972
|
init_utils();
|
|
26468
27973
|
var upPgHandler = (out) => {
|
|
26469
|
-
|
|
26470
|
-
|
|
27974
|
+
};
|
|
27975
|
+
var upPgHandlerV4 = (out) => {
|
|
27976
|
+
const snapshots = snapshotsPriorV4(out);
|
|
27977
|
+
const report = validateWithReport(snapshots, "pg");
|
|
26471
27978
|
let prevId = originUUID;
|
|
26472
27979
|
report.nonLatest.map((it) => ({
|
|
26473
|
-
|
|
27980
|
+
path: it,
|
|
26474
27981
|
raw: report.rawMap[it]
|
|
26475
27982
|
})).forEach((it) => {
|
|
26476
|
-
const
|
|
26477
|
-
const result =
|
|
27983
|
+
const path4 = it.path;
|
|
27984
|
+
const result = updateUpToV4(it.raw, prevId);
|
|
26478
27985
|
prevId = result.id;
|
|
26479
|
-
console.log(
|
|
26480
|
-
|
|
26481
|
-
);
|
|
26482
|
-
(0, import_fs5.writeFileSync)(
|
|
26483
|
-
import_path3.default.join(out, folder, "snapshot.json"),
|
|
26484
|
-
JSON.stringify(result, null, 2)
|
|
26485
|
-
);
|
|
27986
|
+
console.log(`[${source_default.green("\u2713")}] ${path4}`);
|
|
27987
|
+
(0, import_fs5.writeFileSync)(path4, JSON.stringify(result, null, 2));
|
|
26486
27988
|
});
|
|
26487
27989
|
console.log("Everything's fine \u{1F436}\u{1F525}");
|
|
26488
27990
|
};
|
|
26489
|
-
var
|
|
27991
|
+
var updateUpToV4 = (json, prevId) => {
|
|
26490
27992
|
const version = Number(json["version"]);
|
|
26491
27993
|
if (version === 1) {
|
|
26492
27994
|
const v1 = pgSchemaV1.parse(json);
|
|
@@ -26504,7 +28006,7 @@ var updateToLatest = (json, prevId) => {
|
|
|
26504
28006
|
if (version === 3) {
|
|
26505
28007
|
return update3to4(pgSchemaV3.parse(json));
|
|
26506
28008
|
}
|
|
26507
|
-
return
|
|
28009
|
+
return pgSchemaV4.parse(json);
|
|
26508
28010
|
};
|
|
26509
28011
|
var update1to2 = (json) => {
|
|
26510
28012
|
const tables = Object.fromEntries(
|
|
@@ -26654,14 +28156,14 @@ var import_path4 = __toESM(require("path"));
|
|
|
26654
28156
|
init_sqliteSchema();
|
|
26655
28157
|
init_utils();
|
|
26656
28158
|
var upSqliteHandler = (out) => {
|
|
26657
|
-
const
|
|
26658
|
-
const report = validateWithReport(
|
|
28159
|
+
const { snapshots } = prepareOutFolder(out, "sqlite");
|
|
28160
|
+
const report = validateWithReport(snapshots, "sqlite");
|
|
26659
28161
|
report.nonLatest.map((it) => ({
|
|
26660
28162
|
folder: it,
|
|
26661
28163
|
raw: report.rawMap[it]
|
|
26662
28164
|
})).forEach((it) => {
|
|
26663
28165
|
const folder = it.folder;
|
|
26664
|
-
const result =
|
|
28166
|
+
const result = updateToLatest(it.raw);
|
|
26665
28167
|
console.log(
|
|
26666
28168
|
`[${source_default.green("\u2713")}] ${import_path4.default.join(out, folder, "snapshot.json")}`
|
|
26667
28169
|
);
|
|
@@ -26672,7 +28174,7 @@ var upSqliteHandler = (out) => {
|
|
|
26672
28174
|
});
|
|
26673
28175
|
console.log("Everything's fine \u{1F436}\u{1F525}");
|
|
26674
28176
|
};
|
|
26675
|
-
var
|
|
28177
|
+
var updateToLatest = (json) => {
|
|
26676
28178
|
const version = Number(json["version"]);
|
|
26677
28179
|
if (version === 3) {
|
|
26678
28180
|
const v3 = sqliteSchemaV3.parse(json);
|
|
@@ -26702,14 +28204,14 @@ var import_path5 = __toESM(require("path"));
|
|
|
26702
28204
|
init_mysqlSchema();
|
|
26703
28205
|
init_utils();
|
|
26704
28206
|
var upMysqlHandler = (out) => {
|
|
26705
|
-
const
|
|
26706
|
-
const report = validateWithReport(
|
|
28207
|
+
const { snapshots } = prepareOutFolder(out, "mysql");
|
|
28208
|
+
const report = validateWithReport(snapshots, "mysql");
|
|
26707
28209
|
report.nonLatest.map((it) => ({
|
|
26708
28210
|
folder: it,
|
|
26709
28211
|
raw: report.rawMap[it]
|
|
26710
28212
|
})).forEach((it) => {
|
|
26711
28213
|
const folder = it.folder;
|
|
26712
|
-
const result =
|
|
28214
|
+
const result = updateToLatest2(it.raw);
|
|
26713
28215
|
console.log(
|
|
26714
28216
|
`[${source_default.green("\u2713")}] ${import_path5.default.join(out, folder, "snapshot.json")}`
|
|
26715
28217
|
);
|
|
@@ -26720,7 +28222,7 @@ var upMysqlHandler = (out) => {
|
|
|
26720
28222
|
});
|
|
26721
28223
|
console.log("Everything's fine \u{1F436}\u{1F525}");
|
|
26722
28224
|
};
|
|
26723
|
-
var
|
|
28225
|
+
var updateToLatest2 = (json) => {
|
|
26724
28226
|
const version = Number(json["version"]);
|
|
26725
28227
|
if (version === 3) {
|
|
26726
28228
|
const v3 = mysqlSchemaV3.parse(json);
|
|
@@ -26737,6 +28239,273 @@ var updateV3toV42 = (old) => {
|
|
|
26737
28239
|
};
|
|
26738
28240
|
};
|
|
26739
28241
|
|
|
28242
|
+
// src/cli/commands/upFolders.ts
|
|
28243
|
+
var import_fs8 = require("fs");
|
|
28244
|
+
var import_path6 = require("path");
|
|
28245
|
+
init_jsonDiffer();
|
|
28246
|
+
init_snapshotsDiffer();
|
|
28247
|
+
init_utils();
|
|
28248
|
+
init_words();
|
|
28249
|
+
init_pgSchema();
|
|
28250
|
+
var schemasResolver = (missingSchemas, newSchemas, sql) => {
|
|
28251
|
+
try {
|
|
28252
|
+
if (missingSchemas.length === 0 || newSchemas.length === 0) {
|
|
28253
|
+
return { created: newSchemas, renamed: [], deleted: missingSchemas };
|
|
28254
|
+
}
|
|
28255
|
+
const result = { created: [], renamed: [], deleted: [] };
|
|
28256
|
+
let index4 = 0;
|
|
28257
|
+
let leftMissing = [...missingSchemas];
|
|
28258
|
+
do {
|
|
28259
|
+
const created = newSchemas[index4];
|
|
28260
|
+
index4 += 1;
|
|
28261
|
+
const possibleRenames = leftMissing.map((it) => {
|
|
28262
|
+
return {
|
|
28263
|
+
value: it,
|
|
28264
|
+
sql: `ALTER SCHEMA "${it.name}" RENAME TO "${created.name}"`
|
|
28265
|
+
};
|
|
28266
|
+
});
|
|
28267
|
+
const renames = possibleRenames.filter((it) => {
|
|
28268
|
+
return sql.includes(it.sql);
|
|
28269
|
+
});
|
|
28270
|
+
if (renames.length > 1)
|
|
28271
|
+
throw new Error("wtf");
|
|
28272
|
+
if (renames.length === 0) {
|
|
28273
|
+
result.created.push(created);
|
|
28274
|
+
} else {
|
|
28275
|
+
const it = renames[0];
|
|
28276
|
+
result.renamed.push({ from: it.value, to: created });
|
|
28277
|
+
delete leftMissing[leftMissing.indexOf(it.value)];
|
|
28278
|
+
leftMissing = leftMissing.filter(Boolean);
|
|
28279
|
+
}
|
|
28280
|
+
} while (index4 < newSchemas.length);
|
|
28281
|
+
result.deleted.push(...leftMissing);
|
|
28282
|
+
return result;
|
|
28283
|
+
} catch (e) {
|
|
28284
|
+
console.error(e);
|
|
28285
|
+
throw e;
|
|
28286
|
+
}
|
|
28287
|
+
};
|
|
28288
|
+
var tablesResolver = (missingTables, newTables, sql) => {
|
|
28289
|
+
try {
|
|
28290
|
+
if (missingTables.length === 0 || newTables.length === 0) {
|
|
28291
|
+
return { created: newTables, renamed: [], deleted: missingTables };
|
|
28292
|
+
}
|
|
28293
|
+
const result = { created: [], renamed: [], deleted: [] };
|
|
28294
|
+
let index4 = 0;
|
|
28295
|
+
let leftMissing = [...missingTables];
|
|
28296
|
+
do {
|
|
28297
|
+
const created = newTables[index4];
|
|
28298
|
+
index4 += 1;
|
|
28299
|
+
const possibleRenames = leftMissing.map((it) => {
|
|
28300
|
+
const schemaPrefix = created.schema ? `"${created.schema}".` : "";
|
|
28301
|
+
return {
|
|
28302
|
+
value: it,
|
|
28303
|
+
sql: `ALTER TABLE ${schemaPrefix}"${it.name}" RENAME TO ${schemaPrefix}"${created.name}"`
|
|
28304
|
+
};
|
|
28305
|
+
});
|
|
28306
|
+
const renames = possibleRenames.filter((it) => {
|
|
28307
|
+
return sql.includes(it.sql);
|
|
28308
|
+
});
|
|
28309
|
+
if (renames.length > 1)
|
|
28310
|
+
throw new Error("wtf");
|
|
28311
|
+
if (renames.length === 0) {
|
|
28312
|
+
result.created.push(created);
|
|
28313
|
+
} else {
|
|
28314
|
+
const it = renames[0];
|
|
28315
|
+
result.renamed.push({ from: it.value, to: created });
|
|
28316
|
+
delete leftMissing[leftMissing.indexOf(it.value)];
|
|
28317
|
+
leftMissing = leftMissing.filter(Boolean);
|
|
28318
|
+
}
|
|
28319
|
+
} while (index4 < newTables.length);
|
|
28320
|
+
result.deleted.push(...leftMissing);
|
|
28321
|
+
return result;
|
|
28322
|
+
} catch (e) {
|
|
28323
|
+
console.error(e);
|
|
28324
|
+
throw e;
|
|
28325
|
+
}
|
|
28326
|
+
};
|
|
28327
|
+
var columnsResolver = (tableName, missingColumns, newColumns, sql) => {
|
|
28328
|
+
try {
|
|
28329
|
+
if (missingColumns.length === 0 || newColumns.length === 0) {
|
|
28330
|
+
return { created: newColumns, renamed: [], deleted: missingColumns };
|
|
28331
|
+
}
|
|
28332
|
+
const result = { created: [], renamed: [], deleted: [] };
|
|
28333
|
+
let index4 = 0;
|
|
28334
|
+
let leftMissing = [...missingColumns];
|
|
28335
|
+
do {
|
|
28336
|
+
const created = newColumns[index4];
|
|
28337
|
+
index4 += 1;
|
|
28338
|
+
const possibleRenames = leftMissing.map((it) => {
|
|
28339
|
+
return {
|
|
28340
|
+
value: it,
|
|
28341
|
+
sql: `ALTER TABLE ${tableName} RENAME COLUMN "${it.name}" TO "${created.name}"`
|
|
28342
|
+
};
|
|
28343
|
+
});
|
|
28344
|
+
const renames = possibleRenames.filter((it) => {
|
|
28345
|
+
return sql.includes(it.sql);
|
|
28346
|
+
});
|
|
28347
|
+
if (renames.length > 1)
|
|
28348
|
+
throw new Error("wtf");
|
|
28349
|
+
if (renames.length === 0) {
|
|
28350
|
+
result.created.push(created);
|
|
28351
|
+
} else {
|
|
28352
|
+
const it = renames[0];
|
|
28353
|
+
result.renamed.push({ from: it.value, to: created });
|
|
28354
|
+
delete leftMissing[leftMissing.indexOf(it.value)];
|
|
28355
|
+
leftMissing = leftMissing.filter(Boolean);
|
|
28356
|
+
}
|
|
28357
|
+
} while (index4 < newColumns.length);
|
|
28358
|
+
result.deleted.push(...leftMissing);
|
|
28359
|
+
return result;
|
|
28360
|
+
} catch (e) {
|
|
28361
|
+
console.error(e);
|
|
28362
|
+
throw e;
|
|
28363
|
+
}
|
|
28364
|
+
};
|
|
28365
|
+
var fullfill = (prev, cur, sql) => {
|
|
28366
|
+
const b = pgSchemaV4.parse(cur);
|
|
28367
|
+
if (!prev) {
|
|
28368
|
+
return {
|
|
28369
|
+
version: "5",
|
|
28370
|
+
dialect: b.dialect,
|
|
28371
|
+
id: b.id,
|
|
28372
|
+
prevId: b.prevId,
|
|
28373
|
+
tables: b.tables,
|
|
28374
|
+
enums: b.enums,
|
|
28375
|
+
schemas: b.schemas,
|
|
28376
|
+
_meta: {
|
|
28377
|
+
schemas: {},
|
|
28378
|
+
tables: {},
|
|
28379
|
+
columns: {}
|
|
28380
|
+
}
|
|
28381
|
+
};
|
|
28382
|
+
}
|
|
28383
|
+
const a = pgSchemaV4.parse(prev);
|
|
28384
|
+
const json1 = squashPgScheme(a);
|
|
28385
|
+
const json2 = squashPgScheme(b);
|
|
28386
|
+
const diffResult = applyJsonDiff(json1, json2);
|
|
28387
|
+
const parseResult = diffResultScheme.safeParse(diffResult);
|
|
28388
|
+
if (!parseResult.success) {
|
|
28389
|
+
parseResult.error.errors.forEach((it) => {
|
|
28390
|
+
console.error(it);
|
|
28391
|
+
});
|
|
28392
|
+
throw new Error();
|
|
28393
|
+
}
|
|
28394
|
+
const typedResult = parseResult.data;
|
|
28395
|
+
const { renamed: renamedSchemas } = schemasResolver(
|
|
28396
|
+
typedResult.deletedSchemas.map((it) => ({ name: it })),
|
|
28397
|
+
typedResult.addedSchemas.map((it) => ({ name: it })),
|
|
28398
|
+
sql
|
|
28399
|
+
);
|
|
28400
|
+
const { renamed } = tablesResolver(
|
|
28401
|
+
typedResult.deletedTables,
|
|
28402
|
+
typedResult.addedTables,
|
|
28403
|
+
sql
|
|
28404
|
+
);
|
|
28405
|
+
const renamedWithAlternations = Object.values(
|
|
28406
|
+
alteredTableScheme.array().parse(diffForRenamedTables(renamed))
|
|
28407
|
+
);
|
|
28408
|
+
const allAltered = typedResult.alteredTablesWithColumns.concat(
|
|
28409
|
+
renamedWithAlternations
|
|
28410
|
+
);
|
|
28411
|
+
const rSchemas = renamedSchemas.map((it) => ({ from: it.from.name, to: it.to.name }));
|
|
28412
|
+
const rTables = renamed.map((it) => {
|
|
28413
|
+
return { from: it.from, to: it.to };
|
|
28414
|
+
});
|
|
28415
|
+
const rColumns = allAltered.map((table4) => {
|
|
28416
|
+
const name = table4.name;
|
|
28417
|
+
const result = columnsResolver(name, table4.deleted, table4.added, sql);
|
|
28418
|
+
const tableName = table4.name;
|
|
28419
|
+
const schema4 = typeof table4.schema === "string" ? table4.schema : "";
|
|
28420
|
+
return result.renamed.map((it) => {
|
|
28421
|
+
return {
|
|
28422
|
+
from: { schema: schema4, table: tableName, column: it.from.name },
|
|
28423
|
+
to: { schema: schema4, table: tableName, column: it.to.name }
|
|
28424
|
+
};
|
|
28425
|
+
});
|
|
28426
|
+
}).flat();
|
|
28427
|
+
const _meta = prepareMigrationMeta(rSchemas, rTables, rColumns);
|
|
28428
|
+
const bpatched = {
|
|
28429
|
+
version: "5",
|
|
28430
|
+
dialect: b.dialect,
|
|
28431
|
+
id: b.id,
|
|
28432
|
+
prevId: b.prevId,
|
|
28433
|
+
tables: b.tables,
|
|
28434
|
+
enums: b.enums,
|
|
28435
|
+
schemas: b.schemas,
|
|
28436
|
+
_meta
|
|
28437
|
+
};
|
|
28438
|
+
pgSchema.parse(bpatched);
|
|
28439
|
+
return {
|
|
28440
|
+
version: "5",
|
|
28441
|
+
dialect: b.dialect,
|
|
28442
|
+
id: b.id,
|
|
28443
|
+
prevId: b.prevId,
|
|
28444
|
+
tables: b.tables,
|
|
28445
|
+
enums: b.enums,
|
|
28446
|
+
schemas: b.schemas,
|
|
28447
|
+
_meta
|
|
28448
|
+
};
|
|
28449
|
+
};
|
|
28450
|
+
var upgradeFolders = (dialect6, out) => {
|
|
28451
|
+
const oldMigrationFolders = (0, import_fs8.readdirSync)(out).filter(
|
|
28452
|
+
(it) => it.length === 14 && /^\d+$/.test(it)
|
|
28453
|
+
);
|
|
28454
|
+
oldMigrationFolders.sort();
|
|
28455
|
+
const res = oldMigrationFolders.reduce(
|
|
28456
|
+
(res2, it) => {
|
|
28457
|
+
const date = new Date();
|
|
28458
|
+
date.setUTCFullYear(Number(it.substring(0, 4)));
|
|
28459
|
+
date.setUTCMonth(Number(it.substring(4, 6)));
|
|
28460
|
+
date.setUTCDate(Number(it.substring(6, 8)));
|
|
28461
|
+
date.setUTCHours(Number(it.substring(8, 10)));
|
|
28462
|
+
date.setUTCMinutes(Number(it.substring(10, 12)));
|
|
28463
|
+
date.setUTCSeconds(Number(it.substring(12, 14)));
|
|
28464
|
+
const path4 = (0, import_path6.join)(out, it);
|
|
28465
|
+
const pathJson = (0, import_path6.join)(out, it, "snapshot.json");
|
|
28466
|
+
const pathSQL = (0, import_path6.join)(out, it, "migration.sql");
|
|
28467
|
+
const snapshot = JSON.parse((0, import_fs8.readFileSync)(pathJson).toString());
|
|
28468
|
+
const sql = (0, import_fs8.readFileSync)(pathSQL).toString();
|
|
28469
|
+
res2.entries.push({
|
|
28470
|
+
idx: res2.idx,
|
|
28471
|
+
json: snapshot,
|
|
28472
|
+
date,
|
|
28473
|
+
sql,
|
|
28474
|
+
path: path4
|
|
28475
|
+
});
|
|
28476
|
+
res2.idx += 1;
|
|
28477
|
+
return res2;
|
|
28478
|
+
},
|
|
28479
|
+
{
|
|
28480
|
+
entries: [],
|
|
28481
|
+
idx: 0
|
|
28482
|
+
}
|
|
28483
|
+
);
|
|
28484
|
+
const metaFolder = (0, import_path6.join)(`${out}`, "meta");
|
|
28485
|
+
if (!(0, import_fs8.existsSync)(metaFolder)) {
|
|
28486
|
+
(0, import_fs8.mkdirSync)(metaFolder, { recursive: true });
|
|
28487
|
+
}
|
|
28488
|
+
const journal = dryJournal(dialect6);
|
|
28489
|
+
let prev = void 0;
|
|
28490
|
+
res.entries.forEach((it) => {
|
|
28491
|
+
const { prefix, suffix, tag } = prepareMigrationMetadata(it.idx);
|
|
28492
|
+
journal.entries.push({
|
|
28493
|
+
idx: it.idx,
|
|
28494
|
+
when: +it.date,
|
|
28495
|
+
tag
|
|
28496
|
+
});
|
|
28497
|
+
const patchedJSON = fullfill(prev, it.json, it.sql);
|
|
28498
|
+
(0, import_fs8.writeFileSync)(
|
|
28499
|
+
(0, import_path6.join)(`${out}`, "meta", `${prefix}_snapshot.json`),
|
|
28500
|
+
JSON.stringify(patchedJSON)
|
|
28501
|
+
);
|
|
28502
|
+
(0, import_fs8.writeFileSync)((0, import_path6.join)(`${out}`, `${tag}.sql`), it.sql);
|
|
28503
|
+
(0, import_fs8.rmSync)(it.path, { recursive: true });
|
|
28504
|
+
prev = it.json;
|
|
28505
|
+
});
|
|
28506
|
+
(0, import_fs8.writeFileSync)((0, import_path6.join)(metaFolder, "_journal.json"), JSON.stringify(journal));
|
|
28507
|
+
};
|
|
28508
|
+
|
|
26740
28509
|
// src/cli/index.ts
|
|
26741
28510
|
var printVersions = () => {
|
|
26742
28511
|
console.log(`${source_default.gray(versions())}
|
|
@@ -26745,13 +28514,13 @@ var printVersions = () => {
|
|
|
26745
28514
|
var assertEitherConfigOrOut = (config, out) => {
|
|
26746
28515
|
if (out)
|
|
26747
28516
|
return out;
|
|
26748
|
-
if (!(0,
|
|
28517
|
+
if (!(0, import_fs9.existsSync)(import_path7.default.join(import_path7.default.resolve(config)))) {
|
|
26749
28518
|
console.log(`${config} file does not exist`);
|
|
26750
28519
|
process.exit(1);
|
|
26751
28520
|
}
|
|
26752
28521
|
console.log(`Reading ${config}`);
|
|
26753
28522
|
const drizzleConfig = JSON.parse(
|
|
26754
|
-
|
|
28523
|
+
import_fs9.default.readFileSync(import_path7.default.join(import_path7.default.resolve(config))).toString()
|
|
26755
28524
|
);
|
|
26756
28525
|
return drizzleConfig.out;
|
|
26757
28526
|
};
|
|
@@ -26819,9 +28588,9 @@ var generateSqliteCommand = new Command("generate:sqlite").option("--schema <sch
|
|
|
26819
28588
|
var prepareGenerateConfig = (options) => {
|
|
26820
28589
|
const { schema: schema4, out, config } = options;
|
|
26821
28590
|
if (!(schema4 || out)) {
|
|
26822
|
-
const
|
|
28591
|
+
const path4 = config != null ? config : "drizzle.config.json";
|
|
26823
28592
|
const drizzleConfig = JSON.parse(
|
|
26824
|
-
|
|
28593
|
+
import_fs9.default.readFileSync(import_path7.default.join(import_path7.default.resolve(path4))).toString()
|
|
26825
28594
|
);
|
|
26826
28595
|
return drizzleConfig;
|
|
26827
28596
|
}
|
|
@@ -26869,6 +28638,8 @@ var upPgCommand = new Command("up:pg").option("--out <out>", `Output folder`).op
|
|
|
26869
28638
|
process.exit(0);
|
|
26870
28639
|
}
|
|
26871
28640
|
assertPackages("drizzle-orm");
|
|
28641
|
+
upPgHandlerV4(out);
|
|
28642
|
+
upgradeFolders("pg", out);
|
|
26872
28643
|
upPgHandler(out);
|
|
26873
28644
|
});
|
|
26874
28645
|
var upMysqlCommand = new Command("up:mysql").option("--out <out>", `Output folder`).option("--config <config>", `Config path [default=drizzle.config.json]`).action((options) => {
|
|
@@ -26916,29 +28687,18 @@ var introspectPgCommand = new Command("introspect:pg").option("--out <out>", `Mi
|
|
|
26916
28687
|
console.log("Missing required params");
|
|
26917
28688
|
return;
|
|
26918
28689
|
}
|
|
26919
|
-
const
|
|
26920
|
-
const folderName = prepareSnapshotFolderName();
|
|
26921
|
-
const migrationFolderPath = `./${res.data.out}/${folderName}`;
|
|
28690
|
+
const { snapshots, journal } = prepareOutFolder(res.data.out, "pg");
|
|
26922
28691
|
const { schema: schema4, ts } = await pgIntrospect2(res.data);
|
|
26923
|
-
const schemaFile =
|
|
26924
|
-
(0,
|
|
28692
|
+
const schemaFile = import_path7.default.join(res.data.out, "schema.ts");
|
|
28693
|
+
(0, import_fs9.writeFileSync)(schemaFile, ts);
|
|
26925
28694
|
console.log();
|
|
26926
|
-
if (
|
|
26927
|
-
|
|
26928
|
-
const snapshotFile = import_path6.default.join(migrationFolderPath, "snapshot.json");
|
|
26929
|
-
(0, import_fs8.writeFileSync)(snapshotFile, JSON.stringify(schema4));
|
|
26930
|
-
const sql = await prepareSQL(
|
|
28695
|
+
if (snapshots.length === 0) {
|
|
28696
|
+
const { sql, _meta } = await prepareSQL(
|
|
26931
28697
|
squashPgScheme(dryPg),
|
|
26932
28698
|
squashPgScheme(schema4),
|
|
26933
28699
|
"pg"
|
|
26934
28700
|
);
|
|
26935
|
-
|
|
26936
|
-
(0, import_fs8.writeFileSync)(sqlFile, sql);
|
|
26937
|
-
(0, import_hanji4.render)(
|
|
26938
|
-
`[${source_default.green(
|
|
26939
|
-
"\u2713"
|
|
26940
|
-
)}] Your SQL migration file \u279C ${source_default.bold.underline.blue(sqlFile)} \u{1F680}`
|
|
26941
|
-
);
|
|
28701
|
+
writeResult(schema4, sql, 0, journal, _meta, res.data.out);
|
|
26942
28702
|
} else {
|
|
26943
28703
|
(0, import_hanji4.render)(
|
|
26944
28704
|
`[${source_default.blue(
|