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.mjs CHANGED
@@ -8708,40 +8708,40 @@ var require_sync = __commonJS({
8708
8708
  while (typeof pattern[n] === "string") {
8709
8709
  n++;
8710
8710
  }
8711
- var prefix;
8711
+ var prefix2;
8712
8712
  switch (n) {
8713
8713
  case pattern.length:
8714
8714
  this._processSimple(pattern.join("/"), index4);
8715
8715
  return;
8716
8716
  case 0:
8717
- prefix = null;
8717
+ prefix2 = null;
8718
8718
  break;
8719
8719
  default:
8720
- prefix = pattern.slice(0, n).join("/");
8720
+ prefix2 = pattern.slice(0, n).join("/");
8721
8721
  break;
8722
8722
  }
8723
8723
  var remain = pattern.slice(n);
8724
8724
  var read;
8725
- if (prefix === null)
8725
+ if (prefix2 === null)
8726
8726
  read = ".";
8727
- else if (isAbsolute(prefix) || isAbsolute(pattern.map(function(p) {
8727
+ else if (isAbsolute(prefix2) || isAbsolute(pattern.map(function(p) {
8728
8728
  return typeof p === "string" ? p : "[*]";
8729
8729
  }).join("/"))) {
8730
- if (!prefix || !isAbsolute(prefix))
8731
- prefix = "/" + prefix;
8732
- read = prefix;
8730
+ if (!prefix2 || !isAbsolute(prefix2))
8731
+ prefix2 = "/" + prefix2;
8732
+ read = prefix2;
8733
8733
  } else
8734
- read = prefix;
8734
+ read = prefix2;
8735
8735
  var abs = this._makeAbs(read);
8736
8736
  if (childrenIgnored(this, read))
8737
8737
  return;
8738
8738
  var isGlobStar = remain[0] === minimatch2.GLOBSTAR;
8739
8739
  if (isGlobStar)
8740
- this._processGlobStar(prefix, read, abs, remain, index4, inGlobStar);
8740
+ this._processGlobStar(prefix2, read, abs, remain, index4, inGlobStar);
8741
8741
  else
8742
- this._processReaddir(prefix, read, abs, remain, index4, inGlobStar);
8742
+ this._processReaddir(prefix2, read, abs, remain, index4, inGlobStar);
8743
8743
  };
8744
- GlobSync.prototype._processReaddir = function(prefix, read, abs, remain, index4, inGlobStar) {
8744
+ GlobSync.prototype._processReaddir = function(prefix2, read, abs, remain, index4, inGlobStar) {
8745
8745
  var entries = this._readdir(abs, inGlobStar);
8746
8746
  if (!entries)
8747
8747
  return;
@@ -8754,7 +8754,7 @@ var require_sync = __commonJS({
8754
8754
  var e = entries[i];
8755
8755
  if (e.charAt(0) !== "." || dotOk) {
8756
8756
  var m;
8757
- if (negate && !prefix) {
8757
+ if (negate && !prefix2) {
8758
8758
  m = !e.match(pn);
8759
8759
  } else {
8760
8760
  m = e.match(pn);
@@ -8771,11 +8771,11 @@ var require_sync = __commonJS({
8771
8771
  this.matches[index4] = /* @__PURE__ */ Object.create(null);
8772
8772
  for (var i = 0; i < len; i++) {
8773
8773
  var e = matchedEntries[i];
8774
- if (prefix) {
8775
- if (prefix.slice(-1) !== "/")
8776
- e = prefix + "/" + e;
8774
+ if (prefix2) {
8775
+ if (prefix2.slice(-1) !== "/")
8776
+ e = prefix2 + "/" + e;
8777
8777
  else
8778
- e = prefix + e;
8778
+ e = prefix2 + e;
8779
8779
  }
8780
8780
  if (e.charAt(0) === "/" && !this.nomount) {
8781
8781
  e = path2.join(this.root, e);
@@ -8788,8 +8788,8 @@ var require_sync = __commonJS({
8788
8788
  for (var i = 0; i < len; i++) {
8789
8789
  var e = matchedEntries[i];
8790
8790
  var newPattern;
8791
- if (prefix)
8792
- newPattern = [prefix, e];
8791
+ if (prefix2)
8792
+ newPattern = [prefix2, e];
8793
8793
  else
8794
8794
  newPattern = [e];
8795
8795
  this._process(newPattern.concat(remain), index4, inGlobStar);
@@ -8896,12 +8896,12 @@ var require_sync = __commonJS({
8896
8896
  break;
8897
8897
  }
8898
8898
  };
8899
- GlobSync.prototype._processGlobStar = function(prefix, read, abs, remain, index4, inGlobStar) {
8899
+ GlobSync.prototype._processGlobStar = function(prefix2, read, abs, remain, index4, inGlobStar) {
8900
8900
  var entries = this._readdir(abs, inGlobStar);
8901
8901
  if (!entries)
8902
8902
  return;
8903
8903
  var remainWithoutGlobStar = remain.slice(1);
8904
- var gspref = prefix ? [prefix] : [];
8904
+ var gspref = prefix2 ? [prefix2] : [];
8905
8905
  var noGlobStar = gspref.concat(remainWithoutGlobStar);
8906
8906
  this._process(noGlobStar, index4, false);
8907
8907
  var len = entries.length;
@@ -8918,25 +8918,25 @@ var require_sync = __commonJS({
8918
8918
  this._process(below, index4, true);
8919
8919
  }
8920
8920
  };
8921
- GlobSync.prototype._processSimple = function(prefix, index4) {
8922
- var exists2 = this._stat(prefix);
8921
+ GlobSync.prototype._processSimple = function(prefix2, index4) {
8922
+ var exists2 = this._stat(prefix2);
8923
8923
  if (!this.matches[index4])
8924
8924
  this.matches[index4] = /* @__PURE__ */ Object.create(null);
8925
8925
  if (!exists2)
8926
8926
  return;
8927
- if (prefix && isAbsolute(prefix) && !this.nomount) {
8928
- var trail = /[\/\\]$/.test(prefix);
8929
- if (prefix.charAt(0) === "/") {
8930
- prefix = path2.join(this.root, prefix);
8927
+ if (prefix2 && isAbsolute(prefix2) && !this.nomount) {
8928
+ var trail = /[\/\\]$/.test(prefix2);
8929
+ if (prefix2.charAt(0) === "/") {
8930
+ prefix2 = path2.join(this.root, prefix2);
8931
8931
  } else {
8932
- prefix = path2.resolve(this.root, prefix);
8932
+ prefix2 = path2.resolve(this.root, prefix2);
8933
8933
  if (trail)
8934
- prefix += "/";
8934
+ prefix2 += "/";
8935
8935
  }
8936
8936
  }
8937
8937
  if (process.platform === "win32")
8938
- prefix = prefix.replace(/\\/g, "/");
8939
- this._emitMatch(index4, prefix);
8938
+ prefix2 = prefix2.replace(/\\/g, "/");
8939
+ this._emitMatch(index4, prefix2);
8940
8940
  };
8941
8941
  GlobSync.prototype._stat = function(f) {
8942
8942
  var abs = this._makeAbs(f);
@@ -9331,46 +9331,46 @@ var require_glob = __commonJS({
9331
9331
  while (typeof pattern[n] === "string") {
9332
9332
  n++;
9333
9333
  }
9334
- var prefix;
9334
+ var prefix2;
9335
9335
  switch (n) {
9336
9336
  case pattern.length:
9337
9337
  this._processSimple(pattern.join("/"), index4, cb);
9338
9338
  return;
9339
9339
  case 0:
9340
- prefix = null;
9340
+ prefix2 = null;
9341
9341
  break;
9342
9342
  default:
9343
- prefix = pattern.slice(0, n).join("/");
9343
+ prefix2 = pattern.slice(0, n).join("/");
9344
9344
  break;
9345
9345
  }
9346
9346
  var remain = pattern.slice(n);
9347
9347
  var read;
9348
- if (prefix === null)
9348
+ if (prefix2 === null)
9349
9349
  read = ".";
9350
- else if (isAbsolute(prefix) || isAbsolute(pattern.map(function(p) {
9350
+ else if (isAbsolute(prefix2) || isAbsolute(pattern.map(function(p) {
9351
9351
  return typeof p === "string" ? p : "[*]";
9352
9352
  }).join("/"))) {
9353
- if (!prefix || !isAbsolute(prefix))
9354
- prefix = "/" + prefix;
9355
- read = prefix;
9353
+ if (!prefix2 || !isAbsolute(prefix2))
9354
+ prefix2 = "/" + prefix2;
9355
+ read = prefix2;
9356
9356
  } else
9357
- read = prefix;
9357
+ read = prefix2;
9358
9358
  var abs = this._makeAbs(read);
9359
9359
  if (childrenIgnored(this, read))
9360
9360
  return cb();
9361
9361
  var isGlobStar = remain[0] === minimatch2.GLOBSTAR;
9362
9362
  if (isGlobStar)
9363
- this._processGlobStar(prefix, read, abs, remain, index4, inGlobStar, cb);
9363
+ this._processGlobStar(prefix2, read, abs, remain, index4, inGlobStar, cb);
9364
9364
  else
9365
- this._processReaddir(prefix, read, abs, remain, index4, inGlobStar, cb);
9365
+ this._processReaddir(prefix2, read, abs, remain, index4, inGlobStar, cb);
9366
9366
  };
9367
- Glob.prototype._processReaddir = function(prefix, read, abs, remain, index4, inGlobStar, cb) {
9367
+ Glob.prototype._processReaddir = function(prefix2, read, abs, remain, index4, inGlobStar, cb) {
9368
9368
  var self2 = this;
9369
9369
  this._readdir(abs, inGlobStar, function(er, entries) {
9370
- return self2._processReaddir2(prefix, read, abs, remain, index4, inGlobStar, entries, cb);
9370
+ return self2._processReaddir2(prefix2, read, abs, remain, index4, inGlobStar, entries, cb);
9371
9371
  });
9372
9372
  };
9373
- Glob.prototype._processReaddir2 = function(prefix, read, abs, remain, index4, inGlobStar, entries, cb) {
9373
+ Glob.prototype._processReaddir2 = function(prefix2, read, abs, remain, index4, inGlobStar, entries, cb) {
9374
9374
  if (!entries)
9375
9375
  return cb();
9376
9376
  var pn = remain[0];
@@ -9382,7 +9382,7 @@ var require_glob = __commonJS({
9382
9382
  var e = entries[i];
9383
9383
  if (e.charAt(0) !== "." || dotOk) {
9384
9384
  var m;
9385
- if (negate && !prefix) {
9385
+ if (negate && !prefix2) {
9386
9386
  m = !e.match(pn);
9387
9387
  } else {
9388
9388
  m = e.match(pn);
@@ -9399,11 +9399,11 @@ var require_glob = __commonJS({
9399
9399
  this.matches[index4] = /* @__PURE__ */ Object.create(null);
9400
9400
  for (var i = 0; i < len; i++) {
9401
9401
  var e = matchedEntries[i];
9402
- if (prefix) {
9403
- if (prefix !== "/")
9404
- e = prefix + "/" + e;
9402
+ if (prefix2) {
9403
+ if (prefix2 !== "/")
9404
+ e = prefix2 + "/" + e;
9405
9405
  else
9406
- e = prefix + e;
9406
+ e = prefix2 + e;
9407
9407
  }
9408
9408
  if (e.charAt(0) === "/" && !this.nomount) {
9409
9409
  e = path2.join(this.root, e);
@@ -9416,11 +9416,11 @@ var require_glob = __commonJS({
9416
9416
  for (var i = 0; i < len; i++) {
9417
9417
  var e = matchedEntries[i];
9418
9418
  var newPattern;
9419
- if (prefix) {
9420
- if (prefix !== "/")
9421
- e = prefix + "/" + e;
9419
+ if (prefix2) {
9420
+ if (prefix2 !== "/")
9421
+ e = prefix2 + "/" + e;
9422
9422
  else
9423
- e = prefix + e;
9423
+ e = prefix2 + e;
9424
9424
  }
9425
9425
  this._process([e].concat(remain), index4, inGlobStar, cb);
9426
9426
  }
@@ -9551,17 +9551,17 @@ var require_glob = __commonJS({
9551
9551
  }
9552
9552
  return cb();
9553
9553
  };
9554
- Glob.prototype._processGlobStar = function(prefix, read, abs, remain, index4, inGlobStar, cb) {
9554
+ Glob.prototype._processGlobStar = function(prefix2, read, abs, remain, index4, inGlobStar, cb) {
9555
9555
  var self2 = this;
9556
9556
  this._readdir(abs, inGlobStar, function(er, entries) {
9557
- self2._processGlobStar2(prefix, read, abs, remain, index4, inGlobStar, entries, cb);
9557
+ self2._processGlobStar2(prefix2, read, abs, remain, index4, inGlobStar, entries, cb);
9558
9558
  });
9559
9559
  };
9560
- Glob.prototype._processGlobStar2 = function(prefix, read, abs, remain, index4, inGlobStar, entries, cb) {
9560
+ Glob.prototype._processGlobStar2 = function(prefix2, read, abs, remain, index4, inGlobStar, entries, cb) {
9561
9561
  if (!entries)
9562
9562
  return cb();
9563
9563
  var remainWithoutGlobStar = remain.slice(1);
9564
- var gspref = prefix ? [prefix] : [];
9564
+ var gspref = prefix2 ? [prefix2] : [];
9565
9565
  var noGlobStar = gspref.concat(remainWithoutGlobStar);
9566
9566
  this._process(noGlobStar, index4, false, cb);
9567
9567
  var isSym = this.symlinks[abs];
@@ -9579,30 +9579,30 @@ var require_glob = __commonJS({
9579
9579
  }
9580
9580
  cb();
9581
9581
  };
9582
- Glob.prototype._processSimple = function(prefix, index4, cb) {
9582
+ Glob.prototype._processSimple = function(prefix2, index4, cb) {
9583
9583
  var self2 = this;
9584
- this._stat(prefix, function(er, exists2) {
9585
- self2._processSimple2(prefix, index4, er, exists2, cb);
9584
+ this._stat(prefix2, function(er, exists2) {
9585
+ self2._processSimple2(prefix2, index4, er, exists2, cb);
9586
9586
  });
9587
9587
  };
9588
- Glob.prototype._processSimple2 = function(prefix, index4, er, exists2, cb) {
9588
+ Glob.prototype._processSimple2 = function(prefix2, index4, er, exists2, cb) {
9589
9589
  if (!this.matches[index4])
9590
9590
  this.matches[index4] = /* @__PURE__ */ Object.create(null);
9591
9591
  if (!exists2)
9592
9592
  return cb();
9593
- if (prefix && isAbsolute(prefix) && !this.nomount) {
9594
- var trail = /[\/\\]$/.test(prefix);
9595
- if (prefix.charAt(0) === "/") {
9596
- prefix = path2.join(this.root, prefix);
9593
+ if (prefix2 && isAbsolute(prefix2) && !this.nomount) {
9594
+ var trail = /[\/\\]$/.test(prefix2);
9595
+ if (prefix2.charAt(0) === "/") {
9596
+ prefix2 = path2.join(this.root, prefix2);
9597
9597
  } else {
9598
- prefix = path2.resolve(this.root, prefix);
9598
+ prefix2 = path2.resolve(this.root, prefix2);
9599
9599
  if (trail)
9600
- prefix += "/";
9600
+ prefix2 += "/";
9601
9601
  }
9602
9602
  }
9603
9603
  if (process.platform === "win32")
9604
- prefix = prefix.replace(/\\/g, "/");
9605
- this._emitMatch(index4, prefix);
9604
+ prefix2 = prefix2.replace(/\\/g, "/");
9605
+ this._emitMatch(index4, prefix2);
9606
9606
  cb();
9607
9607
  };
9608
9608
  Glob.prototype._stat = function(f, cb) {
@@ -9866,8 +9866,8 @@ import process2 from "process";
9866
9866
  import os from "os";
9867
9867
  import tty from "tty";
9868
9868
  function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
9869
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
9870
- const position = argv.indexOf(prefix + flag);
9869
+ const prefix2 = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
9870
+ const position = argv.indexOf(prefix2 + flag);
9871
9871
  const terminatorPosition = argv.indexOf("--");
9872
9872
  return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
9873
9873
  }
@@ -10009,12 +10009,12 @@ function stringReplaceAll(string, substring, replacer) {
10009
10009
  returnValue += string.slice(endIndex);
10010
10010
  return returnValue;
10011
10011
  }
10012
- function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index4) {
10012
+ function stringEncaseCRLFWithFirstIndex(string, prefix2, postfix, index4) {
10013
10013
  let endIndex = 0;
10014
10014
  let returnValue = "";
10015
10015
  do {
10016
10016
  const gotCR = string[index4 - 1] === "\r";
10017
- returnValue += string.slice(endIndex, gotCR ? index4 - 1 : index4) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
10017
+ returnValue += string.slice(endIndex, gotCR ? index4 - 1 : index4) + prefix2 + (gotCR ? "\r\n" : "\n") + postfix;
10018
10018
  endIndex = index4 + 1;
10019
10019
  index4 = string.indexOf("\n", endIndex);
10020
10020
  } while (index4 !== -1);
@@ -15910,16 +15910,12 @@ var init_schemaValidator = __esm({
15910
15910
  mysqlSchemaSquashed,
15911
15911
  SQLiteSchemaSquashed
15912
15912
  ]);
15913
- commonSchema = unionType([
15914
- pgSchema,
15915
- mysqlSchema,
15916
- sqliteSchema
15917
- ]);
15913
+ commonSchema = unionType([pgSchema, mysqlSchema, sqliteSchema]);
15918
15914
  }
15919
15915
  });
15920
15916
 
15921
15917
  // src/cli/validations/common.ts
15922
- var sqliteDriversLiterals, sqliteDriver, postgresDriver, driver, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema;
15918
+ var sqliteDriversLiterals, migrationFilesPrefixes, prefix, sqliteDriver, postgresDriver, driver, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema;
15923
15919
  var init_common2 = __esm({
15924
15920
  "src/cli/validations/common.ts"() {
15925
15921
  "use strict";
@@ -15931,6 +15927,17 @@ var init_common2 = __esm({
15931
15927
  literalType("d1-http"),
15932
15928
  literalType("expo")
15933
15929
  ];
15930
+ migrationFilesPrefixes = [
15931
+ literalType("index"),
15932
+ literalType("timestamp"),
15933
+ literalType("supabase"),
15934
+ literalType("unix"),
15935
+ literalType("none")
15936
+ ];
15937
+ prefix = unionType(migrationFilesPrefixes);
15938
+ {
15939
+ const _2 = "";
15940
+ }
15934
15941
  sqliteDriver = unionType(sqliteDriversLiterals);
15935
15942
  postgresDriver = literalType("aws-data-api");
15936
15943
  driver = unionType([sqliteDriver, postgresDriver]);
@@ -15939,9 +15946,13 @@ var init_common2 = __esm({
15939
15946
  schema: unionType([stringType(), stringType().array()]).optional(),
15940
15947
  out: stringType().optional(),
15941
15948
  breakpoints: booleanType().optional().default(true),
15949
+ verbose: booleanType().optional().default(false),
15942
15950
  driver: driver.optional(),
15943
15951
  tablesFilter: unionType([stringType(), stringType().array()]).optional(),
15944
- schemaFilter: unionType([stringType(), stringType().array()]).default(["public"])
15952
+ schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
15953
+ migrations: objectType({
15954
+ prefix: prefix.optional().default("index")
15955
+ }).optional()
15945
15956
  });
15946
15957
  casing = unionType([literalType("camel"), literalType("preserve")]).default(
15947
15958
  "preserve"
@@ -16129,6 +16140,7 @@ var init_cli = __esm({
16129
16140
  out: stringType().optional().default("./drizzle"),
16130
16141
  config: stringType().optional(),
16131
16142
  name: stringType().optional(),
16143
+ prefix: prefix.optional(),
16132
16144
  breakpoints: booleanType().optional().default(true),
16133
16145
  custom: booleanType().optional().default(false)
16134
16146
  }).strict();
@@ -16149,7 +16161,10 @@ var init_cli = __esm({
16149
16161
  schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
16150
16162
  extensionsFilters: literalType("postgis").array().optional(),
16151
16163
  introspectCasing: casing,
16152
- breakpoints: booleanType().optional().default(true)
16164
+ breakpoints: booleanType().optional().default(true),
16165
+ database: objectType({
16166
+ prefix: prefix.optional().default("index")
16167
+ }).optional()
16153
16168
  }).passthrough();
16154
16169
  configCheck = objectType({
16155
16170
  dialect: dialect3.optional(),
@@ -16269,7 +16284,8 @@ var init_utils6 = __esm({
16269
16284
  out: stringType().optional().default("drizzle"),
16270
16285
  migrations: objectType({
16271
16286
  table: stringType().optional(),
16272
- schema: stringType().optional()
16287
+ schema: stringType().optional(),
16288
+ prefix: unionType([literalType("index"), literalType("timestamp"), literalType("none")]).optional().default("index")
16273
16289
  }).optional()
16274
16290
  });
16275
16291
  }
@@ -19401,7 +19417,7 @@ var require_difflib = __commonJS({
19401
19417
  return `${beginning},${beginning + length - 1}`;
19402
19418
  };
19403
19419
  contextDiff = function(a, b, { fromfile, tofile, fromfiledate, tofiledate, n, lineterm } = {}) {
19404
- 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;
19420
+ 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;
19405
19421
  if (fromfile == null) {
19406
19422
  fromfile = "";
19407
19423
  }
@@ -19420,7 +19436,7 @@ var require_difflib = __commonJS({
19420
19436
  if (lineterm == null) {
19421
19437
  lineterm = "\n";
19422
19438
  }
19423
- prefix = {
19439
+ prefix2 = {
19424
19440
  insert: "+ ",
19425
19441
  delete: "- ",
19426
19442
  replace: "! ",
@@ -19456,7 +19472,7 @@ var require_difflib = __commonJS({
19456
19472
  ref1 = a.slice(i1, i2);
19457
19473
  for (o = 0, len2 = ref1.length; o < len2; o++) {
19458
19474
  line = ref1[o];
19459
- lines.push(prefix[tag] + line);
19475
+ lines.push(prefix2[tag] + line);
19460
19476
  }
19461
19477
  }
19462
19478
  }
@@ -19478,7 +19494,7 @@ var require_difflib = __commonJS({
19478
19494
  ref2 = b.slice(j1, j2);
19479
19495
  for (q = 0, len4 = ref2.length; q < len4; q++) {
19480
19496
  line = ref2[q];
19481
- lines.push(prefix[tag] + line);
19497
+ lines.push(prefix2[tag] + line);
19482
19498
  }
19483
19499
  }
19484
19500
  }
@@ -19644,8 +19660,8 @@ var require_has_flag = __commonJS({
19644
19660
  module.exports = function(flag, argv) {
19645
19661
  argv = argv || process.argv;
19646
19662
  var terminatorPos = argv.indexOf("--");
19647
- var prefix = /^-{1,2}/.test(flag) ? "" : "--";
19648
- var pos = argv.indexOf(prefix + flag);
19663
+ var prefix2 = /^-{1,2}/.test(flag) ? "" : "--";
19664
+ var pos = argv.indexOf(prefix2 + flag);
19649
19665
  return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
19650
19666
  };
19651
19667
  }
@@ -20254,7 +20270,7 @@ var require_colorize = __commonJS({
20254
20270
  };
20255
20271
  var subcolorizeToCallback = function(options, key, diff2, output, color2, indent) {
20256
20272
  let subvalue;
20257
- const prefix = key ? `${key}: ` : "";
20273
+ const prefix2 = key ? `${key}: ` : "";
20258
20274
  const subindent = indent + " ";
20259
20275
  const outputElisions = (n) => {
20260
20276
  const maxElisions = options.maxElisions === void 0 ? Infinity : options.maxElisions;
@@ -20272,7 +20288,7 @@ var require_colorize = __commonJS({
20272
20288
  subcolorizeToCallback(options, key, diff2.__old, output, "-", indent);
20273
20289
  return subcolorizeToCallback(options, key, diff2.__new, output, "+", indent);
20274
20290
  } else {
20275
- output(color2, `${indent}${prefix}{`);
20291
+ output(color2, `${indent}${prefix2}{`);
20276
20292
  for (const subkey of Object.keys(diff2)) {
20277
20293
  let m;
20278
20294
  subvalue = diff2[subkey];
@@ -20287,7 +20303,7 @@ var require_colorize = __commonJS({
20287
20303
  return output(color2, `${indent}}`);
20288
20304
  }
20289
20305
  case "array": {
20290
- output(color2, `${indent}${prefix}[`);
20306
+ output(color2, `${indent}${prefix2}[`);
20291
20307
  let looksLikeDiff = true;
20292
20308
  for (const item of diff2) {
20293
20309
  if (extendedTypeOf(item) !== "array" || !(item.length === 2 || item.length === 1 && item[0] === " ") || !(typeof item[0] === "string") || item[0].length !== 1 || ![" ", "-", "+", "~"].includes(item[0])) {
@@ -20326,7 +20342,7 @@ var require_colorize = __commonJS({
20326
20342
  }
20327
20343
  default:
20328
20344
  if (diff2 === 0 || diff2 === null || diff2 === false || diff2 === "" || diff2) {
20329
- return output(color2, indent + prefix + JSON.stringify(diff2));
20345
+ return output(color2, indent + prefix2 + JSON.stringify(diff2));
20330
20346
  }
20331
20347
  }
20332
20348
  };
@@ -23107,6 +23123,13 @@ var init_snapshotsDiffer = __esm({
23107
23123
  return false;
23108
23124
  }
23109
23125
  }
23126
+ if (st.type === "alter_table_alter_column_set_notnull") {
23127
+ if (jsonStatements.find(
23128
+ (it) => it.type === "alter_table_alter_column_set_identity" && it.tableName === st.tableName && it.schema === st.schema
23129
+ )) {
23130
+ return false;
23131
+ }
23132
+ }
23110
23133
  return true;
23111
23134
  });
23112
23135
  const sqlStatements = fromJson(filteredJsonStatements, "postgresql");
@@ -23661,7 +23684,12 @@ var init_snapshotsDiffer = __esm({
23661
23684
  {}
23662
23685
  );
23663
23686
  jsonCreateIndexesForAllAlteredTables.push(
23664
- ...prepareCreateIndexesJson(it.name, it.schema, createdIndexes || {})
23687
+ ...prepareCreateIndexesJson(
23688
+ it.name,
23689
+ it.schema,
23690
+ createdIndexes || {},
23691
+ curFull.internal
23692
+ )
23665
23693
  );
23666
23694
  jsonDropIndexesForAllAlteredTables.push(
23667
23695
  ...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {})
@@ -24156,7 +24184,7 @@ var init_sqlgenerator = __esm({
24156
24184
  const notNullStatement = column4.notNull ? " NOT NULL" : "";
24157
24185
  const defaultStatement = column4.default !== void 0 ? ` DEFAULT ${column4.default}` : "";
24158
24186
  const autoincrementStatement = column4.autoincrement ? " AUTOINCREMENT" : "";
24159
- const generatedStatement = column4.generated ? ` GENERATED ALWAYS AS (${column4.generated.as}) ${column4.generated.type.toUpperCase()}` : "";
24187
+ const generatedStatement = column4.generated ? ` GENERATED ALWAYS AS ${column4.generated.as} ${column4.generated.type.toUpperCase()}` : "";
24160
24188
  statement += " ";
24161
24189
  statement += `\`${column4.name}\` ${column4.type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${notNullStatement}${generatedStatement}`;
24162
24190
  statement += i === columns.length - 1 ? "" : ",\n";
@@ -24231,8 +24259,6 @@ var init_sqlgenerator = __esm({
24231
24259
  const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
24232
24260
  const unsquashedIdentity = PgSquasher.unsquashIdentity(identity);
24233
24261
  const unsquashedOldIdentity = PgSquasher.unsquashIdentity(oldIdentity);
24234
- const identityWithSchema = schema4 ? `"${schema4}"."${unsquashedIdentity?.name}"` : `"${unsquashedIdentity?.name}"`;
24235
- const oldIdentityWithSchema = schema4 ? `"${schema4}"."${unsquashedOldIdentity?.name}"` : `"${unsquashedOldIdentity?.name}"`;
24236
24262
  const statementsToReturn = [];
24237
24263
  if (unsquashedOldIdentity.type !== unsquashedIdentity.type) {
24238
24264
  statementsToReturn.push(
@@ -24541,14 +24567,18 @@ var init_sqlgenerator = __esm({
24541
24567
  }
24542
24568
  convert(statement) {
24543
24569
  const { tableName, column: column4, schema: schema4 } = statement;
24544
- const { name: name2, type, notNull, generated } = column4;
24570
+ const { name: name2, type, notNull, generated, primaryKey, identity } = column4;
24571
+ const primaryKeyStatement = primaryKey ? " PRIMARY KEY" : "";
24545
24572
  const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
24546
24573
  const defaultStatement = `${column4.default !== void 0 ? ` DEFAULT ${column4.default}` : ""}`;
24547
24574
  const schemaPrefix = column4.typeSchema && column4.typeSchema !== "public" ? `"${column4.typeSchema}".` : "";
24548
24575
  const fixedType = isPgNativeType(column4.type) ? column4.type : `${schemaPrefix}"${column4.type}"`;
24549
24576
  const notNullStatement = `${notNull ? " NOT NULL" : ""}`;
24577
+ const unsquashedIdentity = identity ? PgSquasher.unsquashIdentity(identity) : void 0;
24578
+ const identityWithSchema = schema4 ? `"${schema4}"."${unsquashedIdentity?.name}"` : `"${unsquashedIdentity?.name}"`;
24579
+ 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` : ""})` : "";
24550
24580
  const generatedStatement = ` GENERATED ALWAYS AS (${generated?.as}) STORED`;
24551
- return `ALTER TABLE ${tableNameWithSchema} ADD COLUMN "${name2}" ${fixedType}${defaultStatement}${notNullStatement}${generated ? generatedStatement : ""};`;
24581
+ return `ALTER TABLE ${tableNameWithSchema} ADD COLUMN "${name2}" ${fixedType}${primaryKeyStatement}${defaultStatement}${notNullStatement}${generated ? generatedStatement : ""}${identityStatement};`;
24552
24582
  }
24553
24583
  };
24554
24584
  MySqlAlterTableAddColumnConvertor = class extends Convertor {
@@ -24587,7 +24617,7 @@ var init_sqlgenerator = __esm({
24587
24617
  const primaryKeyStatement = `${primaryKey ? " PRIMARY KEY" : ""}`;
24588
24618
  const referenceAsObject = referenceData ? SQLiteSquasher.unsquashFK(referenceData) : void 0;
24589
24619
  const referenceStatement = `${referenceAsObject ? ` REFERENCES ${referenceAsObject.tableTo}(${referenceAsObject.columnsTo})` : ""}`;
24590
- const generatedStatement = generated ? ` GENERATED ALWAYS AS (${generated.as}) ${generated.type.toUpperCase()}` : "";
24620
+ const generatedStatement = generated ? ` GENERATED ALWAYS AS ${generated.as} ${generated.type.toUpperCase()}` : "";
24591
24621
  return `ALTER TABLE \`${tableName}\` ADD \`${name2}\` ${type}${primaryKeyStatement}${defaultStatement}${notNullStatement}${generatedStatement}${referenceStatement};`;
24592
24622
  }
24593
24623
  };
@@ -24876,8 +24906,8 @@ var init_sqlgenerator = __esm({
24876
24906
  columnPk,
24877
24907
  columnGenerated
24878
24908
  } = statement;
24879
- const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
24880
- const addColumnStatement = new PgAlterTableAddColumnConvertor().convert({
24909
+ const tableNameWithSchema = schema4 ? `\`${schema4}\`.\`${tableName}\`` : `\`${tableName}\``;
24910
+ const addColumnStatement = new MySqlAlterTableAddColumnConvertor().convert({
24881
24911
  schema: schema4,
24882
24912
  tableName,
24883
24913
  column: {
@@ -24893,7 +24923,7 @@ var init_sqlgenerator = __esm({
24893
24923
  type: "alter_table_add_column"
24894
24924
  });
24895
24925
  return [
24896
- `ALTER TABLE ${tableNameWithSchema} drop column "${columnName}";`,
24926
+ `ALTER TABLE ${tableNameWithSchema} drop column \`${columnName}\`;`,
24897
24927
  addColumnStatement
24898
24928
  ];
24899
24929
  }
@@ -27307,7 +27337,7 @@ function createSetOperator2(type, isAll) {
27307
27337
  return leftSelect.addSetOperators(setOperators);
27308
27338
  };
27309
27339
  }
27310
- var _a199, SQLiteSelectBuilder, _a200, _b145, SQLiteSelectQueryBuilderBase, _a201, _b146, SQLiteSelectBase, getSQLiteSetOperators, union3, unionAll2, intersect2, except2;
27340
+ var _a199, SQLiteSelectBuilder, _a200, _b145, SQLiteSelectQueryBuilderBase, _a201, _b146, SQLiteSelectBase, getSQLiteSetOperators, union2, unionAll2, intersect2, except2;
27311
27341
  var init_select3 = __esm({
27312
27342
  "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"() {
27313
27343
  "use strict";
@@ -27910,12 +27940,12 @@ var init_select3 = __esm({
27910
27940
  __publicField(SQLiteSelectBase, _a201, "SQLiteSelect");
27911
27941
  applyMixins(SQLiteSelectBase, [QueryPromise]);
27912
27942
  getSQLiteSetOperators = () => ({
27913
- union: union3,
27943
+ union: union2,
27914
27944
  unionAll: unionAll2,
27915
27945
  intersect: intersect2,
27916
27946
  except: except2
27917
27947
  });
27918
- union3 = createSetOperator2("union", false);
27948
+ union2 = createSetOperator2("union", false);
27919
27949
  unionAll2 = createSetOperator2("union", true);
27920
27950
  intersect2 = createSetOperator2("intersect", false);
27921
27951
  except2 = createSetOperator2("except", false);
@@ -29070,13 +29100,19 @@ function mapSqlToSqliteType(sqlType) {
29070
29100
  }
29071
29101
  function extractGeneratedColumns(input) {
29072
29102
  const columns = {};
29073
- const lines = input.split("\n");
29103
+ const lines = input.split(/,\s*(?![^()]*\))/);
29074
29104
  for (const line of lines) {
29075
29105
  if (line.includes("GENERATED ALWAYS AS")) {
29076
29106
  const parts = line.trim().split(/\s+/);
29077
- const columnName = parts[0].slice(1, parts[0].length - 1);
29107
+ const columnName = parts[0].replace(/[`'"]/g, "");
29078
29108
  const expression = line.substring(line.indexOf("("), line.indexOf(")") + 1).trim();
29079
- const type = parts[parts.length - 1].replace(/(^,)|(,$)/g, "").toLowerCase();
29109
+ const typeIndex = parts.findIndex(
29110
+ (part) => part.match(/(stored|virtual)/i)
29111
+ );
29112
+ let type = "virtual";
29113
+ if (typeIndex !== -1) {
29114
+ type = parts[typeIndex].replace(/[^a-z]/gi, "").toLowerCase();
29115
+ }
29080
29116
  columns[columnName] = {
29081
29117
  columnName,
29082
29118
  expression,
@@ -29124,7 +29160,7 @@ var init_sqliteSerializer = __esm({
29124
29160
  notNull,
29125
29161
  autoincrement: is(column4, SQLiteBaseInteger) ? column4.autoIncrement : false,
29126
29162
  generated: generated ? {
29127
- as: is(generated.as, SQL) ? dialect5.sqlToQuery(generated.as, "indexes").sql : typeof generated.as === "function" ? dialect5.sqlToQuery(generated.as(), "indexes").sql : generated.as,
29163
+ as: is(generated.as, SQL) ? `(${dialect5.sqlToQuery(generated.as, "indexes").sql})` : typeof generated.as === "function" ? `(${dialect5.sqlToQuery(generated.as(), "indexes").sql})` : `(${generated.as})`,
29128
29164
  type: generated.mode ?? "virtual"
29129
29165
  } : void 0
29130
29166
  };
@@ -29479,12 +29515,12 @@ WHERE
29479
29515
  if (progressCallback) {
29480
29516
  progressCallback("indexes", indexesCount, "fetching");
29481
29517
  }
29482
- if (typeof tableInResult.indexes[constraintName] !== "undefined") {
29518
+ if (typeof tableInResult.indexes[constraintName] !== "undefined" && columnName) {
29483
29519
  tableInResult.indexes[constraintName].columns.push(columnName);
29484
29520
  } else {
29485
29521
  tableInResult.indexes[constraintName] = {
29486
29522
  name: constraintName,
29487
- columns: [columnName],
29523
+ columns: columnName ? [columnName] : [],
29488
29524
  isUnique
29489
29525
  };
29490
29526
  }
@@ -31817,7 +31853,7 @@ function createSetOperator3(type, isAll) {
31817
31853
  return leftSelect.addSetOperators(setOperators);
31818
31854
  };
31819
31855
  }
31820
- var _a298, MySqlSelectBuilder, _a299, _b222, MySqlSelectQueryBuilderBase, _a300, _b223, MySqlSelectBase, getMySqlSetOperators, union4, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
31856
+ var _a298, MySqlSelectBuilder, _a299, _b222, MySqlSelectQueryBuilderBase, _a300, _b223, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
31821
31857
  var init_select4 = __esm({
31822
31858
  "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"() {
31823
31859
  "use strict";
@@ -32507,14 +32543,14 @@ var init_select4 = __esm({
32507
32543
  __publicField(MySqlSelectBase, _a300, "MySqlSelect");
32508
32544
  applyMixins(MySqlSelectBase, [QueryPromise]);
32509
32545
  getMySqlSetOperators = () => ({
32510
- union: union4,
32546
+ union: union3,
32511
32547
  unionAll: unionAll3,
32512
32548
  intersect: intersect3,
32513
32549
  intersectAll: intersectAll2,
32514
32550
  except: except3,
32515
32551
  exceptAll: exceptAll2
32516
32552
  });
32517
- union4 = createSetOperator3("union", false);
32553
+ union3 = createSetOperator3("union", false);
32518
32554
  unionAll3 = createSetOperator3("union", true);
32519
32555
  intersect3 = createSetOperator3("intersect", false);
32520
32556
  intersectAll2 = createSetOperator3("intersect", true);
@@ -34650,7 +34686,7 @@ var pgSuggestions = async (db, statements) => {
34650
34686
  }
34651
34687
  }
34652
34688
  }
34653
- const stmnt = fromJson([statement], "postgresql")[0];
34689
+ const stmnt = fromJson([statement], "postgresql");
34654
34690
  if (typeof stmnt !== "undefined") {
34655
34691
  if (statement.type === "drop_table") {
34656
34692
  statementsToExecute.push(
@@ -34660,7 +34696,7 @@ var pgSuggestions = async (db, statements) => {
34660
34696
  )} CASCADE;`
34661
34697
  );
34662
34698
  } else {
34663
- statementsToExecute.push(stmnt);
34699
+ statementsToExecute.push(...stmnt);
34664
34700
  }
34665
34701
  }
34666
34702
  }
@@ -35034,14 +35070,14 @@ var logSuggestionsAndReturn = async (connection, statements, json1, json2, meta)
35034
35070
  }
35035
35071
  tablesContext[newTableName] = _moveDataStatements(
35036
35072
  statement.tableName,
35037
- json2,
35073
+ json1,
35038
35074
  true
35039
35075
  );
35040
35076
  } else {
35041
35077
  if (typeof tablesContext[newTableName] === "undefined") {
35042
35078
  tablesContext[newTableName] = _moveDataStatements(
35043
35079
  statement.tableName,
35044
- json2
35080
+ json1
35045
35081
  );
35046
35082
  }
35047
35083
  }
@@ -35060,7 +35096,7 @@ var logSuggestionsAndReturn = async (connection, statements, json1, json2, meta)
35060
35096
  const uniqueTableRefs = [...new Set(tablesReferncingCurrent)];
35061
35097
  for (const table4 of uniqueTableRefs) {
35062
35098
  if (typeof tablesContext[table4] === "undefined") {
35063
- tablesContext[table4] = [..._moveDataStatements(table4, json2)];
35099
+ tablesContext[table4] = [..._moveDataStatements(table4, json1)];
35064
35100
  }
35065
35101
  }
35066
35102
  }
@@ -35081,9 +35117,9 @@ var logSuggestionsAndReturn = async (connection, statements, json1, json2, meta)
35081
35117
  );
35082
35118
  }
35083
35119
  } else {
35084
- const stmnt = fromJson([statement], "sqlite")[0];
35120
+ const stmnt = fromJson([statement], "sqlite");
35085
35121
  if (typeof stmnt !== "undefined") {
35086
- statementsToExecute.push(stmnt);
35122
+ statementsToExecute.push(...stmnt);
35087
35123
  }
35088
35124
  }
35089
35125
  }