drizzle-kit 0.20.7-05d4dfb → 0.20.7-2e40056

Sign up to get free protection for your applications and to get access to all the features.
package/bin.cjs CHANGED
@@ -11261,7 +11261,7 @@ var require_node2 = __commonJS({
11261
11261
  });
11262
11262
 
11263
11263
  // src/cli/commands/utils.ts
11264
- var import_path, import_fs, import_hanji2, assertES5, safeRegister, prepareGenerateConfig, assertOutFolder, configCommonSchema, introspectCasing, configIntrospectSchema, configIntrospectCliSchema, configGenerateSchema, configPushSchema, mysqlConnectionSchema, mySqlCliConfigSchema, mySqlIntrospectConfigSchema, drizzleConfigFromFile, readDrizzleConfig;
11264
+ var import_path, import_fs, import_hanji2, assertES5, safeRegister, prepareGenerateConfig, assertOutFolder, driver, configCommonSchema, introspectCasing, configIntrospectSchema, configIntrospectCliSchema, configGenerateSchema, configPushSchema, mysqlConnectionSchema, mySqlCliConfigSchema, mySqlIntrospectConfigSchema, drizzleConfigFromFile, readDrizzleConfig;
11265
11265
  var init_utils = __esm({
11266
11266
  "src/cli/commands/utils.ts"() {
11267
11267
  init_serializer();
@@ -11324,7 +11324,8 @@ var init_utils = __esm({
11324
11324
  custom,
11325
11325
  breakpoints: drizzleConfig.breakpoints ?? false,
11326
11326
  schema: drizzleConfig.schema,
11327
- out: drizzleConfig.out
11327
+ out: drizzleConfig.out,
11328
+ bundle: drizzleConfig.driver === "expo"
11328
11329
  };
11329
11330
  }
11330
11331
  if (!schema4) {
@@ -11340,7 +11341,7 @@ var init_utils = __esm({
11340
11341
  console.error(`'out' param must be set`);
11341
11342
  process.exit(1);
11342
11343
  }
11343
- return { schema: schema4, out, breakpoints, custom };
11344
+ return { schema: schema4, out, breakpoints, custom, bundle: false };
11344
11345
  };
11345
11346
  assertOutFolder = async (it) => {
11346
11347
  if ("out" in it)
@@ -11356,10 +11357,20 @@ var init_utils = __esm({
11356
11357
  }
11357
11358
  return cliConfig.out;
11358
11359
  };
11360
+ driver = unionType([
11361
+ literalType("better-sqlite"),
11362
+ literalType("turso"),
11363
+ literalType("libsql"),
11364
+ literalType("d1"),
11365
+ literalType("expo"),
11366
+ literalType("pg"),
11367
+ literalType("mysql2")
11368
+ ]);
11359
11369
  configCommonSchema = objectType({
11360
11370
  schema: unionType([stringType(), stringType().array()]),
11361
11371
  out: stringType().optional(),
11362
11372
  breakpoints: booleanType().default(true),
11373
+ driver: driver.optional(),
11363
11374
  tablesFilter: unionType([stringType(), stringType().array()]).optional(),
11364
11375
  schemaFilter: unionType([stringType(), stringType().array()]).default(["public"])
11365
11376
  });
@@ -11566,9 +11577,9 @@ var init_outputs = __esm({
11566
11577
  driver: () => withStyle.error(
11567
11578
  `Either "turso", "libsql", "better-sqlite" are available options for "--driver"`
11568
11579
  ),
11569
- url: (driver) => withStyle.error(`"url" is a required option for driver "${driver}". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`),
11570
- authToken: (driver) => withStyle.error(
11571
- `"authToken" is a required option for driver "${driver}". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`
11580
+ url: (driver2) => withStyle.error(`"url" is a required option for driver "${driver2}". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`),
11581
+ authToken: (driver2) => withStyle.error(
11582
+ `"authToken" is a required option for driver "${driver2}". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`
11572
11583
  )
11573
11584
  },
11574
11585
  introspect: {},
@@ -12180,6 +12191,7 @@ var init_pgSerializer = __esm({
12180
12191
  };
12181
12192
  generatePgSnapshot = (tables, enums, schemas, schemaFilter) => {
12182
12193
  const result = {};
12194
+ const indexesInSchema = {};
12183
12195
  for (const table4 of tables) {
12184
12196
  const {
12185
12197
  name: tableName,
@@ -12331,6 +12343,24 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
12331
12343
  return it.name;
12332
12344
  }
12333
12345
  });
12346
+ if (typeof indexesInSchema[schema4 ?? "public"] !== "undefined") {
12347
+ if (indexesInSchema[schema4 ?? "public"].includes(name)) {
12348
+ console.log(
12349
+ `
12350
+ ${withStyle.errorWarning(
12351
+ `We've found duplicated index name across ${source_default.underline.blue(
12352
+ schema4 ?? "public"
12353
+ )} schema. Please rename your index in either the ${source_default.underline.blue(
12354
+ tableName
12355
+ )} table or the table with the duplicated index name`
12356
+ )}`
12357
+ );
12358
+ process.exit(1);
12359
+ }
12360
+ indexesInSchema[schema4 ?? "public"].push(name);
12361
+ } else {
12362
+ indexesInSchema[schema4 ?? "public"] = [name];
12363
+ }
12334
12364
  indexesObject[name] = {
12335
12365
  name,
12336
12366
  columns: indexColumns,
@@ -14885,6 +14915,7 @@ var init_words = __esm({
14885
14915
  var migrate_exports = {};
14886
14916
  __export(migrate_exports, {
14887
14917
  BREAKPOINT: () => BREAKPOINT,
14918
+ embeddedMigrations: () => embeddedMigrations,
14888
14919
  prepareAndMigrateMySql: () => prepareAndMigrateMySql,
14889
14920
  prepareAndMigratePg: () => prepareAndMigratePg,
14890
14921
  prepareAndMigrateSqlite: () => prepareAndMigrateSqlite,
@@ -14895,7 +14926,7 @@ __export(migrate_exports, {
14895
14926
  prepareSnapshotFolderName: () => prepareSnapshotFolderName,
14896
14927
  writeResult: () => writeResult
14897
14928
  });
14898
- var import_fs4, import_path3, import_hanji3, prepareAndMigratePg, prepareMySQLPush, prepareSQLitePush, preparePgPush, prepareAndMigrateMySql, prepareAndMigrateSqlite, prepareSQL, promptColumnsConflicts, promptTablesConflict, promptSchemasConflict, BREAKPOINT, writeResult, prepareSnapshotFolderName, two;
14929
+ var import_fs4, import_path3, import_hanji3, prepareAndMigratePg, prepareMySQLPush, prepareSQLitePush, preparePgPush, prepareAndMigrateMySql, prepareAndMigrateSqlite, prepareSQL, promptColumnsConflicts, promptTablesConflict, promptSchemasConflict, BREAKPOINT, writeResult, embeddedMigrations, prepareSnapshotFolderName, two;
14899
14930
  var init_migrate = __esm({
14900
14931
  "src/cli/commands/migrate.ts"() {
14901
14932
  import_fs4 = __toESM(require("fs"));
@@ -14924,19 +14955,14 @@ var init_migrate = __esm({
14924
14955
  const validatedPrev = pgSchema.parse(prev);
14925
14956
  const validatedCur = pgSchema.parse(cur);
14926
14957
  if (config.custom) {
14927
- writeResult(
14928
- custom,
14929
- [],
14958
+ writeResult({
14959
+ cur: custom,
14960
+ sqlStatements: [],
14930
14961
  journal,
14931
- {
14932
- columns: {},
14933
- schemas: {},
14934
- tables: {}
14935
- },
14936
14962
  outFolder,
14937
- config.breakpoints,
14938
- "custom"
14939
- );
14963
+ breakpoints: config.breakpoints,
14964
+ type: "custom"
14965
+ });
14940
14966
  return;
14941
14967
  }
14942
14968
  const squashedPrev = squashPgScheme(validatedPrev);
@@ -14948,14 +14974,13 @@ var init_migrate = __esm({
14948
14974
  validatedPrev,
14949
14975
  validatedCur
14950
14976
  );
14951
- writeResult(
14977
+ writeResult({
14952
14978
  cur,
14953
14979
  sqlStatements,
14954
14980
  journal,
14955
- _meta,
14956
14981
  outFolder,
14957
- config.breakpoints
14958
- );
14982
+ breakpoints: config.breakpoints
14983
+ });
14959
14984
  } catch (e) {
14960
14985
  console.error(e);
14961
14986
  }
@@ -15049,19 +15074,14 @@ var init_migrate = __esm({
15049
15074
  const validatedPrev = mysqlSchema.parse(prev);
15050
15075
  const validatedCur = mysqlSchema.parse(cur);
15051
15076
  if (config.custom) {
15052
- writeResult(
15053
- custom,
15054
- [],
15077
+ writeResult({
15078
+ cur: custom,
15079
+ sqlStatements: [],
15055
15080
  journal,
15056
- {
15057
- columns: {},
15058
- schemas: {},
15059
- tables: {}
15060
- },
15061
15081
  outFolder,
15062
- config.breakpoints,
15063
- "custom"
15064
- );
15082
+ breakpoints: config.breakpoints,
15083
+ type: "custom"
15084
+ });
15065
15085
  return;
15066
15086
  }
15067
15087
  const squashedPrev = squashMysqlScheme(validatedPrev);
@@ -15073,14 +15093,14 @@ var init_migrate = __esm({
15073
15093
  validatedPrev,
15074
15094
  validatedCur
15075
15095
  );
15076
- writeResult(
15096
+ writeResult({
15077
15097
  cur,
15078
15098
  sqlStatements,
15079
15099
  journal,
15080
15100
  _meta,
15081
15101
  outFolder,
15082
- config.breakpoints
15083
- );
15102
+ breakpoints: config.breakpoints
15103
+ });
15084
15104
  } catch (e) {
15085
15105
  console.error(e);
15086
15106
  }
@@ -15098,19 +15118,15 @@ var init_migrate = __esm({
15098
15118
  const validatedPrev = sqliteSchema.parse(prev);
15099
15119
  const validatedCur = sqliteSchema.parse(cur);
15100
15120
  if (config.custom) {
15101
- writeResult(
15102
- custom,
15103
- [],
15121
+ writeResult({
15122
+ cur: custom,
15123
+ sqlStatements: [],
15104
15124
  journal,
15105
- {
15106
- columns: {},
15107
- schemas: {},
15108
- tables: {}
15109
- },
15110
15125
  outFolder,
15111
- config.breakpoints,
15112
- "custom"
15113
- );
15126
+ breakpoints: config.breakpoints,
15127
+ bundle: config.bundle,
15128
+ type: "custom"
15129
+ });
15114
15130
  return;
15115
15131
  }
15116
15132
  const squashedPrev = squashSqliteScheme(validatedPrev);
@@ -15120,14 +15136,15 @@ var init_migrate = __esm({
15120
15136
  squashedCur,
15121
15137
  "sqlite"
15122
15138
  );
15123
- writeResult(
15139
+ writeResult({
15124
15140
  cur,
15125
15141
  sqlStatements,
15126
15142
  journal,
15127
15143
  _meta,
15128
15144
  outFolder,
15129
- config.breakpoints
15130
- );
15145
+ breakpoints: config.breakpoints,
15146
+ bundle: config.bundle
15147
+ });
15131
15148
  } catch (e) {
15132
15149
  console.error(e);
15133
15150
  }
@@ -15315,7 +15332,20 @@ var init_migrate = __esm({
15315
15332
  return result;
15316
15333
  };
15317
15334
  BREAKPOINT = "--> statement-breakpoint\n";
15318
- writeResult = (cur, sqlStatements, journal, _meta, outFolder, breakpoints, type = "none") => {
15335
+ writeResult = ({
15336
+ cur,
15337
+ sqlStatements,
15338
+ journal,
15339
+ _meta = {
15340
+ columns: {},
15341
+ schemas: {},
15342
+ tables: {}
15343
+ },
15344
+ outFolder,
15345
+ breakpoints,
15346
+ bundle = false,
15347
+ type = "none"
15348
+ }) => {
15319
15349
  if (type === "none") {
15320
15350
  console.log(schema(cur));
15321
15351
  if (sqlStatements.length === 0) {
@@ -15356,6 +15386,10 @@ ${sql2}
15356
15386
  });
15357
15387
  import_fs4.default.writeFileSync(metaJournal, JSON.stringify(journal, null, 2));
15358
15388
  import_fs4.default.writeFileSync(`${outFolder}/${tag}.sql`, sql2);
15389
+ if (bundle) {
15390
+ const js = embeddedMigrations(journal);
15391
+ import_fs4.default.writeFileSync(`${outFolder}/migrations.js`, js);
15392
+ }
15359
15393
  (0, import_hanji3.render)(
15360
15394
  `[${source_default.green(
15361
15395
  "\u2713"
@@ -15364,6 +15398,23 @@ ${sql2}
15364
15398
  )} \u{1F680}`
15365
15399
  );
15366
15400
  };
15401
+ embeddedMigrations = (journal) => {
15402
+ let content = "// This file is required for Expo/React Native SQLite migrations - https://orm.drizzle.team/quick-sqlite/expo\n\n";
15403
+ content += "import journal from './meta/_journal.json';\n";
15404
+ journal.entries.forEach((entry) => {
15405
+ content += `import m${entry.idx.toString().padStart(4, "0")} from './${entry.tag}.sql';
15406
+ `;
15407
+ });
15408
+ content += `
15409
+ export default {
15410
+ journal,
15411
+ migrations: {
15412
+ ${journal.entries.map((it) => `m${it.idx.toString().padStart(4, "0")}`).join(",\n")}
15413
+ }
15414
+ }
15415
+ `;
15416
+ return content;
15417
+ };
15367
15418
  prepareSnapshotFolderName = () => {
15368
15419
  const now = /* @__PURE__ */ new Date();
15369
15420
  return `${now.getFullYear()}${two(now.getUTCMonth() + 1)}${two(
@@ -15458,7 +15509,7 @@ var init_sqlgenerator = __esm({
15458
15509
  if (typeof compositePKs !== "undefined" && compositePKs.length > 0) {
15459
15510
  statement += ",\n";
15460
15511
  const compositePK4 = PgSquasher.unsquashPK(compositePKs[0]);
15461
- statement += ` CONSTRAINT ${st.compositePkName} PRIMARY KEY("${compositePK4.columns.join(`","`)}")`;
15512
+ statement += ` CONSTRAINT "${st.compositePkName}" PRIMARY KEY("${compositePK4.columns.join(`","`)}")`;
15462
15513
  }
15463
15514
  if (typeof uniqueConstraints !== "undefined" && uniqueConstraints.length > 0) {
15464
15515
  for (const uniqueConstraint4 of uniqueConstraints) {
@@ -17855,9 +17906,9 @@ var init_snapshotsDiffer = __esm({
17855
17906
  }
17856
17907
  jsonStatements.push(...jsonDroppedReferencesForAlteredTables);
17857
17908
  jsonStatements.push(...jsonDropIndexesForAllAlteredTables);
17858
- jsonStatements.push(...jsonAddedCompositePKs);
17859
- jsonStatements.push(...jsonTableAlternations.alterColumns);
17860
17909
  jsonStatements.push(...jsonDeletedCompositePKs);
17910
+ jsonStatements.push(...jsonTableAlternations.alterColumns);
17911
+ jsonStatements.push(...jsonAddedCompositePKs);
17861
17912
  if (dialect6 === "mysql") {
17862
17913
  jsonStatements.push(...jsonAddedUniqueConstraints);
17863
17914
  jsonStatements.push(...jsonDeletedUniqueConstraints);
@@ -22307,15 +22358,15 @@ var require_pg_connection_string = __commonJS({
22307
22358
  if (config.sslcert || config.sslkey || config.sslrootcert || config.sslmode) {
22308
22359
  config.ssl = {};
22309
22360
  }
22310
- const fs8 = config.sslcert || config.sslkey || config.sslrootcert ? require("fs") : null;
22361
+ const fs9 = config.sslcert || config.sslkey || config.sslrootcert ? require("fs") : null;
22311
22362
  if (config.sslcert) {
22312
- config.ssl.cert = fs8.readFileSync(config.sslcert).toString();
22363
+ config.ssl.cert = fs9.readFileSync(config.sslcert).toString();
22313
22364
  }
22314
22365
  if (config.sslkey) {
22315
- config.ssl.key = fs8.readFileSync(config.sslkey).toString();
22366
+ config.ssl.key = fs9.readFileSync(config.sslkey).toString();
22316
22367
  }
22317
22368
  if (config.sslrootcert) {
22318
- config.ssl.ca = fs8.readFileSync(config.sslrootcert).toString();
22369
+ config.ssl.ca = fs9.readFileSync(config.sslrootcert).toString();
22319
22370
  }
22320
22371
  switch (config.sslmode) {
22321
22372
  case "disable": {
@@ -24099,15 +24150,15 @@ var require_lib = __commonJS({
24099
24150
  "node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js"(exports, module2) {
24100
24151
  "use strict";
24101
24152
  var path4 = require("path");
24102
- var fs8 = require("fs");
24153
+ var fs9 = require("fs");
24103
24154
  var helper = require_helper();
24104
24155
  module2.exports = function(connInfo, cb) {
24105
24156
  var file = helper.getFileName();
24106
- fs8.stat(file, function(err2, stat) {
24157
+ fs9.stat(file, function(err2, stat) {
24107
24158
  if (err2 || !helper.usePgPass(stat, file)) {
24108
24159
  return cb(void 0);
24109
24160
  }
24110
- var st = fs8.createReadStream(file);
24161
+ var st = fs9.createReadStream(file);
24111
24162
  helper.getPassword(connInfo, st, cb);
24112
24163
  });
24113
24164
  };
@@ -44852,7 +44903,7 @@ var require_windows = __commonJS({
44852
44903
  "node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module2) {
44853
44904
  module2.exports = isexe;
44854
44905
  isexe.sync = sync2;
44855
- var fs8 = require("fs");
44906
+ var fs9 = require("fs");
44856
44907
  function checkPathExt(path4, options) {
44857
44908
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
44858
44909
  if (!pathext) {
@@ -44877,12 +44928,12 @@ var require_windows = __commonJS({
44877
44928
  return checkPathExt(path4, options);
44878
44929
  }
44879
44930
  function isexe(path4, options, cb) {
44880
- fs8.stat(path4, function(er, stat) {
44931
+ fs9.stat(path4, function(er, stat) {
44881
44932
  cb(er, er ? false : checkStat(stat, path4, options));
44882
44933
  });
44883
44934
  }
44884
44935
  function sync2(path4, options) {
44885
- return checkStat(fs8.statSync(path4), path4, options);
44936
+ return checkStat(fs9.statSync(path4), path4, options);
44886
44937
  }
44887
44938
  }
44888
44939
  });
@@ -44892,14 +44943,14 @@ var require_mode = __commonJS({
44892
44943
  "node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module2) {
44893
44944
  module2.exports = isexe;
44894
44945
  isexe.sync = sync2;
44895
- var fs8 = require("fs");
44946
+ var fs9 = require("fs");
44896
44947
  function isexe(path4, options, cb) {
44897
- fs8.stat(path4, function(er, stat) {
44948
+ fs9.stat(path4, function(er, stat) {
44898
44949
  cb(er, er ? false : checkStat(stat, options));
44899
44950
  });
44900
44951
  }
44901
44952
  function sync2(path4, options) {
44902
- return checkStat(fs8.statSync(path4), options);
44953
+ return checkStat(fs9.statSync(path4), options);
44903
44954
  }
44904
44955
  function checkStat(stat, options) {
44905
44956
  return stat.isFile() && checkMode(stat, options);
@@ -44923,7 +44974,7 @@ var require_mode = __commonJS({
44923
44974
  // node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
44924
44975
  var require_isexe = __commonJS({
44925
44976
  "node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
44926
- var fs8 = require("fs");
44977
+ var fs9 = require("fs");
44927
44978
  var core;
44928
44979
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
44929
44980
  core = require_windows();
@@ -49866,8 +49917,8 @@ var require_utils6 = __commonJS({
49866
49917
  exports.array = array;
49867
49918
  var errno = require_errno();
49868
49919
  exports.errno = errno;
49869
- var fs8 = require_fs();
49870
- exports.fs = fs8;
49920
+ var fs9 = require_fs();
49921
+ exports.fs = fs9;
49871
49922
  var path4 = require_path();
49872
49923
  exports.path = path4;
49873
49924
  var pattern = require_pattern();
@@ -50051,12 +50102,12 @@ var require_fs2 = __commonJS({
50051
50102
  "use strict";
50052
50103
  Object.defineProperty(exports, "__esModule", { value: true });
50053
50104
  exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
50054
- var fs8 = require("fs");
50105
+ var fs9 = require("fs");
50055
50106
  exports.FILE_SYSTEM_ADAPTER = {
50056
- lstat: fs8.lstat,
50057
- stat: fs8.stat,
50058
- lstatSync: fs8.lstatSync,
50059
- statSync: fs8.statSync
50107
+ lstat: fs9.lstat,
50108
+ stat: fs9.stat,
50109
+ lstatSync: fs9.lstatSync,
50110
+ statSync: fs9.statSync
50060
50111
  };
50061
50112
  function createFileSystemAdapter(fsMethods) {
50062
50113
  if (fsMethods === void 0) {
@@ -50073,12 +50124,12 @@ var require_settings = __commonJS({
50073
50124
  "node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js"(exports) {
50074
50125
  "use strict";
50075
50126
  Object.defineProperty(exports, "__esModule", { value: true });
50076
- var fs8 = require_fs2();
50127
+ var fs9 = require_fs2();
50077
50128
  var Settings = class {
50078
50129
  constructor(_options = {}) {
50079
50130
  this._options = _options;
50080
50131
  this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
50081
- this.fs = fs8.createFileSystemAdapter(this._options.fs);
50132
+ this.fs = fs9.createFileSystemAdapter(this._options.fs);
50082
50133
  this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
50083
50134
  this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
50084
50135
  }
@@ -50236,8 +50287,8 @@ var require_utils7 = __commonJS({
50236
50287
  "use strict";
50237
50288
  Object.defineProperty(exports, "__esModule", { value: true });
50238
50289
  exports.fs = void 0;
50239
- var fs8 = require_fs3();
50240
- exports.fs = fs8;
50290
+ var fs9 = require_fs3();
50291
+ exports.fs = fs9;
50241
50292
  }
50242
50293
  });
50243
50294
 
@@ -50432,14 +50483,14 @@ var require_fs4 = __commonJS({
50432
50483
  "use strict";
50433
50484
  Object.defineProperty(exports, "__esModule", { value: true });
50434
50485
  exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
50435
- var fs8 = require("fs");
50486
+ var fs9 = require("fs");
50436
50487
  exports.FILE_SYSTEM_ADAPTER = {
50437
- lstat: fs8.lstat,
50438
- stat: fs8.stat,
50439
- lstatSync: fs8.lstatSync,
50440
- statSync: fs8.statSync,
50441
- readdir: fs8.readdir,
50442
- readdirSync: fs8.readdirSync
50488
+ lstat: fs9.lstat,
50489
+ stat: fs9.stat,
50490
+ lstatSync: fs9.lstatSync,
50491
+ statSync: fs9.statSync,
50492
+ readdir: fs9.readdir,
50493
+ readdirSync: fs9.readdirSync
50443
50494
  };
50444
50495
  function createFileSystemAdapter(fsMethods) {
50445
50496
  if (fsMethods === void 0) {
@@ -50458,12 +50509,12 @@ var require_settings2 = __commonJS({
50458
50509
  Object.defineProperty(exports, "__esModule", { value: true });
50459
50510
  var path4 = require("path");
50460
50511
  var fsStat = require_out();
50461
- var fs8 = require_fs4();
50512
+ var fs9 = require_fs4();
50462
50513
  var Settings = class {
50463
50514
  constructor(_options = {}) {
50464
50515
  this._options = _options;
50465
50516
  this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
50466
- this.fs = fs8.createFileSystemAdapter(this._options.fs);
50517
+ this.fs = fs9.createFileSystemAdapter(this._options.fs);
50467
50518
  this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path4.sep);
50468
50519
  this.stats = this._getValue(this._options.stats, false);
50469
50520
  this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
@@ -51779,16 +51830,16 @@ var require_settings4 = __commonJS({
51779
51830
  "use strict";
51780
51831
  Object.defineProperty(exports, "__esModule", { value: true });
51781
51832
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
51782
- var fs8 = require("fs");
51833
+ var fs9 = require("fs");
51783
51834
  var os2 = require("os");
51784
51835
  var CPU_COUNT = Math.max(os2.cpus().length, 1);
51785
51836
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
51786
- lstat: fs8.lstat,
51787
- lstatSync: fs8.lstatSync,
51788
- stat: fs8.stat,
51789
- statSync: fs8.statSync,
51790
- readdir: fs8.readdir,
51791
- readdirSync: fs8.readdirSync
51837
+ lstat: fs9.lstat,
51838
+ lstatSync: fs9.lstatSync,
51839
+ stat: fs9.stat,
51840
+ statSync: fs9.statSync,
51841
+ readdir: fs9.readdir,
51842
+ readdirSync: fs9.readdirSync
51792
51843
  };
51793
51844
  var Settings = class {
51794
51845
  constructor(_options = {}) {
@@ -51939,13 +51990,13 @@ var require_path_type = __commonJS({
51939
51990
  "node_modules/.pnpm/path-type@4.0.0/node_modules/path-type/index.js"(exports) {
51940
51991
  "use strict";
51941
51992
  var { promisify: promisify2 } = require("util");
51942
- var fs8 = require("fs");
51993
+ var fs9 = require("fs");
51943
51994
  async function isType(fsStatType, statsMethodName, filePath) {
51944
51995
  if (typeof filePath !== "string") {
51945
51996
  throw new TypeError(`Expected a string, got ${typeof filePath}`);
51946
51997
  }
51947
51998
  try {
51948
- const stats = await promisify2(fs8[fsStatType])(filePath);
51999
+ const stats = await promisify2(fs9[fsStatType])(filePath);
51949
52000
  return stats[statsMethodName]();
51950
52001
  } catch (error2) {
51951
52002
  if (error2.code === "ENOENT") {
@@ -51959,7 +52010,7 @@ var require_path_type = __commonJS({
51959
52010
  throw new TypeError(`Expected a string, got ${typeof filePath}`);
51960
52011
  }
51961
52012
  try {
51962
- return fs8[fsStatType](filePath)[statsMethodName]();
52013
+ return fs9[fsStatType](filePath)[statsMethodName]();
51963
52014
  } catch (error2) {
51964
52015
  if (error2.code === "ENOENT") {
51965
52016
  return false;
@@ -59638,14 +59689,14 @@ var require_parser2 = __commonJS({
59638
59689
  case "scalar":
59639
59690
  case "single-quoted-scalar":
59640
59691
  case "double-quoted-scalar": {
59641
- const fs8 = this.flowScalar(this.type);
59692
+ const fs9 = this.flowScalar(this.type);
59642
59693
  if (atNextItem || it.value) {
59643
- map.items.push({ start, key: fs8, sep: [] });
59694
+ map.items.push({ start, key: fs9, sep: [] });
59644
59695
  this.onKeyLine = true;
59645
59696
  } else if (it.sep) {
59646
- this.stack.push(fs8);
59697
+ this.stack.push(fs9);
59647
59698
  } else {
59648
- Object.assign(it, { key: fs8, sep: [] });
59699
+ Object.assign(it, { key: fs9, sep: [] });
59649
59700
  this.onKeyLine = true;
59650
59701
  }
59651
59702
  return;
@@ -59764,13 +59815,13 @@ var require_parser2 = __commonJS({
59764
59815
  case "scalar":
59765
59816
  case "single-quoted-scalar":
59766
59817
  case "double-quoted-scalar": {
59767
- const fs8 = this.flowScalar(this.type);
59818
+ const fs9 = this.flowScalar(this.type);
59768
59819
  if (!it || it.value)
59769
- fc.items.push({ start: [], key: fs8, sep: [] });
59820
+ fc.items.push({ start: [], key: fs9, sep: [] });
59770
59821
  else if (it.sep)
59771
- this.stack.push(fs8);
59822
+ this.stack.push(fs9);
59772
59823
  else
59773
- Object.assign(it, { key: fs8, sep: [] });
59824
+ Object.assign(it, { key: fs9, sep: [] });
59774
59825
  return;
59775
59826
  }
59776
59827
  case "flow-map-end":
@@ -60321,8 +60372,8 @@ var init_studioUtils = __esm({
60321
60372
  };
60322
60373
  };
60323
60374
  drizzleForSQLite = async (config, sqliteSchema2, relations4, ts, verbose) => {
60324
- const { driver, dbCredentials: creds } = config;
60325
- if (driver === "d1") {
60375
+ const { driver: driver2, dbCredentials: creds } = config;
60376
+ if (driver2 === "d1") {
60326
60377
  const { drizzle: drizzle2 } = await Promise.resolve().then(() => (init_driver(), driver_exports));
60327
60378
  const { execute: execute2 } = await Promise.resolve().then(() => (init_wrangler_client(), wrangler_client_exports));
60328
60379
  const db = drizzle2(execute2, creds.wranglerConfigPath, creds.dbName, {
@@ -60340,7 +60391,7 @@ var init_studioUtils = __esm({
60340
60391
  ts
60341
60392
  };
60342
60393
  }
60343
- if (driver === "better-sqlite") {
60394
+ if (driver2 === "better-sqlite") {
60344
60395
  assertPackages("better-sqlite3");
60345
60396
  const { drizzle: drizzle2 } = await import("drizzle-orm/better-sqlite3");
60346
60397
  const Database = await import("better-sqlite3");
@@ -60359,7 +60410,7 @@ var init_studioUtils = __esm({
60359
60410
  ts
60360
60411
  };
60361
60412
  }
60362
- if (driver === "libsql" || driver === "turso") {
60413
+ if (driver2 === "libsql" || driver2 === "turso") {
60363
60414
  assertPackages("@libsql/client");
60364
60415
  const { drizzle: drizzle2 } = await import("drizzle-orm/libsql");
60365
60416
  const { createClient } = await import("@libsql/client");
@@ -60383,7 +60434,7 @@ var init_studioUtils = __esm({
60383
60434
  ts
60384
60435
  };
60385
60436
  }
60386
- assertUnreachable(driver);
60437
+ assertUnreachable(driver2);
60387
60438
  };
60388
60439
  drizzleDb = async (drizzleConfig, models, logger) => {
60389
60440
  if (drizzleConfig.driver === "pg") {
@@ -61097,8 +61148,8 @@ var init_mysql = __esm({
61097
61148
  mysqlConnectionConfig
61098
61149
  );
61099
61150
  printCliConnectionIssues3 = (options) => {
61100
- const { driver, uri, host, database } = options || {};
61101
- if (driver !== "mysql2") {
61151
+ const { driver: driver2, uri, host, database } = options || {};
61152
+ if (driver2 !== "mysql2") {
61102
61153
  console.log(outputs.mysql.connection.driver());
61103
61154
  }
61104
61155
  if (!uri && (!host || !database)) {
@@ -61137,7 +61188,7 @@ var init_mysql = __esm({
61137
61188
  const {
61138
61189
  out,
61139
61190
  schema: schema4,
61140
- driver,
61191
+ driver: driver2,
61141
61192
  schemaFilter,
61142
61193
  tablesFilter,
61143
61194
  breakpoints,
@@ -61147,7 +61198,7 @@ var init_mysql = __esm({
61147
61198
  return {
61148
61199
  out,
61149
61200
  schema: schema4,
61150
- driver,
61201
+ driver: driver2,
61151
61202
  schemaFilter,
61152
61203
  tablesFilter,
61153
61204
  breakpoints,
@@ -61183,13 +61234,13 @@ var init_mysql = __esm({
61183
61234
  strict,
61184
61235
  verbose,
61185
61236
  schema: schema4,
61186
- driver,
61237
+ driver: driver2,
61187
61238
  schemaFilter,
61188
61239
  tablesFilter,
61189
61240
  ...rest
61190
61241
  } = cliRes.data;
61191
61242
  return {
61192
- driver,
61243
+ driver: driver2,
61193
61244
  schema: schema4,
61194
61245
  strict,
61195
61246
  verbose,
@@ -61270,7 +61321,7 @@ var require_package = __commonJS({
61270
61321
  // node_modules/.pnpm/dotenv@16.0.3/node_modules/dotenv/lib/main.js
61271
61322
  var require_main = __commonJS({
61272
61323
  "node_modules/.pnpm/dotenv@16.0.3/node_modules/dotenv/lib/main.js"(exports, module2) {
61273
- var fs8 = require("fs");
61324
+ var fs9 = require("fs");
61274
61325
  var path4 = require("path");
61275
61326
  var os2 = require("os");
61276
61327
  var packageJson = require_package();
@@ -61315,7 +61366,7 @@ var require_main = __commonJS({
61315
61366
  }
61316
61367
  }
61317
61368
  try {
61318
- const parsed = DotenvModule.parse(fs8.readFileSync(dotenvPath, { encoding }));
61369
+ const parsed = DotenvModule.parse(fs9.readFileSync(dotenvPath, { encoding }));
61319
61370
  Object.keys(parsed).forEach(function(key) {
61320
61371
  if (!Object.prototype.hasOwnProperty.call(process.env, key)) {
61321
61372
  process.env[key] = parsed[key];
@@ -62109,7 +62160,7 @@ __export(cli_exports, {
62109
62160
  });
62110
62161
  module.exports = __toCommonJS(cli_exports);
62111
62162
  var import_commander = require("commander");
62112
- var import_fs11 = require("fs");
62163
+ var import_fs12 = require("fs");
62113
62164
  init_lib();
62114
62165
 
62115
62166
  // src/cli/commands/check.ts
@@ -62350,13 +62401,18 @@ var import_fs10 = require("fs");
62350
62401
  var import_hanji8 = __toESM(require_hanji());
62351
62402
  var import_path6 = require("path");
62352
62403
  init_views();
62353
- var dropMigration = async (out) => {
62404
+ init_migrate();
62405
+ var import_fs11 = __toESM(require("fs"));
62406
+ var dropMigration = async ({
62407
+ out,
62408
+ bundle
62409
+ }) => {
62354
62410
  const metaFilePath = (0, import_path6.join)(out, "meta", "_journal.json");
62355
- const journal = JSON.parse(
62356
- (0, import_fs10.readFileSync)(metaFilePath, "utf-8")
62357
- );
62411
+ const journal = JSON.parse((0, import_fs10.readFileSync)(metaFilePath, "utf-8"));
62358
62412
  if (journal.entries.length === 0) {
62359
- console.log(`[${source_default.blue("i")}] no migration entries found in ${metaFilePath}`);
62413
+ console.log(
62414
+ `[${source_default.blue("i")}] no migration entries found in ${metaFilePath}`
62415
+ );
62360
62416
  return;
62361
62417
  }
62362
62418
  const result = await (0, import_hanji8.render)(new DropMigrationView(journal.entries));
@@ -62368,11 +62424,25 @@ var dropMigration = async (out) => {
62368
62424
  entries: journal.entries.filter(Boolean)
62369
62425
  };
62370
62426
  const sqlFilePath = (0, import_path6.join)(out, `${result.data.tag}.sql`);
62371
- const snapshotFilePath = (0, import_path6.join)(out, "meta", `${result.data.idx.toFixed(0).padStart(4, "0")}_snapshot.json`);
62427
+ const snapshotFilePath = (0, import_path6.join)(
62428
+ out,
62429
+ "meta",
62430
+ `${result.data.idx.toFixed(0).padStart(4, "0")}_snapshot.json`
62431
+ );
62372
62432
  (0, import_fs10.rmSync)(sqlFilePath);
62373
62433
  (0, import_fs10.rmSync)(snapshotFilePath);
62374
62434
  (0, import_fs10.writeFileSync)(metaFilePath, JSON.stringify(resultJournal));
62375
- console.log(`[${source_default.green("\u2713")}] ${source_default.bold(result.data.tag)} migration successfully dropped`);
62435
+ if (bundle) {
62436
+ import_fs11.default.writeFileSync(
62437
+ (0, import_path6.join)(out, `migrations.js`),
62438
+ embeddedMigrations(resultJournal)
62439
+ );
62440
+ }
62441
+ console.log(
62442
+ `[${source_default.green("\u2713")}] ${source_default.bold(
62443
+ result.data.tag
62444
+ )} migration successfully dropped`
62445
+ );
62376
62446
  };
62377
62447
 
62378
62448
  // src/cli/index.ts
@@ -62994,7 +63064,7 @@ var generateMysqlCommand = new import_commander.Command("generate:mysql").option
62994
63064
  var dbPushMysqlCommand = new import_commander.Command("push:mysql").option(
62995
63065
  "--config <config>",
62996
63066
  "Path to a config.json file, drizzle.config.ts by default"
62997
- ).option("--schema <schema...>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--connectionString <connectionString>", "MySQL connection string").option("--driver <driver>", "MySQL database path").option("--connectionString <connectionString>", "MySQL connection string").option("--host <host>", "MySQL host").option("--port <port>", "MySQL port").option("--user <user>", "MySQL user").option("--password <password>", "MySQL password").option("--database <database>", "MySQL database name").option("--verbose", "Print all statements for each push").option("--strict", "Always ask for confirmation").action(async (options) => {
63067
+ ).option("--schema <schema...>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--connectionString <connectionString>", "MySQL connection string").option("--driver <driver>", "Driver used for querying the database").option("--connectionString <connectionString>", "MySQL connection string").option("--host <host>", "MySQL host").option("--port <port>", "MySQL port").option("--user <user>", "MySQL user").option("--password <password>", "MySQL password").option("--database <database>", "MySQL database name").option("--verbose", "Print all statements for each push").option("--strict", "Always ask for confirmation").action(async (options) => {
62998
63068
  await printVersions();
62999
63069
  await assertPackages("drizzle-orm");
63000
63070
  await assertOrmCoreVersion();
@@ -63111,7 +63181,7 @@ var dbPushPgCommand = new import_commander.Command("push:pg").option(
63111
63181
  ).option("--schema <schema...>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--schemaFilters", `Schema name filters`).option(
63112
63182
  "--connectionString <connectionString>",
63113
63183
  "PostgreSQL connection string"
63114
- ).option("--driver <driver>", "PostgreSQL database path").option(
63184
+ ).option("--driver <driver>", "Driver used for querying the database").option(
63115
63185
  "--connectionString <connectionString>",
63116
63186
  "PostgreSQL connection string"
63117
63187
  ).option("--host <host>", "PostgreSQL host").option("--port <port>", "PostgreSQL port").option("--user <user>", "PostgreSQL user").option("--password <password>", "PostgreSQL password").option("--ssl <ssl>", "Postgres ssl").option("--database <database>", "PostgreSQL database name").option("--verbose", "Print all statements for each push").option("--strict", "Always ask for confirmation").action(async (options) => {
@@ -63221,7 +63291,7 @@ var dbPushPgCommand = new import_commander.Command("push:pg").option(
63221
63291
  var dbPushSqliteCommand = new import_commander.Command("push:sqlite").option(
63222
63292
  "--config <config>",
63223
63293
  "Path to a config.ts file, drizzle.config.ts by default"
63224
- ).option("--schema <schema>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--connectionString <connectionString>", "SQLite connection string").option("--driver <driver>", "SQLite database path").option("--url <url>", "SQLite database path").option("--auth-token <authToken>", "SQLite database path").option("--verbose", "Print all statements for each push").option("--strict", "Always ask for confirmation").action(async (options) => {
63294
+ ).option("--schema <schema>", "Path to a schema file or folder").option("--tablesFilter", `Table name filters`).option("--connectionString <connectionString>", "SQLite connection string").option("--driver <driver>", "Driver used for querying the database").option("--url <url>", "SQLite database path").option("--auth-token <authToken>", "SQLite database path").option("--verbose", "Print all statements for each push").option("--strict", "Always ask for confirmation").action(async (options) => {
63225
63295
  printVersions();
63226
63296
  assertPackages("drizzle-orm");
63227
63297
  assertOrmCoreVersion();
@@ -63336,7 +63406,8 @@ var generateSqliteCommand = new import_commander.Command("generate:sqlite").opti
63336
63406
  });
63337
63407
  var checkSchema = objectType({
63338
63408
  out: stringType().optional(),
63339
- config: stringType().optional()
63409
+ config: stringType().optional(),
63410
+ driver: stringType().optional()
63340
63411
  }).strict();
63341
63412
  var checkPgCommand = new import_commander.Command("check:pg").option("--out <out>", `Output folder`).option("--config <config>", `Config path [default=drizzle.config.ts]`).action(async (options) => {
63342
63413
  await printVersions();
@@ -63442,7 +63513,7 @@ var upSqliteCommand = new import_commander.Command("up:sqlite").option("--out <o
63442
63513
  var introspectPgCommand = new import_commander.Command("introspect:pg").option("--out <out>", `Migrations folder`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option(
63443
63514
  "--introspect-casing <introspectCasing>",
63444
63515
  "Column object keys naming strategy"
63445
- ).option("--tablesFilter", `Table name filters`).option("--driver <driver>", "Postgres connection string").option("--connectionString <connectionString>", "Postgres connection string").option("--host <host>", "Postgres host").option("--port <port>", "Postgres port").option("--user <user>", "Postgres user").option("--password <password>", "Postgres password").option("--database <database>", "Postgres database name").option("--ssl <ssl>", "Postgres ssl").option("--config <config>", `Config path [default=drizzle.config.ts]`).action(async (options) => {
63516
+ ).option("--tablesFilter", `Table name filters`).option("--driver <driver>", "Driver used for querying the database").option("--connectionString <connectionString>", "Postgres connection string").option("--host <host>", "Postgres host").option("--port <port>", "Postgres port").option("--user <user>", "Postgres user").option("--password <password>", "Postgres password").option("--database <database>", "Postgres database name").option("--ssl <ssl>", "Postgres ssl").option("--config <config>", `Config path [default=drizzle.config.ts]`).action(async (options) => {
63446
63517
  await printVersions();
63447
63518
  await assertPackages("drizzle-orm");
63448
63519
  await assertOrmCoreVersion();
@@ -63461,7 +63532,7 @@ var introspectPgCommand = new import_commander.Command("introspect:pg").option("
63461
63532
  schemasFilter
63462
63533
  );
63463
63534
  const schemaFile = import_path7.default.join(validatedConfig.out, "schema.ts");
63464
- (0, import_fs11.writeFileSync)(schemaFile, ts.file);
63535
+ (0, import_fs12.writeFileSync)(schemaFile, ts.file);
63465
63536
  console.log();
63466
63537
  if (snapshots.length === 0) {
63467
63538
  const { sqlStatements, _meta } = await prepareSQL(
@@ -63514,7 +63585,7 @@ var introspectMySqlCommand = new import_commander.Command("introspect:mysql").op
63514
63585
  const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
63515
63586
  const { schema: schema4, ts } = await mysqlIntrospect2(res, tablesFilter);
63516
63587
  const schemaFile = import_path7.default.join(out, "schema.ts");
63517
- (0, import_fs11.writeFileSync)(schemaFile, ts.file);
63588
+ (0, import_fs12.writeFileSync)(schemaFile, ts.file);
63518
63589
  console.log();
63519
63590
  if (snapshots.length === 0) {
63520
63591
  const { sqlStatements, _meta } = await prepareSQL(
@@ -63555,7 +63626,7 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
63555
63626
  ).option(
63556
63627
  "--introspect-casing <introspectCasing>",
63557
63628
  "Column object keys naming strategy"
63558
- ).option("--tablesFilter", `Table name filters`).option("--schema <schema>", `Migrations folder`).option("--out <out>", `Migrations folder`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option("--driver <driver>", "SQLite database path").option("--url <url>", "SQLite database url").option("--auth-token <authToken>", "SQLite database path").action(async (options) => {
63629
+ ).option("--tablesFilter", `Table name filters`).option("--schema <schema>", `Migrations folder`).option("--out <out>", `Migrations folder`).option("--breakpoints", `Prepare SQL statements with breakpoints`).option("--driver <driver>", "Driver used for querying the database").option("--url <url>", "SQLite database url").option("--auth-token <authToken>", "SQLite database path").action(async (options) => {
63559
63630
  printVersions();
63560
63631
  assertPackages("drizzle-orm");
63561
63632
  assertOrmCoreVersion();
@@ -63567,7 +63638,7 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
63567
63638
  const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
63568
63639
  const { schema: schema4, ts } = await sqliteIntrospect2(res, tablesFilter);
63569
63640
  const schemaFile = import_path7.default.join(out, "schema.ts");
63570
- (0, import_fs11.writeFileSync)(schemaFile, ts.file);
63641
+ (0, import_fs12.writeFileSync)(schemaFile, ts.file);
63571
63642
  console.log();
63572
63643
  if (snapshots.length === 0) {
63573
63644
  const { sqlStatements, _meta } = await prepareSQL(
@@ -63602,7 +63673,7 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
63602
63673
  );
63603
63674
  process.exit(0);
63604
63675
  });
63605
- var dropCommand = new import_commander.Command("drop").option("--out <out>", `Output folder`).option("--config <config>", `Config path [default=drizzle.config.ts]`).action(async (options) => {
63676
+ var dropCommand = new import_commander.Command("drop").option("--out <out>", `Output folder`).option("--driver <driver>", `Driver used for querying the database`).option("--config <config>", `Config path [default=drizzle.config.ts]`).action(async (options) => {
63606
63677
  await printVersions();
63607
63678
  await assertOrmCoreVersion();
63608
63679
  const collisionRes = checkCollisions(
@@ -63615,8 +63686,15 @@ var dropCommand = new import_commander.Command("drop").option("--out <out>", `Ou
63615
63686
  }
63616
63687
  const params = checkSchema.parse(options);
63617
63688
  const out = await assertOutFolder(params);
63689
+ let bundle = false;
63690
+ if (typeof options.driver !== "undefined") {
63691
+ bundle = options.driver === "expo";
63692
+ } else {
63693
+ const drizzleConfig = await drizzleConfigFromFile(options.config);
63694
+ bundle = drizzleConfig.driver === "expo";
63695
+ }
63618
63696
  assertV1OutFolder(out, "{dialect}");
63619
- await dropMigration(out);
63697
+ await dropMigration({ out, bundle });
63620
63698
  });
63621
63699
  var studioCommand = new import_commander.Command("studio").option("--port <port>", "Custom port for drizzle studio [default=4983]").option("--host <host>", "Custom host for drizzle studio [default=0.0.0.0]").option("--verbose", "Print all stataments that are executed by Studio").option("--config <config>", `Config path [default=drizzle.config.ts]`).action(async (options) => {
63622
63700
  await printVersions();
@@ -63632,9 +63710,9 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
63632
63710
  prepareSQLiteSchema: prepareSQLiteSchema2,
63633
63711
  drizzleForSQLite: drizzleForSQLite2
63634
63712
  } = await Promise.resolve().then(() => (init_studioUtils(), studioUtils_exports));
63635
- const { driver, schema: schemaPath } = drizzleConfig;
63713
+ const { driver: driver2, schema: schemaPath } = drizzleConfig;
63636
63714
  let setup;
63637
- if (driver === "pg") {
63715
+ if (driver2 === "pg") {
63638
63716
  const { schemaToTypeScript: schemaToTypeScript4, relationsToTypeScript: relationsToTypeScript2 } = await Promise.resolve().then(() => (init_introspect_pg(), introspect_pg_exports));
63639
63717
  const { serializePg: serializePg2 } = await Promise.resolve().then(() => (init_serializer(), serializer_exports));
63640
63718
  const { schema: schema4, relations: relations4 } = await preparePgSchema2(schemaPath);
@@ -63652,7 +63730,7 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
63652
63730
  },
63653
63731
  Boolean(options.verbose)
63654
63732
  );
63655
- } else if (driver === "mysql2") {
63733
+ } else if (driver2 === "mysql2") {
63656
63734
  const { schemaToTypeScript: schemaToTypeScript4 } = await Promise.resolve().then(() => (init_introspect_mysql(), introspect_mysql_exports));
63657
63735
  const { schema: schema4, relations: relations4 } = await prepareMySqlSchema2(schemaPath);
63658
63736
  const { serializeMySql: serializeMySql2 } = await Promise.resolve().then(() => (init_serializer(), serializer_exports));
@@ -63669,7 +63747,7 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
63669
63747
  },
63670
63748
  Boolean(options.verbose)
63671
63749
  );
63672
- } else if (driver === "better-sqlite" || driver === "d1" || driver === "libsql" || driver === "turso") {
63750
+ } else if (driver2 === "better-sqlite" || driver2 === "d1" || driver2 === "libsql" || driver2 === "turso") {
63673
63751
  const { schemaToTypeScript: schemaToTypeScript4 } = await Promise.resolve().then(() => (init_introspect_sqlite(), introspect_sqlite_exports));
63674
63752
  const { schema: schema4, relations: relations4 } = await prepareSQLiteSchema2(schemaPath);
63675
63753
  const { serializeSQLite: serializeSQLite2 } = await Promise.resolve().then(() => (init_serializer(), serializer_exports));
@@ -63687,7 +63765,7 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
63687
63765
  Boolean(options.verbose)
63688
63766
  );
63689
63767
  } else {
63690
- assertUnreachable(driver);
63768
+ assertUnreachable(driver2);
63691
63769
  }
63692
63770
  const qeueryEngine = (0, import_studio.queryEngineForSetup)(setup);
63693
63771
  const server = await (0, import_server.prepareServer)((_2) => {
@@ -63701,7 +63779,7 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
63701
63779
  "Drizzle Studio is currently in Beta. If you find anything that is not working as expected or should be improved, feel free to create an issue on GitHub: https://github.com/drizzle-team/drizzle-kit-mirror/issues/new or write to us on Discord: https://discord.gg/WcRKz2FFxN"
63702
63780
  )
63703
63781
  );
63704
- if (driver === "d1") {
63782
+ if (driver2 === "d1") {
63705
63783
  console.log(
63706
63784
  withStyle.fullWarning(
63707
63785
  "It seems like you are trying to access your D1 Database. Please make sure to run 'wrangler login' before using Drizzle Studio to ensure it has your token for making requests to the D1 Database. If you encounter an error related to CLOUDFLARE_TOKEN, please run 'wrangler login' and restart the studio"