drizzle-kit 0.17.0-6323eb6 → 0.17.0-c3c9ff0
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 +143 -57
- package/package.json +4 -3
- package/utils.js +43 -3
package/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
2
|
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -6016,7 +6015,6 @@ var require_hanji = __commonJS({
|
|
|
6016
6015
|
var import_hanji, err, info, error, schema, isRenamePromptItem, ResolveColumnSelect, ResolveTableSelect, ResolveSchemasSelect, Spinner, IntrospectProgress, DropMigrationView, trimmedRange;
|
|
6017
6016
|
var init_views = __esm({
|
|
6018
6017
|
"src/cli/views.ts"() {
|
|
6019
|
-
"use strict";
|
|
6020
6018
|
init_source();
|
|
6021
6019
|
import_hanji = __toESM(require_hanji());
|
|
6022
6020
|
err = (msg) => {
|
|
@@ -6338,17 +6336,15 @@ Is ${source_default.bold.blue(
|
|
|
6338
6336
|
var originUUID, snapshotVersion;
|
|
6339
6337
|
var init_global = __esm({
|
|
6340
6338
|
"src/global.ts"() {
|
|
6341
|
-
"use strict";
|
|
6342
6339
|
originUUID = "00000000-0000-0000-0000-000000000000";
|
|
6343
6340
|
snapshotVersion = "5";
|
|
6344
6341
|
}
|
|
6345
6342
|
});
|
|
6346
6343
|
|
|
6347
6344
|
// src/serializer/mysqlSchema.ts
|
|
6348
|
-
var index, fk, column, tableV3, compositePK, table, dialect, schemaHash, schemaInternalV3, schemaInternalV4, schemaInternal, schemaV3, schemaV4, schema2, tableSquashed, schemaSquashed, MySqlSquasher, squashMysqlScheme, mysqlSchema, mysqlSchemaV4, mysqlSchemaV3, backwardCompatibleMysqlSchema, dryMySql;
|
|
6345
|
+
var index, fk, column, tableV3, compositePK, tableV4, table, dialect, schemaHash, schemaInternalV3, schemaInternalV4, schemaInternal, schemaV3, schemaV4, schema2, tableSquashedV4, tableSquashed, schemaSquashed, schemaSquashedV4, MySqlSquasher, squashMysqlSchemeV4, squashMysqlScheme, mysqlSchema, mysqlSchemaV4, mysqlSchemaV3, backwardCompatibleMysqlSchema, dryMySql;
|
|
6349
6346
|
var init_mysqlSchema = __esm({
|
|
6350
6347
|
"src/serializer/mysqlSchema.ts"() {
|
|
6351
|
-
"use strict";
|
|
6352
6348
|
init_global();
|
|
6353
6349
|
init_utils();
|
|
6354
6350
|
init_lib();
|
|
@@ -6388,6 +6384,13 @@ var init_mysqlSchema = __esm({
|
|
|
6388
6384
|
name: stringType(),
|
|
6389
6385
|
columns: stringType().array()
|
|
6390
6386
|
}).strict();
|
|
6387
|
+
tableV4 = objectType({
|
|
6388
|
+
name: stringType(),
|
|
6389
|
+
schema: stringType().optional(),
|
|
6390
|
+
columns: recordType(stringType(), column),
|
|
6391
|
+
indexes: recordType(stringType(), index),
|
|
6392
|
+
foreignKeys: recordType(stringType(), fk)
|
|
6393
|
+
}).strict();
|
|
6391
6394
|
table = objectType({
|
|
6392
6395
|
name: stringType(),
|
|
6393
6396
|
schema: stringType().optional(),
|
|
@@ -6409,7 +6412,7 @@ var init_mysqlSchema = __esm({
|
|
|
6409
6412
|
schemaInternalV4 = objectType({
|
|
6410
6413
|
version: literalType("4"),
|
|
6411
6414
|
dialect,
|
|
6412
|
-
tables: recordType(stringType(),
|
|
6415
|
+
tables: recordType(stringType(), tableV4),
|
|
6413
6416
|
schemas: recordType(stringType(), stringType())
|
|
6414
6417
|
}).strict();
|
|
6415
6418
|
schemaInternal = objectType({
|
|
@@ -6426,6 +6429,13 @@ var init_mysqlSchema = __esm({
|
|
|
6426
6429
|
schemaV3 = schemaInternalV3.merge(schemaHash);
|
|
6427
6430
|
schemaV4 = schemaInternalV4.merge(schemaHash);
|
|
6428
6431
|
schema2 = schemaInternal.merge(schemaHash);
|
|
6432
|
+
tableSquashedV4 = objectType({
|
|
6433
|
+
name: stringType(),
|
|
6434
|
+
schema: stringType().optional(),
|
|
6435
|
+
columns: recordType(stringType(), column),
|
|
6436
|
+
indexes: recordType(stringType(), stringType()),
|
|
6437
|
+
foreignKeys: recordType(stringType(), stringType())
|
|
6438
|
+
}).strict();
|
|
6429
6439
|
tableSquashed = objectType({
|
|
6430
6440
|
name: stringType(),
|
|
6431
6441
|
schema: stringType().optional(),
|
|
@@ -6440,6 +6450,12 @@ var init_mysqlSchema = __esm({
|
|
|
6440
6450
|
tables: recordType(stringType(), tableSquashed),
|
|
6441
6451
|
schemas: recordType(stringType(), stringType())
|
|
6442
6452
|
}).strict();
|
|
6453
|
+
schemaSquashedV4 = objectType({
|
|
6454
|
+
version: literalType("4"),
|
|
6455
|
+
dialect,
|
|
6456
|
+
tables: recordType(stringType(), tableSquashedV4),
|
|
6457
|
+
schemas: recordType(stringType(), stringType())
|
|
6458
|
+
}).strict();
|
|
6443
6459
|
MySqlSquasher = {
|
|
6444
6460
|
squashIdx: (idx) => {
|
|
6445
6461
|
var _a, _b, _c;
|
|
@@ -6491,6 +6507,34 @@ var init_mysqlSchema = __esm({
|
|
|
6491
6507
|
return result;
|
|
6492
6508
|
}
|
|
6493
6509
|
};
|
|
6510
|
+
squashMysqlSchemeV4 = (json) => {
|
|
6511
|
+
const mappedTables = Object.fromEntries(
|
|
6512
|
+
Object.entries(json.tables).map((it) => {
|
|
6513
|
+
const squashedIndexes = mapValues(it[1].indexes, (index4) => {
|
|
6514
|
+
return MySqlSquasher.squashIdx(index4);
|
|
6515
|
+
});
|
|
6516
|
+
const squashedFKs = mapValues(it[1].foreignKeys, (fk4) => {
|
|
6517
|
+
return MySqlSquasher.squashFK(fk4);
|
|
6518
|
+
});
|
|
6519
|
+
return [
|
|
6520
|
+
it[0],
|
|
6521
|
+
{
|
|
6522
|
+
name: it[1].name,
|
|
6523
|
+
schema: it[1].schema,
|
|
6524
|
+
columns: it[1].columns,
|
|
6525
|
+
indexes: squashedIndexes,
|
|
6526
|
+
foreignKeys: squashedFKs
|
|
6527
|
+
}
|
|
6528
|
+
];
|
|
6529
|
+
})
|
|
6530
|
+
);
|
|
6531
|
+
return {
|
|
6532
|
+
version: "4",
|
|
6533
|
+
dialect: json.dialect,
|
|
6534
|
+
tables: mappedTables,
|
|
6535
|
+
schemas: json.schemas
|
|
6536
|
+
};
|
|
6537
|
+
};
|
|
6494
6538
|
squashMysqlScheme = (json) => {
|
|
6495
6539
|
const mappedTables = Object.fromEntries(
|
|
6496
6540
|
Object.entries(json.tables).map((it) => {
|
|
@@ -6544,10 +6588,9 @@ var init_mysqlSchema = __esm({
|
|
|
6544
6588
|
});
|
|
6545
6589
|
|
|
6546
6590
|
// src/serializer/pgSchema.ts
|
|
6547
|
-
var indexV2, columnV2, tableV2, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, index2, fk2, column2, tableV32, compositePK2, table2, schemaHash2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternal, tableSquashed2, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg;
|
|
6591
|
+
var indexV2, columnV2, tableV2, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, index2, fk2, column2, tableV32, compositePK2, tableV42, table2, schemaHash2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgSchemeV4, squashPgScheme, dryPg;
|
|
6548
6592
|
var init_pgSchema = __esm({
|
|
6549
6593
|
"src/serializer/pgSchema.ts"() {
|
|
6550
|
-
"use strict";
|
|
6551
6594
|
init_global();
|
|
6552
6595
|
init_utils();
|
|
6553
6596
|
init_lib();
|
|
@@ -6639,6 +6682,13 @@ var init_pgSchema = __esm({
|
|
|
6639
6682
|
name: stringType(),
|
|
6640
6683
|
columns: stringType().array()
|
|
6641
6684
|
}).strict();
|
|
6685
|
+
tableV42 = objectType({
|
|
6686
|
+
name: stringType(),
|
|
6687
|
+
schema: stringType(),
|
|
6688
|
+
columns: recordType(stringType(), column2),
|
|
6689
|
+
indexes: recordType(stringType(), index2),
|
|
6690
|
+
foreignKeys: recordType(stringType(), fk2)
|
|
6691
|
+
}).strict();
|
|
6642
6692
|
table2 = objectType({
|
|
6643
6693
|
name: stringType(),
|
|
6644
6694
|
schema: stringType(),
|
|
@@ -6660,7 +6710,7 @@ var init_pgSchema = __esm({
|
|
|
6660
6710
|
pgSchemaInternalV4 = objectType({
|
|
6661
6711
|
version: literalType("4"),
|
|
6662
6712
|
dialect: literalType("pg"),
|
|
6663
|
-
tables: recordType(stringType(),
|
|
6713
|
+
tables: recordType(stringType(), tableV42),
|
|
6664
6714
|
enums: recordType(stringType(), enumSchema),
|
|
6665
6715
|
schemas: recordType(stringType(), stringType())
|
|
6666
6716
|
}).strict();
|
|
@@ -6684,6 +6734,20 @@ var init_pgSchema = __esm({
|
|
|
6684
6734
|
foreignKeys: recordType(stringType(), stringType()),
|
|
6685
6735
|
compositePrimaryKeys: recordType(stringType(), stringType())
|
|
6686
6736
|
}).strict();
|
|
6737
|
+
tableSquashedV42 = objectType({
|
|
6738
|
+
name: stringType(),
|
|
6739
|
+
schema: stringType(),
|
|
6740
|
+
columns: recordType(stringType(), column2),
|
|
6741
|
+
indexes: recordType(stringType(), stringType()),
|
|
6742
|
+
foreignKeys: recordType(stringType(), stringType())
|
|
6743
|
+
}).strict();
|
|
6744
|
+
pgSchemaSquashedV4 = objectType({
|
|
6745
|
+
version: literalType("4"),
|
|
6746
|
+
dialect: enumType(["pg"]),
|
|
6747
|
+
tables: recordType(stringType(), tableSquashedV42),
|
|
6748
|
+
enums: recordType(stringType(), enumSchema),
|
|
6749
|
+
schemas: recordType(stringType(), stringType())
|
|
6750
|
+
}).strict();
|
|
6687
6751
|
pgSchemaSquashed = objectType({
|
|
6688
6752
|
version: literalType("5"),
|
|
6689
6753
|
dialect: enumType(["pg"]),
|
|
@@ -6747,6 +6811,35 @@ var init_pgSchema = __esm({
|
|
|
6747
6811
|
return result;
|
|
6748
6812
|
}
|
|
6749
6813
|
};
|
|
6814
|
+
squashPgSchemeV4 = (json) => {
|
|
6815
|
+
const mappedTables = Object.fromEntries(
|
|
6816
|
+
Object.entries(json.tables).map((it) => {
|
|
6817
|
+
const squashedIndexes = mapValues(it[1].indexes, (index4) => {
|
|
6818
|
+
return PgSquasher.squashIdx(index4);
|
|
6819
|
+
});
|
|
6820
|
+
const squashedFKs = mapValues(it[1].foreignKeys, (fk4) => {
|
|
6821
|
+
return PgSquasher.squashFK(fk4);
|
|
6822
|
+
});
|
|
6823
|
+
return [
|
|
6824
|
+
it[0],
|
|
6825
|
+
{
|
|
6826
|
+
name: it[1].name,
|
|
6827
|
+
schema: it[1].schema,
|
|
6828
|
+
columns: it[1].columns,
|
|
6829
|
+
indexes: squashedIndexes,
|
|
6830
|
+
foreignKeys: squashedFKs
|
|
6831
|
+
}
|
|
6832
|
+
];
|
|
6833
|
+
})
|
|
6834
|
+
);
|
|
6835
|
+
return {
|
|
6836
|
+
version: "4",
|
|
6837
|
+
dialect: json.dialect,
|
|
6838
|
+
tables: mappedTables,
|
|
6839
|
+
enums: json.enums,
|
|
6840
|
+
schemas: json.schemas
|
|
6841
|
+
};
|
|
6842
|
+
};
|
|
6750
6843
|
squashPgScheme = (json) => {
|
|
6751
6844
|
const mappedTables = Object.fromEntries(
|
|
6752
6845
|
Object.entries(json.tables).map((it) => {
|
|
@@ -6801,7 +6894,6 @@ var init_pgSchema = __esm({
|
|
|
6801
6894
|
var index3, fk3, compositePK3, column3, tableV33, table3, dialect2, schemaHash3, schemaInternalV32, schemaInternalV42, latestVersion, schemaInternal2, schemaV32, schemaV42, schema3, tableSquashed3, schemaSquashed2, SQLiteSquasher, squashSqliteScheme, drySQLite, sqliteSchemaV3, sqliteSchemaV4, sqliteSchema, backwardCompatibleSqliteSchema;
|
|
6802
6895
|
var init_sqliteSchema = __esm({
|
|
6803
6896
|
"src/serializer/sqliteSchema.ts"() {
|
|
6804
|
-
"use strict";
|
|
6805
6897
|
init_global();
|
|
6806
6898
|
init_utils();
|
|
6807
6899
|
init_lib();
|
|
@@ -13169,7 +13261,6 @@ function applyJsonDiff(json1, json2) {
|
|
|
13169
13261
|
var import_json_diff, findAlternationsInTable, alternationsInColumn;
|
|
13170
13262
|
var init_jsonDiffer = __esm({
|
|
13171
13263
|
"src/jsonDiffer.js"() {
|
|
13172
|
-
"use strict";
|
|
13173
13264
|
import_json_diff = __toESM(require_lib());
|
|
13174
13265
|
"use-strict";
|
|
13175
13266
|
findAlternationsInTable = (table4, tableSchema) => {
|
|
@@ -13314,7 +13405,6 @@ var init_jsonDiffer = __esm({
|
|
|
13314
13405
|
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, MySqlAlterTableAlterColumnSetDefaultConvertor, MySqlAlterTableAlterColumnDropDefaultConvertor, MySqlModifyColumn, SqliteAlterTableAlterColumnDropDefaultConvertor, PgAlterTableCreateCompositePrimaryKeyConvertor, PgAlterTableDeleteCompositePrimaryKeyConvertor, PgAlterTableAlterCompositePrimaryKeyConvertor, MySqlAlterTableCreateCompositePrimaryKeyConvertor, MySqlAlterTableDeleteCompositePrimaryKeyConvertor, MySqlAlterTableAlterCompositePrimaryKeyConvertor, 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, MySqlDropIndexConvertor, convertors, fromJson;
|
|
13315
13406
|
var init_sqlgenerator = __esm({
|
|
13316
13407
|
"src/sqlgenerator.ts"() {
|
|
13317
|
-
"use strict";
|
|
13318
13408
|
init_mysqlSchema();
|
|
13319
13409
|
init_pgSchema();
|
|
13320
13410
|
init_sqliteSchema();
|
|
@@ -14414,7 +14504,6 @@ drop type __venum;
|
|
|
14414
14504
|
var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, prepareAlterTableColumnsJson, _prepareDropColumns, _prepareAddColumns, _prepareSQLiteAddColumns, _prepareAlterColumns, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql;
|
|
14415
14505
|
var init_jsonStatements = __esm({
|
|
14416
14506
|
"src/jsonStatements.ts"() {
|
|
14417
|
-
"use strict";
|
|
14418
14507
|
init_mysqlSchema();
|
|
14419
14508
|
init_pgSchema();
|
|
14420
14509
|
init_sqliteSchema();
|
|
@@ -14896,7 +14985,6 @@ var init_jsonStatements = __esm({
|
|
|
14896
14985
|
var makeChanged, makeSelfOrChanged, makePatched, makeSelfOrPatched, valueFromSelfOrPatchedNew, columnSchema, alteredColumnSchema, enumSchema2, changedEnumSchema, tableScheme, alteredTableScheme, diffResultScheme, applySnapshotsDiff;
|
|
14897
14986
|
var init_snapshotsDiffer = __esm({
|
|
14898
14987
|
"src/snapshotsDiffer.ts"() {
|
|
14899
|
-
"use strict";
|
|
14900
14988
|
init_sqlgenerator();
|
|
14901
14989
|
init_lib();
|
|
14902
14990
|
init_jsonDiffer();
|
|
@@ -15352,7 +15440,6 @@ var init_snapshotsDiffer = __esm({
|
|
|
15352
15440
|
var prepareMigrationMetadata, adjectives, heroes;
|
|
15353
15441
|
var init_words = __esm({
|
|
15354
15442
|
"src/utils/words.ts"() {
|
|
15355
|
-
"use strict";
|
|
15356
15443
|
prepareMigrationMetadata = (idx) => {
|
|
15357
15444
|
const prefix = idx.toFixed(0).padStart(4, "0");
|
|
15358
15445
|
const suffix = `${adjectives.random()}_${heroes.random()}`;
|
|
@@ -16674,7 +16761,6 @@ var init_words = __esm({
|
|
|
16674
16761
|
var import_crypto, import_fs, upPgHandlerV4toV5, upPgHandler, upPgHandlerV4, updateUpToV4, update1to2, update2to3, update3to4;
|
|
16675
16762
|
var init_pgUp = __esm({
|
|
16676
16763
|
"src/cli/commands/pgUp.ts"() {
|
|
16677
|
-
"use strict";
|
|
16678
16764
|
init_source();
|
|
16679
16765
|
import_crypto = require("crypto");
|
|
16680
16766
|
import_fs = require("fs");
|
|
@@ -16712,7 +16798,7 @@ var init_pgUp = __esm({
|
|
|
16712
16798
|
}
|
|
16713
16799
|
mappedColumns[ckey] = { ...column6, default: newDefault, type: newType };
|
|
16714
16800
|
}
|
|
16715
|
-
mappedTables[key] = { ...table4, columns: mappedColumns };
|
|
16801
|
+
mappedTables[key] = { ...table4, columns: mappedColumns, compositePrimaryKeys: {} };
|
|
16716
16802
|
}
|
|
16717
16803
|
return {
|
|
16718
16804
|
version: "5",
|
|
@@ -16914,7 +17000,6 @@ var init_pgUp = __esm({
|
|
|
16914
17000
|
var import_fs2, upMysqlHandler, upMySqlHandlerV4toV5, upMysqlHandlerV4, updateToLatestV4, updateV3toV4;
|
|
16915
17001
|
var init_mysqlUp = __esm({
|
|
16916
17002
|
"src/cli/commands/mysqlUp.ts"() {
|
|
16917
|
-
"use strict";
|
|
16918
17003
|
init_source();
|
|
16919
17004
|
import_fs2 = __toESM(require("fs"));
|
|
16920
17005
|
init_mysqlSchema();
|
|
@@ -16972,7 +17057,7 @@ var init_mysqlUp = __esm({
|
|
|
16972
17057
|
autoincrement: newAutoIncrement
|
|
16973
17058
|
};
|
|
16974
17059
|
}
|
|
16975
|
-
mappedTables[key] = { ...table4, columns: mappedColumns };
|
|
17060
|
+
mappedTables[key] = { ...table4, columns: mappedColumns, compositePrimaryKeys: {} };
|
|
16976
17061
|
}
|
|
16977
17062
|
return {
|
|
16978
17063
|
version: "5",
|
|
@@ -17025,7 +17110,6 @@ var init_mysqlUp = __esm({
|
|
|
17025
17110
|
var import_fs3, import_path, schemasResolverWithSQL, resolveSchemas, resolveTablesWithSQL, resolveTables, resolveColumnsWithSQL, resolveColumns, fullfill, fullfillpg, fullfillmysql, fullfillsqlite, upgradeFolders;
|
|
17026
17111
|
var init_upFolders = __esm({
|
|
17027
17112
|
"src/cli/commands/upFolders.ts"() {
|
|
17028
|
-
"use strict";
|
|
17029
17113
|
import_fs3 = require("fs");
|
|
17030
17114
|
import_path = require("path");
|
|
17031
17115
|
init_jsonDiffer();
|
|
@@ -17229,8 +17313,8 @@ var init_upFolders = __esm({
|
|
|
17229
17313
|
return upPgHandlerV4toV5(b);
|
|
17230
17314
|
}
|
|
17231
17315
|
const a = pgSchemaV4.parse(prev);
|
|
17232
|
-
const json1 =
|
|
17233
|
-
const json2 =
|
|
17316
|
+
const json1 = squashPgSchemeV4(a);
|
|
17317
|
+
const json2 = squashPgSchemeV4(b);
|
|
17234
17318
|
const diffResult = applyJsonDiff(json1, json2);
|
|
17235
17319
|
const parseResult = diffResultScheme.safeParse(diffResult);
|
|
17236
17320
|
if (!parseResult.success) {
|
|
@@ -17301,8 +17385,8 @@ var init_upFolders = __esm({
|
|
|
17301
17385
|
return upMySqlHandlerV4toV5(b);
|
|
17302
17386
|
}
|
|
17303
17387
|
const a = mysqlSchemaV4.parse(prev);
|
|
17304
|
-
const json1 =
|
|
17305
|
-
const json2 =
|
|
17388
|
+
const json1 = squashMysqlSchemeV4(a);
|
|
17389
|
+
const json2 = squashMysqlSchemeV4(b);
|
|
17306
17390
|
const diffResult = applyJsonDiff(json1, json2);
|
|
17307
17391
|
const parseResult = diffResultScheme.safeParse(diffResult);
|
|
17308
17392
|
if (!parseResult.success) {
|
|
@@ -17523,7 +17607,6 @@ var init_upFolders = __esm({
|
|
|
17523
17607
|
var import_fs4, import_path2, assertV1OutFolder, dryJournal, snapshotsPriorV4, prepareOutFolder2, mapValues, validatorForDialect, validateWithReport, prepareMigrationFolder, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey;
|
|
17524
17608
|
var init_utils = __esm({
|
|
17525
17609
|
"src/utils.ts"() {
|
|
17526
|
-
"use strict";
|
|
17527
17610
|
import_fs4 = require("fs");
|
|
17528
17611
|
init_views();
|
|
17529
17612
|
init_mysqlSchema();
|
|
@@ -25618,7 +25701,6 @@ __export(mysqlImports_exports, {
|
|
|
25618
25701
|
var import_mysql_core, prepareFromMySqlImports;
|
|
25619
25702
|
var init_mysqlImports = __esm({
|
|
25620
25703
|
"src/serializer/mysqlImports.ts"() {
|
|
25621
|
-
"use strict";
|
|
25622
25704
|
import_mysql_core = require("drizzle-orm/mysql-core");
|
|
25623
25705
|
prepareFromMySqlImports = (imports) => {
|
|
25624
25706
|
const tables = [];
|
|
@@ -25670,7 +25752,6 @@ function clearDefaults(defaultValue, collate) {
|
|
|
25670
25752
|
var import_mysql_core2, import_table, import_utils9, import_sql, import_common, import_date, dialect3, indexName, generateMySqlSnapshot, fromDatabase;
|
|
25671
25753
|
var init_mysqlSerializer = __esm({
|
|
25672
25754
|
"src/serializer/mysqlSerializer.ts"() {
|
|
25673
|
-
"use strict";
|
|
25674
25755
|
import_mysql_core2 = require("drizzle-orm/mysql-core");
|
|
25675
25756
|
import_table = require("drizzle-orm/table");
|
|
25676
25757
|
import_utils9 = require("drizzle-orm/mysql-core/utils");
|
|
@@ -25841,7 +25922,7 @@ var init_mysqlSerializer = __esm({
|
|
|
25841
25922
|
const dataType = column6["DATA_TYPE"];
|
|
25842
25923
|
const columnType = column6["COLUMN_TYPE"];
|
|
25843
25924
|
const isPrimary = column6["COLUMN_KEY"] === "PRI";
|
|
25844
|
-
const isAutoincrement = column6["EXTRA"] === "auto_increment"
|
|
25925
|
+
const isAutoincrement = column6["EXTRA"] === "auto_increment";
|
|
25845
25926
|
const isDefaultAnExpression = column6["EXTRA"] === "DEFAULT_GENERATED";
|
|
25846
25927
|
const columnDefault = column6["COLUMN_DEFAULT"];
|
|
25847
25928
|
const collation = column6["CHARACTER_SET_NAME"];
|
|
@@ -26015,7 +26096,6 @@ __export(pgImports_exports, {
|
|
|
26015
26096
|
var import_pg_core, prepareFromPgImports;
|
|
26016
26097
|
var init_pgImports = __esm({
|
|
26017
26098
|
"src/serializer/pgImports.ts"() {
|
|
26018
|
-
"use strict";
|
|
26019
26099
|
import_pg_core = require("drizzle-orm/pg-core");
|
|
26020
26100
|
prepareFromPgImports = (imports) => {
|
|
26021
26101
|
const tables = [];
|
|
@@ -26054,7 +26134,6 @@ __export(pgSerializer_exports, {
|
|
|
26054
26134
|
var import_pg_core2, import_utils10, import_sql2, import_table2, dialect4, indexName2, generatePgSnapshot, trimChar, fromDatabase2, columnToDefault, defaultForColumn;
|
|
26055
26135
|
var init_pgSerializer = __esm({
|
|
26056
26136
|
"src/serializer/pgSerializer.ts"() {
|
|
26057
|
-
"use strict";
|
|
26058
26137
|
import_pg_core2 = require("drizzle-orm/pg-core");
|
|
26059
26138
|
import_utils10 = require("drizzle-orm/pg-core/utils");
|
|
26060
26139
|
import_sql2 = require("drizzle-orm/sql");
|
|
@@ -26534,7 +26613,6 @@ __export(sqliteImports_exports, {
|
|
|
26534
26613
|
var import_sqlite_core, prepareFromSqliteImports;
|
|
26535
26614
|
var init_sqliteImports = __esm({
|
|
26536
26615
|
"src/serializer/sqliteImports.ts"() {
|
|
26537
|
-
"use strict";
|
|
26538
26616
|
import_sqlite_core = require("drizzle-orm/sqlite-core");
|
|
26539
26617
|
prepareFromSqliteImports = (imports) => {
|
|
26540
26618
|
const tables = [];
|
|
@@ -26561,7 +26639,6 @@ __export(sqliteSerializer_exports, {
|
|
|
26561
26639
|
var import_table3, import_sql3, import_sqlite_core2, import_utils11, dialect5, generateSqliteSnapshot;
|
|
26562
26640
|
var init_sqliteSerializer = __esm({
|
|
26563
26641
|
"src/serializer/sqliteSerializer.ts"() {
|
|
26564
|
-
"use strict";
|
|
26565
26642
|
import_table3 = require("drizzle-orm/table");
|
|
26566
26643
|
import_sql3 = require("drizzle-orm/sql");
|
|
26567
26644
|
import_sqlite_core2 = require("drizzle-orm/sqlite-core");
|
|
@@ -26570,12 +26647,19 @@ var init_sqliteSerializer = __esm({
|
|
|
26570
26647
|
generateSqliteSnapshot = (tables, enums) => {
|
|
26571
26648
|
const result = {};
|
|
26572
26649
|
for (const table4 of tables) {
|
|
26573
|
-
const tableName = (0, import_table3.getTableName)(table4);
|
|
26574
26650
|
const columnsObject = {};
|
|
26575
26651
|
const indexesObject = {};
|
|
26576
26652
|
const foreignKeysObject = {};
|
|
26577
26653
|
const primaryKeysObject = {};
|
|
26578
|
-
|
|
26654
|
+
const {
|
|
26655
|
+
name: tableName,
|
|
26656
|
+
columns,
|
|
26657
|
+
indexes,
|
|
26658
|
+
foreignKeys: tableForeignKeys,
|
|
26659
|
+
schema: schema4,
|
|
26660
|
+
primaryKeys
|
|
26661
|
+
} = (0, import_utils11.getTableConfig)(table4);
|
|
26662
|
+
columns.forEach((column6) => {
|
|
26579
26663
|
const notNull = column6.notNull;
|
|
26580
26664
|
const primaryKey = column6.primary;
|
|
26581
26665
|
const columnToSet = {
|
|
@@ -26583,7 +26667,7 @@ var init_sqliteSerializer = __esm({
|
|
|
26583
26667
|
type: column6.getSQLType(),
|
|
26584
26668
|
primaryKey,
|
|
26585
26669
|
notNull,
|
|
26586
|
-
autoincrement: column6.autoIncrement
|
|
26670
|
+
autoincrement: column6 instanceof import_sqlite_core2.SQLiteBaseInteger ? column6.autoIncrement : void 0
|
|
26587
26671
|
};
|
|
26588
26672
|
if (column6.default !== void 0) {
|
|
26589
26673
|
if (column6.default instanceof import_sql3.SQL) {
|
|
@@ -26602,7 +26686,7 @@ var init_sqliteSerializer = __esm({
|
|
|
26602
26686
|
}
|
|
26603
26687
|
columnsObject[column6.name] = columnToSet;
|
|
26604
26688
|
});
|
|
26605
|
-
const foreignKeys =
|
|
26689
|
+
const foreignKeys = tableForeignKeys.map((fk4) => {
|
|
26606
26690
|
const name = fk4.getName();
|
|
26607
26691
|
const tableFrom = tableName;
|
|
26608
26692
|
const onDelete = fk4.onDelete;
|
|
@@ -26625,11 +26709,11 @@ var init_sqliteSerializer = __esm({
|
|
|
26625
26709
|
foreignKeys.forEach((it) => {
|
|
26626
26710
|
foreignKeysObject[it.name] = it;
|
|
26627
26711
|
});
|
|
26628
|
-
|
|
26712
|
+
indexes.forEach((value) => {
|
|
26629
26713
|
var _a;
|
|
26630
|
-
const
|
|
26714
|
+
const columns2 = value.config.columns;
|
|
26631
26715
|
const name = value.config.name;
|
|
26632
|
-
let indexColumns =
|
|
26716
|
+
let indexColumns = columns2.map((it) => {
|
|
26633
26717
|
if (it instanceof import_sql3.SQL) {
|
|
26634
26718
|
return dialect5.sqlToQuery(it).sql;
|
|
26635
26719
|
} else {
|
|
@@ -26649,7 +26733,7 @@ var init_sqliteSerializer = __esm({
|
|
|
26649
26733
|
where
|
|
26650
26734
|
};
|
|
26651
26735
|
});
|
|
26652
|
-
|
|
26736
|
+
primaryKeys.forEach((it) => {
|
|
26653
26737
|
primaryKeysObject[it.getName()] = {
|
|
26654
26738
|
columns: it.columns.map((it2) => it2.name)
|
|
26655
26739
|
};
|
|
@@ -26680,7 +26764,6 @@ var init_sqliteSerializer = __esm({
|
|
|
26680
26764
|
var import_fs5, import_node, import_path3, import_glob, safeRegister, serializeMySql, serializePg, serializeSQLite, prepareFilenames;
|
|
26681
26765
|
var init_serializer = __esm({
|
|
26682
26766
|
"src/serializer/index.ts"() {
|
|
26683
|
-
"use strict";
|
|
26684
26767
|
import_fs5 = __toESM(require("fs"));
|
|
26685
26768
|
import_node = __toESM(require_node2());
|
|
26686
26769
|
import_path3 = __toESM(require("path"));
|
|
@@ -26746,7 +26829,6 @@ var init_serializer = __esm({
|
|
|
26746
26829
|
var import_fs6, import_crypto2, prepareMySqlMigrationSnapshot, prepareSqliteMigrationSnapshot, preparePgMigrationSnapshot, preparePrevSnapshot;
|
|
26747
26830
|
var init_migrationPreparator = __esm({
|
|
26748
26831
|
"src/migrationPreparator.ts"() {
|
|
26749
|
-
"use strict";
|
|
26750
26832
|
import_fs6 = __toESM(require("fs"));
|
|
26751
26833
|
import_crypto2 = require("crypto");
|
|
26752
26834
|
init_serializer();
|
|
@@ -26816,7 +26898,6 @@ __export(migrate_exports, {
|
|
|
26816
26898
|
var import_fs7, import_path4, import_hanji2, prepareAndMigratePg, prepareAndMigrateMySql, prepareAndMigrateSqlite, prepareSQL, promptColumnsConflicts, promptTablesConflict, promptSchemasConflict, writeResult, prepareSnapshotFolderName, two;
|
|
26817
26899
|
var init_migrate = __esm({
|
|
26818
26900
|
"src/cli/commands/migrate.ts"() {
|
|
26819
|
-
"use strict";
|
|
26820
26901
|
import_fs7 = __toESM(require("fs"));
|
|
26821
26902
|
init_migrationPreparator();
|
|
26822
26903
|
init_snapshotsDiffer();
|
|
@@ -27099,7 +27180,7 @@ var init_migrate = __esm({
|
|
|
27099
27180
|
result.deleted.push(...leftMissing);
|
|
27100
27181
|
return result;
|
|
27101
27182
|
};
|
|
27102
|
-
writeResult = (cur, sqlStatements, journal, _meta, outFolder, breakpoints) => {
|
|
27183
|
+
writeResult = (cur, sqlStatements, journal, _meta, outFolder, breakpoints, isIntrospect = false) => {
|
|
27103
27184
|
console.log(schema(cur));
|
|
27104
27185
|
if (sqlStatements.length === 0) {
|
|
27105
27186
|
console.log("No schema changes, nothing to migrate \u{1F634}");
|
|
@@ -27117,7 +27198,14 @@ var init_migrate = __esm({
|
|
|
27117
27198
|
JSON.stringify(toSave, null, 2)
|
|
27118
27199
|
);
|
|
27119
27200
|
const sqlDelimiter = breakpoints ? "--> statement-breakpoint\n" : "\n";
|
|
27120
|
-
|
|
27201
|
+
let sql = sqlStatements.join(sqlDelimiter);
|
|
27202
|
+
if (isIntrospect) {
|
|
27203
|
+
sql = `-- Current sql file was generated after introspecting the database
|
|
27204
|
+
-- If you want to run this migration please uncomment this code before executing migraitons
|
|
27205
|
+
/*
|
|
27206
|
+
${sql}
|
|
27207
|
+
*/`;
|
|
27208
|
+
}
|
|
27121
27209
|
journal.entries.push({
|
|
27122
27210
|
idx,
|
|
27123
27211
|
version: cur.version,
|
|
@@ -27239,7 +27327,6 @@ var init_camelcase = __esm({
|
|
|
27239
27327
|
// src/@types/utils.ts
|
|
27240
27328
|
var init_utils2 = __esm({
|
|
27241
27329
|
"src/@types/utils.ts"() {
|
|
27242
|
-
"use strict";
|
|
27243
27330
|
init_camelcase();
|
|
27244
27331
|
String.prototype.trimChar = function(char) {
|
|
27245
27332
|
let start = 0;
|
|
@@ -31643,7 +31730,6 @@ var require_lib3 = __commonJS({
|
|
|
31643
31730
|
var pgImportsList, objToStatement2, timeConfig, possibleIntervals, intervalStrToObj, intervalConfig, importsPatch, relations, schemaToTypeScript, isCyclic, isSelf, column4, dimensionsInArray, createTableColumns, createTableIndexes, createTablePKs, createTableFKs;
|
|
31644
31731
|
var init_introspect = __esm({
|
|
31645
31732
|
"src/introspect.ts"() {
|
|
31646
|
-
"use strict";
|
|
31647
31733
|
init_utils2();
|
|
31648
31734
|
init_pgSerializer();
|
|
31649
31735
|
pgImportsList = /* @__PURE__ */ new Set([
|
|
@@ -32144,7 +32230,6 @@ __export(pgIntrospect_exports, {
|
|
|
32144
32230
|
var import_hanji4, import_pg, PgConfig1, PgConfig2, Conf, pgIntrospect;
|
|
32145
32231
|
var init_pgIntrospect = __esm({
|
|
32146
32232
|
"src/cli/commands/pgIntrospect.ts"() {
|
|
32147
|
-
"use strict";
|
|
32148
32233
|
import_hanji4 = __toESM(require_hanji());
|
|
32149
32234
|
init_lib();
|
|
32150
32235
|
init_views();
|
|
@@ -48560,7 +48645,6 @@ var require_promise2 = __commonJS({
|
|
|
48560
48645
|
var mysqlImportsList, objToStatement22, timeConfig2, binaryConfig, importsPatch2, relations2, schemaToTypeScript2, isCyclic2, isSelf2, mapColumnDefault, mapColumnDefaultForJson, column5, createTableColumns2, createTableIndexes2, createTablePKs2, createTableFKs2;
|
|
48561
48646
|
var init_mysql_introspect = __esm({
|
|
48562
48647
|
"src/mysql-introspect.ts"() {
|
|
48563
|
-
"use strict";
|
|
48564
48648
|
init_utils2();
|
|
48565
48649
|
init_mysqlSerializer();
|
|
48566
48650
|
mysqlImportsList = /* @__PURE__ */ new Set([
|
|
@@ -48750,13 +48834,13 @@ import { sql } from "drizzle-orm/sql"
|
|
|
48750
48834
|
if (lowered.startsWith("int")) {
|
|
48751
48835
|
let out = `${name.camelCase()}: int("${name}")`;
|
|
48752
48836
|
out += autoincrement ? `.autoincrement()` : "";
|
|
48753
|
-
out += defaultValue ? `.default(${mapColumnDefault(defaultValue)})` : "";
|
|
48837
|
+
out += typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault(defaultValue)})` : "";
|
|
48754
48838
|
return out;
|
|
48755
48839
|
}
|
|
48756
48840
|
if (lowered.startsWith("tinyint")) {
|
|
48757
48841
|
let out = `${name.camelCase()}: tinyint("${name}")`;
|
|
48758
48842
|
out += autoincrement ? `.autoincrement()` : "";
|
|
48759
|
-
out += defaultValue ? `.default(${mapColumnDefault(defaultValue)})` : "";
|
|
48843
|
+
out += typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault(defaultValue)})` : "";
|
|
48760
48844
|
return out;
|
|
48761
48845
|
}
|
|
48762
48846
|
if (lowered.startsWith("smallint")) {
|
|
@@ -48894,7 +48978,7 @@ import { sql } from "drizzle-orm/sql"
|
|
|
48894
48978
|
params = { precision, scale };
|
|
48895
48979
|
}
|
|
48896
48980
|
let out = params ? `${name.camelCase()}: decimal("${name}", ${timeConfig2(params)})` : `${name.camelCase()}: decimal("${name}")`;
|
|
48897
|
-
defaultValue = defaultValue ? `.default(${mapColumnDefault(defaultValue)})` : "";
|
|
48981
|
+
defaultValue = typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault(defaultValue)})` : "";
|
|
48898
48982
|
out += defaultValue;
|
|
48899
48983
|
return out;
|
|
48900
48984
|
}
|
|
@@ -49027,7 +49111,6 @@ __export(mysqlIntrospect_exports, {
|
|
|
49027
49111
|
var import_hanji5, import_promise, MySQLConfig1, MySQLConfig2, Conf2, mysqlIntrospect;
|
|
49028
49112
|
var init_mysqlIntrospect = __esm({
|
|
49029
49113
|
"src/cli/commands/mysqlIntrospect.ts"() {
|
|
49030
|
-
"use strict";
|
|
49031
49114
|
import_hanji5 = __toESM(require_hanji());
|
|
49032
49115
|
init_lib();
|
|
49033
49116
|
init_views();
|
|
@@ -49199,8 +49282,9 @@ var package_default = {
|
|
|
49199
49282
|
scripts: {
|
|
49200
49283
|
"migrate:old": "drizzle-kit generate:pg --out ./dev/migrations-pg --schema ./dev/migrations-pg/schema.ts",
|
|
49201
49284
|
"migrate:old:mysql": "drizzle-kit generate:mysql --out ./dev/migrations-mysql --schema ./dev/migrations-mysql/schema.ts",
|
|
49202
|
-
"start:pg": "node -r esbuild-register ./src/cli/index.ts generate:pg --out ./dev/
|
|
49203
|
-
"start:
|
|
49285
|
+
"start:pg": "node -r esbuild-register ./src/cli/index.ts generate:pg --out ./dev/migrations-pg --schema ./dev/migrations-pg/schema.ts",
|
|
49286
|
+
"start:sqlite": "node -r esbuild-register ./src/cli/index.ts generate:sqlite --out ./dev/migrations-sqlite --schema ./dev/migrations-sqlite/schema.ts",
|
|
49287
|
+
"start:mysql": "node -r esbuild-register ./src/cli/index.ts generate:mysql --out ./dev/migrations-mysql --schema ./dev/migrations-mysql/schema.ts",
|
|
49204
49288
|
"check:pg": "node -r esbuild-register ./src/cli/index.ts check --out ./dev/migrations --dialect pg",
|
|
49205
49289
|
"introspect:mysql": "node -r esbuild-register ./src/cli/index.ts introspect:mysql --out ./dev/introspect-mysql --connectionString",
|
|
49206
49290
|
"introspect:pg": "node -r esbuild-register ./src/cli/index.ts introspect:pg --out ./dev/introspect-pg --connectionString=postgresql://postgres@localhost:5432/introspect",
|
|
@@ -49571,7 +49655,8 @@ var introspectPgCommand = new Command("introspect:pg").option("--out <out>", `Mi
|
|
|
49571
49655
|
journal,
|
|
49572
49656
|
_meta,
|
|
49573
49657
|
res.data.out,
|
|
49574
|
-
res.data.breakpoints
|
|
49658
|
+
res.data.breakpoints,
|
|
49659
|
+
true
|
|
49575
49660
|
);
|
|
49576
49661
|
} else {
|
|
49577
49662
|
(0, import_hanji6.render)(
|
|
@@ -49622,7 +49707,8 @@ var introspectMySqlCommand = new Command("introspect:mysql").option("--out <out>
|
|
|
49622
49707
|
journal,
|
|
49623
49708
|
_meta,
|
|
49624
49709
|
res.data.out,
|
|
49625
|
-
res.data.breakpoints
|
|
49710
|
+
res.data.breakpoints,
|
|
49711
|
+
true
|
|
49626
49712
|
);
|
|
49627
49713
|
} else {
|
|
49628
49714
|
(0, import_hanji6.render)(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drizzle-kit",
|
|
3
|
-
"version": "0.17.0-
|
|
3
|
+
"version": "0.17.0-c3c9ff0",
|
|
4
4
|
"repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
|
|
5
5
|
"author": "Drizzle Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,8 +10,9 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"migrate:old": "drizzle-kit generate:pg --out ./dev/migrations-pg --schema ./dev/migrations-pg/schema.ts",
|
|
12
12
|
"migrate:old:mysql": "drizzle-kit generate:mysql --out ./dev/migrations-mysql --schema ./dev/migrations-mysql/schema.ts",
|
|
13
|
-
"start:pg": "node -r esbuild-register ./src/cli/index.ts generate:pg --out ./dev/
|
|
14
|
-
"start:
|
|
13
|
+
"start:pg": "node -r esbuild-register ./src/cli/index.ts generate:pg --out ./dev/migrations-pg --schema ./dev/migrations-pg/schema.ts",
|
|
14
|
+
"start:sqlite": "node -r esbuild-register ./src/cli/index.ts generate:sqlite --out ./dev/migrations-sqlite --schema ./dev/migrations-sqlite/schema.ts",
|
|
15
|
+
"start:mysql": "node -r esbuild-register ./src/cli/index.ts generate:mysql --out ./dev/migrations-mysql --schema ./dev/migrations-mysql/schema.ts",
|
|
15
16
|
"check:pg": "node -r esbuild-register ./src/cli/index.ts check --out ./dev/migrations --dialect pg",
|
|
16
17
|
"introspect:mysql": "node -r esbuild-register ./src/cli/index.ts introspect:mysql --out ./dev/introspect-mysql --connectionString",
|
|
17
18
|
"introspect:pg": "node -r esbuild-register ./src/cli/index.ts introspect:pg --out ./dev/introspect-pg --connectionString=postgresql://postgres@localhost:5432/introspect",
|
package/utils.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -10358,6 +10357,13 @@ var compositePK = objectType({
|
|
|
10358
10357
|
name: stringType(),
|
|
10359
10358
|
columns: stringType().array()
|
|
10360
10359
|
}).strict();
|
|
10360
|
+
var tableV4 = objectType({
|
|
10361
|
+
name: stringType(),
|
|
10362
|
+
schema: stringType().optional(),
|
|
10363
|
+
columns: recordType(stringType(), column),
|
|
10364
|
+
indexes: recordType(stringType(), index),
|
|
10365
|
+
foreignKeys: recordType(stringType(), fk)
|
|
10366
|
+
}).strict();
|
|
10361
10367
|
var table = objectType({
|
|
10362
10368
|
name: stringType(),
|
|
10363
10369
|
schema: stringType().optional(),
|
|
@@ -10379,7 +10385,7 @@ var schemaInternalV3 = objectType({
|
|
|
10379
10385
|
var schemaInternalV4 = objectType({
|
|
10380
10386
|
version: literalType("4"),
|
|
10381
10387
|
dialect,
|
|
10382
|
-
tables: recordType(stringType(),
|
|
10388
|
+
tables: recordType(stringType(), tableV4),
|
|
10383
10389
|
schemas: recordType(stringType(), stringType())
|
|
10384
10390
|
}).strict();
|
|
10385
10391
|
var schemaInternal = objectType({
|
|
@@ -10396,6 +10402,13 @@ var schemaInternal = objectType({
|
|
|
10396
10402
|
var schemaV3 = schemaInternalV3.merge(schemaHash);
|
|
10397
10403
|
var schemaV4 = schemaInternalV4.merge(schemaHash);
|
|
10398
10404
|
var schema = schemaInternal.merge(schemaHash);
|
|
10405
|
+
var tableSquashedV4 = objectType({
|
|
10406
|
+
name: stringType(),
|
|
10407
|
+
schema: stringType().optional(),
|
|
10408
|
+
columns: recordType(stringType(), column),
|
|
10409
|
+
indexes: recordType(stringType(), stringType()),
|
|
10410
|
+
foreignKeys: recordType(stringType(), stringType())
|
|
10411
|
+
}).strict();
|
|
10399
10412
|
var tableSquashed = objectType({
|
|
10400
10413
|
name: stringType(),
|
|
10401
10414
|
schema: stringType().optional(),
|
|
@@ -10410,6 +10423,12 @@ var schemaSquashed = objectType({
|
|
|
10410
10423
|
tables: recordType(stringType(), tableSquashed),
|
|
10411
10424
|
schemas: recordType(stringType(), stringType())
|
|
10412
10425
|
}).strict();
|
|
10426
|
+
var schemaSquashedV4 = objectType({
|
|
10427
|
+
version: literalType("4"),
|
|
10428
|
+
dialect,
|
|
10429
|
+
tables: recordType(stringType(), tableSquashedV4),
|
|
10430
|
+
schemas: recordType(stringType(), stringType())
|
|
10431
|
+
}).strict();
|
|
10413
10432
|
var MySqlSquasher = {
|
|
10414
10433
|
squashIdx: (idx) => {
|
|
10415
10434
|
var _a, _b, _c;
|
|
@@ -10566,6 +10585,13 @@ var compositePK2 = objectType({
|
|
|
10566
10585
|
name: stringType(),
|
|
10567
10586
|
columns: stringType().array()
|
|
10568
10587
|
}).strict();
|
|
10588
|
+
var tableV42 = objectType({
|
|
10589
|
+
name: stringType(),
|
|
10590
|
+
schema: stringType(),
|
|
10591
|
+
columns: recordType(stringType(), column2),
|
|
10592
|
+
indexes: recordType(stringType(), index2),
|
|
10593
|
+
foreignKeys: recordType(stringType(), fk2)
|
|
10594
|
+
}).strict();
|
|
10569
10595
|
var table2 = objectType({
|
|
10570
10596
|
name: stringType(),
|
|
10571
10597
|
schema: stringType(),
|
|
@@ -10587,7 +10613,7 @@ var pgSchemaInternalV3 = objectType({
|
|
|
10587
10613
|
var pgSchemaInternalV4 = objectType({
|
|
10588
10614
|
version: literalType("4"),
|
|
10589
10615
|
dialect: literalType("pg"),
|
|
10590
|
-
tables: recordType(stringType(),
|
|
10616
|
+
tables: recordType(stringType(), tableV42),
|
|
10591
10617
|
enums: recordType(stringType(), enumSchema),
|
|
10592
10618
|
schemas: recordType(stringType(), stringType())
|
|
10593
10619
|
}).strict();
|
|
@@ -10611,6 +10637,20 @@ var tableSquashed2 = objectType({
|
|
|
10611
10637
|
foreignKeys: recordType(stringType(), stringType()),
|
|
10612
10638
|
compositePrimaryKeys: recordType(stringType(), stringType())
|
|
10613
10639
|
}).strict();
|
|
10640
|
+
var tableSquashedV42 = objectType({
|
|
10641
|
+
name: stringType(),
|
|
10642
|
+
schema: stringType(),
|
|
10643
|
+
columns: recordType(stringType(), column2),
|
|
10644
|
+
indexes: recordType(stringType(), stringType()),
|
|
10645
|
+
foreignKeys: recordType(stringType(), stringType())
|
|
10646
|
+
}).strict();
|
|
10647
|
+
var pgSchemaSquashedV4 = objectType({
|
|
10648
|
+
version: literalType("4"),
|
|
10649
|
+
dialect: enumType(["pg"]),
|
|
10650
|
+
tables: recordType(stringType(), tableSquashedV42),
|
|
10651
|
+
enums: recordType(stringType(), enumSchema),
|
|
10652
|
+
schemas: recordType(stringType(), stringType())
|
|
10653
|
+
}).strict();
|
|
10614
10654
|
var pgSchemaSquashed = objectType({
|
|
10615
10655
|
version: literalType("5"),
|
|
10616
10656
|
dialect: enumType(["pg"]),
|