drizzle-kit 0.20.7-8d149c2 → 0.20.7-c9519c9

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, driver, configCommonSchema, introspectCasing, configIntrospectSchema, configIntrospectCliSchema, configGenerateSchema, configPushSchema, mysqlConnectionSchema, mySqlCliConfigSchema, mySqlIntrospectConfigSchema, drizzleConfigFromFile, readDrizzleConfig;
11264
+ var import_path, import_fs, import_hanji2, assertES5, safeRegister, prepareGenerateConfig, assertOutFolder, 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,8 +11324,7 @@ var init_utils = __esm({
11324
11324
  custom,
11325
11325
  breakpoints: drizzleConfig.breakpoints ?? false,
11326
11326
  schema: drizzleConfig.schema,
11327
- out: drizzleConfig.out,
11328
- bundle: drizzleConfig.driver === "expo"
11327
+ out: drizzleConfig.out
11329
11328
  };
11330
11329
  }
11331
11330
  if (!schema4) {
@@ -11341,7 +11340,7 @@ var init_utils = __esm({
11341
11340
  console.error(`'out' param must be set`);
11342
11341
  process.exit(1);
11343
11342
  }
11344
- return { schema: schema4, out, breakpoints, custom, bundle: false };
11343
+ return { schema: schema4, out, breakpoints, custom };
11345
11344
  };
11346
11345
  assertOutFolder = async (it) => {
11347
11346
  if ("out" in it)
@@ -11357,20 +11356,10 @@ var init_utils = __esm({
11357
11356
  }
11358
11357
  return cliConfig.out;
11359
11358
  };
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
- ]);
11369
11359
  configCommonSchema = objectType({
11370
11360
  schema: unionType([stringType(), stringType().array()]),
11371
11361
  out: stringType().optional(),
11372
11362
  breakpoints: booleanType().default(true),
11373
- driver: driver.optional(),
11374
11363
  tablesFilter: unionType([stringType(), stringType().array()]).optional(),
11375
11364
  schemaFilter: unionType([stringType(), stringType().array()]).default(["public"])
11376
11365
  });
@@ -11577,9 +11566,9 @@ var init_outputs = __esm({
11577
11566
  driver: () => withStyle.error(
11578
11567
  `Either "turso", "libsql", "better-sqlite" are available options for "--driver"`
11579
11568
  ),
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`
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`
11583
11572
  )
11584
11573
  },
11585
11574
  introspect: {},
@@ -12006,9 +11995,9 @@ We have encountered a collision between the index name on columns ${source_defau
12006
11995
  }
12007
11996
  try {
12008
11997
  const fks = await db.execute(
12009
- `SELECT INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.COLUMN_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_NAME, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_COLUMN_NAME,information_schema.referential_constraints.UPDATE_RULE, information_schema.referential_constraints.DELETE_RULE
11998
+ `SELECT INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.COLUMN_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_NAME, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_COLUMN_NAME,INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS.UPDATE_RULE, INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS.DELETE_RULE
12010
11999
  FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
12011
- LEFT JOIN information_schema.referential_constraints on information_schema.referential_constraints.constraint_name = information_schema.KEY_COLUMN_USAGE.CONSTRAINT_NAME
12000
+ LEFT JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS on INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS.CONSTRAINT_NAME = INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME
12012
12001
  WHERE INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA = ? AND INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME != 'PRIMARY' and INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_NAME is not null;
12013
12002
  `,
12014
12003
  [inputSchema]
@@ -14915,7 +14904,6 @@ var init_words = __esm({
14915
14904
  var migrate_exports = {};
14916
14905
  __export(migrate_exports, {
14917
14906
  BREAKPOINT: () => BREAKPOINT,
14918
- embeddedMigrations: () => embeddedMigrations,
14919
14907
  prepareAndMigrateMySql: () => prepareAndMigrateMySql,
14920
14908
  prepareAndMigratePg: () => prepareAndMigratePg,
14921
14909
  prepareAndMigrateSqlite: () => prepareAndMigrateSqlite,
@@ -14926,7 +14914,7 @@ __export(migrate_exports, {
14926
14914
  prepareSnapshotFolderName: () => prepareSnapshotFolderName,
14927
14915
  writeResult: () => writeResult
14928
14916
  });
14929
- var import_fs4, import_path3, import_hanji3, prepareAndMigratePg, prepareMySQLPush, prepareSQLitePush, preparePgPush, prepareAndMigrateMySql, prepareAndMigrateSqlite, prepareSQL, promptColumnsConflicts, promptTablesConflict, promptSchemasConflict, BREAKPOINT, writeResult, embeddedMigrations, prepareSnapshotFolderName, two;
14917
+ var import_fs4, import_path3, import_hanji3, prepareAndMigratePg, prepareMySQLPush, prepareSQLitePush, preparePgPush, prepareAndMigrateMySql, prepareAndMigrateSqlite, prepareSQL, promptColumnsConflicts, promptTablesConflict, promptSchemasConflict, BREAKPOINT, writeResult, prepareSnapshotFolderName, two;
14930
14918
  var init_migrate = __esm({
14931
14919
  "src/cli/commands/migrate.ts"() {
14932
14920
  import_fs4 = __toESM(require("fs"));
@@ -14955,14 +14943,19 @@ var init_migrate = __esm({
14955
14943
  const validatedPrev = pgSchema.parse(prev);
14956
14944
  const validatedCur = pgSchema.parse(cur);
14957
14945
  if (config.custom) {
14958
- writeResult({
14959
- cur: custom,
14960
- sqlStatements: [],
14946
+ writeResult(
14947
+ custom,
14948
+ [],
14961
14949
  journal,
14950
+ {
14951
+ columns: {},
14952
+ schemas: {},
14953
+ tables: {}
14954
+ },
14962
14955
  outFolder,
14963
- breakpoints: config.breakpoints,
14964
- type: "custom"
14965
- });
14956
+ config.breakpoints,
14957
+ "custom"
14958
+ );
14966
14959
  return;
14967
14960
  }
14968
14961
  const squashedPrev = squashPgScheme(validatedPrev);
@@ -14974,13 +14967,14 @@ var init_migrate = __esm({
14974
14967
  validatedPrev,
14975
14968
  validatedCur
14976
14969
  );
14977
- writeResult({
14970
+ writeResult(
14978
14971
  cur,
14979
14972
  sqlStatements,
14980
14973
  journal,
14974
+ _meta,
14981
14975
  outFolder,
14982
- breakpoints: config.breakpoints
14983
- });
14976
+ config.breakpoints
14977
+ );
14984
14978
  } catch (e) {
14985
14979
  console.error(e);
14986
14980
  }
@@ -15074,14 +15068,19 @@ var init_migrate = __esm({
15074
15068
  const validatedPrev = mysqlSchema.parse(prev);
15075
15069
  const validatedCur = mysqlSchema.parse(cur);
15076
15070
  if (config.custom) {
15077
- writeResult({
15078
- cur: custom,
15079
- sqlStatements: [],
15071
+ writeResult(
15072
+ custom,
15073
+ [],
15080
15074
  journal,
15075
+ {
15076
+ columns: {},
15077
+ schemas: {},
15078
+ tables: {}
15079
+ },
15081
15080
  outFolder,
15082
- breakpoints: config.breakpoints,
15083
- type: "custom"
15084
- });
15081
+ config.breakpoints,
15082
+ "custom"
15083
+ );
15085
15084
  return;
15086
15085
  }
15087
15086
  const squashedPrev = squashMysqlScheme(validatedPrev);
@@ -15093,14 +15092,14 @@ var init_migrate = __esm({
15093
15092
  validatedPrev,
15094
15093
  validatedCur
15095
15094
  );
15096
- writeResult({
15095
+ writeResult(
15097
15096
  cur,
15098
15097
  sqlStatements,
15099
15098
  journal,
15100
15099
  _meta,
15101
15100
  outFolder,
15102
- breakpoints: config.breakpoints
15103
- });
15101
+ config.breakpoints
15102
+ );
15104
15103
  } catch (e) {
15105
15104
  console.error(e);
15106
15105
  }
@@ -15118,15 +15117,19 @@ var init_migrate = __esm({
15118
15117
  const validatedPrev = sqliteSchema.parse(prev);
15119
15118
  const validatedCur = sqliteSchema.parse(cur);
15120
15119
  if (config.custom) {
15121
- writeResult({
15122
- cur: custom,
15123
- sqlStatements: [],
15120
+ writeResult(
15121
+ custom,
15122
+ [],
15124
15123
  journal,
15124
+ {
15125
+ columns: {},
15126
+ schemas: {},
15127
+ tables: {}
15128
+ },
15125
15129
  outFolder,
15126
- breakpoints: config.breakpoints,
15127
- bundle: config.bundle,
15128
- type: "custom"
15129
- });
15130
+ config.breakpoints,
15131
+ "custom"
15132
+ );
15130
15133
  return;
15131
15134
  }
15132
15135
  const squashedPrev = squashSqliteScheme(validatedPrev);
@@ -15136,15 +15139,14 @@ var init_migrate = __esm({
15136
15139
  squashedCur,
15137
15140
  "sqlite"
15138
15141
  );
15139
- writeResult({
15142
+ writeResult(
15140
15143
  cur,
15141
15144
  sqlStatements,
15142
15145
  journal,
15143
15146
  _meta,
15144
15147
  outFolder,
15145
- breakpoints: config.breakpoints,
15146
- bundle: config.bundle
15147
- });
15148
+ config.breakpoints
15149
+ );
15148
15150
  } catch (e) {
15149
15151
  console.error(e);
15150
15152
  }
@@ -15332,20 +15334,7 @@ var init_migrate = __esm({
15332
15334
  return result;
15333
15335
  };
15334
15336
  BREAKPOINT = "--> statement-breakpoint\n";
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
- }) => {
15337
+ writeResult = (cur, sqlStatements, journal, _meta, outFolder, breakpoints, type = "none") => {
15349
15338
  if (type === "none") {
15350
15339
  console.log(schema(cur));
15351
15340
  if (sqlStatements.length === 0) {
@@ -15386,10 +15375,6 @@ ${sql2}
15386
15375
  });
15387
15376
  import_fs4.default.writeFileSync(metaJournal, JSON.stringify(journal, null, 2));
15388
15377
  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
- }
15393
15378
  (0, import_hanji3.render)(
15394
15379
  `[${source_default.green(
15395
15380
  "\u2713"
@@ -15398,22 +15383,6 @@ ${sql2}
15398
15383
  )} \u{1F680}`
15399
15384
  );
15400
15385
  };
15401
- embeddedMigrations = (journal) => {
15402
- let content = "import journal from './meta/_journal.json';\n";
15403
- journal.entries.forEach((entry) => {
15404
- content += `import m${entry.idx.toString().padStart(4, "0")} from './${entry.tag}.sql';
15405
- `;
15406
- });
15407
- content += `
15408
- export default {
15409
- journal,
15410
- migrations: {
15411
- ${journal.entries.map((it) => `m${it.idx.toString().padStart(4, "0")}`).join(",\n")}
15412
- }
15413
- }
15414
- `;
15415
- return content;
15416
- };
15417
15386
  prepareSnapshotFolderName = () => {
15418
15387
  const now = /* @__PURE__ */ new Date();
15419
15388
  return `${now.getFullYear()}${two(now.getUTCMonth() + 1)}${two(
@@ -22357,15 +22326,15 @@ var require_pg_connection_string = __commonJS({
22357
22326
  if (config.sslcert || config.sslkey || config.sslrootcert || config.sslmode) {
22358
22327
  config.ssl = {};
22359
22328
  }
22360
- const fs9 = config.sslcert || config.sslkey || config.sslrootcert ? require("fs") : null;
22329
+ const fs8 = config.sslcert || config.sslkey || config.sslrootcert ? require("fs") : null;
22361
22330
  if (config.sslcert) {
22362
- config.ssl.cert = fs9.readFileSync(config.sslcert).toString();
22331
+ config.ssl.cert = fs8.readFileSync(config.sslcert).toString();
22363
22332
  }
22364
22333
  if (config.sslkey) {
22365
- config.ssl.key = fs9.readFileSync(config.sslkey).toString();
22334
+ config.ssl.key = fs8.readFileSync(config.sslkey).toString();
22366
22335
  }
22367
22336
  if (config.sslrootcert) {
22368
- config.ssl.ca = fs9.readFileSync(config.sslrootcert).toString();
22337
+ config.ssl.ca = fs8.readFileSync(config.sslrootcert).toString();
22369
22338
  }
22370
22339
  switch (config.sslmode) {
22371
22340
  case "disable": {
@@ -24149,15 +24118,15 @@ var require_lib = __commonJS({
24149
24118
  "node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js"(exports, module2) {
24150
24119
  "use strict";
24151
24120
  var path4 = require("path");
24152
- var fs9 = require("fs");
24121
+ var fs8 = require("fs");
24153
24122
  var helper = require_helper();
24154
24123
  module2.exports = function(connInfo, cb) {
24155
24124
  var file = helper.getFileName();
24156
- fs9.stat(file, function(err2, stat) {
24125
+ fs8.stat(file, function(err2, stat) {
24157
24126
  if (err2 || !helper.usePgPass(stat, file)) {
24158
24127
  return cb(void 0);
24159
24128
  }
24160
- var st = fs9.createReadStream(file);
24129
+ var st = fs8.createReadStream(file);
24161
24130
  helper.getPassword(connInfo, st, cb);
24162
24131
  });
24163
24132
  };
@@ -44902,7 +44871,7 @@ var require_windows = __commonJS({
44902
44871
  "node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module2) {
44903
44872
  module2.exports = isexe;
44904
44873
  isexe.sync = sync2;
44905
- var fs9 = require("fs");
44874
+ var fs8 = require("fs");
44906
44875
  function checkPathExt(path4, options) {
44907
44876
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
44908
44877
  if (!pathext) {
@@ -44927,12 +44896,12 @@ var require_windows = __commonJS({
44927
44896
  return checkPathExt(path4, options);
44928
44897
  }
44929
44898
  function isexe(path4, options, cb) {
44930
- fs9.stat(path4, function(er, stat) {
44899
+ fs8.stat(path4, function(er, stat) {
44931
44900
  cb(er, er ? false : checkStat(stat, path4, options));
44932
44901
  });
44933
44902
  }
44934
44903
  function sync2(path4, options) {
44935
- return checkStat(fs9.statSync(path4), path4, options);
44904
+ return checkStat(fs8.statSync(path4), path4, options);
44936
44905
  }
44937
44906
  }
44938
44907
  });
@@ -44942,14 +44911,14 @@ var require_mode = __commonJS({
44942
44911
  "node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module2) {
44943
44912
  module2.exports = isexe;
44944
44913
  isexe.sync = sync2;
44945
- var fs9 = require("fs");
44914
+ var fs8 = require("fs");
44946
44915
  function isexe(path4, options, cb) {
44947
- fs9.stat(path4, function(er, stat) {
44916
+ fs8.stat(path4, function(er, stat) {
44948
44917
  cb(er, er ? false : checkStat(stat, options));
44949
44918
  });
44950
44919
  }
44951
44920
  function sync2(path4, options) {
44952
- return checkStat(fs9.statSync(path4), options);
44921
+ return checkStat(fs8.statSync(path4), options);
44953
44922
  }
44954
44923
  function checkStat(stat, options) {
44955
44924
  return stat.isFile() && checkMode(stat, options);
@@ -44973,7 +44942,7 @@ var require_mode = __commonJS({
44973
44942
  // node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
44974
44943
  var require_isexe = __commonJS({
44975
44944
  "node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
44976
- var fs9 = require("fs");
44945
+ var fs8 = require("fs");
44977
44946
  var core;
44978
44947
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
44979
44948
  core = require_windows();
@@ -49916,8 +49885,8 @@ var require_utils6 = __commonJS({
49916
49885
  exports.array = array;
49917
49886
  var errno = require_errno();
49918
49887
  exports.errno = errno;
49919
- var fs9 = require_fs();
49920
- exports.fs = fs9;
49888
+ var fs8 = require_fs();
49889
+ exports.fs = fs8;
49921
49890
  var path4 = require_path();
49922
49891
  exports.path = path4;
49923
49892
  var pattern = require_pattern();
@@ -50101,12 +50070,12 @@ var require_fs2 = __commonJS({
50101
50070
  "use strict";
50102
50071
  Object.defineProperty(exports, "__esModule", { value: true });
50103
50072
  exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
50104
- var fs9 = require("fs");
50073
+ var fs8 = require("fs");
50105
50074
  exports.FILE_SYSTEM_ADAPTER = {
50106
- lstat: fs9.lstat,
50107
- stat: fs9.stat,
50108
- lstatSync: fs9.lstatSync,
50109
- statSync: fs9.statSync
50075
+ lstat: fs8.lstat,
50076
+ stat: fs8.stat,
50077
+ lstatSync: fs8.lstatSync,
50078
+ statSync: fs8.statSync
50110
50079
  };
50111
50080
  function createFileSystemAdapter(fsMethods) {
50112
50081
  if (fsMethods === void 0) {
@@ -50123,12 +50092,12 @@ var require_settings = __commonJS({
50123
50092
  "node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js"(exports) {
50124
50093
  "use strict";
50125
50094
  Object.defineProperty(exports, "__esModule", { value: true });
50126
- var fs9 = require_fs2();
50095
+ var fs8 = require_fs2();
50127
50096
  var Settings = class {
50128
50097
  constructor(_options = {}) {
50129
50098
  this._options = _options;
50130
50099
  this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
50131
- this.fs = fs9.createFileSystemAdapter(this._options.fs);
50100
+ this.fs = fs8.createFileSystemAdapter(this._options.fs);
50132
50101
  this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
50133
50102
  this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
50134
50103
  }
@@ -50286,8 +50255,8 @@ var require_utils7 = __commonJS({
50286
50255
  "use strict";
50287
50256
  Object.defineProperty(exports, "__esModule", { value: true });
50288
50257
  exports.fs = void 0;
50289
- var fs9 = require_fs3();
50290
- exports.fs = fs9;
50258
+ var fs8 = require_fs3();
50259
+ exports.fs = fs8;
50291
50260
  }
50292
50261
  });
50293
50262
 
@@ -50482,14 +50451,14 @@ var require_fs4 = __commonJS({
50482
50451
  "use strict";
50483
50452
  Object.defineProperty(exports, "__esModule", { value: true });
50484
50453
  exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
50485
- var fs9 = require("fs");
50454
+ var fs8 = require("fs");
50486
50455
  exports.FILE_SYSTEM_ADAPTER = {
50487
- lstat: fs9.lstat,
50488
- stat: fs9.stat,
50489
- lstatSync: fs9.lstatSync,
50490
- statSync: fs9.statSync,
50491
- readdir: fs9.readdir,
50492
- readdirSync: fs9.readdirSync
50456
+ lstat: fs8.lstat,
50457
+ stat: fs8.stat,
50458
+ lstatSync: fs8.lstatSync,
50459
+ statSync: fs8.statSync,
50460
+ readdir: fs8.readdir,
50461
+ readdirSync: fs8.readdirSync
50493
50462
  };
50494
50463
  function createFileSystemAdapter(fsMethods) {
50495
50464
  if (fsMethods === void 0) {
@@ -50508,12 +50477,12 @@ var require_settings2 = __commonJS({
50508
50477
  Object.defineProperty(exports, "__esModule", { value: true });
50509
50478
  var path4 = require("path");
50510
50479
  var fsStat = require_out();
50511
- var fs9 = require_fs4();
50480
+ var fs8 = require_fs4();
50512
50481
  var Settings = class {
50513
50482
  constructor(_options = {}) {
50514
50483
  this._options = _options;
50515
50484
  this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
50516
- this.fs = fs9.createFileSystemAdapter(this._options.fs);
50485
+ this.fs = fs8.createFileSystemAdapter(this._options.fs);
50517
50486
  this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path4.sep);
50518
50487
  this.stats = this._getValue(this._options.stats, false);
50519
50488
  this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
@@ -51829,16 +51798,16 @@ var require_settings4 = __commonJS({
51829
51798
  "use strict";
51830
51799
  Object.defineProperty(exports, "__esModule", { value: true });
51831
51800
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
51832
- var fs9 = require("fs");
51801
+ var fs8 = require("fs");
51833
51802
  var os2 = require("os");
51834
51803
  var CPU_COUNT = Math.max(os2.cpus().length, 1);
51835
51804
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
51836
- lstat: fs9.lstat,
51837
- lstatSync: fs9.lstatSync,
51838
- stat: fs9.stat,
51839
- statSync: fs9.statSync,
51840
- readdir: fs9.readdir,
51841
- readdirSync: fs9.readdirSync
51805
+ lstat: fs8.lstat,
51806
+ lstatSync: fs8.lstatSync,
51807
+ stat: fs8.stat,
51808
+ statSync: fs8.statSync,
51809
+ readdir: fs8.readdir,
51810
+ readdirSync: fs8.readdirSync
51842
51811
  };
51843
51812
  var Settings = class {
51844
51813
  constructor(_options = {}) {
@@ -51989,13 +51958,13 @@ var require_path_type = __commonJS({
51989
51958
  "node_modules/.pnpm/path-type@4.0.0/node_modules/path-type/index.js"(exports) {
51990
51959
  "use strict";
51991
51960
  var { promisify: promisify2 } = require("util");
51992
- var fs9 = require("fs");
51961
+ var fs8 = require("fs");
51993
51962
  async function isType(fsStatType, statsMethodName, filePath) {
51994
51963
  if (typeof filePath !== "string") {
51995
51964
  throw new TypeError(`Expected a string, got ${typeof filePath}`);
51996
51965
  }
51997
51966
  try {
51998
- const stats = await promisify2(fs9[fsStatType])(filePath);
51967
+ const stats = await promisify2(fs8[fsStatType])(filePath);
51999
51968
  return stats[statsMethodName]();
52000
51969
  } catch (error2) {
52001
51970
  if (error2.code === "ENOENT") {
@@ -52009,7 +51978,7 @@ var require_path_type = __commonJS({
52009
51978
  throw new TypeError(`Expected a string, got ${typeof filePath}`);
52010
51979
  }
52011
51980
  try {
52012
- return fs9[fsStatType](filePath)[statsMethodName]();
51981
+ return fs8[fsStatType](filePath)[statsMethodName]();
52013
51982
  } catch (error2) {
52014
51983
  if (error2.code === "ENOENT") {
52015
51984
  return false;
@@ -59688,14 +59657,14 @@ var require_parser2 = __commonJS({
59688
59657
  case "scalar":
59689
59658
  case "single-quoted-scalar":
59690
59659
  case "double-quoted-scalar": {
59691
- const fs9 = this.flowScalar(this.type);
59660
+ const fs8 = this.flowScalar(this.type);
59692
59661
  if (atNextItem || it.value) {
59693
- map.items.push({ start, key: fs9, sep: [] });
59662
+ map.items.push({ start, key: fs8, sep: [] });
59694
59663
  this.onKeyLine = true;
59695
59664
  } else if (it.sep) {
59696
- this.stack.push(fs9);
59665
+ this.stack.push(fs8);
59697
59666
  } else {
59698
- Object.assign(it, { key: fs9, sep: [] });
59667
+ Object.assign(it, { key: fs8, sep: [] });
59699
59668
  this.onKeyLine = true;
59700
59669
  }
59701
59670
  return;
@@ -59814,13 +59783,13 @@ var require_parser2 = __commonJS({
59814
59783
  case "scalar":
59815
59784
  case "single-quoted-scalar":
59816
59785
  case "double-quoted-scalar": {
59817
- const fs9 = this.flowScalar(this.type);
59786
+ const fs8 = this.flowScalar(this.type);
59818
59787
  if (!it || it.value)
59819
- fc.items.push({ start: [], key: fs9, sep: [] });
59788
+ fc.items.push({ start: [], key: fs8, sep: [] });
59820
59789
  else if (it.sep)
59821
- this.stack.push(fs9);
59790
+ this.stack.push(fs8);
59822
59791
  else
59823
- Object.assign(it, { key: fs9, sep: [] });
59792
+ Object.assign(it, { key: fs8, sep: [] });
59824
59793
  return;
59825
59794
  }
59826
59795
  case "flow-map-end":
@@ -60371,8 +60340,8 @@ var init_studioUtils = __esm({
60371
60340
  };
60372
60341
  };
60373
60342
  drizzleForSQLite = async (config, sqliteSchema2, relations4, ts, verbose) => {
60374
- const { driver: driver2, dbCredentials: creds } = config;
60375
- if (driver2 === "d1") {
60343
+ const { driver, dbCredentials: creds } = config;
60344
+ if (driver === "d1") {
60376
60345
  const { drizzle: drizzle2 } = await Promise.resolve().then(() => (init_driver(), driver_exports));
60377
60346
  const { execute: execute2 } = await Promise.resolve().then(() => (init_wrangler_client(), wrangler_client_exports));
60378
60347
  const db = drizzle2(execute2, creds.wranglerConfigPath, creds.dbName, {
@@ -60390,7 +60359,7 @@ var init_studioUtils = __esm({
60390
60359
  ts
60391
60360
  };
60392
60361
  }
60393
- if (driver2 === "better-sqlite") {
60362
+ if (driver === "better-sqlite") {
60394
60363
  assertPackages("better-sqlite3");
60395
60364
  const { drizzle: drizzle2 } = await import("drizzle-orm/better-sqlite3");
60396
60365
  const Database = await import("better-sqlite3");
@@ -60409,7 +60378,7 @@ var init_studioUtils = __esm({
60409
60378
  ts
60410
60379
  };
60411
60380
  }
60412
- if (driver2 === "libsql" || driver2 === "turso") {
60381
+ if (driver === "libsql" || driver === "turso") {
60413
60382
  assertPackages("@libsql/client");
60414
60383
  const { drizzle: drizzle2 } = await import("drizzle-orm/libsql");
60415
60384
  const { createClient } = await import("@libsql/client");
@@ -60433,7 +60402,7 @@ var init_studioUtils = __esm({
60433
60402
  ts
60434
60403
  };
60435
60404
  }
60436
- assertUnreachable(driver2);
60405
+ assertUnreachable(driver);
60437
60406
  };
60438
60407
  drizzleDb = async (drizzleConfig, models, logger) => {
60439
60408
  if (drizzleConfig.driver === "pg") {
@@ -61147,8 +61116,8 @@ var init_mysql = __esm({
61147
61116
  mysqlConnectionConfig
61148
61117
  );
61149
61118
  printCliConnectionIssues3 = (options) => {
61150
- const { driver: driver2, uri, host, database } = options || {};
61151
- if (driver2 !== "mysql2") {
61119
+ const { driver, uri, host, database } = options || {};
61120
+ if (driver !== "mysql2") {
61152
61121
  console.log(outputs.mysql.connection.driver());
61153
61122
  }
61154
61123
  if (!uri && (!host || !database)) {
@@ -61187,7 +61156,7 @@ var init_mysql = __esm({
61187
61156
  const {
61188
61157
  out,
61189
61158
  schema: schema4,
61190
- driver: driver2,
61159
+ driver,
61191
61160
  schemaFilter,
61192
61161
  tablesFilter,
61193
61162
  breakpoints,
@@ -61197,7 +61166,7 @@ var init_mysql = __esm({
61197
61166
  return {
61198
61167
  out,
61199
61168
  schema: schema4,
61200
- driver: driver2,
61169
+ driver,
61201
61170
  schemaFilter,
61202
61171
  tablesFilter,
61203
61172
  breakpoints,
@@ -61233,13 +61202,13 @@ var init_mysql = __esm({
61233
61202
  strict,
61234
61203
  verbose,
61235
61204
  schema: schema4,
61236
- driver: driver2,
61205
+ driver,
61237
61206
  schemaFilter,
61238
61207
  tablesFilter,
61239
61208
  ...rest
61240
61209
  } = cliRes.data;
61241
61210
  return {
61242
- driver: driver2,
61211
+ driver,
61243
61212
  schema: schema4,
61244
61213
  strict,
61245
61214
  verbose,
@@ -61320,7 +61289,7 @@ var require_package = __commonJS({
61320
61289
  // node_modules/.pnpm/dotenv@16.0.3/node_modules/dotenv/lib/main.js
61321
61290
  var require_main = __commonJS({
61322
61291
  "node_modules/.pnpm/dotenv@16.0.3/node_modules/dotenv/lib/main.js"(exports, module2) {
61323
- var fs9 = require("fs");
61292
+ var fs8 = require("fs");
61324
61293
  var path4 = require("path");
61325
61294
  var os2 = require("os");
61326
61295
  var packageJson = require_package();
@@ -61365,7 +61334,7 @@ var require_main = __commonJS({
61365
61334
  }
61366
61335
  }
61367
61336
  try {
61368
- const parsed = DotenvModule.parse(fs9.readFileSync(dotenvPath, { encoding }));
61337
+ const parsed = DotenvModule.parse(fs8.readFileSync(dotenvPath, { encoding }));
61369
61338
  Object.keys(parsed).forEach(function(key) {
61370
61339
  if (!Object.prototype.hasOwnProperty.call(process.env, key)) {
61371
61340
  process.env[key] = parsed[key];
@@ -62159,7 +62128,7 @@ __export(cli_exports, {
62159
62128
  });
62160
62129
  module.exports = __toCommonJS(cli_exports);
62161
62130
  var import_commander = require("commander");
62162
- var import_fs12 = require("fs");
62131
+ var import_fs11 = require("fs");
62163
62132
  init_lib();
62164
62133
 
62165
62134
  // src/cli/commands/check.ts
@@ -62400,8 +62369,6 @@ var import_fs10 = require("fs");
62400
62369
  var import_hanji8 = __toESM(require_hanji());
62401
62370
  var import_path6 = require("path");
62402
62371
  init_views();
62403
- init_migrate();
62404
- var import_fs11 = __toESM(require("fs"));
62405
62372
  var dropMigration = async (out) => {
62406
62373
  const metaFilePath = (0, import_path6.join)(out, "meta", "_journal.json");
62407
62374
  const journal = JSON.parse(
@@ -62424,7 +62391,6 @@ var dropMigration = async (out) => {
62424
62391
  (0, import_fs10.rmSync)(sqlFilePath);
62425
62392
  (0, import_fs10.rmSync)(snapshotFilePath);
62426
62393
  (0, import_fs10.writeFileSync)(metaFilePath, JSON.stringify(resultJournal));
62427
- import_fs11.default.writeFileSync((0, import_path6.join)(out, `migrations.js`), embeddedMigrations(resultJournal));
62428
62394
  console.log(`[${source_default.green("\u2713")}] ${source_default.bold(result.data.tag)} migration successfully dropped`);
62429
62395
  };
62430
62396
 
@@ -63514,7 +63480,7 @@ var introspectPgCommand = new import_commander.Command("introspect:pg").option("
63514
63480
  schemasFilter
63515
63481
  );
63516
63482
  const schemaFile = import_path7.default.join(validatedConfig.out, "schema.ts");
63517
- (0, import_fs12.writeFileSync)(schemaFile, ts.file);
63483
+ (0, import_fs11.writeFileSync)(schemaFile, ts.file);
63518
63484
  console.log();
63519
63485
  if (snapshots.length === 0) {
63520
63486
  const { sqlStatements, _meta } = await prepareSQL(
@@ -63567,7 +63533,7 @@ var introspectMySqlCommand = new import_commander.Command("introspect:mysql").op
63567
63533
  const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
63568
63534
  const { schema: schema4, ts } = await mysqlIntrospect2(res, tablesFilter);
63569
63535
  const schemaFile = import_path7.default.join(out, "schema.ts");
63570
- (0, import_fs12.writeFileSync)(schemaFile, ts.file);
63536
+ (0, import_fs11.writeFileSync)(schemaFile, ts.file);
63571
63537
  console.log();
63572
63538
  if (snapshots.length === 0) {
63573
63539
  const { sqlStatements, _meta } = await prepareSQL(
@@ -63620,7 +63586,7 @@ var introspectSQLiteCommand = new import_commander.Command("introspect:sqlite").
63620
63586
  const tablesFilter = filterConfig ? typeof filterConfig === "string" ? [filterConfig] : filterConfig : [];
63621
63587
  const { schema: schema4, ts } = await sqliteIntrospect2(res, tablesFilter);
63622
63588
  const schemaFile = import_path7.default.join(out, "schema.ts");
63623
- (0, import_fs12.writeFileSync)(schemaFile, ts.file);
63589
+ (0, import_fs11.writeFileSync)(schemaFile, ts.file);
63624
63590
  console.log();
63625
63591
  if (snapshots.length === 0) {
63626
63592
  const { sqlStatements, _meta } = await prepareSQL(
@@ -63685,9 +63651,9 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
63685
63651
  prepareSQLiteSchema: prepareSQLiteSchema2,
63686
63652
  drizzleForSQLite: drizzleForSQLite2
63687
63653
  } = await Promise.resolve().then(() => (init_studioUtils(), studioUtils_exports));
63688
- const { driver: driver2, schema: schemaPath } = drizzleConfig;
63654
+ const { driver, schema: schemaPath } = drizzleConfig;
63689
63655
  let setup;
63690
- if (driver2 === "pg") {
63656
+ if (driver === "pg") {
63691
63657
  const { schemaToTypeScript: schemaToTypeScript4, relationsToTypeScript: relationsToTypeScript2 } = await Promise.resolve().then(() => (init_introspect_pg(), introspect_pg_exports));
63692
63658
  const { serializePg: serializePg2 } = await Promise.resolve().then(() => (init_serializer(), serializer_exports));
63693
63659
  const { schema: schema4, relations: relations4 } = await preparePgSchema2(schemaPath);
@@ -63705,7 +63671,7 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
63705
63671
  },
63706
63672
  Boolean(options.verbose)
63707
63673
  );
63708
- } else if (driver2 === "mysql2") {
63674
+ } else if (driver === "mysql2") {
63709
63675
  const { schemaToTypeScript: schemaToTypeScript4 } = await Promise.resolve().then(() => (init_introspect_mysql(), introspect_mysql_exports));
63710
63676
  const { schema: schema4, relations: relations4 } = await prepareMySqlSchema2(schemaPath);
63711
63677
  const { serializeMySql: serializeMySql2 } = await Promise.resolve().then(() => (init_serializer(), serializer_exports));
@@ -63722,7 +63688,7 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
63722
63688
  },
63723
63689
  Boolean(options.verbose)
63724
63690
  );
63725
- } else if (driver2 === "better-sqlite" || driver2 === "d1" || driver2 === "libsql" || driver2 === "turso") {
63691
+ } else if (driver === "better-sqlite" || driver === "d1" || driver === "libsql" || driver === "turso") {
63726
63692
  const { schemaToTypeScript: schemaToTypeScript4 } = await Promise.resolve().then(() => (init_introspect_sqlite(), introspect_sqlite_exports));
63727
63693
  const { schema: schema4, relations: relations4 } = await prepareSQLiteSchema2(schemaPath);
63728
63694
  const { serializeSQLite: serializeSQLite2 } = await Promise.resolve().then(() => (init_serializer(), serializer_exports));
@@ -63740,7 +63706,7 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
63740
63706
  Boolean(options.verbose)
63741
63707
  );
63742
63708
  } else {
63743
- assertUnreachable(driver2);
63709
+ assertUnreachable(driver);
63744
63710
  }
63745
63711
  const qeueryEngine = (0, import_studio.queryEngineForSetup)(setup);
63746
63712
  const server = await (0, import_server.prepareServer)((_2) => {
@@ -63754,7 +63720,7 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
63754
63720
  "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"
63755
63721
  )
63756
63722
  );
63757
- if (driver2 === "d1") {
63723
+ if (driver === "d1") {
63758
63724
  console.log(
63759
63725
  withStyle.fullWarning(
63760
63726
  "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"
@@ -256,15 +256,5 @@ export declare const prepareSQL: (prev: CommonSquashedSchema, cur: CommonSquashe
256
256
  } | undefined;
257
257
  }>;
258
258
  export declare const BREAKPOINT = "--> statement-breakpoint\n";
259
- export declare const writeResult: ({ cur, sqlStatements, journal, _meta, outFolder, breakpoints, bundle, type, }: {
260
- cur: CommonSchema;
261
- sqlStatements: string[];
262
- journal: Journal;
263
- _meta?: any;
264
- outFolder: string;
265
- breakpoints: boolean;
266
- bundle?: boolean | undefined;
267
- type?: "none" | "custom" | "introspect" | undefined;
268
- }) => void;
269
- export declare const embeddedMigrations: (journal: Journal) => string;
259
+ export declare const writeResult: (cur: CommonSchema, sqlStatements: string[], journal: Journal, _meta: any, outFolder: string, breakpoints: boolean, type?: "introspect" | "custom" | "none") => void;
270
260
  export declare const prepareSnapshotFolderName: () => string;
@@ -7,7 +7,6 @@ export type GenerateConfig = {
7
7
  out: string;
8
8
  breakpoints: boolean;
9
9
  custom: boolean;
10
- bundle: boolean;
11
10
  };
12
11
  export declare const prepareGenerateConfig: (options: {
13
12
  schema?: string | string[];
@@ -21,17 +20,14 @@ export declare const assertOutFolder: (it: {
21
20
  } | {
22
21
  out: string;
23
22
  }) => Promise<string>;
24
- export declare const driver: import("zod").ZodUnion<[import("zod").ZodLiteral<"better-sqlite">, import("zod").ZodLiteral<"turso">, import("zod").ZodLiteral<"libsql">, import("zod").ZodLiteral<"d1">, import("zod").ZodLiteral<"expo">, import("zod").ZodLiteral<"pg">, import("zod").ZodLiteral<"mysql2">]>;
25
23
  export declare const configCommonSchema: import("zod").ZodObject<{
26
24
  schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
27
25
  out: import("zod").ZodOptional<import("zod").ZodString>;
28
26
  breakpoints: import("zod").ZodDefault<import("zod").ZodBoolean>;
29
- driver: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodLiteral<"better-sqlite">, import("zod").ZodLiteral<"turso">, import("zod").ZodLiteral<"libsql">, import("zod").ZodLiteral<"d1">, import("zod").ZodLiteral<"expo">, import("zod").ZodLiteral<"pg">, import("zod").ZodLiteral<"mysql2">]>>;
30
27
  tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
31
28
  schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
32
29
  }, "strip", import("zod").ZodTypeAny, {
33
30
  out?: string | undefined;
34
- driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
35
31
  tablesFilter?: string | string[] | undefined;
36
32
  schema: string | string[];
37
33
  breakpoints: boolean;
@@ -39,7 +35,6 @@ export declare const configCommonSchema: import("zod").ZodObject<{
39
35
  }, {
40
36
  out?: string | undefined;
41
37
  breakpoints?: boolean | undefined;
42
- driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
43
38
  tablesFilter?: string | string[] | undefined;
44
39
  schemaFilter?: string | string[] | undefined;
45
40
  schema: string | string[];
@@ -169,12 +164,10 @@ export declare const mySqlCliConfigSchema: import("zod").ZodIntersection<import(
169
164
  schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
170
165
  out: import("zod").ZodOptional<import("zod").ZodString>;
171
166
  breakpoints: import("zod").ZodDefault<import("zod").ZodBoolean>;
172
- driver: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodLiteral<"better-sqlite">, import("zod").ZodLiteral<"turso">, import("zod").ZodLiteral<"libsql">, import("zod").ZodLiteral<"d1">, import("zod").ZodLiteral<"expo">, import("zod").ZodLiteral<"pg">, import("zod").ZodLiteral<"mysql2">]>>;
173
167
  tablesFilter: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
174
168
  schemaFilter: import("zod").ZodDefault<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>>;
175
169
  }, "strip", import("zod").ZodTypeAny, {
176
170
  out?: string | undefined;
177
- driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
178
171
  tablesFilter?: string | string[] | undefined;
179
172
  schema: string | string[];
180
173
  breakpoints: boolean;
@@ -182,7 +175,6 @@ export declare const mySqlCliConfigSchema: import("zod").ZodIntersection<import(
182
175
  }, {
183
176
  out?: string | undefined;
184
177
  breakpoints?: boolean | undefined;
185
- driver?: "turso" | "better-sqlite" | "libsql" | "d1" | "pg" | "mysql2" | "expo" | undefined;
186
178
  tablesFilter?: string | string[] | undefined;
187
179
  schemaFilter?: string | string[] | undefined;
188
180
  schema: string | string[];
@@ -269,6 +261,5 @@ export declare const mySqlIntrospectConfigSchema: import("zod").ZodIntersection<
269
261
  }>, import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>]>>;
270
262
  export type MySqlCliConfig = TypeOf<typeof mySqlCliConfigSchema>;
271
263
  export type CliConfig = MySqlCliConfig;
272
- export type Driver = TypeOf<typeof driver>;
273
264
  export declare const drizzleConfigFromFile: (configPath?: string) => Promise<CliConfig>;
274
265
  export declare const readDrizzleConfig: (configPath?: string) => Promise<any>;
@@ -9,17 +9,17 @@ export declare const mysqlConnectionCli: import("zod").ZodUnion<[import("zod").Z
9
9
  }, "strip", import("zod").ZodTypeAny, {
10
10
  port?: number | undefined;
11
11
  password?: string | undefined;
12
- driver: "mysql2";
13
12
  host: string;
14
13
  user: string;
15
14
  database: string;
15
+ driver: "mysql2";
16
16
  }, {
17
17
  port?: number | undefined;
18
18
  user?: string | undefined;
19
19
  password?: string | undefined;
20
- driver: "mysql2";
21
20
  host: string;
22
21
  database: string;
22
+ driver: "mysql2";
23
23
  }>, import("zod").ZodObject<{
24
24
  driver: import("zod").ZodLiteral<"mysql2">;
25
25
  uri: import("zod").ZodString;
@@ -217,17 +217,17 @@ export declare const mysqlCliIntrospectParams: import("zod").ZodIntersection<imp
217
217
  }, "strip", import("zod").ZodTypeAny, {
218
218
  port?: number | undefined;
219
219
  password?: string | undefined;
220
- driver: "mysql2";
221
220
  host: string;
222
221
  user: string;
223
222
  database: string;
223
+ driver: "mysql2";
224
224
  }, {
225
225
  port?: number | undefined;
226
226
  user?: string | undefined;
227
227
  password?: string | undefined;
228
- driver: "mysql2";
229
228
  host: string;
230
229
  database: string;
230
+ driver: "mysql2";
231
231
  }>, import("zod").ZodObject<{
232
232
  driver: import("zod").ZodLiteral<"mysql2">;
233
233
  uri: import("zod").ZodString;
@@ -266,17 +266,17 @@ export declare const mysqlCliPushParams: import("zod").ZodIntersection<import("z
266
266
  }, "strip", import("zod").ZodTypeAny, {
267
267
  port?: number | undefined;
268
268
  password?: string | undefined;
269
- driver: "mysql2";
270
269
  host: string;
271
270
  user: string;
272
271
  database: string;
272
+ driver: "mysql2";
273
273
  }, {
274
274
  port?: number | undefined;
275
275
  user?: string | undefined;
276
276
  password?: string | undefined;
277
- driver: "mysql2";
278
277
  host: string;
279
278
  database: string;
279
+ driver: "mysql2";
280
280
  }>, import("zod").ZodObject<{
281
281
  driver: import("zod").ZodLiteral<"mysql2">;
282
282
  uri: import("zod").ZodString;
@@ -13,31 +13,31 @@ export declare const pgConnectionCli: import("zod").ZodUnion<[import("zod").ZodO
13
13
  password?: string | undefined;
14
14
  ssl?: boolean | undefined;
15
15
  type: "params";
16
- driver: "pg";
17
16
  host: string;
18
17
  user: string;
19
18
  database: string;
19
+ driver: "pg";
20
20
  }, {
21
21
  type?: "params" | undefined;
22
22
  port?: number | undefined;
23
23
  user?: string | undefined;
24
24
  password?: string | undefined;
25
25
  ssl?: boolean | undefined;
26
- driver: "pg";
27
26
  host: string;
28
27
  database: string;
28
+ driver: "pg";
29
29
  }>, import("zod").ZodObject<{
30
30
  driver: import("zod").ZodLiteral<"pg">;
31
31
  connectionString: import("zod").ZodString;
32
32
  type: import("zod").ZodDefault<import("zod").ZodLiteral<"url">>;
33
33
  }, "strip", import("zod").ZodTypeAny, {
34
34
  type: "url";
35
- driver: "pg";
36
35
  connectionString: string;
36
+ driver: "pg";
37
37
  }, {
38
38
  type?: "url" | undefined;
39
- driver: "pg";
40
39
  connectionString: string;
40
+ driver: "pg";
41
41
  }>]>;
42
42
  export declare const pgConnectionConfig: import("zod").ZodUnion<[import("zod").ZodObject<{
43
43
  driver: import("zod").ZodLiteral<"pg">;
@@ -253,31 +253,31 @@ export declare const pgCliIntrospectParams: import("zod").ZodIntersection<import
253
253
  password?: string | undefined;
254
254
  ssl?: boolean | undefined;
255
255
  type: "params";
256
- driver: "pg";
257
256
  host: string;
258
257
  user: string;
259
258
  database: string;
259
+ driver: "pg";
260
260
  }, {
261
261
  type?: "params" | undefined;
262
262
  port?: number | undefined;
263
263
  user?: string | undefined;
264
264
  password?: string | undefined;
265
265
  ssl?: boolean | undefined;
266
- driver: "pg";
267
266
  host: string;
268
267
  database: string;
268
+ driver: "pg";
269
269
  }>, import("zod").ZodObject<{
270
270
  driver: import("zod").ZodLiteral<"pg">;
271
271
  connectionString: import("zod").ZodString;
272
272
  type: import("zod").ZodDefault<import("zod").ZodLiteral<"url">>;
273
273
  }, "strip", import("zod").ZodTypeAny, {
274
274
  type: "url";
275
- driver: "pg";
276
275
  connectionString: string;
276
+ driver: "pg";
277
277
  }, {
278
278
  type?: "url" | undefined;
279
- driver: "pg";
280
279
  connectionString: string;
280
+ driver: "pg";
281
281
  }>]>>;
282
282
  export declare const pgCliPushParams: import("zod").ZodIntersection<import("zod").ZodObject<{
283
283
  schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
@@ -311,31 +311,31 @@ export declare const pgCliPushParams: import("zod").ZodIntersection<import("zod"
311
311
  password?: string | undefined;
312
312
  ssl?: boolean | undefined;
313
313
  type: "params";
314
- driver: "pg";
315
314
  host: string;
316
315
  user: string;
317
316
  database: string;
317
+ driver: "pg";
318
318
  }, {
319
319
  type?: "params" | undefined;
320
320
  port?: number | undefined;
321
321
  user?: string | undefined;
322
322
  password?: string | undefined;
323
323
  ssl?: boolean | undefined;
324
- driver: "pg";
325
324
  host: string;
326
325
  database: string;
326
+ driver: "pg";
327
327
  }>, import("zod").ZodObject<{
328
328
  driver: import("zod").ZodLiteral<"pg">;
329
329
  connectionString: import("zod").ZodString;
330
330
  type: import("zod").ZodDefault<import("zod").ZodLiteral<"url">>;
331
331
  }, "strip", import("zod").ZodTypeAny, {
332
332
  type: "url";
333
- driver: "pg";
334
333
  connectionString: string;
334
+ driver: "pg";
335
335
  }, {
336
336
  type?: "url" | undefined;
337
- driver: "pg";
338
337
  connectionString: string;
338
+ driver: "pg";
339
339
  }>]>>;
340
340
  export declare const pgConfigPushParams: import("zod").ZodIntersection<import("zod").ZodObject<{
341
341
  schema: import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString, "many">]>;
package/index.d.mts CHANGED
@@ -101,7 +101,5 @@ export type Config = {
101
101
  wranglerConfigPath: string;
102
102
  dbName: string;
103
103
  };
104
- } | {
105
- driver: "expo";
106
104
  } | {});
107
105
  export declare function defineConfig(config: Config): Config;
package/index.d.ts CHANGED
@@ -101,7 +101,5 @@ export type Config = {
101
101
  wranglerConfigPath: string;
102
102
  dbName: string;
103
103
  };
104
- } | {
105
- driver: "expo";
106
104
  } | {});
107
105
  export declare function defineConfig(config: Config): Config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.20.7-8d149c2",
3
+ "version": "0.20.7-c9519c9",
4
4
  "repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
5
5
  "author": "Drizzle Team",
6
6
  "license": "MIT",
package/utils.js CHANGED
@@ -11140,7 +11140,7 @@ var require_node2 = __commonJS({
11140
11140
  });
11141
11141
 
11142
11142
  // src/cli/commands/utils.ts
11143
- var import_hanji2, assertES5, safeRegister, driver, configCommonSchema, introspectCasing, configIntrospectSchema, configIntrospectCliSchema, configGenerateSchema, configPushSchema, mysqlConnectionSchema, mySqlCliConfigSchema, mySqlIntrospectConfigSchema;
11143
+ var import_hanji2, assertES5, safeRegister, configCommonSchema, introspectCasing, configIntrospectSchema, configIntrospectCliSchema, configGenerateSchema, configPushSchema, mysqlConnectionSchema, mySqlCliConfigSchema, mySqlIntrospectConfigSchema;
11144
11144
  var init_utils = __esm({
11145
11145
  "src/cli/commands/utils.ts"() {
11146
11146
  init_serializer();
@@ -11189,20 +11189,10 @@ var init_utils = __esm({
11189
11189
  await assertES5(res.unregister);
11190
11190
  return res;
11191
11191
  };
11192
- driver = unionType([
11193
- literalType("better-sqlite"),
11194
- literalType("turso"),
11195
- literalType("libsql"),
11196
- literalType("d1"),
11197
- literalType("expo"),
11198
- literalType("pg"),
11199
- literalType("mysql2")
11200
- ]);
11201
11192
  configCommonSchema = objectType({
11202
11193
  schema: unionType([stringType(), stringType().array()]),
11203
11194
  out: stringType().optional(),
11204
11195
  breakpoints: booleanType().default(true),
11205
- driver: driver.optional(),
11206
11196
  tablesFilter: unionType([stringType(), stringType().array()]).optional(),
11207
11197
  schemaFilter: unionType([stringType(), stringType().array()]).default(["public"])
11208
11198
  });
@@ -11731,9 +11721,9 @@ We have encountered a collision between the index name on columns ${source_defau
11731
11721
  }
11732
11722
  try {
11733
11723
  const fks = await db.execute(
11734
- `SELECT INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.COLUMN_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_NAME, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_COLUMN_NAME,information_schema.referential_constraints.UPDATE_RULE, information_schema.referential_constraints.DELETE_RULE
11724
+ `SELECT INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.COLUMN_NAME,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_SCHEMA,INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_NAME, INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_COLUMN_NAME,INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS.UPDATE_RULE, INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS.DELETE_RULE
11735
11725
  FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
11736
- LEFT JOIN information_schema.referential_constraints on information_schema.referential_constraints.constraint_name = information_schema.KEY_COLUMN_USAGE.CONSTRAINT_NAME
11726
+ LEFT JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS on INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS.CONSTRAINT_NAME = INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME
11737
11727
  WHERE INFORMATION_SCHEMA.KEY_COLUMN_USAGE.TABLE_SCHEMA = ? AND INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME != 'PRIMARY' and INFORMATION_SCHEMA.KEY_COLUMN_USAGE.REFERENCED_TABLE_NAME is not null;
11738
11728
  `,
11739
11729
  [inputSchema]
@@ -14632,7 +14622,6 @@ var init_words = __esm({
14632
14622
  var migrate_exports = {};
14633
14623
  __export(migrate_exports, {
14634
14624
  BREAKPOINT: () => BREAKPOINT,
14635
- embeddedMigrations: () => embeddedMigrations,
14636
14625
  prepareAndMigrateMySql: () => prepareAndMigrateMySql,
14637
14626
  prepareAndMigratePg: () => prepareAndMigratePg,
14638
14627
  prepareAndMigrateSqlite: () => prepareAndMigrateSqlite,
@@ -14643,7 +14632,7 @@ __export(migrate_exports, {
14643
14632
  prepareSnapshotFolderName: () => prepareSnapshotFolderName,
14644
14633
  writeResult: () => writeResult
14645
14634
  });
14646
- var import_fs3, import_path2, import_hanji3, prepareAndMigratePg, prepareMySQLPush, prepareSQLitePush, preparePgPush, prepareAndMigrateMySql, prepareAndMigrateSqlite, prepareSQL, promptColumnsConflicts, promptTablesConflict, promptSchemasConflict, BREAKPOINT, writeResult, embeddedMigrations, prepareSnapshotFolderName, two;
14635
+ var import_fs3, import_path2, import_hanji3, prepareAndMigratePg, prepareMySQLPush, prepareSQLitePush, preparePgPush, prepareAndMigrateMySql, prepareAndMigrateSqlite, prepareSQL, promptColumnsConflicts, promptTablesConflict, promptSchemasConflict, BREAKPOINT, writeResult, prepareSnapshotFolderName, two;
14647
14636
  var init_migrate = __esm({
14648
14637
  "src/cli/commands/migrate.ts"() {
14649
14638
  import_fs3 = __toESM(require("fs"));
@@ -14672,14 +14661,19 @@ var init_migrate = __esm({
14672
14661
  const validatedPrev = pgSchema.parse(prev);
14673
14662
  const validatedCur = pgSchema.parse(cur);
14674
14663
  if (config.custom) {
14675
- writeResult({
14676
- cur: custom,
14677
- sqlStatements: [],
14664
+ writeResult(
14665
+ custom,
14666
+ [],
14678
14667
  journal,
14668
+ {
14669
+ columns: {},
14670
+ schemas: {},
14671
+ tables: {}
14672
+ },
14679
14673
  outFolder,
14680
- breakpoints: config.breakpoints,
14681
- type: "custom"
14682
- });
14674
+ config.breakpoints,
14675
+ "custom"
14676
+ );
14683
14677
  return;
14684
14678
  }
14685
14679
  const squashedPrev = squashPgScheme(validatedPrev);
@@ -14691,13 +14685,14 @@ var init_migrate = __esm({
14691
14685
  validatedPrev,
14692
14686
  validatedCur
14693
14687
  );
14694
- writeResult({
14688
+ writeResult(
14695
14689
  cur,
14696
14690
  sqlStatements,
14697
14691
  journal,
14692
+ _meta,
14698
14693
  outFolder,
14699
- breakpoints: config.breakpoints
14700
- });
14694
+ config.breakpoints
14695
+ );
14701
14696
  } catch (e) {
14702
14697
  console.error(e);
14703
14698
  }
@@ -14791,14 +14786,19 @@ var init_migrate = __esm({
14791
14786
  const validatedPrev = mysqlSchema.parse(prev);
14792
14787
  const validatedCur = mysqlSchema.parse(cur);
14793
14788
  if (config.custom) {
14794
- writeResult({
14795
- cur: custom,
14796
- sqlStatements: [],
14789
+ writeResult(
14790
+ custom,
14791
+ [],
14797
14792
  journal,
14793
+ {
14794
+ columns: {},
14795
+ schemas: {},
14796
+ tables: {}
14797
+ },
14798
14798
  outFolder,
14799
- breakpoints: config.breakpoints,
14800
- type: "custom"
14801
- });
14799
+ config.breakpoints,
14800
+ "custom"
14801
+ );
14802
14802
  return;
14803
14803
  }
14804
14804
  const squashedPrev = squashMysqlScheme(validatedPrev);
@@ -14810,14 +14810,14 @@ var init_migrate = __esm({
14810
14810
  validatedPrev,
14811
14811
  validatedCur
14812
14812
  );
14813
- writeResult({
14813
+ writeResult(
14814
14814
  cur,
14815
14815
  sqlStatements,
14816
14816
  journal,
14817
14817
  _meta,
14818
14818
  outFolder,
14819
- breakpoints: config.breakpoints
14820
- });
14819
+ config.breakpoints
14820
+ );
14821
14821
  } catch (e) {
14822
14822
  console.error(e);
14823
14823
  }
@@ -14835,15 +14835,19 @@ var init_migrate = __esm({
14835
14835
  const validatedPrev = sqliteSchema.parse(prev);
14836
14836
  const validatedCur = sqliteSchema.parse(cur);
14837
14837
  if (config.custom) {
14838
- writeResult({
14839
- cur: custom,
14840
- sqlStatements: [],
14838
+ writeResult(
14839
+ custom,
14840
+ [],
14841
14841
  journal,
14842
+ {
14843
+ columns: {},
14844
+ schemas: {},
14845
+ tables: {}
14846
+ },
14842
14847
  outFolder,
14843
- breakpoints: config.breakpoints,
14844
- bundle: config.bundle,
14845
- type: "custom"
14846
- });
14848
+ config.breakpoints,
14849
+ "custom"
14850
+ );
14847
14851
  return;
14848
14852
  }
14849
14853
  const squashedPrev = squashSqliteScheme(validatedPrev);
@@ -14853,15 +14857,14 @@ var init_migrate = __esm({
14853
14857
  squashedCur,
14854
14858
  "sqlite"
14855
14859
  );
14856
- writeResult({
14860
+ writeResult(
14857
14861
  cur,
14858
14862
  sqlStatements,
14859
14863
  journal,
14860
14864
  _meta,
14861
14865
  outFolder,
14862
- breakpoints: config.breakpoints,
14863
- bundle: config.bundle
14864
- });
14866
+ config.breakpoints
14867
+ );
14865
14868
  } catch (e) {
14866
14869
  console.error(e);
14867
14870
  }
@@ -15049,20 +15052,7 @@ var init_migrate = __esm({
15049
15052
  return result;
15050
15053
  };
15051
15054
  BREAKPOINT = "--> statement-breakpoint\n";
15052
- writeResult = ({
15053
- cur,
15054
- sqlStatements,
15055
- journal,
15056
- _meta = {
15057
- columns: {},
15058
- schemas: {},
15059
- tables: {}
15060
- },
15061
- outFolder,
15062
- breakpoints,
15063
- bundle = false,
15064
- type = "none"
15065
- }) => {
15055
+ writeResult = (cur, sqlStatements, journal, _meta, outFolder, breakpoints, type = "none") => {
15066
15056
  if (type === "none") {
15067
15057
  console.log(schema(cur));
15068
15058
  if (sqlStatements.length === 0) {
@@ -15103,10 +15093,6 @@ ${sql2}
15103
15093
  });
15104
15094
  import_fs3.default.writeFileSync(metaJournal, JSON.stringify(journal, null, 2));
15105
15095
  import_fs3.default.writeFileSync(`${outFolder}/${tag}.sql`, sql2);
15106
- if (bundle) {
15107
- const js = embeddedMigrations(journal);
15108
- import_fs3.default.writeFileSync(`${outFolder}/migrations.js`, js);
15109
- }
15110
15096
  (0, import_hanji3.render)(
15111
15097
  `[${source_default.green(
15112
15098
  "\u2713"
@@ -15115,22 +15101,6 @@ ${sql2}
15115
15101
  )} \u{1F680}`
15116
15102
  );
15117
15103
  };
15118
- embeddedMigrations = (journal) => {
15119
- let content = "import journal from './meta/_journal.json';\n";
15120
- journal.entries.forEach((entry) => {
15121
- content += `import m${entry.idx.toString().padStart(4, "0")} from './${entry.tag}.sql';
15122
- `;
15123
- });
15124
- content += `
15125
- export default {
15126
- journal,
15127
- migrations: {
15128
- ${journal.entries.map((it) => `m${it.idx.toString().padStart(4, "0")}`).join(",\n")}
15129
- }
15130
- }
15131
- `;
15132
- return content;
15133
- };
15134
15104
  prepareSnapshotFolderName = () => {
15135
15105
  const now = /* @__PURE__ */ new Date();
15136
15106
  return `${now.getFullYear()}${two(now.getUTCMonth() + 1)}${two(