drizzle-kit 0.22.7-d059930 → 0.22.7-fbc7b5c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/payload.js CHANGED
@@ -8703,40 +8703,40 @@ var require_sync = __commonJS({
8703
8703
  while (typeof pattern[n] === "string") {
8704
8704
  n++;
8705
8705
  }
8706
- var prefix;
8706
+ var prefix2;
8707
8707
  switch (n) {
8708
8708
  case pattern.length:
8709
8709
  this._processSimple(pattern.join("/"), index4);
8710
8710
  return;
8711
8711
  case 0:
8712
- prefix = null;
8712
+ prefix2 = null;
8713
8713
  break;
8714
8714
  default:
8715
- prefix = pattern.slice(0, n).join("/");
8715
+ prefix2 = pattern.slice(0, n).join("/");
8716
8716
  break;
8717
8717
  }
8718
8718
  var remain = pattern.slice(n);
8719
8719
  var read;
8720
- if (prefix === null)
8720
+ if (prefix2 === null)
8721
8721
  read = ".";
8722
- else if (isAbsolute(prefix) || isAbsolute(pattern.map(function(p) {
8722
+ else if (isAbsolute(prefix2) || isAbsolute(pattern.map(function(p) {
8723
8723
  return typeof p === "string" ? p : "[*]";
8724
8724
  }).join("/"))) {
8725
- if (!prefix || !isAbsolute(prefix))
8726
- prefix = "/" + prefix;
8727
- read = prefix;
8725
+ if (!prefix2 || !isAbsolute(prefix2))
8726
+ prefix2 = "/" + prefix2;
8727
+ read = prefix2;
8728
8728
  } else
8729
- read = prefix;
8729
+ read = prefix2;
8730
8730
  var abs = this._makeAbs(read);
8731
8731
  if (childrenIgnored(this, read))
8732
8732
  return;
8733
8733
  var isGlobStar = remain[0] === minimatch2.GLOBSTAR;
8734
8734
  if (isGlobStar)
8735
- this._processGlobStar(prefix, read, abs, remain, index4, inGlobStar);
8735
+ this._processGlobStar(prefix2, read, abs, remain, index4, inGlobStar);
8736
8736
  else
8737
- this._processReaddir(prefix, read, abs, remain, index4, inGlobStar);
8737
+ this._processReaddir(prefix2, read, abs, remain, index4, inGlobStar);
8738
8738
  };
8739
- GlobSync.prototype._processReaddir = function(prefix, read, abs, remain, index4, inGlobStar) {
8739
+ GlobSync.prototype._processReaddir = function(prefix2, read, abs, remain, index4, inGlobStar) {
8740
8740
  var entries = this._readdir(abs, inGlobStar);
8741
8741
  if (!entries)
8742
8742
  return;
@@ -8749,7 +8749,7 @@ var require_sync = __commonJS({
8749
8749
  var e = entries[i];
8750
8750
  if (e.charAt(0) !== "." || dotOk) {
8751
8751
  var m;
8752
- if (negate && !prefix) {
8752
+ if (negate && !prefix2) {
8753
8753
  m = !e.match(pn);
8754
8754
  } else {
8755
8755
  m = e.match(pn);
@@ -8766,11 +8766,11 @@ var require_sync = __commonJS({
8766
8766
  this.matches[index4] = /* @__PURE__ */ Object.create(null);
8767
8767
  for (var i = 0; i < len; i++) {
8768
8768
  var e = matchedEntries[i];
8769
- if (prefix) {
8770
- if (prefix.slice(-1) !== "/")
8771
- e = prefix + "/" + e;
8769
+ if (prefix2) {
8770
+ if (prefix2.slice(-1) !== "/")
8771
+ e = prefix2 + "/" + e;
8772
8772
  else
8773
- e = prefix + e;
8773
+ e = prefix2 + e;
8774
8774
  }
8775
8775
  if (e.charAt(0) === "/" && !this.nomount) {
8776
8776
  e = path2.join(this.root, e);
@@ -8783,8 +8783,8 @@ var require_sync = __commonJS({
8783
8783
  for (var i = 0; i < len; i++) {
8784
8784
  var e = matchedEntries[i];
8785
8785
  var newPattern;
8786
- if (prefix)
8787
- newPattern = [prefix, e];
8786
+ if (prefix2)
8787
+ newPattern = [prefix2, e];
8788
8788
  else
8789
8789
  newPattern = [e];
8790
8790
  this._process(newPattern.concat(remain), index4, inGlobStar);
@@ -8891,12 +8891,12 @@ var require_sync = __commonJS({
8891
8891
  break;
8892
8892
  }
8893
8893
  };
8894
- GlobSync.prototype._processGlobStar = function(prefix, read, abs, remain, index4, inGlobStar) {
8894
+ GlobSync.prototype._processGlobStar = function(prefix2, read, abs, remain, index4, inGlobStar) {
8895
8895
  var entries = this._readdir(abs, inGlobStar);
8896
8896
  if (!entries)
8897
8897
  return;
8898
8898
  var remainWithoutGlobStar = remain.slice(1);
8899
- var gspref = prefix ? [prefix] : [];
8899
+ var gspref = prefix2 ? [prefix2] : [];
8900
8900
  var noGlobStar = gspref.concat(remainWithoutGlobStar);
8901
8901
  this._process(noGlobStar, index4, false);
8902
8902
  var len = entries.length;
@@ -8913,25 +8913,25 @@ var require_sync = __commonJS({
8913
8913
  this._process(below, index4, true);
8914
8914
  }
8915
8915
  };
8916
- GlobSync.prototype._processSimple = function(prefix, index4) {
8917
- var exists2 = this._stat(prefix);
8916
+ GlobSync.prototype._processSimple = function(prefix2, index4) {
8917
+ var exists2 = this._stat(prefix2);
8918
8918
  if (!this.matches[index4])
8919
8919
  this.matches[index4] = /* @__PURE__ */ Object.create(null);
8920
8920
  if (!exists2)
8921
8921
  return;
8922
- if (prefix && isAbsolute(prefix) && !this.nomount) {
8923
- var trail = /[\/\\]$/.test(prefix);
8924
- if (prefix.charAt(0) === "/") {
8925
- prefix = path2.join(this.root, prefix);
8922
+ if (prefix2 && isAbsolute(prefix2) && !this.nomount) {
8923
+ var trail = /[\/\\]$/.test(prefix2);
8924
+ if (prefix2.charAt(0) === "/") {
8925
+ prefix2 = path2.join(this.root, prefix2);
8926
8926
  } else {
8927
- prefix = path2.resolve(this.root, prefix);
8927
+ prefix2 = path2.resolve(this.root, prefix2);
8928
8928
  if (trail)
8929
- prefix += "/";
8929
+ prefix2 += "/";
8930
8930
  }
8931
8931
  }
8932
8932
  if (process.platform === "win32")
8933
- prefix = prefix.replace(/\\/g, "/");
8934
- this._emitMatch(index4, prefix);
8933
+ prefix2 = prefix2.replace(/\\/g, "/");
8934
+ this._emitMatch(index4, prefix2);
8935
8935
  };
8936
8936
  GlobSync.prototype._stat = function(f) {
8937
8937
  var abs = this._makeAbs(f);
@@ -9326,46 +9326,46 @@ var require_glob = __commonJS({
9326
9326
  while (typeof pattern[n] === "string") {
9327
9327
  n++;
9328
9328
  }
9329
- var prefix;
9329
+ var prefix2;
9330
9330
  switch (n) {
9331
9331
  case pattern.length:
9332
9332
  this._processSimple(pattern.join("/"), index4, cb);
9333
9333
  return;
9334
9334
  case 0:
9335
- prefix = null;
9335
+ prefix2 = null;
9336
9336
  break;
9337
9337
  default:
9338
- prefix = pattern.slice(0, n).join("/");
9338
+ prefix2 = pattern.slice(0, n).join("/");
9339
9339
  break;
9340
9340
  }
9341
9341
  var remain = pattern.slice(n);
9342
9342
  var read;
9343
- if (prefix === null)
9343
+ if (prefix2 === null)
9344
9344
  read = ".";
9345
- else if (isAbsolute(prefix) || isAbsolute(pattern.map(function(p) {
9345
+ else if (isAbsolute(prefix2) || isAbsolute(pattern.map(function(p) {
9346
9346
  return typeof p === "string" ? p : "[*]";
9347
9347
  }).join("/"))) {
9348
- if (!prefix || !isAbsolute(prefix))
9349
- prefix = "/" + prefix;
9350
- read = prefix;
9348
+ if (!prefix2 || !isAbsolute(prefix2))
9349
+ prefix2 = "/" + prefix2;
9350
+ read = prefix2;
9351
9351
  } else
9352
- read = prefix;
9352
+ read = prefix2;
9353
9353
  var abs = this._makeAbs(read);
9354
9354
  if (childrenIgnored(this, read))
9355
9355
  return cb();
9356
9356
  var isGlobStar = remain[0] === minimatch2.GLOBSTAR;
9357
9357
  if (isGlobStar)
9358
- this._processGlobStar(prefix, read, abs, remain, index4, inGlobStar, cb);
9358
+ this._processGlobStar(prefix2, read, abs, remain, index4, inGlobStar, cb);
9359
9359
  else
9360
- this._processReaddir(prefix, read, abs, remain, index4, inGlobStar, cb);
9360
+ this._processReaddir(prefix2, read, abs, remain, index4, inGlobStar, cb);
9361
9361
  };
9362
- Glob.prototype._processReaddir = function(prefix, read, abs, remain, index4, inGlobStar, cb) {
9362
+ Glob.prototype._processReaddir = function(prefix2, read, abs, remain, index4, inGlobStar, cb) {
9363
9363
  var self2 = this;
9364
9364
  this._readdir(abs, inGlobStar, function(er, entries) {
9365
- return self2._processReaddir2(prefix, read, abs, remain, index4, inGlobStar, entries, cb);
9365
+ return self2._processReaddir2(prefix2, read, abs, remain, index4, inGlobStar, entries, cb);
9366
9366
  });
9367
9367
  };
9368
- Glob.prototype._processReaddir2 = function(prefix, read, abs, remain, index4, inGlobStar, entries, cb) {
9368
+ Glob.prototype._processReaddir2 = function(prefix2, read, abs, remain, index4, inGlobStar, entries, cb) {
9369
9369
  if (!entries)
9370
9370
  return cb();
9371
9371
  var pn = remain[0];
@@ -9377,7 +9377,7 @@ var require_glob = __commonJS({
9377
9377
  var e = entries[i];
9378
9378
  if (e.charAt(0) !== "." || dotOk) {
9379
9379
  var m;
9380
- if (negate && !prefix) {
9380
+ if (negate && !prefix2) {
9381
9381
  m = !e.match(pn);
9382
9382
  } else {
9383
9383
  m = e.match(pn);
@@ -9394,11 +9394,11 @@ var require_glob = __commonJS({
9394
9394
  this.matches[index4] = /* @__PURE__ */ Object.create(null);
9395
9395
  for (var i = 0; i < len; i++) {
9396
9396
  var e = matchedEntries[i];
9397
- if (prefix) {
9398
- if (prefix !== "/")
9399
- e = prefix + "/" + e;
9397
+ if (prefix2) {
9398
+ if (prefix2 !== "/")
9399
+ e = prefix2 + "/" + e;
9400
9400
  else
9401
- e = prefix + e;
9401
+ e = prefix2 + e;
9402
9402
  }
9403
9403
  if (e.charAt(0) === "/" && !this.nomount) {
9404
9404
  e = path2.join(this.root, e);
@@ -9411,11 +9411,11 @@ var require_glob = __commonJS({
9411
9411
  for (var i = 0; i < len; i++) {
9412
9412
  var e = matchedEntries[i];
9413
9413
  var newPattern;
9414
- if (prefix) {
9415
- if (prefix !== "/")
9416
- e = prefix + "/" + e;
9414
+ if (prefix2) {
9415
+ if (prefix2 !== "/")
9416
+ e = prefix2 + "/" + e;
9417
9417
  else
9418
- e = prefix + e;
9418
+ e = prefix2 + e;
9419
9419
  }
9420
9420
  this._process([e].concat(remain), index4, inGlobStar, cb);
9421
9421
  }
@@ -9546,17 +9546,17 @@ var require_glob = __commonJS({
9546
9546
  }
9547
9547
  return cb();
9548
9548
  };
9549
- Glob.prototype._processGlobStar = function(prefix, read, abs, remain, index4, inGlobStar, cb) {
9549
+ Glob.prototype._processGlobStar = function(prefix2, read, abs, remain, index4, inGlobStar, cb) {
9550
9550
  var self2 = this;
9551
9551
  this._readdir(abs, inGlobStar, function(er, entries) {
9552
- self2._processGlobStar2(prefix, read, abs, remain, index4, inGlobStar, entries, cb);
9552
+ self2._processGlobStar2(prefix2, read, abs, remain, index4, inGlobStar, entries, cb);
9553
9553
  });
9554
9554
  };
9555
- Glob.prototype._processGlobStar2 = function(prefix, read, abs, remain, index4, inGlobStar, entries, cb) {
9555
+ Glob.prototype._processGlobStar2 = function(prefix2, read, abs, remain, index4, inGlobStar, entries, cb) {
9556
9556
  if (!entries)
9557
9557
  return cb();
9558
9558
  var remainWithoutGlobStar = remain.slice(1);
9559
- var gspref = prefix ? [prefix] : [];
9559
+ var gspref = prefix2 ? [prefix2] : [];
9560
9560
  var noGlobStar = gspref.concat(remainWithoutGlobStar);
9561
9561
  this._process(noGlobStar, index4, false, cb);
9562
9562
  var isSym = this.symlinks[abs];
@@ -9574,30 +9574,30 @@ var require_glob = __commonJS({
9574
9574
  }
9575
9575
  cb();
9576
9576
  };
9577
- Glob.prototype._processSimple = function(prefix, index4, cb) {
9577
+ Glob.prototype._processSimple = function(prefix2, index4, cb) {
9578
9578
  var self2 = this;
9579
- this._stat(prefix, function(er, exists2) {
9580
- self2._processSimple2(prefix, index4, er, exists2, cb);
9579
+ this._stat(prefix2, function(er, exists2) {
9580
+ self2._processSimple2(prefix2, index4, er, exists2, cb);
9581
9581
  });
9582
9582
  };
9583
- Glob.prototype._processSimple2 = function(prefix, index4, er, exists2, cb) {
9583
+ Glob.prototype._processSimple2 = function(prefix2, index4, er, exists2, cb) {
9584
9584
  if (!this.matches[index4])
9585
9585
  this.matches[index4] = /* @__PURE__ */ Object.create(null);
9586
9586
  if (!exists2)
9587
9587
  return cb();
9588
- if (prefix && isAbsolute(prefix) && !this.nomount) {
9589
- var trail = /[\/\\]$/.test(prefix);
9590
- if (prefix.charAt(0) === "/") {
9591
- prefix = path2.join(this.root, prefix);
9588
+ if (prefix2 && isAbsolute(prefix2) && !this.nomount) {
9589
+ var trail = /[\/\\]$/.test(prefix2);
9590
+ if (prefix2.charAt(0) === "/") {
9591
+ prefix2 = path2.join(this.root, prefix2);
9592
9592
  } else {
9593
- prefix = path2.resolve(this.root, prefix);
9593
+ prefix2 = path2.resolve(this.root, prefix2);
9594
9594
  if (trail)
9595
- prefix += "/";
9595
+ prefix2 += "/";
9596
9596
  }
9597
9597
  }
9598
9598
  if (process.platform === "win32")
9599
- prefix = prefix.replace(/\\/g, "/");
9600
- this._emitMatch(index4, prefix);
9599
+ prefix2 = prefix2.replace(/\\/g, "/");
9600
+ this._emitMatch(index4, prefix2);
9601
9601
  cb();
9602
9602
  };
9603
9603
  Glob.prototype._stat = function(f, cb) {
@@ -9858,8 +9858,8 @@ var init_ansi_styles = __esm({
9858
9858
 
9859
9859
  // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
9860
9860
  function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : import_node_process.default.argv) {
9861
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
9862
- const position = argv.indexOf(prefix + flag);
9861
+ const prefix2 = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
9862
+ const position = argv.indexOf(prefix2 + flag);
9863
9863
  const terminatorPosition = argv.indexOf("--");
9864
9864
  return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
9865
9865
  }
@@ -10004,12 +10004,12 @@ function stringReplaceAll(string, substring, replacer) {
10004
10004
  returnValue += string.slice(endIndex);
10005
10005
  return returnValue;
10006
10006
  }
10007
- function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index4) {
10007
+ function stringEncaseCRLFWithFirstIndex(string, prefix2, postfix, index4) {
10008
10008
  let endIndex = 0;
10009
10009
  let returnValue = "";
10010
10010
  do {
10011
10011
  const gotCR = string[index4 - 1] === "\r";
10012
- returnValue += string.slice(endIndex, gotCR ? index4 - 1 : index4) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
10012
+ returnValue += string.slice(endIndex, gotCR ? index4 - 1 : index4) + prefix2 + (gotCR ? "\r\n" : "\n") + postfix;
10013
10013
  endIndex = index4 + 1;
10014
10014
  index4 = string.indexOf("\n", endIndex);
10015
10015
  } while (index4 !== -1);
@@ -15905,16 +15905,12 @@ var init_schemaValidator = __esm({
15905
15905
  mysqlSchemaSquashed,
15906
15906
  SQLiteSchemaSquashed
15907
15907
  ]);
15908
- commonSchema = unionType([
15909
- pgSchema,
15910
- mysqlSchema,
15911
- sqliteSchema
15912
- ]);
15908
+ commonSchema = unionType([pgSchema, mysqlSchema, sqliteSchema]);
15913
15909
  }
15914
15910
  });
15915
15911
 
15916
15912
  // src/cli/validations/common.ts
15917
- var sqliteDriversLiterals, sqliteDriver, postgresDriver, driver, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema;
15913
+ var sqliteDriversLiterals, migrationFilesPrefixes, prefix, sqliteDriver, postgresDriver, driver, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema;
15918
15914
  var init_common2 = __esm({
15919
15915
  "src/cli/validations/common.ts"() {
15920
15916
  "use strict";
@@ -15926,6 +15922,17 @@ var init_common2 = __esm({
15926
15922
  literalType("d1-http"),
15927
15923
  literalType("expo")
15928
15924
  ];
15925
+ migrationFilesPrefixes = [
15926
+ literalType("index"),
15927
+ literalType("timestamp"),
15928
+ literalType("supabase"),
15929
+ literalType("unix"),
15930
+ literalType("none")
15931
+ ];
15932
+ prefix = unionType(migrationFilesPrefixes);
15933
+ {
15934
+ const _2 = "";
15935
+ }
15929
15936
  sqliteDriver = unionType(sqliteDriversLiterals);
15930
15937
  postgresDriver = literalType("aws-data-api");
15931
15938
  driver = unionType([sqliteDriver, postgresDriver]);
@@ -15934,9 +15941,13 @@ var init_common2 = __esm({
15934
15941
  schema: unionType([stringType(), stringType().array()]).optional(),
15935
15942
  out: stringType().optional(),
15936
15943
  breakpoints: booleanType().optional().default(true),
15944
+ verbose: booleanType().optional().default(false),
15937
15945
  driver: driver.optional(),
15938
15946
  tablesFilter: unionType([stringType(), stringType().array()]).optional(),
15939
- schemaFilter: unionType([stringType(), stringType().array()]).default(["public"])
15947
+ schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
15948
+ migrations: objectType({
15949
+ prefix: prefix.optional().default("index")
15950
+ }).optional()
15940
15951
  });
15941
15952
  casing = unionType([literalType("camel"), literalType("preserve")]).default(
15942
15953
  "preserve"
@@ -16124,6 +16135,7 @@ var init_cli = __esm({
16124
16135
  out: stringType().optional().default("./drizzle"),
16125
16136
  config: stringType().optional(),
16126
16137
  name: stringType().optional(),
16138
+ prefix: prefix.optional(),
16127
16139
  breakpoints: booleanType().optional().default(true),
16128
16140
  custom: booleanType().optional().default(false)
16129
16141
  }).strict();
@@ -16144,7 +16156,10 @@ var init_cli = __esm({
16144
16156
  schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
16145
16157
  extensionsFilters: literalType("postgis").array().optional(),
16146
16158
  introspectCasing: casing,
16147
- breakpoints: booleanType().optional().default(true)
16159
+ breakpoints: booleanType().optional().default(true),
16160
+ database: objectType({
16161
+ prefix: prefix.optional().default("index")
16162
+ }).optional()
16148
16163
  }).passthrough();
16149
16164
  configCheck = objectType({
16150
16165
  dialect: dialect3.optional(),
@@ -16264,7 +16279,8 @@ var init_utils6 = __esm({
16264
16279
  out: stringType().optional().default("drizzle"),
16265
16280
  migrations: objectType({
16266
16281
  table: stringType().optional(),
16267
- schema: stringType().optional()
16282
+ schema: stringType().optional(),
16283
+ prefix: unionType([literalType("index"), literalType("timestamp"), literalType("none")]).optional().default("index")
16268
16284
  }).optional()
16269
16285
  });
16270
16286
  }
@@ -19396,7 +19412,7 @@ var require_difflib = __commonJS({
19396
19412
  return `${beginning},${beginning + length - 1}`;
19397
19413
  };
19398
19414
  contextDiff = function(a, b, { fromfile, tofile, fromfiledate, tofiledate, n, lineterm } = {}) {
19399
- var _2, file1Range, file2Range, first, fromdate, group, i1, i2, j1, j2, l, last, len, len1, len2, len3, len4, line, lines, m, o, p, prefix, q, ref, ref1, ref2, started, tag, todate;
19415
+ var _2, file1Range, file2Range, first, fromdate, group, i1, i2, j1, j2, l, last, len, len1, len2, len3, len4, line, lines, m, o, p, prefix2, q, ref, ref1, ref2, started, tag, todate;
19400
19416
  if (fromfile == null) {
19401
19417
  fromfile = "";
19402
19418
  }
@@ -19415,7 +19431,7 @@ var require_difflib = __commonJS({
19415
19431
  if (lineterm == null) {
19416
19432
  lineterm = "\n";
19417
19433
  }
19418
- prefix = {
19434
+ prefix2 = {
19419
19435
  insert: "+ ",
19420
19436
  delete: "- ",
19421
19437
  replace: "! ",
@@ -19451,7 +19467,7 @@ var require_difflib = __commonJS({
19451
19467
  ref1 = a.slice(i1, i2);
19452
19468
  for (o = 0, len2 = ref1.length; o < len2; o++) {
19453
19469
  line = ref1[o];
19454
- lines.push(prefix[tag] + line);
19470
+ lines.push(prefix2[tag] + line);
19455
19471
  }
19456
19472
  }
19457
19473
  }
@@ -19473,7 +19489,7 @@ var require_difflib = __commonJS({
19473
19489
  ref2 = b.slice(j1, j2);
19474
19490
  for (q = 0, len4 = ref2.length; q < len4; q++) {
19475
19491
  line = ref2[q];
19476
- lines.push(prefix[tag] + line);
19492
+ lines.push(prefix2[tag] + line);
19477
19493
  }
19478
19494
  }
19479
19495
  }
@@ -19639,8 +19655,8 @@ var require_has_flag = __commonJS({
19639
19655
  module2.exports = function(flag, argv) {
19640
19656
  argv = argv || process.argv;
19641
19657
  var terminatorPos = argv.indexOf("--");
19642
- var prefix = /^-{1,2}/.test(flag) ? "" : "--";
19643
- var pos = argv.indexOf(prefix + flag);
19658
+ var prefix2 = /^-{1,2}/.test(flag) ? "" : "--";
19659
+ var pos = argv.indexOf(prefix2 + flag);
19644
19660
  return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
19645
19661
  };
19646
19662
  }
@@ -20249,7 +20265,7 @@ var require_colorize = __commonJS({
20249
20265
  };
20250
20266
  var subcolorizeToCallback = function(options, key, diff2, output, color2, indent) {
20251
20267
  let subvalue;
20252
- const prefix = key ? `${key}: ` : "";
20268
+ const prefix2 = key ? `${key}: ` : "";
20253
20269
  const subindent = indent + " ";
20254
20270
  const outputElisions = (n) => {
20255
20271
  const maxElisions = options.maxElisions === void 0 ? Infinity : options.maxElisions;
@@ -20267,7 +20283,7 @@ var require_colorize = __commonJS({
20267
20283
  subcolorizeToCallback(options, key, diff2.__old, output, "-", indent);
20268
20284
  return subcolorizeToCallback(options, key, diff2.__new, output, "+", indent);
20269
20285
  } else {
20270
- output(color2, `${indent}${prefix}{`);
20286
+ output(color2, `${indent}${prefix2}{`);
20271
20287
  for (const subkey of Object.keys(diff2)) {
20272
20288
  let m;
20273
20289
  subvalue = diff2[subkey];
@@ -20282,7 +20298,7 @@ var require_colorize = __commonJS({
20282
20298
  return output(color2, `${indent}}`);
20283
20299
  }
20284
20300
  case "array": {
20285
- output(color2, `${indent}${prefix}[`);
20301
+ output(color2, `${indent}${prefix2}[`);
20286
20302
  let looksLikeDiff = true;
20287
20303
  for (const item of diff2) {
20288
20304
  if (extendedTypeOf(item) !== "array" || !(item.length === 2 || item.length === 1 && item[0] === " ") || !(typeof item[0] === "string") || item[0].length !== 1 || ![" ", "-", "+", "~"].includes(item[0])) {
@@ -20321,7 +20337,7 @@ var require_colorize = __commonJS({
20321
20337
  }
20322
20338
  default:
20323
20339
  if (diff2 === 0 || diff2 === null || diff2 === false || diff2 === "" || diff2) {
20324
- return output(color2, indent + prefix + JSON.stringify(diff2));
20340
+ return output(color2, indent + prefix2 + JSON.stringify(diff2));
20325
20341
  }
20326
20342
  }
20327
20343
  };
@@ -23102,6 +23118,13 @@ var init_snapshotsDiffer = __esm({
23102
23118
  return false;
23103
23119
  }
23104
23120
  }
23121
+ if (st.type === "alter_table_alter_column_set_notnull") {
23122
+ if (jsonStatements.find(
23123
+ (it) => it.type === "alter_table_alter_column_set_identity" && it.tableName === st.tableName && it.schema === st.schema
23124
+ )) {
23125
+ return false;
23126
+ }
23127
+ }
23105
23128
  return true;
23106
23129
  });
23107
23130
  const sqlStatements = fromJson(filteredJsonStatements, "postgresql");
@@ -23656,7 +23679,12 @@ var init_snapshotsDiffer = __esm({
23656
23679
  {}
23657
23680
  );
23658
23681
  jsonCreateIndexesForAllAlteredTables.push(
23659
- ...prepareCreateIndexesJson(it.name, it.schema, createdIndexes || {})
23682
+ ...prepareCreateIndexesJson(
23683
+ it.name,
23684
+ it.schema,
23685
+ createdIndexes || {},
23686
+ curFull.internal
23687
+ )
23660
23688
  );
23661
23689
  jsonDropIndexesForAllAlteredTables.push(
23662
23690
  ...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {})
@@ -24151,7 +24179,7 @@ var init_sqlgenerator = __esm({
24151
24179
  const notNullStatement = column4.notNull ? " NOT NULL" : "";
24152
24180
  const defaultStatement = column4.default !== void 0 ? ` DEFAULT ${column4.default}` : "";
24153
24181
  const autoincrementStatement = column4.autoincrement ? " AUTOINCREMENT" : "";
24154
- const generatedStatement = column4.generated ? ` GENERATED ALWAYS AS (${column4.generated.as}) ${column4.generated.type.toUpperCase()}` : "";
24182
+ const generatedStatement = column4.generated ? ` GENERATED ALWAYS AS ${column4.generated.as} ${column4.generated.type.toUpperCase()}` : "";
24155
24183
  statement += " ";
24156
24184
  statement += `\`${column4.name}\` ${column4.type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${notNullStatement}${generatedStatement}`;
24157
24185
  statement += i === columns.length - 1 ? "" : ",\n";
@@ -24226,8 +24254,6 @@ var init_sqlgenerator = __esm({
24226
24254
  const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
24227
24255
  const unsquashedIdentity = PgSquasher.unsquashIdentity(identity);
24228
24256
  const unsquashedOldIdentity = PgSquasher.unsquashIdentity(oldIdentity);
24229
- const identityWithSchema = schema4 ? `"${schema4}"."${unsquashedIdentity?.name}"` : `"${unsquashedIdentity?.name}"`;
24230
- const oldIdentityWithSchema = schema4 ? `"${schema4}"."${unsquashedOldIdentity?.name}"` : `"${unsquashedOldIdentity?.name}"`;
24231
24257
  const statementsToReturn = [];
24232
24258
  if (unsquashedOldIdentity.type !== unsquashedIdentity.type) {
24233
24259
  statementsToReturn.push(
@@ -24536,14 +24562,18 @@ var init_sqlgenerator = __esm({
24536
24562
  }
24537
24563
  convert(statement) {
24538
24564
  const { tableName, column: column4, schema: schema4 } = statement;
24539
- const { name: name2, type, notNull, generated } = column4;
24565
+ const { name: name2, type, notNull, generated, primaryKey, identity } = column4;
24566
+ const primaryKeyStatement = primaryKey ? " PRIMARY KEY" : "";
24540
24567
  const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
24541
24568
  const defaultStatement = `${column4.default !== void 0 ? ` DEFAULT ${column4.default}` : ""}`;
24542
24569
  const schemaPrefix = column4.typeSchema && column4.typeSchema !== "public" ? `"${column4.typeSchema}".` : "";
24543
24570
  const fixedType = isPgNativeType(column4.type) ? column4.type : `${schemaPrefix}"${column4.type}"`;
24544
24571
  const notNullStatement = `${notNull ? " NOT NULL" : ""}`;
24572
+ const unsquashedIdentity = identity ? PgSquasher.unsquashIdentity(identity) : void 0;
24573
+ const identityWithSchema = schema4 ? `"${schema4}"."${unsquashedIdentity?.name}"` : `"${unsquashedIdentity?.name}"`;
24574
+ const identityStatement = unsquashedIdentity ? ` GENERATED ${unsquashedIdentity.type === "always" ? "ALWAYS" : "BY DEFAULT"} AS IDENTITY (sequence name ${identityWithSchema}${unsquashedIdentity.increment ? ` INCREMENT BY ${unsquashedIdentity.increment}` : ""}${unsquashedIdentity.minValue ? ` MINVALUE ${unsquashedIdentity.minValue}` : ""}${unsquashedIdentity.maxValue ? ` MAXVALUE ${unsquashedIdentity.maxValue}` : ""}${unsquashedIdentity.startWith ? ` START WITH ${unsquashedIdentity.startWith}` : ""}${unsquashedIdentity.cache ? ` CACHE ${unsquashedIdentity.cache}` : ""}${unsquashedIdentity.cycle ? ` CYCLE` : ""})` : "";
24545
24575
  const generatedStatement = ` GENERATED ALWAYS AS (${generated?.as}) STORED`;
24546
- return `ALTER TABLE ${tableNameWithSchema} ADD COLUMN "${name2}" ${fixedType}${defaultStatement}${notNullStatement}${generated ? generatedStatement : ""};`;
24576
+ return `ALTER TABLE ${tableNameWithSchema} ADD COLUMN "${name2}" ${fixedType}${primaryKeyStatement}${defaultStatement}${notNullStatement}${generated ? generatedStatement : ""}${identityStatement};`;
24547
24577
  }
24548
24578
  };
24549
24579
  MySqlAlterTableAddColumnConvertor = class extends Convertor {
@@ -24582,7 +24612,7 @@ var init_sqlgenerator = __esm({
24582
24612
  const primaryKeyStatement = `${primaryKey ? " PRIMARY KEY" : ""}`;
24583
24613
  const referenceAsObject = referenceData ? SQLiteSquasher.unsquashFK(referenceData) : void 0;
24584
24614
  const referenceStatement = `${referenceAsObject ? ` REFERENCES ${referenceAsObject.tableTo}(${referenceAsObject.columnsTo})` : ""}`;
24585
- const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated.as}) ${generated.type.toUpperCase()}` : "";
24615
+ const generatedStatement = generated ? ` GENERATED ALWAYS AS ${generated.as} ${generated.type.toUpperCase()}` : "";
24586
24616
  return `ALTER TABLE \`${tableName}\` ADD \`${name2}\` ${type}${primaryKeyStatement}${defaultStatement}${notNullStatement}${generatedStatement}${referenceStatement};`;
24587
24617
  }
24588
24618
  };
@@ -24871,8 +24901,8 @@ var init_sqlgenerator = __esm({
24871
24901
  columnPk,
24872
24902
  columnGenerated
24873
24903
  } = statement;
24874
- const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
24875
- const addColumnStatement = new PgAlterTableAddColumnConvertor().convert({
24904
+ const tableNameWithSchema = schema4 ? `\`${schema4}\`.\`${tableName}\`` : `\`${tableName}\``;
24905
+ const addColumnStatement = new MySqlAlterTableAddColumnConvertor().convert({
24876
24906
  schema: schema4,
24877
24907
  tableName,
24878
24908
  column: {
@@ -24888,7 +24918,7 @@ var init_sqlgenerator = __esm({
24888
24918
  type: "alter_table_add_column"
24889
24919
  });
24890
24920
  return [
24891
- `ALTER TABLE ${tableNameWithSchema} drop column "${columnName}";`,
24921
+ `ALTER TABLE ${tableNameWithSchema} drop column \`${columnName}\`;`,
24892
24922
  addColumnStatement
24893
24923
  ];
24894
24924
  }
@@ -27302,7 +27332,7 @@ function createSetOperator2(type, isAll) {
27302
27332
  return leftSelect.addSetOperators(setOperators);
27303
27333
  };
27304
27334
  }
27305
- var _a199, SQLiteSelectBuilder, _a200, _b145, SQLiteSelectQueryBuilderBase, _a201, _b146, SQLiteSelectBase, getSQLiteSetOperators, union3, unionAll2, intersect2, except2;
27335
+ var _a199, SQLiteSelectBuilder, _a200, _b145, SQLiteSelectQueryBuilderBase, _a201, _b146, SQLiteSelectBase, getSQLiteSetOperators, union2, unionAll2, intersect2, except2;
27306
27336
  var init_select3 = __esm({
27307
27337
  "node_modules/.pnpm/drizzle-orm@0.32.0-85c8008_@aws-sdk+client-rds-data@3.600.0_@cloudflare+workers-types@4.20240_7kwr7fdj2penywro4vdziyruiq/node_modules/drizzle-orm/sqlite-core/query-builders/select.js"() {
27308
27338
  "use strict";
@@ -27905,12 +27935,12 @@ var init_select3 = __esm({
27905
27935
  __publicField(SQLiteSelectBase, _a201, "SQLiteSelect");
27906
27936
  applyMixins(SQLiteSelectBase, [QueryPromise]);
27907
27937
  getSQLiteSetOperators = () => ({
27908
- union: union3,
27938
+ union: union2,
27909
27939
  unionAll: unionAll2,
27910
27940
  intersect: intersect2,
27911
27941
  except: except2
27912
27942
  });
27913
- union3 = createSetOperator2("union", false);
27943
+ union2 = createSetOperator2("union", false);
27914
27944
  unionAll2 = createSetOperator2("union", true);
27915
27945
  intersect2 = createSetOperator2("intersect", false);
27916
27946
  except2 = createSetOperator2("except", false);
@@ -29065,13 +29095,19 @@ function mapSqlToSqliteType(sqlType) {
29065
29095
  }
29066
29096
  function extractGeneratedColumns(input) {
29067
29097
  const columns = {};
29068
- const lines = input.split("\n");
29098
+ const lines = input.split(/,\s*(?![^()]*\))/);
29069
29099
  for (const line of lines) {
29070
29100
  if (line.includes("GENERATED ALWAYS AS")) {
29071
29101
  const parts = line.trim().split(/\s+/);
29072
- const columnName = parts[0].slice(1, parts[0].length - 1);
29102
+ const columnName = parts[0].replace(/[`'"]/g, "");
29073
29103
  const expression = line.substring(line.indexOf("("), line.indexOf(")") + 1).trim();
29074
- const type = parts[parts.length - 1].replace(/(^,)|(,$)/g, "").toLowerCase();
29104
+ const typeIndex = parts.findIndex(
29105
+ (part) => part.match(/(stored|virtual)/i)
29106
+ );
29107
+ let type = "virtual";
29108
+ if (typeIndex !== -1) {
29109
+ type = parts[typeIndex].replace(/[^a-z]/gi, "").toLowerCase();
29110
+ }
29075
29111
  columns[columnName] = {
29076
29112
  columnName,
29077
29113
  expression,
@@ -29119,7 +29155,7 @@ var init_sqliteSerializer = __esm({
29119
29155
  notNull,
29120
29156
  autoincrement: is(column4, SQLiteBaseInteger) ? column4.autoIncrement : false,
29121
29157
  generated: generated ? {
29122
- as: is(generated.as, SQL) ? dialect5.sqlToQuery(generated.as, "indexes").sql : typeof generated.as === "function" ? dialect5.sqlToQuery(generated.as(), "indexes").sql : generated.as,
29158
+ as: is(generated.as, SQL) ? `(${dialect5.sqlToQuery(generated.as, "indexes").sql})` : typeof generated.as === "function" ? `(${dialect5.sqlToQuery(generated.as(), "indexes").sql})` : `(${generated.as})`,
29123
29159
  type: generated.mode ?? "virtual"
29124
29160
  } : void 0
29125
29161
  };
@@ -29474,12 +29510,12 @@ WHERE
29474
29510
  if (progressCallback) {
29475
29511
  progressCallback("indexes", indexesCount, "fetching");
29476
29512
  }
29477
- if (typeof tableInResult.indexes[constraintName] !== "undefined") {
29513
+ if (typeof tableInResult.indexes[constraintName] !== "undefined" && columnName) {
29478
29514
  tableInResult.indexes[constraintName].columns.push(columnName);
29479
29515
  } else {
29480
29516
  tableInResult.indexes[constraintName] = {
29481
29517
  name: constraintName,
29482
- columns: [columnName],
29518
+ columns: columnName ? [columnName] : [],
29483
29519
  isUnique
29484
29520
  };
29485
29521
  }
@@ -31812,7 +31848,7 @@ function createSetOperator3(type, isAll) {
31812
31848
  return leftSelect.addSetOperators(setOperators);
31813
31849
  };
31814
31850
  }
31815
- var _a298, MySqlSelectBuilder, _a299, _b222, MySqlSelectQueryBuilderBase, _a300, _b223, MySqlSelectBase, getMySqlSetOperators, union4, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
31851
+ var _a298, MySqlSelectBuilder, _a299, _b222, MySqlSelectQueryBuilderBase, _a300, _b223, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
31816
31852
  var init_select4 = __esm({
31817
31853
  "node_modules/.pnpm/drizzle-orm@0.32.0-85c8008_@aws-sdk+client-rds-data@3.600.0_@cloudflare+workers-types@4.20240_7kwr7fdj2penywro4vdziyruiq/node_modules/drizzle-orm/mysql-core/query-builders/select.js"() {
31818
31854
  "use strict";
@@ -32502,14 +32538,14 @@ var init_select4 = __esm({
32502
32538
  __publicField(MySqlSelectBase, _a300, "MySqlSelect");
32503
32539
  applyMixins(MySqlSelectBase, [QueryPromise]);
32504
32540
  getMySqlSetOperators = () => ({
32505
- union: union4,
32541
+ union: union3,
32506
32542
  unionAll: unionAll3,
32507
32543
  intersect: intersect3,
32508
32544
  intersectAll: intersectAll2,
32509
32545
  except: except3,
32510
32546
  exceptAll: exceptAll2
32511
32547
  });
32512
- union4 = createSetOperator3("union", false);
32548
+ union3 = createSetOperator3("union", false);
32513
32549
  unionAll3 = createSetOperator3("union", true);
32514
32550
  intersect3 = createSetOperator3("intersect", false);
32515
32551
  intersectAll2 = createSetOperator3("intersect", true);
@@ -34659,7 +34695,7 @@ var pgSuggestions = async (db, statements) => {
34659
34695
  }
34660
34696
  }
34661
34697
  }
34662
- const stmnt = fromJson([statement], "postgresql")[0];
34698
+ const stmnt = fromJson([statement], "postgresql");
34663
34699
  if (typeof stmnt !== "undefined") {
34664
34700
  if (statement.type === "drop_table") {
34665
34701
  statementsToExecute.push(
@@ -34669,7 +34705,7 @@ var pgSuggestions = async (db, statements) => {
34669
34705
  )} CASCADE;`
34670
34706
  );
34671
34707
  } else {
34672
- statementsToExecute.push(stmnt);
34708
+ statementsToExecute.push(...stmnt);
34673
34709
  }
34674
34710
  }
34675
34711
  }
@@ -35043,14 +35079,14 @@ var logSuggestionsAndReturn = async (connection, statements, json1, json2, meta)
35043
35079
  }
35044
35080
  tablesContext[newTableName] = _moveDataStatements(
35045
35081
  statement.tableName,
35046
- json2,
35082
+ json1,
35047
35083
  true
35048
35084
  );
35049
35085
  } else {
35050
35086
  if (typeof tablesContext[newTableName] === "undefined") {
35051
35087
  tablesContext[newTableName] = _moveDataStatements(
35052
35088
  statement.tableName,
35053
- json2
35089
+ json1
35054
35090
  );
35055
35091
  }
35056
35092
  }
@@ -35069,7 +35105,7 @@ var logSuggestionsAndReturn = async (connection, statements, json1, json2, meta)
35069
35105
  const uniqueTableRefs = [...new Set(tablesReferncingCurrent)];
35070
35106
  for (const table4 of uniqueTableRefs) {
35071
35107
  if (typeof tablesContext[table4] === "undefined") {
35072
- tablesContext[table4] = [..._moveDataStatements(table4, json2)];
35108
+ tablesContext[table4] = [..._moveDataStatements(table4, json1)];
35073
35109
  }
35074
35110
  }
35075
35111
  }
@@ -35090,9 +35126,9 @@ var logSuggestionsAndReturn = async (connection, statements, json1, json2, meta)
35090
35126
  );
35091
35127
  }
35092
35128
  } else {
35093
- const stmnt = fromJson([statement], "sqlite")[0];
35129
+ const stmnt = fromJson([statement], "sqlite");
35094
35130
  if (typeof stmnt !== "undefined") {
35095
- statementsToExecute.push(stmnt);
35131
+ statementsToExecute.push(...stmnt);
35096
35132
  }
35097
35133
  }
35098
35134
  }