drizzle-kit 0.20.6-88f61dc → 0.20.7-05d4dfb
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +680 -612
- package/package.json +2 -3
- package/serializer/pgSerializer.d.ts +2 -0
- package/serializer/sqliteSerializer.d.ts +2 -0
- package/serializer/studioUtils.d.ts +4 -4
- package/utils-studio.d.mts +2 -2
- package/utils-studio.d.ts +2 -2
- package/utils-studio.js +700 -702
- package/utils-studio.mjs +626 -628
- package/utils.js +171 -177
- package/serializer/schemaToDrizzle.d.ts +0 -7
package/utils.js
CHANGED
@@ -11709,8 +11709,8 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
11709
11709
|
}
|
11710
11710
|
for (const [key, value] of Object.entries(tableToPk)) {
|
11711
11711
|
result[key].compositePrimaryKeys = {
|
11712
|
-
[`${key}_${value.join("_")}
|
11713
|
-
name: `${key}_${value.join("_")}
|
11712
|
+
[`${key}_${value.join("_")}`]: {
|
11713
|
+
name: `${key}_${value.join("_")}`,
|
11714
11714
|
columns: value
|
11715
11715
|
}
|
11716
11716
|
};
|
@@ -11888,9 +11888,10 @@ var pgSerializer_exports = {};
|
|
11888
11888
|
__export(pgSerializer_exports, {
|
11889
11889
|
fromDatabase: () => fromDatabase2,
|
11890
11890
|
generatePgSnapshot: () => generatePgSnapshot,
|
11891
|
-
indexName: () => indexName2
|
11891
|
+
indexName: () => indexName2,
|
11892
|
+
toDrizzle: () => toDrizzle
|
11892
11893
|
});
|
11893
|
-
var import_pg_core2, import_pg_core3, import_drizzle_orm5, dialect4, indexName2, generatePgSnapshot, trimChar, fromDatabase2, columnToDefault, defaultForColumn;
|
11894
|
+
var import_pg_core2, import_pg_core3, import_drizzle_orm5, dialect4, indexName2, generatePgSnapshot, trimChar, fromDatabase2, columnToDefault, defaultForColumn, toDrizzle;
|
11894
11895
|
var init_pgSerializer = __esm({
|
11895
11896
|
"src/serializer/pgSerializer.ts"() {
|
11896
11897
|
import_pg_core2 = require("drizzle-orm/pg-core");
|
@@ -12501,6 +12502,108 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
12501
12502
|
}
|
12502
12503
|
}
|
12503
12504
|
};
|
12505
|
+
toDrizzle = (schema4, schemaName) => {
|
12506
|
+
const tables = {};
|
12507
|
+
Object.values(schema4.tables).forEach((t) => {
|
12508
|
+
const columns = {};
|
12509
|
+
Object.values(t.columns).forEach((c) => {
|
12510
|
+
const columnName = c.name;
|
12511
|
+
const type = c.type;
|
12512
|
+
let columnBuilder;
|
12513
|
+
if (type === "bigint") {
|
12514
|
+
columnBuilder = new import_pg_core2.PgBigInt53Builder(columnName);
|
12515
|
+
} else if (type === "bigserial") {
|
12516
|
+
columnBuilder = new import_pg_core2.PgBigSerial53Builder(columnName);
|
12517
|
+
} else if (type === "boolean") {
|
12518
|
+
columnBuilder = new import_pg_core2.PgBooleanBuilder(columnName);
|
12519
|
+
} else if (type === "cidr") {
|
12520
|
+
columnBuilder = new import_pg_core2.PgCidrBuilder(columnName);
|
12521
|
+
} else if (type === "date") {
|
12522
|
+
columnBuilder = new import_pg_core2.PgDateBuilder(columnName);
|
12523
|
+
} else if (type === "double precision") {
|
12524
|
+
columnBuilder = new import_pg_core2.PgDoublePrecisionBuilder(columnName);
|
12525
|
+
} else if (type === "inet") {
|
12526
|
+
columnBuilder = new import_pg_core2.PgInetBuilder(columnName);
|
12527
|
+
} else if (type === "integer") {
|
12528
|
+
columnBuilder = new import_pg_core2.PgIntegerBuilder(columnName);
|
12529
|
+
} else if (type === "interval" || type.startsWith("interval ")) {
|
12530
|
+
columnBuilder = new import_pg_core2.PgIntervalBuilder(columnName, {});
|
12531
|
+
} else if (type === "json") {
|
12532
|
+
columnBuilder = new import_pg_core2.PgJsonBuilder(columnName);
|
12533
|
+
} else if (type === "jsonb") {
|
12534
|
+
columnBuilder = new import_pg_core2.PgJsonbBuilder(columnName);
|
12535
|
+
} else if (type === "macaddr") {
|
12536
|
+
columnBuilder = new import_pg_core2.PgMacaddrBuilder(columnName);
|
12537
|
+
} else if (type === "macaddr8") {
|
12538
|
+
columnBuilder = new import_pg_core2.PgMacaddr8Builder(columnName);
|
12539
|
+
} else if (type === "numeric" || type.startsWith("numeric(")) {
|
12540
|
+
columnBuilder = new import_pg_core2.PgNumericBuilder(columnName);
|
12541
|
+
} else if (type === "real") {
|
12542
|
+
columnBuilder = new import_pg_core2.PgRealBuilder(columnName);
|
12543
|
+
} else if (type === "serial") {
|
12544
|
+
columnBuilder = new import_pg_core2.PgSerialBuilder(columnName);
|
12545
|
+
} else if (type === "smallint") {
|
12546
|
+
columnBuilder = new import_pg_core2.PgSmallIntBuilder(columnName);
|
12547
|
+
} else if (type === "smallserial") {
|
12548
|
+
columnBuilder = new import_pg_core2.PgSmallSerialBuilder(columnName);
|
12549
|
+
} else if (type === "text") {
|
12550
|
+
columnBuilder = new import_pg_core2.PgTextBuilder(columnName, {});
|
12551
|
+
} else if (type === "time" || type.startsWith("time(") || type === "time with time zone") {
|
12552
|
+
columnBuilder = new import_pg_core2.PgTimeBuilder(columnName, false, void 0);
|
12553
|
+
} else if (type === "timestamp" || type.startsWith("timestamp(") || type === "timestamp with time zone") {
|
12554
|
+
columnBuilder = new import_pg_core2.PgTimestampBuilder(columnName, false, void 0);
|
12555
|
+
} else if (type === "uuid") {
|
12556
|
+
columnBuilder = new import_pg_core2.PgUUIDBuilder(columnName);
|
12557
|
+
} else if (type === "varchar" || type.startsWith("varchar(")) {
|
12558
|
+
columnBuilder = new import_pg_core2.PgVarcharBuilder(columnName, {});
|
12559
|
+
} else if (type === "char" || type.startsWith("char(")) {
|
12560
|
+
columnBuilder = new import_pg_core2.PgCharBuilder(columnName, {});
|
12561
|
+
} else {
|
12562
|
+
columnBuilder = (0, import_pg_core2.customType)({
|
12563
|
+
dataType() {
|
12564
|
+
return type;
|
12565
|
+
}
|
12566
|
+
})(columnName);
|
12567
|
+
}
|
12568
|
+
if (c.notNull) {
|
12569
|
+
columnBuilder = columnBuilder.notNull();
|
12570
|
+
}
|
12571
|
+
if (c.default) {
|
12572
|
+
columnBuilder = columnBuilder.default(c.default);
|
12573
|
+
}
|
12574
|
+
if (c.primaryKey) {
|
12575
|
+
columnBuilder = columnBuilder.primaryKey();
|
12576
|
+
}
|
12577
|
+
columns[columnName] = columnBuilder;
|
12578
|
+
});
|
12579
|
+
if (schemaName === "public") {
|
12580
|
+
tables[t.name] = (0, import_pg_core2.pgTable)(t.name, columns, (cb) => {
|
12581
|
+
const res = {};
|
12582
|
+
Object.values(t.compositePrimaryKeys).forEach((cpk) => {
|
12583
|
+
const gh = cpk.columns.map((c) => cb[c]);
|
12584
|
+
res[cpk.name] = new import_pg_core2.PrimaryKeyBuilder(
|
12585
|
+
gh,
|
12586
|
+
cpk.name
|
12587
|
+
);
|
12588
|
+
});
|
12589
|
+
return res;
|
12590
|
+
});
|
12591
|
+
} else {
|
12592
|
+
tables[t.name] = (0, import_pg_core2.pgSchema)(schemaName).table(t.name, columns, (cb) => {
|
12593
|
+
const res = {};
|
12594
|
+
Object.values(t.compositePrimaryKeys).forEach((cpk) => {
|
12595
|
+
const gh = cpk.columns.map((c) => cb[c]);
|
12596
|
+
res[cpk.name] = new import_pg_core2.PrimaryKeyBuilder(
|
12597
|
+
gh,
|
12598
|
+
cpk.name
|
12599
|
+
);
|
12600
|
+
});
|
12601
|
+
return res;
|
12602
|
+
});
|
12603
|
+
}
|
12604
|
+
});
|
12605
|
+
return tables;
|
12606
|
+
};
|
12504
12607
|
}
|
12505
12608
|
});
|
12506
12609
|
|
@@ -12539,7 +12642,8 @@ var init_sqliteImports = __esm({
|
|
12539
12642
|
var sqliteSerializer_exports = {};
|
12540
12643
|
__export(sqliteSerializer_exports, {
|
12541
12644
|
fromDatabase: () => fromDatabase3,
|
12542
|
-
generateSqliteSnapshot: () => generateSqliteSnapshot
|
12645
|
+
generateSqliteSnapshot: () => generateSqliteSnapshot,
|
12646
|
+
toDrizzle: () => toDrizzle2
|
12543
12647
|
});
|
12544
12648
|
function mapSqlToSqliteType(sqlType) {
|
12545
12649
|
if ([
|
@@ -12576,7 +12680,7 @@ function mapSqlToSqliteType(sqlType) {
|
|
12576
12680
|
return "numeric";
|
12577
12681
|
}
|
12578
12682
|
}
|
12579
|
-
var import_drizzle_orm7, import_sqlite_core2, dialect5, generateSqliteSnapshot, fromDatabase3;
|
12683
|
+
var import_drizzle_orm7, import_sqlite_core2, dialect5, generateSqliteSnapshot, fromDatabase3, toDrizzle2;
|
12580
12684
|
var init_sqliteSerializer = __esm({
|
12581
12685
|
"src/serializer/sqliteSerializer.ts"() {
|
12582
12686
|
import_drizzle_orm7 = require("drizzle-orm");
|
@@ -12944,6 +13048,50 @@ WHERE
|
|
12944
13048
|
}
|
12945
13049
|
};
|
12946
13050
|
};
|
13051
|
+
toDrizzle2 = (schema4) => {
|
13052
|
+
const tables = {};
|
13053
|
+
Object.values(schema4.tables).forEach((t) => {
|
13054
|
+
const columns = {};
|
13055
|
+
Object.values(t.columns).forEach((c) => {
|
13056
|
+
const columnName = c.name;
|
13057
|
+
const type = c.type;
|
13058
|
+
let columnBuilder;
|
13059
|
+
if (type === "integer") {
|
13060
|
+
columnBuilder = new import_sqlite_core2.SQLiteIntegerBuilder(columnName);
|
13061
|
+
} else if (type === "text") {
|
13062
|
+
columnBuilder = new import_sqlite_core2.SQLiteTextBuilder(columnName, {});
|
13063
|
+
} else if (type === "blob") {
|
13064
|
+
columnBuilder = new import_sqlite_core2.SQLiteBlobBufferBuilder(columnName);
|
13065
|
+
} else if (type === "real") {
|
13066
|
+
columnBuilder = new import_sqlite_core2.SQLiteRealBuilder(columnName);
|
13067
|
+
} else {
|
13068
|
+
columnBuilder = new import_sqlite_core2.SQLiteNumericBuilder(columnName);
|
13069
|
+
}
|
13070
|
+
if (c.notNull) {
|
13071
|
+
columnBuilder = columnBuilder.notNull();
|
13072
|
+
}
|
13073
|
+
if (c.default) {
|
13074
|
+
columnBuilder = columnBuilder.default(c.default);
|
13075
|
+
}
|
13076
|
+
if (c.primaryKey) {
|
13077
|
+
columnBuilder = columnBuilder.primaryKey();
|
13078
|
+
}
|
13079
|
+
columns[columnName] = columnBuilder;
|
13080
|
+
});
|
13081
|
+
tables[t.name] = (0, import_sqlite_core2.sqliteTable)(t.name, columns, (cb) => {
|
13082
|
+
const res = {};
|
13083
|
+
Object.values(t.compositePrimaryKeys).forEach((cpk) => {
|
13084
|
+
const gh = cpk.columns.map((c) => cb[c]);
|
13085
|
+
res[cpk.name] = new import_sqlite_core2.PrimaryKeyBuilder(
|
13086
|
+
gh,
|
13087
|
+
cpk.name
|
13088
|
+
);
|
13089
|
+
});
|
13090
|
+
return res;
|
13091
|
+
});
|
13092
|
+
});
|
13093
|
+
return tables;
|
13094
|
+
};
|
12947
13095
|
}
|
12948
13096
|
});
|
12949
13097
|
|
@@ -17420,13 +17568,14 @@ var init_snapshotsDiffer = __esm({
|
|
17420
17568
|
jsonStatements.push(...jsonDropTables);
|
17421
17569
|
jsonStatements.push(...jsonRenameTables);
|
17422
17570
|
jsonStatements.push(...jsonRenameColumnsStatements);
|
17423
|
-
jsonStatements.push(...jsonDeletedCompositePKs);
|
17424
17571
|
if (dialect6 !== "mysql") {
|
17425
17572
|
jsonStatements.push(...jsonDeletedUniqueConstraints);
|
17426
17573
|
}
|
17427
17574
|
jsonStatements.push(...jsonDroppedReferencesForAlteredTables);
|
17428
17575
|
jsonStatements.push(...jsonDropIndexesForAllAlteredTables);
|
17576
|
+
jsonStatements.push(...jsonAddedCompositePKs);
|
17429
17577
|
jsonStatements.push(...jsonTableAlternations.alterColumns);
|
17578
|
+
jsonStatements.push(...jsonDeletedCompositePKs);
|
17430
17579
|
if (dialect6 === "mysql") {
|
17431
17580
|
jsonStatements.push(...jsonAddedUniqueConstraints);
|
17432
17581
|
jsonStatements.push(...jsonDeletedUniqueConstraints);
|
@@ -17438,7 +17587,6 @@ var init_snapshotsDiffer = __esm({
|
|
17438
17587
|
jsonStatements.push(...jsonTableAlternations.dropColumns);
|
17439
17588
|
if (dialect6 !== "sqlite")
|
17440
17589
|
jsonStatements.push(...jsonCreateReferences);
|
17441
|
-
jsonStatements.push(...jsonAddedCompositePKs);
|
17442
17590
|
jsonStatements.push(...jsonAlteredCompositePKs);
|
17443
17591
|
if (dialect6 !== "mysql") {
|
17444
17592
|
jsonStatements.push(...jsonAddedUniqueConstraints);
|
@@ -24710,161 +24858,6 @@ var init_sqliteIntrospect = __esm({
|
|
24710
24858
|
}
|
24711
24859
|
});
|
24712
24860
|
|
24713
|
-
// src/serializer/schemaToDrizzle.ts
|
24714
|
-
var import_pg_core4, import_sqlite_core3, pgSchemaToDrizzle, sqliteSchemaToDrizzle;
|
24715
|
-
var init_schemaToDrizzle = __esm({
|
24716
|
-
"src/serializer/schemaToDrizzle.ts"() {
|
24717
|
-
import_pg_core4 = require("drizzle-orm/pg-core");
|
24718
|
-
import_sqlite_core3 = require("drizzle-orm/sqlite-core");
|
24719
|
-
pgSchemaToDrizzle = (schema4, schemaName) => {
|
24720
|
-
const tables = {};
|
24721
|
-
Object.values(schema4.tables).forEach((t) => {
|
24722
|
-
const columns = {};
|
24723
|
-
Object.values(t.columns).forEach((c) => {
|
24724
|
-
const columnName = c.name;
|
24725
|
-
const type = c.type;
|
24726
|
-
let columnBuilder;
|
24727
|
-
if (type === "bigint") {
|
24728
|
-
columnBuilder = new import_pg_core4.PgBigInt53Builder(columnName);
|
24729
|
-
} else if (type === "bigserial") {
|
24730
|
-
columnBuilder = new import_pg_core4.PgBigSerial53Builder(columnName);
|
24731
|
-
} else if (type === "boolean") {
|
24732
|
-
columnBuilder = new import_pg_core4.PgBooleanBuilder(columnName);
|
24733
|
-
} else if (type === "cidr") {
|
24734
|
-
columnBuilder = new import_pg_core4.PgCidrBuilder(columnName);
|
24735
|
-
} else if (type === "date") {
|
24736
|
-
columnBuilder = new import_pg_core4.PgDateBuilder(columnName);
|
24737
|
-
} else if (type === "double precision") {
|
24738
|
-
columnBuilder = new import_pg_core4.PgDoublePrecisionBuilder(columnName);
|
24739
|
-
} else if (type === "inet") {
|
24740
|
-
columnBuilder = new import_pg_core4.PgInetBuilder(columnName);
|
24741
|
-
} else if (type === "integer") {
|
24742
|
-
columnBuilder = new import_pg_core4.PgIntegerBuilder(columnName);
|
24743
|
-
} else if (type === "interval" || type.startsWith("interval ")) {
|
24744
|
-
columnBuilder = new import_pg_core4.PgIntervalBuilder(columnName, {});
|
24745
|
-
} else if (type === "json") {
|
24746
|
-
columnBuilder = new import_pg_core4.PgJsonBuilder(columnName);
|
24747
|
-
} else if (type === "jsonb") {
|
24748
|
-
columnBuilder = new import_pg_core4.PgJsonbBuilder(columnName);
|
24749
|
-
} else if (type === "macaddr") {
|
24750
|
-
columnBuilder = new import_pg_core4.PgMacaddrBuilder(columnName);
|
24751
|
-
} else if (type === "macaddr8") {
|
24752
|
-
columnBuilder = new import_pg_core4.PgMacaddr8Builder(columnName);
|
24753
|
-
} else if (type === "numeric" || type.startsWith("numeric(")) {
|
24754
|
-
columnBuilder = new import_pg_core4.PgNumericBuilder(columnName);
|
24755
|
-
} else if (type === "real") {
|
24756
|
-
columnBuilder = new import_pg_core4.PgRealBuilder(columnName);
|
24757
|
-
} else if (type === "serial") {
|
24758
|
-
columnBuilder = new import_pg_core4.PgSerialBuilder(columnName);
|
24759
|
-
} else if (type === "smallint") {
|
24760
|
-
columnBuilder = new import_pg_core4.PgSmallIntBuilder(columnName);
|
24761
|
-
} else if (type === "smallserial") {
|
24762
|
-
columnBuilder = new import_pg_core4.PgSmallSerialBuilder(columnName);
|
24763
|
-
} else if (type === "text") {
|
24764
|
-
columnBuilder = new import_pg_core4.PgTextBuilder(columnName, {});
|
24765
|
-
} else if (type === "time" || type.startsWith("time(") || type === "time with time zone") {
|
24766
|
-
columnBuilder = new import_pg_core4.PgTimeBuilder(columnName, false, void 0);
|
24767
|
-
} else if (type === "timestamp" || type.startsWith("timestamp(") || type === "timestamp with time zone") {
|
24768
|
-
columnBuilder = new import_pg_core4.PgTimestampBuilder(columnName, false, void 0);
|
24769
|
-
} else if (type === "uuid") {
|
24770
|
-
columnBuilder = new import_pg_core4.PgUUIDBuilder(columnName);
|
24771
|
-
} else if (type === "varchar" || type.startsWith("varchar(")) {
|
24772
|
-
columnBuilder = new import_pg_core4.PgVarcharBuilder(columnName, {});
|
24773
|
-
} else if (type === "char" || type.startsWith("char(")) {
|
24774
|
-
columnBuilder = new import_pg_core4.PgCharBuilder(columnName, {});
|
24775
|
-
} else {
|
24776
|
-
columnBuilder = (0, import_pg_core4.customType)({
|
24777
|
-
dataType() {
|
24778
|
-
return type;
|
24779
|
-
}
|
24780
|
-
})(columnName);
|
24781
|
-
}
|
24782
|
-
if (c.notNull) {
|
24783
|
-
columnBuilder = columnBuilder.notNull();
|
24784
|
-
}
|
24785
|
-
if (c.default) {
|
24786
|
-
columnBuilder = columnBuilder.default(c.default);
|
24787
|
-
}
|
24788
|
-
if (c.primaryKey) {
|
24789
|
-
columnBuilder = columnBuilder.primaryKey();
|
24790
|
-
}
|
24791
|
-
columns[columnName] = columnBuilder;
|
24792
|
-
});
|
24793
|
-
if (schemaName === "public") {
|
24794
|
-
tables[t.name] = (0, import_pg_core4.pgTable)(t.name, columns, (cb) => {
|
24795
|
-
const res = {};
|
24796
|
-
Object.values(t.compositePrimaryKeys).forEach((cpk) => {
|
24797
|
-
const gh = cpk.columns.map((c) => cb[c]);
|
24798
|
-
res[cpk.name] = new import_pg_core4.PrimaryKeyBuilder(
|
24799
|
-
gh,
|
24800
|
-
cpk.name
|
24801
|
-
);
|
24802
|
-
});
|
24803
|
-
return res;
|
24804
|
-
});
|
24805
|
-
} else {
|
24806
|
-
tables[t.name] = (0, import_pg_core4.pgSchema)(schemaName).table(t.name, columns, (cb) => {
|
24807
|
-
const res = {};
|
24808
|
-
Object.values(t.compositePrimaryKeys).forEach((cpk) => {
|
24809
|
-
const gh = cpk.columns.map((c) => cb[c]);
|
24810
|
-
res[cpk.name] = new import_pg_core4.PrimaryKeyBuilder(
|
24811
|
-
gh,
|
24812
|
-
cpk.name
|
24813
|
-
);
|
24814
|
-
});
|
24815
|
-
return res;
|
24816
|
-
});
|
24817
|
-
}
|
24818
|
-
});
|
24819
|
-
return tables;
|
24820
|
-
};
|
24821
|
-
sqliteSchemaToDrizzle = (schema4) => {
|
24822
|
-
const tables = {};
|
24823
|
-
Object.values(schema4.tables).forEach((t) => {
|
24824
|
-
const columns = {};
|
24825
|
-
Object.values(t.columns).forEach((c) => {
|
24826
|
-
const columnName = c.name;
|
24827
|
-
const type = c.type;
|
24828
|
-
let columnBuilder;
|
24829
|
-
if (type === "integer") {
|
24830
|
-
columnBuilder = new import_sqlite_core3.SQLiteIntegerBuilder(columnName);
|
24831
|
-
} else if (type === "text") {
|
24832
|
-
columnBuilder = new import_sqlite_core3.SQLiteTextBuilder(columnName, {});
|
24833
|
-
} else if (type === "blob") {
|
24834
|
-
columnBuilder = new import_sqlite_core3.SQLiteBlobBufferBuilder(columnName);
|
24835
|
-
} else if (type === "real") {
|
24836
|
-
columnBuilder = new import_sqlite_core3.SQLiteRealBuilder(columnName);
|
24837
|
-
} else {
|
24838
|
-
columnBuilder = new import_sqlite_core3.SQLiteNumericBuilder(columnName);
|
24839
|
-
}
|
24840
|
-
if (c.notNull) {
|
24841
|
-
columnBuilder = columnBuilder.notNull();
|
24842
|
-
}
|
24843
|
-
if (c.default) {
|
24844
|
-
columnBuilder = columnBuilder.default(c.default);
|
24845
|
-
}
|
24846
|
-
if (c.primaryKey) {
|
24847
|
-
columnBuilder = columnBuilder.primaryKey();
|
24848
|
-
}
|
24849
|
-
columns[columnName] = columnBuilder;
|
24850
|
-
});
|
24851
|
-
tables[t.name] = (0, import_sqlite_core3.sqliteTable)(t.name, columns, (cb) => {
|
24852
|
-
const res = {};
|
24853
|
-
Object.values(t.compositePrimaryKeys).forEach((cpk) => {
|
24854
|
-
const gh = cpk.columns.map((c) => cb[c]);
|
24855
|
-
res[cpk.name] = new import_sqlite_core3.PrimaryKeyBuilder(
|
24856
|
-
gh,
|
24857
|
-
cpk.name
|
24858
|
-
);
|
24859
|
-
});
|
24860
|
-
return res;
|
24861
|
-
});
|
24862
|
-
});
|
24863
|
-
return tables;
|
24864
|
-
};
|
24865
|
-
}
|
24866
|
-
});
|
24867
|
-
|
24868
24861
|
// node_modules/.pnpm/semver@7.5.4/node_modules/semver/internal/constants.js
|
24869
24862
|
var require_constants = __commonJS({
|
24870
24863
|
"node_modules/.pnpm/semver@7.5.4/node_modules/semver/internal/constants.js"(exports, module2) {
|
@@ -43208,15 +43201,15 @@ var require_promise = __commonJS({
|
|
43208
43201
|
});
|
43209
43202
|
|
43210
43203
|
// src/orm-extenstions/d1-driver/session.ts
|
43211
|
-
var import_drizzle_orm10, import_drizzle_orm11, import_drizzle_orm12,
|
43204
|
+
var import_drizzle_orm10, import_drizzle_orm11, import_drizzle_orm12, import_sqlite_core3, import_drizzle_orm13, _a, SQLiteWranglerD1Session, _a2, PreparedQuery;
|
43212
43205
|
var init_session = __esm({
|
43213
43206
|
"src/orm-extenstions/d1-driver/session.ts"() {
|
43214
43207
|
import_drizzle_orm10 = require("drizzle-orm");
|
43215
43208
|
import_drizzle_orm11 = require("drizzle-orm");
|
43216
43209
|
import_drizzle_orm12 = require("drizzle-orm");
|
43217
|
-
|
43210
|
+
import_sqlite_core3 = require("drizzle-orm/sqlite-core");
|
43218
43211
|
import_drizzle_orm13 = require("drizzle-orm");
|
43219
|
-
SQLiteWranglerD1Session = class extends
|
43212
|
+
SQLiteWranglerD1Session = class extends import_sqlite_core3.SQLiteSession {
|
43220
43213
|
constructor(client, configPath, dbName, dialect6, schema4, options = {}) {
|
43221
43214
|
super(dialect6);
|
43222
43215
|
this.client = client;
|
@@ -43245,7 +43238,7 @@ var init_session = __esm({
|
|
43245
43238
|
};
|
43246
43239
|
_a = import_drizzle_orm10.entityKind;
|
43247
43240
|
SQLiteWranglerD1Session[_a] = "SQLiteD1Session";
|
43248
|
-
PreparedQuery = class extends
|
43241
|
+
PreparedQuery = class extends import_sqlite_core3.SQLitePreparedQuery {
|
43249
43242
|
constructor(stmt, configPath, dbName, queryString, params, logger, fields, executeMethod, customResultMapper) {
|
43250
43243
|
super("async", executeMethod, {
|
43251
43244
|
sql: queryString,
|
@@ -43370,20 +43363,20 @@ function drizzle(client, configPath, dbName, config = {}) {
|
|
43370
43363
|
const session = new SQLiteWranglerD1Session(client, configPath, dbName, dialect6, schema4, {
|
43371
43364
|
logger
|
43372
43365
|
});
|
43373
|
-
return new
|
43366
|
+
return new import_sqlite_core4.BaseSQLiteDatabase(
|
43374
43367
|
"async",
|
43375
43368
|
dialect6,
|
43376
43369
|
session,
|
43377
43370
|
schema4
|
43378
43371
|
);
|
43379
43372
|
}
|
43380
|
-
var import_drizzle_orm14,
|
43373
|
+
var import_drizzle_orm14, import_sqlite_core4, WranglerDialect;
|
43381
43374
|
var init_driver = __esm({
|
43382
43375
|
"src/orm-extenstions/d1-driver/driver.ts"() {
|
43383
43376
|
import_drizzle_orm14 = require("drizzle-orm");
|
43384
|
-
|
43377
|
+
import_sqlite_core4 = require("drizzle-orm/sqlite-core");
|
43385
43378
|
init_session();
|
43386
|
-
WranglerDialect = class extends
|
43379
|
+
WranglerDialect = class extends import_sqlite_core4.SQLiteAsyncDialect {
|
43387
43380
|
sqlToQuery(sql2) {
|
43388
43381
|
return sql2.toQuery({
|
43389
43382
|
escapeName: this.escapeName,
|
@@ -58699,13 +58692,13 @@ var init_wrangler_client = __esm({
|
|
58699
58692
|
});
|
58700
58693
|
|
58701
58694
|
// src/serializer/studioUtils.ts
|
58702
|
-
var import_drizzle_orm15, import_mysql_core4,
|
58695
|
+
var import_drizzle_orm15, import_mysql_core4, import_pg_core4, import_sqlite_core5, drizzleDb;
|
58703
58696
|
var init_studioUtils = __esm({
|
58704
58697
|
"src/serializer/studioUtils.ts"() {
|
58705
58698
|
import_drizzle_orm15 = require("drizzle-orm");
|
58706
58699
|
import_mysql_core4 = require("drizzle-orm/mysql-core");
|
58707
|
-
|
58708
|
-
|
58700
|
+
import_pg_core4 = require("drizzle-orm/pg-core");
|
58701
|
+
import_sqlite_core5 = require("drizzle-orm/sqlite-core");
|
58709
58702
|
init_utils();
|
58710
58703
|
init_utils3();
|
58711
58704
|
init_global();
|
@@ -58814,7 +58807,8 @@ var init_utils5 = __esm({
|
|
58814
58807
|
init_pgIntrospect();
|
58815
58808
|
init_pgPushUtils();
|
58816
58809
|
init_sqliteIntrospect();
|
58817
|
-
|
58810
|
+
init_sqliteSerializer();
|
58811
|
+
init_pgSerializer();
|
58818
58812
|
init_studioUtils();
|
58819
58813
|
init_pgConnect();
|
58820
58814
|
assertV1OutFolder = (out, dialect6) => {
|
@@ -59133,7 +59127,7 @@ var init_utils5 = __esm({
|
|
59133
59127
|
preparedConnection.client,
|
59134
59128
|
[]
|
59135
59129
|
);
|
59136
|
-
const models =
|
59130
|
+
const models = toDrizzle2(schema4);
|
59137
59131
|
const drizzleDbInstance = await drizzleDb(
|
59138
59132
|
connection,
|
59139
59133
|
{ sqliteSchema: models },
|
@@ -59158,7 +59152,7 @@ var init_utils5 = __esm({
|
|
59158
59152
|
[],
|
59159
59153
|
[schemaName]
|
59160
59154
|
);
|
59161
|
-
const models =
|
59155
|
+
const models = toDrizzle(schema4, schemaName);
|
59162
59156
|
response[schemaName] = await drizzleDb(
|
59163
59157
|
// @ts-ignore I don't know how to fix it yet. But will find a way
|
59164
59158
|
connection,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import { Relations } from "drizzle-orm";
|
2
|
-
import { AnyPgTable } from "drizzle-orm/pg-core";
|
3
|
-
import { AnySQLiteTable } from "drizzle-orm/sqlite-core";
|
4
|
-
import type { PgSchemaInternal } from "./pgSchema";
|
5
|
-
import type { SQLiteSchemaInternal } from "./sqliteSchema";
|
6
|
-
export declare const pgSchemaToDrizzle: (schema: PgSchemaInternal, schemaName: string) => Record<string, AnyPgTable | Relations>;
|
7
|
-
export declare const sqliteSchemaToDrizzle: (schema: SQLiteSchemaInternal) => Record<string, AnySQLiteTable | Relations>;
|