drizzle-kit 0.25.0-1f15bfd → 0.25.0-225f91d

Sign up to get free protection for your applications and to get access to all the features.
package/api.js CHANGED
@@ -2475,9 +2475,9 @@ var require_inflight = __commonJS({
2475
2475
  }
2476
2476
  function slice(args) {
2477
2477
  var length = args.length;
2478
- var array = [];
2479
- for (var i = 0; i < length; i++) array[i] = args[i];
2480
- return array;
2478
+ var array2 = [];
2479
+ for (var i = 0; i < length; i++) array2[i] = args[i];
2480
+ return array2;
2481
2481
  }
2482
2482
  }
2483
2483
  });
@@ -3647,13 +3647,13 @@ function processCreateParams(params) {
3647
3647
  if (errorMap2)
3648
3648
  return { errorMap: errorMap2, description };
3649
3649
  const customMap = (iss, ctx) => {
3650
- var _a324, _b233;
3650
+ var _a326, _b233;
3651
3651
  const { message } = params;
3652
3652
  if (iss.code === "invalid_enum_value") {
3653
3653
  return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
3654
3654
  }
3655
3655
  if (typeof ctx.data === "undefined") {
3656
- return { message: (_a324 = message !== null && message !== void 0 ? message : required_error) !== null && _a324 !== void 0 ? _a324 : ctx.defaultError };
3656
+ return { message: (_a326 = message !== null && message !== void 0 ? message : required_error) !== null && _a326 !== void 0 ? _a326 : ctx.defaultError };
3657
3657
  }
3658
3658
  if (iss.code !== "invalid_type")
3659
3659
  return { message: ctx.defaultError };
@@ -3820,8 +3820,8 @@ var init_lib = __esm({
3820
3820
  return void 0;
3821
3821
  };
3822
3822
  util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
3823
- function joinValues(array, separator = " | ") {
3824
- return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
3823
+ function joinValues(array2, separator = " | ") {
3824
+ return array2.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
3825
3825
  }
3826
3826
  util2.joinValues = joinValues;
3827
3827
  util2.jsonStringifyReplacer = (_2, value) => {
@@ -4319,11 +4319,11 @@ var init_lib = __esm({
4319
4319
  throw result.error;
4320
4320
  }
4321
4321
  safeParse(data, params) {
4322
- var _a324;
4322
+ var _a326;
4323
4323
  const ctx = {
4324
4324
  common: {
4325
4325
  issues: [],
4326
- async: (_a324 = params === null || params === void 0 ? void 0 : params.async) !== null && _a324 !== void 0 ? _a324 : false,
4326
+ async: (_a326 = params === null || params === void 0 ? void 0 : params.async) !== null && _a326 !== void 0 ? _a326 : false,
4327
4327
  contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
4328
4328
  },
4329
4329
  path: (params === null || params === void 0 ? void 0 : params.path) || [],
@@ -4645,7 +4645,7 @@ var init_lib = __esm({
4645
4645
  } else if (check.kind === "url") {
4646
4646
  try {
4647
4647
  new URL(input.data);
4648
- } catch (_a324) {
4648
+ } catch (_a326) {
4649
4649
  ctx = this._getOrReturnCtx(input, ctx);
4650
4650
  addIssueToContext(ctx, {
4651
4651
  validation: "url",
@@ -4815,7 +4815,7 @@ var init_lib = __esm({
4815
4815
  return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
4816
4816
  }
4817
4817
  datetime(options) {
4818
- var _a324, _b233;
4818
+ var _a326, _b233;
4819
4819
  if (typeof options === "string") {
4820
4820
  return this._addCheck({
4821
4821
  kind: "datetime",
@@ -4828,7 +4828,7 @@ var init_lib = __esm({
4828
4828
  return this._addCheck({
4829
4829
  kind: "datetime",
4830
4830
  precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
4831
- offset: (_a324 = options === null || options === void 0 ? void 0 : options.offset) !== null && _a324 !== void 0 ? _a324 : false,
4831
+ offset: (_a326 = options === null || options === void 0 ? void 0 : options.offset) !== null && _a326 !== void 0 ? _a326 : false,
4832
4832
  local: (_b233 = options === null || options === void 0 ? void 0 : options.local) !== null && _b233 !== void 0 ? _b233 : false,
4833
4833
  ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
4834
4834
  });
@@ -4992,11 +4992,11 @@ var init_lib = __esm({
4992
4992
  }
4993
4993
  };
4994
4994
  ZodString.create = (params) => {
4995
- var _a324;
4995
+ var _a326;
4996
4996
  return new ZodString({
4997
4997
  checks: [],
4998
4998
  typeName: ZodFirstPartyTypeKind.ZodString,
4999
- coerce: (_a324 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a324 !== void 0 ? _a324 : false,
4999
+ coerce: (_a326 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a326 !== void 0 ? _a326 : false,
5000
5000
  ...processCreateParams(params)
5001
5001
  });
5002
5002
  };
@@ -5389,11 +5389,11 @@ var init_lib = __esm({
5389
5389
  }
5390
5390
  };
5391
5391
  ZodBigInt.create = (params) => {
5392
- var _a324;
5392
+ var _a326;
5393
5393
  return new ZodBigInt({
5394
5394
  checks: [],
5395
5395
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
5396
- coerce: (_a324 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a324 !== void 0 ? _a324 : false,
5396
+ coerce: (_a326 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a326 !== void 0 ? _a326 : false,
5397
5397
  ...processCreateParams(params)
5398
5398
  });
5399
5399
  };
@@ -5873,8 +5873,8 @@ var init_lib = __esm({
5873
5873
  unknownKeys: "strict",
5874
5874
  ...message !== void 0 ? {
5875
5875
  errorMap: (issue, ctx) => {
5876
- var _a324, _b233, _c12, _d5;
5877
- const defaultError = (_c12 = (_b233 = (_a324 = this._def).errorMap) === null || _b233 === void 0 ? void 0 : _b233.call(_a324, issue, ctx).message) !== null && _c12 !== void 0 ? _c12 : ctx.defaultError;
5876
+ var _a326, _b233, _c12, _d5;
5877
+ const defaultError = (_c12 = (_b233 = (_a326 = this._def).errorMap) === null || _b233 === void 0 ? void 0 : _b233.call(_a326, issue, ctx).message) !== null && _c12 !== void 0 ? _c12 : ctx.defaultError;
5878
5878
  if (issue.code === "unrecognized_keys")
5879
5879
  return {
5880
5880
  message: (_d5 = errorUtil.errToObj(message).message) !== null && _d5 !== void 0 ? _d5 : defaultError
@@ -7661,7 +7661,7 @@ var init_vector = __esm({
7661
7661
  });
7662
7662
 
7663
7663
  // src/serializer/pgSchema.ts
7664
- var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn, index2, indexV4, indexV5, indexV6, fk2, sequenceSchema, sequenceSquashed, columnV7, column2, columnSquashed, tableV32, compositePK2, uniqueConstraint2, tableV42, tableV5, tableV6, tableV7, table2, schemaHash2, kitInternals2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaInternalV6, pgSchemaExternal, pgSchemaInternalV7, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashedV6, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchemaV6, pgSchemaV7, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg;
7664
+ var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn, index2, indexV4, indexV5, indexV6, fk2, sequenceSchema, roleSchema, sequenceSquashed, columnV7, column2, columnSquashed, tableV32, compositePK2, uniqueConstraint2, policy, tableV42, tableV5, tableV6, tableV7, table2, schemaHash2, kitInternals2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaInternalV6, pgSchemaExternal, pgSchemaInternalV7, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashedV6, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchemaV6, pgSchemaV7, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg;
7665
7665
  var init_pgSchema = __esm({
7666
7666
  "src/serializer/pgSchema.ts"() {
7667
7667
  "use strict";
@@ -7793,6 +7793,12 @@ var init_pgSchema = __esm({
7793
7793
  cycle: booleanType().optional(),
7794
7794
  schema: stringType()
7795
7795
  }).strict();
7796
+ roleSchema = objectType({
7797
+ name: stringType(),
7798
+ createDb: booleanType().optional(),
7799
+ createRole: booleanType().optional(),
7800
+ inherit: booleanType().optional()
7801
+ }).strict();
7796
7802
  sequenceSquashed = objectType({
7797
7803
  name: stringType(),
7798
7804
  schema: stringType(),
@@ -7856,6 +7862,14 @@ var init_pgSchema = __esm({
7856
7862
  columns: stringType().array(),
7857
7863
  nullsNotDistinct: booleanType()
7858
7864
  }).strict();
7865
+ policy = objectType({
7866
+ name: stringType(),
7867
+ as: enumType(["PERMISSIVE", "RESTRICTIVE"]).optional(),
7868
+ for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
7869
+ to: stringType().array().optional(),
7870
+ using: stringType().optional(),
7871
+ withCheck: stringType().optional()
7872
+ }).strict();
7859
7873
  tableV42 = objectType({
7860
7874
  name: stringType(),
7861
7875
  schema: stringType(),
@@ -7897,7 +7911,8 @@ var init_pgSchema = __esm({
7897
7911
  indexes: recordType(stringType(), index2),
7898
7912
  foreignKeys: recordType(stringType(), fk2),
7899
7913
  compositePrimaryKeys: recordType(stringType(), compositePK2),
7900
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
7914
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
7915
+ policies: recordType(stringType(), policy).default({})
7901
7916
  }).strict();
7902
7917
  schemaHash2 = objectType({
7903
7918
  id: stringType(),
@@ -7991,6 +8006,7 @@ var init_pgSchema = __esm({
7991
8006
  enums: recordType(stringType(), enumSchema),
7992
8007
  schemas: recordType(stringType(), stringType()),
7993
8008
  sequences: recordType(stringType(), sequenceSchema).default({}),
8009
+ roles: recordType(stringType(), roleSchema).default({}),
7994
8010
  _meta: objectType({
7995
8011
  schemas: recordType(stringType(), stringType()),
7996
8012
  tables: recordType(stringType(), stringType()),
@@ -8005,7 +8021,8 @@ var init_pgSchema = __esm({
8005
8021
  indexes: recordType(stringType(), stringType()),
8006
8022
  foreignKeys: recordType(stringType(), stringType()),
8007
8023
  compositePrimaryKeys: recordType(stringType(), stringType()),
8008
- uniqueConstraints: recordType(stringType(), stringType())
8024
+ uniqueConstraints: recordType(stringType(), stringType()),
8025
+ policies: recordType(stringType(), stringType())
8009
8026
  }).strict();
8010
8027
  tableSquashedV42 = objectType({
8011
8028
  name: stringType(),
@@ -8034,7 +8051,8 @@ var init_pgSchema = __esm({
8034
8051
  tables: recordType(stringType(), tableSquashed2),
8035
8052
  enums: recordType(stringType(), enumSchema),
8036
8053
  schemas: recordType(stringType(), stringType()),
8037
- sequences: recordType(stringType(), sequenceSquashed)
8054
+ sequences: recordType(stringType(), sequenceSquashed),
8055
+ roles: recordType(stringType(), roleSchema).default({})
8038
8056
  }).strict();
8039
8057
  pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
8040
8058
  pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
@@ -8117,6 +8135,23 @@ var init_pgSchema = __esm({
8117
8135
  squashFK: (fk4) => {
8118
8136
  return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${fk4.onUpdate ?? ""};${fk4.onDelete ?? ""};${fk4.schemaTo || "public"}`;
8119
8137
  },
8138
+ squashPolicy: (policy2) => {
8139
+ return `${policy2.name}--${policy2.as}--${policy2.for}--${policy2.to?.join(",")}--${policy2.using}--${policy2.withCheck}`;
8140
+ },
8141
+ unsquashPolicy: (policy2) => {
8142
+ const splitted = policy2.split("--");
8143
+ return {
8144
+ name: splitted[0],
8145
+ as: splitted[1],
8146
+ for: splitted[2],
8147
+ to: splitted[3].split(","),
8148
+ using: splitted[4] !== "undefined" ? splitted[4] : void 0,
8149
+ withCheck: splitted[5] !== "undefined" ? splitted[5] : void 0
8150
+ };
8151
+ },
8152
+ squashPolicyPush: (policy2) => {
8153
+ return `${policy2.name}--${policy2.as}--${policy2.for}--${policy2.to?.join(",")}`;
8154
+ },
8120
8155
  squashPK: (pk) => {
8121
8156
  return `${pk.columns.join(",")};${pk.name}`;
8122
8157
  },
@@ -8219,6 +8254,9 @@ var init_pgSchema = __esm({
8219
8254
  return PgSquasher.squashUnique(unq);
8220
8255
  }
8221
8256
  );
8257
+ const squashedPolicies = mapValues(it[1].policies, (policy2) => {
8258
+ return action === "push" ? PgSquasher.squashPolicyPush(policy2) : PgSquasher.squashPolicy(policy2);
8259
+ });
8222
8260
  return [
8223
8261
  it[0],
8224
8262
  {
@@ -8228,7 +8266,8 @@ var init_pgSchema = __esm({
8228
8266
  indexes: squashedIndexes,
8229
8267
  foreignKeys: squashedFKs,
8230
8268
  compositePrimaryKeys: squashedPKs,
8231
- uniqueConstraints: squashedUniqueConstraints
8269
+ uniqueConstraints: squashedUniqueConstraints,
8270
+ policies: squashedPolicies
8232
8271
  }
8233
8272
  ];
8234
8273
  })
@@ -8251,7 +8290,8 @@ var init_pgSchema = __esm({
8251
8290
  tables: mappedTables,
8252
8291
  enums: json3.enums,
8253
8292
  schemas: json3.schemas,
8254
- sequences: mappedSequences
8293
+ sequences: mappedSequences,
8294
+ roles: json3.roles
8255
8295
  };
8256
8296
  };
8257
8297
  dryPg = pgSchema.parse({
@@ -8601,7 +8641,7 @@ var init_utils = __esm({
8601
8641
  });
8602
8642
 
8603
8643
  // src/cli/views.ts
8604
- var import_hanji, warning, error, isRenamePromptItem, ResolveColumnSelect, tableKey, ResolveSelect, ResolveSchemasSelect, Spinner, ProgressView;
8644
+ var import_hanji, warning, error, isRenamePromptItem, ResolveColumnSelect, tableKey, ResolveSelectNamed, ResolveSelect, ResolveSchemasSelect, Spinner, ProgressView;
8605
8645
  var init_views = __esm({
8606
8646
  "src/cli/views.ts"() {
8607
8647
  "use strict";
@@ -8666,6 +8706,53 @@ Is ${source_default.bold.blue(
8666
8706
  tableKey = (it) => {
8667
8707
  return it.schema === "public" || !it.schema ? it.name : `${it.schema}.${it.name}`;
8668
8708
  };
8709
+ ResolveSelectNamed = class extends import_hanji.Prompt {
8710
+ constructor(base, data, entityType) {
8711
+ super();
8712
+ this.base = base;
8713
+ this.entityType = entityType;
8714
+ this.on("attach", (terminal) => terminal.toggleCursor("hide"));
8715
+ this.state = new import_hanji.SelectState(data);
8716
+ this.state.bind(this);
8717
+ this.base = base;
8718
+ }
8719
+ render(status) {
8720
+ if (status === "submitted" || status === "aborted") {
8721
+ return "";
8722
+ }
8723
+ const key = this.base.name;
8724
+ let text4 = `
8725
+ Is ${source_default.bold.blue(key)} ${this.entityType} created or renamed from another ${this.entityType}?
8726
+ `;
8727
+ const isSelectedRenamed = isRenamePromptItem(
8728
+ this.state.items[this.state.selectedIdx]
8729
+ );
8730
+ const selectedPrefix = isSelectedRenamed ? source_default.yellow("\u276F ") : source_default.green("\u276F ");
8731
+ const labelLength = this.state.items.filter((it) => isRenamePromptItem(it)).map((_2) => {
8732
+ const it = _2;
8733
+ const keyFrom = it.from.name;
8734
+ return key.length + 3 + keyFrom.length;
8735
+ }).reduce((a, b) => {
8736
+ if (a > b) {
8737
+ return a;
8738
+ }
8739
+ return b;
8740
+ }, 0);
8741
+ const entityType = this.entityType;
8742
+ this.state.items.forEach((it, idx) => {
8743
+ const isSelected = idx === this.state.selectedIdx;
8744
+ const isRenamed = isRenamePromptItem(it);
8745
+ const title = isRenamed ? `${it.from.name} \u203A ${it.to.name}`.padEnd(labelLength, " ") : it.name.padEnd(labelLength, " ");
8746
+ const label = isRenamed ? `${source_default.yellow("~")} ${title} ${source_default.gray(`rename ${entityType}`)}` : `${source_default.green("+")} ${title} ${source_default.gray(`create ${entityType}`)}`;
8747
+ text4 += isSelected ? `${selectedPrefix}${label}` : ` ${label}`;
8748
+ text4 += idx != this.state.items.length - 1 ? "\n" : "";
8749
+ });
8750
+ return text4;
8751
+ }
8752
+ result() {
8753
+ return this.state.items[this.state.selectedIdx];
8754
+ }
8755
+ };
8669
8756
  ResolveSelect = class extends import_hanji.Prompt {
8670
8757
  constructor(base, data, entityType) {
8671
8758
  super();
@@ -8882,57 +8969,57 @@ var require_heap = __commonJS({
8882
8969
  }
8883
8970
  return [].splice.apply(a, [lo, lo - lo].concat(x)), x;
8884
8971
  };
8885
- heappush = function(array, item, cmp) {
8972
+ heappush = function(array2, item, cmp) {
8886
8973
  if (cmp == null) {
8887
8974
  cmp = defaultCmp;
8888
8975
  }
8889
- array.push(item);
8890
- return _siftdown(array, 0, array.length - 1, cmp);
8976
+ array2.push(item);
8977
+ return _siftdown(array2, 0, array2.length - 1, cmp);
8891
8978
  };
8892
- heappop = function(array, cmp) {
8979
+ heappop = function(array2, cmp) {
8893
8980
  var lastelt, returnitem;
8894
8981
  if (cmp == null) {
8895
8982
  cmp = defaultCmp;
8896
8983
  }
8897
- lastelt = array.pop();
8898
- if (array.length) {
8899
- returnitem = array[0];
8900
- array[0] = lastelt;
8901
- _siftup(array, 0, cmp);
8984
+ lastelt = array2.pop();
8985
+ if (array2.length) {
8986
+ returnitem = array2[0];
8987
+ array2[0] = lastelt;
8988
+ _siftup(array2, 0, cmp);
8902
8989
  } else {
8903
8990
  returnitem = lastelt;
8904
8991
  }
8905
8992
  return returnitem;
8906
8993
  };
8907
- heapreplace = function(array, item, cmp) {
8994
+ heapreplace = function(array2, item, cmp) {
8908
8995
  var returnitem;
8909
8996
  if (cmp == null) {
8910
8997
  cmp = defaultCmp;
8911
8998
  }
8912
- returnitem = array[0];
8913
- array[0] = item;
8914
- _siftup(array, 0, cmp);
8999
+ returnitem = array2[0];
9000
+ array2[0] = item;
9001
+ _siftup(array2, 0, cmp);
8915
9002
  return returnitem;
8916
9003
  };
8917
- heappushpop = function(array, item, cmp) {
9004
+ heappushpop = function(array2, item, cmp) {
8918
9005
  var _ref;
8919
9006
  if (cmp == null) {
8920
9007
  cmp = defaultCmp;
8921
9008
  }
8922
- if (array.length && cmp(array[0], item) < 0) {
8923
- _ref = [array[0], item], item = _ref[0], array[0] = _ref[1];
8924
- _siftup(array, 0, cmp);
9009
+ if (array2.length && cmp(array2[0], item) < 0) {
9010
+ _ref = [array2[0], item], item = _ref[0], array2[0] = _ref[1];
9011
+ _siftup(array2, 0, cmp);
8925
9012
  }
8926
9013
  return item;
8927
9014
  };
8928
- heapify = function(array, cmp) {
9015
+ heapify = function(array2, cmp) {
8929
9016
  var i, _i2, _j2, _len, _ref, _ref1, _results, _results1;
8930
9017
  if (cmp == null) {
8931
9018
  cmp = defaultCmp;
8932
9019
  }
8933
9020
  _ref1 = function() {
8934
9021
  _results1 = [];
8935
- for (var _j3 = 0, _ref2 = floor(array.length / 2); 0 <= _ref2 ? _j3 < _ref2 : _j3 > _ref2; 0 <= _ref2 ? _j3++ : _j3--) {
9022
+ for (var _j3 = 0, _ref2 = floor(array2.length / 2); 0 <= _ref2 ? _j3 < _ref2 : _j3 > _ref2; 0 <= _ref2 ? _j3++ : _j3--) {
8936
9023
  _results1.push(_j3);
8937
9024
  }
8938
9025
  return _results1;
@@ -8940,51 +9027,51 @@ var require_heap = __commonJS({
8940
9027
  _results = [];
8941
9028
  for (_i2 = 0, _len = _ref1.length; _i2 < _len; _i2++) {
8942
9029
  i = _ref1[_i2];
8943
- _results.push(_siftup(array, i, cmp));
9030
+ _results.push(_siftup(array2, i, cmp));
8944
9031
  }
8945
9032
  return _results;
8946
9033
  };
8947
- updateItem = function(array, item, cmp) {
9034
+ updateItem = function(array2, item, cmp) {
8948
9035
  var pos;
8949
9036
  if (cmp == null) {
8950
9037
  cmp = defaultCmp;
8951
9038
  }
8952
- pos = array.indexOf(item);
9039
+ pos = array2.indexOf(item);
8953
9040
  if (pos === -1) {
8954
9041
  return;
8955
9042
  }
8956
- _siftdown(array, 0, pos, cmp);
8957
- return _siftup(array, pos, cmp);
9043
+ _siftdown(array2, 0, pos, cmp);
9044
+ return _siftup(array2, pos, cmp);
8958
9045
  };
8959
- nlargest = function(array, n, cmp) {
9046
+ nlargest = function(array2, n, cmp) {
8960
9047
  var elem, result, _i2, _len, _ref;
8961
9048
  if (cmp == null) {
8962
9049
  cmp = defaultCmp;
8963
9050
  }
8964
- result = array.slice(0, n);
9051
+ result = array2.slice(0, n);
8965
9052
  if (!result.length) {
8966
9053
  return result;
8967
9054
  }
8968
9055
  heapify(result, cmp);
8969
- _ref = array.slice(n);
9056
+ _ref = array2.slice(n);
8970
9057
  for (_i2 = 0, _len = _ref.length; _i2 < _len; _i2++) {
8971
9058
  elem = _ref[_i2];
8972
9059
  heappushpop(result, elem, cmp);
8973
9060
  }
8974
9061
  return result.sort(cmp).reverse();
8975
9062
  };
8976
- nsmallest = function(array, n, cmp) {
9063
+ nsmallest = function(array2, n, cmp) {
8977
9064
  var elem, i, los, result, _i2, _j2, _len, _ref, _ref1, _results;
8978
9065
  if (cmp == null) {
8979
9066
  cmp = defaultCmp;
8980
9067
  }
8981
- if (n * 10 <= array.length) {
8982
- result = array.slice(0, n).sort(cmp);
9068
+ if (n * 10 <= array2.length) {
9069
+ result = array2.slice(0, n).sort(cmp);
8983
9070
  if (!result.length) {
8984
9071
  return result;
8985
9072
  }
8986
9073
  los = result[result.length - 1];
8987
- _ref = array.slice(n);
9074
+ _ref = array2.slice(n);
8988
9075
  for (_i2 = 0, _len = _ref.length; _i2 < _len; _i2++) {
8989
9076
  elem = _ref[_i2];
8990
9077
  if (cmp(elem, los) < 0) {
@@ -8995,51 +9082,51 @@ var require_heap = __commonJS({
8995
9082
  }
8996
9083
  return result;
8997
9084
  }
8998
- heapify(array, cmp);
9085
+ heapify(array2, cmp);
8999
9086
  _results = [];
9000
- for (i = _j2 = 0, _ref1 = min2(n, array.length); 0 <= _ref1 ? _j2 < _ref1 : _j2 > _ref1; i = 0 <= _ref1 ? ++_j2 : --_j2) {
9001
- _results.push(heappop(array, cmp));
9087
+ for (i = _j2 = 0, _ref1 = min2(n, array2.length); 0 <= _ref1 ? _j2 < _ref1 : _j2 > _ref1; i = 0 <= _ref1 ? ++_j2 : --_j2) {
9088
+ _results.push(heappop(array2, cmp));
9002
9089
  }
9003
9090
  return _results;
9004
9091
  };
9005
- _siftdown = function(array, startpos, pos, cmp) {
9092
+ _siftdown = function(array2, startpos, pos, cmp) {
9006
9093
  var newitem, parent, parentpos;
9007
9094
  if (cmp == null) {
9008
9095
  cmp = defaultCmp;
9009
9096
  }
9010
- newitem = array[pos];
9097
+ newitem = array2[pos];
9011
9098
  while (pos > startpos) {
9012
9099
  parentpos = pos - 1 >> 1;
9013
- parent = array[parentpos];
9100
+ parent = array2[parentpos];
9014
9101
  if (cmp(newitem, parent) < 0) {
9015
- array[pos] = parent;
9102
+ array2[pos] = parent;
9016
9103
  pos = parentpos;
9017
9104
  continue;
9018
9105
  }
9019
9106
  break;
9020
9107
  }
9021
- return array[pos] = newitem;
9108
+ return array2[pos] = newitem;
9022
9109
  };
9023
- _siftup = function(array, pos, cmp) {
9110
+ _siftup = function(array2, pos, cmp) {
9024
9111
  var childpos, endpos, newitem, rightpos, startpos;
9025
9112
  if (cmp == null) {
9026
9113
  cmp = defaultCmp;
9027
9114
  }
9028
- endpos = array.length;
9115
+ endpos = array2.length;
9029
9116
  startpos = pos;
9030
- newitem = array[pos];
9117
+ newitem = array2[pos];
9031
9118
  childpos = 2 * pos + 1;
9032
9119
  while (childpos < endpos) {
9033
9120
  rightpos = childpos + 1;
9034
- if (rightpos < endpos && !(cmp(array[childpos], array[rightpos]) < 0)) {
9121
+ if (rightpos < endpos && !(cmp(array2[childpos], array2[rightpos]) < 0)) {
9035
9122
  childpos = rightpos;
9036
9123
  }
9037
- array[pos] = array[childpos];
9124
+ array2[pos] = array2[childpos];
9038
9125
  pos = childpos;
9039
9126
  childpos = 2 * pos + 1;
9040
9127
  }
9041
- array[pos] = newitem;
9042
- return _siftdown(array, startpos, pos, cmp);
9128
+ array2[pos] = newitem;
9129
+ return _siftdown(array2, startpos, pos, cmp);
9043
9130
  };
9044
9131
  Heap = function() {
9045
9132
  Heap2.push = heappush;
@@ -10966,12 +11053,12 @@ var require_lib = __commonJS({
10966
11053
  }
10967
11054
  return bestMatch;
10968
11055
  }
10969
- scalarize(array, originals, fuzzyOriginals) {
11056
+ scalarize(array2, originals, fuzzyOriginals) {
10970
11057
  const fuzzyMatches = [];
10971
11058
  if (fuzzyOriginals) {
10972
11059
  const keyScores = {};
10973
- for (let index4 = 0; index4 < array.length; index4++) {
10974
- const item = array[index4];
11060
+ for (let index4 = 0; index4 < array2.length; index4++) {
11061
+ const item = array2[index4];
10975
11062
  if (this.isScalar(item)) {
10976
11063
  continue;
10977
11064
  }
@@ -10985,8 +11072,8 @@ var require_lib = __commonJS({
10985
11072
  }
10986
11073
  }
10987
11074
  const result = [];
10988
- for (let index4 = 0; index4 < array.length; index4++) {
10989
- const item = array[index4];
11075
+ for (let index4 = 0; index4 < array2.length; index4++) {
11076
+ const item = array2[index4];
10990
11077
  if (this.isScalar(item)) {
10991
11078
  result.push(item);
10992
11079
  } else {
@@ -11208,6 +11295,37 @@ function diffColumns(left, right) {
11208
11295
  );
11209
11296
  return alteredTables;
11210
11297
  }
11298
+ function diffPolicies(left, right) {
11299
+ left = JSON.parse(JSON.stringify(left));
11300
+ right = JSON.parse(JSON.stringify(right));
11301
+ const result = (0, import_json_diff.diff)(left, right) ?? {};
11302
+ const alteredTables = Object.fromEntries(
11303
+ Object.entries(result).filter((it) => {
11304
+ return !(it[0].includes("__added") || it[0].includes("__deleted"));
11305
+ }).map((tableEntry) => {
11306
+ const deletedPolicies = Object.entries(tableEntry[1].policies ?? {}).filter((it) => {
11307
+ return it[0].endsWith("__deleted");
11308
+ }).map((it) => {
11309
+ return it[1];
11310
+ });
11311
+ const addedPolicies = Object.entries(tableEntry[1].policies ?? {}).filter((it) => {
11312
+ return it[0].endsWith("__added");
11313
+ }).map((it) => {
11314
+ return it[1];
11315
+ });
11316
+ tableEntry[1].policies = {
11317
+ added: addedPolicies,
11318
+ deleted: deletedPolicies
11319
+ };
11320
+ const table4 = left[tableEntry[0]];
11321
+ return [
11322
+ tableEntry[0],
11323
+ { name: table4.name, schema: table4.schema, ...tableEntry[1] }
11324
+ ];
11325
+ })
11326
+ );
11327
+ return alteredTables;
11328
+ }
11211
11329
  function applyJsonDiff(json1, json22) {
11212
11330
  json1 = JSON.parse(JSON.stringify(json1));
11213
11331
  json22 = JSON.parse(JSON.stringify(json22));
@@ -11217,6 +11335,7 @@ function applyJsonDiff(json1, json22) {
11217
11335
  difference.tables = difference.tables || {};
11218
11336
  difference.enums = difference.enums || {};
11219
11337
  difference.sequences = difference.sequences || {};
11338
+ difference.roles = difference.roles || {};
11220
11339
  const schemaKeys = Object.keys(difference.schemas);
11221
11340
  for (let key of schemaKeys) {
11222
11341
  if (key.endsWith("__added") || key.endsWith("__deleted")) {
@@ -11272,6 +11391,10 @@ function applyJsonDiff(json1, json22) {
11272
11391
  const alteredSequences = sequencesEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted")) && "values" in it[1]).map((it) => {
11273
11392
  return json22.sequences[it[0]];
11274
11393
  });
11394
+ const rolesEntries = Object.entries(difference.roles);
11395
+ const alteredRoles = rolesEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted"))).map((it) => {
11396
+ return json22.roles[it[0]];
11397
+ });
11275
11398
  const alteredTablesWithColumns = Object.values(difference.tables).map(
11276
11399
  (table4) => {
11277
11400
  return findAlternationsInTable(table4);
@@ -11280,7 +11403,8 @@ function applyJsonDiff(json1, json22) {
11280
11403
  return {
11281
11404
  alteredTablesWithColumns,
11282
11405
  alteredEnums,
11283
- alteredSequences
11406
+ alteredSequences,
11407
+ alteredRoles
11284
11408
  };
11285
11409
  }
11286
11410
  var import_json_diff, mapArraysDiff, findAlternationsInTable, alternationsInColumn;
@@ -11340,6 +11464,21 @@ var init_jsonDiffer = __esm({
11340
11464
  return !it[0].endsWith("__deleted") && !it[0].endsWith("__added");
11341
11465
  })
11342
11466
  );
11467
+ const deletedPolicies = Object.fromEntries(
11468
+ Object.entries(table4.policies__deleted || {}).concat(
11469
+ Object.entries(table4.policies || {}).filter((it) => it[0].includes("__deleted"))
11470
+ ).map((entry) => [entry[0].replace("__deleted", ""), entry[1]])
11471
+ );
11472
+ const addedPolicies = Object.fromEntries(
11473
+ Object.entries(table4.policies__added || {}).concat(
11474
+ Object.entries(table4.policies || {}).filter((it) => it[0].includes("__added"))
11475
+ ).map((entry) => [entry[0].replace("__added", ""), entry[1]])
11476
+ );
11477
+ const alteredPolicies = Object.fromEntries(
11478
+ Object.entries(table4.policies || {}).filter((it) => {
11479
+ return !it[0].endsWith("__deleted") && !it[0].endsWith("__added");
11480
+ })
11481
+ );
11343
11482
  const deletedForeignKeys = Object.fromEntries(
11344
11483
  Object.entries(table4.foreignKeys__deleted || {}).concat(
11345
11484
  Object.entries(table4.foreignKeys || {}).filter((it) => it[0].includes("__deleted"))
@@ -11401,7 +11540,10 @@ var init_jsonDiffer = __esm({
11401
11540
  alteredCompositePKs,
11402
11541
  addedUniqueConstraints,
11403
11542
  deletedUniqueConstraints,
11404
- alteredUniqueConstraints
11543
+ alteredUniqueConstraints,
11544
+ deletedPolicies,
11545
+ addedPolicies,
11546
+ alteredPolicies
11405
11547
  };
11406
11548
  };
11407
11549
  alternationsInColumn = (column4) => {
@@ -11675,7 +11817,7 @@ function fromJson(statements, dialect4, action, json22) {
11675
11817
  }).filter((it) => it !== "");
11676
11818
  return result;
11677
11819
  }
11678
- var pgNativeTypes, isPgNativeType, Convertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, PgAlterTableAlterColumnSetGenerated, PgAlterTableAlterColumnDropGenerated, PgAlterTableAlterColumnAlterGenerated, PgAlterTableAddUniqueConstraintConvertor, PgAlterTableDropUniqueConstraintConvertor, MySQLAlterTableAddUniqueConstraintConvertor, MySQLAlterTableDropUniqueConstraintConvertor, CreatePgSequenceConvertor, DropPgSequenceConvertor, RenamePgSequenceConvertor, MovePgSequenceConvertor, AlterPgSequenceConvertor, CreateTypeEnumConvertor, DropTypeEnumConvertor, AlterTypeAddValueConvertor, AlterTypeSetSchemaConvertor, AlterRenameTypeConvertor, AlterTypeDropValueConvertor, PgDropTableConvertor, MySQLDropTableConvertor, SQLiteDropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, PgAlterTableAlterColumnDropGeneratedConvertor, PgAlterTableAlterColumnSetExpressionConvertor, PgAlterTableAlterColumnAlterrGeneratedConvertor, SqliteAlterTableAlterColumnDropGeneratedConvertor, SqliteAlterTableAlterColumnSetExpressionConvertor, SqliteAlterTableAlterColumnAlterGeneratedConvertor, MySqlAlterTableAlterColumnAlterrGeneratedConvertor, MySqlAlterTableAddPk, MySqlAlterTableDropPk, LibSQLModifyColumn, MySqlModifyColumn, PgAlterTableCreateCompositePrimaryKeyConvertor, PgAlterTableDeleteCompositePrimaryKeyConvertor, PgAlterTableAlterCompositePrimaryKeyConvertor, MySqlAlterTableCreateCompositePrimaryKeyConvertor, MySqlAlterTableDeleteCompositePrimaryKeyConvertor, MySqlAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetPrimaryKeyConvertor, PgAlterTableAlterColumnDropPrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, PgAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, LibSQLCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MySqlDropIndexConvertor, SQLiteRecreateTableConvertor, LibSQLRecreateTableConvertor, convertors;
11820
+ var pgNativeTypes, isPgNativeType, Convertor, PgCreateRoleConvertor, PgDropRoleConvertor, PgRenameRoleConvertor, PgAlterRoleConvertor, PgCreatePolicyConvertor, PgDropPolicyConvertor, PgRenamePolicyConvertor, PgAlterPolicyConvertor, PgEnableRlsConvertor, PgDisableRlsConvertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, PgAlterTableAlterColumnSetGenerated, PgAlterTableAlterColumnDropGenerated, PgAlterTableAlterColumnAlterGenerated, PgAlterTableAddUniqueConstraintConvertor, PgAlterTableDropUniqueConstraintConvertor, MySQLAlterTableAddUniqueConstraintConvertor, MySQLAlterTableDropUniqueConstraintConvertor, CreatePgSequenceConvertor, DropPgSequenceConvertor, RenamePgSequenceConvertor, MovePgSequenceConvertor, AlterPgSequenceConvertor, CreateTypeEnumConvertor, AlterTypeAddValueConvertor, PgDropTableConvertor, MySQLDropTableConvertor, SQLiteDropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, PgAlterTableAlterColumnDropGeneratedConvertor, PgAlterTableAlterColumnSetExpressionConvertor, PgAlterTableAlterColumnAlterrGeneratedConvertor, SqliteAlterTableAlterColumnDropGeneratedConvertor, SqliteAlterTableAlterColumnSetExpressionConvertor, SqliteAlterTableAlterColumnAlterGeneratedConvertor, MySqlAlterTableAlterColumnAlterrGeneratedConvertor, MySqlAlterTableAddPk, MySqlAlterTableDropPk, LibSQLModifyColumn, MySqlModifyColumn, PgAlterTableCreateCompositePrimaryKeyConvertor, PgAlterTableDeleteCompositePrimaryKeyConvertor, PgAlterTableAlterCompositePrimaryKeyConvertor, MySqlAlterTableCreateCompositePrimaryKeyConvertor, MySqlAlterTableDeleteCompositePrimaryKeyConvertor, MySqlAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetPrimaryKeyConvertor, PgAlterTableAlterColumnDropPrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, PgAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, LibSQLCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MySqlDropIndexConvertor, SQLiteRecreateTableConvertor, LibSQLRecreateTableConvertor, convertors;
11679
11821
  var init_sqlgenerator = __esm({
11680
11822
  "src/sqlgenerator.ts"() {
11681
11823
  "use strict";
@@ -11731,12 +11873,109 @@ var init_sqlgenerator = __esm({
11731
11873
  };
11732
11874
  Convertor = class {
11733
11875
  };
11876
+ PgCreateRoleConvertor = class extends Convertor {
11877
+ can(statement, dialect4) {
11878
+ return statement.type === "create_role" && dialect4 === "postgresql";
11879
+ }
11880
+ convert(statement) {
11881
+ return `CREATE ROLE "${statement.name}"${statement.values.createDb || statement.values.createRole || !statement.values.inherit ? ` WITH${statement.values.createDb ? " CREATEDB" : ""}${statement.values.createRole ? " CREATEROLE" : ""}${statement.values.inherit ? "" : " NOINHERIT"}` : ""};`;
11882
+ }
11883
+ };
11884
+ PgDropRoleConvertor = class extends Convertor {
11885
+ can(statement, dialect4) {
11886
+ return statement.type === "drop_role" && dialect4 === "postgresql";
11887
+ }
11888
+ convert(statement) {
11889
+ return `DROP ROLE "${statement.name}";`;
11890
+ }
11891
+ };
11892
+ PgRenameRoleConvertor = class extends Convertor {
11893
+ can(statement, dialect4) {
11894
+ return statement.type === "rename_role" && dialect4 === "postgresql";
11895
+ }
11896
+ convert(statement) {
11897
+ return `ALTER ROLE "${statement.nameFrom}" RENAME TO "${statement.nameTo}";`;
11898
+ }
11899
+ };
11900
+ PgAlterRoleConvertor = class extends Convertor {
11901
+ can(statement, dialect4) {
11902
+ return statement.type === "alter_role" && dialect4 === "postgresql";
11903
+ }
11904
+ convert(statement) {
11905
+ return `ALTER ROLE "${statement.name}"${` WITH${statement.values.createDb ? " CREATEDB" : " NOCREATEDB"}${statement.values.createRole ? " CREATEROLE" : " NOCREATEROLE"}${statement.values.inherit ? " INHERIT" : " NOINHERIT"}`};`;
11906
+ }
11907
+ };
11908
+ PgCreatePolicyConvertor = class extends Convertor {
11909
+ can(statement, dialect4) {
11910
+ return statement.type === "create_policy" && dialect4 === "postgresql";
11911
+ }
11912
+ convert(statement) {
11913
+ const policy2 = statement.data;
11914
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
11915
+ const usingPart = policy2.using ? ` USING (${policy2.using})` : "";
11916
+ const withCheckPart = policy2.withCheck ? ` WITH CHECK (${policy2.withCheck})` : "";
11917
+ const policyToPart = policy2.to?.map(
11918
+ (v) => ["current_user", "current_role", "session_user", "public"].includes(v) ? v : `"${v}"`
11919
+ ).join(", ");
11920
+ return `CREATE POLICY "${policy2.name}" ON ${tableNameWithSchema} AS ${policy2.as?.toUpperCase()} FOR ${policy2.for?.toUpperCase()} TO ${policyToPart}${usingPart}${withCheckPart};`;
11921
+ }
11922
+ };
11923
+ PgDropPolicyConvertor = class extends Convertor {
11924
+ can(statement, dialect4) {
11925
+ return statement.type === "drop_policy" && dialect4 === "postgresql";
11926
+ }
11927
+ convert(statement) {
11928
+ const policy2 = statement.data;
11929
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
11930
+ return `DROP POLICY "${policy2.name}" ON ${tableNameWithSchema} CASCADE;`;
11931
+ }
11932
+ };
11933
+ PgRenamePolicyConvertor = class extends Convertor {
11934
+ can(statement, dialect4) {
11935
+ return statement.type === "rename_policy" && dialect4 === "postgresql";
11936
+ }
11937
+ convert(statement) {
11938
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
11939
+ return `ALTER POLICY "${statement.oldName}" ON ${tableNameWithSchema} RENAME TO "${statement.newName}";`;
11940
+ }
11941
+ };
11942
+ PgAlterPolicyConvertor = class extends Convertor {
11943
+ can(statement, dialect4) {
11944
+ return statement.type === "alter_policy" && dialect4 === "postgresql";
11945
+ }
11946
+ convert(statement) {
11947
+ const newPolicy = PgSquasher.unsquashPolicy(statement.newData);
11948
+ const oldPolicy = PgSquasher.unsquashPolicy(statement.oldData);
11949
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
11950
+ const usingPart = newPolicy.using ? ` USING (${newPolicy.using})` : oldPolicy.using ? ` USING (${oldPolicy.using})` : "";
11951
+ const withCheckPart = newPolicy.withCheck ? ` WITH CHECK (${newPolicy.withCheck})` : oldPolicy.withCheck ? ` WITH CHECK (${oldPolicy.withCheck})` : "";
11952
+ return `ALTER POLICY "${oldPolicy.name}" ON ${tableNameWithSchema} TO ${newPolicy.to}${usingPart}${withCheckPart};`;
11953
+ }
11954
+ };
11955
+ PgEnableRlsConvertor = class extends Convertor {
11956
+ can(statement, dialect4) {
11957
+ return statement.type === "enable_rls" && dialect4 === "postgresql";
11958
+ }
11959
+ convert(statement) {
11960
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
11961
+ return `ALTER TABLE ${tableNameWithSchema} ENABLE ROW LEVEL SECURITY;`;
11962
+ }
11963
+ };
11964
+ PgDisableRlsConvertor = class extends Convertor {
11965
+ can(statement, dialect4) {
11966
+ return statement.type === "disable_rls" && dialect4 === "postgresql";
11967
+ }
11968
+ convert(statement) {
11969
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
11970
+ return `ALTER TABLE ${tableNameWithSchema} DISABLE ROW LEVEL SECURITY;`;
11971
+ }
11972
+ };
11734
11973
  PgCreateTableConvertor = class extends Convertor {
11735
11974
  can(statement, dialect4) {
11736
11975
  return statement.type === "create_table" && dialect4 === "postgresql";
11737
11976
  }
11738
11977
  convert(st) {
11739
- const { tableName, schema: schema4, columns, compositePKs, uniqueConstraints } = st;
11978
+ const { tableName, schema: schema4, columns, compositePKs, uniqueConstraints, policies } = st;
11740
11979
  let statement = "";
11741
11980
  const name2 = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
11742
11981
  statement += `CREATE TABLE IF NOT EXISTS ${name2} (
@@ -11773,7 +12012,12 @@ var init_sqlgenerator = __esm({
11773
12012
  );`;
11774
12013
  statement += `
11775
12014
  `;
11776
- return statement;
12015
+ const enableRls = new PgEnableRlsConvertor().convert({
12016
+ type: "enable_rls",
12017
+ tableName,
12018
+ schema: schema4
12019
+ });
12020
+ return [statement, ...policies && policies.length > 0 ? [enableRls] : []];
11777
12021
  }
11778
12022
  };
11779
12023
  MySqlCreateTableConvertor = class extends Convertor {
@@ -12056,22 +12300,20 @@ var init_sqlgenerator = __esm({
12056
12300
  }
12057
12301
  convert(st) {
12058
12302
  const { name: name2, values, schema: schema4 } = st;
12059
- const enumNameWithSchema = schema4 ? `"${schema4}"."${name2}"` : `"${name2}"`;
12303
+ const tableNameWithSchema = schema4 ? `"${schema4}"."${name2}"` : `"${name2}"`;
12060
12304
  let valuesStatement = "(";
12061
12305
  valuesStatement += values.map((it) => `'${it}'`).join(", ");
12062
12306
  valuesStatement += ")";
12063
- let statement = `CREATE TYPE ${enumNameWithSchema} AS ENUM${valuesStatement};`;
12064
- return statement;
12065
- }
12066
- };
12067
- DropTypeEnumConvertor = class extends Convertor {
12068
- can(statement) {
12069
- return statement.type === "drop_type_enum";
12070
- }
12071
- convert(st) {
12072
- const { name: name2, schema: schema4 } = st;
12073
- const enumNameWithSchema = schema4 ? `"${schema4}"."${name2}"` : `"${name2}"`;
12074
- let statement = `DROP TYPE ${enumNameWithSchema} CASCADE;`;
12307
+ let statement = "DO $$ BEGIN";
12308
+ statement += "\n";
12309
+ statement += ` CREATE TYPE ${tableNameWithSchema} AS ENUM${valuesStatement};`;
12310
+ statement += "\n";
12311
+ statement += "EXCEPTION";
12312
+ statement += "\n";
12313
+ statement += " WHEN duplicate_object THEN null;";
12314
+ statement += "\n";
12315
+ statement += "END $$;";
12316
+ statement += "\n";
12075
12317
  return statement;
12076
12318
  }
12077
12319
  };
@@ -12080,56 +12322,9 @@ var init_sqlgenerator = __esm({
12080
12322
  return statement.type === "alter_type_add_value";
12081
12323
  }
12082
12324
  convert(st) {
12083
- const { name: name2, schema: schema4, value, before } = st;
12084
- const enumNameWithSchema = schema4 ? `"${schema4}"."${name2}"` : `"${name2}"`;
12085
- return `ALTER TYPE ${enumNameWithSchema} ADD VALUE '${value}'${before.length ? ` BEFORE '${before}'` : ""};`;
12086
- }
12087
- };
12088
- AlterTypeSetSchemaConvertor = class extends Convertor {
12089
- can(statement) {
12090
- return statement.type === "move_type_enum";
12091
- }
12092
- convert(st) {
12093
- const { name: name2, schemaFrom, schemaTo } = st;
12094
- const enumNameWithSchema = schemaFrom ? `"${schemaFrom}"."${name2}"` : `"${name2}"`;
12095
- return `ALTER TYPE ${enumNameWithSchema} SET SCHEMA "${schemaTo}";`;
12096
- }
12097
- };
12098
- AlterRenameTypeConvertor = class extends Convertor {
12099
- can(statement) {
12100
- return statement.type === "rename_type_enum";
12101
- }
12102
- convert(st) {
12103
- const { nameTo, nameFrom, schema: schema4 } = st;
12104
- const enumNameWithSchema = schema4 ? `"${schema4}"."${nameFrom}"` : `"${nameFrom}"`;
12105
- return `ALTER TYPE ${enumNameWithSchema} RENAME TO "${nameTo}";`;
12106
- }
12107
- };
12108
- AlterTypeDropValueConvertor = class extends Convertor {
12109
- can(statement) {
12110
- return statement.type === "alter_type_drop_value";
12111
- }
12112
- convert(st) {
12113
- const { columnsWithEnum, name: name2, newValues, schema: schema4 } = st;
12114
- const statements = [];
12115
- for (const withEnum of columnsWithEnum) {
12116
- statements.push(
12117
- `ALTER TABLE "${withEnum.schema}"."${withEnum.table}" ALTER COLUMN "${withEnum.column}" SET DATA TYPE text;`
12118
- );
12119
- }
12120
- statements.push(new DropTypeEnumConvertor().convert({ name: name2, schema: schema4, type: "drop_type_enum" }));
12121
- statements.push(new CreateTypeEnumConvertor().convert({
12122
- name: name2,
12123
- schema: schema4,
12124
- values: newValues,
12125
- type: "create_type_enum"
12126
- }));
12127
- for (const withEnum of columnsWithEnum) {
12128
- statements.push(
12129
- `ALTER TABLE "${withEnum.schema}"."${withEnum.table}" ALTER COLUMN "${withEnum.column}" SET DATA TYPE "${schema4}"."${name2}" USING "${withEnum.column}"::"${schema4}"."${name2}";`
12130
- );
12131
- }
12132
- return statements;
12325
+ const { name: name2, schema: schema4, value } = st;
12326
+ const schemaPrefix = schema4 && schema4 !== "public" ? `"${schema4}".` : "";
12327
+ return `ALTER TYPE ${schemaPrefix}"${name2}" ADD VALUE '${value}';`;
12133
12328
  }
12134
12329
  };
12135
12330
  PgDropTableConvertor = class extends Convertor {
@@ -12137,9 +12332,21 @@ var init_sqlgenerator = __esm({
12137
12332
  return statement.type === "drop_table" && dialect4 === "postgresql";
12138
12333
  }
12139
12334
  convert(statement) {
12140
- const { tableName, schema: schema4 } = statement;
12335
+ const { tableName, schema: schema4, policies } = statement;
12141
12336
  const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
12142
- return `DROP TABLE ${tableNameWithSchema};`;
12337
+ const dropPolicyConvertor = new PgDropPolicyConvertor();
12338
+ const droppedPolicies = policies?.map((p) => {
12339
+ return dropPolicyConvertor.convert({
12340
+ type: "drop_policy",
12341
+ tableName,
12342
+ data: PgSquasher.unsquashPolicy(p),
12343
+ schema: schema4
12344
+ });
12345
+ }) ?? [];
12346
+ return [
12347
+ ...droppedPolicies,
12348
+ `DROP TABLE ${tableNameWithSchema};`
12349
+ ];
12143
12350
  }
12144
12351
  };
12145
12352
  MySQLDropTableConvertor = class extends Convertor {
@@ -13273,11 +13480,6 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
13273
13480
  convertors.push(new SQLiteRecreateTableConvertor());
13274
13481
  convertors.push(new LibSQLRecreateTableConvertor());
13275
13482
  convertors.push(new CreateTypeEnumConvertor());
13276
- convertors.push(new DropTypeEnumConvertor());
13277
- convertors.push(new AlterTypeAddValueConvertor());
13278
- convertors.push(new AlterTypeSetSchemaConvertor());
13279
- convertors.push(new AlterRenameTypeConvertor());
13280
- convertors.push(new AlterTypeDropValueConvertor());
13281
13483
  convertors.push(new CreatePgSequenceConvertor());
13282
13484
  convertors.push(new DropPgSequenceConvertor());
13283
13485
  convertors.push(new RenamePgSequenceConvertor());
@@ -13309,12 +13511,23 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
13309
13511
  convertors.push(new PgDropIndexConvertor());
13310
13512
  convertors.push(new SqliteDropIndexConvertor());
13311
13513
  convertors.push(new MySqlDropIndexConvertor());
13514
+ convertors.push(new AlterTypeAddValueConvertor());
13312
13515
  convertors.push(new PgAlterTableAlterColumnSetPrimaryKeyConvertor());
13313
13516
  convertors.push(new PgAlterTableAlterColumnDropPrimaryKeyConvertor());
13314
13517
  convertors.push(new PgAlterTableAlterColumnSetNotNullConvertor());
13315
13518
  convertors.push(new PgAlterTableAlterColumnDropNotNullConvertor());
13316
13519
  convertors.push(new PgAlterTableAlterColumnSetDefaultConvertor());
13317
13520
  convertors.push(new PgAlterTableAlterColumnDropDefaultConvertor());
13521
+ convertors.push(new PgAlterPolicyConvertor());
13522
+ convertors.push(new PgCreatePolicyConvertor());
13523
+ convertors.push(new PgDropPolicyConvertor());
13524
+ convertors.push(new PgRenamePolicyConvertor());
13525
+ convertors.push(new PgEnableRlsConvertor());
13526
+ convertors.push(new PgDisableRlsConvertor());
13527
+ convertors.push(new PgDropRoleConvertor());
13528
+ convertors.push(new PgAlterRoleConvertor());
13529
+ convertors.push(new PgCreateRoleConvertor());
13530
+ convertors.push(new PgRenameRoleConvertor());
13318
13531
  convertors.push(new PgAlterTableAlterColumnSetExpressionConvertor());
13319
13532
  convertors.push(new PgAlterTableAlterColumnDropGeneratedConvertor());
13320
13533
  convertors.push(new PgAlterTableAlterColumnAlterrGeneratedConvertor());
@@ -13609,7 +13822,7 @@ var init_sqlitePushUtils = __esm({
13609
13822
  });
13610
13823
 
13611
13824
  // src/jsonStatements.ts
13612
- var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumValues, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareLibSQLCreateReferencesJson, prepareDropReferencesJson, prepareLibSQLDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql;
13825
+ var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson, prepareCreateRoleJson, prepareAlterRoleJson, prepareDropRoleJson, prepareRenameRoleJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, prepareRenamePolicyJsons, prepareCreatePolicyJsons, prepareDropPolicyJsons, prepareAlterPolicyJson, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareLibSQLCreateReferencesJson, prepareDropReferencesJson, prepareLibSQLDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql;
13613
13826
  var init_jsonStatements = __esm({
13614
13827
  "src/jsonStatements.ts"() {
13615
13828
  "use strict";
@@ -13620,7 +13833,7 @@ var init_jsonStatements = __esm({
13620
13833
  init_pgSchema();
13621
13834
  init_sqliteSchema();
13622
13835
  preparePgCreateTableJson = (table4, json22) => {
13623
- const { name: name2, schema: schema4, columns, compositePrimaryKeys, uniqueConstraints } = table4;
13836
+ const { name: name2, schema: schema4, columns, compositePrimaryKeys, uniqueConstraints, policies } = table4;
13624
13837
  const tableKey2 = `${schema4 || "public"}.${name2}`;
13625
13838
  const compositePkName = Object.values(compositePrimaryKeys).length > 0 ? json22.tables[tableKey2].compositePrimaryKeys[`${PgSquasher.unsquashPK(Object.values(compositePrimaryKeys)[0]).name}`].name : "";
13626
13839
  return {
@@ -13630,7 +13843,8 @@ var init_jsonStatements = __esm({
13630
13843
  columns: Object.values(columns),
13631
13844
  compositePKs: Object.values(compositePrimaryKeys),
13632
13845
  compositePkName,
13633
- uniqueConstraints: Object.values(uniqueConstraints)
13846
+ uniqueConstraints: Object.values(uniqueConstraints),
13847
+ policies: Object.values(policies)
13634
13848
  };
13635
13849
  };
13636
13850
  prepareMySqlCreateTableJson = (table4, json22, internals) => {
@@ -13668,7 +13882,8 @@ var init_jsonStatements = __esm({
13668
13882
  return {
13669
13883
  type: "drop_table",
13670
13884
  tableName: table4.name,
13671
- schema: table4.schema
13885
+ schema: table4.schema,
13886
+ policies: table4.policies ? Object.values(table4.policies) : []
13672
13887
  };
13673
13888
  };
13674
13889
  prepareRenameTableJson = (tableFrom, tableTo) => {
@@ -13699,27 +13914,6 @@ var init_jsonStatements = __esm({
13699
13914
  };
13700
13915
  });
13701
13916
  };
13702
- prepareDropEnumValues = (name2, schema4, removedValues, json22) => {
13703
- if (!removedValues.length) return [];
13704
- const affectedColumns = [];
13705
- for (const tableKey2 in json22.tables) {
13706
- const table4 = json22.tables[tableKey2];
13707
- for (const columnKey in table4.columns) {
13708
- const column4 = table4.columns[columnKey];
13709
- if (column4.type === name2 && column4.typeSchema === schema4) {
13710
- affectedColumns.push({ schema: table4.schema || "public", table: table4.name, column: column4.name });
13711
- }
13712
- }
13713
- }
13714
- return [{
13715
- type: "alter_type_drop_value",
13716
- name: name2,
13717
- schema: schema4,
13718
- deletedValues: removedValues,
13719
- newValues: json22.enums[`${schema4}.${name2}`].values,
13720
- columnsWithEnum: affectedColumns
13721
- }];
13722
- };
13723
13917
  prepareDropEnumJson = (name2, schema4) => {
13724
13918
  return {
13725
13919
  type: "drop_type_enum",
@@ -13786,6 +13980,41 @@ var init_jsonStatements = __esm({
13786
13980
  schema: schema4
13787
13981
  };
13788
13982
  };
13983
+ prepareCreateRoleJson = (role) => {
13984
+ return {
13985
+ type: "create_role",
13986
+ name: role.name,
13987
+ values: {
13988
+ createDb: role.createDb,
13989
+ createRole: role.createRole,
13990
+ inherit: role.inherit
13991
+ }
13992
+ };
13993
+ };
13994
+ prepareAlterRoleJson = (role) => {
13995
+ return {
13996
+ type: "alter_role",
13997
+ name: role.name,
13998
+ values: {
13999
+ createDb: role.createDb,
14000
+ createRole: role.createRole,
14001
+ inherit: role.inherit
14002
+ }
14003
+ };
14004
+ };
14005
+ prepareDropRoleJson = (name2) => {
14006
+ return {
14007
+ type: "drop_role",
14008
+ name: name2
14009
+ };
14010
+ };
14011
+ prepareRenameRoleJson = (nameFrom, nameTo) => {
14012
+ return {
14013
+ type: "rename_role",
14014
+ nameFrom,
14015
+ nameTo
14016
+ };
14017
+ };
13789
14018
  prepareCreateSchemasJson = (values) => {
13790
14019
  return values.map((it) => {
13791
14020
  return {
@@ -14682,6 +14911,46 @@ var init_jsonStatements = __esm({
14682
14911
  }
14683
14912
  return [...dropPkStatements, ...setPkStatements, ...statements];
14684
14913
  };
14914
+ prepareRenamePolicyJsons = (tableName, schema4, renames) => {
14915
+ return renames.map((it) => {
14916
+ return {
14917
+ type: "rename_policy",
14918
+ tableName,
14919
+ oldName: it.from.name,
14920
+ newName: it.to.name,
14921
+ schema: schema4
14922
+ };
14923
+ });
14924
+ };
14925
+ prepareCreatePolicyJsons = (tableName, schema4, policies) => {
14926
+ return policies.map((it) => {
14927
+ return {
14928
+ type: "create_policy",
14929
+ tableName,
14930
+ data: it,
14931
+ schema: schema4
14932
+ };
14933
+ });
14934
+ };
14935
+ prepareDropPolicyJsons = (tableName, schema4, policies) => {
14936
+ return policies.map((it) => {
14937
+ return {
14938
+ type: "drop_policy",
14939
+ tableName,
14940
+ data: it,
14941
+ schema: schema4
14942
+ };
14943
+ });
14944
+ };
14945
+ prepareAlterPolicyJson = (tableName, schema4, oldPolicy, newPolicy) => {
14946
+ return {
14947
+ type: "alter_policy",
14948
+ tableName,
14949
+ oldData: oldPolicy,
14950
+ newData: newPolicy,
14951
+ schema: schema4
14952
+ };
14953
+ };
14685
14954
  preparePgCreateIndexesJson = (tableName, schema4, indexes, fullSchema, action) => {
14686
14955
  if (action === "push") {
14687
14956
  return Object.values(indexes).map((indexData) => {
@@ -15387,7 +15656,8 @@ var init_snapshotsDiffer = __esm({
15387
15656
  indexes: recordType(stringType(), stringType()),
15388
15657
  foreignKeys: recordType(stringType(), stringType()),
15389
15658
  compositePrimaryKeys: recordType(stringType(), stringType()).default({}),
15390
- uniqueConstraints: recordType(stringType(), stringType()).default({})
15659
+ uniqueConstraints: recordType(stringType(), stringType()).default({}),
15660
+ policies: recordType(stringType(), stringType()).default({})
15391
15661
  }).strict();
15392
15662
  alteredTableScheme = objectType({
15393
15663
  name: stringType(),
@@ -15428,12 +15698,22 @@ var init_snapshotsDiffer = __esm({
15428
15698
  __new: stringType(),
15429
15699
  __old: stringType()
15430
15700
  })
15701
+ ),
15702
+ addedPolicies: recordType(stringType(), stringType()),
15703
+ deletedPolicies: recordType(stringType(), stringType()),
15704
+ alteredPolicies: recordType(
15705
+ stringType(),
15706
+ objectType({
15707
+ __new: stringType(),
15708
+ __old: stringType()
15709
+ })
15431
15710
  )
15432
15711
  }).strict();
15433
15712
  diffResultScheme = objectType({
15434
15713
  alteredTablesWithColumns: alteredTableScheme.array(),
15435
15714
  alteredEnums: changedEnumSchema.array(),
15436
- alteredSequences: sequenceSquashed.array()
15715
+ alteredSequences: sequenceSquashed.array(),
15716
+ alteredRoles: roleSchema.array()
15437
15717
  }).strict();
15438
15718
  diffResultSchemeMysql = objectType({
15439
15719
  alteredTablesWithColumns: alteredTableScheme.array(),
@@ -15488,7 +15768,7 @@ var init_snapshotsDiffer = __esm({
15488
15768
  }
15489
15769
  return column4;
15490
15770
  };
15491
- applyPgSnapshotsDiff = async (json1, json22, schemasResolver2, enumsResolver2, sequencesResolver2, tablesResolver2, columnsResolver2, prevFull, curFull, action) => {
15771
+ applyPgSnapshotsDiff = async (json1, json22, schemasResolver2, enumsResolver2, sequencesResolver2, policyResolver2, roleResolver2, tablesResolver2, columnsResolver2, prevFull, curFull, action) => {
15492
15772
  const schemasDiff = diffSchemasOrTables(json1.schemas, json22.schemas);
15493
15773
  const {
15494
15774
  created: createdSchemas,
@@ -15638,6 +15918,47 @@ var init_snapshotsDiffer = __esm({
15638
15918
  return [tableKey2, tableValue];
15639
15919
  }
15640
15920
  );
15921
+ const rolesDiff = diffSchemasOrTables(
15922
+ schemasPatchedSnap1.roles,
15923
+ json22.roles
15924
+ );
15925
+ const {
15926
+ created: createdRoles,
15927
+ deleted: deletedRoles,
15928
+ renamed: renamedRoles
15929
+ } = await roleResolver2({
15930
+ created: rolesDiff.added,
15931
+ deleted: rolesDiff.deleted
15932
+ });
15933
+ schemasPatchedSnap1.roles = mapEntries(
15934
+ schemasPatchedSnap1.roles,
15935
+ (_2, it) => {
15936
+ const { name: name2 } = nameChangeFor(it, renamedRoles);
15937
+ it.name = name2;
15938
+ return [name2, it];
15939
+ }
15940
+ );
15941
+ const rolesChangeMap = renamedRoles.reduce(
15942
+ (acc, it) => {
15943
+ acc[it.from.name] = {
15944
+ nameFrom: it.from.name,
15945
+ nameTo: it.to.name
15946
+ };
15947
+ return acc;
15948
+ },
15949
+ {}
15950
+ );
15951
+ schemasPatchedSnap1.roles = mapEntries(
15952
+ schemasPatchedSnap1.roles,
15953
+ (roleKey, roleValue) => {
15954
+ const key = roleKey;
15955
+ const change = rolesChangeMap[key];
15956
+ if (change) {
15957
+ roleValue.name = change.nameTo;
15958
+ }
15959
+ return [roleKey, roleValue];
15960
+ }
15961
+ );
15641
15962
  const tablesDiff = diffSchemasOrTables(
15642
15963
  schemasPatchedSnap1.tables,
15643
15964
  json22.tables
@@ -15716,6 +16037,65 @@ var init_snapshotsDiffer = __esm({
15716
16037
  return [tableKey2, tableValue];
15717
16038
  }
15718
16039
  );
16040
+ const policyRes = diffPolicies(tablesPatchedSnap1.tables, json22.tables);
16041
+ const policyRenames = [];
16042
+ const policyCreates = [];
16043
+ const policyDeletes = [];
16044
+ for (let entry of Object.values(policyRes)) {
16045
+ const { renamed, created, deleted } = await policyResolver2({
16046
+ tableName: entry.name,
16047
+ schema: entry.schema,
16048
+ deleted: entry.policies.deleted.map(PgSquasher.unsquashPolicy),
16049
+ created: entry.policies.added.map(PgSquasher.unsquashPolicy)
16050
+ });
16051
+ if (created.length > 0) {
16052
+ policyCreates.push({
16053
+ table: entry.name,
16054
+ schema: entry.schema,
16055
+ columns: created
16056
+ });
16057
+ }
16058
+ if (deleted.length > 0) {
16059
+ policyDeletes.push({
16060
+ table: entry.name,
16061
+ schema: entry.schema,
16062
+ columns: deleted
16063
+ });
16064
+ }
16065
+ if (renamed.length > 0) {
16066
+ policyRenames.push({
16067
+ table: entry.name,
16068
+ schema: entry.schema,
16069
+ renames: renamed
16070
+ });
16071
+ }
16072
+ }
16073
+ const policyRenamesDict = columnRenames.reduce(
16074
+ (acc, it) => {
16075
+ acc[`${it.schema || "public"}.${it.table}`] = it.renames;
16076
+ return acc;
16077
+ },
16078
+ {}
16079
+ );
16080
+ const policyPatchedSnap1 = copy(tablesPatchedSnap1);
16081
+ policyPatchedSnap1.tables = mapEntries(
16082
+ policyPatchedSnap1.tables,
16083
+ (tableKey2, tableValue) => {
16084
+ const patchedPolicies = mapKeys(
16085
+ tableValue.policies,
16086
+ (policyKey, policy2) => {
16087
+ const rens = policyRenamesDict[`${tableValue.schema || "public"}.${tableValue.name}`] || [];
16088
+ const newName = columnChangeFor(policyKey, rens);
16089
+ const unsquashedPolicy = PgSquasher.unsquashPolicy(policy2);
16090
+ unsquashedPolicy.name = newName;
16091
+ policy2 = PgSquasher.squashPolicy(unsquashedPolicy);
16092
+ return newName;
16093
+ }
16094
+ );
16095
+ tableValue.policies = patchedPolicies;
16096
+ return [tableKey2, tableValue];
16097
+ }
16098
+ );
15719
16099
  const diffResult = applyJsonDiff(columnsPatchedSnap1, json22);
15720
16100
  const typedResult = diffResultScheme.parse(diffResult);
15721
16101
  const jsonStatements = [];
@@ -15760,13 +16140,15 @@ var init_snapshotsDiffer = __esm({
15760
16140
  const jsonDeletedUniqueConstraints = [];
15761
16141
  const jsonAlteredUniqueConstraints = [];
15762
16142
  const jsonSetTableSchemas = [];
15763
- for (let it of movedTables) {
15764
- jsonSetTableSchemas.push({
15765
- type: "alter_table_set_schema",
15766
- tableName: it.name,
15767
- schemaFrom: it.schemaFrom || "public",
15768
- schemaTo: it.schemaTo || "public"
15769
- });
16143
+ if (movedTables) {
16144
+ for (let it of movedTables) {
16145
+ jsonSetTableSchemas.push({
16146
+ type: "alter_table_set_schema",
16147
+ tableName: it.name,
16148
+ schemaFrom: it.schemaFrom || "public",
16149
+ schemaTo: it.schemaTo || "public"
16150
+ });
16151
+ }
15770
16152
  }
15771
16153
  for (let it of alteredTables) {
15772
16154
  let addedColumns = [];
@@ -15871,7 +16253,99 @@ var init_snapshotsDiffer = __esm({
15871
16253
  it.deletedIndexes || {}
15872
16254
  );
15873
16255
  }).flat();
16256
+ const jsonCreatePoliciesStatements = [];
16257
+ const jsonDropPoliciesStatements = [];
16258
+ const jsonAlterPoliciesStatements = [];
16259
+ const jsonRenamePoliciesStatements = [];
16260
+ const jsonEnableRLSStatements = [];
16261
+ const jsonDisableRLSStatements = [];
16262
+ for (let it of policyRenames) {
16263
+ jsonRenamePoliciesStatements.push(
16264
+ ...prepareRenamePolicyJsons(it.table, it.schema, it.renames)
16265
+ );
16266
+ }
16267
+ for (const it of policyCreates) {
16268
+ jsonCreatePoliciesStatements.push(
16269
+ ...prepareCreatePolicyJsons(
16270
+ it.table,
16271
+ it.schema,
16272
+ it.columns
16273
+ )
16274
+ );
16275
+ }
16276
+ for (const it of policyDeletes) {
16277
+ jsonDropPoliciesStatements.push(
16278
+ ...prepareDropPolicyJsons(
16279
+ it.table,
16280
+ it.schema,
16281
+ it.columns
16282
+ )
16283
+ );
16284
+ }
15874
16285
  alteredTables.forEach((it) => {
16286
+ Object.keys(it.alteredPolicies).forEach((policyName) => {
16287
+ const newPolicy = PgSquasher.unsquashPolicy(it.alteredPolicies[policyName].__new);
16288
+ const oldPolicy = PgSquasher.unsquashPolicy(it.alteredPolicies[policyName].__old);
16289
+ if (newPolicy.as !== oldPolicy.as) {
16290
+ jsonDropPoliciesStatements.push(
16291
+ ...prepareDropPolicyJsons(
16292
+ it.name,
16293
+ it.schema,
16294
+ [oldPolicy]
16295
+ )
16296
+ );
16297
+ jsonCreatePoliciesStatements.push(
16298
+ ...prepareCreatePolicyJsons(
16299
+ it.name,
16300
+ it.schema,
16301
+ [newPolicy]
16302
+ )
16303
+ );
16304
+ return;
16305
+ }
16306
+ if (newPolicy.for !== oldPolicy.for) {
16307
+ jsonDropPoliciesStatements.push(
16308
+ ...prepareDropPolicyJsons(
16309
+ it.name,
16310
+ it.schema,
16311
+ [oldPolicy]
16312
+ )
16313
+ );
16314
+ jsonCreatePoliciesStatements.push(
16315
+ ...prepareCreatePolicyJsons(
16316
+ it.name,
16317
+ it.schema,
16318
+ [newPolicy]
16319
+ )
16320
+ );
16321
+ return;
16322
+ }
16323
+ jsonAlterPoliciesStatements.push(
16324
+ prepareAlterPolicyJson(
16325
+ it.name,
16326
+ it.schema,
16327
+ it.alteredPolicies[policyName].__old,
16328
+ it.alteredPolicies[policyName].__new
16329
+ )
16330
+ );
16331
+ });
16332
+ for (const table4 of Object.values(json22.tables)) {
16333
+ const policiesInCurrentState = Object.keys(table4.policies);
16334
+ const tableInPreviousState = columnsPatchedSnap1.tables[`${table4.schema === "" ? "public" : table4.schema}.${table4.name}`];
16335
+ const policiesInPreviousState = tableInPreviousState ? Object.keys(tableInPreviousState.policies) : [];
16336
+ if (policiesInPreviousState.length === 0 && policiesInCurrentState.length > 0) {
16337
+ jsonEnableRLSStatements.push({ type: "enable_rls", tableName: table4.name, schema: table4.schema });
16338
+ }
16339
+ if (policiesInPreviousState.length > 0 && policiesInCurrentState.length === 0) {
16340
+ jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
16341
+ }
16342
+ }
16343
+ for (const table4 of Object.values(columnsPatchedSnap1.tables)) {
16344
+ const tableInCurrentState = json22.tables[`${table4.schema === "" ? "public" : table4.schema}.${table4.name}`];
16345
+ if (tableInCurrentState === void 0) {
16346
+ jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
16347
+ }
16348
+ }
15875
16349
  const droppedIndexes = Object.keys(it.alteredIndexes).reduce(
15876
16350
  (current, item) => {
15877
16351
  current[item] = it.alteredIndexes[item].__old;
@@ -15941,9 +16415,6 @@ var init_snapshotsDiffer = __esm({
15941
16415
  const jsonAlterEnumsWithAddedValues = typedResult.alteredEnums.map((it) => {
15942
16416
  return prepareAddValuesToEnumJson(it.name, it.schema, it.addedValues);
15943
16417
  }).flat() ?? [];
15944
- const jsonAlterEnumsWithDroppedValues = typedResult.alteredEnums.map((it) => {
15945
- return prepareDropEnumValues(it.name, it.schema, it.deletedValues, curFull);
15946
- }).flat() ?? [];
15947
16418
  const createSequences = createdSequences.map((it) => {
15948
16419
  return prepareCreateSequenceJson(it);
15949
16420
  }) ?? [];
@@ -15959,6 +16430,18 @@ var init_snapshotsDiffer = __esm({
15959
16430
  const jsonAlterSequences = typedResult.alteredSequences.map((it) => {
15960
16431
  return prepareAlterSequenceJson(it);
15961
16432
  }).flat() ?? [];
16433
+ const createRoles = createdRoles.map((it) => {
16434
+ return prepareCreateRoleJson(it);
16435
+ }) ?? [];
16436
+ const dropRoles = deletedRoles.map((it) => {
16437
+ return prepareDropRoleJson(it.name);
16438
+ });
16439
+ const renameRoles = renamedRoles.map((it) => {
16440
+ return prepareRenameRoleJson(it.from.name, it.to.name);
16441
+ });
16442
+ const jsonAlterRoles = typedResult.alteredRoles.map((it) => {
16443
+ return prepareAlterRoleJson(it);
16444
+ }).flat() ?? [];
15962
16445
  const createSchemas = prepareCreateSchemasJson(
15963
16446
  createdSchemas.map((it) => it.name)
15964
16447
  );
@@ -15971,6 +16454,11 @@ var init_snapshotsDiffer = __esm({
15971
16454
  const createTables = createdTables.map((it) => {
15972
16455
  return preparePgCreateTableJson(it, curFull);
15973
16456
  });
16457
+ jsonCreatePoliciesStatements.push(...[].concat(
16458
+ ...createdTables.map(
16459
+ (it) => prepareCreatePolicyJsons(it.name, it.schema, Object.values(it.policies).map(PgSquasher.unsquashPolicy))
16460
+ )
16461
+ ));
15974
16462
  jsonStatements.push(...createSchemas);
15975
16463
  jsonStatements.push(...renameSchemas);
15976
16464
  jsonStatements.push(...createEnums);
@@ -15981,7 +16469,13 @@ var init_snapshotsDiffer = __esm({
15981
16469
  jsonStatements.push(...moveSequences);
15982
16470
  jsonStatements.push(...renameSequences);
15983
16471
  jsonStatements.push(...jsonAlterSequences);
16472
+ jsonStatements.push(...renameRoles);
16473
+ jsonStatements.push(...dropRoles);
16474
+ jsonStatements.push(...createRoles);
16475
+ jsonStatements.push(...jsonAlterRoles);
15984
16476
  jsonStatements.push(...createTables);
16477
+ jsonStatements.push(...jsonEnableRLSStatements);
16478
+ jsonStatements.push(...jsonDisableRLSStatements);
15985
16479
  jsonStatements.push(...jsonDropTables);
15986
16480
  jsonStatements.push(...jsonSetTableSchemas);
15987
16481
  jsonStatements.push(...jsonRenameTables);
@@ -16001,7 +16495,10 @@ var init_snapshotsDiffer = __esm({
16001
16495
  jsonStatements.push(...jsonAlteredCompositePKs);
16002
16496
  jsonStatements.push(...jsonAddedUniqueConstraints);
16003
16497
  jsonStatements.push(...jsonAlteredUniqueConstraints);
16004
- jsonStatements.push(...jsonAlterEnumsWithDroppedValues);
16498
+ jsonStatements.push(...jsonRenamePoliciesStatements);
16499
+ jsonStatements.push(...jsonDropPoliciesStatements);
16500
+ jsonStatements.push(...jsonCreatePoliciesStatements);
16501
+ jsonStatements.push(...jsonAlterPoliciesStatements);
16005
16502
  jsonStatements.push(...dropEnums);
16006
16503
  jsonStatements.push(...dropSequences);
16007
16504
  jsonStatements.push(...dropSchemas);
@@ -17073,7 +17570,7 @@ var init_outputs = __esm({
17073
17570
  });
17074
17571
 
17075
17572
  // src/cli/commands/migrate.ts
17076
- var import_hanji2, schemasResolver, tablesResolver, sequencesResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT;
17573
+ var import_hanji2, schemasResolver, tablesResolver, sequencesResolver, roleResolver, policyResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedConflict, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT;
17077
17574
  var init_migrate = __esm({
17078
17575
  "src/cli/commands/migrate.ts"() {
17079
17576
  "use strict";
@@ -17136,6 +17633,32 @@ var init_migrate = __esm({
17136
17633
  throw e;
17137
17634
  }
17138
17635
  };
17636
+ roleResolver = async (input) => {
17637
+ const result = await promptNamedConflict(
17638
+ input.created,
17639
+ input.deleted,
17640
+ "role"
17641
+ );
17642
+ return {
17643
+ created: result.created,
17644
+ deleted: result.deleted,
17645
+ renamed: result.renamed
17646
+ };
17647
+ };
17648
+ policyResolver = async (input) => {
17649
+ const result = await promptColumnsConflicts(
17650
+ input.tableName,
17651
+ input.created,
17652
+ input.deleted
17653
+ );
17654
+ return {
17655
+ tableName: input.tableName,
17656
+ schema: input.schema,
17657
+ created: result.created,
17658
+ deleted: result.deleted,
17659
+ renamed: result.renamed
17660
+ };
17661
+ };
17139
17662
  enumsResolver = async (input) => {
17140
17663
  try {
17141
17664
  const { created, deleted, moved, renamed } = await promptNamedWithSchemasConflict(
@@ -17218,6 +17741,56 @@ var init_migrate = __esm({
17218
17741
  result.deleted.push(...leftMissing);
17219
17742
  return result;
17220
17743
  };
17744
+ promptNamedConflict = async (newItems, missingItems, entity) => {
17745
+ if (missingItems.length === 0 || newItems.length === 0) {
17746
+ return {
17747
+ created: newItems,
17748
+ renamed: [],
17749
+ deleted: missingItems
17750
+ };
17751
+ }
17752
+ const result = { created: [], renamed: [], deleted: [] };
17753
+ let index4 = 0;
17754
+ let leftMissing = [...missingItems];
17755
+ do {
17756
+ const created = newItems[index4];
17757
+ const renames = leftMissing.map((it) => {
17758
+ return { from: it, to: created };
17759
+ });
17760
+ const promptData = [created, ...renames];
17761
+ const { status, data } = await (0, import_hanji2.render)(
17762
+ new ResolveSelectNamed(created, promptData, entity)
17763
+ );
17764
+ if (status === "aborted") {
17765
+ console.error("ERROR");
17766
+ process.exit(1);
17767
+ }
17768
+ if (isRenamePromptItem(data)) {
17769
+ console.log(
17770
+ `${source_default.yellow("~")} ${data.from.name} \u203A ${data.to.name} ${source_default.gray(
17771
+ `${entity} will be renamed/moved`
17772
+ )}`
17773
+ );
17774
+ if (data.from.name !== data.to.name) {
17775
+ result.renamed.push(data);
17776
+ }
17777
+ delete leftMissing[leftMissing.indexOf(data.from)];
17778
+ leftMissing = leftMissing.filter(Boolean);
17779
+ } else {
17780
+ console.log(
17781
+ `${source_default.green("+")} ${data.name} ${source_default.gray(
17782
+ `${entity} will be created`
17783
+ )}`
17784
+ );
17785
+ result.created.push(created);
17786
+ }
17787
+ index4 += 1;
17788
+ } while (index4 < newItems.length);
17789
+ console.log(source_default.gray(`--- all ${entity} conflicts resolved ---
17790
+ `));
17791
+ result.deleted.push(...leftMissing);
17792
+ return result;
17793
+ };
17221
17794
  promptNamedWithSchemasConflict = async (newItems, missingItems, entity) => {
17222
17795
  if (missingItems.length === 0 || newItems.length === 0) {
17223
17796
  return {
@@ -18774,8 +19347,8 @@ function parsePgArray(arrayString) {
18774
19347
  const [result] = parsePgNestedArray(arrayString, 1);
18775
19348
  return result;
18776
19349
  }
18777
- function makePgArray(array) {
18778
- return `{${array.map((item) => {
19350
+ function makePgArray(array2) {
19351
+ return `{${array2.map((item) => {
18779
19352
  if (Array.isArray(item)) {
18780
19353
  return makePgArray(item);
18781
19354
  }
@@ -19483,8 +20056,8 @@ var init_sql = __esm({
19483
20056
  sql2.param = param2;
19484
20057
  })(sql || (sql = {}));
19485
20058
  ((SQL2) => {
19486
- var _a324;
19487
- _a324 = entityKind;
20059
+ var _a326;
20060
+ _a326 = entityKind;
19488
20061
  const _Aliased = class _Aliased {
19489
20062
  constructor(sql2, fieldAlias) {
19490
20063
  /** @internal */
@@ -19500,7 +20073,7 @@ var init_sql = __esm({
19500
20073
  return new _Aliased(this.sql, this.fieldAlias);
19501
20074
  }
19502
20075
  };
19503
- __publicField(_Aliased, _a324, "SQL.Aliased");
20076
+ __publicField(_Aliased, _a326, "SQL.Aliased");
19504
20077
  let Aliased = _Aliased;
19505
20078
  SQL2.Aliased = Aliased;
19506
20079
  })(SQL || (SQL = {}));
@@ -19783,8 +20356,8 @@ function arrayContains(column4, values) {
19783
20356
  if (values.length === 0) {
19784
20357
  throw new Error("arrayContains requires at least one value");
19785
20358
  }
19786
- const array = sql`${bindIfParam(values, column4)}`;
19787
- return sql`${column4} @> ${array}`;
20359
+ const array2 = sql`${bindIfParam(values, column4)}`;
20360
+ return sql`${column4} @> ${array2}`;
19788
20361
  }
19789
20362
  return sql`${column4} @> ${bindIfParam(values, column4)}`;
19790
20363
  }
@@ -19793,8 +20366,8 @@ function arrayContained(column4, values) {
19793
20366
  if (values.length === 0) {
19794
20367
  throw new Error("arrayContained requires at least one value");
19795
20368
  }
19796
- const array = sql`${bindIfParam(values, column4)}`;
19797
- return sql`${column4} <@ ${array}`;
20369
+ const array2 = sql`${bindIfParam(values, column4)}`;
20370
+ return sql`${column4} <@ ${array2}`;
19798
20371
  }
19799
20372
  return sql`${column4} <@ ${bindIfParam(values, column4)}`;
19800
20373
  }
@@ -19803,8 +20376,8 @@ function arrayOverlaps(column4, values) {
19803
20376
  if (values.length === 0) {
19804
20377
  throw new Error("arrayOverlaps requires at least one value");
19805
20378
  }
19806
- const array = sql`${bindIfParam(values, column4)}`;
19807
- return sql`${column4} && ${array}`;
20379
+ const array2 = sql`${bindIfParam(values, column4)}`;
20380
+ return sql`${column4} && ${array2}`;
19808
20381
  }
19809
20382
  return sql`${column4} && ${bindIfParam(values, column4)}`;
19810
20383
  }
@@ -25470,6 +26043,67 @@ var init_indexes = __esm({
25470
26043
  }
25471
26044
  });
25472
26045
 
26046
+ // ../drizzle-orm/dist/pg-core/policies.js
26047
+ var _a147, PgPolicy;
26048
+ var init_policies = __esm({
26049
+ "../drizzle-orm/dist/pg-core/policies.js"() {
26050
+ "use strict";
26051
+ init_entity();
26052
+ _a147 = entityKind;
26053
+ PgPolicy = class {
26054
+ constructor(name2, config) {
26055
+ __publicField(this, "as");
26056
+ __publicField(this, "for");
26057
+ __publicField(this, "to");
26058
+ __publicField(this, "using");
26059
+ __publicField(this, "withCheck");
26060
+ this.name = name2;
26061
+ if (config) {
26062
+ this.as = config.as;
26063
+ this.for = config.for;
26064
+ this.to = config.to;
26065
+ this.using = config.using;
26066
+ this.withCheck = config.withCheck;
26067
+ }
26068
+ }
26069
+ };
26070
+ __publicField(PgPolicy, _a147, "PgPolicy");
26071
+ }
26072
+ });
26073
+
26074
+ // ../drizzle-orm/dist/pg-core/roles.js
26075
+ var _a148, PgRole;
26076
+ var init_roles = __esm({
26077
+ "../drizzle-orm/dist/pg-core/roles.js"() {
26078
+ "use strict";
26079
+ init_entity();
26080
+ _a148 = entityKind;
26081
+ PgRole = class {
26082
+ constructor(name2, config) {
26083
+ /** @internal */
26084
+ __publicField(this, "_existing");
26085
+ /** @internal */
26086
+ __publicField(this, "createDb");
26087
+ /** @internal */
26088
+ __publicField(this, "createRole");
26089
+ /** @internal */
26090
+ __publicField(this, "inherit");
26091
+ this.name = name2;
26092
+ if (config) {
26093
+ this.createDb = config.createDb;
26094
+ this.createRole = config.createRole;
26095
+ this.inherit = config.inherit;
26096
+ }
26097
+ }
26098
+ existing() {
26099
+ this._existing = true;
26100
+ return this;
26101
+ }
26102
+ };
26103
+ __publicField(PgRole, _a148, "PgRole");
26104
+ }
26105
+ });
26106
+
25473
26107
  // ../drizzle-orm/dist/pg-core/sequence.js
25474
26108
  function pgSequenceWithSchema(name2, options, schema4) {
25475
26109
  return new PgSequence(name2, options, schema4);
@@ -25477,12 +26111,12 @@ function pgSequenceWithSchema(name2, options, schema4) {
25477
26111
  function isPgSequence(obj) {
25478
26112
  return is(obj, PgSequence);
25479
26113
  }
25480
- var _a147, PgSequence;
26114
+ var _a149, PgSequence;
25481
26115
  var init_sequence = __esm({
25482
26116
  "../drizzle-orm/dist/pg-core/sequence.js"() {
25483
26117
  "use strict";
25484
26118
  init_entity();
25485
- _a147 = entityKind;
26119
+ _a149 = entityKind;
25486
26120
  PgSequence = class {
25487
26121
  constructor(seqName, seqOptions, schema4) {
25488
26122
  this.seqName = seqName;
@@ -25490,7 +26124,7 @@ var init_sequence = __esm({
25490
26124
  this.schema = schema4;
25491
26125
  }
25492
26126
  };
25493
- __publicField(PgSequence, _a147, "PgSequence");
26127
+ __publicField(PgSequence, _a149, "PgSequence");
25494
26128
  }
25495
26129
  });
25496
26130
 
@@ -25516,7 +26150,7 @@ function pgMaterializedViewWithSchema(name2, selection, schema4) {
25516
26150
  }
25517
26151
  return new MaterializedViewBuilder(name2, schema4);
25518
26152
  }
25519
- var _a148, DefaultViewBuilderCore, _a149, _b107, ViewBuilder, _a150, _b108, ManualViewBuilder, _a151, MaterializedViewBuilderCore, _a152, _b109, MaterializedViewBuilder, _a153, _b110, ManualMaterializedViewBuilder, _a154, _b111, _c4, PgView, PgMaterializedViewConfig, _a155, _b112, _c5, PgMaterializedView;
26153
+ var _a150, DefaultViewBuilderCore, _a151, _b107, ViewBuilder, _a152, _b108, ManualViewBuilder, _a153, MaterializedViewBuilderCore, _a154, _b109, MaterializedViewBuilder, _a155, _b110, ManualMaterializedViewBuilder, _a156, _b111, _c4, PgView, PgMaterializedViewConfig, _a157, _b112, _c5, PgMaterializedView;
25520
26154
  var init_view = __esm({
25521
26155
  "../drizzle-orm/dist/pg-core/view.js"() {
25522
26156
  "use strict";
@@ -25527,7 +26161,7 @@ var init_view = __esm({
25527
26161
  init_table2();
25528
26162
  init_view_base();
25529
26163
  init_view_common2();
25530
- _a148 = entityKind;
26164
+ _a150 = entityKind;
25531
26165
  DefaultViewBuilderCore = class {
25532
26166
  constructor(name2, schema4) {
25533
26167
  __publicField(this, "config", {});
@@ -25539,8 +26173,8 @@ var init_view = __esm({
25539
26173
  return this;
25540
26174
  }
25541
26175
  };
25542
- __publicField(DefaultViewBuilderCore, _a148, "PgDefaultViewBuilderCore");
25543
- ViewBuilder = class extends (_b107 = DefaultViewBuilderCore, _a149 = entityKind, _b107) {
26176
+ __publicField(DefaultViewBuilderCore, _a150, "PgDefaultViewBuilderCore");
26177
+ ViewBuilder = class extends (_b107 = DefaultViewBuilderCore, _a151 = entityKind, _b107) {
25544
26178
  as(qb) {
25545
26179
  if (typeof qb === "function") {
25546
26180
  qb = qb(new QueryBuilder());
@@ -25566,8 +26200,8 @@ var init_view = __esm({
25566
26200
  );
25567
26201
  }
25568
26202
  };
25569
- __publicField(ViewBuilder, _a149, "PgViewBuilder");
25570
- ManualViewBuilder = class extends (_b108 = DefaultViewBuilderCore, _a150 = entityKind, _b108) {
26203
+ __publicField(ViewBuilder, _a151, "PgViewBuilder");
26204
+ ManualViewBuilder = class extends (_b108 = DefaultViewBuilderCore, _a152 = entityKind, _b108) {
25571
26205
  constructor(name2, columns, schema4) {
25572
26206
  super(name2, schema4);
25573
26207
  __publicField(this, "columns");
@@ -25612,8 +26246,8 @@ var init_view = __esm({
25612
26246
  );
25613
26247
  }
25614
26248
  };
25615
- __publicField(ManualViewBuilder, _a150, "PgManualViewBuilder");
25616
- _a151 = entityKind;
26249
+ __publicField(ManualViewBuilder, _a152, "PgManualViewBuilder");
26250
+ _a153 = entityKind;
25617
26251
  MaterializedViewBuilderCore = class {
25618
26252
  constructor(name2, schema4) {
25619
26253
  __publicField(this, "config", {});
@@ -25637,8 +26271,8 @@ var init_view = __esm({
25637
26271
  return this;
25638
26272
  }
25639
26273
  };
25640
- __publicField(MaterializedViewBuilderCore, _a151, "PgMaterializedViewBuilderCore");
25641
- MaterializedViewBuilder = class extends (_b109 = MaterializedViewBuilderCore, _a152 = entityKind, _b109) {
26274
+ __publicField(MaterializedViewBuilderCore, _a153, "PgMaterializedViewBuilderCore");
26275
+ MaterializedViewBuilder = class extends (_b109 = MaterializedViewBuilderCore, _a154 = entityKind, _b109) {
25642
26276
  as(qb) {
25643
26277
  if (typeof qb === "function") {
25644
26278
  qb = qb(new QueryBuilder());
@@ -25669,8 +26303,8 @@ var init_view = __esm({
25669
26303
  );
25670
26304
  }
25671
26305
  };
25672
- __publicField(MaterializedViewBuilder, _a152, "PgMaterializedViewBuilder");
25673
- ManualMaterializedViewBuilder = class extends (_b110 = MaterializedViewBuilderCore, _a153 = entityKind, _b110) {
26306
+ __publicField(MaterializedViewBuilder, _a154, "PgMaterializedViewBuilder");
26307
+ ManualMaterializedViewBuilder = class extends (_b110 = MaterializedViewBuilderCore, _a155 = entityKind, _b110) {
25674
26308
  constructor(name2, columns, schema4) {
25675
26309
  super(name2, schema4);
25676
26310
  __publicField(this, "columns");
@@ -25715,11 +26349,11 @@ var init_view = __esm({
25715
26349
  );
25716
26350
  }
25717
26351
  };
25718
- __publicField(ManualMaterializedViewBuilder, _a153, "PgManualMaterializedViewBuilder");
25719
- PgView = class extends (_c4 = PgViewBase, _b111 = entityKind, _a154 = PgViewConfig, _c4) {
26352
+ __publicField(ManualMaterializedViewBuilder, _a155, "PgManualMaterializedViewBuilder");
26353
+ PgView = class extends (_c4 = PgViewBase, _b111 = entityKind, _a156 = PgViewConfig, _c4) {
25720
26354
  constructor({ pgConfig, config }) {
25721
26355
  super(config);
25722
- __publicField(this, _a154);
26356
+ __publicField(this, _a156);
25723
26357
  if (pgConfig) {
25724
26358
  this[PgViewConfig] = {
25725
26359
  with: pgConfig.with
@@ -25729,10 +26363,10 @@ var init_view = __esm({
25729
26363
  };
25730
26364
  __publicField(PgView, _b111, "PgView");
25731
26365
  PgMaterializedViewConfig = Symbol.for("drizzle:PgMaterializedViewConfig");
25732
- PgMaterializedView = class extends (_c5 = PgViewBase, _b112 = entityKind, _a155 = PgMaterializedViewConfig, _c5) {
26366
+ PgMaterializedView = class extends (_c5 = PgViewBase, _b112 = entityKind, _a157 = PgMaterializedViewConfig, _c5) {
25733
26367
  constructor({ pgConfig, config }) {
25734
26368
  super(config);
25735
- __publicField(this, _a155);
26369
+ __publicField(this, _a157);
25736
26370
  this[PgMaterializedViewConfig] = {
25737
26371
  with: pgConfig?.with,
25738
26372
  using: pgConfig?.using,
@@ -25746,7 +26380,7 @@ var init_view = __esm({
25746
26380
  });
25747
26381
 
25748
26382
  // ../drizzle-orm/dist/pg-core/schema.js
25749
- var _a156, PgSchema5;
26383
+ var _a158, PgSchema5;
25750
26384
  var init_schema = __esm({
25751
26385
  "../drizzle-orm/dist/pg-core/schema.js"() {
25752
26386
  "use strict";
@@ -25756,7 +26390,7 @@ var init_schema = __esm({
25756
26390
  init_sequence();
25757
26391
  init_table2();
25758
26392
  init_view();
25759
- _a156 = entityKind;
26393
+ _a158 = entityKind;
25760
26394
  PgSchema5 = class {
25761
26395
  constructor(schemaName) {
25762
26396
  __publicField(this, "table", (name2, columns, extraConfig) => {
@@ -25783,12 +26417,12 @@ var init_schema = __esm({
25783
26417
  return true;
25784
26418
  }
25785
26419
  };
25786
- __publicField(PgSchema5, _a156, "PgSchema");
26420
+ __publicField(PgSchema5, _a158, "PgSchema");
25787
26421
  }
25788
26422
  });
25789
26423
 
25790
26424
  // ../drizzle-orm/dist/pg-core/session.js
25791
- var _a157, PgPreparedQuery, _a158, PgSession, _a159, _b113, PgTransaction;
26425
+ var _a159, PgPreparedQuery, _a160, PgSession, _a161, _b113, PgTransaction;
25792
26426
  var init_session = __esm({
25793
26427
  "../drizzle-orm/dist/pg-core/session.js"() {
25794
26428
  "use strict";
@@ -25797,7 +26431,7 @@ var init_session = __esm({
25797
26431
  init_sql2();
25798
26432
  init_tracing();
25799
26433
  init_db();
25800
- _a157 = entityKind;
26434
+ _a159 = entityKind;
25801
26435
  PgPreparedQuery = class {
25802
26436
  constructor(query) {
25803
26437
  /** @internal */
@@ -25811,8 +26445,8 @@ var init_session = __esm({
25811
26445
  return response;
25812
26446
  }
25813
26447
  };
25814
- __publicField(PgPreparedQuery, _a157, "PgPreparedQuery");
25815
- _a158 = entityKind;
26448
+ __publicField(PgPreparedQuery, _a159, "PgPreparedQuery");
26449
+ _a160 = entityKind;
25816
26450
  PgSession = class {
25817
26451
  constructor(dialect4) {
25818
26452
  this.dialect = dialect4;
@@ -25845,8 +26479,8 @@ var init_session = __esm({
25845
26479
  );
25846
26480
  }
25847
26481
  };
25848
- __publicField(PgSession, _a158, "PgSession");
25849
- PgTransaction = class extends (_b113 = PgDatabase, _a159 = entityKind, _b113) {
26482
+ __publicField(PgSession, _a160, "PgSession");
26483
+ PgTransaction = class extends (_b113 = PgDatabase, _a161 = entityKind, _b113) {
25850
26484
  constructor(dialect4, session, schema4, nestedIndex = 0) {
25851
26485
  super(dialect4, session, schema4);
25852
26486
  this.schema = schema4;
@@ -25873,7 +26507,7 @@ var init_session = __esm({
25873
26507
  return this.session.execute(sql`set transaction ${this.getTransactionConfigSQL(config)}`);
25874
26508
  }
25875
26509
  };
25876
- __publicField(PgTransaction, _a159, "PgTransaction");
26510
+ __publicField(PgTransaction, _a161, "PgTransaction");
25877
26511
  }
25878
26512
  });
25879
26513
 
@@ -25894,10 +26528,12 @@ function getTableConfig(table4) {
25894
26528
  const uniqueConstraints = [];
25895
26529
  const name2 = table4[Table.Symbol.Name];
25896
26530
  const schema4 = table4[Table.Symbol.Schema];
26531
+ const policies = [];
25897
26532
  const extraConfigBuilder = table4[PgTable.Symbol.ExtraConfigBuilder];
25898
26533
  if (extraConfigBuilder !== void 0) {
25899
26534
  const extraConfig = extraConfigBuilder(table4[Table.Symbol.ExtraConfigColumns]);
25900
- for (const builder of Object.values(extraConfig)) {
26535
+ const extraValues = Array.isArray(extraConfig) ? extraConfig : Object.values(extraConfig);
26536
+ for (const builder of extraValues) {
25901
26537
  if (is(builder, IndexBuilder)) {
25902
26538
  indexes.push(builder.build(table4));
25903
26539
  } else if (is(builder, CheckBuilder)) {
@@ -25908,6 +26544,8 @@ function getTableConfig(table4) {
25908
26544
  primaryKeys.push(builder.build(table4));
25909
26545
  } else if (is(builder, ForeignKeyBuilder)) {
25910
26546
  foreignKeys.push(builder.build(table4));
26547
+ } else if (is(builder, PgPolicy)) {
26548
+ policies.push(builder);
25911
26549
  }
25912
26550
  }
25913
26551
  }
@@ -25919,7 +26557,8 @@ function getTableConfig(table4) {
25919
26557
  primaryKeys,
25920
26558
  uniqueConstraints,
25921
26559
  name: name2,
25922
- schema: schema4
26560
+ schema: schema4,
26561
+ policies
25923
26562
  };
25924
26563
  }
25925
26564
  var init_utils4 = __esm({
@@ -25931,6 +26570,7 @@ var init_utils4 = __esm({
25931
26570
  init_checks();
25932
26571
  init_foreign_keys();
25933
26572
  init_indexes();
26573
+ init_policies();
25934
26574
  init_primary_keys();
25935
26575
  init_unique_constraint();
25936
26576
  }
@@ -25955,8 +26595,10 @@ var init_pg_core = __esm({
25955
26595
  init_dialect();
25956
26596
  init_foreign_keys();
25957
26597
  init_indexes();
26598
+ init_policies();
25958
26599
  init_primary_keys();
25959
26600
  init_query_builders();
26601
+ init_roles();
25960
26602
  init_schema();
25961
26603
  init_sequence();
25962
26604
  init_session();
@@ -25983,9 +26625,9 @@ function minRangeForIdentityBasedOn(columnType) {
25983
26625
  function stringFromDatabaseIdentityProperty(field) {
25984
26626
  return typeof field === "string" ? field : typeof field === "undefined" ? void 0 : typeof field === "bigint" ? field.toString() : String(field);
25985
26627
  }
25986
- function buildArrayString(array, sqlType) {
26628
+ function buildArrayString(array2, sqlType) {
25987
26629
  sqlType = sqlType.split("[")[0];
25988
- const values = array.map((value) => {
26630
+ const values = array2.map((value) => {
25989
26631
  if (typeof value === "number" || typeof value === "bigint") {
25990
26632
  return value.toString();
25991
26633
  } else if (typeof value === "boolean") {
@@ -26007,6 +26649,40 @@ function buildArrayString(array, sqlType) {
26007
26649
  }).join(",");
26008
26650
  return `{${values}}`;
26009
26651
  }
26652
+ function prepareRoles(entities) {
26653
+ let useRoles = false;
26654
+ const includeRoles = [];
26655
+ const excludeRoles = [];
26656
+ if (entities && entities.roles) {
26657
+ if (typeof entities.roles === "object") {
26658
+ if (entities.roles.provider) {
26659
+ if (entities.roles.provider === "supabase") {
26660
+ excludeRoles.push(...[
26661
+ "anon",
26662
+ "authenticator",
26663
+ "authenticated",
26664
+ "service_role",
26665
+ "supabase_auth_admin",
26666
+ "supabase_storage_admin",
26667
+ "dashboard_user",
26668
+ "supabase_admin"
26669
+ ]);
26670
+ } else if (entities.roles.provider === "neon") {
26671
+ excludeRoles.push(...["authenticated", "anonymous"]);
26672
+ }
26673
+ }
26674
+ if (entities.roles.include) {
26675
+ includeRoles.push(...entities.roles.include);
26676
+ }
26677
+ if (entities.roles.exclude) {
26678
+ excludeRoles.push(...entities.roles.exclude);
26679
+ }
26680
+ } else {
26681
+ useRoles = entities.roles;
26682
+ }
26683
+ }
26684
+ return { useRoles, includeRoles, excludeRoles };
26685
+ }
26010
26686
  var indexName, generatePgSnapshot, trimChar, fromDatabase, defaultForColumn;
26011
26687
  var init_pgSerializer = __esm({
26012
26688
  "src/serializer/pgSerializer.ts"() {
@@ -26022,10 +26698,11 @@ var init_pgSerializer = __esm({
26022
26698
  indexName = (tableName, columns) => {
26023
26699
  return `${tableName}_${columns.join("_")}_index`;
26024
26700
  };
26025
- generatePgSnapshot = (tables, enums, schemas, sequences, casing2, schemaFilter) => {
26701
+ generatePgSnapshot = (tables, enums, schemas, sequences, roles, casing2, schemaFilter) => {
26026
26702
  const dialect4 = new PgDialect({ casing: casing2 });
26027
26703
  const result = {};
26028
26704
  const sequencesToReturn = {};
26705
+ const rolesToReturn = {};
26029
26706
  const indexesInSchema = {};
26030
26707
  for (const table4 of tables) {
26031
26708
  const {
@@ -26036,7 +26713,8 @@ var init_pgSerializer = __esm({
26036
26713
  checks,
26037
26714
  schema: schema4,
26038
26715
  primaryKeys,
26039
- uniqueConstraints
26716
+ uniqueConstraints,
26717
+ policies
26040
26718
  } = getTableConfig(table4);
26041
26719
  if (schemaFilter && !schemaFilter.includes(schema4 ?? "public")) {
26042
26720
  continue;
@@ -26046,6 +26724,7 @@ var init_pgSerializer = __esm({
26046
26724
  const foreignKeysObject = {};
26047
26725
  const primaryKeysObject = {};
26048
26726
  const uniqueConstraintObject = {};
26727
+ const policiesObject = {};
26049
26728
  columns.forEach((column4) => {
26050
26729
  const name2 = getColumnCasing(column4, casing2);
26051
26730
  const notNull = column4.notNull;
@@ -26308,6 +26987,34 @@ ${withStyle.errorWarning(
26308
26987
  with: value.config.with ?? {}
26309
26988
  };
26310
26989
  });
26990
+ policies.forEach((policy2) => {
26991
+ const mappedTo = [];
26992
+ if (!policy2.to) {
26993
+ mappedTo.push("public");
26994
+ } else {
26995
+ if (policy2.to && typeof policy2.to === "string") {
26996
+ mappedTo.push(policy2.to);
26997
+ } else if (policy2.to && is(policy2.to, PgRole)) {
26998
+ mappedTo.push(policy2.to.name);
26999
+ } else if (policy2.to && Array.isArray(policy2.to)) {
27000
+ policy2.to.forEach((it) => {
27001
+ if (typeof it === "string") {
27002
+ mappedTo.push(it);
27003
+ } else if (is(it, PgRole)) {
27004
+ mappedTo.push(it.name);
27005
+ }
27006
+ });
27007
+ }
27008
+ }
27009
+ policiesObject[policy2.name] = {
27010
+ name: policy2.name,
27011
+ as: policy2.as?.toUpperCase() ?? "PERMISSIVE",
27012
+ for: policy2.for?.toUpperCase() ?? "ALL",
27013
+ to: mappedTo.sort(),
27014
+ using: is(policy2.using, SQL) ? dialect4.sqlToQuery(policy2.using).sql : void 0,
27015
+ withCheck: is(policy2.withCheck, SQL) ? dialect4.sqlToQuery(policy2.withCheck).sql : void 0
27016
+ };
27017
+ });
26311
27018
  const tableKey2 = `${schema4 ?? "public"}.${tableName}`;
26312
27019
  result[tableKey2] = {
26313
27020
  name: tableName,
@@ -26316,7 +27023,8 @@ ${withStyle.errorWarning(
26316
27023
  indexes: indexesObject,
26317
27024
  foreignKeys: foreignKeysObject,
26318
27025
  compositePrimaryKeys: primaryKeysObject,
26319
- uniqueConstraints: uniqueConstraintObject
27026
+ uniqueConstraints: uniqueConstraintObject,
27027
+ policies: policiesObject
26320
27028
  };
26321
27029
  }
26322
27030
  for (const sequence of sequences) {
@@ -26340,6 +27048,16 @@ ${withStyle.errorWarning(
26340
27048
  } else {
26341
27049
  }
26342
27050
  }
27051
+ for (const role of roles) {
27052
+ if (!role._existing) {
27053
+ rolesToReturn[role.name] = {
27054
+ name: role.name,
27055
+ createDb: role.createDb === void 0 ? false : role.createDb,
27056
+ createRole: role.createRole === void 0 ? false : role.createRole,
27057
+ inherit: role.inherit === void 0 ? true : role.inherit
27058
+ };
27059
+ }
27060
+ }
26343
27061
  const enumsToReturn = enums.reduce((map, obj) => {
26344
27062
  const enumSchema3 = obj.schema || "public";
26345
27063
  const key = `${enumSchema3}.${obj.enumName}`;
@@ -26366,6 +27084,7 @@ ${withStyle.errorWarning(
26366
27084
  enums: enumsToReturn,
26367
27085
  schemas: schemasObject,
26368
27086
  sequences: sequencesToReturn,
27087
+ roles: rolesToReturn,
26369
27088
  _meta: {
26370
27089
  schemas: {},
26371
27090
  tables: {},
@@ -26380,7 +27099,7 @@ ${withStyle.errorWarning(
26380
27099
  while (end > start && str[end - 1] === char3) --end;
26381
27100
  return start > 0 || end < str.length ? str.substring(start, end) : str.toString();
26382
27101
  };
26383
- fromDatabase = async (db, tablesFilter = () => true, schemaFilters, progressCallback) => {
27102
+ fromDatabase = async (db, tablesFilter = () => true, schemaFilters, entities, progressCallback) => {
26384
27103
  const result = {};
26385
27104
  const internals = { tables: {} };
26386
27105
  const where = schemaFilters.map((t) => `table_schema = '${t}'`).join(" or ");
@@ -26462,6 +27181,60 @@ ${withStyle.errorWarning(
26462
27181
  if (progressCallback) {
26463
27182
  progressCallback("enums", Object.keys(enumsToReturn).length, "done");
26464
27183
  }
27184
+ const allRoles = await db.query(
27185
+ `SELECT rolname, rolinherit, rolcreatedb, rolcreaterole FROM pg_roles;`
27186
+ );
27187
+ const rolesToReturn = {};
27188
+ const preparedRoles = prepareRoles(entities);
27189
+ if (preparedRoles.useRoles || !(preparedRoles.includeRoles.length === 0 && preparedRoles.excludeRoles.length === 0)) {
27190
+ for (const dbRole of allRoles) {
27191
+ if (preparedRoles.useRoles) {
27192
+ rolesToReturn[dbRole.rolname] = {
27193
+ createDb: dbRole.rolcreatedb,
27194
+ createRole: dbRole.rolcreatedb,
27195
+ inherit: dbRole.rolinherit,
27196
+ name: dbRole.rolname
27197
+ };
27198
+ } else {
27199
+ if (preparedRoles.includeRoles.length === 0 && preparedRoles.excludeRoles.length === 0) continue;
27200
+ if (preparedRoles.includeRoles.includes(dbRole.rolname) && preparedRoles.excludeRoles.includes(dbRole.rolname)) continue;
27201
+ if (preparedRoles.excludeRoles.includes(dbRole.rolname)) continue;
27202
+ if (!preparedRoles.includeRoles.includes(dbRole.rolname)) continue;
27203
+ rolesToReturn[dbRole.rolname] = {
27204
+ createDb: dbRole.rolcreatedb,
27205
+ createRole: dbRole.rolcreaterole,
27206
+ inherit: dbRole.rolinherit,
27207
+ name: dbRole.rolname
27208
+ };
27209
+ }
27210
+ }
27211
+ }
27212
+ const wherePolicies = schemaFilters.map((t) => `schemaname = '${t}'`).join(" or ");
27213
+ const policiesByTable = {};
27214
+ const allPolicies = await db.query(`SELECT schemaname, tablename, policyname as name, permissive as "as", roles as to, cmd as for, qual as using, with_check as "withCheck" FROM pg_policies${wherePolicies === "" ? "" : ` WHERE ${wherePolicies}`};`);
27215
+ for (const dbPolicy of allPolicies) {
27216
+ const { tablename, schemaname, to, withCheck, using, ...rest } = dbPolicy;
27217
+ const tableForPolicy = policiesByTable[`${schemaname}.${tablename}`];
27218
+ const parsedTo = to === "{}" ? [] : to.substring(1, to.length - 1).split(/\s*,\s*/g).sort();
27219
+ const parsedWithCheck = withCheck === null ? void 0 : withCheck;
27220
+ const parsedUsing = using === null ? void 0 : using;
27221
+ if (tableForPolicy) {
27222
+ tableForPolicy[dbPolicy.name] = { ...rest, to: parsedTo };
27223
+ } else {
27224
+ policiesByTable[`${schemaname}.${tablename}`] = {
27225
+ [dbPolicy.name]: { ...rest, to: parsedTo, withCheck: parsedWithCheck, using: parsedUsing }
27226
+ };
27227
+ }
27228
+ }
27229
+ if (progressCallback) {
27230
+ progressCallback(
27231
+ "policies",
27232
+ Object.values(policiesByTable).reduce((total, innerRecord) => {
27233
+ return total + Object.keys(innerRecord).length;
27234
+ }, 0),
27235
+ "done"
27236
+ );
27237
+ }
26465
27238
  const sequencesInColumns = [];
26466
27239
  const all = allTables.map((row) => {
26467
27240
  return new Promise(async (res, rej) => {
@@ -26855,7 +27628,8 @@ ${withStyle.errorWarning(
26855
27628
  indexes: indexToReturn,
26856
27629
  foreignKeys: foreignKeysToReturn,
26857
27630
  compositePrimaryKeys: primaryKeys,
26858
- uniqueConstraints: uniqueConstrains
27631
+ uniqueConstraints: uniqueConstrains,
27632
+ policies: policiesByTable[`${tableSchema}.${tableName}`] ?? {}
26859
27633
  };
26860
27634
  } catch (e) {
26861
27635
  rej(e);
@@ -26882,6 +27656,7 @@ ${withStyle.errorWarning(
26882
27656
  enums: enumsToReturn,
26883
27657
  schemas: schemasObject,
26884
27658
  sequences: sequencesToReturn,
27659
+ roles: rolesToReturn,
26885
27660
  _meta: {
26886
27661
  schemas: {},
26887
27662
  tables: {},
@@ -27004,12 +27779,12 @@ var init_alias3 = __esm({
27004
27779
  });
27005
27780
 
27006
27781
  // ../drizzle-orm/dist/sqlite-core/checks.js
27007
- var _a160, CheckBuilder2, _a161, Check2;
27782
+ var _a162, CheckBuilder2, _a163, Check2;
27008
27783
  var init_checks2 = __esm({
27009
27784
  "../drizzle-orm/dist/sqlite-core/checks.js"() {
27010
27785
  "use strict";
27011
27786
  init_entity();
27012
- _a160 = entityKind;
27787
+ _a162 = entityKind;
27013
27788
  CheckBuilder2 = class {
27014
27789
  constructor(name2, value) {
27015
27790
  __publicField(this, "brand");
@@ -27020,8 +27795,8 @@ var init_checks2 = __esm({
27020
27795
  return new Check2(table4, this);
27021
27796
  }
27022
27797
  };
27023
- __publicField(CheckBuilder2, _a160, "SQLiteCheckBuilder");
27024
- _a161 = entityKind;
27798
+ __publicField(CheckBuilder2, _a162, "SQLiteCheckBuilder");
27799
+ _a163 = entityKind;
27025
27800
  Check2 = class {
27026
27801
  constructor(table4, builder) {
27027
27802
  __publicField(this, "name");
@@ -27031,18 +27806,18 @@ var init_checks2 = __esm({
27031
27806
  this.value = builder.value;
27032
27807
  }
27033
27808
  };
27034
- __publicField(Check2, _a161, "SQLiteCheck");
27809
+ __publicField(Check2, _a163, "SQLiteCheck");
27035
27810
  }
27036
27811
  });
27037
27812
 
27038
27813
  // ../drizzle-orm/dist/sqlite-core/foreign-keys.js
27039
- var _a162, ForeignKeyBuilder2, _a163, ForeignKey2;
27814
+ var _a164, ForeignKeyBuilder2, _a165, ForeignKey2;
27040
27815
  var init_foreign_keys2 = __esm({
27041
27816
  "../drizzle-orm/dist/sqlite-core/foreign-keys.js"() {
27042
27817
  "use strict";
27043
27818
  init_entity();
27044
27819
  init_table_utils();
27045
- _a162 = entityKind;
27820
+ _a164 = entityKind;
27046
27821
  ForeignKeyBuilder2 = class {
27047
27822
  constructor(config, actions) {
27048
27823
  /** @internal */
@@ -27073,8 +27848,8 @@ var init_foreign_keys2 = __esm({
27073
27848
  return new ForeignKey2(table4, this);
27074
27849
  }
27075
27850
  };
27076
- __publicField(ForeignKeyBuilder2, _a162, "SQLiteForeignKeyBuilder");
27077
- _a163 = entityKind;
27851
+ __publicField(ForeignKeyBuilder2, _a164, "SQLiteForeignKeyBuilder");
27852
+ _a165 = entityKind;
27078
27853
  ForeignKey2 = class {
27079
27854
  constructor(table4, builder) {
27080
27855
  __publicField(this, "reference");
@@ -27098,7 +27873,7 @@ var init_foreign_keys2 = __esm({
27098
27873
  return name2 ?? `${chunks.join("_")}_fk`;
27099
27874
  }
27100
27875
  };
27101
- __publicField(ForeignKey2, _a163, "SQLiteForeignKey");
27876
+ __publicField(ForeignKey2, _a165, "SQLiteForeignKey");
27102
27877
  }
27103
27878
  });
27104
27879
 
@@ -27106,13 +27881,13 @@ var init_foreign_keys2 = __esm({
27106
27881
  function uniqueKeyName2(table4, columns) {
27107
27882
  return `${table4[TableName]}_${columns.join("_")}_unique`;
27108
27883
  }
27109
- var _a164, UniqueConstraintBuilder2, _a165, UniqueOnConstraintBuilder2, _a166, UniqueConstraint2;
27884
+ var _a166, UniqueConstraintBuilder2, _a167, UniqueOnConstraintBuilder2, _a168, UniqueConstraint2;
27110
27885
  var init_unique_constraint2 = __esm({
27111
27886
  "../drizzle-orm/dist/sqlite-core/unique-constraint.js"() {
27112
27887
  "use strict";
27113
27888
  init_entity();
27114
27889
  init_table_utils();
27115
- _a164 = entityKind;
27890
+ _a166 = entityKind;
27116
27891
  UniqueConstraintBuilder2 = class {
27117
27892
  constructor(columns, name2) {
27118
27893
  /** @internal */
@@ -27125,8 +27900,8 @@ var init_unique_constraint2 = __esm({
27125
27900
  return new UniqueConstraint2(table4, this.columns, this.name);
27126
27901
  }
27127
27902
  };
27128
- __publicField(UniqueConstraintBuilder2, _a164, "SQLiteUniqueConstraintBuilder");
27129
- _a165 = entityKind;
27903
+ __publicField(UniqueConstraintBuilder2, _a166, "SQLiteUniqueConstraintBuilder");
27904
+ _a167 = entityKind;
27130
27905
  UniqueOnConstraintBuilder2 = class {
27131
27906
  constructor(name2) {
27132
27907
  /** @internal */
@@ -27137,8 +27912,8 @@ var init_unique_constraint2 = __esm({
27137
27912
  return new UniqueConstraintBuilder2(columns, this.name);
27138
27913
  }
27139
27914
  };
27140
- __publicField(UniqueOnConstraintBuilder2, _a165, "SQLiteUniqueOnConstraintBuilder");
27141
- _a166 = entityKind;
27915
+ __publicField(UniqueOnConstraintBuilder2, _a167, "SQLiteUniqueOnConstraintBuilder");
27916
+ _a168 = entityKind;
27142
27917
  UniqueConstraint2 = class {
27143
27918
  constructor(table4, columns, name2) {
27144
27919
  __publicField(this, "columns");
@@ -27151,12 +27926,12 @@ var init_unique_constraint2 = __esm({
27151
27926
  return this.name;
27152
27927
  }
27153
27928
  };
27154
- __publicField(UniqueConstraint2, _a166, "SQLiteUniqueConstraint");
27929
+ __publicField(UniqueConstraint2, _a168, "SQLiteUniqueConstraint");
27155
27930
  }
27156
27931
  });
27157
27932
 
27158
27933
  // ../drizzle-orm/dist/sqlite-core/columns/common.js
27159
- var _a167, _b114, SQLiteColumnBuilder, _a168, _b115, SQLiteColumn;
27934
+ var _a169, _b114, SQLiteColumnBuilder, _a170, _b115, SQLiteColumn;
27160
27935
  var init_common3 = __esm({
27161
27936
  "../drizzle-orm/dist/sqlite-core/columns/common.js"() {
27162
27937
  "use strict";
@@ -27165,7 +27940,7 @@ var init_common3 = __esm({
27165
27940
  init_entity();
27166
27941
  init_foreign_keys2();
27167
27942
  init_unique_constraint2();
27168
- SQLiteColumnBuilder = class extends (_b114 = ColumnBuilder, _a167 = entityKind, _b114) {
27943
+ SQLiteColumnBuilder = class extends (_b114 = ColumnBuilder, _a169 = entityKind, _b114) {
27169
27944
  constructor() {
27170
27945
  super(...arguments);
27171
27946
  __publicField(this, "foreignKeyConfigs", []);
@@ -27206,8 +27981,8 @@ var init_common3 = __esm({
27206
27981
  });
27207
27982
  }
27208
27983
  };
27209
- __publicField(SQLiteColumnBuilder, _a167, "SQLiteColumnBuilder");
27210
- SQLiteColumn = class extends (_b115 = Column2, _a168 = entityKind, _b115) {
27984
+ __publicField(SQLiteColumnBuilder, _a169, "SQLiteColumnBuilder");
27985
+ SQLiteColumn = class extends (_b115 = Column2, _a170 = entityKind, _b115) {
27211
27986
  constructor(table4, config) {
27212
27987
  if (!config.uniqueName) {
27213
27988
  config.uniqueName = uniqueKeyName2(table4, [config.name]);
@@ -27216,7 +27991,7 @@ var init_common3 = __esm({
27216
27991
  this.table = table4;
27217
27992
  }
27218
27993
  };
27219
- __publicField(SQLiteColumn, _a168, "SQLiteColumn");
27994
+ __publicField(SQLiteColumn, _a170, "SQLiteColumn");
27220
27995
  }
27221
27996
  });
27222
27997
 
@@ -27231,14 +28006,14 @@ function blob(a, b) {
27231
28006
  }
27232
28007
  return new SQLiteBlobBufferBuilder(name2);
27233
28008
  }
27234
- var _a169, _b116, SQLiteBigIntBuilder, _a170, _b117, SQLiteBigInt, _a171, _b118, SQLiteBlobJsonBuilder, _a172, _b119, SQLiteBlobJson, _a173, _b120, SQLiteBlobBufferBuilder, _a174, _b121, SQLiteBlobBuffer;
28009
+ var _a171, _b116, SQLiteBigIntBuilder, _a172, _b117, SQLiteBigInt, _a173, _b118, SQLiteBlobJsonBuilder, _a174, _b119, SQLiteBlobJson, _a175, _b120, SQLiteBlobBufferBuilder, _a176, _b121, SQLiteBlobBuffer;
27235
28010
  var init_blob = __esm({
27236
28011
  "../drizzle-orm/dist/sqlite-core/columns/blob.js"() {
27237
28012
  "use strict";
27238
28013
  init_entity();
27239
28014
  init_utils2();
27240
28015
  init_common3();
27241
- SQLiteBigIntBuilder = class extends (_b116 = SQLiteColumnBuilder, _a169 = entityKind, _b116) {
28016
+ SQLiteBigIntBuilder = class extends (_b116 = SQLiteColumnBuilder, _a171 = entityKind, _b116) {
27242
28017
  constructor(name2) {
27243
28018
  super(name2, "bigint", "SQLiteBigInt");
27244
28019
  }
@@ -27247,8 +28022,8 @@ var init_blob = __esm({
27247
28022
  return new SQLiteBigInt(table4, this.config);
27248
28023
  }
27249
28024
  };
27250
- __publicField(SQLiteBigIntBuilder, _a169, "SQLiteBigIntBuilder");
27251
- SQLiteBigInt = class extends (_b117 = SQLiteColumn, _a170 = entityKind, _b117) {
28025
+ __publicField(SQLiteBigIntBuilder, _a171, "SQLiteBigIntBuilder");
28026
+ SQLiteBigInt = class extends (_b117 = SQLiteColumn, _a172 = entityKind, _b117) {
27252
28027
  getSQLType() {
27253
28028
  return "blob";
27254
28029
  }
@@ -27259,8 +28034,8 @@ var init_blob = __esm({
27259
28034
  return Buffer.from(value.toString());
27260
28035
  }
27261
28036
  };
27262
- __publicField(SQLiteBigInt, _a170, "SQLiteBigInt");
27263
- SQLiteBlobJsonBuilder = class extends (_b118 = SQLiteColumnBuilder, _a171 = entityKind, _b118) {
28037
+ __publicField(SQLiteBigInt, _a172, "SQLiteBigInt");
28038
+ SQLiteBlobJsonBuilder = class extends (_b118 = SQLiteColumnBuilder, _a173 = entityKind, _b118) {
27264
28039
  constructor(name2) {
27265
28040
  super(name2, "json", "SQLiteBlobJson");
27266
28041
  }
@@ -27272,8 +28047,8 @@ var init_blob = __esm({
27272
28047
  );
27273
28048
  }
27274
28049
  };
27275
- __publicField(SQLiteBlobJsonBuilder, _a171, "SQLiteBlobJsonBuilder");
27276
- SQLiteBlobJson = class extends (_b119 = SQLiteColumn, _a172 = entityKind, _b119) {
28050
+ __publicField(SQLiteBlobJsonBuilder, _a173, "SQLiteBlobJsonBuilder");
28051
+ SQLiteBlobJson = class extends (_b119 = SQLiteColumn, _a174 = entityKind, _b119) {
27277
28052
  getSQLType() {
27278
28053
  return "blob";
27279
28054
  }
@@ -27284,8 +28059,8 @@ var init_blob = __esm({
27284
28059
  return Buffer.from(JSON.stringify(value));
27285
28060
  }
27286
28061
  };
27287
- __publicField(SQLiteBlobJson, _a172, "SQLiteBlobJson");
27288
- SQLiteBlobBufferBuilder = class extends (_b120 = SQLiteColumnBuilder, _a173 = entityKind, _b120) {
28062
+ __publicField(SQLiteBlobJson, _a174, "SQLiteBlobJson");
28063
+ SQLiteBlobBufferBuilder = class extends (_b120 = SQLiteColumnBuilder, _a175 = entityKind, _b120) {
27289
28064
  constructor(name2) {
27290
28065
  super(name2, "buffer", "SQLiteBlobBuffer");
27291
28066
  }
@@ -27294,13 +28069,13 @@ var init_blob = __esm({
27294
28069
  return new SQLiteBlobBuffer(table4, this.config);
27295
28070
  }
27296
28071
  };
27297
- __publicField(SQLiteBlobBufferBuilder, _a173, "SQLiteBlobBufferBuilder");
27298
- SQLiteBlobBuffer = class extends (_b121 = SQLiteColumn, _a174 = entityKind, _b121) {
28072
+ __publicField(SQLiteBlobBufferBuilder, _a175, "SQLiteBlobBufferBuilder");
28073
+ SQLiteBlobBuffer = class extends (_b121 = SQLiteColumn, _a176 = entityKind, _b121) {
27299
28074
  getSQLType() {
27300
28075
  return "blob";
27301
28076
  }
27302
28077
  };
27303
- __publicField(SQLiteBlobBuffer, _a174, "SQLiteBlobBuffer");
28078
+ __publicField(SQLiteBlobBuffer, _a176, "SQLiteBlobBuffer");
27304
28079
  }
27305
28080
  });
27306
28081
 
@@ -27315,14 +28090,14 @@ function customType2(customTypeParams) {
27315
28090
  );
27316
28091
  };
27317
28092
  }
27318
- var _a175, _b122, SQLiteCustomColumnBuilder, _a176, _b123, SQLiteCustomColumn;
28093
+ var _a177, _b122, SQLiteCustomColumnBuilder, _a178, _b123, SQLiteCustomColumn;
27319
28094
  var init_custom2 = __esm({
27320
28095
  "../drizzle-orm/dist/sqlite-core/columns/custom.js"() {
27321
28096
  "use strict";
27322
28097
  init_entity();
27323
28098
  init_utils2();
27324
28099
  init_common3();
27325
- SQLiteCustomColumnBuilder = class extends (_b122 = SQLiteColumnBuilder, _a175 = entityKind, _b122) {
28100
+ SQLiteCustomColumnBuilder = class extends (_b122 = SQLiteColumnBuilder, _a177 = entityKind, _b122) {
27326
28101
  constructor(name2, fieldConfig, customTypeParams) {
27327
28102
  super(name2, "custom", "SQLiteCustomColumn");
27328
28103
  this.config.fieldConfig = fieldConfig;
@@ -27336,8 +28111,8 @@ var init_custom2 = __esm({
27336
28111
  );
27337
28112
  }
27338
28113
  };
27339
- __publicField(SQLiteCustomColumnBuilder, _a175, "SQLiteCustomColumnBuilder");
27340
- SQLiteCustomColumn = class extends (_b123 = SQLiteColumn, _a176 = entityKind, _b123) {
28114
+ __publicField(SQLiteCustomColumnBuilder, _a177, "SQLiteCustomColumnBuilder");
28115
+ SQLiteCustomColumn = class extends (_b123 = SQLiteColumn, _a178 = entityKind, _b123) {
27341
28116
  constructor(table4, config) {
27342
28117
  super(table4, config);
27343
28118
  __publicField(this, "sqlName");
@@ -27357,7 +28132,7 @@ var init_custom2 = __esm({
27357
28132
  return typeof this.mapTo === "function" ? this.mapTo(value) : value;
27358
28133
  }
27359
28134
  };
27360
- __publicField(SQLiteCustomColumn, _a176, "SQLiteCustomColumn");
28135
+ __publicField(SQLiteCustomColumn, _a178, "SQLiteCustomColumn");
27361
28136
  }
27362
28137
  });
27363
28138
 
@@ -27372,7 +28147,7 @@ function integer2(a, b) {
27372
28147
  }
27373
28148
  return new SQLiteIntegerBuilder(name2);
27374
28149
  }
27375
- var _a177, _b124, SQLiteBaseIntegerBuilder, _a178, _b125, SQLiteBaseInteger, _a179, _b126, SQLiteIntegerBuilder, _a180, _b127, SQLiteInteger, _a181, _b128, SQLiteTimestampBuilder, _a182, _b129, SQLiteTimestamp, _a183, _b130, SQLiteBooleanBuilder, _a184, _b131, SQLiteBoolean;
28150
+ var _a179, _b124, SQLiteBaseIntegerBuilder, _a180, _b125, SQLiteBaseInteger, _a181, _b126, SQLiteIntegerBuilder, _a182, _b127, SQLiteInteger, _a183, _b128, SQLiteTimestampBuilder, _a184, _b129, SQLiteTimestamp, _a185, _b130, SQLiteBooleanBuilder, _a186, _b131, SQLiteBoolean;
27376
28151
  var init_integer2 = __esm({
27377
28152
  "../drizzle-orm/dist/sqlite-core/columns/integer.js"() {
27378
28153
  "use strict";
@@ -27380,7 +28155,7 @@ var init_integer2 = __esm({
27380
28155
  init_sql();
27381
28156
  init_utils2();
27382
28157
  init_common3();
27383
- SQLiteBaseIntegerBuilder = class extends (_b124 = SQLiteColumnBuilder, _a177 = entityKind, _b124) {
28158
+ SQLiteBaseIntegerBuilder = class extends (_b124 = SQLiteColumnBuilder, _a179 = entityKind, _b124) {
27384
28159
  constructor(name2, dataType, columnType) {
27385
28160
  super(name2, dataType, columnType);
27386
28161
  this.config.autoIncrement = false;
@@ -27393,8 +28168,8 @@ var init_integer2 = __esm({
27393
28168
  return super.primaryKey();
27394
28169
  }
27395
28170
  };
27396
- __publicField(SQLiteBaseIntegerBuilder, _a177, "SQLiteBaseIntegerBuilder");
27397
- SQLiteBaseInteger = class extends (_b125 = SQLiteColumn, _a178 = entityKind, _b125) {
28171
+ __publicField(SQLiteBaseIntegerBuilder, _a179, "SQLiteBaseIntegerBuilder");
28172
+ SQLiteBaseInteger = class extends (_b125 = SQLiteColumn, _a180 = entityKind, _b125) {
27398
28173
  constructor() {
27399
28174
  super(...arguments);
27400
28175
  __publicField(this, "autoIncrement", this.config.autoIncrement);
@@ -27403,8 +28178,8 @@ var init_integer2 = __esm({
27403
28178
  return "integer";
27404
28179
  }
27405
28180
  };
27406
- __publicField(SQLiteBaseInteger, _a178, "SQLiteBaseInteger");
27407
- SQLiteIntegerBuilder = class extends (_b126 = SQLiteBaseIntegerBuilder, _a179 = entityKind, _b126) {
28181
+ __publicField(SQLiteBaseInteger, _a180, "SQLiteBaseInteger");
28182
+ SQLiteIntegerBuilder = class extends (_b126 = SQLiteBaseIntegerBuilder, _a181 = entityKind, _b126) {
27408
28183
  constructor(name2) {
27409
28184
  super(name2, "number", "SQLiteInteger");
27410
28185
  }
@@ -27415,11 +28190,11 @@ var init_integer2 = __esm({
27415
28190
  );
27416
28191
  }
27417
28192
  };
27418
- __publicField(SQLiteIntegerBuilder, _a179, "SQLiteIntegerBuilder");
27419
- SQLiteInteger = class extends (_b127 = SQLiteBaseInteger, _a180 = entityKind, _b127) {
28193
+ __publicField(SQLiteIntegerBuilder, _a181, "SQLiteIntegerBuilder");
28194
+ SQLiteInteger = class extends (_b127 = SQLiteBaseInteger, _a182 = entityKind, _b127) {
27420
28195
  };
27421
- __publicField(SQLiteInteger, _a180, "SQLiteInteger");
27422
- SQLiteTimestampBuilder = class extends (_b128 = SQLiteBaseIntegerBuilder, _a181 = entityKind, _b128) {
28196
+ __publicField(SQLiteInteger, _a182, "SQLiteInteger");
28197
+ SQLiteTimestampBuilder = class extends (_b128 = SQLiteBaseIntegerBuilder, _a183 = entityKind, _b128) {
27423
28198
  constructor(name2, mode) {
27424
28199
  super(name2, "date", "SQLiteTimestamp");
27425
28200
  this.config.mode = mode;
@@ -27439,8 +28214,8 @@ var init_integer2 = __esm({
27439
28214
  );
27440
28215
  }
27441
28216
  };
27442
- __publicField(SQLiteTimestampBuilder, _a181, "SQLiteTimestampBuilder");
27443
- SQLiteTimestamp = class extends (_b129 = SQLiteBaseInteger, _a182 = entityKind, _b129) {
28217
+ __publicField(SQLiteTimestampBuilder, _a183, "SQLiteTimestampBuilder");
28218
+ SQLiteTimestamp = class extends (_b129 = SQLiteBaseInteger, _a184 = entityKind, _b129) {
27444
28219
  constructor() {
27445
28220
  super(...arguments);
27446
28221
  __publicField(this, "mode", this.config.mode);
@@ -27459,8 +28234,8 @@ var init_integer2 = __esm({
27459
28234
  return unix;
27460
28235
  }
27461
28236
  };
27462
- __publicField(SQLiteTimestamp, _a182, "SQLiteTimestamp");
27463
- SQLiteBooleanBuilder = class extends (_b130 = SQLiteBaseIntegerBuilder, _a183 = entityKind, _b130) {
28237
+ __publicField(SQLiteTimestamp, _a184, "SQLiteTimestamp");
28238
+ SQLiteBooleanBuilder = class extends (_b130 = SQLiteBaseIntegerBuilder, _a185 = entityKind, _b130) {
27464
28239
  constructor(name2, mode) {
27465
28240
  super(name2, "boolean", "SQLiteBoolean");
27466
28241
  this.config.mode = mode;
@@ -27472,8 +28247,8 @@ var init_integer2 = __esm({
27472
28247
  );
27473
28248
  }
27474
28249
  };
27475
- __publicField(SQLiteBooleanBuilder, _a183, "SQLiteBooleanBuilder");
27476
- SQLiteBoolean = class extends (_b131 = SQLiteBaseInteger, _a184 = entityKind, _b131) {
28250
+ __publicField(SQLiteBooleanBuilder, _a185, "SQLiteBooleanBuilder");
28251
+ SQLiteBoolean = class extends (_b131 = SQLiteBaseInteger, _a186 = entityKind, _b131) {
27477
28252
  constructor() {
27478
28253
  super(...arguments);
27479
28254
  __publicField(this, "mode", this.config.mode);
@@ -27485,7 +28260,7 @@ var init_integer2 = __esm({
27485
28260
  return value ? 1 : 0;
27486
28261
  }
27487
28262
  };
27488
- __publicField(SQLiteBoolean, _a184, "SQLiteBoolean");
28263
+ __publicField(SQLiteBoolean, _a186, "SQLiteBoolean");
27489
28264
  }
27490
28265
  });
27491
28266
 
@@ -27493,13 +28268,13 @@ var init_integer2 = __esm({
27493
28268
  function numeric2(name2) {
27494
28269
  return new SQLiteNumericBuilder(name2 ?? "");
27495
28270
  }
27496
- var _a185, _b132, SQLiteNumericBuilder, _a186, _b133, SQLiteNumeric;
28271
+ var _a187, _b132, SQLiteNumericBuilder, _a188, _b133, SQLiteNumeric;
27497
28272
  var init_numeric2 = __esm({
27498
28273
  "../drizzle-orm/dist/sqlite-core/columns/numeric.js"() {
27499
28274
  "use strict";
27500
28275
  init_entity();
27501
28276
  init_common3();
27502
- SQLiteNumericBuilder = class extends (_b132 = SQLiteColumnBuilder, _a185 = entityKind, _b132) {
28277
+ SQLiteNumericBuilder = class extends (_b132 = SQLiteColumnBuilder, _a187 = entityKind, _b132) {
27503
28278
  constructor(name2) {
27504
28279
  super(name2, "string", "SQLiteNumeric");
27505
28280
  }
@@ -27511,13 +28286,13 @@ var init_numeric2 = __esm({
27511
28286
  );
27512
28287
  }
27513
28288
  };
27514
- __publicField(SQLiteNumericBuilder, _a185, "SQLiteNumericBuilder");
27515
- SQLiteNumeric = class extends (_b133 = SQLiteColumn, _a186 = entityKind, _b133) {
28289
+ __publicField(SQLiteNumericBuilder, _a187, "SQLiteNumericBuilder");
28290
+ SQLiteNumeric = class extends (_b133 = SQLiteColumn, _a188 = entityKind, _b133) {
27516
28291
  getSQLType() {
27517
28292
  return "numeric";
27518
28293
  }
27519
28294
  };
27520
- __publicField(SQLiteNumeric, _a186, "SQLiteNumeric");
28295
+ __publicField(SQLiteNumeric, _a188, "SQLiteNumeric");
27521
28296
  }
27522
28297
  });
27523
28298
 
@@ -27525,13 +28300,13 @@ var init_numeric2 = __esm({
27525
28300
  function real2(name2) {
27526
28301
  return new SQLiteRealBuilder(name2 ?? "");
27527
28302
  }
27528
- var _a187, _b134, SQLiteRealBuilder, _a188, _b135, SQLiteReal;
28303
+ var _a189, _b134, SQLiteRealBuilder, _a190, _b135, SQLiteReal;
27529
28304
  var init_real2 = __esm({
27530
28305
  "../drizzle-orm/dist/sqlite-core/columns/real.js"() {
27531
28306
  "use strict";
27532
28307
  init_entity();
27533
28308
  init_common3();
27534
- SQLiteRealBuilder = class extends (_b134 = SQLiteColumnBuilder, _a187 = entityKind, _b134) {
28309
+ SQLiteRealBuilder = class extends (_b134 = SQLiteColumnBuilder, _a189 = entityKind, _b134) {
27535
28310
  constructor(name2) {
27536
28311
  super(name2, "number", "SQLiteReal");
27537
28312
  }
@@ -27540,13 +28315,13 @@ var init_real2 = __esm({
27540
28315
  return new SQLiteReal(table4, this.config);
27541
28316
  }
27542
28317
  };
27543
- __publicField(SQLiteRealBuilder, _a187, "SQLiteRealBuilder");
27544
- SQLiteReal = class extends (_b135 = SQLiteColumn, _a188 = entityKind, _b135) {
28318
+ __publicField(SQLiteRealBuilder, _a189, "SQLiteRealBuilder");
28319
+ SQLiteReal = class extends (_b135 = SQLiteColumn, _a190 = entityKind, _b135) {
27545
28320
  getSQLType() {
27546
28321
  return "real";
27547
28322
  }
27548
28323
  };
27549
- __publicField(SQLiteReal, _a188, "SQLiteReal");
28324
+ __publicField(SQLiteReal, _a190, "SQLiteReal");
27550
28325
  }
27551
28326
  });
27552
28327
 
@@ -27558,14 +28333,14 @@ function text2(a, b = {}) {
27558
28333
  }
27559
28334
  return new SQLiteTextBuilder(name2, config);
27560
28335
  }
27561
- var _a189, _b136, SQLiteTextBuilder, _a190, _b137, SQLiteText, _a191, _b138, SQLiteTextJsonBuilder, _a192, _b139, SQLiteTextJson;
28336
+ var _a191, _b136, SQLiteTextBuilder, _a192, _b137, SQLiteText, _a193, _b138, SQLiteTextJsonBuilder, _a194, _b139, SQLiteTextJson;
27562
28337
  var init_text2 = __esm({
27563
28338
  "../drizzle-orm/dist/sqlite-core/columns/text.js"() {
27564
28339
  "use strict";
27565
28340
  init_entity();
27566
28341
  init_utils2();
27567
28342
  init_common3();
27568
- SQLiteTextBuilder = class extends (_b136 = SQLiteColumnBuilder, _a189 = entityKind, _b136) {
28343
+ SQLiteTextBuilder = class extends (_b136 = SQLiteColumnBuilder, _a191 = entityKind, _b136) {
27569
28344
  constructor(name2, config) {
27570
28345
  super(name2, "string", "SQLiteText");
27571
28346
  this.config.enumValues = config.enum;
@@ -27576,8 +28351,8 @@ var init_text2 = __esm({
27576
28351
  return new SQLiteText(table4, this.config);
27577
28352
  }
27578
28353
  };
27579
- __publicField(SQLiteTextBuilder, _a189, "SQLiteTextBuilder");
27580
- SQLiteText = class extends (_b137 = SQLiteColumn, _a190 = entityKind, _b137) {
28354
+ __publicField(SQLiteTextBuilder, _a191, "SQLiteTextBuilder");
28355
+ SQLiteText = class extends (_b137 = SQLiteColumn, _a192 = entityKind, _b137) {
27581
28356
  constructor(table4, config) {
27582
28357
  super(table4, config);
27583
28358
  __publicField(this, "enumValues", this.config.enumValues);
@@ -27587,8 +28362,8 @@ var init_text2 = __esm({
27587
28362
  return `text${this.config.length ? `(${this.config.length})` : ""}`;
27588
28363
  }
27589
28364
  };
27590
- __publicField(SQLiteText, _a190, "SQLiteText");
27591
- SQLiteTextJsonBuilder = class extends (_b138 = SQLiteColumnBuilder, _a191 = entityKind, _b138) {
28365
+ __publicField(SQLiteText, _a192, "SQLiteText");
28366
+ SQLiteTextJsonBuilder = class extends (_b138 = SQLiteColumnBuilder, _a193 = entityKind, _b138) {
27592
28367
  constructor(name2) {
27593
28368
  super(name2, "json", "SQLiteTextJson");
27594
28369
  }
@@ -27600,8 +28375,8 @@ var init_text2 = __esm({
27600
28375
  );
27601
28376
  }
27602
28377
  };
27603
- __publicField(SQLiteTextJsonBuilder, _a191, "SQLiteTextJsonBuilder");
27604
- SQLiteTextJson = class extends (_b139 = SQLiteColumn, _a192 = entityKind, _b139) {
28378
+ __publicField(SQLiteTextJsonBuilder, _a193, "SQLiteTextJsonBuilder");
28379
+ SQLiteTextJson = class extends (_b139 = SQLiteColumn, _a194 = entityKind, _b139) {
27605
28380
  getSQLType() {
27606
28381
  return "text";
27607
28382
  }
@@ -27612,7 +28387,7 @@ var init_text2 = __esm({
27612
28387
  return JSON.stringify(value);
27613
28388
  }
27614
28389
  };
27615
- __publicField(SQLiteTextJson, _a192, "SQLiteTextJson");
28390
+ __publicField(SQLiteTextJson, _a194, "SQLiteTextJson");
27616
28391
  }
27617
28392
  });
27618
28393
 
@@ -27674,7 +28449,7 @@ function sqliteTableBase(name2, columns, extraConfig, schema4, baseName = name2)
27674
28449
  }
27675
28450
  return table4;
27676
28451
  }
27677
- var InlineForeignKeys2, _a193, _b140, _c6, _d3, _e2, SQLiteTable, sqliteTable;
28452
+ var InlineForeignKeys2, _a195, _b140, _c6, _d3, _e2, SQLiteTable, sqliteTable;
27678
28453
  var init_table3 = __esm({
27679
28454
  "../drizzle-orm/dist/sqlite-core/table.js"() {
27680
28455
  "use strict";
@@ -27682,7 +28457,7 @@ var init_table3 = __esm({
27682
28457
  init_table();
27683
28458
  init_all2();
27684
28459
  InlineForeignKeys2 = Symbol.for("drizzle:SQLiteInlineForeignKeys");
27685
- SQLiteTable = class extends (_e2 = Table, _d3 = entityKind, _c6 = Table.Symbol.Columns, _b140 = InlineForeignKeys2, _a193 = Table.Symbol.ExtraConfigBuilder, _e2) {
28460
+ SQLiteTable = class extends (_e2 = Table, _d3 = entityKind, _c6 = Table.Symbol.Columns, _b140 = InlineForeignKeys2, _a195 = Table.Symbol.ExtraConfigBuilder, _e2) {
27686
28461
  constructor() {
27687
28462
  super(...arguments);
27688
28463
  /** @internal */
@@ -27690,7 +28465,7 @@ var init_table3 = __esm({
27690
28465
  /** @internal */
27691
28466
  __publicField(this, _b140, []);
27692
28467
  /** @internal */
27693
- __publicField(this, _a193);
28468
+ __publicField(this, _a195);
27694
28469
  }
27695
28470
  };
27696
28471
  __publicField(SQLiteTable, _d3, "SQLiteTable");
@@ -27705,7 +28480,7 @@ var init_table3 = __esm({
27705
28480
  });
27706
28481
 
27707
28482
  // ../drizzle-orm/dist/sqlite-core/query-builders/delete.js
27708
- var _a194, _b141, SQLiteDeleteBase;
28483
+ var _a196, _b141, SQLiteDeleteBase;
27709
28484
  var init_delete2 = __esm({
27710
28485
  "../drizzle-orm/dist/sqlite-core/query-builders/delete.js"() {
27711
28486
  "use strict";
@@ -27713,7 +28488,7 @@ var init_delete2 = __esm({
27713
28488
  init_query_promise();
27714
28489
  init_table3();
27715
28490
  init_utils2();
27716
- SQLiteDeleteBase = class extends (_b141 = QueryPromise, _a194 = entityKind, _b141) {
28491
+ SQLiteDeleteBase = class extends (_b141 = QueryPromise, _a196 = entityKind, _b141) {
27717
28492
  constructor(table4, session, dialect4, withList) {
27718
28493
  super();
27719
28494
  /** @internal */
@@ -27799,12 +28574,12 @@ var init_delete2 = __esm({
27799
28574
  return this;
27800
28575
  }
27801
28576
  };
27802
- __publicField(SQLiteDeleteBase, _a194, "SQLiteDelete");
28577
+ __publicField(SQLiteDeleteBase, _a196, "SQLiteDelete");
27803
28578
  }
27804
28579
  });
27805
28580
 
27806
28581
  // ../drizzle-orm/dist/sqlite-core/query-builders/insert.js
27807
- var _a195, SQLiteInsertBuilder, _a196, _b142, SQLiteInsertBase;
28582
+ var _a197, SQLiteInsertBuilder, _a198, _b142, SQLiteInsertBase;
27808
28583
  var init_insert2 = __esm({
27809
28584
  "../drizzle-orm/dist/sqlite-core/query-builders/insert.js"() {
27810
28585
  "use strict";
@@ -27814,7 +28589,7 @@ var init_insert2 = __esm({
27814
28589
  init_table3();
27815
28590
  init_table();
27816
28591
  init_utils2();
27817
- _a195 = entityKind;
28592
+ _a197 = entityKind;
27818
28593
  SQLiteInsertBuilder = class {
27819
28594
  constructor(table4, session, dialect4, withList) {
27820
28595
  this.table = table4;
@@ -27839,8 +28614,8 @@ var init_insert2 = __esm({
27839
28614
  return new SQLiteInsertBase(this.table, mappedValues, this.session, this.dialect, this.withList);
27840
28615
  }
27841
28616
  };
27842
- __publicField(SQLiteInsertBuilder, _a195, "SQLiteInsertBuilder");
27843
- SQLiteInsertBase = class extends (_b142 = QueryPromise, _a196 = entityKind, _b142) {
28617
+ __publicField(SQLiteInsertBuilder, _a197, "SQLiteInsertBuilder");
28618
+ SQLiteInsertBase = class extends (_b142 = QueryPromise, _a198 = entityKind, _b142) {
27844
28619
  constructor(table4, values, session, dialect4, withList) {
27845
28620
  super();
27846
28621
  /** @internal */
@@ -27967,25 +28742,25 @@ var init_insert2 = __esm({
27967
28742
  return this;
27968
28743
  }
27969
28744
  };
27970
- __publicField(SQLiteInsertBase, _a196, "SQLiteInsert");
28745
+ __publicField(SQLiteInsertBase, _a198, "SQLiteInsert");
27971
28746
  }
27972
28747
  });
27973
28748
 
27974
28749
  // ../drizzle-orm/dist/sqlite-core/view-base.js
27975
- var _a197, _b143, SQLiteViewBase;
28750
+ var _a199, _b143, SQLiteViewBase;
27976
28751
  var init_view_base2 = __esm({
27977
28752
  "../drizzle-orm/dist/sqlite-core/view-base.js"() {
27978
28753
  "use strict";
27979
28754
  init_entity();
27980
28755
  init_sql();
27981
- SQLiteViewBase = class extends (_b143 = View, _a197 = entityKind, _b143) {
28756
+ SQLiteViewBase = class extends (_b143 = View, _a199 = entityKind, _b143) {
27982
28757
  };
27983
- __publicField(SQLiteViewBase, _a197, "SQLiteViewBase");
28758
+ __publicField(SQLiteViewBase, _a199, "SQLiteViewBase");
27984
28759
  }
27985
28760
  });
27986
28761
 
27987
28762
  // ../drizzle-orm/dist/sqlite-core/dialect.js
27988
- var _a198, SQLiteDialect, _a199, _b144, SQLiteSyncDialect, _a200, _b145, SQLiteAsyncDialect;
28763
+ var _a200, SQLiteDialect, _a201, _b144, SQLiteSyncDialect, _a202, _b145, SQLiteAsyncDialect;
27989
28764
  var init_dialect2 = __esm({
27990
28765
  "../drizzle-orm/dist/sqlite-core/dialect.js"() {
27991
28766
  "use strict";
@@ -28004,7 +28779,7 @@ var init_dialect2 = __esm({
28004
28779
  init_utils2();
28005
28780
  init_view_common();
28006
28781
  init_view_base2();
28007
- _a198 = entityKind;
28782
+ _a200 = entityKind;
28008
28783
  SQLiteDialect = class {
28009
28784
  constructor(config) {
28010
28785
  /** @internal */
@@ -28516,8 +29291,8 @@ var init_dialect2 = __esm({
28516
29291
  };
28517
29292
  }
28518
29293
  };
28519
- __publicField(SQLiteDialect, _a198, "SQLiteDialect");
28520
- SQLiteSyncDialect = class extends (_b144 = SQLiteDialect, _a199 = entityKind, _b144) {
29294
+ __publicField(SQLiteDialect, _a200, "SQLiteDialect");
29295
+ SQLiteSyncDialect = class extends (_b144 = SQLiteDialect, _a201 = entityKind, _b144) {
28521
29296
  migrate(migrations, session, config) {
28522
29297
  const migrationsTable = config === void 0 ? "__drizzle_migrations" : typeof config === "string" ? "__drizzle_migrations" : config.migrationsTable ?? "__drizzle_migrations";
28523
29298
  const migrationTableCreate = sql`
@@ -28551,8 +29326,8 @@ var init_dialect2 = __esm({
28551
29326
  }
28552
29327
  }
28553
29328
  };
28554
- __publicField(SQLiteSyncDialect, _a199, "SQLiteSyncDialect");
28555
- SQLiteAsyncDialect = class extends (_b145 = SQLiteDialect, _a200 = entityKind, _b145) {
29329
+ __publicField(SQLiteSyncDialect, _a201, "SQLiteSyncDialect");
29330
+ SQLiteAsyncDialect = class extends (_b145 = SQLiteDialect, _a202 = entityKind, _b145) {
28556
29331
  async migrate(migrations, session, config) {
28557
29332
  const migrationsTable = config === void 0 ? "__drizzle_migrations" : typeof config === "string" ? "__drizzle_migrations" : config.migrationsTable ?? "__drizzle_migrations";
28558
29333
  const migrationTableCreate = sql`
@@ -28581,7 +29356,7 @@ var init_dialect2 = __esm({
28581
29356
  });
28582
29357
  }
28583
29358
  };
28584
- __publicField(SQLiteAsyncDialect, _a200, "SQLiteAsyncDialect");
29359
+ __publicField(SQLiteAsyncDialect, _a202, "SQLiteAsyncDialect");
28585
29360
  }
28586
29361
  });
28587
29362
 
@@ -28603,7 +29378,7 @@ function createSetOperator2(type, isAll) {
28603
29378
  return leftSelect.addSetOperators(setOperators);
28604
29379
  };
28605
29380
  }
28606
- var _a201, SQLiteSelectBuilder, _a202, _b146, SQLiteSelectQueryBuilderBase, _a203, _b147, SQLiteSelectBase, getSQLiteSetOperators, union2, unionAll2, intersect2, except2;
29381
+ var _a203, SQLiteSelectBuilder, _a204, _b146, SQLiteSelectQueryBuilderBase, _a205, _b147, SQLiteSelectBase, getSQLiteSetOperators, union2, unionAll2, intersect2, except2;
28607
29382
  var init_select3 = __esm({
28608
29383
  "../drizzle-orm/dist/sqlite-core/query-builders/select.js"() {
28609
29384
  "use strict";
@@ -28617,7 +29392,7 @@ var init_select3 = __esm({
28617
29392
  init_utils2();
28618
29393
  init_view_common();
28619
29394
  init_view_base2();
28620
- _a201 = entityKind;
29395
+ _a203 = entityKind;
28621
29396
  SQLiteSelectBuilder = class {
28622
29397
  constructor(config) {
28623
29398
  __publicField(this, "fields");
@@ -28658,8 +29433,8 @@ var init_select3 = __esm({
28658
29433
  });
28659
29434
  }
28660
29435
  };
28661
- __publicField(SQLiteSelectBuilder, _a201, "SQLiteSelectBuilder");
28662
- SQLiteSelectQueryBuilderBase = class extends (_b146 = TypedQueryBuilder, _a202 = entityKind, _b146) {
29436
+ __publicField(SQLiteSelectBuilder, _a203, "SQLiteSelectBuilder");
29437
+ SQLiteSelectQueryBuilderBase = class extends (_b146 = TypedQueryBuilder, _a204 = entityKind, _b146) {
28663
29438
  constructor({ table: table4, fields, isPartialSelect, session, dialect: dialect4, withList, distinct }) {
28664
29439
  super();
28665
29440
  __publicField(this, "_");
@@ -29164,8 +29939,8 @@ var init_select3 = __esm({
29164
29939
  return this;
29165
29940
  }
29166
29941
  };
29167
- __publicField(SQLiteSelectQueryBuilderBase, _a202, "SQLiteSelectQueryBuilder");
29168
- SQLiteSelectBase = class extends (_b147 = SQLiteSelectQueryBuilderBase, _a203 = entityKind, _b147) {
29942
+ __publicField(SQLiteSelectQueryBuilderBase, _a204, "SQLiteSelectQueryBuilder");
29943
+ SQLiteSelectBase = class extends (_b147 = SQLiteSelectQueryBuilderBase, _a205 = entityKind, _b147) {
29169
29944
  constructor() {
29170
29945
  super(...arguments);
29171
29946
  __publicField(this, "run", (placeholderValues) => {
@@ -29203,7 +29978,7 @@ var init_select3 = __esm({
29203
29978
  return this.all();
29204
29979
  }
29205
29980
  };
29206
- __publicField(SQLiteSelectBase, _a203, "SQLiteSelect");
29981
+ __publicField(SQLiteSelectBase, _a205, "SQLiteSelect");
29207
29982
  applyMixins(SQLiteSelectBase, [QueryPromise]);
29208
29983
  getSQLiteSetOperators = () => ({
29209
29984
  union: union2,
@@ -29219,7 +29994,7 @@ var init_select3 = __esm({
29219
29994
  });
29220
29995
 
29221
29996
  // ../drizzle-orm/dist/sqlite-core/query-builders/query-builder.js
29222
- var _a204, QueryBuilder2;
29997
+ var _a206, QueryBuilder2;
29223
29998
  var init_query_builder3 = __esm({
29224
29999
  "../drizzle-orm/dist/sqlite-core/query-builders/query-builder.js"() {
29225
30000
  "use strict";
@@ -29228,7 +30003,7 @@ var init_query_builder3 = __esm({
29228
30003
  init_dialect2();
29229
30004
  init_subquery();
29230
30005
  init_select3();
29231
- _a204 = entityKind;
30006
+ _a206 = entityKind;
29232
30007
  QueryBuilder2 = class {
29233
30008
  constructor(dialect4) {
29234
30009
  __publicField(this, "dialect");
@@ -29290,7 +30065,7 @@ var init_query_builder3 = __esm({
29290
30065
  return this.dialect;
29291
30066
  }
29292
30067
  };
29293
- __publicField(QueryBuilder2, _a204, "SQLiteQueryBuilder");
30068
+ __publicField(QueryBuilder2, _a206, "SQLiteQueryBuilder");
29294
30069
  }
29295
30070
  });
29296
30071
 
@@ -29302,7 +30077,7 @@ var init_select_types2 = __esm({
29302
30077
  });
29303
30078
 
29304
30079
  // ../drizzle-orm/dist/sqlite-core/query-builders/update.js
29305
- var _a205, SQLiteUpdateBuilder, _a206, _b148, SQLiteUpdateBase;
30080
+ var _a207, SQLiteUpdateBuilder, _a208, _b148, SQLiteUpdateBase;
29306
30081
  var init_update2 = __esm({
29307
30082
  "../drizzle-orm/dist/sqlite-core/query-builders/update.js"() {
29308
30083
  "use strict";
@@ -29310,7 +30085,7 @@ var init_update2 = __esm({
29310
30085
  init_query_promise();
29311
30086
  init_table3();
29312
30087
  init_utils2();
29313
- _a205 = entityKind;
30088
+ _a207 = entityKind;
29314
30089
  SQLiteUpdateBuilder = class {
29315
30090
  constructor(table4, session, dialect4, withList) {
29316
30091
  this.table = table4;
@@ -29328,8 +30103,8 @@ var init_update2 = __esm({
29328
30103
  );
29329
30104
  }
29330
30105
  };
29331
- __publicField(SQLiteUpdateBuilder, _a205, "SQLiteUpdateBuilder");
29332
- SQLiteUpdateBase = class extends (_b148 = QueryPromise, _a206 = entityKind, _b148) {
30106
+ __publicField(SQLiteUpdateBuilder, _a207, "SQLiteUpdateBuilder");
30107
+ SQLiteUpdateBase = class extends (_b148 = QueryPromise, _a208 = entityKind, _b148) {
29333
30108
  constructor(table4, set, session, dialect4, withList) {
29334
30109
  super();
29335
30110
  /** @internal */
@@ -29418,7 +30193,7 @@ var init_update2 = __esm({
29418
30193
  return this;
29419
30194
  }
29420
30195
  };
29421
- __publicField(SQLiteUpdateBase, _a206, "SQLiteUpdate");
30196
+ __publicField(SQLiteUpdateBase, _a208, "SQLiteUpdate");
29422
30197
  }
29423
30198
  });
29424
30199
 
@@ -29436,17 +30211,17 @@ var init_query_builders2 = __esm({
29436
30211
  });
29437
30212
 
29438
30213
  // ../drizzle-orm/dist/sqlite-core/query-builders/count.js
29439
- var _a207, _b149, _c7, _SQLiteCountBuilder, SQLiteCountBuilder;
30214
+ var _a209, _b149, _c7, _SQLiteCountBuilder, SQLiteCountBuilder;
29440
30215
  var init_count2 = __esm({
29441
30216
  "../drizzle-orm/dist/sqlite-core/query-builders/count.js"() {
29442
30217
  "use strict";
29443
30218
  init_entity();
29444
30219
  init_sql();
29445
- _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b149 = entityKind, _a207 = Symbol.toStringTag, _c7) {
30220
+ _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b149 = entityKind, _a209 = Symbol.toStringTag, _c7) {
29446
30221
  constructor(params) {
29447
30222
  super(_SQLiteCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
29448
30223
  __publicField(this, "sql");
29449
- __publicField(this, _a207, "SQLiteCountBuilderAsync");
30224
+ __publicField(this, _a209, "SQLiteCountBuilderAsync");
29450
30225
  __publicField(this, "session");
29451
30226
  this.params = params;
29452
30227
  this.session = params.session;
@@ -29489,14 +30264,14 @@ var init_count2 = __esm({
29489
30264
  });
29490
30265
 
29491
30266
  // ../drizzle-orm/dist/sqlite-core/query-builders/query.js
29492
- var _a208, RelationalQueryBuilder2, _a209, _b150, SQLiteRelationalQuery, _a210, _b151, SQLiteSyncRelationalQuery;
30267
+ var _a210, RelationalQueryBuilder2, _a211, _b150, SQLiteRelationalQuery, _a212, _b151, SQLiteSyncRelationalQuery;
29493
30268
  var init_query2 = __esm({
29494
30269
  "../drizzle-orm/dist/sqlite-core/query-builders/query.js"() {
29495
30270
  "use strict";
29496
30271
  init_entity();
29497
30272
  init_query_promise();
29498
30273
  init_relations();
29499
- _a208 = entityKind;
30274
+ _a210 = entityKind;
29500
30275
  RelationalQueryBuilder2 = class {
29501
30276
  constructor(mode, fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session) {
29502
30277
  this.mode = mode;
@@ -29555,8 +30330,8 @@ var init_query2 = __esm({
29555
30330
  );
29556
30331
  }
29557
30332
  };
29558
- __publicField(RelationalQueryBuilder2, _a208, "SQLiteAsyncRelationalQueryBuilder");
29559
- SQLiteRelationalQuery = class extends (_b150 = QueryPromise, _a209 = entityKind, _b150) {
30333
+ __publicField(RelationalQueryBuilder2, _a210, "SQLiteAsyncRelationalQueryBuilder");
30334
+ SQLiteRelationalQuery = class extends (_b150 = QueryPromise, _a211 = entityKind, _b150) {
29560
30335
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, config, mode) {
29561
30336
  super();
29562
30337
  /** @internal */
@@ -29632,24 +30407,24 @@ var init_query2 = __esm({
29632
30407
  return this.executeRaw();
29633
30408
  }
29634
30409
  };
29635
- __publicField(SQLiteRelationalQuery, _a209, "SQLiteAsyncRelationalQuery");
29636
- SQLiteSyncRelationalQuery = class extends (_b151 = SQLiteRelationalQuery, _a210 = entityKind, _b151) {
30410
+ __publicField(SQLiteRelationalQuery, _a211, "SQLiteAsyncRelationalQuery");
30411
+ SQLiteSyncRelationalQuery = class extends (_b151 = SQLiteRelationalQuery, _a212 = entityKind, _b151) {
29637
30412
  sync() {
29638
30413
  return this.executeRaw();
29639
30414
  }
29640
30415
  };
29641
- __publicField(SQLiteSyncRelationalQuery, _a210, "SQLiteSyncRelationalQuery");
30416
+ __publicField(SQLiteSyncRelationalQuery, _a212, "SQLiteSyncRelationalQuery");
29642
30417
  }
29643
30418
  });
29644
30419
 
29645
30420
  // ../drizzle-orm/dist/sqlite-core/query-builders/raw.js
29646
- var _a211, _b152, SQLiteRaw;
30421
+ var _a213, _b152, SQLiteRaw;
29647
30422
  var init_raw2 = __esm({
29648
30423
  "../drizzle-orm/dist/sqlite-core/query-builders/raw.js"() {
29649
30424
  "use strict";
29650
30425
  init_entity();
29651
30426
  init_query_promise();
29652
- SQLiteRaw = class extends (_b152 = QueryPromise, _a211 = entityKind, _b152) {
30427
+ SQLiteRaw = class extends (_b152 = QueryPromise, _a213 = entityKind, _b152) {
29653
30428
  constructor(execute, getSQL, action, dialect4, mapBatchResult) {
29654
30429
  super();
29655
30430
  /** @internal */
@@ -29674,12 +30449,12 @@ var init_raw2 = __esm({
29674
30449
  return false;
29675
30450
  }
29676
30451
  };
29677
- __publicField(SQLiteRaw, _a211, "SQLiteRaw");
30452
+ __publicField(SQLiteRaw, _a213, "SQLiteRaw");
29678
30453
  }
29679
30454
  });
29680
30455
 
29681
30456
  // ../drizzle-orm/dist/sqlite-core/db.js
29682
- var _a212, BaseSQLiteDatabase;
30457
+ var _a214, BaseSQLiteDatabase;
29683
30458
  var init_db2 = __esm({
29684
30459
  "../drizzle-orm/dist/sqlite-core/db.js"() {
29685
30460
  "use strict";
@@ -29691,7 +30466,7 @@ var init_db2 = __esm({
29691
30466
  init_count2();
29692
30467
  init_query2();
29693
30468
  init_raw2();
29694
- _a212 = entityKind;
30469
+ _a214 = entityKind;
29695
30470
  BaseSQLiteDatabase = class {
29696
30471
  constructor(resultKind, dialect4, session, schema4) {
29697
30472
  __publicField(this, "query");
@@ -29973,17 +30748,17 @@ var init_db2 = __esm({
29973
30748
  return this.session.transaction(transaction, config);
29974
30749
  }
29975
30750
  };
29976
- __publicField(BaseSQLiteDatabase, _a212, "BaseSQLiteDatabase");
30751
+ __publicField(BaseSQLiteDatabase, _a214, "BaseSQLiteDatabase");
29977
30752
  }
29978
30753
  });
29979
30754
 
29980
30755
  // ../drizzle-orm/dist/sqlite-core/indexes.js
29981
- var _a213, IndexBuilderOn2, _a214, IndexBuilder2, _a215, Index4;
30756
+ var _a215, IndexBuilderOn2, _a216, IndexBuilder2, _a217, Index4;
29982
30757
  var init_indexes2 = __esm({
29983
30758
  "../drizzle-orm/dist/sqlite-core/indexes.js"() {
29984
30759
  "use strict";
29985
30760
  init_entity();
29986
- _a213 = entityKind;
30761
+ _a215 = entityKind;
29987
30762
  IndexBuilderOn2 = class {
29988
30763
  constructor(name2, unique) {
29989
30764
  this.name = name2;
@@ -29993,8 +30768,8 @@ var init_indexes2 = __esm({
29993
30768
  return new IndexBuilder2(this.name, columns, this.unique);
29994
30769
  }
29995
30770
  };
29996
- __publicField(IndexBuilderOn2, _a213, "SQLiteIndexBuilderOn");
29997
- _a214 = entityKind;
30771
+ __publicField(IndexBuilderOn2, _a215, "SQLiteIndexBuilderOn");
30772
+ _a216 = entityKind;
29998
30773
  IndexBuilder2 = class {
29999
30774
  constructor(name2, columns, unique) {
30000
30775
  /** @internal */
@@ -30018,26 +30793,26 @@ var init_indexes2 = __esm({
30018
30793
  return new Index4(this.config, table4);
30019
30794
  }
30020
30795
  };
30021
- __publicField(IndexBuilder2, _a214, "SQLiteIndexBuilder");
30022
- _a215 = entityKind;
30796
+ __publicField(IndexBuilder2, _a216, "SQLiteIndexBuilder");
30797
+ _a217 = entityKind;
30023
30798
  Index4 = class {
30024
30799
  constructor(config, table4) {
30025
30800
  __publicField(this, "config");
30026
30801
  this.config = { ...config, table: table4 };
30027
30802
  }
30028
30803
  };
30029
- __publicField(Index4, _a215, "SQLiteIndex");
30804
+ __publicField(Index4, _a217, "SQLiteIndex");
30030
30805
  }
30031
30806
  });
30032
30807
 
30033
30808
  // ../drizzle-orm/dist/sqlite-core/primary-keys.js
30034
- var _a216, PrimaryKeyBuilder2, _a217, PrimaryKey2;
30809
+ var _a218, PrimaryKeyBuilder2, _a219, PrimaryKey2;
30035
30810
  var init_primary_keys2 = __esm({
30036
30811
  "../drizzle-orm/dist/sqlite-core/primary-keys.js"() {
30037
30812
  "use strict";
30038
30813
  init_entity();
30039
30814
  init_table3();
30040
- _a216 = entityKind;
30815
+ _a218 = entityKind;
30041
30816
  PrimaryKeyBuilder2 = class {
30042
30817
  constructor(columns, name2) {
30043
30818
  /** @internal */
@@ -30052,8 +30827,8 @@ var init_primary_keys2 = __esm({
30052
30827
  return new PrimaryKey2(table4, this.columns, this.name);
30053
30828
  }
30054
30829
  };
30055
- __publicField(PrimaryKeyBuilder2, _a216, "SQLitePrimaryKeyBuilder");
30056
- _a217 = entityKind;
30830
+ __publicField(PrimaryKeyBuilder2, _a218, "SQLitePrimaryKeyBuilder");
30831
+ _a219 = entityKind;
30057
30832
  PrimaryKey2 = class {
30058
30833
  constructor(table4, columns, name2) {
30059
30834
  __publicField(this, "columns");
@@ -30066,12 +30841,12 @@ var init_primary_keys2 = __esm({
30066
30841
  return this.name ?? `${this.table[SQLiteTable.Symbol.Name]}_${this.columns.map((column4) => column4.name).join("_")}_pk`;
30067
30842
  }
30068
30843
  };
30069
- __publicField(PrimaryKey2, _a217, "SQLitePrimaryKey");
30844
+ __publicField(PrimaryKey2, _a219, "SQLitePrimaryKey");
30070
30845
  }
30071
30846
  });
30072
30847
 
30073
30848
  // ../drizzle-orm/dist/sqlite-core/session.js
30074
- var _a218, _b153, ExecuteResultSync, _a219, SQLitePreparedQuery, _a220, SQLiteSession, _a221, _b154, SQLiteTransaction;
30849
+ var _a220, _b153, ExecuteResultSync, _a221, SQLitePreparedQuery, _a222, SQLiteSession, _a223, _b154, SQLiteTransaction;
30075
30850
  var init_session2 = __esm({
30076
30851
  "../drizzle-orm/dist/sqlite-core/session.js"() {
30077
30852
  "use strict";
@@ -30079,7 +30854,7 @@ var init_session2 = __esm({
30079
30854
  init_errors();
30080
30855
  init_query_promise();
30081
30856
  init_db2();
30082
- ExecuteResultSync = class extends (_b153 = QueryPromise, _a218 = entityKind, _b153) {
30857
+ ExecuteResultSync = class extends (_b153 = QueryPromise, _a220 = entityKind, _b153) {
30083
30858
  constructor(resultCb) {
30084
30859
  super();
30085
30860
  this.resultCb = resultCb;
@@ -30091,8 +30866,8 @@ var init_session2 = __esm({
30091
30866
  return this.resultCb();
30092
30867
  }
30093
30868
  };
30094
- __publicField(ExecuteResultSync, _a218, "ExecuteResultSync");
30095
- _a219 = entityKind;
30869
+ __publicField(ExecuteResultSync, _a220, "ExecuteResultSync");
30870
+ _a221 = entityKind;
30096
30871
  SQLitePreparedQuery = class {
30097
30872
  constructor(mode, executeMethod, query) {
30098
30873
  /** @internal */
@@ -30133,8 +30908,8 @@ var init_session2 = __esm({
30133
30908
  }
30134
30909
  }
30135
30910
  };
30136
- __publicField(SQLitePreparedQuery, _a219, "PreparedQuery");
30137
- _a220 = entityKind;
30911
+ __publicField(SQLitePreparedQuery, _a221, "PreparedQuery");
30912
+ _a222 = entityKind;
30138
30913
  SQLiteSession = class {
30139
30914
  constructor(dialect4) {
30140
30915
  this.dialect = dialect4;
@@ -30180,8 +30955,8 @@ var init_session2 = __esm({
30180
30955
  throw new Error("Not implemented");
30181
30956
  }
30182
30957
  };
30183
- __publicField(SQLiteSession, _a220, "SQLiteSession");
30184
- SQLiteTransaction = class extends (_b154 = BaseSQLiteDatabase, _a221 = entityKind, _b154) {
30958
+ __publicField(SQLiteSession, _a222, "SQLiteSession");
30959
+ SQLiteTransaction = class extends (_b154 = BaseSQLiteDatabase, _a223 = entityKind, _b154) {
30185
30960
  constructor(resultType, dialect4, session, schema4, nestedIndex = 0) {
30186
30961
  super(resultType, dialect4, session, schema4);
30187
30962
  this.schema = schema4;
@@ -30191,7 +30966,7 @@ var init_session2 = __esm({
30191
30966
  throw new TransactionRollbackError();
30192
30967
  }
30193
30968
  };
30194
- __publicField(SQLiteTransaction, _a221, "SQLiteTransaction");
30969
+ __publicField(SQLiteTransaction, _a223, "SQLiteTransaction");
30195
30970
  }
30196
30971
  });
30197
30972
 
@@ -30262,7 +31037,7 @@ var init_utils6 = __esm({
30262
31037
  });
30263
31038
 
30264
31039
  // ../drizzle-orm/dist/sqlite-core/view.js
30265
- var _a222, ViewBuilderCore, _a223, _b155, ViewBuilder2, _a224, _b156, ManualViewBuilder2, _a225, _b157, _c8, SQLiteView;
31040
+ var _a224, ViewBuilderCore, _a225, _b155, ViewBuilder2, _a226, _b156, ManualViewBuilder2, _a227, _b157, _c8, SQLiteView;
30266
31041
  var init_view2 = __esm({
30267
31042
  "../drizzle-orm/dist/sqlite-core/view.js"() {
30268
31043
  "use strict";
@@ -30273,15 +31048,15 @@ var init_view2 = __esm({
30273
31048
  init_table3();
30274
31049
  init_view_base2();
30275
31050
  init_view_common3();
30276
- _a222 = entityKind;
31051
+ _a224 = entityKind;
30277
31052
  ViewBuilderCore = class {
30278
31053
  constructor(name2) {
30279
31054
  __publicField(this, "config", {});
30280
31055
  this.name = name2;
30281
31056
  }
30282
31057
  };
30283
- __publicField(ViewBuilderCore, _a222, "SQLiteViewBuilderCore");
30284
- ViewBuilder2 = class extends (_b155 = ViewBuilderCore, _a223 = entityKind, _b155) {
31058
+ __publicField(ViewBuilderCore, _a224, "SQLiteViewBuilderCore");
31059
+ ViewBuilder2 = class extends (_b155 = ViewBuilderCore, _a225 = entityKind, _b155) {
30285
31060
  as(qb) {
30286
31061
  if (typeof qb === "function") {
30287
31062
  qb = qb(new QueryBuilder2());
@@ -30307,8 +31082,8 @@ var init_view2 = __esm({
30307
31082
  );
30308
31083
  }
30309
31084
  };
30310
- __publicField(ViewBuilder2, _a223, "SQLiteViewBuilder");
30311
- ManualViewBuilder2 = class extends (_b156 = ViewBuilderCore, _a224 = entityKind, _b156) {
31085
+ __publicField(ViewBuilder2, _a225, "SQLiteViewBuilder");
31086
+ ManualViewBuilder2 = class extends (_b156 = ViewBuilderCore, _a226 = entityKind, _b156) {
30312
31087
  constructor(name2, columns) {
30313
31088
  super(name2);
30314
31089
  __publicField(this, "columns");
@@ -30353,12 +31128,12 @@ var init_view2 = __esm({
30353
31128
  );
30354
31129
  }
30355
31130
  };
30356
- __publicField(ManualViewBuilder2, _a224, "SQLiteManualViewBuilder");
30357
- SQLiteView = class extends (_c8 = SQLiteViewBase, _b157 = entityKind, _a225 = SQLiteViewConfig, _c8) {
31131
+ __publicField(ManualViewBuilder2, _a226, "SQLiteManualViewBuilder");
31132
+ SQLiteView = class extends (_c8 = SQLiteViewBase, _b157 = entityKind, _a227 = SQLiteViewConfig, _c8) {
30358
31133
  constructor({ sqliteConfig, config }) {
30359
31134
  super(config);
30360
31135
  /** @internal */
30361
- __publicField(this, _a225);
31136
+ __publicField(this, _a227);
30362
31137
  this[SQLiteViewConfig] = sqliteConfig;
30363
31138
  }
30364
31139
  };
@@ -30895,12 +31670,12 @@ var init_alias4 = __esm({
30895
31670
  });
30896
31671
 
30897
31672
  // ../drizzle-orm/dist/mysql-core/checks.js
30898
- var _a226, CheckBuilder3, _a227, Check3;
31673
+ var _a228, CheckBuilder3, _a229, Check3;
30899
31674
  var init_checks3 = __esm({
30900
31675
  "../drizzle-orm/dist/mysql-core/checks.js"() {
30901
31676
  "use strict";
30902
31677
  init_entity();
30903
- _a226 = entityKind;
31678
+ _a228 = entityKind;
30904
31679
  CheckBuilder3 = class {
30905
31680
  constructor(name2, value) {
30906
31681
  __publicField(this, "brand");
@@ -30912,8 +31687,8 @@ var init_checks3 = __esm({
30912
31687
  return new Check3(table4, this);
30913
31688
  }
30914
31689
  };
30915
- __publicField(CheckBuilder3, _a226, "MySqlCheckBuilder");
30916
- _a227 = entityKind;
31690
+ __publicField(CheckBuilder3, _a228, "MySqlCheckBuilder");
31691
+ _a229 = entityKind;
30917
31692
  Check3 = class {
30918
31693
  constructor(table4, builder) {
30919
31694
  __publicField(this, "name");
@@ -30923,18 +31698,18 @@ var init_checks3 = __esm({
30923
31698
  this.value = builder.value;
30924
31699
  }
30925
31700
  };
30926
- __publicField(Check3, _a227, "MySqlCheck");
31701
+ __publicField(Check3, _a229, "MySqlCheck");
30927
31702
  }
30928
31703
  });
30929
31704
 
30930
31705
  // ../drizzle-orm/dist/mysql-core/foreign-keys.js
30931
- var _a228, ForeignKeyBuilder3, _a229, ForeignKey3;
31706
+ var _a230, ForeignKeyBuilder3, _a231, ForeignKey3;
30932
31707
  var init_foreign_keys3 = __esm({
30933
31708
  "../drizzle-orm/dist/mysql-core/foreign-keys.js"() {
30934
31709
  "use strict";
30935
31710
  init_entity();
30936
31711
  init_table_utils();
30937
- _a228 = entityKind;
31712
+ _a230 = entityKind;
30938
31713
  ForeignKeyBuilder3 = class {
30939
31714
  constructor(config, actions) {
30940
31715
  /** @internal */
@@ -30965,8 +31740,8 @@ var init_foreign_keys3 = __esm({
30965
31740
  return new ForeignKey3(table4, this);
30966
31741
  }
30967
31742
  };
30968
- __publicField(ForeignKeyBuilder3, _a228, "MySqlForeignKeyBuilder");
30969
- _a229 = entityKind;
31743
+ __publicField(ForeignKeyBuilder3, _a230, "MySqlForeignKeyBuilder");
31744
+ _a231 = entityKind;
30970
31745
  ForeignKey3 = class {
30971
31746
  constructor(table4, builder) {
30972
31747
  __publicField(this, "reference");
@@ -30990,7 +31765,7 @@ var init_foreign_keys3 = __esm({
30990
31765
  return name2 ?? `${chunks.join("_")}_fk`;
30991
31766
  }
30992
31767
  };
30993
- __publicField(ForeignKey3, _a229, "MySqlForeignKey");
31768
+ __publicField(ForeignKey3, _a231, "MySqlForeignKey");
30994
31769
  }
30995
31770
  });
30996
31771
 
@@ -30998,13 +31773,13 @@ var init_foreign_keys3 = __esm({
30998
31773
  function uniqueKeyName3(table4, columns) {
30999
31774
  return `${table4[TableName]}_${columns.join("_")}_unique`;
31000
31775
  }
31001
- var _a230, UniqueConstraintBuilder3, _a231, UniqueOnConstraintBuilder3, _a232, UniqueConstraint3;
31776
+ var _a232, UniqueConstraintBuilder3, _a233, UniqueOnConstraintBuilder3, _a234, UniqueConstraint3;
31002
31777
  var init_unique_constraint3 = __esm({
31003
31778
  "../drizzle-orm/dist/mysql-core/unique-constraint.js"() {
31004
31779
  "use strict";
31005
31780
  init_entity();
31006
31781
  init_table_utils();
31007
- _a230 = entityKind;
31782
+ _a232 = entityKind;
31008
31783
  UniqueConstraintBuilder3 = class {
31009
31784
  constructor(columns, name2) {
31010
31785
  /** @internal */
@@ -31017,8 +31792,8 @@ var init_unique_constraint3 = __esm({
31017
31792
  return new UniqueConstraint3(table4, this.columns, this.name);
31018
31793
  }
31019
31794
  };
31020
- __publicField(UniqueConstraintBuilder3, _a230, "MySqlUniqueConstraintBuilder");
31021
- _a231 = entityKind;
31795
+ __publicField(UniqueConstraintBuilder3, _a232, "MySqlUniqueConstraintBuilder");
31796
+ _a233 = entityKind;
31022
31797
  UniqueOnConstraintBuilder3 = class {
31023
31798
  constructor(name2) {
31024
31799
  /** @internal */
@@ -31029,8 +31804,8 @@ var init_unique_constraint3 = __esm({
31029
31804
  return new UniqueConstraintBuilder3(columns, this.name);
31030
31805
  }
31031
31806
  };
31032
- __publicField(UniqueOnConstraintBuilder3, _a231, "MySqlUniqueOnConstraintBuilder");
31033
- _a232 = entityKind;
31807
+ __publicField(UniqueOnConstraintBuilder3, _a233, "MySqlUniqueOnConstraintBuilder");
31808
+ _a234 = entityKind;
31034
31809
  UniqueConstraint3 = class {
31035
31810
  constructor(table4, columns, name2) {
31036
31811
  __publicField(this, "columns");
@@ -31044,12 +31819,12 @@ var init_unique_constraint3 = __esm({
31044
31819
  return this.name;
31045
31820
  }
31046
31821
  };
31047
- __publicField(UniqueConstraint3, _a232, "MySqlUniqueConstraint");
31822
+ __publicField(UniqueConstraint3, _a234, "MySqlUniqueConstraint");
31048
31823
  }
31049
31824
  });
31050
31825
 
31051
31826
  // ../drizzle-orm/dist/mysql-core/columns/common.js
31052
- var _a233, _b158, MySqlColumnBuilder, _a234, _b159, MySqlColumn, _a235, _b160, MySqlColumnBuilderWithAutoIncrement, _a236, _b161, MySqlColumnWithAutoIncrement;
31827
+ var _a235, _b158, MySqlColumnBuilder, _a236, _b159, MySqlColumn, _a237, _b160, MySqlColumnBuilderWithAutoIncrement, _a238, _b161, MySqlColumnWithAutoIncrement;
31053
31828
  var init_common4 = __esm({
31054
31829
  "../drizzle-orm/dist/mysql-core/columns/common.js"() {
31055
31830
  "use strict";
@@ -31058,7 +31833,7 @@ var init_common4 = __esm({
31058
31833
  init_entity();
31059
31834
  init_foreign_keys3();
31060
31835
  init_unique_constraint3();
31061
- MySqlColumnBuilder = class extends (_b158 = ColumnBuilder, _a233 = entityKind, _b158) {
31836
+ MySqlColumnBuilder = class extends (_b158 = ColumnBuilder, _a235 = entityKind, _b158) {
31062
31837
  constructor() {
31063
31838
  super(...arguments);
31064
31839
  __publicField(this, "foreignKeyConfigs", []);
@@ -31099,8 +31874,8 @@ var init_common4 = __esm({
31099
31874
  });
31100
31875
  }
31101
31876
  };
31102
- __publicField(MySqlColumnBuilder, _a233, "MySqlColumnBuilder");
31103
- MySqlColumn = class extends (_b159 = Column2, _a234 = entityKind, _b159) {
31877
+ __publicField(MySqlColumnBuilder, _a235, "MySqlColumnBuilder");
31878
+ MySqlColumn = class extends (_b159 = Column2, _a236 = entityKind, _b159) {
31104
31879
  constructor(table4, config) {
31105
31880
  if (!config.uniqueName) {
31106
31881
  config.uniqueName = uniqueKeyName3(table4, [config.name]);
@@ -31109,8 +31884,8 @@ var init_common4 = __esm({
31109
31884
  this.table = table4;
31110
31885
  }
31111
31886
  };
31112
- __publicField(MySqlColumn, _a234, "MySqlColumn");
31113
- MySqlColumnBuilderWithAutoIncrement = class extends (_b160 = MySqlColumnBuilder, _a235 = entityKind, _b160) {
31887
+ __publicField(MySqlColumn, _a236, "MySqlColumn");
31888
+ MySqlColumnBuilderWithAutoIncrement = class extends (_b160 = MySqlColumnBuilder, _a237 = entityKind, _b160) {
31114
31889
  constructor(name2, dataType, columnType) {
31115
31890
  super(name2, dataType, columnType);
31116
31891
  this.config.autoIncrement = false;
@@ -31121,14 +31896,14 @@ var init_common4 = __esm({
31121
31896
  return this;
31122
31897
  }
31123
31898
  };
31124
- __publicField(MySqlColumnBuilderWithAutoIncrement, _a235, "MySqlColumnBuilderWithAutoIncrement");
31125
- MySqlColumnWithAutoIncrement = class extends (_b161 = MySqlColumn, _a236 = entityKind, _b161) {
31899
+ __publicField(MySqlColumnBuilderWithAutoIncrement, _a237, "MySqlColumnBuilderWithAutoIncrement");
31900
+ MySqlColumnWithAutoIncrement = class extends (_b161 = MySqlColumn, _a238 = entityKind, _b161) {
31126
31901
  constructor() {
31127
31902
  super(...arguments);
31128
31903
  __publicField(this, "autoIncrement", this.config.autoIncrement);
31129
31904
  }
31130
31905
  };
31131
- __publicField(MySqlColumnWithAutoIncrement, _a236, "MySqlColumnWithAutoIncrement");
31906
+ __publicField(MySqlColumnWithAutoIncrement, _a238, "MySqlColumnWithAutoIncrement");
31132
31907
  }
31133
31908
  });
31134
31909
 
@@ -31140,14 +31915,14 @@ function bigint2(a, b) {
31140
31915
  }
31141
31916
  return new MySqlBigInt64Builder(name2, config.unsigned);
31142
31917
  }
31143
- var _a237, _b162, MySqlBigInt53Builder, _a238, _b163, MySqlBigInt53, _a239, _b164, MySqlBigInt64Builder, _a240, _b165, MySqlBigInt64;
31918
+ var _a239, _b162, MySqlBigInt53Builder, _a240, _b163, MySqlBigInt53, _a241, _b164, MySqlBigInt64Builder, _a242, _b165, MySqlBigInt64;
31144
31919
  var init_bigint2 = __esm({
31145
31920
  "../drizzle-orm/dist/mysql-core/columns/bigint.js"() {
31146
31921
  "use strict";
31147
31922
  init_entity();
31148
31923
  init_utils2();
31149
31924
  init_common4();
31150
- MySqlBigInt53Builder = class extends (_b162 = MySqlColumnBuilderWithAutoIncrement, _a237 = entityKind, _b162) {
31925
+ MySqlBigInt53Builder = class extends (_b162 = MySqlColumnBuilderWithAutoIncrement, _a239 = entityKind, _b162) {
31151
31926
  constructor(name2, unsigned = false) {
31152
31927
  super(name2, "number", "MySqlBigInt53");
31153
31928
  this.config.unsigned = unsigned;
@@ -31160,8 +31935,8 @@ var init_bigint2 = __esm({
31160
31935
  );
31161
31936
  }
31162
31937
  };
31163
- __publicField(MySqlBigInt53Builder, _a237, "MySqlBigInt53Builder");
31164
- MySqlBigInt53 = class extends (_b163 = MySqlColumnWithAutoIncrement, _a238 = entityKind, _b163) {
31938
+ __publicField(MySqlBigInt53Builder, _a239, "MySqlBigInt53Builder");
31939
+ MySqlBigInt53 = class extends (_b163 = MySqlColumnWithAutoIncrement, _a240 = entityKind, _b163) {
31165
31940
  getSQLType() {
31166
31941
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
31167
31942
  }
@@ -31172,8 +31947,8 @@ var init_bigint2 = __esm({
31172
31947
  return Number(value);
31173
31948
  }
31174
31949
  };
31175
- __publicField(MySqlBigInt53, _a238, "MySqlBigInt53");
31176
- MySqlBigInt64Builder = class extends (_b164 = MySqlColumnBuilderWithAutoIncrement, _a239 = entityKind, _b164) {
31950
+ __publicField(MySqlBigInt53, _a240, "MySqlBigInt53");
31951
+ MySqlBigInt64Builder = class extends (_b164 = MySqlColumnBuilderWithAutoIncrement, _a241 = entityKind, _b164) {
31177
31952
  constructor(name2, unsigned = false) {
31178
31953
  super(name2, "bigint", "MySqlBigInt64");
31179
31954
  this.config.unsigned = unsigned;
@@ -31186,8 +31961,8 @@ var init_bigint2 = __esm({
31186
31961
  );
31187
31962
  }
31188
31963
  };
31189
- __publicField(MySqlBigInt64Builder, _a239, "MySqlBigInt64Builder");
31190
- MySqlBigInt64 = class extends (_b165 = MySqlColumnWithAutoIncrement, _a240 = entityKind, _b165) {
31964
+ __publicField(MySqlBigInt64Builder, _a241, "MySqlBigInt64Builder");
31965
+ MySqlBigInt64 = class extends (_b165 = MySqlColumnWithAutoIncrement, _a242 = entityKind, _b165) {
31191
31966
  getSQLType() {
31192
31967
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
31193
31968
  }
@@ -31196,7 +31971,7 @@ var init_bigint2 = __esm({
31196
31971
  return BigInt(value);
31197
31972
  }
31198
31973
  };
31199
- __publicField(MySqlBigInt64, _a240, "MySqlBigInt64");
31974
+ __publicField(MySqlBigInt64, _a242, "MySqlBigInt64");
31200
31975
  }
31201
31976
  });
31202
31977
 
@@ -31205,14 +31980,14 @@ function binary(a, b = {}) {
31205
31980
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31206
31981
  return new MySqlBinaryBuilder(name2, config.length);
31207
31982
  }
31208
- var _a241, _b166, MySqlBinaryBuilder, _a242, _b167, MySqlBinary;
31983
+ var _a243, _b166, MySqlBinaryBuilder, _a244, _b167, MySqlBinary;
31209
31984
  var init_binary = __esm({
31210
31985
  "../drizzle-orm/dist/mysql-core/columns/binary.js"() {
31211
31986
  "use strict";
31212
31987
  init_entity();
31213
31988
  init_utils2();
31214
31989
  init_common4();
31215
- MySqlBinaryBuilder = class extends (_b166 = MySqlColumnBuilder, _a241 = entityKind, _b166) {
31990
+ MySqlBinaryBuilder = class extends (_b166 = MySqlColumnBuilder, _a243 = entityKind, _b166) {
31216
31991
  constructor(name2, length) {
31217
31992
  super(name2, "string", "MySqlBinary");
31218
31993
  this.config.length = length;
@@ -31222,8 +31997,8 @@ var init_binary = __esm({
31222
31997
  return new MySqlBinary(table4, this.config);
31223
31998
  }
31224
31999
  };
31225
- __publicField(MySqlBinaryBuilder, _a241, "MySqlBinaryBuilder");
31226
- MySqlBinary = class extends (_b167 = MySqlColumn, _a242 = entityKind, _b167) {
32000
+ __publicField(MySqlBinaryBuilder, _a243, "MySqlBinaryBuilder");
32001
+ MySqlBinary = class extends (_b167 = MySqlColumn, _a244 = entityKind, _b167) {
31227
32002
  constructor() {
31228
32003
  super(...arguments);
31229
32004
  __publicField(this, "length", this.config.length);
@@ -31232,7 +32007,7 @@ var init_binary = __esm({
31232
32007
  return this.length === void 0 ? `binary` : `binary(${this.length})`;
31233
32008
  }
31234
32009
  };
31235
- __publicField(MySqlBinary, _a242, "MySqlBinary");
32010
+ __publicField(MySqlBinary, _a244, "MySqlBinary");
31236
32011
  }
31237
32012
  });
31238
32013
 
@@ -31240,13 +32015,13 @@ var init_binary = __esm({
31240
32015
  function boolean2(name2) {
31241
32016
  return new MySqlBooleanBuilder(name2 ?? "");
31242
32017
  }
31243
- var _a243, _b168, MySqlBooleanBuilder, _a244, _b169, MySqlBoolean;
32018
+ var _a245, _b168, MySqlBooleanBuilder, _a246, _b169, MySqlBoolean;
31244
32019
  var init_boolean2 = __esm({
31245
32020
  "../drizzle-orm/dist/mysql-core/columns/boolean.js"() {
31246
32021
  "use strict";
31247
32022
  init_entity();
31248
32023
  init_common4();
31249
- MySqlBooleanBuilder = class extends (_b168 = MySqlColumnBuilder, _a243 = entityKind, _b168) {
32024
+ MySqlBooleanBuilder = class extends (_b168 = MySqlColumnBuilder, _a245 = entityKind, _b168) {
31250
32025
  constructor(name2) {
31251
32026
  super(name2, "boolean", "MySqlBoolean");
31252
32027
  }
@@ -31258,8 +32033,8 @@ var init_boolean2 = __esm({
31258
32033
  );
31259
32034
  }
31260
32035
  };
31261
- __publicField(MySqlBooleanBuilder, _a243, "MySqlBooleanBuilder");
31262
- MySqlBoolean = class extends (_b169 = MySqlColumn, _a244 = entityKind, _b169) {
32036
+ __publicField(MySqlBooleanBuilder, _a245, "MySqlBooleanBuilder");
32037
+ MySqlBoolean = class extends (_b169 = MySqlColumn, _a246 = entityKind, _b169) {
31263
32038
  getSQLType() {
31264
32039
  return "boolean";
31265
32040
  }
@@ -31270,7 +32045,7 @@ var init_boolean2 = __esm({
31270
32045
  return value === 1;
31271
32046
  }
31272
32047
  };
31273
- __publicField(MySqlBoolean, _a244, "MySqlBoolean");
32048
+ __publicField(MySqlBoolean, _a246, "MySqlBoolean");
31274
32049
  }
31275
32050
  });
31276
32051
 
@@ -31279,14 +32054,14 @@ function char2(a, b = {}) {
31279
32054
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31280
32055
  return new MySqlCharBuilder(name2, config);
31281
32056
  }
31282
- var _a245, _b170, MySqlCharBuilder, _a246, _b171, MySqlChar;
32057
+ var _a247, _b170, MySqlCharBuilder, _a248, _b171, MySqlChar;
31283
32058
  var init_char2 = __esm({
31284
32059
  "../drizzle-orm/dist/mysql-core/columns/char.js"() {
31285
32060
  "use strict";
31286
32061
  init_entity();
31287
32062
  init_utils2();
31288
32063
  init_common4();
31289
- MySqlCharBuilder = class extends (_b170 = MySqlColumnBuilder, _a245 = entityKind, _b170) {
32064
+ MySqlCharBuilder = class extends (_b170 = MySqlColumnBuilder, _a247 = entityKind, _b170) {
31290
32065
  constructor(name2, config) {
31291
32066
  super(name2, "string", "MySqlChar");
31292
32067
  this.config.length = config.length;
@@ -31300,8 +32075,8 @@ var init_char2 = __esm({
31300
32075
  );
31301
32076
  }
31302
32077
  };
31303
- __publicField(MySqlCharBuilder, _a245, "MySqlCharBuilder");
31304
- MySqlChar = class extends (_b171 = MySqlColumn, _a246 = entityKind, _b171) {
32078
+ __publicField(MySqlCharBuilder, _a247, "MySqlCharBuilder");
32079
+ MySqlChar = class extends (_b171 = MySqlColumn, _a248 = entityKind, _b171) {
31305
32080
  constructor() {
31306
32081
  super(...arguments);
31307
32082
  __publicField(this, "length", this.config.length);
@@ -31311,7 +32086,7 @@ var init_char2 = __esm({
31311
32086
  return this.length === void 0 ? `char` : `char(${this.length})`;
31312
32087
  }
31313
32088
  };
31314
- __publicField(MySqlChar, _a246, "MySqlChar");
32089
+ __publicField(MySqlChar, _a248, "MySqlChar");
31315
32090
  }
31316
32091
  });
31317
32092
 
@@ -31322,14 +32097,14 @@ function customType3(customTypeParams) {
31322
32097
  return new MySqlCustomColumnBuilder(name2, config, customTypeParams);
31323
32098
  };
31324
32099
  }
31325
- var _a247, _b172, MySqlCustomColumnBuilder, _a248, _b173, MySqlCustomColumn;
32100
+ var _a249, _b172, MySqlCustomColumnBuilder, _a250, _b173, MySqlCustomColumn;
31326
32101
  var init_custom3 = __esm({
31327
32102
  "../drizzle-orm/dist/mysql-core/columns/custom.js"() {
31328
32103
  "use strict";
31329
32104
  init_entity();
31330
32105
  init_utils2();
31331
32106
  init_common4();
31332
- MySqlCustomColumnBuilder = class extends (_b172 = MySqlColumnBuilder, _a247 = entityKind, _b172) {
32107
+ MySqlCustomColumnBuilder = class extends (_b172 = MySqlColumnBuilder, _a249 = entityKind, _b172) {
31333
32108
  constructor(name2, fieldConfig, customTypeParams) {
31334
32109
  super(name2, "custom", "MySqlCustomColumn");
31335
32110
  this.config.fieldConfig = fieldConfig;
@@ -31343,8 +32118,8 @@ var init_custom3 = __esm({
31343
32118
  );
31344
32119
  }
31345
32120
  };
31346
- __publicField(MySqlCustomColumnBuilder, _a247, "MySqlCustomColumnBuilder");
31347
- MySqlCustomColumn = class extends (_b173 = MySqlColumn, _a248 = entityKind, _b173) {
32121
+ __publicField(MySqlCustomColumnBuilder, _a249, "MySqlCustomColumnBuilder");
32122
+ MySqlCustomColumn = class extends (_b173 = MySqlColumn, _a250 = entityKind, _b173) {
31348
32123
  constructor(table4, config) {
31349
32124
  super(table4, config);
31350
32125
  __publicField(this, "sqlName");
@@ -31364,7 +32139,7 @@ var init_custom3 = __esm({
31364
32139
  return typeof this.mapTo === "function" ? this.mapTo(value) : value;
31365
32140
  }
31366
32141
  };
31367
- __publicField(MySqlCustomColumn, _a248, "MySqlCustomColumn");
32142
+ __publicField(MySqlCustomColumn, _a250, "MySqlCustomColumn");
31368
32143
  }
31369
32144
  });
31370
32145
 
@@ -31376,14 +32151,14 @@ function date2(a, b) {
31376
32151
  }
31377
32152
  return new MySqlDateBuilder(name2);
31378
32153
  }
31379
- var _a249, _b174, MySqlDateBuilder, _a250, _b175, MySqlDate, _a251, _b176, MySqlDateStringBuilder, _a252, _b177, MySqlDateString;
32154
+ var _a251, _b174, MySqlDateBuilder, _a252, _b175, MySqlDate, _a253, _b176, MySqlDateStringBuilder, _a254, _b177, MySqlDateString;
31380
32155
  var init_date2 = __esm({
31381
32156
  "../drizzle-orm/dist/mysql-core/columns/date.js"() {
31382
32157
  "use strict";
31383
32158
  init_entity();
31384
32159
  init_utils2();
31385
32160
  init_common4();
31386
- MySqlDateBuilder = class extends (_b174 = MySqlColumnBuilder, _a249 = entityKind, _b174) {
32161
+ MySqlDateBuilder = class extends (_b174 = MySqlColumnBuilder, _a251 = entityKind, _b174) {
31387
32162
  constructor(name2) {
31388
32163
  super(name2, "date", "MySqlDate");
31389
32164
  }
@@ -31392,8 +32167,8 @@ var init_date2 = __esm({
31392
32167
  return new MySqlDate(table4, this.config);
31393
32168
  }
31394
32169
  };
31395
- __publicField(MySqlDateBuilder, _a249, "MySqlDateBuilder");
31396
- MySqlDate = class extends (_b175 = MySqlColumn, _a250 = entityKind, _b175) {
32170
+ __publicField(MySqlDateBuilder, _a251, "MySqlDateBuilder");
32171
+ MySqlDate = class extends (_b175 = MySqlColumn, _a252 = entityKind, _b175) {
31397
32172
  constructor(table4, config) {
31398
32173
  super(table4, config);
31399
32174
  }
@@ -31404,8 +32179,8 @@ var init_date2 = __esm({
31404
32179
  return new Date(value);
31405
32180
  }
31406
32181
  };
31407
- __publicField(MySqlDate, _a250, "MySqlDate");
31408
- MySqlDateStringBuilder = class extends (_b176 = MySqlColumnBuilder, _a251 = entityKind, _b176) {
32182
+ __publicField(MySqlDate, _a252, "MySqlDate");
32183
+ MySqlDateStringBuilder = class extends (_b176 = MySqlColumnBuilder, _a253 = entityKind, _b176) {
31409
32184
  constructor(name2) {
31410
32185
  super(name2, "string", "MySqlDateString");
31411
32186
  }
@@ -31417,8 +32192,8 @@ var init_date2 = __esm({
31417
32192
  );
31418
32193
  }
31419
32194
  };
31420
- __publicField(MySqlDateStringBuilder, _a251, "MySqlDateStringBuilder");
31421
- MySqlDateString = class extends (_b177 = MySqlColumn, _a252 = entityKind, _b177) {
32195
+ __publicField(MySqlDateStringBuilder, _a253, "MySqlDateStringBuilder");
32196
+ MySqlDateString = class extends (_b177 = MySqlColumn, _a254 = entityKind, _b177) {
31422
32197
  constructor(table4, config) {
31423
32198
  super(table4, config);
31424
32199
  }
@@ -31426,7 +32201,7 @@ var init_date2 = __esm({
31426
32201
  return `date`;
31427
32202
  }
31428
32203
  };
31429
- __publicField(MySqlDateString, _a252, "MySqlDateString");
32204
+ __publicField(MySqlDateString, _a254, "MySqlDateString");
31430
32205
  }
31431
32206
  });
31432
32207
 
@@ -31438,14 +32213,14 @@ function datetime(a, b) {
31438
32213
  }
31439
32214
  return new MySqlDateTimeBuilder(name2, config);
31440
32215
  }
31441
- var _a253, _b178, MySqlDateTimeBuilder, _a254, _b179, MySqlDateTime, _a255, _b180, MySqlDateTimeStringBuilder, _a256, _b181, MySqlDateTimeString;
32216
+ var _a255, _b178, MySqlDateTimeBuilder, _a256, _b179, MySqlDateTime, _a257, _b180, MySqlDateTimeStringBuilder, _a258, _b181, MySqlDateTimeString;
31442
32217
  var init_datetime = __esm({
31443
32218
  "../drizzle-orm/dist/mysql-core/columns/datetime.js"() {
31444
32219
  "use strict";
31445
32220
  init_entity();
31446
32221
  init_utils2();
31447
32222
  init_common4();
31448
- MySqlDateTimeBuilder = class extends (_b178 = MySqlColumnBuilder, _a253 = entityKind, _b178) {
32223
+ MySqlDateTimeBuilder = class extends (_b178 = MySqlColumnBuilder, _a255 = entityKind, _b178) {
31449
32224
  constructor(name2, config) {
31450
32225
  super(name2, "date", "MySqlDateTime");
31451
32226
  this.config.fsp = config?.fsp;
@@ -31458,8 +32233,8 @@ var init_datetime = __esm({
31458
32233
  );
31459
32234
  }
31460
32235
  };
31461
- __publicField(MySqlDateTimeBuilder, _a253, "MySqlDateTimeBuilder");
31462
- MySqlDateTime = class extends (_b179 = MySqlColumn, _a254 = entityKind, _b179) {
32236
+ __publicField(MySqlDateTimeBuilder, _a255, "MySqlDateTimeBuilder");
32237
+ MySqlDateTime = class extends (_b179 = MySqlColumn, _a256 = entityKind, _b179) {
31463
32238
  constructor(table4, config) {
31464
32239
  super(table4, config);
31465
32240
  __publicField(this, "fsp");
@@ -31476,8 +32251,8 @@ var init_datetime = __esm({
31476
32251
  return /* @__PURE__ */ new Date(value.replace(" ", "T") + "Z");
31477
32252
  }
31478
32253
  };
31479
- __publicField(MySqlDateTime, _a254, "MySqlDateTime");
31480
- MySqlDateTimeStringBuilder = class extends (_b180 = MySqlColumnBuilder, _a255 = entityKind, _b180) {
32254
+ __publicField(MySqlDateTime, _a256, "MySqlDateTime");
32255
+ MySqlDateTimeStringBuilder = class extends (_b180 = MySqlColumnBuilder, _a257 = entityKind, _b180) {
31481
32256
  constructor(name2, config) {
31482
32257
  super(name2, "string", "MySqlDateTimeString");
31483
32258
  this.config.fsp = config?.fsp;
@@ -31490,8 +32265,8 @@ var init_datetime = __esm({
31490
32265
  );
31491
32266
  }
31492
32267
  };
31493
- __publicField(MySqlDateTimeStringBuilder, _a255, "MySqlDateTimeStringBuilder");
31494
- MySqlDateTimeString = class extends (_b181 = MySqlColumn, _a256 = entityKind, _b181) {
32268
+ __publicField(MySqlDateTimeStringBuilder, _a257, "MySqlDateTimeStringBuilder");
32269
+ MySqlDateTimeString = class extends (_b181 = MySqlColumn, _a258 = entityKind, _b181) {
31495
32270
  constructor(table4, config) {
31496
32271
  super(table4, config);
31497
32272
  __publicField(this, "fsp");
@@ -31502,7 +32277,7 @@ var init_datetime = __esm({
31502
32277
  return `datetime${precision}`;
31503
32278
  }
31504
32279
  };
31505
- __publicField(MySqlDateTimeString, _a256, "MySqlDateTimeString");
32280
+ __publicField(MySqlDateTimeString, _a258, "MySqlDateTimeString");
31506
32281
  }
31507
32282
  });
31508
32283
 
@@ -31511,14 +32286,14 @@ function decimal(a, b = {}) {
31511
32286
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31512
32287
  return new MySqlDecimalBuilder(name2, config.precision, config.scale);
31513
32288
  }
31514
- var _a257, _b182, MySqlDecimalBuilder, _a258, _b183, MySqlDecimal;
32289
+ var _a259, _b182, MySqlDecimalBuilder, _a260, _b183, MySqlDecimal;
31515
32290
  var init_decimal = __esm({
31516
32291
  "../drizzle-orm/dist/mysql-core/columns/decimal.js"() {
31517
32292
  "use strict";
31518
32293
  init_entity();
31519
32294
  init_utils2();
31520
32295
  init_common4();
31521
- MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a257 = entityKind, _b182) {
32296
+ MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b182) {
31522
32297
  constructor(name2, precision, scale) {
31523
32298
  super(name2, "string", "MySqlDecimal");
31524
32299
  this.config.precision = precision;
@@ -31532,8 +32307,8 @@ var init_decimal = __esm({
31532
32307
  );
31533
32308
  }
31534
32309
  };
31535
- __publicField(MySqlDecimalBuilder, _a257, "MySqlDecimalBuilder");
31536
- MySqlDecimal = class extends (_b183 = MySqlColumnWithAutoIncrement, _a258 = entityKind, _b183) {
32310
+ __publicField(MySqlDecimalBuilder, _a259, "MySqlDecimalBuilder");
32311
+ MySqlDecimal = class extends (_b183 = MySqlColumnWithAutoIncrement, _a260 = entityKind, _b183) {
31537
32312
  constructor() {
31538
32313
  super(...arguments);
31539
32314
  __publicField(this, "precision", this.config.precision);
@@ -31549,7 +32324,7 @@ var init_decimal = __esm({
31549
32324
  }
31550
32325
  }
31551
32326
  };
31552
- __publicField(MySqlDecimal, _a258, "MySqlDecimal");
32327
+ __publicField(MySqlDecimal, _a260, "MySqlDecimal");
31553
32328
  }
31554
32329
  });
31555
32330
 
@@ -31558,14 +32333,14 @@ function double(a, b) {
31558
32333
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31559
32334
  return new MySqlDoubleBuilder(name2, config);
31560
32335
  }
31561
- var _a259, _b184, MySqlDoubleBuilder, _a260, _b185, MySqlDouble;
32336
+ var _a261, _b184, MySqlDoubleBuilder, _a262, _b185, MySqlDouble;
31562
32337
  var init_double = __esm({
31563
32338
  "../drizzle-orm/dist/mysql-core/columns/double.js"() {
31564
32339
  "use strict";
31565
32340
  init_entity();
31566
32341
  init_utils2();
31567
32342
  init_common4();
31568
- MySqlDoubleBuilder = class extends (_b184 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b184) {
32343
+ MySqlDoubleBuilder = class extends (_b184 = MySqlColumnBuilderWithAutoIncrement, _a261 = entityKind, _b184) {
31569
32344
  constructor(name2, config) {
31570
32345
  super(name2, "number", "MySqlDouble");
31571
32346
  this.config.precision = config?.precision;
@@ -31576,8 +32351,8 @@ var init_double = __esm({
31576
32351
  return new MySqlDouble(table4, this.config);
31577
32352
  }
31578
32353
  };
31579
- __publicField(MySqlDoubleBuilder, _a259, "MySqlDoubleBuilder");
31580
- MySqlDouble = class extends (_b185 = MySqlColumnWithAutoIncrement, _a260 = entityKind, _b185) {
32354
+ __publicField(MySqlDoubleBuilder, _a261, "MySqlDoubleBuilder");
32355
+ MySqlDouble = class extends (_b185 = MySqlColumnWithAutoIncrement, _a262 = entityKind, _b185) {
31581
32356
  constructor() {
31582
32357
  super(...arguments);
31583
32358
  __publicField(this, "precision", this.config.precision);
@@ -31593,7 +32368,7 @@ var init_double = __esm({
31593
32368
  }
31594
32369
  }
31595
32370
  };
31596
- __publicField(MySqlDouble, _a260, "MySqlDouble");
32371
+ __publicField(MySqlDouble, _a262, "MySqlDouble");
31597
32372
  }
31598
32373
  });
31599
32374
 
@@ -31605,14 +32380,14 @@ function mysqlEnum(a, b) {
31605
32380
  }
31606
32381
  return new MySqlEnumColumnBuilder(name2, values);
31607
32382
  }
31608
- var _a261, _b186, MySqlEnumColumnBuilder, _a262, _b187, MySqlEnumColumn;
32383
+ var _a263, _b186, MySqlEnumColumnBuilder, _a264, _b187, MySqlEnumColumn;
31609
32384
  var init_enum2 = __esm({
31610
32385
  "../drizzle-orm/dist/mysql-core/columns/enum.js"() {
31611
32386
  "use strict";
31612
32387
  init_entity();
31613
32388
  init_utils2();
31614
32389
  init_common4();
31615
- MySqlEnumColumnBuilder = class extends (_b186 = MySqlColumnBuilder, _a261 = entityKind, _b186) {
32390
+ MySqlEnumColumnBuilder = class extends (_b186 = MySqlColumnBuilder, _a263 = entityKind, _b186) {
31616
32391
  constructor(name2, values) {
31617
32392
  super(name2, "string", "MySqlEnumColumn");
31618
32393
  this.config.enumValues = values;
@@ -31625,8 +32400,8 @@ var init_enum2 = __esm({
31625
32400
  );
31626
32401
  }
31627
32402
  };
31628
- __publicField(MySqlEnumColumnBuilder, _a261, "MySqlEnumColumnBuilder");
31629
- MySqlEnumColumn = class extends (_b187 = MySqlColumn, _a262 = entityKind, _b187) {
32403
+ __publicField(MySqlEnumColumnBuilder, _a263, "MySqlEnumColumnBuilder");
32404
+ MySqlEnumColumn = class extends (_b187 = MySqlColumn, _a264 = entityKind, _b187) {
31630
32405
  constructor() {
31631
32406
  super(...arguments);
31632
32407
  __publicField(this, "enumValues", this.config.enumValues);
@@ -31635,7 +32410,7 @@ var init_enum2 = __esm({
31635
32410
  return `enum(${this.enumValues.map((value) => `'${value}'`).join(",")})`;
31636
32411
  }
31637
32412
  };
31638
- __publicField(MySqlEnumColumn, _a262, "MySqlEnumColumn");
32413
+ __publicField(MySqlEnumColumn, _a264, "MySqlEnumColumn");
31639
32414
  }
31640
32415
  });
31641
32416
 
@@ -31643,13 +32418,13 @@ var init_enum2 = __esm({
31643
32418
  function float(name2) {
31644
32419
  return new MySqlFloatBuilder(name2 ?? "");
31645
32420
  }
31646
- var _a263, _b188, MySqlFloatBuilder, _a264, _b189, MySqlFloat;
32421
+ var _a265, _b188, MySqlFloatBuilder, _a266, _b189, MySqlFloat;
31647
32422
  var init_float = __esm({
31648
32423
  "../drizzle-orm/dist/mysql-core/columns/float.js"() {
31649
32424
  "use strict";
31650
32425
  init_entity();
31651
32426
  init_common4();
31652
- MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a263 = entityKind, _b188) {
32427
+ MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b188) {
31653
32428
  constructor(name2) {
31654
32429
  super(name2, "number", "MySqlFloat");
31655
32430
  }
@@ -31658,13 +32433,13 @@ var init_float = __esm({
31658
32433
  return new MySqlFloat(table4, this.config);
31659
32434
  }
31660
32435
  };
31661
- __publicField(MySqlFloatBuilder, _a263, "MySqlFloatBuilder");
31662
- MySqlFloat = class extends (_b189 = MySqlColumnWithAutoIncrement, _a264 = entityKind, _b189) {
32436
+ __publicField(MySqlFloatBuilder, _a265, "MySqlFloatBuilder");
32437
+ MySqlFloat = class extends (_b189 = MySqlColumnWithAutoIncrement, _a266 = entityKind, _b189) {
31663
32438
  getSQLType() {
31664
32439
  return "float";
31665
32440
  }
31666
32441
  };
31667
- __publicField(MySqlFloat, _a264, "MySqlFloat");
32442
+ __publicField(MySqlFloat, _a266, "MySqlFloat");
31668
32443
  }
31669
32444
  });
31670
32445
 
@@ -31673,14 +32448,14 @@ function int(a, b) {
31673
32448
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31674
32449
  return new MySqlIntBuilder(name2, config);
31675
32450
  }
31676
- var _a265, _b190, MySqlIntBuilder, _a266, _b191, MySqlInt;
32451
+ var _a267, _b190, MySqlIntBuilder, _a268, _b191, MySqlInt;
31677
32452
  var init_int = __esm({
31678
32453
  "../drizzle-orm/dist/mysql-core/columns/int.js"() {
31679
32454
  "use strict";
31680
32455
  init_entity();
31681
32456
  init_utils2();
31682
32457
  init_common4();
31683
- MySqlIntBuilder = class extends (_b190 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b190) {
32458
+ MySqlIntBuilder = class extends (_b190 = MySqlColumnBuilderWithAutoIncrement, _a267 = entityKind, _b190) {
31684
32459
  constructor(name2, config) {
31685
32460
  super(name2, "number", "MySqlInt");
31686
32461
  this.config.unsigned = config ? config.unsigned : false;
@@ -31690,8 +32465,8 @@ var init_int = __esm({
31690
32465
  return new MySqlInt(table4, this.config);
31691
32466
  }
31692
32467
  };
31693
- __publicField(MySqlIntBuilder, _a265, "MySqlIntBuilder");
31694
- MySqlInt = class extends (_b191 = MySqlColumnWithAutoIncrement, _a266 = entityKind, _b191) {
32468
+ __publicField(MySqlIntBuilder, _a267, "MySqlIntBuilder");
32469
+ MySqlInt = class extends (_b191 = MySqlColumnWithAutoIncrement, _a268 = entityKind, _b191) {
31695
32470
  getSQLType() {
31696
32471
  return `int${this.config.unsigned ? " unsigned" : ""}`;
31697
32472
  }
@@ -31702,7 +32477,7 @@ var init_int = __esm({
31702
32477
  return value;
31703
32478
  }
31704
32479
  };
31705
- __publicField(MySqlInt, _a266, "MySqlInt");
32480
+ __publicField(MySqlInt, _a268, "MySqlInt");
31706
32481
  }
31707
32482
  });
31708
32483
 
@@ -31710,13 +32485,13 @@ var init_int = __esm({
31710
32485
  function json2(name2) {
31711
32486
  return new MySqlJsonBuilder(name2 ?? "");
31712
32487
  }
31713
- var _a267, _b192, MySqlJsonBuilder, _a268, _b193, MySqlJson;
32488
+ var _a269, _b192, MySqlJsonBuilder, _a270, _b193, MySqlJson;
31714
32489
  var init_json2 = __esm({
31715
32490
  "../drizzle-orm/dist/mysql-core/columns/json.js"() {
31716
32491
  "use strict";
31717
32492
  init_entity();
31718
32493
  init_common4();
31719
- MySqlJsonBuilder = class extends (_b192 = MySqlColumnBuilder, _a267 = entityKind, _b192) {
32494
+ MySqlJsonBuilder = class extends (_b192 = MySqlColumnBuilder, _a269 = entityKind, _b192) {
31720
32495
  constructor(name2) {
31721
32496
  super(name2, "json", "MySqlJson");
31722
32497
  }
@@ -31725,8 +32500,8 @@ var init_json2 = __esm({
31725
32500
  return new MySqlJson(table4, this.config);
31726
32501
  }
31727
32502
  };
31728
- __publicField(MySqlJsonBuilder, _a267, "MySqlJsonBuilder");
31729
- MySqlJson = class extends (_b193 = MySqlColumn, _a268 = entityKind, _b193) {
32503
+ __publicField(MySqlJsonBuilder, _a269, "MySqlJsonBuilder");
32504
+ MySqlJson = class extends (_b193 = MySqlColumn, _a270 = entityKind, _b193) {
31730
32505
  getSQLType() {
31731
32506
  return "json";
31732
32507
  }
@@ -31734,7 +32509,7 @@ var init_json2 = __esm({
31734
32509
  return JSON.stringify(value);
31735
32510
  }
31736
32511
  };
31737
- __publicField(MySqlJson, _a268, "MySqlJson");
32512
+ __publicField(MySqlJson, _a270, "MySqlJson");
31738
32513
  }
31739
32514
  });
31740
32515
 
@@ -31743,14 +32518,14 @@ function mediumint(a, b) {
31743
32518
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31744
32519
  return new MySqlMediumIntBuilder(name2, config);
31745
32520
  }
31746
- var _a269, _b194, MySqlMediumIntBuilder, _a270, _b195, MySqlMediumInt;
32521
+ var _a271, _b194, MySqlMediumIntBuilder, _a272, _b195, MySqlMediumInt;
31747
32522
  var init_mediumint = __esm({
31748
32523
  "../drizzle-orm/dist/mysql-core/columns/mediumint.js"() {
31749
32524
  "use strict";
31750
32525
  init_entity();
31751
32526
  init_utils2();
31752
32527
  init_common4();
31753
- MySqlMediumIntBuilder = class extends (_b194 = MySqlColumnBuilderWithAutoIncrement, _a269 = entityKind, _b194) {
32528
+ MySqlMediumIntBuilder = class extends (_b194 = MySqlColumnBuilderWithAutoIncrement, _a271 = entityKind, _b194) {
31754
32529
  constructor(name2, config) {
31755
32530
  super(name2, "number", "MySqlMediumInt");
31756
32531
  this.config.unsigned = config ? config.unsigned : false;
@@ -31763,8 +32538,8 @@ var init_mediumint = __esm({
31763
32538
  );
31764
32539
  }
31765
32540
  };
31766
- __publicField(MySqlMediumIntBuilder, _a269, "MySqlMediumIntBuilder");
31767
- MySqlMediumInt = class extends (_b195 = MySqlColumnWithAutoIncrement, _a270 = entityKind, _b195) {
32541
+ __publicField(MySqlMediumIntBuilder, _a271, "MySqlMediumIntBuilder");
32542
+ MySqlMediumInt = class extends (_b195 = MySqlColumnWithAutoIncrement, _a272 = entityKind, _b195) {
31768
32543
  getSQLType() {
31769
32544
  return `mediumint${this.config.unsigned ? " unsigned" : ""}`;
31770
32545
  }
@@ -31775,7 +32550,7 @@ var init_mediumint = __esm({
31775
32550
  return value;
31776
32551
  }
31777
32552
  };
31778
- __publicField(MySqlMediumInt, _a270, "MySqlMediumInt");
32553
+ __publicField(MySqlMediumInt, _a272, "MySqlMediumInt");
31779
32554
  }
31780
32555
  });
31781
32556
 
@@ -31784,14 +32559,14 @@ function real3(a, b = {}) {
31784
32559
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31785
32560
  return new MySqlRealBuilder(name2, config);
31786
32561
  }
31787
- var _a271, _b196, MySqlRealBuilder, _a272, _b197, MySqlReal;
32562
+ var _a273, _b196, MySqlRealBuilder, _a274, _b197, MySqlReal;
31788
32563
  var init_real3 = __esm({
31789
32564
  "../drizzle-orm/dist/mysql-core/columns/real.js"() {
31790
32565
  "use strict";
31791
32566
  init_entity();
31792
32567
  init_utils2();
31793
32568
  init_common4();
31794
- MySqlRealBuilder = class extends (_b196 = MySqlColumnBuilderWithAutoIncrement, _a271 = entityKind, _b196) {
32569
+ MySqlRealBuilder = class extends (_b196 = MySqlColumnBuilderWithAutoIncrement, _a273 = entityKind, _b196) {
31795
32570
  constructor(name2, config) {
31796
32571
  super(name2, "number", "MySqlReal");
31797
32572
  this.config.precision = config?.precision;
@@ -31802,8 +32577,8 @@ var init_real3 = __esm({
31802
32577
  return new MySqlReal(table4, this.config);
31803
32578
  }
31804
32579
  };
31805
- __publicField(MySqlRealBuilder, _a271, "MySqlRealBuilder");
31806
- MySqlReal = class extends (_b197 = MySqlColumnWithAutoIncrement, _a272 = entityKind, _b197) {
32580
+ __publicField(MySqlRealBuilder, _a273, "MySqlRealBuilder");
32581
+ MySqlReal = class extends (_b197 = MySqlColumnWithAutoIncrement, _a274 = entityKind, _b197) {
31807
32582
  constructor() {
31808
32583
  super(...arguments);
31809
32584
  __publicField(this, "precision", this.config.precision);
@@ -31819,7 +32594,7 @@ var init_real3 = __esm({
31819
32594
  }
31820
32595
  }
31821
32596
  };
31822
- __publicField(MySqlReal, _a272, "MySqlReal");
32597
+ __publicField(MySqlReal, _a274, "MySqlReal");
31823
32598
  }
31824
32599
  });
31825
32600
 
@@ -31827,13 +32602,13 @@ var init_real3 = __esm({
31827
32602
  function serial2(name2) {
31828
32603
  return new MySqlSerialBuilder(name2 ?? "");
31829
32604
  }
31830
- var _a273, _b198, MySqlSerialBuilder, _a274, _b199, MySqlSerial;
32605
+ var _a275, _b198, MySqlSerialBuilder, _a276, _b199, MySqlSerial;
31831
32606
  var init_serial2 = __esm({
31832
32607
  "../drizzle-orm/dist/mysql-core/columns/serial.js"() {
31833
32608
  "use strict";
31834
32609
  init_entity();
31835
32610
  init_common4();
31836
- MySqlSerialBuilder = class extends (_b198 = MySqlColumnBuilderWithAutoIncrement, _a273 = entityKind, _b198) {
32611
+ MySqlSerialBuilder = class extends (_b198 = MySqlColumnBuilderWithAutoIncrement, _a275 = entityKind, _b198) {
31837
32612
  constructor(name2) {
31838
32613
  super(name2, "number", "MySqlSerial");
31839
32614
  this.config.hasDefault = true;
@@ -31844,8 +32619,8 @@ var init_serial2 = __esm({
31844
32619
  return new MySqlSerial(table4, this.config);
31845
32620
  }
31846
32621
  };
31847
- __publicField(MySqlSerialBuilder, _a273, "MySqlSerialBuilder");
31848
- MySqlSerial = class extends (_b199 = MySqlColumnWithAutoIncrement, _a274 = entityKind, _b199) {
32622
+ __publicField(MySqlSerialBuilder, _a275, "MySqlSerialBuilder");
32623
+ MySqlSerial = class extends (_b199 = MySqlColumnWithAutoIncrement, _a276 = entityKind, _b199) {
31849
32624
  getSQLType() {
31850
32625
  return "serial";
31851
32626
  }
@@ -31856,7 +32631,7 @@ var init_serial2 = __esm({
31856
32631
  return value;
31857
32632
  }
31858
32633
  };
31859
- __publicField(MySqlSerial, _a274, "MySqlSerial");
32634
+ __publicField(MySqlSerial, _a276, "MySqlSerial");
31860
32635
  }
31861
32636
  });
31862
32637
 
@@ -31865,14 +32640,14 @@ function smallint2(a, b) {
31865
32640
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31866
32641
  return new MySqlSmallIntBuilder(name2, config);
31867
32642
  }
31868
- var _a275, _b200, MySqlSmallIntBuilder, _a276, _b201, MySqlSmallInt;
32643
+ var _a277, _b200, MySqlSmallIntBuilder, _a278, _b201, MySqlSmallInt;
31869
32644
  var init_smallint2 = __esm({
31870
32645
  "../drizzle-orm/dist/mysql-core/columns/smallint.js"() {
31871
32646
  "use strict";
31872
32647
  init_entity();
31873
32648
  init_utils2();
31874
32649
  init_common4();
31875
- MySqlSmallIntBuilder = class extends (_b200 = MySqlColumnBuilderWithAutoIncrement, _a275 = entityKind, _b200) {
32650
+ MySqlSmallIntBuilder = class extends (_b200 = MySqlColumnBuilderWithAutoIncrement, _a277 = entityKind, _b200) {
31876
32651
  constructor(name2, config) {
31877
32652
  super(name2, "number", "MySqlSmallInt");
31878
32653
  this.config.unsigned = config ? config.unsigned : false;
@@ -31885,8 +32660,8 @@ var init_smallint2 = __esm({
31885
32660
  );
31886
32661
  }
31887
32662
  };
31888
- __publicField(MySqlSmallIntBuilder, _a275, "MySqlSmallIntBuilder");
31889
- MySqlSmallInt = class extends (_b201 = MySqlColumnWithAutoIncrement, _a276 = entityKind, _b201) {
32663
+ __publicField(MySqlSmallIntBuilder, _a277, "MySqlSmallIntBuilder");
32664
+ MySqlSmallInt = class extends (_b201 = MySqlColumnWithAutoIncrement, _a278 = entityKind, _b201) {
31890
32665
  getSQLType() {
31891
32666
  return `smallint${this.config.unsigned ? " unsigned" : ""}`;
31892
32667
  }
@@ -31897,7 +32672,7 @@ var init_smallint2 = __esm({
31897
32672
  return value;
31898
32673
  }
31899
32674
  };
31900
- __publicField(MySqlSmallInt, _a276, "MySqlSmallInt");
32675
+ __publicField(MySqlSmallInt, _a278, "MySqlSmallInt");
31901
32676
  }
31902
32677
  });
31903
32678
 
@@ -31906,14 +32681,14 @@ function text3(a, b = {}) {
31906
32681
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31907
32682
  return new MySqlTextBuilder(name2, "text", config);
31908
32683
  }
31909
- var _a277, _b202, MySqlTextBuilder, _a278, _b203, MySqlText;
32684
+ var _a279, _b202, MySqlTextBuilder, _a280, _b203, MySqlText;
31910
32685
  var init_text3 = __esm({
31911
32686
  "../drizzle-orm/dist/mysql-core/columns/text.js"() {
31912
32687
  "use strict";
31913
32688
  init_entity();
31914
32689
  init_utils2();
31915
32690
  init_common4();
31916
- MySqlTextBuilder = class extends (_b202 = MySqlColumnBuilder, _a277 = entityKind, _b202) {
32691
+ MySqlTextBuilder = class extends (_b202 = MySqlColumnBuilder, _a279 = entityKind, _b202) {
31917
32692
  constructor(name2, textType, config) {
31918
32693
  super(name2, "string", "MySqlText");
31919
32694
  this.config.textType = textType;
@@ -31924,8 +32699,8 @@ var init_text3 = __esm({
31924
32699
  return new MySqlText(table4, this.config);
31925
32700
  }
31926
32701
  };
31927
- __publicField(MySqlTextBuilder, _a277, "MySqlTextBuilder");
31928
- MySqlText = class extends (_b203 = MySqlColumn, _a278 = entityKind, _b203) {
32702
+ __publicField(MySqlTextBuilder, _a279, "MySqlTextBuilder");
32703
+ MySqlText = class extends (_b203 = MySqlColumn, _a280 = entityKind, _b203) {
31929
32704
  constructor() {
31930
32705
  super(...arguments);
31931
32706
  __publicField(this, "textType", this.config.textType);
@@ -31935,7 +32710,7 @@ var init_text3 = __esm({
31935
32710
  return this.textType;
31936
32711
  }
31937
32712
  };
31938
- __publicField(MySqlText, _a278, "MySqlText");
32713
+ __publicField(MySqlText, _a280, "MySqlText");
31939
32714
  }
31940
32715
  });
31941
32716
 
@@ -31944,14 +32719,14 @@ function time2(a, b) {
31944
32719
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31945
32720
  return new MySqlTimeBuilder(name2, config);
31946
32721
  }
31947
- var _a279, _b204, MySqlTimeBuilder, _a280, _b205, MySqlTime;
32722
+ var _a281, _b204, MySqlTimeBuilder, _a282, _b205, MySqlTime;
31948
32723
  var init_time2 = __esm({
31949
32724
  "../drizzle-orm/dist/mysql-core/columns/time.js"() {
31950
32725
  "use strict";
31951
32726
  init_entity();
31952
32727
  init_utils2();
31953
32728
  init_common4();
31954
- MySqlTimeBuilder = class extends (_b204 = MySqlColumnBuilder, _a279 = entityKind, _b204) {
32729
+ MySqlTimeBuilder = class extends (_b204 = MySqlColumnBuilder, _a281 = entityKind, _b204) {
31955
32730
  constructor(name2, config) {
31956
32731
  super(name2, "string", "MySqlTime");
31957
32732
  this.config.fsp = config?.fsp;
@@ -31961,8 +32736,8 @@ var init_time2 = __esm({
31961
32736
  return new MySqlTime(table4, this.config);
31962
32737
  }
31963
32738
  };
31964
- __publicField(MySqlTimeBuilder, _a279, "MySqlTimeBuilder");
31965
- MySqlTime = class extends (_b205 = MySqlColumn, _a280 = entityKind, _b205) {
32739
+ __publicField(MySqlTimeBuilder, _a281, "MySqlTimeBuilder");
32740
+ MySqlTime = class extends (_b205 = MySqlColumn, _a282 = entityKind, _b205) {
31966
32741
  constructor() {
31967
32742
  super(...arguments);
31968
32743
  __publicField(this, "fsp", this.config.fsp);
@@ -31972,19 +32747,19 @@ var init_time2 = __esm({
31972
32747
  return `time${precision}`;
31973
32748
  }
31974
32749
  };
31975
- __publicField(MySqlTime, _a280, "MySqlTime");
32750
+ __publicField(MySqlTime, _a282, "MySqlTime");
31976
32751
  }
31977
32752
  });
31978
32753
 
31979
32754
  // ../drizzle-orm/dist/mysql-core/columns/date.common.js
31980
- var _a281, _b206, MySqlDateColumnBaseBuilder, _a282, _b207, MySqlDateBaseColumn;
32755
+ var _a283, _b206, MySqlDateColumnBaseBuilder, _a284, _b207, MySqlDateBaseColumn;
31981
32756
  var init_date_common2 = __esm({
31982
32757
  "../drizzle-orm/dist/mysql-core/columns/date.common.js"() {
31983
32758
  "use strict";
31984
32759
  init_entity();
31985
32760
  init_sql();
31986
32761
  init_common4();
31987
- MySqlDateColumnBaseBuilder = class extends (_b206 = MySqlColumnBuilder, _a281 = entityKind, _b206) {
32762
+ MySqlDateColumnBaseBuilder = class extends (_b206 = MySqlColumnBuilder, _a283 = entityKind, _b206) {
31988
32763
  defaultNow() {
31989
32764
  return this.default(sql`(now())`);
31990
32765
  }
@@ -31995,14 +32770,14 @@ var init_date_common2 = __esm({
31995
32770
  return this;
31996
32771
  }
31997
32772
  };
31998
- __publicField(MySqlDateColumnBaseBuilder, _a281, "MySqlDateColumnBuilder");
31999
- MySqlDateBaseColumn = class extends (_b207 = MySqlColumn, _a282 = entityKind, _b207) {
32773
+ __publicField(MySqlDateColumnBaseBuilder, _a283, "MySqlDateColumnBuilder");
32774
+ MySqlDateBaseColumn = class extends (_b207 = MySqlColumn, _a284 = entityKind, _b207) {
32000
32775
  constructor() {
32001
32776
  super(...arguments);
32002
32777
  __publicField(this, "hasOnUpdateNow", this.config.hasOnUpdateNow);
32003
32778
  }
32004
32779
  };
32005
- __publicField(MySqlDateBaseColumn, _a282, "MySqlDateColumn");
32780
+ __publicField(MySqlDateBaseColumn, _a284, "MySqlDateColumn");
32006
32781
  }
32007
32782
  });
32008
32783
 
@@ -32014,14 +32789,14 @@ function timestamp2(a, b = {}) {
32014
32789
  }
32015
32790
  return new MySqlTimestampBuilder(name2, config);
32016
32791
  }
32017
- var _a283, _b208, MySqlTimestampBuilder, _a284, _b209, MySqlTimestamp, _a285, _b210, MySqlTimestampStringBuilder, _a286, _b211, MySqlTimestampString;
32792
+ var _a285, _b208, MySqlTimestampBuilder, _a286, _b209, MySqlTimestamp, _a287, _b210, MySqlTimestampStringBuilder, _a288, _b211, MySqlTimestampString;
32018
32793
  var init_timestamp2 = __esm({
32019
32794
  "../drizzle-orm/dist/mysql-core/columns/timestamp.js"() {
32020
32795
  "use strict";
32021
32796
  init_entity();
32022
32797
  init_utils2();
32023
32798
  init_date_common2();
32024
- MySqlTimestampBuilder = class extends (_b208 = MySqlDateColumnBaseBuilder, _a283 = entityKind, _b208) {
32799
+ MySqlTimestampBuilder = class extends (_b208 = MySqlDateColumnBaseBuilder, _a285 = entityKind, _b208) {
32025
32800
  constructor(name2, config) {
32026
32801
  super(name2, "date", "MySqlTimestamp");
32027
32802
  this.config.fsp = config?.fsp;
@@ -32034,8 +32809,8 @@ var init_timestamp2 = __esm({
32034
32809
  );
32035
32810
  }
32036
32811
  };
32037
- __publicField(MySqlTimestampBuilder, _a283, "MySqlTimestampBuilder");
32038
- MySqlTimestamp = class extends (_b209 = MySqlDateBaseColumn, _a284 = entityKind, _b209) {
32812
+ __publicField(MySqlTimestampBuilder, _a285, "MySqlTimestampBuilder");
32813
+ MySqlTimestamp = class extends (_b209 = MySqlDateBaseColumn, _a286 = entityKind, _b209) {
32039
32814
  constructor() {
32040
32815
  super(...arguments);
32041
32816
  __publicField(this, "fsp", this.config.fsp);
@@ -32051,8 +32826,8 @@ var init_timestamp2 = __esm({
32051
32826
  return value.toISOString().slice(0, -1).replace("T", " ");
32052
32827
  }
32053
32828
  };
32054
- __publicField(MySqlTimestamp, _a284, "MySqlTimestamp");
32055
- MySqlTimestampStringBuilder = class extends (_b210 = MySqlDateColumnBaseBuilder, _a285 = entityKind, _b210) {
32829
+ __publicField(MySqlTimestamp, _a286, "MySqlTimestamp");
32830
+ MySqlTimestampStringBuilder = class extends (_b210 = MySqlDateColumnBaseBuilder, _a287 = entityKind, _b210) {
32056
32831
  constructor(name2, config) {
32057
32832
  super(name2, "string", "MySqlTimestampString");
32058
32833
  this.config.fsp = config?.fsp;
@@ -32065,8 +32840,8 @@ var init_timestamp2 = __esm({
32065
32840
  );
32066
32841
  }
32067
32842
  };
32068
- __publicField(MySqlTimestampStringBuilder, _a285, "MySqlTimestampStringBuilder");
32069
- MySqlTimestampString = class extends (_b211 = MySqlDateBaseColumn, _a286 = entityKind, _b211) {
32843
+ __publicField(MySqlTimestampStringBuilder, _a287, "MySqlTimestampStringBuilder");
32844
+ MySqlTimestampString = class extends (_b211 = MySqlDateBaseColumn, _a288 = entityKind, _b211) {
32070
32845
  constructor() {
32071
32846
  super(...arguments);
32072
32847
  __publicField(this, "fsp", this.config.fsp);
@@ -32076,7 +32851,7 @@ var init_timestamp2 = __esm({
32076
32851
  return `timestamp${precision}`;
32077
32852
  }
32078
32853
  };
32079
- __publicField(MySqlTimestampString, _a286, "MySqlTimestampString");
32854
+ __publicField(MySqlTimestampString, _a288, "MySqlTimestampString");
32080
32855
  }
32081
32856
  });
32082
32857
 
@@ -32085,14 +32860,14 @@ function tinyint(a, b) {
32085
32860
  const { name: name2, config } = getColumnNameAndConfig(a, b);
32086
32861
  return new MySqlTinyIntBuilder(name2, config);
32087
32862
  }
32088
- var _a287, _b212, MySqlTinyIntBuilder, _a288, _b213, MySqlTinyInt;
32863
+ var _a289, _b212, MySqlTinyIntBuilder, _a290, _b213, MySqlTinyInt;
32089
32864
  var init_tinyint = __esm({
32090
32865
  "../drizzle-orm/dist/mysql-core/columns/tinyint.js"() {
32091
32866
  "use strict";
32092
32867
  init_entity();
32093
32868
  init_utils2();
32094
32869
  init_common4();
32095
- MySqlTinyIntBuilder = class extends (_b212 = MySqlColumnBuilderWithAutoIncrement, _a287 = entityKind, _b212) {
32870
+ MySqlTinyIntBuilder = class extends (_b212 = MySqlColumnBuilderWithAutoIncrement, _a289 = entityKind, _b212) {
32096
32871
  constructor(name2, config) {
32097
32872
  super(name2, "number", "MySqlTinyInt");
32098
32873
  this.config.unsigned = config ? config.unsigned : false;
@@ -32105,8 +32880,8 @@ var init_tinyint = __esm({
32105
32880
  );
32106
32881
  }
32107
32882
  };
32108
- __publicField(MySqlTinyIntBuilder, _a287, "MySqlTinyIntBuilder");
32109
- MySqlTinyInt = class extends (_b213 = MySqlColumnWithAutoIncrement, _a288 = entityKind, _b213) {
32883
+ __publicField(MySqlTinyIntBuilder, _a289, "MySqlTinyIntBuilder");
32884
+ MySqlTinyInt = class extends (_b213 = MySqlColumnWithAutoIncrement, _a290 = entityKind, _b213) {
32110
32885
  getSQLType() {
32111
32886
  return `tinyint${this.config.unsigned ? " unsigned" : ""}`;
32112
32887
  }
@@ -32117,7 +32892,7 @@ var init_tinyint = __esm({
32117
32892
  return value;
32118
32893
  }
32119
32894
  };
32120
- __publicField(MySqlTinyInt, _a288, "MySqlTinyInt");
32895
+ __publicField(MySqlTinyInt, _a290, "MySqlTinyInt");
32121
32896
  }
32122
32897
  });
32123
32898
 
@@ -32126,14 +32901,14 @@ function varbinary(a, b) {
32126
32901
  const { name: name2, config } = getColumnNameAndConfig(a, b);
32127
32902
  return new MySqlVarBinaryBuilder(name2, config);
32128
32903
  }
32129
- var _a289, _b214, MySqlVarBinaryBuilder, _a290, _b215, MySqlVarBinary;
32904
+ var _a291, _b214, MySqlVarBinaryBuilder, _a292, _b215, MySqlVarBinary;
32130
32905
  var init_varbinary = __esm({
32131
32906
  "../drizzle-orm/dist/mysql-core/columns/varbinary.js"() {
32132
32907
  "use strict";
32133
32908
  init_entity();
32134
32909
  init_utils2();
32135
32910
  init_common4();
32136
- MySqlVarBinaryBuilder = class extends (_b214 = MySqlColumnBuilder, _a289 = entityKind, _b214) {
32911
+ MySqlVarBinaryBuilder = class extends (_b214 = MySqlColumnBuilder, _a291 = entityKind, _b214) {
32137
32912
  /** @internal */
32138
32913
  constructor(name2, config) {
32139
32914
  super(name2, "string", "MySqlVarBinary");
@@ -32147,8 +32922,8 @@ var init_varbinary = __esm({
32147
32922
  );
32148
32923
  }
32149
32924
  };
32150
- __publicField(MySqlVarBinaryBuilder, _a289, "MySqlVarBinaryBuilder");
32151
- MySqlVarBinary = class extends (_b215 = MySqlColumn, _a290 = entityKind, _b215) {
32925
+ __publicField(MySqlVarBinaryBuilder, _a291, "MySqlVarBinaryBuilder");
32926
+ MySqlVarBinary = class extends (_b215 = MySqlColumn, _a292 = entityKind, _b215) {
32152
32927
  constructor() {
32153
32928
  super(...arguments);
32154
32929
  __publicField(this, "length", this.config.length);
@@ -32157,7 +32932,7 @@ var init_varbinary = __esm({
32157
32932
  return this.length === void 0 ? `varbinary` : `varbinary(${this.length})`;
32158
32933
  }
32159
32934
  };
32160
- __publicField(MySqlVarBinary, _a290, "MySqlVarBinary");
32935
+ __publicField(MySqlVarBinary, _a292, "MySqlVarBinary");
32161
32936
  }
32162
32937
  });
32163
32938
 
@@ -32166,14 +32941,14 @@ function varchar2(a, b) {
32166
32941
  const { name: name2, config } = getColumnNameAndConfig(a, b);
32167
32942
  return new MySqlVarCharBuilder(name2, config);
32168
32943
  }
32169
- var _a291, _b216, MySqlVarCharBuilder, _a292, _b217, MySqlVarChar;
32944
+ var _a293, _b216, MySqlVarCharBuilder, _a294, _b217, MySqlVarChar;
32170
32945
  var init_varchar2 = __esm({
32171
32946
  "../drizzle-orm/dist/mysql-core/columns/varchar.js"() {
32172
32947
  "use strict";
32173
32948
  init_entity();
32174
32949
  init_utils2();
32175
32950
  init_common4();
32176
- MySqlVarCharBuilder = class extends (_b216 = MySqlColumnBuilder, _a291 = entityKind, _b216) {
32951
+ MySqlVarCharBuilder = class extends (_b216 = MySqlColumnBuilder, _a293 = entityKind, _b216) {
32177
32952
  /** @internal */
32178
32953
  constructor(name2, config) {
32179
32954
  super(name2, "string", "MySqlVarChar");
@@ -32188,8 +32963,8 @@ var init_varchar2 = __esm({
32188
32963
  );
32189
32964
  }
32190
32965
  };
32191
- __publicField(MySqlVarCharBuilder, _a291, "MySqlVarCharBuilder");
32192
- MySqlVarChar = class extends (_b217 = MySqlColumn, _a292 = entityKind, _b217) {
32966
+ __publicField(MySqlVarCharBuilder, _a293, "MySqlVarCharBuilder");
32967
+ MySqlVarChar = class extends (_b217 = MySqlColumn, _a294 = entityKind, _b217) {
32193
32968
  constructor() {
32194
32969
  super(...arguments);
32195
32970
  __publicField(this, "length", this.config.length);
@@ -32199,7 +32974,7 @@ var init_varchar2 = __esm({
32199
32974
  return this.length === void 0 ? `varchar` : `varchar(${this.length})`;
32200
32975
  }
32201
32976
  };
32202
- __publicField(MySqlVarChar, _a292, "MySqlVarChar");
32977
+ __publicField(MySqlVarChar, _a294, "MySqlVarChar");
32203
32978
  }
32204
32979
  });
32205
32980
 
@@ -32207,13 +32982,13 @@ var init_varchar2 = __esm({
32207
32982
  function year(name2) {
32208
32983
  return new MySqlYearBuilder(name2 ?? "");
32209
32984
  }
32210
- var _a293, _b218, MySqlYearBuilder, _a294, _b219, MySqlYear;
32985
+ var _a295, _b218, MySqlYearBuilder, _a296, _b219, MySqlYear;
32211
32986
  var init_year = __esm({
32212
32987
  "../drizzle-orm/dist/mysql-core/columns/year.js"() {
32213
32988
  "use strict";
32214
32989
  init_entity();
32215
32990
  init_common4();
32216
- MySqlYearBuilder = class extends (_b218 = MySqlColumnBuilder, _a293 = entityKind, _b218) {
32991
+ MySqlYearBuilder = class extends (_b218 = MySqlColumnBuilder, _a295 = entityKind, _b218) {
32217
32992
  constructor(name2) {
32218
32993
  super(name2, "number", "MySqlYear");
32219
32994
  }
@@ -32222,13 +32997,13 @@ var init_year = __esm({
32222
32997
  return new MySqlYear(table4, this.config);
32223
32998
  }
32224
32999
  };
32225
- __publicField(MySqlYearBuilder, _a293, "MySqlYearBuilder");
32226
- MySqlYear = class extends (_b219 = MySqlColumn, _a294 = entityKind, _b219) {
33000
+ __publicField(MySqlYearBuilder, _a295, "MySqlYearBuilder");
33001
+ MySqlYear = class extends (_b219 = MySqlColumn, _a296 = entityKind, _b219) {
32227
33002
  getSQLType() {
32228
33003
  return `year`;
32229
33004
  }
32230
33005
  };
32231
- __publicField(MySqlYear, _a294, "MySqlYear");
33006
+ __publicField(MySqlYear, _a296, "MySqlYear");
32232
33007
  }
32233
33008
  });
32234
33009
 
@@ -32265,17 +33040,17 @@ var init_columns3 = __esm({
32265
33040
  });
32266
33041
 
32267
33042
  // ../drizzle-orm/dist/mysql-core/query-builders/count.js
32268
- var _a295, _b220, _c9, _MySqlCountBuilder, MySqlCountBuilder;
33043
+ var _a297, _b220, _c9, _MySqlCountBuilder, MySqlCountBuilder;
32269
33044
  var init_count3 = __esm({
32270
33045
  "../drizzle-orm/dist/mysql-core/query-builders/count.js"() {
32271
33046
  "use strict";
32272
33047
  init_entity();
32273
33048
  init_sql();
32274
- _MySqlCountBuilder = class _MySqlCountBuilder extends (_c9 = SQL, _b220 = entityKind, _a295 = Symbol.toStringTag, _c9) {
33049
+ _MySqlCountBuilder = class _MySqlCountBuilder extends (_c9 = SQL, _b220 = entityKind, _a297 = Symbol.toStringTag, _c9) {
32275
33050
  constructor(params) {
32276
33051
  super(_MySqlCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
32277
33052
  __publicField(this, "sql");
32278
- __publicField(this, _a295, "MySqlCountBuilder");
33053
+ __publicField(this, _a297, "MySqlCountBuilder");
32279
33054
  __publicField(this, "session");
32280
33055
  this.params = params;
32281
33056
  this.mapWith(Number);
@@ -32319,13 +33094,13 @@ var init_count3 = __esm({
32319
33094
  });
32320
33095
 
32321
33096
  // ../drizzle-orm/dist/mysql-core/query-builders/delete.js
32322
- var _a296, _b221, MySqlDeleteBase;
33097
+ var _a298, _b221, MySqlDeleteBase;
32323
33098
  var init_delete3 = __esm({
32324
33099
  "../drizzle-orm/dist/mysql-core/query-builders/delete.js"() {
32325
33100
  "use strict";
32326
33101
  init_entity();
32327
33102
  init_query_promise();
32328
- MySqlDeleteBase = class extends (_b221 = QueryPromise, _a296 = entityKind, _b221) {
33103
+ MySqlDeleteBase = class extends (_b221 = QueryPromise, _a298 = entityKind, _b221) {
32329
33104
  constructor(table4, session, dialect4, withList) {
32330
33105
  super();
32331
33106
  __publicField(this, "config");
@@ -32395,12 +33170,12 @@ var init_delete3 = __esm({
32395
33170
  return this;
32396
33171
  }
32397
33172
  };
32398
- __publicField(MySqlDeleteBase, _a296, "MySqlDelete");
33173
+ __publicField(MySqlDeleteBase, _a298, "MySqlDelete");
32399
33174
  }
32400
33175
  });
32401
33176
 
32402
33177
  // ../drizzle-orm/dist/mysql-core/query-builders/insert.js
32403
- var _a297, MySqlInsertBuilder, _a298, _b222, MySqlInsertBase;
33178
+ var _a299, MySqlInsertBuilder, _a300, _b222, MySqlInsertBase;
32404
33179
  var init_insert3 = __esm({
32405
33180
  "../drizzle-orm/dist/mysql-core/query-builders/insert.js"() {
32406
33181
  "use strict";
@@ -32409,7 +33184,7 @@ var init_insert3 = __esm({
32409
33184
  init_sql();
32410
33185
  init_table();
32411
33186
  init_utils2();
32412
- _a297 = entityKind;
33187
+ _a299 = entityKind;
32413
33188
  MySqlInsertBuilder = class {
32414
33189
  constructor(table4, session, dialect4) {
32415
33190
  __publicField(this, "shouldIgnore", false);
@@ -32438,8 +33213,8 @@ var init_insert3 = __esm({
32438
33213
  return new MySqlInsertBase(this.table, mappedValues, this.shouldIgnore, this.session, this.dialect);
32439
33214
  }
32440
33215
  };
32441
- __publicField(MySqlInsertBuilder, _a297, "MySqlInsertBuilder");
32442
- MySqlInsertBase = class extends (_b222 = QueryPromise, _a298 = entityKind, _b222) {
33216
+ __publicField(MySqlInsertBuilder, _a299, "MySqlInsertBuilder");
33217
+ MySqlInsertBase = class extends (_b222 = QueryPromise, _a300 = entityKind, _b222) {
32443
33218
  constructor(table4, values, ignore, session, dialect4) {
32444
33219
  super();
32445
33220
  __publicField(this, "config");
@@ -32520,7 +33295,7 @@ var init_insert3 = __esm({
32520
33295
  return this;
32521
33296
  }
32522
33297
  };
32523
- __publicField(MySqlInsertBase, _a298, "MySqlInsert");
33298
+ __publicField(MySqlInsertBase, _a300, "MySqlInsert");
32524
33299
  }
32525
33300
  });
32526
33301
 
@@ -32604,7 +33379,7 @@ function mysqlTableWithSchema(name2, columns, extraConfig, schema4, baseName = n
32604
33379
  }
32605
33380
  return table4;
32606
33381
  }
32607
- var InlineForeignKeys3, _a299, _b223, _c10, _d4, _e3, MySqlTable, mysqlTable;
33382
+ var InlineForeignKeys3, _a301, _b223, _c10, _d4, _e3, MySqlTable, mysqlTable;
32608
33383
  var init_table4 = __esm({
32609
33384
  "../drizzle-orm/dist/mysql-core/table.js"() {
32610
33385
  "use strict";
@@ -32612,7 +33387,7 @@ var init_table4 = __esm({
32612
33387
  init_table();
32613
33388
  init_all3();
32614
33389
  InlineForeignKeys3 = Symbol.for("drizzle:MySqlInlineForeignKeys");
32615
- MySqlTable = class extends (_e3 = Table, _d4 = entityKind, _c10 = Table.Symbol.Columns, _b223 = InlineForeignKeys3, _a299 = Table.Symbol.ExtraConfigBuilder, _e3) {
33390
+ MySqlTable = class extends (_e3 = Table, _d4 = entityKind, _c10 = Table.Symbol.Columns, _b223 = InlineForeignKeys3, _a301 = Table.Symbol.ExtraConfigBuilder, _e3) {
32616
33391
  constructor() {
32617
33392
  super(...arguments);
32618
33393
  /** @internal */
@@ -32620,7 +33395,7 @@ var init_table4 = __esm({
32620
33395
  /** @internal */
32621
33396
  __publicField(this, _b223, []);
32622
33397
  /** @internal */
32623
- __publicField(this, _a299);
33398
+ __publicField(this, _a301);
32624
33399
  }
32625
33400
  };
32626
33401
  __publicField(MySqlTable, _d4, "MySqlTable");
@@ -32635,20 +33410,20 @@ var init_table4 = __esm({
32635
33410
  });
32636
33411
 
32637
33412
  // ../drizzle-orm/dist/mysql-core/view-base.js
32638
- var _a300, _b224, MySqlViewBase;
33413
+ var _a302, _b224, MySqlViewBase;
32639
33414
  var init_view_base3 = __esm({
32640
33415
  "../drizzle-orm/dist/mysql-core/view-base.js"() {
32641
33416
  "use strict";
32642
33417
  init_entity();
32643
33418
  init_sql();
32644
- MySqlViewBase = class extends (_b224 = View, _a300 = entityKind, _b224) {
33419
+ MySqlViewBase = class extends (_b224 = View, _a302 = entityKind, _b224) {
32645
33420
  };
32646
- __publicField(MySqlViewBase, _a300, "MySqlViewBase");
33421
+ __publicField(MySqlViewBase, _a302, "MySqlViewBase");
32647
33422
  }
32648
33423
  });
32649
33424
 
32650
33425
  // ../drizzle-orm/dist/mysql-core/dialect.js
32651
- var _a301, MySqlDialect;
33426
+ var _a303, MySqlDialect;
32652
33427
  var init_dialect3 = __esm({
32653
33428
  "../drizzle-orm/dist/mysql-core/dialect.js"() {
32654
33429
  "use strict";
@@ -32667,7 +33442,7 @@ var init_dialect3 = __esm({
32667
33442
  init_common4();
32668
33443
  init_table4();
32669
33444
  init_view_base3();
32670
- _a301 = entityKind;
33445
+ _a303 = entityKind;
32671
33446
  MySqlDialect = class {
32672
33447
  constructor(config) {
32673
33448
  /** @internal */
@@ -33449,7 +34224,7 @@ var init_dialect3 = __esm({
33449
34224
  };
33450
34225
  }
33451
34226
  };
33452
- __publicField(MySqlDialect, _a301, "MySqlDialect");
34227
+ __publicField(MySqlDialect, _a303, "MySqlDialect");
33453
34228
  }
33454
34229
  });
33455
34230
 
@@ -33471,7 +34246,7 @@ function createSetOperator3(type, isAll) {
33471
34246
  return leftSelect.addSetOperators(setOperators);
33472
34247
  };
33473
34248
  }
33474
- var _a302, MySqlSelectBuilder, _a303, _b225, MySqlSelectQueryBuilderBase, _a304, _b226, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
34249
+ var _a304, MySqlSelectBuilder, _a305, _b225, MySqlSelectQueryBuilderBase, _a306, _b226, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
33475
34250
  var init_select4 = __esm({
33476
34251
  "../drizzle-orm/dist/mysql-core/query-builders/select.js"() {
33477
34252
  "use strict";
@@ -33486,7 +34261,7 @@ var init_select4 = __esm({
33486
34261
  init_utils2();
33487
34262
  init_view_common();
33488
34263
  init_view_base3();
33489
- _a302 = entityKind;
34264
+ _a304 = entityKind;
33490
34265
  MySqlSelectBuilder = class {
33491
34266
  constructor(config) {
33492
34267
  __publicField(this, "fields");
@@ -33531,8 +34306,8 @@ var init_select4 = __esm({
33531
34306
  );
33532
34307
  }
33533
34308
  };
33534
- __publicField(MySqlSelectBuilder, _a302, "MySqlSelectBuilder");
33535
- MySqlSelectQueryBuilderBase = class extends (_b225 = TypedQueryBuilder, _a303 = entityKind, _b225) {
34309
+ __publicField(MySqlSelectBuilder, _a304, "MySqlSelectBuilder");
34310
+ MySqlSelectQueryBuilderBase = class extends (_b225 = TypedQueryBuilder, _a305 = entityKind, _b225) {
33536
34311
  constructor({ table: table4, fields, isPartialSelect, session, dialect: dialect4, withList, distinct }) {
33537
34312
  super();
33538
34313
  __publicField(this, "_");
@@ -34133,8 +34908,8 @@ var init_select4 = __esm({
34133
34908
  return this;
34134
34909
  }
34135
34910
  };
34136
- __publicField(MySqlSelectQueryBuilderBase, _a303, "MySqlSelectQueryBuilder");
34137
- MySqlSelectBase = class extends (_b226 = MySqlSelectQueryBuilderBase, _a304 = entityKind, _b226) {
34911
+ __publicField(MySqlSelectQueryBuilderBase, _a305, "MySqlSelectQueryBuilder");
34912
+ MySqlSelectBase = class extends (_b226 = MySqlSelectQueryBuilderBase, _a306 = entityKind, _b226) {
34138
34913
  constructor() {
34139
34914
  super(...arguments);
34140
34915
  __publicField(this, "execute", (placeholderValues) => {
@@ -34158,7 +34933,7 @@ var init_select4 = __esm({
34158
34933
  return query;
34159
34934
  }
34160
34935
  };
34161
- __publicField(MySqlSelectBase, _a304, "MySqlSelect");
34936
+ __publicField(MySqlSelectBase, _a306, "MySqlSelect");
34162
34937
  applyMixins(MySqlSelectBase, [QueryPromise]);
34163
34938
  getMySqlSetOperators = () => ({
34164
34939
  union: union3,
@@ -34178,7 +34953,7 @@ var init_select4 = __esm({
34178
34953
  });
34179
34954
 
34180
34955
  // ../drizzle-orm/dist/mysql-core/query-builders/query-builder.js
34181
- var _a305, QueryBuilder3;
34956
+ var _a307, QueryBuilder3;
34182
34957
  var init_query_builder4 = __esm({
34183
34958
  "../drizzle-orm/dist/mysql-core/query-builders/query-builder.js"() {
34184
34959
  "use strict";
@@ -34187,7 +34962,7 @@ var init_query_builder4 = __esm({
34187
34962
  init_selection_proxy();
34188
34963
  init_subquery();
34189
34964
  init_select4();
34190
- _a305 = entityKind;
34965
+ _a307 = entityKind;
34191
34966
  QueryBuilder3 = class {
34192
34967
  constructor(dialect4) {
34193
34968
  __publicField(this, "dialect");
@@ -34249,7 +35024,7 @@ var init_query_builder4 = __esm({
34249
35024
  return this.dialect;
34250
35025
  }
34251
35026
  };
34252
- __publicField(QueryBuilder3, _a305, "MySqlQueryBuilder");
35027
+ __publicField(QueryBuilder3, _a307, "MySqlQueryBuilder");
34253
35028
  }
34254
35029
  });
34255
35030
 
@@ -34261,14 +35036,14 @@ var init_select_types3 = __esm({
34261
35036
  });
34262
35037
 
34263
35038
  // ../drizzle-orm/dist/mysql-core/query-builders/update.js
34264
- var _a306, MySqlUpdateBuilder, _a307, _b227, MySqlUpdateBase;
35039
+ var _a308, MySqlUpdateBuilder, _a309, _b227, MySqlUpdateBase;
34265
35040
  var init_update3 = __esm({
34266
35041
  "../drizzle-orm/dist/mysql-core/query-builders/update.js"() {
34267
35042
  "use strict";
34268
35043
  init_entity();
34269
35044
  init_query_promise();
34270
35045
  init_utils2();
34271
- _a306 = entityKind;
35046
+ _a308 = entityKind;
34272
35047
  MySqlUpdateBuilder = class {
34273
35048
  constructor(table4, session, dialect4, withList) {
34274
35049
  this.table = table4;
@@ -34280,8 +35055,8 @@ var init_update3 = __esm({
34280
35055
  return new MySqlUpdateBase(this.table, mapUpdateSet(this.table, values), this.session, this.dialect, this.withList);
34281
35056
  }
34282
35057
  };
34283
- __publicField(MySqlUpdateBuilder, _a306, "MySqlUpdateBuilder");
34284
- MySqlUpdateBase = class extends (_b227 = QueryPromise, _a307 = entityKind, _b227) {
35058
+ __publicField(MySqlUpdateBuilder, _a308, "MySqlUpdateBuilder");
35059
+ MySqlUpdateBase = class extends (_b227 = QueryPromise, _a309 = entityKind, _b227) {
34285
35060
  constructor(table4, set, session, dialect4, withList) {
34286
35061
  super();
34287
35062
  __publicField(this, "config");
@@ -34354,7 +35129,7 @@ var init_update3 = __esm({
34354
35129
  return this;
34355
35130
  }
34356
35131
  };
34357
- __publicField(MySqlUpdateBase, _a307, "MySqlUpdate");
35132
+ __publicField(MySqlUpdateBase, _a309, "MySqlUpdate");
34358
35133
  }
34359
35134
  });
34360
35135
 
@@ -34372,14 +35147,14 @@ var init_query_builders3 = __esm({
34372
35147
  });
34373
35148
 
34374
35149
  // ../drizzle-orm/dist/mysql-core/query-builders/query.js
34375
- var _a308, RelationalQueryBuilder3, _a309, _b228, MySqlRelationalQuery;
35150
+ var _a310, RelationalQueryBuilder3, _a311, _b228, MySqlRelationalQuery;
34376
35151
  var init_query3 = __esm({
34377
35152
  "../drizzle-orm/dist/mysql-core/query-builders/query.js"() {
34378
35153
  "use strict";
34379
35154
  init_entity();
34380
35155
  init_query_promise();
34381
35156
  init_relations();
34382
- _a308 = entityKind;
35157
+ _a310 = entityKind;
34383
35158
  RelationalQueryBuilder3 = class {
34384
35159
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, mode) {
34385
35160
  this.fullSchema = fullSchema;
@@ -34420,8 +35195,8 @@ var init_query3 = __esm({
34420
35195
  );
34421
35196
  }
34422
35197
  };
34423
- __publicField(RelationalQueryBuilder3, _a308, "MySqlRelationalQueryBuilder");
34424
- MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a309 = entityKind, _b228) {
35198
+ __publicField(RelationalQueryBuilder3, _a310, "MySqlRelationalQueryBuilder");
35199
+ MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a311 = entityKind, _b228) {
34425
35200
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, config, queryMode, mode) {
34426
35201
  super();
34427
35202
  this.fullSchema = fullSchema;
@@ -34485,12 +35260,12 @@ var init_query3 = __esm({
34485
35260
  return this.prepare().execute();
34486
35261
  }
34487
35262
  };
34488
- __publicField(MySqlRelationalQuery, _a309, "MySqlRelationalQuery");
35263
+ __publicField(MySqlRelationalQuery, _a311, "MySqlRelationalQuery");
34489
35264
  }
34490
35265
  });
34491
35266
 
34492
35267
  // ../drizzle-orm/dist/mysql-core/db.js
34493
- var _a310, MySqlDatabase;
35268
+ var _a312, MySqlDatabase;
34494
35269
  var init_db3 = __esm({
34495
35270
  "../drizzle-orm/dist/mysql-core/db.js"() {
34496
35271
  "use strict";
@@ -34501,7 +35276,7 @@ var init_db3 = __esm({
34501
35276
  init_count3();
34502
35277
  init_query_builders3();
34503
35278
  init_query3();
34504
- _a310 = entityKind;
35279
+ _a312 = entityKind;
34505
35280
  MySqlDatabase = class {
34506
35281
  constructor(dialect4, session, schema4, mode) {
34507
35282
  __publicField(this, "query");
@@ -34714,17 +35489,17 @@ var init_db3 = __esm({
34714
35489
  return this.session.transaction(transaction, config);
34715
35490
  }
34716
35491
  };
34717
- __publicField(MySqlDatabase, _a310, "MySqlDatabase");
35492
+ __publicField(MySqlDatabase, _a312, "MySqlDatabase");
34718
35493
  }
34719
35494
  });
34720
35495
 
34721
35496
  // ../drizzle-orm/dist/mysql-core/indexes.js
34722
- var _a311, IndexBuilderOn3, _a312, IndexBuilder3, _a313, Index5;
35497
+ var _a313, IndexBuilderOn3, _a314, IndexBuilder3, _a315, Index5;
34723
35498
  var init_indexes3 = __esm({
34724
35499
  "../drizzle-orm/dist/mysql-core/indexes.js"() {
34725
35500
  "use strict";
34726
35501
  init_entity();
34727
- _a311 = entityKind;
35502
+ _a313 = entityKind;
34728
35503
  IndexBuilderOn3 = class {
34729
35504
  constructor(name2, unique) {
34730
35505
  this.name = name2;
@@ -34734,8 +35509,8 @@ var init_indexes3 = __esm({
34734
35509
  return new IndexBuilder3(this.name, columns, this.unique);
34735
35510
  }
34736
35511
  };
34737
- __publicField(IndexBuilderOn3, _a311, "MySqlIndexBuilderOn");
34738
- _a312 = entityKind;
35512
+ __publicField(IndexBuilderOn3, _a313, "MySqlIndexBuilderOn");
35513
+ _a314 = entityKind;
34739
35514
  IndexBuilder3 = class {
34740
35515
  constructor(name2, columns, unique) {
34741
35516
  /** @internal */
@@ -34763,26 +35538,26 @@ var init_indexes3 = __esm({
34763
35538
  return new Index5(this.config, table4);
34764
35539
  }
34765
35540
  };
34766
- __publicField(IndexBuilder3, _a312, "MySqlIndexBuilder");
34767
- _a313 = entityKind;
35541
+ __publicField(IndexBuilder3, _a314, "MySqlIndexBuilder");
35542
+ _a315 = entityKind;
34768
35543
  Index5 = class {
34769
35544
  constructor(config, table4) {
34770
35545
  __publicField(this, "config");
34771
35546
  this.config = { ...config, table: table4 };
34772
35547
  }
34773
35548
  };
34774
- __publicField(Index5, _a313, "MySqlIndex");
35549
+ __publicField(Index5, _a315, "MySqlIndex");
34775
35550
  }
34776
35551
  });
34777
35552
 
34778
35553
  // ../drizzle-orm/dist/mysql-core/primary-keys.js
34779
- var _a314, PrimaryKeyBuilder3, _a315, PrimaryKey3;
35554
+ var _a316, PrimaryKeyBuilder3, _a317, PrimaryKey3;
34780
35555
  var init_primary_keys3 = __esm({
34781
35556
  "../drizzle-orm/dist/mysql-core/primary-keys.js"() {
34782
35557
  "use strict";
34783
35558
  init_entity();
34784
35559
  init_table4();
34785
- _a314 = entityKind;
35560
+ _a316 = entityKind;
34786
35561
  PrimaryKeyBuilder3 = class {
34787
35562
  constructor(columns, name2) {
34788
35563
  /** @internal */
@@ -34797,8 +35572,8 @@ var init_primary_keys3 = __esm({
34797
35572
  return new PrimaryKey3(table4, this.columns, this.name);
34798
35573
  }
34799
35574
  };
34800
- __publicField(PrimaryKeyBuilder3, _a314, "MySqlPrimaryKeyBuilder");
34801
- _a315 = entityKind;
35575
+ __publicField(PrimaryKeyBuilder3, _a316, "MySqlPrimaryKeyBuilder");
35576
+ _a317 = entityKind;
34802
35577
  PrimaryKey3 = class {
34803
35578
  constructor(table4, columns, name2) {
34804
35579
  __publicField(this, "columns");
@@ -34811,7 +35586,7 @@ var init_primary_keys3 = __esm({
34811
35586
  return this.name ?? `${this.table[MySqlTable.Symbol.Name]}_${this.columns.map((column4) => column4.name).join("_")}_pk`;
34812
35587
  }
34813
35588
  };
34814
- __publicField(PrimaryKey3, _a315, "MySqlPrimaryKey");
35589
+ __publicField(PrimaryKey3, _a317, "MySqlPrimaryKey");
34815
35590
  }
34816
35591
  });
34817
35592
 
@@ -34831,7 +35606,7 @@ function mysqlViewWithSchema(name2, selection, schema4) {
34831
35606
  }
34832
35607
  return new ViewBuilder3(name2, schema4);
34833
35608
  }
34834
- var _a316, ViewBuilderCore2, _a317, _b229, ViewBuilder3, _a318, _b230, ManualViewBuilder3, _a319, _b231, _c11, MySqlView;
35609
+ var _a318, ViewBuilderCore2, _a319, _b229, ViewBuilder3, _a320, _b230, ManualViewBuilder3, _a321, _b231, _c11, MySqlView;
34835
35610
  var init_view3 = __esm({
34836
35611
  "../drizzle-orm/dist/mysql-core/view.js"() {
34837
35612
  "use strict";
@@ -34842,7 +35617,7 @@ var init_view3 = __esm({
34842
35617
  init_table4();
34843
35618
  init_view_base3();
34844
35619
  init_view_common4();
34845
- _a316 = entityKind;
35620
+ _a318 = entityKind;
34846
35621
  ViewBuilderCore2 = class {
34847
35622
  constructor(name2, schema4) {
34848
35623
  __publicField(this, "config", {});
@@ -34866,8 +35641,8 @@ var init_view3 = __esm({
34866
35641
  return this;
34867
35642
  }
34868
35643
  };
34869
- __publicField(ViewBuilderCore2, _a316, "MySqlViewBuilder");
34870
- ViewBuilder3 = class extends (_b229 = ViewBuilderCore2, _a317 = entityKind, _b229) {
35644
+ __publicField(ViewBuilderCore2, _a318, "MySqlViewBuilder");
35645
+ ViewBuilder3 = class extends (_b229 = ViewBuilderCore2, _a319 = entityKind, _b229) {
34871
35646
  as(qb) {
34872
35647
  if (typeof qb === "function") {
34873
35648
  qb = qb(new QueryBuilder3());
@@ -34893,8 +35668,8 @@ var init_view3 = __esm({
34893
35668
  );
34894
35669
  }
34895
35670
  };
34896
- __publicField(ViewBuilder3, _a317, "MySqlViewBuilder");
34897
- ManualViewBuilder3 = class extends (_b230 = ViewBuilderCore2, _a318 = entityKind, _b230) {
35671
+ __publicField(ViewBuilder3, _a319, "MySqlViewBuilder");
35672
+ ManualViewBuilder3 = class extends (_b230 = ViewBuilderCore2, _a320 = entityKind, _b230) {
34898
35673
  constructor(name2, columns, schema4) {
34899
35674
  super(name2, schema4);
34900
35675
  __publicField(this, "columns");
@@ -34939,11 +35714,11 @@ var init_view3 = __esm({
34939
35714
  );
34940
35715
  }
34941
35716
  };
34942
- __publicField(ManualViewBuilder3, _a318, "MySqlManualViewBuilder");
34943
- MySqlView = class extends (_c11 = MySqlViewBase, _b231 = entityKind, _a319 = MySqlViewConfig, _c11) {
35717
+ __publicField(ManualViewBuilder3, _a320, "MySqlManualViewBuilder");
35718
+ MySqlView = class extends (_c11 = MySqlViewBase, _b231 = entityKind, _a321 = MySqlViewConfig, _c11) {
34944
35719
  constructor({ mysqlConfig, config }) {
34945
35720
  super(config);
34946
- __publicField(this, _a319);
35721
+ __publicField(this, _a321);
34947
35722
  this[MySqlViewConfig] = mysqlConfig;
34948
35723
  }
34949
35724
  };
@@ -34952,14 +35727,14 @@ var init_view3 = __esm({
34952
35727
  });
34953
35728
 
34954
35729
  // ../drizzle-orm/dist/mysql-core/schema.js
34955
- var _a320, MySqlSchema5;
35730
+ var _a322, MySqlSchema5;
34956
35731
  var init_schema2 = __esm({
34957
35732
  "../drizzle-orm/dist/mysql-core/schema.js"() {
34958
35733
  "use strict";
34959
35734
  init_entity();
34960
35735
  init_table4();
34961
35736
  init_view3();
34962
- _a320 = entityKind;
35737
+ _a322 = entityKind;
34963
35738
  MySqlSchema5 = class {
34964
35739
  constructor(schemaName) {
34965
35740
  __publicField(this, "table", (name2, columns, extraConfig) => {
@@ -34971,12 +35746,12 @@ var init_schema2 = __esm({
34971
35746
  this.schemaName = schemaName;
34972
35747
  }
34973
35748
  };
34974
- __publicField(MySqlSchema5, _a320, "MySqlSchema");
35749
+ __publicField(MySqlSchema5, _a322, "MySqlSchema");
34975
35750
  }
34976
35751
  });
34977
35752
 
34978
35753
  // ../drizzle-orm/dist/mysql-core/session.js
34979
- var _a321, MySqlPreparedQuery, _a322, MySqlSession, _a323, _b232, MySqlTransaction;
35754
+ var _a323, MySqlPreparedQuery, _a324, MySqlSession, _a325, _b232, MySqlTransaction;
34980
35755
  var init_session3 = __esm({
34981
35756
  "../drizzle-orm/dist/mysql-core/session.js"() {
34982
35757
  "use strict";
@@ -34984,15 +35759,15 @@ var init_session3 = __esm({
34984
35759
  init_errors();
34985
35760
  init_sql();
34986
35761
  init_db3();
34987
- _a321 = entityKind;
35762
+ _a323 = entityKind;
34988
35763
  MySqlPreparedQuery = class {
34989
35764
  constructor() {
34990
35765
  /** @internal */
34991
35766
  __publicField(this, "joinsNotNullableMap");
34992
35767
  }
34993
35768
  };
34994
- __publicField(MySqlPreparedQuery, _a321, "MySqlPreparedQuery");
34995
- _a322 = entityKind;
35769
+ __publicField(MySqlPreparedQuery, _a323, "MySqlPreparedQuery");
35770
+ _a324 = entityKind;
34996
35771
  MySqlSession = class {
34997
35772
  constructor(dialect4) {
34998
35773
  this.dialect = dialect4;
@@ -35027,8 +35802,8 @@ var init_session3 = __esm({
35027
35802
  return parts.length ? sql`start transaction ${sql.raw(parts.join(" "))}` : void 0;
35028
35803
  }
35029
35804
  };
35030
- __publicField(MySqlSession, _a322, "MySqlSession");
35031
- MySqlTransaction = class extends (_b232 = MySqlDatabase, _a323 = entityKind, _b232) {
35805
+ __publicField(MySqlSession, _a324, "MySqlSession");
35806
+ MySqlTransaction = class extends (_b232 = MySqlDatabase, _a325 = entityKind, _b232) {
35032
35807
  constructor(dialect4, session, schema4, nestedIndex, mode) {
35033
35808
  super(dialect4, session, schema4, mode);
35034
35809
  this.schema = schema4;
@@ -35038,7 +35813,7 @@ var init_session3 = __esm({
35038
35813
  throw new TransactionRollbackError();
35039
35814
  }
35040
35815
  };
35041
- __publicField(MySqlTransaction, _a323, "MySqlTransaction");
35816
+ __publicField(MySqlTransaction, _a325, "MySqlTransaction");
35042
35817
  }
35043
35818
  });
35044
35819
 
@@ -35736,6 +36511,13 @@ var init_cli = __esm({
35736
36511
  breakpoints: booleanType().optional().default(true),
35737
36512
  migrations: objectType({
35738
36513
  prefix: prefix.optional().default("index")
36514
+ }).optional(),
36515
+ entities: objectType({
36516
+ roles: booleanType().or(objectType({
36517
+ provider: stringType().optional(),
36518
+ include: stringType().array().optional(),
36519
+ exclude: stringType().array().optional()
36520
+ })).optional().default(false)
35739
36521
  }).optional()
35740
36522
  }).passthrough();
35741
36523
  configCheck = objectType({
@@ -36002,6 +36784,7 @@ var init_pgImports = __esm({
36002
36784
  const enums = [];
36003
36785
  const schemas = [];
36004
36786
  const sequences = [];
36787
+ const roles = [];
36005
36788
  const i0values = Object.values(exports2);
36006
36789
  i0values.forEach((t) => {
36007
36790
  if (isPgEnum(t)) {
@@ -36017,8 +36800,11 @@ var init_pgImports = __esm({
36017
36800
  if (isPgSequence(t)) {
36018
36801
  sequences.push(t);
36019
36802
  }
36803
+ if (is(t, PgRole)) {
36804
+ roles.push(t);
36805
+ }
36020
36806
  });
36021
- return { tables, enums, schemas, sequences };
36807
+ return { tables, enums, schemas, sequences, roles };
36022
36808
  };
36023
36809
  }
36024
36810
  });
@@ -36426,7 +37212,7 @@ init_mjs();
36426
37212
  init_global();
36427
37213
  init_pgSerializer();
36428
37214
  init_views();
36429
- var pgPushIntrospect = async (db, filters, schemaFilters) => {
37215
+ var pgPushIntrospect = async (db, filters, schemaFilters, entities = { roles: true }) => {
36430
37216
  const matchers = filters.map((it) => {
36431
37217
  return new Minimatch(it);
36432
37218
  });
@@ -36454,7 +37240,7 @@ var pgPushIntrospect = async (db, filters, schemaFilters) => {
36454
37240
  );
36455
37241
  const res = await (0, import_hanji3.renderWithTask)(
36456
37242
  progress,
36457
- fromDatabase(db, filter2, schemaFilters)
37243
+ fromDatabase(db, filter2, schemaFilters, entities)
36458
37244
  );
36459
37245
  const schema4 = { id: originUUID, prevId: "", ...res };
36460
37246
  const { internal, ...schemaWithoutInternals } = schema4;
@@ -36932,6 +37718,7 @@ var generateDrizzleJson = (imports, prevId, schemaFilters, casing2) => {
36932
37718
  prepared.enums,
36933
37719
  prepared.schemas,
36934
37720
  prepared.sequences,
37721
+ prepared.roles,
36935
37722
  casing2,
36936
37723
  schemaFilters
36937
37724
  );
@@ -36953,6 +37740,8 @@ var generateMigration = async (prev, cur) => {
36953
37740
  schemasResolver,
36954
37741
  enumsResolver,
36955
37742
  sequencesResolver,
37743
+ policyResolver,
37744
+ roleResolver,
36956
37745
  tablesResolver,
36957
37746
  columnsResolver,
36958
37747
  validatedPrev,
@@ -36985,6 +37774,8 @@ var pushSchema = async (imports, drizzleInstance, schemaFilters) => {
36985
37774
  schemasResolver,
36986
37775
  enumsResolver,
36987
37776
  sequencesResolver,
37777
+ policyResolver,
37778
+ roleResolver,
36988
37779
  tablesResolver,
36989
37780
  columnsResolver,
36990
37781
  validatedPrev,