drizzle-kit 0.20.6-88f61dc → 0.20.7-02055e2

Sign up to get free protection for your applications and to get access to all the features.
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("_")}_pk`]: {
11713
- name: `${key}_${value.join("_")}_pk`,
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");
@@ -11905,6 +11906,7 @@ var init_pgSerializer = __esm({
11905
11906
  };
11906
11907
  generatePgSnapshot = (tables, enums, schemas, schemaFilter) => {
11907
11908
  const result = {};
11909
+ const indexesInSchema = {};
11908
11910
  for (const table4 of tables) {
11909
11911
  const {
11910
11912
  name: tableName,
@@ -12056,6 +12058,24 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
12056
12058
  return it.name;
12057
12059
  }
12058
12060
  });
12061
+ if (typeof indexesInSchema[schema4 ?? "public"] !== "undefined") {
12062
+ if (indexesInSchema[schema4 ?? "public"].includes(name)) {
12063
+ console.log(
12064
+ `
12065
+ ${withStyle.errorWarning(
12066
+ `We've found duplicated index name across ${source_default.underline.blue(
12067
+ schema4 ?? "public"
12068
+ )} schema. Please rename your index in either the ${source_default.underline.blue(
12069
+ tableName
12070
+ )} table or the table with the duplicated index name`
12071
+ )}`
12072
+ );
12073
+ process.exit(1);
12074
+ }
12075
+ indexesInSchema[schema4 ?? "public"].push(name);
12076
+ } else {
12077
+ indexesInSchema[schema4 ?? "public"] = [name];
12078
+ }
12059
12079
  indexesObject[name] = {
12060
12080
  name,
12061
12081
  columns: indexColumns,
@@ -12501,6 +12521,108 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
12501
12521
  }
12502
12522
  }
12503
12523
  };
12524
+ toDrizzle = (schema4, schemaName) => {
12525
+ const tables = {};
12526
+ Object.values(schema4.tables).forEach((t) => {
12527
+ const columns = {};
12528
+ Object.values(t.columns).forEach((c) => {
12529
+ const columnName = c.name;
12530
+ const type = c.type;
12531
+ let columnBuilder;
12532
+ if (type === "bigint") {
12533
+ columnBuilder = new import_pg_core2.PgBigInt53Builder(columnName);
12534
+ } else if (type === "bigserial") {
12535
+ columnBuilder = new import_pg_core2.PgBigSerial53Builder(columnName);
12536
+ } else if (type === "boolean") {
12537
+ columnBuilder = new import_pg_core2.PgBooleanBuilder(columnName);
12538
+ } else if (type === "cidr") {
12539
+ columnBuilder = new import_pg_core2.PgCidrBuilder(columnName);
12540
+ } else if (type === "date") {
12541
+ columnBuilder = new import_pg_core2.PgDateBuilder(columnName);
12542
+ } else if (type === "double precision") {
12543
+ columnBuilder = new import_pg_core2.PgDoublePrecisionBuilder(columnName);
12544
+ } else if (type === "inet") {
12545
+ columnBuilder = new import_pg_core2.PgInetBuilder(columnName);
12546
+ } else if (type === "integer") {
12547
+ columnBuilder = new import_pg_core2.PgIntegerBuilder(columnName);
12548
+ } else if (type === "interval" || type.startsWith("interval ")) {
12549
+ columnBuilder = new import_pg_core2.PgIntervalBuilder(columnName, {});
12550
+ } else if (type === "json") {
12551
+ columnBuilder = new import_pg_core2.PgJsonBuilder(columnName);
12552
+ } else if (type === "jsonb") {
12553
+ columnBuilder = new import_pg_core2.PgJsonbBuilder(columnName);
12554
+ } else if (type === "macaddr") {
12555
+ columnBuilder = new import_pg_core2.PgMacaddrBuilder(columnName);
12556
+ } else if (type === "macaddr8") {
12557
+ columnBuilder = new import_pg_core2.PgMacaddr8Builder(columnName);
12558
+ } else if (type === "numeric" || type.startsWith("numeric(")) {
12559
+ columnBuilder = new import_pg_core2.PgNumericBuilder(columnName);
12560
+ } else if (type === "real") {
12561
+ columnBuilder = new import_pg_core2.PgRealBuilder(columnName);
12562
+ } else if (type === "serial") {
12563
+ columnBuilder = new import_pg_core2.PgSerialBuilder(columnName);
12564
+ } else if (type === "smallint") {
12565
+ columnBuilder = new import_pg_core2.PgSmallIntBuilder(columnName);
12566
+ } else if (type === "smallserial") {
12567
+ columnBuilder = new import_pg_core2.PgSmallSerialBuilder(columnName);
12568
+ } else if (type === "text") {
12569
+ columnBuilder = new import_pg_core2.PgTextBuilder(columnName, {});
12570
+ } else if (type === "time" || type.startsWith("time(") || type === "time with time zone") {
12571
+ columnBuilder = new import_pg_core2.PgTimeBuilder(columnName, false, void 0);
12572
+ } else if (type === "timestamp" || type.startsWith("timestamp(") || type === "timestamp with time zone") {
12573
+ columnBuilder = new import_pg_core2.PgTimestampBuilder(columnName, false, void 0);
12574
+ } else if (type === "uuid") {
12575
+ columnBuilder = new import_pg_core2.PgUUIDBuilder(columnName);
12576
+ } else if (type === "varchar" || type.startsWith("varchar(")) {
12577
+ columnBuilder = new import_pg_core2.PgVarcharBuilder(columnName, {});
12578
+ } else if (type === "char" || type.startsWith("char(")) {
12579
+ columnBuilder = new import_pg_core2.PgCharBuilder(columnName, {});
12580
+ } else {
12581
+ columnBuilder = (0, import_pg_core2.customType)({
12582
+ dataType() {
12583
+ return type;
12584
+ }
12585
+ })(columnName);
12586
+ }
12587
+ if (c.notNull) {
12588
+ columnBuilder = columnBuilder.notNull();
12589
+ }
12590
+ if (c.default) {
12591
+ columnBuilder = columnBuilder.default(c.default);
12592
+ }
12593
+ if (c.primaryKey) {
12594
+ columnBuilder = columnBuilder.primaryKey();
12595
+ }
12596
+ columns[columnName] = columnBuilder;
12597
+ });
12598
+ if (schemaName === "public") {
12599
+ tables[t.name] = (0, import_pg_core2.pgTable)(t.name, columns, (cb) => {
12600
+ const res = {};
12601
+ Object.values(t.compositePrimaryKeys).forEach((cpk) => {
12602
+ const gh = cpk.columns.map((c) => cb[c]);
12603
+ res[cpk.name] = new import_pg_core2.PrimaryKeyBuilder(
12604
+ gh,
12605
+ cpk.name
12606
+ );
12607
+ });
12608
+ return res;
12609
+ });
12610
+ } else {
12611
+ tables[t.name] = (0, import_pg_core2.pgSchema)(schemaName).table(t.name, columns, (cb) => {
12612
+ const res = {};
12613
+ Object.values(t.compositePrimaryKeys).forEach((cpk) => {
12614
+ const gh = cpk.columns.map((c) => cb[c]);
12615
+ res[cpk.name] = new import_pg_core2.PrimaryKeyBuilder(
12616
+ gh,
12617
+ cpk.name
12618
+ );
12619
+ });
12620
+ return res;
12621
+ });
12622
+ }
12623
+ });
12624
+ return tables;
12625
+ };
12504
12626
  }
12505
12627
  });
12506
12628
 
@@ -12539,7 +12661,8 @@ var init_sqliteImports = __esm({
12539
12661
  var sqliteSerializer_exports = {};
12540
12662
  __export(sqliteSerializer_exports, {
12541
12663
  fromDatabase: () => fromDatabase3,
12542
- generateSqliteSnapshot: () => generateSqliteSnapshot
12664
+ generateSqliteSnapshot: () => generateSqliteSnapshot,
12665
+ toDrizzle: () => toDrizzle2
12543
12666
  });
12544
12667
  function mapSqlToSqliteType(sqlType) {
12545
12668
  if ([
@@ -12576,7 +12699,7 @@ function mapSqlToSqliteType(sqlType) {
12576
12699
  return "numeric";
12577
12700
  }
12578
12701
  }
12579
- var import_drizzle_orm7, import_sqlite_core2, dialect5, generateSqliteSnapshot, fromDatabase3;
12702
+ var import_drizzle_orm7, import_sqlite_core2, dialect5, generateSqliteSnapshot, fromDatabase3, toDrizzle2;
12580
12703
  var init_sqliteSerializer = __esm({
12581
12704
  "src/serializer/sqliteSerializer.ts"() {
12582
12705
  import_drizzle_orm7 = require("drizzle-orm");
@@ -12944,6 +13067,50 @@ WHERE
12944
13067
  }
12945
13068
  };
12946
13069
  };
13070
+ toDrizzle2 = (schema4) => {
13071
+ const tables = {};
13072
+ Object.values(schema4.tables).forEach((t) => {
13073
+ const columns = {};
13074
+ Object.values(t.columns).forEach((c) => {
13075
+ const columnName = c.name;
13076
+ const type = c.type;
13077
+ let columnBuilder;
13078
+ if (type === "integer") {
13079
+ columnBuilder = new import_sqlite_core2.SQLiteIntegerBuilder(columnName);
13080
+ } else if (type === "text") {
13081
+ columnBuilder = new import_sqlite_core2.SQLiteTextBuilder(columnName, {});
13082
+ } else if (type === "blob") {
13083
+ columnBuilder = new import_sqlite_core2.SQLiteBlobBufferBuilder(columnName);
13084
+ } else if (type === "real") {
13085
+ columnBuilder = new import_sqlite_core2.SQLiteRealBuilder(columnName);
13086
+ } else {
13087
+ columnBuilder = new import_sqlite_core2.SQLiteNumericBuilder(columnName);
13088
+ }
13089
+ if (c.notNull) {
13090
+ columnBuilder = columnBuilder.notNull();
13091
+ }
13092
+ if (c.default) {
13093
+ columnBuilder = columnBuilder.default(c.default);
13094
+ }
13095
+ if (c.primaryKey) {
13096
+ columnBuilder = columnBuilder.primaryKey();
13097
+ }
13098
+ columns[columnName] = columnBuilder;
13099
+ });
13100
+ tables[t.name] = (0, import_sqlite_core2.sqliteTable)(t.name, columns, (cb) => {
13101
+ const res = {};
13102
+ Object.values(t.compositePrimaryKeys).forEach((cpk) => {
13103
+ const gh = cpk.columns.map((c) => cb[c]);
13104
+ res[cpk.name] = new import_sqlite_core2.PrimaryKeyBuilder(
13105
+ gh,
13106
+ cpk.name
13107
+ );
13108
+ });
13109
+ return res;
13110
+ });
13111
+ });
13112
+ return tables;
13113
+ };
12947
13114
  }
12948
13115
  });
12949
13116
 
@@ -15028,7 +15195,7 @@ var init_sqlgenerator = __esm({
15028
15195
  if (typeof compositePKs !== "undefined" && compositePKs.length > 0) {
15029
15196
  statement += ",\n";
15030
15197
  const compositePK4 = PgSquasher.unsquashPK(compositePKs[0]);
15031
- statement += ` CONSTRAINT ${st.compositePkName} PRIMARY KEY("${compositePK4.columns.join(`","`)}")`;
15198
+ statement += ` CONSTRAINT "${st.compositePkName}" PRIMARY KEY("${compositePK4.columns.join(`","`)}")`;
15032
15199
  }
15033
15200
  if (typeof uniqueConstraints !== "undefined" && uniqueConstraints.length > 0) {
15034
15201
  for (const uniqueConstraint4 of uniqueConstraints) {
@@ -17420,13 +17587,14 @@ var init_snapshotsDiffer = __esm({
17420
17587
  jsonStatements.push(...jsonDropTables);
17421
17588
  jsonStatements.push(...jsonRenameTables);
17422
17589
  jsonStatements.push(...jsonRenameColumnsStatements);
17423
- jsonStatements.push(...jsonDeletedCompositePKs);
17424
17590
  if (dialect6 !== "mysql") {
17425
17591
  jsonStatements.push(...jsonDeletedUniqueConstraints);
17426
17592
  }
17427
17593
  jsonStatements.push(...jsonDroppedReferencesForAlteredTables);
17428
17594
  jsonStatements.push(...jsonDropIndexesForAllAlteredTables);
17595
+ jsonStatements.push(...jsonDeletedCompositePKs);
17429
17596
  jsonStatements.push(...jsonTableAlternations.alterColumns);
17597
+ jsonStatements.push(...jsonAddedCompositePKs);
17430
17598
  if (dialect6 === "mysql") {
17431
17599
  jsonStatements.push(...jsonAddedUniqueConstraints);
17432
17600
  jsonStatements.push(...jsonDeletedUniqueConstraints);
@@ -17438,7 +17606,6 @@ var init_snapshotsDiffer = __esm({
17438
17606
  jsonStatements.push(...jsonTableAlternations.dropColumns);
17439
17607
  if (dialect6 !== "sqlite")
17440
17608
  jsonStatements.push(...jsonCreateReferences);
17441
- jsonStatements.push(...jsonAddedCompositePKs);
17442
17609
  jsonStatements.push(...jsonAlteredCompositePKs);
17443
17610
  if (dialect6 !== "mysql") {
17444
17611
  jsonStatements.push(...jsonAddedUniqueConstraints);
@@ -24710,161 +24877,6 @@ var init_sqliteIntrospect = __esm({
24710
24877
  }
24711
24878
  });
24712
24879
 
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
24880
  // node_modules/.pnpm/semver@7.5.4/node_modules/semver/internal/constants.js
24869
24881
  var require_constants = __commonJS({
24870
24882
  "node_modules/.pnpm/semver@7.5.4/node_modules/semver/internal/constants.js"(exports, module2) {
@@ -43208,15 +43220,15 @@ var require_promise = __commonJS({
43208
43220
  });
43209
43221
 
43210
43222
  // src/orm-extenstions/d1-driver/session.ts
43211
- var import_drizzle_orm10, import_drizzle_orm11, import_drizzle_orm12, import_sqlite_core4, import_drizzle_orm13, _a, SQLiteWranglerD1Session, _a2, PreparedQuery;
43223
+ var import_drizzle_orm10, import_drizzle_orm11, import_drizzle_orm12, import_sqlite_core3, import_drizzle_orm13, _a, SQLiteWranglerD1Session, _a2, PreparedQuery;
43212
43224
  var init_session = __esm({
43213
43225
  "src/orm-extenstions/d1-driver/session.ts"() {
43214
43226
  import_drizzle_orm10 = require("drizzle-orm");
43215
43227
  import_drizzle_orm11 = require("drizzle-orm");
43216
43228
  import_drizzle_orm12 = require("drizzle-orm");
43217
- import_sqlite_core4 = require("drizzle-orm/sqlite-core");
43229
+ import_sqlite_core3 = require("drizzle-orm/sqlite-core");
43218
43230
  import_drizzle_orm13 = require("drizzle-orm");
43219
- SQLiteWranglerD1Session = class extends import_sqlite_core4.SQLiteSession {
43231
+ SQLiteWranglerD1Session = class extends import_sqlite_core3.SQLiteSession {
43220
43232
  constructor(client, configPath, dbName, dialect6, schema4, options = {}) {
43221
43233
  super(dialect6);
43222
43234
  this.client = client;
@@ -43245,7 +43257,7 @@ var init_session = __esm({
43245
43257
  };
43246
43258
  _a = import_drizzle_orm10.entityKind;
43247
43259
  SQLiteWranglerD1Session[_a] = "SQLiteD1Session";
43248
- PreparedQuery = class extends import_sqlite_core4.SQLitePreparedQuery {
43260
+ PreparedQuery = class extends import_sqlite_core3.SQLitePreparedQuery {
43249
43261
  constructor(stmt, configPath, dbName, queryString, params, logger, fields, executeMethod, customResultMapper) {
43250
43262
  super("async", executeMethod, {
43251
43263
  sql: queryString,
@@ -43370,20 +43382,20 @@ function drizzle(client, configPath, dbName, config = {}) {
43370
43382
  const session = new SQLiteWranglerD1Session(client, configPath, dbName, dialect6, schema4, {
43371
43383
  logger
43372
43384
  });
43373
- return new import_sqlite_core5.BaseSQLiteDatabase(
43385
+ return new import_sqlite_core4.BaseSQLiteDatabase(
43374
43386
  "async",
43375
43387
  dialect6,
43376
43388
  session,
43377
43389
  schema4
43378
43390
  );
43379
43391
  }
43380
- var import_drizzle_orm14, import_sqlite_core5, WranglerDialect;
43392
+ var import_drizzle_orm14, import_sqlite_core4, WranglerDialect;
43381
43393
  var init_driver = __esm({
43382
43394
  "src/orm-extenstions/d1-driver/driver.ts"() {
43383
43395
  import_drizzle_orm14 = require("drizzle-orm");
43384
- import_sqlite_core5 = require("drizzle-orm/sqlite-core");
43396
+ import_sqlite_core4 = require("drizzle-orm/sqlite-core");
43385
43397
  init_session();
43386
- WranglerDialect = class extends import_sqlite_core5.SQLiteAsyncDialect {
43398
+ WranglerDialect = class extends import_sqlite_core4.SQLiteAsyncDialect {
43387
43399
  sqlToQuery(sql2) {
43388
43400
  return sql2.toQuery({
43389
43401
  escapeName: this.escapeName,
@@ -58699,13 +58711,13 @@ var init_wrangler_client = __esm({
58699
58711
  });
58700
58712
 
58701
58713
  // src/serializer/studioUtils.ts
58702
- var import_drizzle_orm15, import_mysql_core4, import_pg_core5, import_sqlite_core6, drizzleDb;
58714
+ var import_drizzle_orm15, import_mysql_core4, import_pg_core4, import_sqlite_core5, drizzleDb;
58703
58715
  var init_studioUtils = __esm({
58704
58716
  "src/serializer/studioUtils.ts"() {
58705
58717
  import_drizzle_orm15 = require("drizzle-orm");
58706
58718
  import_mysql_core4 = require("drizzle-orm/mysql-core");
58707
- import_pg_core5 = require("drizzle-orm/pg-core");
58708
- import_sqlite_core6 = require("drizzle-orm/sqlite-core");
58719
+ import_pg_core4 = require("drizzle-orm/pg-core");
58720
+ import_sqlite_core5 = require("drizzle-orm/sqlite-core");
58709
58721
  init_utils();
58710
58722
  init_utils3();
58711
58723
  init_global();
@@ -58814,7 +58826,8 @@ var init_utils5 = __esm({
58814
58826
  init_pgIntrospect();
58815
58827
  init_pgPushUtils();
58816
58828
  init_sqliteIntrospect();
58817
- init_schemaToDrizzle();
58829
+ init_sqliteSerializer();
58830
+ init_pgSerializer();
58818
58831
  init_studioUtils();
58819
58832
  init_pgConnect();
58820
58833
  assertV1OutFolder = (out, dialect6) => {
@@ -59133,7 +59146,7 @@ var init_utils5 = __esm({
59133
59146
  preparedConnection.client,
59134
59147
  []
59135
59148
  );
59136
- const models = sqliteSchemaToDrizzle(schema4);
59149
+ const models = toDrizzle2(schema4);
59137
59150
  const drizzleDbInstance = await drizzleDb(
59138
59151
  connection,
59139
59152
  { sqliteSchema: models },
@@ -59158,7 +59171,7 @@ var init_utils5 = __esm({
59158
59171
  [],
59159
59172
  [schemaName]
59160
59173
  );
59161
- const models = pgSchemaToDrizzle(schema4, schemaName);
59174
+ const models = toDrizzle(schema4, schemaName);
59162
59175
  response[schemaName] = await drizzleDb(
59163
59176
  // @ts-ignore I don't know how to fix it yet. But will find a way
59164
59177
  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>;