drizzle-kit 0.21.4 → 0.22.0-407e2e6

Sign up to get free protection for your applications and to get access to all the features.
package/bin.cjs CHANGED
@@ -1456,7 +1456,7 @@ var init_global = __esm({
1456
1456
  "src/global.ts"() {
1457
1457
  "use strict";
1458
1458
  originUUID = "00000000-0000-0000-0000-000000000000";
1459
- snapshotVersion = "6";
1459
+ snapshotVersion = "7";
1460
1460
  mapValues = (obj, map) => {
1461
1461
  const result = Object.keys(obj).reduce(function(result2, key) {
1462
1462
  result2[key] = map(obj[key]);
@@ -5658,7 +5658,7 @@ var init_mysqlSchema = __esm({
5658
5658
  });
5659
5659
 
5660
5660
  // src/serializer/pgSchema.ts
5661
- var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, index2, fk2, column2, tableV32, compositePK2, uniqueConstraint2, tableV42, table2, schemaHash2, kitInternals2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaExternal, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg;
5661
+ var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn, index2, indexV4, indexV5, indexV6, fk2, column2, tableV32, compositePK2, uniqueConstraint2, tableV42, tableV6, tableV5, table2, schemaHash2, kitInternals2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaInternalV6, pgSchemaExternal, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashedV6, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchemaV6, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg;
5662
5662
  var init_pgSchema = __esm({
5663
5663
  "src/serializer/pgSchema.ts"() {
5664
5664
  "use strict";
@@ -5726,10 +5726,48 @@ var init_pgSchema = __esm({
5726
5726
  tables: recordType(stringType(), tableV1),
5727
5727
  enums: recordType(stringType(), enumSchemaV1)
5728
5728
  }).strict();
5729
+ indexColumn = objectType({
5730
+ expression: stringType(),
5731
+ isExpression: booleanType(),
5732
+ asc: booleanType(),
5733
+ nulls: stringType().optional(),
5734
+ opclass: stringType().optional()
5735
+ });
5729
5736
  index2 = objectType({
5737
+ name: stringType(),
5738
+ columns: indexColumn.array(),
5739
+ isUnique: booleanType(),
5740
+ with: recordType(stringType(), anyType()).optional(),
5741
+ method: stringType().default("btree"),
5742
+ where: stringType().optional(),
5743
+ concurrently: booleanType().default(false)
5744
+ }).strict();
5745
+ indexV4 = objectType({
5730
5746
  name: stringType(),
5731
5747
  columns: stringType().array(),
5732
- isUnique: booleanType()
5748
+ isUnique: booleanType(),
5749
+ with: recordType(stringType(), stringType()).optional(),
5750
+ method: stringType().default("btree"),
5751
+ where: stringType().optional(),
5752
+ concurrently: booleanType().default(false)
5753
+ }).strict();
5754
+ indexV5 = objectType({
5755
+ name: stringType(),
5756
+ columns: stringType().array(),
5757
+ isUnique: booleanType(),
5758
+ with: recordType(stringType(), stringType()).optional(),
5759
+ method: stringType().default("btree"),
5760
+ where: stringType().optional(),
5761
+ concurrently: booleanType().default(false)
5762
+ }).strict();
5763
+ indexV6 = objectType({
5764
+ name: stringType(),
5765
+ columns: stringType().array(),
5766
+ isUnique: booleanType(),
5767
+ with: recordType(stringType(), stringType()).optional(),
5768
+ method: stringType().default("btree"),
5769
+ where: stringType().optional(),
5770
+ concurrently: booleanType().default(false)
5733
5771
  }).strict();
5734
5772
  fk2 = objectType({
5735
5773
  name: stringType(),
@@ -5771,9 +5809,27 @@ var init_pgSchema = __esm({
5771
5809
  name: stringType(),
5772
5810
  schema: stringType(),
5773
5811
  columns: recordType(stringType(), column2),
5774
- indexes: recordType(stringType(), index2),
5812
+ indexes: recordType(stringType(), indexV4),
5775
5813
  foreignKeys: recordType(stringType(), fk2)
5776
5814
  }).strict();
5815
+ tableV6 = objectType({
5816
+ name: stringType(),
5817
+ schema: stringType(),
5818
+ columns: recordType(stringType(), column2),
5819
+ indexes: recordType(stringType(), indexV6),
5820
+ foreignKeys: recordType(stringType(), fk2),
5821
+ compositePrimaryKeys: recordType(stringType(), compositePK2),
5822
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5823
+ }).strict();
5824
+ tableV5 = objectType({
5825
+ name: stringType(),
5826
+ schema: stringType(),
5827
+ columns: recordType(stringType(), column2),
5828
+ indexes: recordType(stringType(), indexV5),
5829
+ foreignKeys: recordType(stringType(), fk2),
5830
+ compositePrimaryKeys: recordType(stringType(), compositePK2),
5831
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5832
+ }).strict();
5777
5833
  table2 = objectType({
5778
5834
  name: stringType(),
5779
5835
  schema: stringType(),
@@ -5818,7 +5874,7 @@ var init_pgSchema = __esm({
5818
5874
  pgSchemaInternalV5 = objectType({
5819
5875
  version: literalType("5"),
5820
5876
  dialect: literalType("pg"),
5821
- tables: recordType(stringType(), table2),
5877
+ tables: recordType(stringType(), tableV5),
5822
5878
  enums: recordType(stringType(), enumSchemaV1),
5823
5879
  schemas: recordType(stringType(), stringType()),
5824
5880
  _meta: objectType({
@@ -5828,6 +5884,19 @@ var init_pgSchema = __esm({
5828
5884
  }),
5829
5885
  internal: kitInternals2
5830
5886
  }).strict();
5887
+ pgSchemaInternalV6 = objectType({
5888
+ version: literalType("6"),
5889
+ dialect: literalType("postgresql"),
5890
+ tables: recordType(stringType(), tableV6),
5891
+ enums: recordType(stringType(), enumSchema),
5892
+ schemas: recordType(stringType(), stringType()),
5893
+ _meta: objectType({
5894
+ schemas: recordType(stringType(), stringType()),
5895
+ tables: recordType(stringType(), stringType()),
5896
+ columns: recordType(stringType(), stringType())
5897
+ }),
5898
+ internal: kitInternals2
5899
+ }).strict();
5831
5900
  pgSchemaExternal = objectType({
5832
5901
  version: literalType("5"),
5833
5902
  dialect: literalType("pg"),
@@ -5841,7 +5910,7 @@ var init_pgSchema = __esm({
5841
5910
  })
5842
5911
  }).strict();
5843
5912
  pgSchemaInternal = objectType({
5844
- version: literalType("6"),
5913
+ version: literalType("7"),
5845
5914
  dialect: literalType("postgresql"),
5846
5915
  tables: recordType(stringType(), table2),
5847
5916
  enums: recordType(stringType(), enumSchema),
@@ -5876,29 +5945,94 @@ var init_pgSchema = __esm({
5876
5945
  enums: recordType(stringType(), enumSchemaV1),
5877
5946
  schemas: recordType(stringType(), stringType())
5878
5947
  }).strict();
5879
- pgSchemaSquashed = objectType({
5948
+ pgSchemaSquashedV6 = objectType({
5880
5949
  version: literalType("6"),
5881
5950
  dialect: literalType("postgresql"),
5882
5951
  tables: recordType(stringType(), tableSquashed2),
5883
5952
  enums: recordType(stringType(), enumSchema),
5884
5953
  schemas: recordType(stringType(), stringType())
5885
5954
  }).strict();
5955
+ pgSchemaSquashed = objectType({
5956
+ version: literalType("7"),
5957
+ dialect: literalType("postgresql"),
5958
+ tables: recordType(stringType(), tableSquashed2),
5959
+ enums: recordType(stringType(), enumSchema),
5960
+ schemas: recordType(stringType(), stringType())
5961
+ }).strict();
5886
5962
  pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
5887
5963
  pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
5888
5964
  pgSchemaV5 = pgSchemaInternalV5.merge(schemaHash2);
5965
+ pgSchemaV6 = pgSchemaInternalV6.merge(schemaHash2);
5889
5966
  pgSchema = pgSchemaInternal.merge(schemaHash2);
5890
- backwardCompatiblePgSchema = unionType([pgSchemaV5, pgSchema]);
5967
+ backwardCompatiblePgSchema = unionType([
5968
+ pgSchemaV5,
5969
+ pgSchemaV6,
5970
+ pgSchema
5971
+ ]);
5891
5972
  PgSquasher = {
5892
5973
  squashIdx: (idx) => {
5893
5974
  index2.parse(idx);
5894
- return `${idx.name};${idx.columns.join(",")};${idx.isUnique}`;
5975
+ return `${idx.name};${idx.columns.map(
5976
+ (c) => `${c.expression},${c.isExpression},${c.asc},${c.nulls},${c.opclass}`
5977
+ ).join(",,")};${idx.isUnique};${idx.concurrently};${idx.method};${idx.where};${JSON.stringify(idx.with)}`;
5895
5978
  },
5896
5979
  unsquashIdx: (input) => {
5897
- const [name, columnsString, isUnique] = input.split(";");
5980
+ const [
5981
+ name,
5982
+ columnsString,
5983
+ isUnique,
5984
+ concurrently,
5985
+ method,
5986
+ where,
5987
+ idxWith
5988
+ ] = input.split(";");
5989
+ const columnString = columnsString.split(",,");
5990
+ const columns = [];
5991
+ for (const column7 of columnString) {
5992
+ const [expression, isExpression, asc, nulls, opclass] = column7.split(",");
5993
+ columns.push({
5994
+ nulls,
5995
+ isExpression: isExpression === "true",
5996
+ asc: asc === "true",
5997
+ expression,
5998
+ opclass: opclass === "undefined" ? void 0 : opclass
5999
+ });
6000
+ }
5898
6001
  const result = index2.parse({
5899
6002
  name,
5900
- columns: columnsString.split(","),
5901
- isUnique: isUnique === "true"
6003
+ columns,
6004
+ isUnique: isUnique === "true",
6005
+ concurrently: concurrently === "true",
6006
+ method,
6007
+ where: where === "undefined" ? void 0 : where,
6008
+ with: !idxWith || idxWith === "undefined" ? void 0 : JSON.parse(idxWith)
6009
+ });
6010
+ return result;
6011
+ },
6012
+ squashIdxPush: (idx) => {
6013
+ index2.parse(idx);
6014
+ return `${idx.name};${idx.columns.map((c) => `${c.isExpression ? "" : c.expression},${c.asc},${c.nulls}`).join(",,")};${idx.isUnique};${idx.method};${JSON.stringify(idx.with)}`;
6015
+ },
6016
+ unsquashIdxPush: (input) => {
6017
+ const [name, columnsString, isUnique, method, idxWith] = input.split(";");
6018
+ const columnString = columnsString.split(",,");
6019
+ const columns = [];
6020
+ for (const column7 of columnString) {
6021
+ const [expression, asc, nulls, opclass] = column7.split(",");
6022
+ columns.push({
6023
+ nulls,
6024
+ isExpression: expression === "",
6025
+ asc: asc === "true",
6026
+ expression
6027
+ });
6028
+ }
6029
+ const result = index2.parse({
6030
+ name,
6031
+ columns,
6032
+ isUnique: isUnique === "true",
6033
+ concurrently: false,
6034
+ method,
6035
+ with: idxWith === "undefined" ? void 0 : JSON.parse(idxWith)
5902
6036
  });
5903
6037
  return result;
5904
6038
  },
@@ -5947,11 +6081,11 @@ var init_pgSchema = __esm({
5947
6081
  return result;
5948
6082
  }
5949
6083
  };
5950
- squashPgScheme = (json) => {
6084
+ squashPgScheme = (json, action) => {
5951
6085
  const mappedTables = Object.fromEntries(
5952
6086
  Object.entries(json.tables).map((it) => {
5953
6087
  const squashedIndexes = mapValues(it[1].indexes, (index4) => {
5954
- return PgSquasher.squashIdx(index4);
6088
+ return action === "push" ? PgSquasher.squashIdxPush(index4) : PgSquasher.squashIdx(index4);
5955
6089
  });
5956
6090
  const squashedFKs = mapValues(it[1].foreignKeys, (fk4) => {
5957
6091
  return PgSquasher.squashFK(fk4);
@@ -5980,7 +6114,7 @@ var init_pgSchema = __esm({
5980
6114
  })
5981
6115
  );
5982
6116
  return {
5983
- version: "6",
6117
+ version: "7",
5984
6118
  dialect: json.dialect,
5985
6119
  tables: mappedTables,
5986
6120
  enums: json.enums,
@@ -6223,7 +6357,7 @@ var init_sqliteSchema = __esm({
6223
6357
  });
6224
6358
 
6225
6359
  // src/utils.ts
6226
- var import_fs, import_path, copy, objectValues, assertV1OutFolder, dryJournal, prepareOutFolder, validatorForDialect, validateWithReport, prepareMigrationFolder, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey;
6360
+ var import_fs, import_path, import_url, copy, objectValues, assertV1OutFolder, dryJournal, prepareOutFolder, validatorForDialect, validateWithReport, prepareMigrationFolder, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey, normaliseSQLiteUrl;
6227
6361
  var init_utils = __esm({
6228
6362
  "src/utils.ts"() {
6229
6363
  "use strict";
@@ -6234,6 +6368,7 @@ var init_utils = __esm({
6234
6368
  init_sqliteSchema();
6235
6369
  init_source();
6236
6370
  import_path = require("path");
6371
+ import_url = require("url");
6237
6372
  init_global();
6238
6373
  copy = (it) => {
6239
6374
  return JSON.parse(JSON.stringify(it));
@@ -6278,7 +6413,7 @@ var init_utils = __esm({
6278
6413
  validatorForDialect = (dialect7) => {
6279
6414
  switch (dialect7) {
6280
6415
  case "postgresql":
6281
- return { validator: backwardCompatiblePgSchema, version: 6 };
6416
+ return { validator: backwardCompatiblePgSchema, version: 7 };
6282
6417
  case "sqlite":
6283
6418
  return { validator: backwardCompatibleSqliteSchema, version: 6 };
6284
6419
  case "mysql":
@@ -6396,6 +6531,29 @@ var init_utils = __esm({
6396
6531
  const out = schema5 ? `"${schema5}"."${table4}"."${column7}"` : `"${table4}"."${column7}"`;
6397
6532
  return out;
6398
6533
  };
6534
+ normaliseSQLiteUrl = (it, type) => {
6535
+ if (type === "libsql") {
6536
+ if (it.startsWith("file:")) {
6537
+ return it;
6538
+ }
6539
+ try {
6540
+ const url = (0, import_url.parse)(it);
6541
+ if (url.protocol === null) {
6542
+ return `file:${it}`;
6543
+ }
6544
+ return it;
6545
+ } catch (e2) {
6546
+ return `file:${it}`;
6547
+ }
6548
+ }
6549
+ if (type === "better-sqlite") {
6550
+ if (it.startsWith("file:")) {
6551
+ return it.substring(5);
6552
+ }
6553
+ return it;
6554
+ }
6555
+ assertUnreachable(type);
6556
+ };
6399
6557
  }
6400
6558
  });
6401
6559
 
@@ -6809,7 +6967,7 @@ var require_semver = __commonJS({
6809
6967
  var require_parse = __commonJS({
6810
6968
  "node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/parse.js"(exports2, module2) {
6811
6969
  var SemVer = require_semver();
6812
- var parse6 = (version2, options, throwErrors = false) => {
6970
+ var parse7 = (version2, options, throwErrors = false) => {
6813
6971
  if (version2 instanceof SemVer) {
6814
6972
  return version2;
6815
6973
  }
@@ -6822,16 +6980,16 @@ var require_parse = __commonJS({
6822
6980
  throw er3;
6823
6981
  }
6824
6982
  };
6825
- module2.exports = parse6;
6983
+ module2.exports = parse7;
6826
6984
  }
6827
6985
  });
6828
6986
 
6829
6987
  // node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/valid.js
6830
6988
  var require_valid = __commonJS({
6831
6989
  "node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/valid.js"(exports2, module2) {
6832
- var parse6 = require_parse();
6990
+ var parse7 = require_parse();
6833
6991
  var valid = (version2, options) => {
6834
- const v6 = parse6(version2, options);
6992
+ const v6 = parse7(version2, options);
6835
6993
  return v6 ? v6.version : null;
6836
6994
  };
6837
6995
  module2.exports = valid;
@@ -6841,9 +6999,9 @@ var require_valid = __commonJS({
6841
6999
  // node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/clean.js
6842
7000
  var require_clean = __commonJS({
6843
7001
  "node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/clean.js"(exports2, module2) {
6844
- var parse6 = require_parse();
7002
+ var parse7 = require_parse();
6845
7003
  var clean = (version2, options) => {
6846
- const s2 = parse6(version2.trim().replace(/^[=v]+/, ""), options);
7004
+ const s2 = parse7(version2.trim().replace(/^[=v]+/, ""), options);
6847
7005
  return s2 ? s2.version : null;
6848
7006
  };
6849
7007
  module2.exports = clean;
@@ -6876,10 +7034,10 @@ var require_inc = __commonJS({
6876
7034
  // node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/diff.js
6877
7035
  var require_diff = __commonJS({
6878
7036
  "node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/diff.js"(exports2, module2) {
6879
- var parse6 = require_parse();
7037
+ var parse7 = require_parse();
6880
7038
  var diff2 = (version1, version2) => {
6881
- const v12 = parse6(version1, null, true);
6882
- const v22 = parse6(version2, null, true);
7039
+ const v12 = parse7(version1, null, true);
7040
+ const v22 = parse7(version2, null, true);
6883
7041
  const comparison = v12.compare(v22);
6884
7042
  if (comparison === 0) {
6885
7043
  return null;
@@ -6947,9 +7105,9 @@ var require_patch = __commonJS({
6947
7105
  // node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/prerelease.js
6948
7106
  var require_prerelease = __commonJS({
6949
7107
  "node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/prerelease.js"(exports2, module2) {
6950
- var parse6 = require_parse();
7108
+ var parse7 = require_parse();
6951
7109
  var prerelease = (version2, options) => {
6952
- const parsed = parse6(version2, options);
7110
+ const parsed = parse7(version2, options);
6953
7111
  return parsed && parsed.prerelease.length ? parsed.prerelease : null;
6954
7112
  };
6955
7113
  module2.exports = prerelease;
@@ -7121,7 +7279,7 @@ var require_cmp = __commonJS({
7121
7279
  var require_coerce = __commonJS({
7122
7280
  "node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/coerce.js"(exports2, module2) {
7123
7281
  var SemVer = require_semver();
7124
- var parse6 = require_parse();
7282
+ var parse7 = require_parse();
7125
7283
  var { safeRe: re2, t: t2 } = require_re();
7126
7284
  var coerce3 = (version2, options) => {
7127
7285
  if (version2 instanceof SemVer) {
@@ -7156,7 +7314,7 @@ var require_coerce = __commonJS({
7156
7314
  const patch = match2[4] || "0";
7157
7315
  const prerelease = options.includePrerelease && match2[5] ? `-${match2[5]}` : "";
7158
7316
  const build = options.includePrerelease && match2[6] ? `+${match2[6]}` : "";
7159
- return parse6(`${major}.${minor}.${patch}${prerelease}${build}`, options);
7317
+ return parse7(`${major}.${minor}.${patch}${prerelease}${build}`, options);
7160
7318
  };
7161
7319
  module2.exports = coerce3;
7162
7320
  }
@@ -8137,7 +8295,7 @@ var require_semver2 = __commonJS({
8137
8295
  var constants = require_constants();
8138
8296
  var SemVer = require_semver();
8139
8297
  var identifiers = require_identifiers();
8140
- var parse6 = require_parse();
8298
+ var parse7 = require_parse();
8141
8299
  var valid = require_valid();
8142
8300
  var clean = require_clean();
8143
8301
  var inc = require_inc();
@@ -8175,7 +8333,7 @@ var require_semver2 = __commonJS({
8175
8333
  var simplifyRange = require_simplify();
8176
8334
  var subset = require_subset();
8177
8335
  module2.exports = {
8178
- parse: parse6,
8336
+ parse: parse7,
8179
8337
  valid,
8180
8338
  clean,
8181
8339
  inc,
@@ -8265,7 +8423,7 @@ var init_utils2 = __esm({
8265
8423
  process.exit(1);
8266
8424
  }
8267
8425
  };
8268
- requiredApiVersion = 6;
8426
+ requiredApiVersion = 7;
8269
8427
  assertOrmCoreVersion = async () => {
8270
8428
  try {
8271
8429
  const { compatibilityVersion } = await import("drizzle-orm/version");
@@ -8829,7 +8987,7 @@ var require_ms = __commonJS({
8829
8987
  options = options || {};
8830
8988
  var type = typeof val2;
8831
8989
  if (type === "string" && val2.length > 0) {
8832
- return parse6(val2);
8990
+ return parse7(val2);
8833
8991
  } else if (type === "number" && isFinite(val2)) {
8834
8992
  return options.long ? fmtLong(val2) : fmtShort(val2);
8835
8993
  }
@@ -8837,7 +8995,7 @@ var require_ms = __commonJS({
8837
8995
  "val is not a non-empty string or a valid number. val=" + JSON.stringify(val2)
8838
8996
  );
8839
8997
  };
8840
- function parse6(str) {
8998
+ function parse7(str) {
8841
8999
  str = String(str);
8842
9000
  if (str.length > 100) {
8843
9001
  return;
@@ -12556,7 +12714,7 @@ var require_node2 = __commonJS({
12556
12714
  var token;
12557
12715
  var key;
12558
12716
  var root;
12559
- module22.exports = function parse6(text, reviver) {
12717
+ module22.exports = function parse7(text, reviver) {
12560
12718
  source = String(text);
12561
12719
  parseState = "start";
12562
12720
  stack = [];
@@ -13604,10 +13762,10 @@ var require_node2 = __commonJS({
13604
13762
  };
13605
13763
  });
13606
13764
  var require_lib32 = __commonJS2((exports3, module22) => {
13607
- var parse6 = require_parse4();
13765
+ var parse7 = require_parse4();
13608
13766
  var stringify4 = require_stringify3();
13609
13767
  var JSON5 = {
13610
- parse: parse6,
13768
+ parse: parse7,
13611
13769
  stringify: stringify4
13612
13770
  };
13613
13771
  module22.exports = JSON5;
@@ -15525,6 +15683,24 @@ var init_pgImports = __esm({
15525
15683
  }
15526
15684
  });
15527
15685
 
15686
+ // src/extensions/vector.ts
15687
+ var vectorOps;
15688
+ var init_vector = __esm({
15689
+ "src/extensions/vector.ts"() {
15690
+ "use strict";
15691
+ vectorOps = [
15692
+ "vector_l2_ops",
15693
+ "vector_ip_ops",
15694
+ "vector_cosine_ops",
15695
+ "vector_l1_ops",
15696
+ "bit_hamming_ops",
15697
+ "bit_jaccard_ops",
15698
+ "halfvec_l2_ops",
15699
+ "sparsevec_l2_ops"
15700
+ ];
15701
+ }
15702
+ });
15703
+
15528
15704
  // src/serializer/pgSerializer.ts
15529
15705
  var pgSerializer_exports = {};
15530
15706
  __export(pgSerializer_exports, {
@@ -15542,6 +15718,7 @@ var init_pgSerializer = __esm({
15542
15718
  init_serializer();
15543
15719
  init_source();
15544
15720
  init_outputs();
15721
+ init_vector();
15545
15722
  dialect5 = new import_pg_core2.PgDialect();
15546
15723
  indexName2 = (tableName, columns) => {
15547
15724
  return `${tableName}_${columns.join("_")}_index`;
@@ -15549,6 +15726,16 @@ var init_pgSerializer = __esm({
15549
15726
  generatePgSnapshot = (tables, enums, schemas, schemaFilter) => {
15550
15727
  const result = {};
15551
15728
  const indexesInSchema = {};
15729
+ const enumsToReturn = enums.reduce((map, obj) => {
15730
+ const enumSchema3 = obj.schema || "public";
15731
+ const key = `${enumSchema3}.${obj.enumName}`;
15732
+ map[key] = {
15733
+ name: obj.enumName,
15734
+ schema: enumSchema3,
15735
+ values: obj.enumValues
15736
+ };
15737
+ return map;
15738
+ }, {});
15552
15739
  for (const table4 of tables) {
15553
15740
  const {
15554
15741
  name: tableName,
@@ -15579,6 +15766,7 @@ var init_pgSerializer = __esm({
15579
15766
  typeSchema,
15580
15767
  primaryKey,
15581
15768
  notNull
15769
+ // isenum: typeof enumsToReturn[column.getSQLType()] !== "undefined",
15582
15770
  };
15583
15771
  if (column7.isUnique) {
15584
15772
  const existingUnique = uniqueConstraintObject[column7.uniqueName];
@@ -15692,18 +15880,71 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
15692
15880
  });
15693
15881
  indexes.forEach((value) => {
15694
15882
  const columns2 = value.config.columns;
15695
- let name = value.config.name;
15696
- name = name ? name : indexName2(
15697
- tableName,
15698
- columns2.map((it) => it.name)
15699
- );
15700
- let indexColumns = columns2.map((it) => {
15883
+ let indexColumnNames = [];
15884
+ columns2.forEach((it) => {
15701
15885
  if ((0, import_drizzle_orm5.is)(it, import_drizzle_orm5.SQL)) {
15702
- return dialect5.sqlToQuery(it).sql;
15703
- } else {
15704
- return it.name;
15886
+ if (typeof value.config.name === "undefined") {
15887
+ console.log(
15888
+ `
15889
+ ${withStyle.errorWarning(
15890
+ `Please specify an index name in ${(0, import_drizzle_orm5.getTableName)(
15891
+ value.config.table
15892
+ )} table that has "${dialect5.sqlToQuery(it).sql}" expression. We can generate index names for indexes on columns only; for expressions in indexes, you need to specify the name yourself.`
15893
+ )}`
15894
+ );
15895
+ process.exit(1);
15896
+ }
15897
+ }
15898
+ it = it;
15899
+ if (!(0, import_drizzle_orm5.is)(it, import_drizzle_orm5.SQL) && it.type === "PgVector" && typeof it.indexConfig.opClass === "undefined") {
15900
+ console.log(
15901
+ `
15902
+ ${withStyle.errorWarning(
15903
+ `You are specifying an index on the ${source_default.blueBright(
15904
+ it.name
15905
+ )} column inside the ${source_default.blueBright(
15906
+ tableName
15907
+ )} table with the ${source_default.blueBright(
15908
+ "vector"
15909
+ )} type without specifying an operator class. Vector extension doesn't have a default operator class, so you need to specify one of the available options. Here is a list of available op classes for the vector extension: [${vectorOps.map((it2) => `${source_default.underline(`${it2}`)}`).join(
15910
+ ", "
15911
+ )}].
15912
+
15913
+ You can specify it using current syntax: ${source_default.underline(
15914
+ `index("${value.config.name}").using("${value.config.method}", table.${it.name}.op("${vectorOps[0]}"))`
15915
+ )}
15916
+
15917
+ You can check the "pg_vector" docs for more info: https://github.com/pgvector/pgvector?tab=readme-ov-file#indexing
15918
+ `
15919
+ )}`
15920
+ );
15921
+ process.exit(1);
15705
15922
  }
15923
+ indexColumnNames.push(it.name);
15706
15924
  });
15925
+ const name = value.config.name ? value.config.name : indexName2(tableName, indexColumnNames);
15926
+ let indexColumns = columns2.map(
15927
+ (it) => {
15928
+ var _a, _b, _c, _d, _e2;
15929
+ if ((0, import_drizzle_orm5.is)(it, import_drizzle_orm5.SQL)) {
15930
+ return {
15931
+ expression: dialect5.sqlToQuery(it, "indexes").sql,
15932
+ asc: true,
15933
+ isExpression: true,
15934
+ nulls: "last"
15935
+ };
15936
+ } else {
15937
+ it = it;
15938
+ return {
15939
+ expression: it.name,
15940
+ isExpression: false,
15941
+ asc: ((_a = it.indexConfig) == null ? void 0 : _a.order) === "asc",
15942
+ nulls: ((_b = it.indexConfig) == null ? void 0 : _b.nulls) ? (_c = it.indexConfig) == null ? void 0 : _c.nulls : ((_d = it.indexConfig) == null ? void 0 : _d.order) === "desc" ? "first" : "last",
15943
+ opclass: (_e2 = it.indexConfig) == null ? void 0 : _e2.opClass
15944
+ };
15945
+ }
15946
+ }
15947
+ );
15707
15948
  if (typeof indexesInSchema[schema5 ?? "public"] !== "undefined") {
15708
15949
  if (indexesInSchema[schema5 ?? "public"].includes(name)) {
15709
15950
  console.log(
@@ -15725,7 +15966,11 @@ ${withStyle.errorWarning(
15725
15966
  indexesObject[name] = {
15726
15967
  name,
15727
15968
  columns: indexColumns,
15728
- isUnique: value.config.unique ?? false
15969
+ isUnique: value.config.unique ?? false,
15970
+ where: value.config.where ? dialect5.sqlToQuery(value.config.where).sql : void 0,
15971
+ concurrently: value.config.concurrently ?? false,
15972
+ method: value.config.method ?? "btree",
15973
+ with: value.config.with ?? {}
15729
15974
  };
15730
15975
  });
15731
15976
  const tableKey2 = `${schema5 ?? "public"}.${tableName}`;
@@ -15739,16 +15984,6 @@ ${withStyle.errorWarning(
15739
15984
  uniqueConstraints: uniqueConstraintObject
15740
15985
  };
15741
15986
  }
15742
- const enumsToReturn = enums.reduce((map, obj) => {
15743
- const enumSchema3 = obj.schema || "public";
15744
- const key = `${enumSchema3}.${obj.enumName}`;
15745
- map[key] = {
15746
- name: obj.enumName,
15747
- schema: enumSchema3,
15748
- values: obj.enumValues
15749
- };
15750
- return map;
15751
- }, {});
15752
15987
  const schemasObject = Object.fromEntries(
15753
15988
  schemas.filter((it) => {
15754
15989
  if (schemaFilter) {
@@ -15759,7 +15994,7 @@ ${withStyle.errorWarning(
15759
15994
  }).map((it) => [it.schemaName, it.schemaName])
15760
15995
  );
15761
15996
  return {
15762
- version: "6",
15997
+ version: "7",
15763
15998
  dialect: "postgresql",
15764
15999
  tables: result,
15765
16000
  enums: enumsToReturn,
@@ -16031,7 +16266,10 @@ ${withStyle.errorWarning(
16031
16266
  columnTypeMapped = trimChar(columnTypeMapped, '"');
16032
16267
  columnToReturn[columnName] = {
16033
16268
  name: columnName,
16034
- type: columnAdditionalDT === "USER-DEFINED" ? enumType3 : columnTypeMapped,
16269
+ type: (
16270
+ // filter vectors, but in future we should filter any extension that was installed by user
16271
+ columnAdditionalDT === "USER-DEFINED" && enumType3 !== "vector" ? enumType3 : columnTypeMapped
16272
+ ),
16035
16273
  typeSchema: enumsToReturn[`${tableSchema}.${enumType3}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType3}`].schema : void 0,
16036
16274
  primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
16037
16275
  // default: isSerial ? undefined : defaultValue,
@@ -16042,15 +16280,42 @@ ${withStyle.errorWarning(
16042
16280
  }
16043
16281
  }
16044
16282
  const dbIndexes = await db2.query(
16045
- `SELECT t.relname as table_name, i.relname AS index_name, ix.indisunique AS is_unique, a.attname AS column_name
16046
- FROM pg_class t
16047
- JOIN pg_index ix ON t.oid = ix.indrelid
16048
- JOIN pg_class i ON i.oid = ix.indexrelid
16049
- JOIN pg_attribute a ON a.attrelid = t.oid AND a.attnum = ANY(ix.indkey)
16050
- JOIN pg_namespace ns ON ns.oid = t.relnamespace
16051
- WHERE ns.nspname = '${tableSchema}'
16052
- AND t.relname = '${tableName}'
16053
- and ix.indisprimary = false;`
16283
+ `SELECT DISTINCT ON (t.relname, ic.relname, k.i) t.relname as table_name, ic.relname AS indexname,
16284
+ k.i AS index_order,
16285
+ i.indisunique as is_unique,
16286
+ am.amname as method,
16287
+ ic.reloptions as with,
16288
+ coalesce(a.attname,
16289
+ (('{' || pg_get_expr(
16290
+ i.indexprs,
16291
+ i.indrelid
16292
+ )
16293
+ || '}')::text[]
16294
+ )[k.i]
16295
+ ) AS column_name,
16296
+ CASE
16297
+ WHEN pg_get_expr(i.indexprs, i.indrelid) IS NOT NULL THEN 1
16298
+ ELSE 0
16299
+ END AS is_expression,
16300
+ i.indoption[k.i-1] & 1 = 1 AS descending,
16301
+ i.indoption[k.i-1] & 2 = 2 AS nulls_first,
16302
+ pg_get_expr(
16303
+ i.indpred,
16304
+ i.indrelid
16305
+ ) as where,
16306
+ opc.opcname
16307
+ FROM pg_class t
16308
+ LEFT JOIN pg_index i ON t.oid = i.indrelid
16309
+ LEFT JOIN pg_class ic ON ic.oid = i.indexrelid
16310
+ CROSS JOIN LATERAL (SELECT unnest(i.indkey), generate_subscripts(i.indkey, 1) + 1) AS k(attnum, i)
16311
+ LEFT JOIN pg_attribute AS a
16312
+ ON i.indrelid = a.attrelid AND k.attnum = a.attnum
16313
+ JOIN pg_namespace c on c.oid = t.relnamespace
16314
+ LEFT JOIN pg_am AS am ON ic.relam = am.oid
16315
+ JOIN pg_opclass opc ON opc.oid = ANY(i.indclass)
16316
+ WHERE
16317
+ c.nspname = '${tableSchema}' AND
16318
+ t.relname = '${tableName}';`
16054
16319
  );
16055
16320
  const dbIndexFromConstraint = await db2.query(
16056
16321
  `SELECT
@@ -16067,18 +16332,51 @@ ${withStyle.errorWarning(
16067
16332
  );
16068
16333
  const idxsInConsteraint = dbIndexFromConstraint.filter((it) => it.generated_by_constraint === 1).map((it) => it.index_name);
16069
16334
  for (const dbIndex of dbIndexes) {
16070
- const indexName4 = dbIndex.index_name;
16335
+ const indexName4 = dbIndex.indexname;
16071
16336
  const indexColumnName = dbIndex.column_name;
16072
16337
  const indexIsUnique = dbIndex.is_unique;
16338
+ const indexMethod = dbIndex.method;
16339
+ const indexWith = dbIndex.with;
16340
+ const indexWhere = dbIndex.where;
16341
+ const opclass = dbIndex.opcname;
16342
+ const isExpression = dbIndex.is_expression === 1;
16343
+ const desc = dbIndex.descending;
16344
+ const nullsFirst = dbIndex.nulls_first;
16345
+ const mappedWith = {};
16346
+ if (indexWith !== null) {
16347
+ indexWith.forEach((it) => {
16348
+ const splitted = it.split("=");
16349
+ mappedWith[splitted[0]] = splitted[1];
16350
+ });
16351
+ }
16073
16352
  if (idxsInConsteraint.includes(indexName4))
16074
16353
  continue;
16075
16354
  if (typeof indexToReturn[indexName4] !== "undefined") {
16076
- indexToReturn[indexName4].columns.push(indexColumnName);
16355
+ indexToReturn[indexName4].columns.push({
16356
+ expression: indexColumnName,
16357
+ asc: !desc,
16358
+ nulls: nullsFirst ? "first" : "last",
16359
+ opclass,
16360
+ isExpression
16361
+ });
16077
16362
  } else {
16078
16363
  indexToReturn[indexName4] = {
16079
16364
  name: indexName4,
16080
- columns: [indexColumnName],
16081
- isUnique: indexIsUnique
16365
+ columns: [
16366
+ {
16367
+ expression: indexColumnName,
16368
+ asc: !desc,
16369
+ nulls: nullsFirst ? "first" : "last",
16370
+ opclass,
16371
+ isExpression
16372
+ }
16373
+ ],
16374
+ isUnique: indexIsUnique,
16375
+ // should not be a part of diff detecs
16376
+ concurrently: false,
16377
+ method: indexMethod,
16378
+ where: indexWhere === null ? void 0 : indexWhere,
16379
+ with: mappedWith
16082
16380
  };
16083
16381
  }
16084
16382
  }
@@ -16114,7 +16412,7 @@ ${withStyle.errorWarning(
16114
16412
  }
16115
16413
  const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
16116
16414
  return {
16117
- version: "6",
16415
+ version: "7",
16118
16416
  dialect: "postgresql",
16119
16417
  tables: result,
16120
16418
  enums: enumsToReturn,
@@ -16898,7 +17196,7 @@ var init_sqlgenerator = __esm({
16898
17196
  if (pgNativeTypes.has(it))
16899
17197
  return true;
16900
17198
  const toCheck = it.replace(/ /g, "");
16901
- return toCheck.startsWith("varchar(") || toCheck.startsWith("char(") || toCheck.startsWith("numeric(") || toCheck.startsWith("timestamp(") || toCheck.startsWith("intervalyear(") || toCheck.startsWith("intervalmonth(") || toCheck.startsWith("intervalday(") || toCheck.startsWith("intervalhour(") || toCheck.startsWith("intervalminute(") || toCheck.startsWith("intervalsecond(") || toCheck.startsWith("intervalyeartomonth(") || toCheck.startsWith("intervaldaytohour(") || toCheck.startsWith("intervaldaytominute(") || toCheck.startsWith("intervaldaytosecond(") || toCheck.startsWith("intervalhourtominute(") || toCheck.startsWith("intervalhourtosecond(") || toCheck.startsWith("intervalminutetosecond(") || /^(\w+)(\[\d*])+$/.test(it);
17199
+ return toCheck.startsWith("varchar(") || toCheck.startsWith("char(") || toCheck.startsWith("numeric(") || toCheck.startsWith("timestamp(") || toCheck.startsWith("intervalyear(") || toCheck.startsWith("intervalmonth(") || toCheck.startsWith("intervalday(") || toCheck.startsWith("intervalhour(") || toCheck.startsWith("intervalminute(") || toCheck.startsWith("intervalsecond(") || toCheck.startsWith("intervalyeartomonth(") || toCheck.startsWith("intervaldaytohour(") || toCheck.startsWith("intervaldaytominute(") || toCheck.startsWith("intervaldaytosecond(") || toCheck.startsWith("intervalhourtominute(") || toCheck.startsWith("intervalhourtosecond(") || toCheck.startsWith("intervalminutetosecond(") || toCheck.startsWith("vector(") || /^(\w+)(\[\d*])+$/.test(it);
16902
17200
  };
16903
17201
  Convertor = class {
16904
17202
  };
@@ -17860,14 +18158,34 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
17860
18158
  };
17861
18159
  CreatePgIndexConvertor = class extends Convertor {
17862
18160
  can(statement, dialect7) {
17863
- return statement.type === "create_index" && dialect7 === "postgresql";
18161
+ return statement.type === "create_index_pg" && dialect7 === "postgresql";
17864
18162
  }
17865
18163
  convert(statement) {
17866
- const { name, columns, isUnique } = PgSquasher.unsquashIdx(statement.data);
18164
+ const {
18165
+ name,
18166
+ columns,
18167
+ isUnique,
18168
+ concurrently,
18169
+ with: withMap,
18170
+ method,
18171
+ where
18172
+ } = statement.data;
17867
18173
  const indexPart = isUnique ? "UNIQUE INDEX" : "INDEX";
17868
- const value = columns.map((it) => `"${it}"`).join(",");
18174
+ const value = columns.map(
18175
+ (it) => `${it.expression}${it.opclass ? ` ${it.opclass}` : it.asc ? "" : " DESC"}${it.asc && it.nulls && it.nulls === "last" || it.opclass ? "" : ` NULLS ${it.nulls.toUpperCase()}`}`
18176
+ ).join(",");
17869
18177
  const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
17870
- return `CREATE ${indexPart} IF NOT EXISTS "${name}" ON ${tableNameWithSchema} (${value});`;
18178
+ function reverseLogic(mappedWith) {
18179
+ let reversedString = "";
18180
+ for (const key in mappedWith) {
18181
+ if (mappedWith.hasOwnProperty(key)) {
18182
+ reversedString += `${key}=${mappedWith[key]},`;
18183
+ }
18184
+ }
18185
+ reversedString = reversedString.slice(0, -1);
18186
+ return reversedString;
18187
+ }
18188
+ return `CREATE ${indexPart}${concurrently ? " CONCURRENTLY" : ""} IF NOT EXISTS "${name}" ON ${tableNameWithSchema} USING ${method} (${value})${Object.keys(withMap).length !== 0 ? ` WITH (${reverseLogic(withMap)})` : ""}${where ? ` WHERE ${where}` : ""};`;
17871
18189
  }
17872
18190
  };
17873
18191
  CreateMySqlIndexConvertor = class extends Convertor {
@@ -18521,7 +18839,7 @@ var init_jsonDiffer = __esm({
18521
18839
  });
18522
18840
 
18523
18841
  // src/jsonStatements.ts
18524
- var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql;
18842
+ var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql;
18525
18843
  var init_jsonStatements = __esm({
18526
18844
  "src/jsonStatements.ts"() {
18527
18845
  "use strict";
@@ -19286,6 +19604,28 @@ var init_jsonStatements = __esm({
19286
19604
  }
19287
19605
  return [...dropPkStatements, ...setPkStatements, ...statements];
19288
19606
  };
19607
+ preparePgCreateIndexesJson = (tableName, schema5, indexes, fullSchema, action) => {
19608
+ if (action === "push") {
19609
+ return Object.values(indexes).map((indexData) => {
19610
+ const unsquashedIndex = PgSquasher.unsquashIdxPush(indexData);
19611
+ const data = fullSchema.tables[`${schema5 === "" ? "public" : schema5}.${tableName}`].indexes[unsquashedIndex.name];
19612
+ return {
19613
+ type: "create_index_pg",
19614
+ tableName,
19615
+ data,
19616
+ schema: schema5
19617
+ };
19618
+ });
19619
+ }
19620
+ return Object.values(indexes).map((indexData) => {
19621
+ return {
19622
+ type: "create_index_pg",
19623
+ tableName,
19624
+ data: PgSquasher.unsquashIdx(indexData),
19625
+ schema: schema5
19626
+ };
19627
+ });
19628
+ };
19289
19629
  prepareCreateIndexesJson = (tableName, schema5, indexes) => {
19290
19630
  return Object.values(indexes).map((indexData) => {
19291
19631
  return {
@@ -19317,20 +19657,21 @@ var init_jsonStatements = __esm({
19317
19657
  });
19318
19658
  };
19319
19659
  prepareAlterReferencesJson = (tableName, schema5, foreignKeys) => {
19320
- const keys = Object.keys(foreignKeys);
19321
19660
  const stmts = [];
19322
- if (keys.length > 0) {
19323
- stmts.push(
19324
- ...prepareDropReferencesJson(tableName, schema5, {
19325
- [keys[0]]: foreignKeys[keys[0]].__old
19326
- })
19327
- );
19328
- stmts.push(
19329
- ...prepareCreateReferencesJson(tableName, schema5, {
19330
- [keys[0]]: foreignKeys[keys[0]].__new
19331
- })
19332
- );
19333
- }
19661
+ Object.values(foreignKeys).map((val2) => {
19662
+ stmts.push({
19663
+ type: "delete_reference",
19664
+ tableName,
19665
+ schema: schema5,
19666
+ data: val2.__old
19667
+ });
19668
+ stmts.push({
19669
+ type: "create_reference",
19670
+ tableName,
19671
+ schema: schema5,
19672
+ data: val2.__new
19673
+ });
19674
+ });
19334
19675
  return stmts;
19335
19676
  };
19336
19677
  prepareDropIndexesJson = (tableName, schema5, indexes) => {
@@ -19661,7 +20002,7 @@ var init_snapshotsDiffer = __esm({
19661
20002
  }
19662
20003
  return column7;
19663
20004
  };
19664
- applyPgSnapshotsDiff = async (json1, json2, schemasResolver2, enumsResolver2, tablesResolver2, columnsResolver2, prevFull, curFull) => {
20005
+ applyPgSnapshotsDiff = async (json1, json2, schemasResolver2, enumsResolver2, tablesResolver2, columnsResolver2, prevFull, curFull, action) => {
19665
20006
  const schemasDiff = diffSchemasOrTables(json1.schemas, json2.schemas);
19666
20007
  const {
19667
20008
  created: createdSchemas,
@@ -19823,7 +20164,13 @@ var init_snapshotsDiffer = __esm({
19823
20164
  const typedResult = diffResultScheme.parse(diffResult);
19824
20165
  const jsonStatements = [];
19825
20166
  const jsonCreateIndexesForCreatedTables = createdTables.map((it) => {
19826
- return prepareCreateIndexesJson(it.name, it.schema, it.indexes);
20167
+ return preparePgCreateIndexesJson(
20168
+ it.name,
20169
+ it.schema,
20170
+ it.indexes,
20171
+ curFull,
20172
+ action
20173
+ );
19827
20174
  }).flat();
19828
20175
  const jsonDropTables = deletedTables.map((it) => {
19829
20176
  return prepareDropTableJson(it);
@@ -19947,10 +20294,12 @@ var init_snapshotsDiffer = __esm({
19947
20294
  return preparePgAlterColumns(it.name, it.schema, it.altered, json2);
19948
20295
  }).flat();
19949
20296
  const jsonCreateIndexesFoAlteredTables = alteredTables.map((it) => {
19950
- return prepareCreateIndexesJson(
20297
+ return preparePgCreateIndexesJson(
19951
20298
  it.name,
19952
20299
  it.schema,
19953
- it.addedIndexes || {}
20300
+ it.addedIndexes || {},
20301
+ curFull,
20302
+ action
19954
20303
  );
19955
20304
  }).flat();
19956
20305
  const jsonDropIndexesForAllAlteredTables = alteredTables.map((it) => {
@@ -19976,7 +20325,13 @@ var init_snapshotsDiffer = __esm({
19976
20325
  {}
19977
20326
  );
19978
20327
  jsonCreateIndexesFoAlteredTables.push(
19979
- ...prepareCreateIndexesJson(it.name, it.schema, createdIndexes || {})
20328
+ ...preparePgCreateIndexesJson(
20329
+ it.name,
20330
+ it.schema,
20331
+ createdIndexes || {},
20332
+ curFull,
20333
+ action
20334
+ )
19980
20335
  );
19981
20336
  jsonDropIndexesForAllAlteredTables.push(
19982
20337
  ...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {})
@@ -22083,7 +22438,10 @@ var init_migrate = __esm({
22083
22438
  const schemaPath = config.schema;
22084
22439
  try {
22085
22440
  assertV1OutFolder(outFolder);
22086
- const { snapshots, journal } = prepareMigrationFolder(outFolder, "postgresql");
22441
+ const { snapshots, journal } = prepareMigrationFolder(
22442
+ outFolder,
22443
+ "postgresql"
22444
+ );
22087
22445
  const { prev, cur, custom: custom2 } = await preparePgMigrationSnapshot(
22088
22446
  snapshots,
22089
22447
  schemaPath
@@ -22134,8 +22492,8 @@ var init_migrate = __esm({
22134
22492
  );
22135
22493
  const validatedPrev = pgSchema.parse(prev);
22136
22494
  const validatedCur = pgSchema.parse(cur);
22137
- const squashedPrev = squashPgScheme(validatedPrev);
22138
- const squashedCur = squashPgScheme(validatedCur);
22495
+ const squashedPrev = squashPgScheme(validatedPrev, "push");
22496
+ const squashedCur = squashPgScheme(validatedCur, "push");
22139
22497
  const { sqlStatements, statements, _meta } = await applyPgSnapshotsDiff(
22140
22498
  squashedPrev,
22141
22499
  squashedCur,
@@ -22144,7 +22502,8 @@ var init_migrate = __esm({
22144
22502
  tablesResolver,
22145
22503
  columnsResolver,
22146
22504
  validatedPrev,
22147
- validatedCur
22505
+ validatedCur,
22506
+ "push"
22148
22507
  );
22149
22508
  return { sqlStatements, statements, squashedPrev, squashedCur };
22150
22509
  };
@@ -22615,7 +22974,7 @@ var require_main = __commonJS({
22615
22974
  var packageJson = require_package();
22616
22975
  var version2 = packageJson.version;
22617
22976
  var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
22618
- function parse6(src) {
22977
+ function parse7(src) {
22619
22978
  const obj = {};
22620
22979
  let lines = src.toString();
22621
22980
  lines = lines.replace(/\r\n?/mg, "\n");
@@ -22858,7 +23217,7 @@ var require_main = __commonJS({
22858
23217
  _parseVault,
22859
23218
  config,
22860
23219
  decrypt,
22861
- parse: parse6,
23220
+ parse: parse7,
22862
23221
  populate
22863
23222
  };
22864
23223
  module2.exports.configDotenv = DotenvModule.configDotenv;
@@ -24271,9 +24630,9 @@ var require_glob_parent = __commonJS({
24271
24630
  }
24272
24631
  });
24273
24632
 
24274
- // node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js
24633
+ // node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/utils.js
24275
24634
  var require_utils2 = __commonJS({
24276
- "node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js"(exports2) {
24635
+ "node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/utils.js"(exports2) {
24277
24636
  "use strict";
24278
24637
  exports2.isInteger = (num) => {
24279
24638
  if (typeof num === "number") {
@@ -24293,7 +24652,7 @@ var require_utils2 = __commonJS({
24293
24652
  return (Number(max) - Number(min)) / Number(step) >= limit;
24294
24653
  };
24295
24654
  exports2.escapeNode = (block, n = 0, type) => {
24296
- const node = block.nodes[n];
24655
+ let node = block.nodes[n];
24297
24656
  if (!node)
24298
24657
  return;
24299
24658
  if (type && node.type === type || node.type === "open" || node.type === "close") {
@@ -24344,14 +24703,8 @@ var require_utils2 = __commonJS({
24344
24703
  const result = [];
24345
24704
  const flat = (arr) => {
24346
24705
  for (let i2 = 0; i2 < arr.length; i2++) {
24347
- const ele = arr[i2];
24348
- if (Array.isArray(ele)) {
24349
- flat(ele);
24350
- continue;
24351
- }
24352
- if (ele !== void 0) {
24353
- result.push(ele);
24354
- }
24706
+ let ele = arr[i2];
24707
+ Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele);
24355
24708
  }
24356
24709
  return result;
24357
24710
  };
@@ -24361,15 +24714,15 @@ var require_utils2 = __commonJS({
24361
24714
  }
24362
24715
  });
24363
24716
 
24364
- // node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js
24717
+ // node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/stringify.js
24365
24718
  var require_stringify = __commonJS({
24366
- "node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js"(exports2, module2) {
24719
+ "node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/stringify.js"(exports2, module2) {
24367
24720
  "use strict";
24368
24721
  var utils = require_utils2();
24369
24722
  module2.exports = (ast, options = {}) => {
24370
- const stringify4 = (node, parent = {}) => {
24371
- const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
24372
- const invalidNode = node.invalid === true && options.escapeInvalid === true;
24723
+ let stringify4 = (node, parent = {}) => {
24724
+ let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
24725
+ let invalidNode = node.invalid === true && options.escapeInvalid === true;
24373
24726
  let output = "";
24374
24727
  if (node.value) {
24375
24728
  if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
@@ -24381,7 +24734,7 @@ var require_stringify = __commonJS({
24381
24734
  return node.value;
24382
24735
  }
24383
24736
  if (node.nodes) {
24384
- for (const child of node.nodes) {
24737
+ for (let child of node.nodes) {
24385
24738
  output += stringify4(child);
24386
24739
  }
24387
24740
  }
@@ -24826,24 +25179,23 @@ var require_fill_range = __commonJS({
24826
25179
  }
24827
25180
  });
24828
25181
 
24829
- // node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/compile.js
25182
+ // node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/compile.js
24830
25183
  var require_compile = __commonJS({
24831
- "node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/compile.js"(exports2, module2) {
25184
+ "node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/compile.js"(exports2, module2) {
24832
25185
  "use strict";
24833
25186
  var fill = require_fill_range();
24834
25187
  var utils = require_utils2();
24835
25188
  var compile = (ast, options = {}) => {
24836
- const walk = (node, parent = {}) => {
24837
- const invalidBlock = utils.isInvalidBrace(parent);
24838
- const invalidNode = node.invalid === true && options.escapeInvalid === true;
24839
- const invalid = invalidBlock === true || invalidNode === true;
24840
- const prefix = options.escapeInvalid === true ? "\\" : "";
25189
+ let walk = (node, parent = {}) => {
25190
+ let invalidBlock = utils.isInvalidBrace(parent);
25191
+ let invalidNode = node.invalid === true && options.escapeInvalid === true;
25192
+ let invalid = invalidBlock === true || invalidNode === true;
25193
+ let prefix = options.escapeInvalid === true ? "\\" : "";
24841
25194
  let output = "";
24842
25195
  if (node.isOpen === true) {
24843
25196
  return prefix + node.value;
24844
25197
  }
24845
25198
  if (node.isClose === true) {
24846
- console.log("node.isClose", prefix, node.value);
24847
25199
  return prefix + node.value;
24848
25200
  }
24849
25201
  if (node.type === "open") {
@@ -24859,14 +25211,14 @@ var require_compile = __commonJS({
24859
25211
  return node.value;
24860
25212
  }
24861
25213
  if (node.nodes && node.ranges > 0) {
24862
- const args = utils.reduce(node.nodes);
24863
- const range = fill(...args, { ...options, wrap: false, toRegex: true, strictZeros: true });
25214
+ let args = utils.reduce(node.nodes);
25215
+ let range = fill(...args, { ...options, wrap: false, toRegex: true });
24864
25216
  if (range.length !== 0) {
24865
25217
  return args.length > 1 && range.length > 1 ? `(${range})` : range;
24866
25218
  }
24867
25219
  }
24868
25220
  if (node.nodes) {
24869
- for (const child of node.nodes) {
25221
+ for (let child of node.nodes) {
24870
25222
  output += walk(child, node);
24871
25223
  }
24872
25224
  }
@@ -24878,15 +25230,15 @@ var require_compile = __commonJS({
24878
25230
  }
24879
25231
  });
24880
25232
 
24881
- // node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/expand.js
25233
+ // node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/expand.js
24882
25234
  var require_expand = __commonJS({
24883
- "node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/expand.js"(exports2, module2) {
25235
+ "node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/expand.js"(exports2, module2) {
24884
25236
  "use strict";
24885
25237
  var fill = require_fill_range();
24886
25238
  var stringify4 = require_stringify();
24887
25239
  var utils = require_utils2();
24888
25240
  var append = (queue = "", stash = "", enclose = false) => {
24889
- const result = [];
25241
+ let result = [];
24890
25242
  queue = [].concat(queue);
24891
25243
  stash = [].concat(stash);
24892
25244
  if (!stash.length)
@@ -24894,9 +25246,9 @@ var require_expand = __commonJS({
24894
25246
  if (!queue.length) {
24895
25247
  return enclose ? utils.flatten(stash).map((ele) => `{${ele}}`) : stash;
24896
25248
  }
24897
- for (const item of queue) {
25249
+ for (let item of queue) {
24898
25250
  if (Array.isArray(item)) {
24899
- for (const value of item) {
25251
+ for (let value of item) {
24900
25252
  result.push(append(value, stash, enclose));
24901
25253
  }
24902
25254
  } else {
@@ -24910,8 +25262,8 @@ var require_expand = __commonJS({
24910
25262
  return utils.flatten(result);
24911
25263
  };
24912
25264
  var expand2 = (ast, options = {}) => {
24913
- const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
24914
- const walk = (node, parent = {}) => {
25265
+ let rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
25266
+ let walk = (node, parent = {}) => {
24915
25267
  node.queue = [];
24916
25268
  let p4 = parent;
24917
25269
  let q = parent.queue;
@@ -24928,7 +25280,7 @@ var require_expand = __commonJS({
24928
25280
  return;
24929
25281
  }
24930
25282
  if (node.nodes && node.ranges > 0) {
24931
- const args = utils.reduce(node.nodes);
25283
+ let args = utils.reduce(node.nodes);
24932
25284
  if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
24933
25285
  throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");
24934
25286
  }
@@ -24940,7 +25292,7 @@ var require_expand = __commonJS({
24940
25292
  node.nodes = [];
24941
25293
  return;
24942
25294
  }
24943
- const enclose = utils.encloseBrace(node);
25295
+ let enclose = utils.encloseBrace(node);
24944
25296
  let queue = node.queue;
24945
25297
  let block = node;
24946
25298
  while (block.type !== "brace" && block.type !== "root" && block.parent) {
@@ -24948,7 +25300,7 @@ var require_expand = __commonJS({
24948
25300
  queue = block.queue;
24949
25301
  }
24950
25302
  for (let i2 = 0; i2 < node.nodes.length; i2++) {
24951
- const child = node.nodes[i2];
25303
+ let child = node.nodes[i2];
24952
25304
  if (child.type === "comma" && node.type === "brace") {
24953
25305
  if (i2 === 1)
24954
25306
  queue.push("");
@@ -24975,12 +25327,12 @@ var require_expand = __commonJS({
24975
25327
  }
24976
25328
  });
24977
25329
 
24978
- // node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/constants.js
25330
+ // node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/constants.js
24979
25331
  var require_constants2 = __commonJS({
24980
- "node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/constants.js"(exports2, module2) {
25332
+ "node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/constants.js"(exports2, module2) {
24981
25333
  "use strict";
24982
25334
  module2.exports = {
24983
- MAX_LENGTH: 1e4,
25335
+ MAX_LENGTH: 1024 * 64,
24984
25336
  // Digits
24985
25337
  CHAR_0: "0",
24986
25338
  /* 0 */
@@ -25076,9 +25428,9 @@ var require_constants2 = __commonJS({
25076
25428
  }
25077
25429
  });
25078
25430
 
25079
- // node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js
25431
+ // node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/parse.js
25080
25432
  var require_parse2 = __commonJS({
25081
- "node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js"(exports2, module2) {
25433
+ "node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/parse.js"(exports2, module2) {
25082
25434
  "use strict";
25083
25435
  var stringify4 = require_stringify();
25084
25436
  var {
@@ -25110,24 +25462,25 @@ var require_parse2 = __commonJS({
25110
25462
  CHAR_NO_BREAK_SPACE,
25111
25463
  CHAR_ZERO_WIDTH_NOBREAK_SPACE
25112
25464
  } = require_constants2();
25113
- var parse6 = (input, options = {}) => {
25465
+ var parse7 = (input, options = {}) => {
25114
25466
  if (typeof input !== "string") {
25115
25467
  throw new TypeError("Expected a string");
25116
25468
  }
25117
- const opts = options || {};
25118
- const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
25469
+ let opts = options || {};
25470
+ let max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
25119
25471
  if (input.length > max) {
25120
25472
  throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
25121
25473
  }
25122
- const ast = { type: "root", input, nodes: [] };
25123
- const stack = [ast];
25474
+ let ast = { type: "root", input, nodes: [] };
25475
+ let stack = [ast];
25124
25476
  let block = ast;
25125
25477
  let prev = ast;
25126
25478
  let brackets = 0;
25127
- const length = input.length;
25479
+ let length = input.length;
25128
25480
  let index4 = 0;
25129
25481
  let depth = 0;
25130
25482
  let value;
25483
+ let memo = {};
25131
25484
  const advance = () => input[index4++];
25132
25485
  const push = (node) => {
25133
25486
  if (node.type === "text" && prev.type === "dot") {
@@ -25160,6 +25513,7 @@ var require_parse2 = __commonJS({
25160
25513
  }
25161
25514
  if (value === CHAR_LEFT_SQUARE_BRACKET) {
25162
25515
  brackets++;
25516
+ let closed = true;
25163
25517
  let next;
25164
25518
  while (index4 < length && (next = advance())) {
25165
25519
  value += next;
@@ -25198,7 +25552,7 @@ var require_parse2 = __commonJS({
25198
25552
  continue;
25199
25553
  }
25200
25554
  if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
25201
- const open = value;
25555
+ let open = value;
25202
25556
  let next;
25203
25557
  if (options.keepQuotes !== true) {
25204
25558
  value = "";
@@ -25220,8 +25574,8 @@ var require_parse2 = __commonJS({
25220
25574
  }
25221
25575
  if (value === CHAR_LEFT_CURLY_BRACE) {
25222
25576
  depth++;
25223
- const dollar = prev.value && prev.value.slice(-1) === "$" || block.dollar === true;
25224
- const brace = {
25577
+ let dollar = prev.value && prev.value.slice(-1) === "$" || block.dollar === true;
25578
+ let brace = {
25225
25579
  type: "brace",
25226
25580
  open: true,
25227
25581
  close: false,
@@ -25241,7 +25595,7 @@ var require_parse2 = __commonJS({
25241
25595
  push({ type: "text", value });
25242
25596
  continue;
25243
25597
  }
25244
- const type = "close";
25598
+ let type = "close";
25245
25599
  block = stack.pop();
25246
25600
  block.close = true;
25247
25601
  push({ type, value });
@@ -25252,7 +25606,7 @@ var require_parse2 = __commonJS({
25252
25606
  if (value === CHAR_COMMA && depth > 0) {
25253
25607
  if (block.ranges > 0) {
25254
25608
  block.ranges = 0;
25255
- const open = block.nodes.shift();
25609
+ let open = block.nodes.shift();
25256
25610
  block.nodes = [open, { type: "text", value: stringify4(block) }];
25257
25611
  }
25258
25612
  push({ type: "comma", value });
@@ -25260,7 +25614,7 @@ var require_parse2 = __commonJS({
25260
25614
  continue;
25261
25615
  }
25262
25616
  if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
25263
- const siblings = block.nodes;
25617
+ let siblings = block.nodes;
25264
25618
  if (depth === 0 || siblings.length === 0) {
25265
25619
  push({ type: "text", value });
25266
25620
  continue;
@@ -25281,7 +25635,7 @@ var require_parse2 = __commonJS({
25281
25635
  }
25282
25636
  if (prev.type === "range") {
25283
25637
  siblings.pop();
25284
- const before = siblings[siblings.length - 1];
25638
+ let before = siblings[siblings.length - 1];
25285
25639
  before.value += prev.value + value;
25286
25640
  prev = before;
25287
25641
  block.ranges--;
@@ -25306,31 +25660,31 @@ var require_parse2 = __commonJS({
25306
25660
  node.invalid = true;
25307
25661
  }
25308
25662
  });
25309
- const parent = stack[stack.length - 1];
25310
- const index5 = parent.nodes.indexOf(block);
25663
+ let parent = stack[stack.length - 1];
25664
+ let index5 = parent.nodes.indexOf(block);
25311
25665
  parent.nodes.splice(index5, 1, ...block.nodes);
25312
25666
  }
25313
25667
  } while (stack.length > 0);
25314
25668
  push({ type: "eos" });
25315
25669
  return ast;
25316
25670
  };
25317
- module2.exports = parse6;
25671
+ module2.exports = parse7;
25318
25672
  }
25319
25673
  });
25320
25674
 
25321
- // node_modules/.pnpm/braces@3.0.3/node_modules/braces/index.js
25675
+ // node_modules/.pnpm/braces@3.0.2/node_modules/braces/index.js
25322
25676
  var require_braces = __commonJS({
25323
- "node_modules/.pnpm/braces@3.0.3/node_modules/braces/index.js"(exports2, module2) {
25677
+ "node_modules/.pnpm/braces@3.0.2/node_modules/braces/index.js"(exports2, module2) {
25324
25678
  "use strict";
25325
25679
  var stringify4 = require_stringify();
25326
25680
  var compile = require_compile();
25327
25681
  var expand2 = require_expand();
25328
- var parse6 = require_parse2();
25682
+ var parse7 = require_parse2();
25329
25683
  var braces = (input, options = {}) => {
25330
25684
  let output = [];
25331
25685
  if (Array.isArray(input)) {
25332
- for (const pattern of input) {
25333
- const result = braces.create(pattern, options);
25686
+ for (let pattern of input) {
25687
+ let result = braces.create(pattern, options);
25334
25688
  if (Array.isArray(result)) {
25335
25689
  output.push(...result);
25336
25690
  } else {
@@ -25345,7 +25699,7 @@ var require_braces = __commonJS({
25345
25699
  }
25346
25700
  return output;
25347
25701
  };
25348
- braces.parse = (input, options = {}) => parse6(input, options);
25702
+ braces.parse = (input, options = {}) => parse7(input, options);
25349
25703
  braces.stringify = (input, options = {}) => {
25350
25704
  if (typeof input === "string") {
25351
25705
  return stringify4(braces.parse(input, options), options);
@@ -26003,7 +26357,7 @@ var require_parse3 = __commonJS({
26003
26357
  var syntaxError = (type, char) => {
26004
26358
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
26005
26359
  };
26006
- var parse6 = (input, options) => {
26360
+ var parse7 = (input, options) => {
26007
26361
  if (typeof input !== "string") {
26008
26362
  throw new TypeError("Expected a string");
26009
26363
  }
@@ -26153,7 +26507,7 @@ var require_parse3 = __commonJS({
26153
26507
  output = token.close = `)$))${extglobStar}`;
26154
26508
  }
26155
26509
  if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
26156
- const expression = parse6(rest, { ...options, fastpaths: false }).output;
26510
+ const expression = parse7(rest, { ...options, fastpaths: false }).output;
26157
26511
  output = token.close = `)${expression})${extglobStar})`;
26158
26512
  }
26159
26513
  if (token.prev.type === "bos") {
@@ -26682,7 +27036,7 @@ var require_parse3 = __commonJS({
26682
27036
  }
26683
27037
  return state;
26684
27038
  };
26685
- parse6.fastpaths = (input, options) => {
27039
+ parse7.fastpaths = (input, options) => {
26686
27040
  const opts = { ...options };
26687
27041
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
26688
27042
  const len = input.length;
@@ -26751,7 +27105,7 @@ var require_parse3 = __commonJS({
26751
27105
  }
26752
27106
  return source;
26753
27107
  };
26754
- module2.exports = parse6;
27108
+ module2.exports = parse7;
26755
27109
  }
26756
27110
  });
26757
27111
 
@@ -26761,7 +27115,7 @@ var require_picomatch = __commonJS({
26761
27115
  "use strict";
26762
27116
  var path5 = require("path");
26763
27117
  var scan = require_scan();
26764
- var parse6 = require_parse3();
27118
+ var parse7 = require_parse3();
26765
27119
  var utils = require_utils3();
26766
27120
  var constants = require_constants3();
26767
27121
  var isObject = (val2) => val2 && typeof val2 === "object" && !Array.isArray(val2);
@@ -26851,7 +27205,7 @@ var require_picomatch = __commonJS({
26851
27205
  picomatch.parse = (pattern, options) => {
26852
27206
  if (Array.isArray(pattern))
26853
27207
  return pattern.map((p4) => picomatch.parse(p4, options));
26854
- return parse6(pattern, { ...options, fastpaths: false });
27208
+ return parse7(pattern, { ...options, fastpaths: false });
26855
27209
  };
26856
27210
  picomatch.scan = (input, options) => scan(input, options);
26857
27211
  picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
@@ -26877,10 +27231,10 @@ var require_picomatch = __commonJS({
26877
27231
  }
26878
27232
  let parsed = { negated: false, fastpaths: true };
26879
27233
  if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
26880
- parsed.output = parse6.fastpaths(input, options);
27234
+ parsed.output = parse7.fastpaths(input, options);
26881
27235
  }
26882
27236
  if (!parsed.output) {
26883
- parsed = parse6(input, options);
27237
+ parsed = parse7(input, options);
26884
27238
  }
26885
27239
  return picomatch.compileRe(parsed, options, returnOutput, returnState);
26886
27240
  };
@@ -26907,9 +27261,9 @@ var require_picomatch2 = __commonJS({
26907
27261
  }
26908
27262
  });
26909
27263
 
26910
- // node_modules/.pnpm/micromatch@4.0.7/node_modules/micromatch/index.js
27264
+ // node_modules/.pnpm/micromatch@4.0.5/node_modules/micromatch/index.js
26911
27265
  var require_micromatch = __commonJS({
26912
- "node_modules/.pnpm/micromatch@4.0.7/node_modules/micromatch/index.js"(exports2, module2) {
27266
+ "node_modules/.pnpm/micromatch@4.0.5/node_modules/micromatch/index.js"(exports2, module2) {
26913
27267
  "use strict";
26914
27268
  var util2 = require("util");
26915
27269
  var braces = require_braces();
@@ -41867,7 +42221,7 @@ var require_public_api = __commonJS({
41867
42221
  }
41868
42222
  return doc;
41869
42223
  }
41870
- function parse6(src, reviver, options) {
42224
+ function parse7(src, reviver, options) {
41871
42225
  let _reviver = void 0;
41872
42226
  if (typeof reviver === "function") {
41873
42227
  _reviver = reviver;
@@ -41906,7 +42260,7 @@ var require_public_api = __commonJS({
41906
42260
  }
41907
42261
  return new Document.Document(value, _replacer, options).toString(options);
41908
42262
  }
41909
- exports2.parse = parse6;
42263
+ exports2.parse = parse7;
41910
42264
  exports2.parseAllDocuments = parseAllDocuments;
41911
42265
  exports2.parseDocument = parseDocument;
41912
42266
  exports2.stringify = stringify4;
@@ -44332,7 +44686,7 @@ var require_extension = __commonJS({
44332
44686
  else
44333
44687
  dest[name].push(elem);
44334
44688
  }
44335
- function parse6(header) {
44689
+ function parse7(header) {
44336
44690
  const offers = /* @__PURE__ */ Object.create(null);
44337
44691
  let params = /* @__PURE__ */ Object.create(null);
44338
44692
  let mustUnescape = false;
@@ -44487,7 +44841,7 @@ var require_extension = __commonJS({
44487
44841
  }).join(", ");
44488
44842
  }).join(", ");
44489
44843
  }
44490
- module2.exports = { format: format2, parse: parse6 };
44844
+ module2.exports = { format: format2, parse: parse7 };
44491
44845
  }
44492
44846
  });
44493
44847
 
@@ -44519,7 +44873,7 @@ var require_websocket = __commonJS({
44519
44873
  var {
44520
44874
  EventTarget: { addEventListener: addEventListener2, removeEventListener }
44521
44875
  } = require_event_target();
44522
- var { format: format2, parse: parse6 } = require_extension();
44876
+ var { format: format2, parse: parse7 } = require_extension();
44523
44877
  var { toBuffer } = require_buffer_util();
44524
44878
  var closeTimeout = 30 * 1e3;
44525
44879
  var kAborted = Symbol("kAborted");
@@ -45206,7 +45560,7 @@ var require_websocket = __commonJS({
45206
45560
  }
45207
45561
  let extensions;
45208
45562
  try {
45209
- extensions = parse6(secWebSocketExtensions);
45563
+ extensions = parse7(secWebSocketExtensions);
45210
45564
  } catch (err2) {
45211
45565
  const message = "Invalid Sec-WebSocket-Extensions header";
45212
45566
  abortHandshake(websocket, socket, message);
@@ -45382,7 +45736,7 @@ var require_subprotocol = __commonJS({
45382
45736
  "node_modules/.pnpm/ws@8.17.0/node_modules/ws/lib/subprotocol.js"(exports2, module2) {
45383
45737
  "use strict";
45384
45738
  var { tokenChars } = require_validation();
45385
- function parse6(header) {
45739
+ function parse7(header) {
45386
45740
  const protocols = /* @__PURE__ */ new Set();
45387
45741
  let start = -1;
45388
45742
  let end = -1;
@@ -45421,7 +45775,7 @@ var require_subprotocol = __commonJS({
45421
45775
  protocols.add(protocol2);
45422
45776
  return protocols;
45423
45777
  }
45424
- module2.exports = { parse: parse6 };
45778
+ module2.exports = { parse: parse7 };
45425
45779
  }
45426
45780
  });
45427
45781
 
@@ -50251,7 +50605,7 @@ var init_v1 = __esm({
50251
50605
  });
50252
50606
 
50253
50607
  // node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/parse.js
50254
- function parse(uuid) {
50608
+ function parse2(uuid) {
50255
50609
  if (!validate_default(uuid)) {
50256
50610
  throw TypeError("Invalid UUID");
50257
50611
  }
@@ -50279,7 +50633,7 @@ var parse_default;
50279
50633
  var init_parse = __esm({
50280
50634
  "node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/parse.js"() {
50281
50635
  init_validate();
50282
- parse_default = parse;
50636
+ parse_default = parse2;
50283
50637
  }
50284
50638
  });
50285
50639
 
@@ -58236,7 +58590,7 @@ var require_dist_cjs39 = __commonJS({
58236
58590
  providerConfigFromInit: () => providerConfigFromInit
58237
58591
  });
58238
58592
  module2.exports = __toCommonJS2(src_exports2);
58239
- var import_url7 = require("url");
58593
+ var import_url8 = require("url");
58240
58594
  var import_property_provider = require_dist_cjs12();
58241
58595
  var import_buffer2 = require("buffer");
58242
58596
  var import_http3 = require("http");
@@ -58343,7 +58697,7 @@ var require_dist_cjs39 = __commonJS({
58343
58697
  };
58344
58698
  }
58345
58699
  if (process.env[ENV_CMDS_FULL_URI]) {
58346
- const parsed = (0, import_url7.parse)(process.env[ENV_CMDS_FULL_URI]);
58700
+ const parsed = (0, import_url8.parse)(process.env[ENV_CMDS_FULL_URI]);
58347
58701
  if (!parsed.hostname || !(parsed.hostname in GREENGRASS_HOSTS)) {
58348
58702
  throw new import_property_provider.CredentialsProviderError(
58349
58703
  `${parsed.hostname} is not a valid container metadata service hostname`,
@@ -65812,7 +66166,7 @@ var require_postgres_interval = __commonJS({
65812
66166
  if (!(this instanceof PostgresInterval)) {
65813
66167
  return new PostgresInterval(raw2);
65814
66168
  }
65815
- extend(this, parse6(raw2));
66169
+ extend(this, parse7(raw2));
65816
66170
  }
65817
66171
  var properties = ["seconds", "minutes", "hours", "days", "months", "years"];
65818
66172
  PostgresInterval.prototype.toPostgres = function() {
@@ -65874,7 +66228,7 @@ var require_postgres_interval = __commonJS({
65874
66228
  var microseconds = fraction + "000000".slice(fraction.length);
65875
66229
  return parseInt(microseconds, 10) / 1e3;
65876
66230
  }
65877
- function parse6(interval) {
66231
+ function parse7(interval) {
65878
66232
  if (!interval)
65879
66233
  return {};
65880
66234
  var matches = INTERVAL.exec(interval);
@@ -66368,13 +66722,13 @@ var require_binaryParsers = __commonJS({
66368
66722
  console.log("ERROR: ElementType not implemented: " + elementType2);
66369
66723
  }
66370
66724
  };
66371
- var parse6 = function(dimension, elementType2) {
66725
+ var parse7 = function(dimension, elementType2) {
66372
66726
  var array = [];
66373
66727
  var i3;
66374
66728
  if (dimension.length > 1) {
66375
66729
  var count = dimension.shift();
66376
66730
  for (i3 = 0; i3 < count; i3++) {
66377
- array[i3] = parse6(dimension, elementType2);
66731
+ array[i3] = parse7(dimension, elementType2);
66378
66732
  }
66379
66733
  dimension.unshift(count);
66380
66734
  } else {
@@ -66384,7 +66738,7 @@ var require_binaryParsers = __commonJS({
66384
66738
  }
66385
66739
  return array;
66386
66740
  };
66387
- return parse6(dims, elementType);
66741
+ return parse7(dims, elementType);
66388
66742
  };
66389
66743
  var parseText = function(value) {
66390
66744
  return value.toString("utf8");
@@ -67032,7 +67386,7 @@ var require_type_overrides = __commonJS({
67032
67386
  var require_pg_connection_string = __commonJS({
67033
67387
  "node_modules/.pnpm/pg-connection-string@2.6.4/node_modules/pg-connection-string/index.js"(exports2, module2) {
67034
67388
  "use strict";
67035
- function parse6(str) {
67389
+ function parse7(str) {
67036
67390
  if (str.charAt(0) === "/") {
67037
67391
  const config2 = str.split(" ");
67038
67392
  return { host: config2[0], database: config2[1] };
@@ -67108,8 +67462,8 @@ var require_pg_connection_string = __commonJS({
67108
67462
  }
67109
67463
  return config;
67110
67464
  }
67111
- module2.exports = parse6;
67112
- parse6.parse = parse6;
67465
+ module2.exports = parse7;
67466
+ parse7.parse = parse7;
67113
67467
  }
67114
67468
  });
67115
67469
 
@@ -67119,7 +67473,7 @@ var require_connection_parameters = __commonJS({
67119
67473
  "use strict";
67120
67474
  var dns = require("dns");
67121
67475
  var defaults3 = require_defaults();
67122
- var parse6 = require_pg_connection_string().parse;
67476
+ var parse7 = require_pg_connection_string().parse;
67123
67477
  var val2 = function(key, config, envVar) {
67124
67478
  if (envVar === void 0) {
67125
67479
  envVar = process.env["PG" + key.toUpperCase()];
@@ -67154,9 +67508,9 @@ var require_connection_parameters = __commonJS({
67154
67508
  };
67155
67509
  var ConnectionParameters = class {
67156
67510
  constructor(config) {
67157
- config = typeof config === "string" ? parse6(config) : config || {};
67511
+ config = typeof config === "string" ? parse7(config) : config || {};
67158
67512
  if (config.connectionString) {
67159
- config = Object.assign({}, config, parse6(config.connectionString));
67513
+ config = Object.assign({}, config, parse7(config.connectionString));
67160
67514
  }
67161
67515
  this.user = val2("user", config);
67162
67516
  this.database = val2("database", config);
@@ -67827,7 +68181,7 @@ var require_serializer = __commonJS({
67827
68181
  );
67828
68182
  };
67829
68183
  var emptyArray = [];
67830
- var parse6 = (query2) => {
68184
+ var parse7 = (query2) => {
67831
68185
  const name = query2.name || "";
67832
68186
  if (name.length > 63) {
67833
68187
  console.error("Warning! Postgres only supports 63 characters for query names.");
@@ -67976,7 +68330,7 @@ var require_serializer = __commonJS({
67976
68330
  sendSASLInitialResponseMessage,
67977
68331
  sendSCRAMClientFinalMessage,
67978
68332
  query,
67979
- parse: parse6,
68333
+ parse: parse7,
67980
68334
  bind,
67981
68335
  execute,
67982
68336
  describe,
@@ -68354,12 +68708,12 @@ var require_dist2 = __commonJS({
68354
68708
  return serializer_1.serialize;
68355
68709
  } });
68356
68710
  var parser_1 = require_parser2();
68357
- function parse6(stream, callback) {
68711
+ function parse7(stream, callback) {
68358
68712
  const parser = new parser_1.Parser();
68359
68713
  stream.on("data", (buffer2) => parser.parse(buffer2, callback));
68360
68714
  return new Promise((resolve2) => stream.on("end", () => resolve2()));
68361
68715
  }
68362
- exports2.parse = parse6;
68716
+ exports2.parse = parse7;
68363
68717
  }
68364
68718
  });
68365
68719
 
@@ -68405,7 +68759,7 @@ var require_connection = __commonJS({
68405
68759
  "use strict";
68406
68760
  var net2 = require("net");
68407
68761
  var EventEmitter = require("events").EventEmitter;
68408
- var { parse: parse6, serialize: serialize3 } = require_dist2();
68762
+ var { parse: parse7, serialize: serialize3 } = require_dist2();
68409
68763
  var { getStream, getSecureStream } = require_stream6();
68410
68764
  var flushBuffer = serialize3.flush();
68411
68765
  var syncBuffer = serialize3.sync();
@@ -68492,7 +68846,7 @@ var require_connection = __commonJS({
68492
68846
  });
68493
68847
  }
68494
68848
  attachListeners(stream) {
68495
- parse6(stream, (msg) => {
68849
+ parse7(stream, (msg) => {
68496
68850
  var eventName = msg.name === "error" ? "errorMessage" : msg.name;
68497
68851
  if (this._emitMessage) {
68498
68852
  this.emit("message", msg);
@@ -71754,7 +72108,7 @@ function Subscribe(postgres2, options) {
71754
72108
  }
71755
72109
  function data(x4) {
71756
72110
  if (x4[0] === 119) {
71757
- parse2(x4.subarray(25), state2, sql3.options.parsers, handle, options.transform);
72111
+ parse3(x4.subarray(25), state2, sql3.options.parsers, handle, options.transform);
71758
72112
  } else if (x4[0] === 107 && x4[17]) {
71759
72113
  state2.lsn = x4.subarray(1, 9);
71760
72114
  pong();
@@ -71784,7 +72138,7 @@ function Subscribe(postgres2, options) {
71784
72138
  function Time(x3) {
71785
72139
  return new Date(Date.UTC(2e3, 0, 1) + Number(x3 / BigInt(1e3)));
71786
72140
  }
71787
- function parse2(x3, state, parsers2, handle, transform) {
72141
+ function parse3(x3, state, parsers2, handle, transform) {
71788
72142
  const char = (acc, [k2, v6]) => (acc[k2.charCodeAt(0)] = v6, acc);
71789
72143
  Object.entries({
71790
72144
  R: (x4) => {
@@ -80286,7 +80640,7 @@ var require_extension2 = __commonJS({
80286
80640
  else
80287
80641
  dest[name].push(elem);
80288
80642
  }
80289
- function parse6(header) {
80643
+ function parse7(header) {
80290
80644
  const offers = /* @__PURE__ */ Object.create(null);
80291
80645
  let params = /* @__PURE__ */ Object.create(null);
80292
80646
  let mustUnescape = false;
@@ -80441,7 +80795,7 @@ var require_extension2 = __commonJS({
80441
80795
  }).join(", ");
80442
80796
  }).join(", ");
80443
80797
  }
80444
- module2.exports = { format: format2, parse: parse6 };
80798
+ module2.exports = { format: format2, parse: parse7 };
80445
80799
  }
80446
80800
  });
80447
80801
 
@@ -80473,7 +80827,7 @@ var require_websocket2 = __commonJS({
80473
80827
  var {
80474
80828
  EventTarget: { addEventListener: addEventListener2, removeEventListener }
80475
80829
  } = require_event_target2();
80476
- var { format: format2, parse: parse6 } = require_extension2();
80830
+ var { format: format2, parse: parse7 } = require_extension2();
80477
80831
  var { toBuffer } = require_buffer_util2();
80478
80832
  var closeTimeout = 30 * 1e3;
80479
80833
  var kAborted = Symbol("kAborted");
@@ -81153,7 +81507,7 @@ var require_websocket2 = __commonJS({
81153
81507
  }
81154
81508
  let extensions;
81155
81509
  try {
81156
- extensions = parse6(secWebSocketExtensions);
81510
+ extensions = parse7(secWebSocketExtensions);
81157
81511
  } catch (err2) {
81158
81512
  const message = "Invalid Sec-WebSocket-Extensions header";
81159
81513
  abortHandshake(websocket, socket, message);
@@ -81327,7 +81681,7 @@ var require_subprotocol2 = __commonJS({
81327
81681
  "node_modules/.pnpm/ws@8.14.2_bufferutil@4.0.8_utf-8-validate@6.0.3/node_modules/ws/lib/subprotocol.js"(exports2, module2) {
81328
81682
  "use strict";
81329
81683
  var { tokenChars } = require_validation2();
81330
- function parse6(header) {
81684
+ function parse7(header) {
81331
81685
  const protocols = /* @__PURE__ */ new Set();
81332
81686
  let start = -1;
81333
81687
  let end = -1;
@@ -81366,7 +81720,7 @@ var require_subprotocol2 = __commonJS({
81366
81720
  protocols.add(protocol2);
81367
81721
  return protocols;
81368
81722
  }
81369
- module2.exports = { parse: parse6 };
81723
+ module2.exports = { parse: parse7 };
81370
81724
  }
81371
81725
  });
81372
81726
 
@@ -99253,7 +99607,7 @@ var require_esprima = __commonJS({
99253
99607
  var jsx_parser_1 = __webpack_require__2(3);
99254
99608
  var parser_1 = __webpack_require__2(8);
99255
99609
  var tokenizer_1 = __webpack_require__2(15);
99256
- function parse6(code, options, delegate) {
99610
+ function parse7(code, options, delegate) {
99257
99611
  var commentHandler = null;
99258
99612
  var proxyDelegate = function(node, metadata) {
99259
99613
  if (delegate) {
@@ -99298,17 +99652,17 @@ var require_esprima = __commonJS({
99298
99652
  }
99299
99653
  return ast;
99300
99654
  }
99301
- exports3.parse = parse6;
99655
+ exports3.parse = parse7;
99302
99656
  function parseModule(code, options, delegate) {
99303
99657
  var parsingOptions = options || {};
99304
99658
  parsingOptions.sourceType = "module";
99305
- return parse6(code, parsingOptions, delegate);
99659
+ return parse7(code, parsingOptions, delegate);
99306
99660
  }
99307
99661
  exports3.parseModule = parseModule;
99308
99662
  function parseScript(code, options, delegate) {
99309
99663
  var parsingOptions = options || {};
99310
99664
  parsingOptions.sourceType = "script";
99311
- return parse6(code, parsingOptions, delegate);
99665
+ return parse7(code, parsingOptions, delegate);
99312
99666
  }
99313
99667
  exports3.parseScript = parseScript;
99314
99668
  function tokenize(code, options, delegate) {
@@ -108860,7 +109214,7 @@ var require_named_placeholders = __commonJS({
108860
109214
  var DQUOTE = 34;
108861
109215
  var SQUOTE = 39;
108862
109216
  var BSLASH = 92;
108863
- function parse6(query) {
109217
+ function parse7(query) {
108864
109218
  let ppos = RE_PARAM.exec(query);
108865
109219
  let curpos = 0;
108866
109220
  let start = 0;
@@ -108975,17 +109329,17 @@ var require_named_placeholders = __commonJS({
108975
109329
  if (cache && (tree = cache.get(query))) {
108976
109330
  return toArrayParams(tree, paramsObj);
108977
109331
  }
108978
- tree = join7(parse6(query));
109332
+ tree = join7(parse7(query));
108979
109333
  if (cache) {
108980
109334
  cache.set(query, tree);
108981
109335
  }
108982
109336
  return toArrayParams(tree, paramsObj);
108983
109337
  }
108984
- compile.parse = parse6;
109338
+ compile.parse = parse7;
108985
109339
  return compile;
108986
109340
  }
108987
109341
  function toNumbered(q, params) {
108988
- const tree = parse6(q);
109342
+ const tree = parse7(q);
108989
109343
  const paramsArr = [];
108990
109344
  if (tree.length == 1) {
108991
109345
  return [tree[0], paramsArr];
@@ -111139,7 +111493,7 @@ function parseObjectRow(fields, rawRow, cast2) {
111139
111493
  return acc;
111140
111494
  }, {});
111141
111495
  }
111142
- function parse3(result, cast2, returnAs) {
111496
+ function parse4(result, cast2, returnAs) {
111143
111497
  const fields = result.fields ?? [];
111144
111498
  const rows = result.rows ?? [];
111145
111499
  return rows.map((row) => returnAs === "array" ? parseArrayRow(fields, row, cast2) : parseObjectRow(fields, row, cast2));
@@ -111248,7 +111602,7 @@ var init_dist2 = __esm({
111248
111602
  field.type || (field.type = "NULL");
111249
111603
  }
111250
111604
  const castFn = options.cast || this.config.cast || cast;
111251
- const rows = result ? parse3(result, castFn, options.as || "object") : [];
111605
+ const rows = result ? parse4(result, castFn, options.as || "object") : [];
111252
111606
  const headers = fields.map((f3) => f3.name);
111253
111607
  const typeByName = (acc, { name, type }) => ({ ...acc, [name]: type });
111254
111608
  const types4 = fields.reduce(typeByName, {});
@@ -111291,6 +111645,7 @@ var init_connections = __esm({
111291
111645
  init_utils2();
111292
111646
  init_global();
111293
111647
  init_outputs();
111648
+ init_utils();
111294
111649
  preparePostgresDB = async (credentials2) => {
111295
111650
  if ("driver" in credentials2) {
111296
111651
  if (credentials2.driver === "aws-data-api") {
@@ -111675,7 +112030,7 @@ var init_connections = __esm({
111675
112030
  const { drizzle } = await import("drizzle-orm/libsql");
111676
112031
  const { migrate } = await import("drizzle-orm/libsql/migrator");
111677
112032
  const client = createClient2({
111678
- url: credentials2.url
112033
+ url: normaliseSQLiteUrl(credentials2.url, "libsql")
111679
112034
  });
111680
112035
  const drzl = drizzle(client);
111681
112036
  const migrateFn = async (config) => {
@@ -111710,7 +112065,7 @@ var init_connections = __esm({
111710
112065
  const { default: Database } = await import("better-sqlite3");
111711
112066
  const { drizzle } = await import("drizzle-orm/better-sqlite3");
111712
112067
  const { migrate } = await import("drizzle-orm/better-sqlite3/migrator");
111713
- const sqlite = new Database(credentials2.url);
112068
+ const sqlite = new Database(normaliseSQLiteUrl(credentials2.url, "better-sqlite"));
111714
112069
  const drzl = drizzle(sqlite);
111715
112070
  const migrateFn = async (config) => {
111716
112071
  return migrate(drzl, config);
@@ -115165,6 +115520,7 @@ var init_introspect_pg = __esm({
115165
115520
  init_utils3();
115166
115521
  init_pgSerializer();
115167
115522
  init_global();
115523
+ init_vector();
115168
115524
  pgImportsList = /* @__PURE__ */ new Set([
115169
115525
  "pgTable",
115170
115526
  "pgEnum",
@@ -115193,7 +115549,8 @@ var init_introspect_pg = __esm({
115193
115549
  "macaddr8",
115194
115550
  "bigint",
115195
115551
  "doublePrecision",
115196
- "uuid"
115552
+ "uuid",
115553
+ "vector"
115197
115554
  ]);
115198
115555
  objToStatement23 = (json) => {
115199
115556
  json = Object.fromEntries(Object.entries(json).filter((it) => it[1]));
@@ -115330,6 +115687,7 @@ var init_introspect_pg = __esm({
115330
115687
  patched = patched.startsWith("numeric(") ? "numeric" : patched;
115331
115688
  patched = patched.startsWith("time(") ? "time" : patched;
115332
115689
  patched = patched.startsWith("timestamp(") ? "timestamp" : patched;
115690
+ patched = patched.startsWith("vector(") ? "vector" : patched;
115333
115691
  return patched;
115334
115692
  }).filter((type) => {
115335
115693
  return pgImportsList.has(type);
@@ -115520,7 +115878,7 @@ var init_introspect_pg = __esm({
115520
115878
  }
115521
115879
  if (lowered === "date") {
115522
115880
  let out = `${withCasing2(name, casing2)}: date("${name}")`;
115523
- defaultValue = defaultValue === "now()" ? ".defaultNow()" : defaultValue ? `.default(${defaultValue})` : "";
115881
+ defaultValue = defaultValue === "now()" ? ".defaultNow()" : defaultValue === "CURRENT_DATE" ? `.default(sql\`${defaultValue}\`)` : defaultValue ? `.default(${defaultValue})` : "";
115524
115882
  out += defaultValue;
115525
115883
  return out;
115526
115884
  }
@@ -115580,6 +115938,23 @@ var init_introspect_pg = __esm({
115580
115938
  out += typeof defaultValue !== "undefined" ? `.default(${defaultValue})` : "";
115581
115939
  return out;
115582
115940
  }
115941
+ if (lowered.startsWith("vector")) {
115942
+ const split = lowered.split(" ");
115943
+ let out;
115944
+ if (lowered.length !== 6) {
115945
+ out = `${withCasing2(
115946
+ name,
115947
+ casing2
115948
+ )}: vector("${name}", { dimensions: ${lowered.substring(
115949
+ 7,
115950
+ lowered.length - 1
115951
+ )} })`;
115952
+ } else {
115953
+ out = `${withCasing2(name, casing2)}: vector("${name}")`;
115954
+ }
115955
+ out += typeof defaultValue !== "undefined" ? `.default(${defaultValue})` : "";
115956
+ return out;
115957
+ }
115583
115958
  if (lowered.startsWith("char")) {
115584
115959
  let out;
115585
115960
  if (lowered.length !== 4) {
@@ -115693,13 +116068,35 @@ var init_introspect_pg = __esm({
115693
116068
  let idxKey = it.name.startsWith(tableName) && it.name !== tableName ? it.name.slice(tableName.length + 1) : it.name;
115694
116069
  idxKey = idxKey.endsWith("_index") ? idxKey.slice(0, -"_index".length) + "_idx" : idxKey;
115695
116070
  idxKey = withCasing2(idxKey, casing2);
115696
- const indexGeneratedName = indexName2(tableName, it.columns);
116071
+ const indexGeneratedName = indexName2(
116072
+ tableName,
116073
+ it.columns.map((it2) => it2.expression)
116074
+ );
115697
116075
  const escapedIndexName = indexGeneratedName === it.name ? "" : `"${it.name}"`;
115698
116076
  statement += ` ${idxKey}: `;
115699
116077
  statement += it.isUnique ? "uniqueIndex(" : "index(";
115700
116078
  statement += `${escapedIndexName})`;
115701
- statement += `.on(${it.columns.map((it2) => `table.${withCasing2(it2, casing2)}`).join(", ")}),`;
115702
- statement += `
116079
+ statement += `${it.concurrently ? `.concurrently()` : ""}`;
116080
+ statement += `.using("${it.method}", ${it.columns.map((it2) => {
116081
+ if (it2.isExpression) {
116082
+ return `sql\`${it2.expression}\``;
116083
+ } else {
116084
+ return `table.${withCasing2(it2.expression, casing2)}${it2.opclass && vectorOps.includes(it2.opclass) ? `.op("${it2.opclass}")` : ""}`;
116085
+ }
116086
+ }).join(", ")})`;
116087
+ statement += it.where ? `.where(sql\`${it.where}\`)` : "";
116088
+ function reverseLogic(mappedWith) {
116089
+ let reversedString = "{";
116090
+ for (const key in mappedWith) {
116091
+ if (mappedWith.hasOwnProperty(key)) {
116092
+ reversedString += `${key}: "${mappedWith[key]}",`;
116093
+ }
116094
+ }
116095
+ reversedString = reversedString.length > 1 ? reversedString.slice(0, reversedString.length - 1) : reversedString;
116096
+ return `${reversedString}}`;
116097
+ }
116098
+ statement += it.with && Object.keys(it.with).length > 0 ? `.with(${reverseLogic(it.with)})` : "";
116099
+ statement += `,
115703
116100
  `;
115704
116101
  });
115705
116102
  return statement;
@@ -117099,13 +117496,13 @@ var init_url = __esm({
117099
117496
  });
117100
117497
 
117101
117498
  // node_modules/.pnpm/hono@4.3.9/node_modules/hono/dist/utils/cookie.js
117102
- var validCookieNameRegEx, validCookieValueRegEx, parse4;
117499
+ var validCookieNameRegEx, validCookieValueRegEx, parse5;
117103
117500
  var init_cookie = __esm({
117104
117501
  "node_modules/.pnpm/hono@4.3.9/node_modules/hono/dist/utils/cookie.js"() {
117105
117502
  init_url();
117106
117503
  validCookieNameRegEx = /^[\w!#$%&'*.^`|~+-]+$/;
117107
117504
  validCookieValueRegEx = /^[ !#-:<-[\]-~]*$/;
117108
- parse4 = (cookie, name) => {
117505
+ parse5 = (cookie, name) => {
117109
117506
  const pairs = cookie.trim().split(";");
117110
117507
  return pairs.reduce((parsedCookie, pairStr) => {
117111
117508
  pairStr = pairStr.trim();
@@ -117147,13 +117544,13 @@ var init_cookie2 = __esm({
117147
117544
  } else if (prefix === "host") {
117148
117545
  finalKey = "__Host-" + key;
117149
117546
  }
117150
- const obj2 = parse4(cookie, finalKey);
117547
+ const obj2 = parse5(cookie, finalKey);
117151
117548
  return obj2[finalKey];
117152
117549
  }
117153
117550
  if (!cookie) {
117154
117551
  return {};
117155
117552
  }
117156
- const obj = parse4(cookie);
117553
+ const obj = parse5(cookie);
117157
117554
  return obj;
117158
117555
  };
117159
117556
  }
@@ -119566,7 +119963,7 @@ var init_dist6 = __esm({
119566
119963
  });
119567
119964
 
119568
119965
  // node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/index.js
119569
- var SuperJSON, serialize2, deserialize, stringify3, parse5, registerClass, registerCustom, registerSymbol, allowErrorProps;
119966
+ var SuperJSON, serialize2, deserialize, stringify3, parse6, registerClass, registerCustom, registerSymbol, allowErrorProps;
119570
119967
  var init_dist7 = __esm({
119571
119968
  "node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/index.js"() {
119572
119969
  init_class_registry();
@@ -119651,7 +120048,7 @@ var init_dist7 = __esm({
119651
120048
  serialize2 = SuperJSON.serialize;
119652
120049
  deserialize = SuperJSON.deserialize;
119653
120050
  stringify3 = SuperJSON.stringify;
119654
- parse5 = SuperJSON.parse;
120051
+ parse6 = SuperJSON.parse;
119655
120052
  registerClass = SuperJSON.registerClass;
119656
120053
  registerCustom = SuperJSON.registerCustom;
119657
120054
  registerSymbol = SuperJSON.registerSymbol;
@@ -120141,7 +120538,11 @@ var upPgHandler = (out) => {
120141
120538
  raw: report.rawMap[it]
120142
120539
  })).forEach((it) => {
120143
120540
  const path5 = it.path;
120144
- const result = updateUpToV6(it.raw);
120541
+ let resultV6 = it.raw;
120542
+ if (it.raw.version === "5") {
120543
+ resultV6 = updateUpToV6(it.raw);
120544
+ }
120545
+ const result = updateUpToV7(resultV6);
120145
120546
  console.log(`[${source_default.green("\u2713")}] ${path5}`);
120146
120547
  (0, import_fs2.writeFileSync)(path5, JSON.stringify(result, null, 2));
120147
120548
  });
@@ -120177,6 +120578,36 @@ var updateUpToV6 = (json) => {
120177
120578
  enums
120178
120579
  };
120179
120580
  };
120581
+ var updateUpToV7 = (json) => {
120582
+ const schema5 = pgSchemaV6.parse(json);
120583
+ const tables = Object.fromEntries(
120584
+ Object.entries(schema5.tables).map((it) => {
120585
+ const table4 = it[1];
120586
+ const mappedIndexes = Object.fromEntries(
120587
+ Object.entries(table4.indexes).map((idx) => {
120588
+ const { columns, ...rest } = idx[1];
120589
+ const mappedColumns = columns.map((it2) => {
120590
+ return {
120591
+ expression: it2,
120592
+ isExpression: false,
120593
+ asc: true,
120594
+ nulls: "last",
120595
+ opClass: void 0
120596
+ };
120597
+ });
120598
+ return [idx[0], { columns: mappedColumns, ...rest }];
120599
+ })
120600
+ );
120601
+ return [it[0], { ...table4, indexes: mappedIndexes }];
120602
+ })
120603
+ );
120604
+ return {
120605
+ ...schema5,
120606
+ version: "7",
120607
+ dialect: "postgresql",
120608
+ tables
120609
+ };
120610
+ };
120180
120611
 
120181
120612
  // src/cli/commands/sqliteUp.ts
120182
120613
  init_source();
@@ -121342,7 +121773,7 @@ var printVersions = async () => {
121342
121773
  var versions = async () => {
121343
121774
  const { npmVersion } = await ormCoreVersions();
121344
121775
  const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
121345
- const envVersion = "0.21.4";
121776
+ const envVersion = "0.22.0";
121346
121777
  const kitVersion = envVersion ? `v${envVersion}` : "--";
121347
121778
  const versions2 = `drizzle-kit: ${kitVersion}
121348
121779
  ${ormVersion}`;