drizzle-kit 0.25.0-a345cb3 → 0.25.0-a5ec472

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, 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;
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, 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;
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,20 +12300,22 @@ var init_sqlgenerator = __esm({
12056
12300
  }
12057
12301
  convert(st) {
12058
12302
  const { name: name2, values, schema: schema4 } = st;
12059
- const tableNameWithSchema = schema4 ? `"${schema4}"."${name2}"` : `"${name2}"`;
12303
+ const enumNameWithSchema = schema4 ? `"${schema4}"."${name2}"` : `"${name2}"`;
12060
12304
  let valuesStatement = "(";
12061
12305
  valuesStatement += values.map((it) => `'${it}'`).join(", ");
12062
12306
  valuesStatement += ")";
12063
- let statement = "DO $$ BEGIN";
12064
- statement += "\n";
12065
- statement += ` CREATE TYPE ${tableNameWithSchema} AS ENUM${valuesStatement};`;
12066
- statement += "\n";
12067
- statement += "EXCEPTION";
12068
- statement += "\n";
12069
- statement += " WHEN duplicate_object THEN null;";
12070
- statement += "\n";
12071
- statement += "END $$;";
12072
- statement += "\n";
12307
+ let statement = `CREATE TYPE ${enumNameWithSchema} AS ENUM${valuesStatement};`;
12308
+ return statement;
12309
+ }
12310
+ };
12311
+ DropTypeEnumConvertor = class extends Convertor {
12312
+ can(statement) {
12313
+ return statement.type === "drop_type_enum";
12314
+ }
12315
+ convert(st) {
12316
+ const { name: name2, schema: schema4 } = st;
12317
+ const enumNameWithSchema = schema4 ? `"${schema4}"."${name2}"` : `"${name2}"`;
12318
+ let statement = `DROP TYPE ${enumNameWithSchema};`;
12073
12319
  return statement;
12074
12320
  }
12075
12321
  };
@@ -12078,9 +12324,56 @@ var init_sqlgenerator = __esm({
12078
12324
  return statement.type === "alter_type_add_value";
12079
12325
  }
12080
12326
  convert(st) {
12081
- const { name: name2, schema: schema4, value } = st;
12082
- const schemaPrefix = schema4 && schema4 !== "public" ? `"${schema4}".` : "";
12083
- return `ALTER TYPE ${schemaPrefix}"${name2}" ADD VALUE '${value}';`;
12327
+ const { name: name2, schema: schema4, value, before } = st;
12328
+ const enumNameWithSchema = schema4 ? `"${schema4}"."${name2}"` : `"${name2}"`;
12329
+ return `ALTER TYPE ${enumNameWithSchema} ADD VALUE '${value}'${before.length ? ` BEFORE '${before}'` : ""};`;
12330
+ }
12331
+ };
12332
+ AlterTypeSetSchemaConvertor = class extends Convertor {
12333
+ can(statement) {
12334
+ return statement.type === "move_type_enum";
12335
+ }
12336
+ convert(st) {
12337
+ const { name: name2, schemaFrom, schemaTo } = st;
12338
+ const enumNameWithSchema = schemaFrom ? `"${schemaFrom}"."${name2}"` : `"${name2}"`;
12339
+ return `ALTER TYPE ${enumNameWithSchema} SET SCHEMA "${schemaTo}";`;
12340
+ }
12341
+ };
12342
+ AlterRenameTypeConvertor = class extends Convertor {
12343
+ can(statement) {
12344
+ return statement.type === "rename_type_enum";
12345
+ }
12346
+ convert(st) {
12347
+ const { nameTo, nameFrom, schema: schema4 } = st;
12348
+ const enumNameWithSchema = schema4 ? `"${schema4}"."${nameFrom}"` : `"${nameFrom}"`;
12349
+ return `ALTER TYPE ${enumNameWithSchema} RENAME TO "${nameTo}";`;
12350
+ }
12351
+ };
12352
+ AlterTypeDropValueConvertor = class extends Convertor {
12353
+ can(statement) {
12354
+ return statement.type === "alter_type_drop_value";
12355
+ }
12356
+ convert(st) {
12357
+ const { columnsWithEnum, name: name2, newValues, schema: schema4 } = st;
12358
+ const statements = [];
12359
+ for (const withEnum of columnsWithEnum) {
12360
+ statements.push(
12361
+ `ALTER TABLE "${withEnum.schema}"."${withEnum.table}" ALTER COLUMN "${withEnum.column}" SET DATA TYPE text;`
12362
+ );
12363
+ }
12364
+ statements.push(new DropTypeEnumConvertor().convert({ name: name2, schema: schema4, type: "drop_type_enum" }));
12365
+ statements.push(new CreateTypeEnumConvertor().convert({
12366
+ name: name2,
12367
+ schema: schema4,
12368
+ values: newValues,
12369
+ type: "create_type_enum"
12370
+ }));
12371
+ for (const withEnum of columnsWithEnum) {
12372
+ statements.push(
12373
+ `ALTER TABLE "${withEnum.schema}"."${withEnum.table}" ALTER COLUMN "${withEnum.column}" SET DATA TYPE "${schema4}"."${name2}" USING "${withEnum.column}"::"${schema4}"."${name2}";`
12374
+ );
12375
+ }
12376
+ return statements;
12084
12377
  }
12085
12378
  };
12086
12379
  PgDropTableConvertor = class extends Convertor {
@@ -12088,9 +12381,21 @@ var init_sqlgenerator = __esm({
12088
12381
  return statement.type === "drop_table" && dialect4 === "postgresql";
12089
12382
  }
12090
12383
  convert(statement) {
12091
- const { tableName, schema: schema4 } = statement;
12384
+ const { tableName, schema: schema4, policies } = statement;
12092
12385
  const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
12093
- return `DROP TABLE ${tableNameWithSchema};`;
12386
+ const dropPolicyConvertor = new PgDropPolicyConvertor();
12387
+ const droppedPolicies = policies?.map((p) => {
12388
+ return dropPolicyConvertor.convert({
12389
+ type: "drop_policy",
12390
+ tableName,
12391
+ data: PgSquasher.unsquashPolicy(p),
12392
+ schema: schema4
12393
+ });
12394
+ }) ?? [];
12395
+ return [
12396
+ ...droppedPolicies,
12397
+ `DROP TABLE ${tableNameWithSchema};`
12398
+ ];
12094
12399
  }
12095
12400
  };
12096
12401
  MySQLDropTableConvertor = class extends Convertor {
@@ -13224,6 +13529,11 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
13224
13529
  convertors.push(new SQLiteRecreateTableConvertor());
13225
13530
  convertors.push(new LibSQLRecreateTableConvertor());
13226
13531
  convertors.push(new CreateTypeEnumConvertor());
13532
+ convertors.push(new DropTypeEnumConvertor());
13533
+ convertors.push(new AlterTypeAddValueConvertor());
13534
+ convertors.push(new AlterTypeSetSchemaConvertor());
13535
+ convertors.push(new AlterRenameTypeConvertor());
13536
+ convertors.push(new AlterTypeDropValueConvertor());
13227
13537
  convertors.push(new CreatePgSequenceConvertor());
13228
13538
  convertors.push(new DropPgSequenceConvertor());
13229
13539
  convertors.push(new RenamePgSequenceConvertor());
@@ -13255,13 +13565,22 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
13255
13565
  convertors.push(new PgDropIndexConvertor());
13256
13566
  convertors.push(new SqliteDropIndexConvertor());
13257
13567
  convertors.push(new MySqlDropIndexConvertor());
13258
- convertors.push(new AlterTypeAddValueConvertor());
13259
13568
  convertors.push(new PgAlterTableAlterColumnSetPrimaryKeyConvertor());
13260
13569
  convertors.push(new PgAlterTableAlterColumnDropPrimaryKeyConvertor());
13261
13570
  convertors.push(new PgAlterTableAlterColumnSetNotNullConvertor());
13262
13571
  convertors.push(new PgAlterTableAlterColumnDropNotNullConvertor());
13263
13572
  convertors.push(new PgAlterTableAlterColumnSetDefaultConvertor());
13264
13573
  convertors.push(new PgAlterTableAlterColumnDropDefaultConvertor());
13574
+ convertors.push(new PgAlterPolicyConvertor());
13575
+ convertors.push(new PgCreatePolicyConvertor());
13576
+ convertors.push(new PgDropPolicyConvertor());
13577
+ convertors.push(new PgRenamePolicyConvertor());
13578
+ convertors.push(new PgEnableRlsConvertor());
13579
+ convertors.push(new PgDisableRlsConvertor());
13580
+ convertors.push(new PgDropRoleConvertor());
13581
+ convertors.push(new PgAlterRoleConvertor());
13582
+ convertors.push(new PgCreateRoleConvertor());
13583
+ convertors.push(new PgRenameRoleConvertor());
13265
13584
  convertors.push(new PgAlterTableAlterColumnSetExpressionConvertor());
13266
13585
  convertors.push(new PgAlterTableAlterColumnDropGeneratedConvertor());
13267
13586
  convertors.push(new PgAlterTableAlterColumnAlterrGeneratedConvertor());
@@ -13556,7 +13875,7 @@ var init_sqlitePushUtils = __esm({
13556
13875
  });
13557
13876
 
13558
13877
  // src/jsonStatements.ts
13559
- var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, 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;
13878
+ var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumValues, 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;
13560
13879
  var init_jsonStatements = __esm({
13561
13880
  "src/jsonStatements.ts"() {
13562
13881
  "use strict";
@@ -13567,7 +13886,7 @@ var init_jsonStatements = __esm({
13567
13886
  init_pgSchema();
13568
13887
  init_sqliteSchema();
13569
13888
  preparePgCreateTableJson = (table4, json22) => {
13570
- const { name: name2, schema: schema4, columns, compositePrimaryKeys, uniqueConstraints } = table4;
13889
+ const { name: name2, schema: schema4, columns, compositePrimaryKeys, uniqueConstraints, policies } = table4;
13571
13890
  const tableKey2 = `${schema4 || "public"}.${name2}`;
13572
13891
  const compositePkName = Object.values(compositePrimaryKeys).length > 0 ? json22.tables[tableKey2].compositePrimaryKeys[`${PgSquasher.unsquashPK(Object.values(compositePrimaryKeys)[0]).name}`].name : "";
13573
13892
  return {
@@ -13577,7 +13896,8 @@ var init_jsonStatements = __esm({
13577
13896
  columns: Object.values(columns),
13578
13897
  compositePKs: Object.values(compositePrimaryKeys),
13579
13898
  compositePkName,
13580
- uniqueConstraints: Object.values(uniqueConstraints)
13899
+ uniqueConstraints: Object.values(uniqueConstraints),
13900
+ policies: Object.values(policies)
13581
13901
  };
13582
13902
  };
13583
13903
  prepareMySqlCreateTableJson = (table4, json22, internals) => {
@@ -13615,7 +13935,8 @@ var init_jsonStatements = __esm({
13615
13935
  return {
13616
13936
  type: "drop_table",
13617
13937
  tableName: table4.name,
13618
- schema: table4.schema
13938
+ schema: table4.schema,
13939
+ policies: table4.policies ? Object.values(table4.policies) : []
13619
13940
  };
13620
13941
  };
13621
13942
  prepareRenameTableJson = (tableFrom, tableTo) => {
@@ -13646,6 +13967,27 @@ var init_jsonStatements = __esm({
13646
13967
  };
13647
13968
  });
13648
13969
  };
13970
+ prepareDropEnumValues = (name2, schema4, removedValues, json22) => {
13971
+ if (!removedValues.length) return [];
13972
+ const affectedColumns = [];
13973
+ for (const tableKey2 in json22.tables) {
13974
+ const table4 = json22.tables[tableKey2];
13975
+ for (const columnKey in table4.columns) {
13976
+ const column4 = table4.columns[columnKey];
13977
+ if (column4.type === name2 && column4.typeSchema === schema4) {
13978
+ affectedColumns.push({ schema: table4.schema || "public", table: table4.name, column: column4.name });
13979
+ }
13980
+ }
13981
+ }
13982
+ return [{
13983
+ type: "alter_type_drop_value",
13984
+ name: name2,
13985
+ schema: schema4,
13986
+ deletedValues: removedValues,
13987
+ newValues: json22.enums[`${schema4}.${name2}`].values,
13988
+ columnsWithEnum: affectedColumns
13989
+ }];
13990
+ };
13649
13991
  prepareDropEnumJson = (name2, schema4) => {
13650
13992
  return {
13651
13993
  type: "drop_type_enum",
@@ -13712,6 +14054,41 @@ var init_jsonStatements = __esm({
13712
14054
  schema: schema4
13713
14055
  };
13714
14056
  };
14057
+ prepareCreateRoleJson = (role) => {
14058
+ return {
14059
+ type: "create_role",
14060
+ name: role.name,
14061
+ values: {
14062
+ createDb: role.createDb,
14063
+ createRole: role.createRole,
14064
+ inherit: role.inherit
14065
+ }
14066
+ };
14067
+ };
14068
+ prepareAlterRoleJson = (role) => {
14069
+ return {
14070
+ type: "alter_role",
14071
+ name: role.name,
14072
+ values: {
14073
+ createDb: role.createDb,
14074
+ createRole: role.createRole,
14075
+ inherit: role.inherit
14076
+ }
14077
+ };
14078
+ };
14079
+ prepareDropRoleJson = (name2) => {
14080
+ return {
14081
+ type: "drop_role",
14082
+ name: name2
14083
+ };
14084
+ };
14085
+ prepareRenameRoleJson = (nameFrom, nameTo) => {
14086
+ return {
14087
+ type: "rename_role",
14088
+ nameFrom,
14089
+ nameTo
14090
+ };
14091
+ };
13715
14092
  prepareCreateSchemasJson = (values) => {
13716
14093
  return values.map((it) => {
13717
14094
  return {
@@ -14608,6 +14985,46 @@ var init_jsonStatements = __esm({
14608
14985
  }
14609
14986
  return [...dropPkStatements, ...setPkStatements, ...statements];
14610
14987
  };
14988
+ prepareRenamePolicyJsons = (tableName, schema4, renames) => {
14989
+ return renames.map((it) => {
14990
+ return {
14991
+ type: "rename_policy",
14992
+ tableName,
14993
+ oldName: it.from.name,
14994
+ newName: it.to.name,
14995
+ schema: schema4
14996
+ };
14997
+ });
14998
+ };
14999
+ prepareCreatePolicyJsons = (tableName, schema4, policies) => {
15000
+ return policies.map((it) => {
15001
+ return {
15002
+ type: "create_policy",
15003
+ tableName,
15004
+ data: it,
15005
+ schema: schema4
15006
+ };
15007
+ });
15008
+ };
15009
+ prepareDropPolicyJsons = (tableName, schema4, policies) => {
15010
+ return policies.map((it) => {
15011
+ return {
15012
+ type: "drop_policy",
15013
+ tableName,
15014
+ data: it,
15015
+ schema: schema4
15016
+ };
15017
+ });
15018
+ };
15019
+ prepareAlterPolicyJson = (tableName, schema4, oldPolicy, newPolicy) => {
15020
+ return {
15021
+ type: "alter_policy",
15022
+ tableName,
15023
+ oldData: oldPolicy,
15024
+ newData: newPolicy,
15025
+ schema: schema4
15026
+ };
15027
+ };
14611
15028
  preparePgCreateIndexesJson = (tableName, schema4, indexes, fullSchema, action) => {
14612
15029
  if (action === "push") {
14613
15030
  return Object.values(indexes).map((indexData) => {
@@ -15313,7 +15730,8 @@ var init_snapshotsDiffer = __esm({
15313
15730
  indexes: recordType(stringType(), stringType()),
15314
15731
  foreignKeys: recordType(stringType(), stringType()),
15315
15732
  compositePrimaryKeys: recordType(stringType(), stringType()).default({}),
15316
- uniqueConstraints: recordType(stringType(), stringType()).default({})
15733
+ uniqueConstraints: recordType(stringType(), stringType()).default({}),
15734
+ policies: recordType(stringType(), stringType()).default({})
15317
15735
  }).strict();
15318
15736
  alteredTableScheme = objectType({
15319
15737
  name: stringType(),
@@ -15354,12 +15772,22 @@ var init_snapshotsDiffer = __esm({
15354
15772
  __new: stringType(),
15355
15773
  __old: stringType()
15356
15774
  })
15775
+ ),
15776
+ addedPolicies: recordType(stringType(), stringType()),
15777
+ deletedPolicies: recordType(stringType(), stringType()),
15778
+ alteredPolicies: recordType(
15779
+ stringType(),
15780
+ objectType({
15781
+ __new: stringType(),
15782
+ __old: stringType()
15783
+ })
15357
15784
  )
15358
15785
  }).strict();
15359
15786
  diffResultScheme = objectType({
15360
15787
  alteredTablesWithColumns: alteredTableScheme.array(),
15361
15788
  alteredEnums: changedEnumSchema.array(),
15362
- alteredSequences: sequenceSquashed.array()
15789
+ alteredSequences: sequenceSquashed.array(),
15790
+ alteredRoles: roleSchema.array()
15363
15791
  }).strict();
15364
15792
  diffResultSchemeMysql = objectType({
15365
15793
  alteredTablesWithColumns: alteredTableScheme.array(),
@@ -15414,7 +15842,7 @@ var init_snapshotsDiffer = __esm({
15414
15842
  }
15415
15843
  return column4;
15416
15844
  };
15417
- applyPgSnapshotsDiff = async (json1, json22, schemasResolver2, enumsResolver2, sequencesResolver2, tablesResolver2, columnsResolver2, prevFull, curFull, action) => {
15845
+ applyPgSnapshotsDiff = async (json1, json22, schemasResolver2, enumsResolver2, sequencesResolver2, policyResolver2, roleResolver2, tablesResolver2, columnsResolver2, prevFull, curFull, action) => {
15418
15846
  const schemasDiff = diffSchemasOrTables(json1.schemas, json22.schemas);
15419
15847
  const {
15420
15848
  created: createdSchemas,
@@ -15564,6 +15992,47 @@ var init_snapshotsDiffer = __esm({
15564
15992
  return [tableKey2, tableValue];
15565
15993
  }
15566
15994
  );
15995
+ const rolesDiff = diffSchemasOrTables(
15996
+ schemasPatchedSnap1.roles,
15997
+ json22.roles
15998
+ );
15999
+ const {
16000
+ created: createdRoles,
16001
+ deleted: deletedRoles,
16002
+ renamed: renamedRoles
16003
+ } = await roleResolver2({
16004
+ created: rolesDiff.added,
16005
+ deleted: rolesDiff.deleted
16006
+ });
16007
+ schemasPatchedSnap1.roles = mapEntries(
16008
+ schemasPatchedSnap1.roles,
16009
+ (_2, it) => {
16010
+ const { name: name2 } = nameChangeFor(it, renamedRoles);
16011
+ it.name = name2;
16012
+ return [name2, it];
16013
+ }
16014
+ );
16015
+ const rolesChangeMap = renamedRoles.reduce(
16016
+ (acc, it) => {
16017
+ acc[it.from.name] = {
16018
+ nameFrom: it.from.name,
16019
+ nameTo: it.to.name
16020
+ };
16021
+ return acc;
16022
+ },
16023
+ {}
16024
+ );
16025
+ schemasPatchedSnap1.roles = mapEntries(
16026
+ schemasPatchedSnap1.roles,
16027
+ (roleKey, roleValue) => {
16028
+ const key = roleKey;
16029
+ const change = rolesChangeMap[key];
16030
+ if (change) {
16031
+ roleValue.name = change.nameTo;
16032
+ }
16033
+ return [roleKey, roleValue];
16034
+ }
16035
+ );
15567
16036
  const tablesDiff = diffSchemasOrTables(
15568
16037
  schemasPatchedSnap1.tables,
15569
16038
  json22.tables
@@ -15642,6 +16111,65 @@ var init_snapshotsDiffer = __esm({
15642
16111
  return [tableKey2, tableValue];
15643
16112
  }
15644
16113
  );
16114
+ const policyRes = diffPolicies(tablesPatchedSnap1.tables, json22.tables);
16115
+ const policyRenames = [];
16116
+ const policyCreates = [];
16117
+ const policyDeletes = [];
16118
+ for (let entry of Object.values(policyRes)) {
16119
+ const { renamed, created, deleted } = await policyResolver2({
16120
+ tableName: entry.name,
16121
+ schema: entry.schema,
16122
+ deleted: entry.policies.deleted.map(PgSquasher.unsquashPolicy),
16123
+ created: entry.policies.added.map(PgSquasher.unsquashPolicy)
16124
+ });
16125
+ if (created.length > 0) {
16126
+ policyCreates.push({
16127
+ table: entry.name,
16128
+ schema: entry.schema,
16129
+ columns: created
16130
+ });
16131
+ }
16132
+ if (deleted.length > 0) {
16133
+ policyDeletes.push({
16134
+ table: entry.name,
16135
+ schema: entry.schema,
16136
+ columns: deleted
16137
+ });
16138
+ }
16139
+ if (renamed.length > 0) {
16140
+ policyRenames.push({
16141
+ table: entry.name,
16142
+ schema: entry.schema,
16143
+ renames: renamed
16144
+ });
16145
+ }
16146
+ }
16147
+ const policyRenamesDict = columnRenames.reduce(
16148
+ (acc, it) => {
16149
+ acc[`${it.schema || "public"}.${it.table}`] = it.renames;
16150
+ return acc;
16151
+ },
16152
+ {}
16153
+ );
16154
+ const policyPatchedSnap1 = copy(tablesPatchedSnap1);
16155
+ policyPatchedSnap1.tables = mapEntries(
16156
+ policyPatchedSnap1.tables,
16157
+ (tableKey2, tableValue) => {
16158
+ const patchedPolicies = mapKeys(
16159
+ tableValue.policies,
16160
+ (policyKey, policy2) => {
16161
+ const rens = policyRenamesDict[`${tableValue.schema || "public"}.${tableValue.name}`] || [];
16162
+ const newName = columnChangeFor(policyKey, rens);
16163
+ const unsquashedPolicy = PgSquasher.unsquashPolicy(policy2);
16164
+ unsquashedPolicy.name = newName;
16165
+ policy2 = PgSquasher.squashPolicy(unsquashedPolicy);
16166
+ return newName;
16167
+ }
16168
+ );
16169
+ tableValue.policies = patchedPolicies;
16170
+ return [tableKey2, tableValue];
16171
+ }
16172
+ );
15645
16173
  const diffResult = applyJsonDiff(columnsPatchedSnap1, json22);
15646
16174
  const typedResult = diffResultScheme.parse(diffResult);
15647
16175
  const jsonStatements = [];
@@ -15686,13 +16214,15 @@ var init_snapshotsDiffer = __esm({
15686
16214
  const jsonDeletedUniqueConstraints = [];
15687
16215
  const jsonAlteredUniqueConstraints = [];
15688
16216
  const jsonSetTableSchemas = [];
15689
- for (let it of movedTables) {
15690
- jsonSetTableSchemas.push({
15691
- type: "alter_table_set_schema",
15692
- tableName: it.name,
15693
- schemaFrom: it.schemaFrom || "public",
15694
- schemaTo: it.schemaTo || "public"
15695
- });
16217
+ if (movedTables) {
16218
+ for (let it of movedTables) {
16219
+ jsonSetTableSchemas.push({
16220
+ type: "alter_table_set_schema",
16221
+ tableName: it.name,
16222
+ schemaFrom: it.schemaFrom || "public",
16223
+ schemaTo: it.schemaTo || "public"
16224
+ });
16225
+ }
15696
16226
  }
15697
16227
  for (let it of alteredTables) {
15698
16228
  let addedColumns = [];
@@ -15797,7 +16327,99 @@ var init_snapshotsDiffer = __esm({
15797
16327
  it.deletedIndexes || {}
15798
16328
  );
15799
16329
  }).flat();
16330
+ const jsonCreatePoliciesStatements = [];
16331
+ const jsonDropPoliciesStatements = [];
16332
+ const jsonAlterPoliciesStatements = [];
16333
+ const jsonRenamePoliciesStatements = [];
16334
+ const jsonEnableRLSStatements = [];
16335
+ const jsonDisableRLSStatements = [];
16336
+ for (let it of policyRenames) {
16337
+ jsonRenamePoliciesStatements.push(
16338
+ ...prepareRenamePolicyJsons(it.table, it.schema, it.renames)
16339
+ );
16340
+ }
16341
+ for (const it of policyCreates) {
16342
+ jsonCreatePoliciesStatements.push(
16343
+ ...prepareCreatePolicyJsons(
16344
+ it.table,
16345
+ it.schema,
16346
+ it.columns
16347
+ )
16348
+ );
16349
+ }
16350
+ for (const it of policyDeletes) {
16351
+ jsonDropPoliciesStatements.push(
16352
+ ...prepareDropPolicyJsons(
16353
+ it.table,
16354
+ it.schema,
16355
+ it.columns
16356
+ )
16357
+ );
16358
+ }
15800
16359
  alteredTables.forEach((it) => {
16360
+ Object.keys(it.alteredPolicies).forEach((policyName) => {
16361
+ const newPolicy = PgSquasher.unsquashPolicy(it.alteredPolicies[policyName].__new);
16362
+ const oldPolicy = PgSquasher.unsquashPolicy(it.alteredPolicies[policyName].__old);
16363
+ if (newPolicy.as !== oldPolicy.as) {
16364
+ jsonDropPoliciesStatements.push(
16365
+ ...prepareDropPolicyJsons(
16366
+ it.name,
16367
+ it.schema,
16368
+ [oldPolicy]
16369
+ )
16370
+ );
16371
+ jsonCreatePoliciesStatements.push(
16372
+ ...prepareCreatePolicyJsons(
16373
+ it.name,
16374
+ it.schema,
16375
+ [newPolicy]
16376
+ )
16377
+ );
16378
+ return;
16379
+ }
16380
+ if (newPolicy.for !== oldPolicy.for) {
16381
+ jsonDropPoliciesStatements.push(
16382
+ ...prepareDropPolicyJsons(
16383
+ it.name,
16384
+ it.schema,
16385
+ [oldPolicy]
16386
+ )
16387
+ );
16388
+ jsonCreatePoliciesStatements.push(
16389
+ ...prepareCreatePolicyJsons(
16390
+ it.name,
16391
+ it.schema,
16392
+ [newPolicy]
16393
+ )
16394
+ );
16395
+ return;
16396
+ }
16397
+ jsonAlterPoliciesStatements.push(
16398
+ prepareAlterPolicyJson(
16399
+ it.name,
16400
+ it.schema,
16401
+ it.alteredPolicies[policyName].__old,
16402
+ it.alteredPolicies[policyName].__new
16403
+ )
16404
+ );
16405
+ });
16406
+ for (const table4 of Object.values(json22.tables)) {
16407
+ const policiesInCurrentState = Object.keys(table4.policies);
16408
+ const tableInPreviousState = columnsPatchedSnap1.tables[`${table4.schema === "" ? "public" : table4.schema}.${table4.name}`];
16409
+ const policiesInPreviousState = tableInPreviousState ? Object.keys(tableInPreviousState.policies) : [];
16410
+ if (policiesInPreviousState.length === 0 && policiesInCurrentState.length > 0) {
16411
+ jsonEnableRLSStatements.push({ type: "enable_rls", tableName: table4.name, schema: table4.schema });
16412
+ }
16413
+ if (policiesInPreviousState.length > 0 && policiesInCurrentState.length === 0) {
16414
+ jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
16415
+ }
16416
+ }
16417
+ for (const table4 of Object.values(columnsPatchedSnap1.tables)) {
16418
+ const tableInCurrentState = json22.tables[`${table4.schema === "" ? "public" : table4.schema}.${table4.name}`];
16419
+ if (tableInCurrentState === void 0) {
16420
+ jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
16421
+ }
16422
+ }
15801
16423
  const droppedIndexes = Object.keys(it.alteredIndexes).reduce(
15802
16424
  (current, item) => {
15803
16425
  current[item] = it.alteredIndexes[item].__old;
@@ -15867,6 +16489,9 @@ var init_snapshotsDiffer = __esm({
15867
16489
  const jsonAlterEnumsWithAddedValues = typedResult.alteredEnums.map((it) => {
15868
16490
  return prepareAddValuesToEnumJson(it.name, it.schema, it.addedValues);
15869
16491
  }).flat() ?? [];
16492
+ const jsonAlterEnumsWithDroppedValues = typedResult.alteredEnums.map((it) => {
16493
+ return prepareDropEnumValues(it.name, it.schema, it.deletedValues, curFull);
16494
+ }).flat() ?? [];
15870
16495
  const createSequences = createdSequences.map((it) => {
15871
16496
  return prepareCreateSequenceJson(it);
15872
16497
  }) ?? [];
@@ -15882,6 +16507,18 @@ var init_snapshotsDiffer = __esm({
15882
16507
  const jsonAlterSequences = typedResult.alteredSequences.map((it) => {
15883
16508
  return prepareAlterSequenceJson(it);
15884
16509
  }).flat() ?? [];
16510
+ const createRoles = createdRoles.map((it) => {
16511
+ return prepareCreateRoleJson(it);
16512
+ }) ?? [];
16513
+ const dropRoles = deletedRoles.map((it) => {
16514
+ return prepareDropRoleJson(it.name);
16515
+ });
16516
+ const renameRoles = renamedRoles.map((it) => {
16517
+ return prepareRenameRoleJson(it.from.name, it.to.name);
16518
+ });
16519
+ const jsonAlterRoles = typedResult.alteredRoles.map((it) => {
16520
+ return prepareAlterRoleJson(it);
16521
+ }).flat() ?? [];
15885
16522
  const createSchemas = prepareCreateSchemasJson(
15886
16523
  createdSchemas.map((it) => it.name)
15887
16524
  );
@@ -15894,6 +16531,11 @@ var init_snapshotsDiffer = __esm({
15894
16531
  const createTables = createdTables.map((it) => {
15895
16532
  return preparePgCreateTableJson(it, curFull);
15896
16533
  });
16534
+ jsonCreatePoliciesStatements.push(...[].concat(
16535
+ ...createdTables.map(
16536
+ (it) => prepareCreatePolicyJsons(it.name, it.schema, Object.values(it.policies).map(PgSquasher.unsquashPolicy))
16537
+ )
16538
+ ));
15897
16539
  jsonStatements.push(...createSchemas);
15898
16540
  jsonStatements.push(...renameSchemas);
15899
16541
  jsonStatements.push(...createEnums);
@@ -15904,7 +16546,13 @@ var init_snapshotsDiffer = __esm({
15904
16546
  jsonStatements.push(...moveSequences);
15905
16547
  jsonStatements.push(...renameSequences);
15906
16548
  jsonStatements.push(...jsonAlterSequences);
16549
+ jsonStatements.push(...renameRoles);
16550
+ jsonStatements.push(...dropRoles);
16551
+ jsonStatements.push(...createRoles);
16552
+ jsonStatements.push(...jsonAlterRoles);
15907
16553
  jsonStatements.push(...createTables);
16554
+ jsonStatements.push(...jsonEnableRLSStatements);
16555
+ jsonStatements.push(...jsonDisableRLSStatements);
15908
16556
  jsonStatements.push(...jsonDropTables);
15909
16557
  jsonStatements.push(...jsonSetTableSchemas);
15910
16558
  jsonStatements.push(...jsonRenameTables);
@@ -15924,6 +16572,11 @@ var init_snapshotsDiffer = __esm({
15924
16572
  jsonStatements.push(...jsonAlteredCompositePKs);
15925
16573
  jsonStatements.push(...jsonAddedUniqueConstraints);
15926
16574
  jsonStatements.push(...jsonAlteredUniqueConstraints);
16575
+ jsonStatements.push(...jsonAlterEnumsWithDroppedValues);
16576
+ jsonStatements.push(...jsonRenamePoliciesStatements);
16577
+ jsonStatements.push(...jsonDropPoliciesStatements);
16578
+ jsonStatements.push(...jsonCreatePoliciesStatements);
16579
+ jsonStatements.push(...jsonAlterPoliciesStatements);
15927
16580
  jsonStatements.push(...dropEnums);
15928
16581
  jsonStatements.push(...dropSequences);
15929
16582
  jsonStatements.push(...dropSchemas);
@@ -15944,7 +16597,17 @@ var init_snapshotsDiffer = __esm({
15944
16597
  }
15945
16598
  return true;
15946
16599
  });
15947
- const sqlStatements = fromJson(filteredJsonStatements, "postgresql");
16600
+ const filteredEnumsJsonStatements = filteredJsonStatements.filter((st) => {
16601
+ if (st.type === "alter_type_add_value") {
16602
+ if (jsonStatements.find(
16603
+ (it) => it.type === "alter_type_drop_value" && it.name === st.name && it.schema === st.schema
16604
+ )) {
16605
+ return false;
16606
+ }
16607
+ }
16608
+ return true;
16609
+ });
16610
+ const sqlStatements = fromJson(filteredEnumsJsonStatements, "postgresql");
15948
16611
  const uniqueSqlStatements = [];
15949
16612
  sqlStatements.forEach((ss) => {
15950
16613
  if (!uniqueSqlStatements.includes(ss)) {
@@ -15960,7 +16623,7 @@ var init_snapshotsDiffer = __esm({
15960
16623
  });
15961
16624
  const _meta = prepareMigrationMeta(rSchemas, rTables, rColumns);
15962
16625
  return {
15963
- statements: filteredJsonStatements,
16626
+ statements: filteredEnumsJsonStatements,
15964
16627
  sqlStatements: uniqueSqlStatements,
15965
16628
  _meta
15966
16629
  };
@@ -16995,7 +17658,7 @@ var init_outputs = __esm({
16995
17658
  });
16996
17659
 
16997
17660
  // src/cli/commands/migrate.ts
16998
- var import_hanji2, schemasResolver, tablesResolver, sequencesResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT;
17661
+ var import_hanji2, schemasResolver, tablesResolver, sequencesResolver, roleResolver, policyResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedConflict, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT;
16999
17662
  var init_migrate = __esm({
17000
17663
  "src/cli/commands/migrate.ts"() {
17001
17664
  "use strict";
@@ -17058,6 +17721,32 @@ var init_migrate = __esm({
17058
17721
  throw e;
17059
17722
  }
17060
17723
  };
17724
+ roleResolver = async (input) => {
17725
+ const result = await promptNamedConflict(
17726
+ input.created,
17727
+ input.deleted,
17728
+ "role"
17729
+ );
17730
+ return {
17731
+ created: result.created,
17732
+ deleted: result.deleted,
17733
+ renamed: result.renamed
17734
+ };
17735
+ };
17736
+ policyResolver = async (input) => {
17737
+ const result = await promptColumnsConflicts(
17738
+ input.tableName,
17739
+ input.created,
17740
+ input.deleted
17741
+ );
17742
+ return {
17743
+ tableName: input.tableName,
17744
+ schema: input.schema,
17745
+ created: result.created,
17746
+ deleted: result.deleted,
17747
+ renamed: result.renamed
17748
+ };
17749
+ };
17061
17750
  enumsResolver = async (input) => {
17062
17751
  try {
17063
17752
  const { created, deleted, moved, renamed } = await promptNamedWithSchemasConflict(
@@ -17140,6 +17829,56 @@ var init_migrate = __esm({
17140
17829
  result.deleted.push(...leftMissing);
17141
17830
  return result;
17142
17831
  };
17832
+ promptNamedConflict = async (newItems, missingItems, entity) => {
17833
+ if (missingItems.length === 0 || newItems.length === 0) {
17834
+ return {
17835
+ created: newItems,
17836
+ renamed: [],
17837
+ deleted: missingItems
17838
+ };
17839
+ }
17840
+ const result = { created: [], renamed: [], deleted: [] };
17841
+ let index4 = 0;
17842
+ let leftMissing = [...missingItems];
17843
+ do {
17844
+ const created = newItems[index4];
17845
+ const renames = leftMissing.map((it) => {
17846
+ return { from: it, to: created };
17847
+ });
17848
+ const promptData = [created, ...renames];
17849
+ const { status, data } = await (0, import_hanji2.render)(
17850
+ new ResolveSelectNamed(created, promptData, entity)
17851
+ );
17852
+ if (status === "aborted") {
17853
+ console.error("ERROR");
17854
+ process.exit(1);
17855
+ }
17856
+ if (isRenamePromptItem(data)) {
17857
+ console.log(
17858
+ `${source_default.yellow("~")} ${data.from.name} \u203A ${data.to.name} ${source_default.gray(
17859
+ `${entity} will be renamed/moved`
17860
+ )}`
17861
+ );
17862
+ if (data.from.name !== data.to.name) {
17863
+ result.renamed.push(data);
17864
+ }
17865
+ delete leftMissing[leftMissing.indexOf(data.from)];
17866
+ leftMissing = leftMissing.filter(Boolean);
17867
+ } else {
17868
+ console.log(
17869
+ `${source_default.green("+")} ${data.name} ${source_default.gray(
17870
+ `${entity} will be created`
17871
+ )}`
17872
+ );
17873
+ result.created.push(created);
17874
+ }
17875
+ index4 += 1;
17876
+ } while (index4 < newItems.length);
17877
+ console.log(source_default.gray(`--- all ${entity} conflicts resolved ---
17878
+ `));
17879
+ result.deleted.push(...leftMissing);
17880
+ return result;
17881
+ };
17143
17882
  promptNamedWithSchemasConflict = async (newItems, missingItems, entity) => {
17144
17883
  if (missingItems.length === 0 || newItems.length === 0) {
17145
17884
  return {
@@ -18696,8 +19435,8 @@ function parsePgArray(arrayString) {
18696
19435
  const [result] = parsePgNestedArray(arrayString, 1);
18697
19436
  return result;
18698
19437
  }
18699
- function makePgArray(array) {
18700
- return `{${array.map((item) => {
19438
+ function makePgArray(array2) {
19439
+ return `{${array2.map((item) => {
18701
19440
  if (Array.isArray(item)) {
18702
19441
  return makePgArray(item);
18703
19442
  }
@@ -19405,8 +20144,8 @@ var init_sql = __esm({
19405
20144
  sql2.param = param2;
19406
20145
  })(sql || (sql = {}));
19407
20146
  ((SQL2) => {
19408
- var _a324;
19409
- _a324 = entityKind;
20147
+ var _a326;
20148
+ _a326 = entityKind;
19410
20149
  const _Aliased = class _Aliased {
19411
20150
  constructor(sql2, fieldAlias) {
19412
20151
  /** @internal */
@@ -19422,7 +20161,7 @@ var init_sql = __esm({
19422
20161
  return new _Aliased(this.sql, this.fieldAlias);
19423
20162
  }
19424
20163
  };
19425
- __publicField(_Aliased, _a324, "SQL.Aliased");
20164
+ __publicField(_Aliased, _a326, "SQL.Aliased");
19426
20165
  let Aliased = _Aliased;
19427
20166
  SQL2.Aliased = Aliased;
19428
20167
  })(SQL || (SQL = {}));
@@ -19705,8 +20444,8 @@ function arrayContains(column4, values) {
19705
20444
  if (values.length === 0) {
19706
20445
  throw new Error("arrayContains requires at least one value");
19707
20446
  }
19708
- const array = sql`${bindIfParam(values, column4)}`;
19709
- return sql`${column4} @> ${array}`;
20447
+ const array2 = sql`${bindIfParam(values, column4)}`;
20448
+ return sql`${column4} @> ${array2}`;
19710
20449
  }
19711
20450
  return sql`${column4} @> ${bindIfParam(values, column4)}`;
19712
20451
  }
@@ -19715,8 +20454,8 @@ function arrayContained(column4, values) {
19715
20454
  if (values.length === 0) {
19716
20455
  throw new Error("arrayContained requires at least one value");
19717
20456
  }
19718
- const array = sql`${bindIfParam(values, column4)}`;
19719
- return sql`${column4} <@ ${array}`;
20457
+ const array2 = sql`${bindIfParam(values, column4)}`;
20458
+ return sql`${column4} <@ ${array2}`;
19720
20459
  }
19721
20460
  return sql`${column4} <@ ${bindIfParam(values, column4)}`;
19722
20461
  }
@@ -19725,8 +20464,8 @@ function arrayOverlaps(column4, values) {
19725
20464
  if (values.length === 0) {
19726
20465
  throw new Error("arrayOverlaps requires at least one value");
19727
20466
  }
19728
- const array = sql`${bindIfParam(values, column4)}`;
19729
- return sql`${column4} && ${array}`;
20467
+ const array2 = sql`${bindIfParam(values, column4)}`;
20468
+ return sql`${column4} && ${array2}`;
19730
20469
  }
19731
20470
  return sql`${column4} && ${bindIfParam(values, column4)}`;
19732
20471
  }
@@ -25392,6 +26131,67 @@ var init_indexes = __esm({
25392
26131
  }
25393
26132
  });
25394
26133
 
26134
+ // ../drizzle-orm/dist/pg-core/policies.js
26135
+ var _a147, PgPolicy;
26136
+ var init_policies = __esm({
26137
+ "../drizzle-orm/dist/pg-core/policies.js"() {
26138
+ "use strict";
26139
+ init_entity();
26140
+ _a147 = entityKind;
26141
+ PgPolicy = class {
26142
+ constructor(name2, config) {
26143
+ __publicField(this, "as");
26144
+ __publicField(this, "for");
26145
+ __publicField(this, "to");
26146
+ __publicField(this, "using");
26147
+ __publicField(this, "withCheck");
26148
+ this.name = name2;
26149
+ if (config) {
26150
+ this.as = config.as;
26151
+ this.for = config.for;
26152
+ this.to = config.to;
26153
+ this.using = config.using;
26154
+ this.withCheck = config.withCheck;
26155
+ }
26156
+ }
26157
+ };
26158
+ __publicField(PgPolicy, _a147, "PgPolicy");
26159
+ }
26160
+ });
26161
+
26162
+ // ../drizzle-orm/dist/pg-core/roles.js
26163
+ var _a148, PgRole;
26164
+ var init_roles = __esm({
26165
+ "../drizzle-orm/dist/pg-core/roles.js"() {
26166
+ "use strict";
26167
+ init_entity();
26168
+ _a148 = entityKind;
26169
+ PgRole = class {
26170
+ constructor(name2, config) {
26171
+ /** @internal */
26172
+ __publicField(this, "_existing");
26173
+ /** @internal */
26174
+ __publicField(this, "createDb");
26175
+ /** @internal */
26176
+ __publicField(this, "createRole");
26177
+ /** @internal */
26178
+ __publicField(this, "inherit");
26179
+ this.name = name2;
26180
+ if (config) {
26181
+ this.createDb = config.createDb;
26182
+ this.createRole = config.createRole;
26183
+ this.inherit = config.inherit;
26184
+ }
26185
+ }
26186
+ existing() {
26187
+ this._existing = true;
26188
+ return this;
26189
+ }
26190
+ };
26191
+ __publicField(PgRole, _a148, "PgRole");
26192
+ }
26193
+ });
26194
+
25395
26195
  // ../drizzle-orm/dist/pg-core/sequence.js
25396
26196
  function pgSequenceWithSchema(name2, options, schema4) {
25397
26197
  return new PgSequence(name2, options, schema4);
@@ -25399,12 +26199,12 @@ function pgSequenceWithSchema(name2, options, schema4) {
25399
26199
  function isPgSequence(obj) {
25400
26200
  return is(obj, PgSequence);
25401
26201
  }
25402
- var _a147, PgSequence;
26202
+ var _a149, PgSequence;
25403
26203
  var init_sequence = __esm({
25404
26204
  "../drizzle-orm/dist/pg-core/sequence.js"() {
25405
26205
  "use strict";
25406
26206
  init_entity();
25407
- _a147 = entityKind;
26207
+ _a149 = entityKind;
25408
26208
  PgSequence = class {
25409
26209
  constructor(seqName, seqOptions, schema4) {
25410
26210
  this.seqName = seqName;
@@ -25412,7 +26212,7 @@ var init_sequence = __esm({
25412
26212
  this.schema = schema4;
25413
26213
  }
25414
26214
  };
25415
- __publicField(PgSequence, _a147, "PgSequence");
26215
+ __publicField(PgSequence, _a149, "PgSequence");
25416
26216
  }
25417
26217
  });
25418
26218
 
@@ -25438,7 +26238,7 @@ function pgMaterializedViewWithSchema(name2, selection, schema4) {
25438
26238
  }
25439
26239
  return new MaterializedViewBuilder(name2, schema4);
25440
26240
  }
25441
- 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;
26241
+ 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;
25442
26242
  var init_view = __esm({
25443
26243
  "../drizzle-orm/dist/pg-core/view.js"() {
25444
26244
  "use strict";
@@ -25449,7 +26249,7 @@ var init_view = __esm({
25449
26249
  init_table2();
25450
26250
  init_view_base();
25451
26251
  init_view_common2();
25452
- _a148 = entityKind;
26252
+ _a150 = entityKind;
25453
26253
  DefaultViewBuilderCore = class {
25454
26254
  constructor(name2, schema4) {
25455
26255
  __publicField(this, "config", {});
@@ -25461,8 +26261,8 @@ var init_view = __esm({
25461
26261
  return this;
25462
26262
  }
25463
26263
  };
25464
- __publicField(DefaultViewBuilderCore, _a148, "PgDefaultViewBuilderCore");
25465
- ViewBuilder = class extends (_b107 = DefaultViewBuilderCore, _a149 = entityKind, _b107) {
26264
+ __publicField(DefaultViewBuilderCore, _a150, "PgDefaultViewBuilderCore");
26265
+ ViewBuilder = class extends (_b107 = DefaultViewBuilderCore, _a151 = entityKind, _b107) {
25466
26266
  as(qb) {
25467
26267
  if (typeof qb === "function") {
25468
26268
  qb = qb(new QueryBuilder());
@@ -25488,8 +26288,8 @@ var init_view = __esm({
25488
26288
  );
25489
26289
  }
25490
26290
  };
25491
- __publicField(ViewBuilder, _a149, "PgViewBuilder");
25492
- ManualViewBuilder = class extends (_b108 = DefaultViewBuilderCore, _a150 = entityKind, _b108) {
26291
+ __publicField(ViewBuilder, _a151, "PgViewBuilder");
26292
+ ManualViewBuilder = class extends (_b108 = DefaultViewBuilderCore, _a152 = entityKind, _b108) {
25493
26293
  constructor(name2, columns, schema4) {
25494
26294
  super(name2, schema4);
25495
26295
  __publicField(this, "columns");
@@ -25534,8 +26334,8 @@ var init_view = __esm({
25534
26334
  );
25535
26335
  }
25536
26336
  };
25537
- __publicField(ManualViewBuilder, _a150, "PgManualViewBuilder");
25538
- _a151 = entityKind;
26337
+ __publicField(ManualViewBuilder, _a152, "PgManualViewBuilder");
26338
+ _a153 = entityKind;
25539
26339
  MaterializedViewBuilderCore = class {
25540
26340
  constructor(name2, schema4) {
25541
26341
  __publicField(this, "config", {});
@@ -25559,8 +26359,8 @@ var init_view = __esm({
25559
26359
  return this;
25560
26360
  }
25561
26361
  };
25562
- __publicField(MaterializedViewBuilderCore, _a151, "PgMaterializedViewBuilderCore");
25563
- MaterializedViewBuilder = class extends (_b109 = MaterializedViewBuilderCore, _a152 = entityKind, _b109) {
26362
+ __publicField(MaterializedViewBuilderCore, _a153, "PgMaterializedViewBuilderCore");
26363
+ MaterializedViewBuilder = class extends (_b109 = MaterializedViewBuilderCore, _a154 = entityKind, _b109) {
25564
26364
  as(qb) {
25565
26365
  if (typeof qb === "function") {
25566
26366
  qb = qb(new QueryBuilder());
@@ -25591,8 +26391,8 @@ var init_view = __esm({
25591
26391
  );
25592
26392
  }
25593
26393
  };
25594
- __publicField(MaterializedViewBuilder, _a152, "PgMaterializedViewBuilder");
25595
- ManualMaterializedViewBuilder = class extends (_b110 = MaterializedViewBuilderCore, _a153 = entityKind, _b110) {
26394
+ __publicField(MaterializedViewBuilder, _a154, "PgMaterializedViewBuilder");
26395
+ ManualMaterializedViewBuilder = class extends (_b110 = MaterializedViewBuilderCore, _a155 = entityKind, _b110) {
25596
26396
  constructor(name2, columns, schema4) {
25597
26397
  super(name2, schema4);
25598
26398
  __publicField(this, "columns");
@@ -25637,11 +26437,11 @@ var init_view = __esm({
25637
26437
  );
25638
26438
  }
25639
26439
  };
25640
- __publicField(ManualMaterializedViewBuilder, _a153, "PgManualMaterializedViewBuilder");
25641
- PgView = class extends (_c4 = PgViewBase, _b111 = entityKind, _a154 = PgViewConfig, _c4) {
26440
+ __publicField(ManualMaterializedViewBuilder, _a155, "PgManualMaterializedViewBuilder");
26441
+ PgView = class extends (_c4 = PgViewBase, _b111 = entityKind, _a156 = PgViewConfig, _c4) {
25642
26442
  constructor({ pgConfig, config }) {
25643
26443
  super(config);
25644
- __publicField(this, _a154);
26444
+ __publicField(this, _a156);
25645
26445
  if (pgConfig) {
25646
26446
  this[PgViewConfig] = {
25647
26447
  with: pgConfig.with
@@ -25651,10 +26451,10 @@ var init_view = __esm({
25651
26451
  };
25652
26452
  __publicField(PgView, _b111, "PgView");
25653
26453
  PgMaterializedViewConfig = Symbol.for("drizzle:PgMaterializedViewConfig");
25654
- PgMaterializedView = class extends (_c5 = PgViewBase, _b112 = entityKind, _a155 = PgMaterializedViewConfig, _c5) {
26454
+ PgMaterializedView = class extends (_c5 = PgViewBase, _b112 = entityKind, _a157 = PgMaterializedViewConfig, _c5) {
25655
26455
  constructor({ pgConfig, config }) {
25656
26456
  super(config);
25657
- __publicField(this, _a155);
26457
+ __publicField(this, _a157);
25658
26458
  this[PgMaterializedViewConfig] = {
25659
26459
  with: pgConfig?.with,
25660
26460
  using: pgConfig?.using,
@@ -25668,7 +26468,7 @@ var init_view = __esm({
25668
26468
  });
25669
26469
 
25670
26470
  // ../drizzle-orm/dist/pg-core/schema.js
25671
- var _a156, PgSchema5;
26471
+ var _a158, PgSchema5;
25672
26472
  var init_schema = __esm({
25673
26473
  "../drizzle-orm/dist/pg-core/schema.js"() {
25674
26474
  "use strict";
@@ -25678,7 +26478,7 @@ var init_schema = __esm({
25678
26478
  init_sequence();
25679
26479
  init_table2();
25680
26480
  init_view();
25681
- _a156 = entityKind;
26481
+ _a158 = entityKind;
25682
26482
  PgSchema5 = class {
25683
26483
  constructor(schemaName) {
25684
26484
  __publicField(this, "table", (name2, columns, extraConfig) => {
@@ -25705,12 +26505,12 @@ var init_schema = __esm({
25705
26505
  return true;
25706
26506
  }
25707
26507
  };
25708
- __publicField(PgSchema5, _a156, "PgSchema");
26508
+ __publicField(PgSchema5, _a158, "PgSchema");
25709
26509
  }
25710
26510
  });
25711
26511
 
25712
26512
  // ../drizzle-orm/dist/pg-core/session.js
25713
- var _a157, PgPreparedQuery, _a158, PgSession, _a159, _b113, PgTransaction;
26513
+ var _a159, PgPreparedQuery, _a160, PgSession, _a161, _b113, PgTransaction;
25714
26514
  var init_session = __esm({
25715
26515
  "../drizzle-orm/dist/pg-core/session.js"() {
25716
26516
  "use strict";
@@ -25719,7 +26519,7 @@ var init_session = __esm({
25719
26519
  init_sql2();
25720
26520
  init_tracing();
25721
26521
  init_db();
25722
- _a157 = entityKind;
26522
+ _a159 = entityKind;
25723
26523
  PgPreparedQuery = class {
25724
26524
  constructor(query) {
25725
26525
  /** @internal */
@@ -25733,8 +26533,8 @@ var init_session = __esm({
25733
26533
  return response;
25734
26534
  }
25735
26535
  };
25736
- __publicField(PgPreparedQuery, _a157, "PgPreparedQuery");
25737
- _a158 = entityKind;
26536
+ __publicField(PgPreparedQuery, _a159, "PgPreparedQuery");
26537
+ _a160 = entityKind;
25738
26538
  PgSession = class {
25739
26539
  constructor(dialect4) {
25740
26540
  this.dialect = dialect4;
@@ -25767,8 +26567,8 @@ var init_session = __esm({
25767
26567
  );
25768
26568
  }
25769
26569
  };
25770
- __publicField(PgSession, _a158, "PgSession");
25771
- PgTransaction = class extends (_b113 = PgDatabase, _a159 = entityKind, _b113) {
26570
+ __publicField(PgSession, _a160, "PgSession");
26571
+ PgTransaction = class extends (_b113 = PgDatabase, _a161 = entityKind, _b113) {
25772
26572
  constructor(dialect4, session, schema4, nestedIndex = 0) {
25773
26573
  super(dialect4, session, schema4);
25774
26574
  this.schema = schema4;
@@ -25795,7 +26595,7 @@ var init_session = __esm({
25795
26595
  return this.session.execute(sql`set transaction ${this.getTransactionConfigSQL(config)}`);
25796
26596
  }
25797
26597
  };
25798
- __publicField(PgTransaction, _a159, "PgTransaction");
26598
+ __publicField(PgTransaction, _a161, "PgTransaction");
25799
26599
  }
25800
26600
  });
25801
26601
 
@@ -25816,10 +26616,12 @@ function getTableConfig(table4) {
25816
26616
  const uniqueConstraints = [];
25817
26617
  const name2 = table4[Table.Symbol.Name];
25818
26618
  const schema4 = table4[Table.Symbol.Schema];
26619
+ const policies = [];
25819
26620
  const extraConfigBuilder = table4[PgTable.Symbol.ExtraConfigBuilder];
25820
26621
  if (extraConfigBuilder !== void 0) {
25821
26622
  const extraConfig = extraConfigBuilder(table4[Table.Symbol.ExtraConfigColumns]);
25822
- for (const builder of Object.values(extraConfig)) {
26623
+ const extraValues = Array.isArray(extraConfig) ? extraConfig.flat(1) : Object.values(extraConfig);
26624
+ for (const builder of extraValues) {
25823
26625
  if (is(builder, IndexBuilder)) {
25824
26626
  indexes.push(builder.build(table4));
25825
26627
  } else if (is(builder, CheckBuilder)) {
@@ -25830,6 +26632,8 @@ function getTableConfig(table4) {
25830
26632
  primaryKeys.push(builder.build(table4));
25831
26633
  } else if (is(builder, ForeignKeyBuilder)) {
25832
26634
  foreignKeys.push(builder.build(table4));
26635
+ } else if (is(builder, PgPolicy)) {
26636
+ policies.push(builder);
25833
26637
  }
25834
26638
  }
25835
26639
  }
@@ -25841,7 +26645,8 @@ function getTableConfig(table4) {
25841
26645
  primaryKeys,
25842
26646
  uniqueConstraints,
25843
26647
  name: name2,
25844
- schema: schema4
26648
+ schema: schema4,
26649
+ policies
25845
26650
  };
25846
26651
  }
25847
26652
  var init_utils4 = __esm({
@@ -25853,6 +26658,7 @@ var init_utils4 = __esm({
25853
26658
  init_checks();
25854
26659
  init_foreign_keys();
25855
26660
  init_indexes();
26661
+ init_policies();
25856
26662
  init_primary_keys();
25857
26663
  init_unique_constraint();
25858
26664
  }
@@ -25877,8 +26683,10 @@ var init_pg_core = __esm({
25877
26683
  init_dialect();
25878
26684
  init_foreign_keys();
25879
26685
  init_indexes();
26686
+ init_policies();
25880
26687
  init_primary_keys();
25881
26688
  init_query_builders();
26689
+ init_roles();
25882
26690
  init_schema();
25883
26691
  init_sequence();
25884
26692
  init_session();
@@ -25905,9 +26713,9 @@ function minRangeForIdentityBasedOn(columnType) {
25905
26713
  function stringFromDatabaseIdentityProperty(field) {
25906
26714
  return typeof field === "string" ? field : typeof field === "undefined" ? void 0 : typeof field === "bigint" ? field.toString() : String(field);
25907
26715
  }
25908
- function buildArrayString(array, sqlType) {
26716
+ function buildArrayString(array2, sqlType) {
25909
26717
  sqlType = sqlType.split("[")[0];
25910
- const values = array.map((value) => {
26718
+ const values = array2.map((value) => {
25911
26719
  if (typeof value === "number" || typeof value === "bigint") {
25912
26720
  return value.toString();
25913
26721
  } else if (typeof value === "boolean") {
@@ -25929,6 +26737,40 @@ function buildArrayString(array, sqlType) {
25929
26737
  }).join(",");
25930
26738
  return `{${values}}`;
25931
26739
  }
26740
+ function prepareRoles(entities) {
26741
+ let useRoles = false;
26742
+ const includeRoles = [];
26743
+ const excludeRoles = [];
26744
+ if (entities && entities.roles) {
26745
+ if (typeof entities.roles === "object") {
26746
+ if (entities.roles.provider) {
26747
+ if (entities.roles.provider === "supabase") {
26748
+ excludeRoles.push(...[
26749
+ "anon",
26750
+ "authenticator",
26751
+ "authenticated",
26752
+ "service_role",
26753
+ "supabase_auth_admin",
26754
+ "supabase_storage_admin",
26755
+ "dashboard_user",
26756
+ "supabase_admin"
26757
+ ]);
26758
+ } else if (entities.roles.provider === "neon") {
26759
+ excludeRoles.push(...["authenticated", "anonymous"]);
26760
+ }
26761
+ }
26762
+ if (entities.roles.include) {
26763
+ includeRoles.push(...entities.roles.include);
26764
+ }
26765
+ if (entities.roles.exclude) {
26766
+ excludeRoles.push(...entities.roles.exclude);
26767
+ }
26768
+ } else {
26769
+ useRoles = entities.roles;
26770
+ }
26771
+ }
26772
+ return { useRoles, includeRoles, excludeRoles };
26773
+ }
25932
26774
  var indexName, generatePgSnapshot, trimChar, fromDatabase, defaultForColumn;
25933
26775
  var init_pgSerializer = __esm({
25934
26776
  "src/serializer/pgSerializer.ts"() {
@@ -25944,10 +26786,11 @@ var init_pgSerializer = __esm({
25944
26786
  indexName = (tableName, columns) => {
25945
26787
  return `${tableName}_${columns.join("_")}_index`;
25946
26788
  };
25947
- generatePgSnapshot = (tables, enums, schemas, sequences, casing2, schemaFilter) => {
26789
+ generatePgSnapshot = (tables, enums, schemas, sequences, roles, casing2, schemaFilter) => {
25948
26790
  const dialect4 = new PgDialect({ casing: casing2 });
25949
26791
  const result = {};
25950
26792
  const sequencesToReturn = {};
26793
+ const rolesToReturn = {};
25951
26794
  const indexesInSchema = {};
25952
26795
  for (const table4 of tables) {
25953
26796
  const {
@@ -25958,7 +26801,8 @@ var init_pgSerializer = __esm({
25958
26801
  checks,
25959
26802
  schema: schema4,
25960
26803
  primaryKeys,
25961
- uniqueConstraints
26804
+ uniqueConstraints,
26805
+ policies
25962
26806
  } = getTableConfig(table4);
25963
26807
  if (schemaFilter && !schemaFilter.includes(schema4 ?? "public")) {
25964
26808
  continue;
@@ -25968,6 +26812,7 @@ var init_pgSerializer = __esm({
25968
26812
  const foreignKeysObject = {};
25969
26813
  const primaryKeysObject = {};
25970
26814
  const uniqueConstraintObject = {};
26815
+ const policiesObject = {};
25971
26816
  columns.forEach((column4) => {
25972
26817
  const name2 = getColumnCasing(column4, casing2);
25973
26818
  const notNull = column4.notNull;
@@ -26230,6 +27075,34 @@ ${withStyle.errorWarning(
26230
27075
  with: value.config.with ?? {}
26231
27076
  };
26232
27077
  });
27078
+ policies.forEach((policy2) => {
27079
+ const mappedTo = [];
27080
+ if (!policy2.to) {
27081
+ mappedTo.push("public");
27082
+ } else {
27083
+ if (policy2.to && typeof policy2.to === "string") {
27084
+ mappedTo.push(policy2.to);
27085
+ } else if (policy2.to && is(policy2.to, PgRole)) {
27086
+ mappedTo.push(policy2.to.name);
27087
+ } else if (policy2.to && Array.isArray(policy2.to)) {
27088
+ policy2.to.forEach((it) => {
27089
+ if (typeof it === "string") {
27090
+ mappedTo.push(it);
27091
+ } else if (is(it, PgRole)) {
27092
+ mappedTo.push(it.name);
27093
+ }
27094
+ });
27095
+ }
27096
+ }
27097
+ policiesObject[policy2.name] = {
27098
+ name: policy2.name,
27099
+ as: policy2.as?.toUpperCase() ?? "PERMISSIVE",
27100
+ for: policy2.for?.toUpperCase() ?? "ALL",
27101
+ to: mappedTo.sort(),
27102
+ using: is(policy2.using, SQL) ? dialect4.sqlToQuery(policy2.using).sql : void 0,
27103
+ withCheck: is(policy2.withCheck, SQL) ? dialect4.sqlToQuery(policy2.withCheck).sql : void 0
27104
+ };
27105
+ });
26233
27106
  const tableKey2 = `${schema4 ?? "public"}.${tableName}`;
26234
27107
  result[tableKey2] = {
26235
27108
  name: tableName,
@@ -26238,7 +27111,8 @@ ${withStyle.errorWarning(
26238
27111
  indexes: indexesObject,
26239
27112
  foreignKeys: foreignKeysObject,
26240
27113
  compositePrimaryKeys: primaryKeysObject,
26241
- uniqueConstraints: uniqueConstraintObject
27114
+ uniqueConstraints: uniqueConstraintObject,
27115
+ policies: policiesObject
26242
27116
  };
26243
27117
  }
26244
27118
  for (const sequence of sequences) {
@@ -26262,6 +27136,16 @@ ${withStyle.errorWarning(
26262
27136
  } else {
26263
27137
  }
26264
27138
  }
27139
+ for (const role of roles) {
27140
+ if (!role._existing) {
27141
+ rolesToReturn[role.name] = {
27142
+ name: role.name,
27143
+ createDb: role.createDb === void 0 ? false : role.createDb,
27144
+ createRole: role.createRole === void 0 ? false : role.createRole,
27145
+ inherit: role.inherit === void 0 ? true : role.inherit
27146
+ };
27147
+ }
27148
+ }
26265
27149
  const enumsToReturn = enums.reduce((map, obj) => {
26266
27150
  const enumSchema3 = obj.schema || "public";
26267
27151
  const key = `${enumSchema3}.${obj.enumName}`;
@@ -26288,6 +27172,7 @@ ${withStyle.errorWarning(
26288
27172
  enums: enumsToReturn,
26289
27173
  schemas: schemasObject,
26290
27174
  sequences: sequencesToReturn,
27175
+ roles: rolesToReturn,
26291
27176
  _meta: {
26292
27177
  schemas: {},
26293
27178
  tables: {},
@@ -26302,7 +27187,7 @@ ${withStyle.errorWarning(
26302
27187
  while (end > start && str[end - 1] === char3) --end;
26303
27188
  return start > 0 || end < str.length ? str.substring(start, end) : str.toString();
26304
27189
  };
26305
- fromDatabase = async (db, tablesFilter = () => true, schemaFilters, progressCallback) => {
27190
+ fromDatabase = async (db, tablesFilter = () => true, schemaFilters, entities, progressCallback) => {
26306
27191
  const result = {};
26307
27192
  const internals = { tables: {} };
26308
27193
  const where = schemaFilters.map((t) => `table_schema = '${t}'`).join(" or ");
@@ -26384,6 +27269,60 @@ ${withStyle.errorWarning(
26384
27269
  if (progressCallback) {
26385
27270
  progressCallback("enums", Object.keys(enumsToReturn).length, "done");
26386
27271
  }
27272
+ const allRoles = await db.query(
27273
+ `SELECT rolname, rolinherit, rolcreatedb, rolcreaterole FROM pg_roles;`
27274
+ );
27275
+ const rolesToReturn = {};
27276
+ const preparedRoles = prepareRoles(entities);
27277
+ if (preparedRoles.useRoles || !(preparedRoles.includeRoles.length === 0 && preparedRoles.excludeRoles.length === 0)) {
27278
+ for (const dbRole of allRoles) {
27279
+ if (preparedRoles.useRoles) {
27280
+ rolesToReturn[dbRole.rolname] = {
27281
+ createDb: dbRole.rolcreatedb,
27282
+ createRole: dbRole.rolcreatedb,
27283
+ inherit: dbRole.rolinherit,
27284
+ name: dbRole.rolname
27285
+ };
27286
+ } else {
27287
+ if (preparedRoles.includeRoles.length === 0 && preparedRoles.excludeRoles.length === 0) continue;
27288
+ if (preparedRoles.includeRoles.includes(dbRole.rolname) && preparedRoles.excludeRoles.includes(dbRole.rolname)) continue;
27289
+ if (preparedRoles.excludeRoles.includes(dbRole.rolname)) continue;
27290
+ if (!preparedRoles.includeRoles.includes(dbRole.rolname)) continue;
27291
+ rolesToReturn[dbRole.rolname] = {
27292
+ createDb: dbRole.rolcreatedb,
27293
+ createRole: dbRole.rolcreaterole,
27294
+ inherit: dbRole.rolinherit,
27295
+ name: dbRole.rolname
27296
+ };
27297
+ }
27298
+ }
27299
+ }
27300
+ const wherePolicies = schemaFilters.map((t) => `schemaname = '${t}'`).join(" or ");
27301
+ const policiesByTable = {};
27302
+ 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}`};`);
27303
+ for (const dbPolicy of allPolicies) {
27304
+ const { tablename, schemaname, to, withCheck, using, ...rest } = dbPolicy;
27305
+ const tableForPolicy = policiesByTable[`${schemaname}.${tablename}`];
27306
+ const parsedTo = to;
27307
+ const parsedWithCheck = withCheck === null ? void 0 : withCheck;
27308
+ const parsedUsing = using === null ? void 0 : using;
27309
+ if (tableForPolicy) {
27310
+ tableForPolicy[dbPolicy.name] = { ...rest, to: parsedTo };
27311
+ } else {
27312
+ policiesByTable[`${schemaname}.${tablename}`] = {
27313
+ [dbPolicy.name]: { ...rest, to: parsedTo, withCheck: parsedWithCheck, using: parsedUsing }
27314
+ };
27315
+ }
27316
+ }
27317
+ if (progressCallback) {
27318
+ progressCallback(
27319
+ "policies",
27320
+ Object.values(policiesByTable).reduce((total, innerRecord) => {
27321
+ return total + Object.keys(innerRecord).length;
27322
+ }, 0),
27323
+ "done"
27324
+ );
27325
+ }
26387
27326
  const sequencesInColumns = [];
26388
27327
  const all = allTables.map((row) => {
26389
27328
  return new Promise(async (res, rej) => {
@@ -26777,7 +27716,8 @@ ${withStyle.errorWarning(
26777
27716
  indexes: indexToReturn,
26778
27717
  foreignKeys: foreignKeysToReturn,
26779
27718
  compositePrimaryKeys: primaryKeys,
26780
- uniqueConstraints: uniqueConstrains
27719
+ uniqueConstraints: uniqueConstrains,
27720
+ policies: policiesByTable[`${tableSchema}.${tableName}`] ?? {}
26781
27721
  };
26782
27722
  } catch (e) {
26783
27723
  rej(e);
@@ -26804,6 +27744,7 @@ ${withStyle.errorWarning(
26804
27744
  enums: enumsToReturn,
26805
27745
  schemas: schemasObject,
26806
27746
  sequences: sequencesToReturn,
27747
+ roles: rolesToReturn,
26807
27748
  _meta: {
26808
27749
  schemas: {},
26809
27750
  tables: {},
@@ -26926,12 +27867,12 @@ var init_alias3 = __esm({
26926
27867
  });
26927
27868
 
26928
27869
  // ../drizzle-orm/dist/sqlite-core/checks.js
26929
- var _a160, CheckBuilder2, _a161, Check2;
27870
+ var _a162, CheckBuilder2, _a163, Check2;
26930
27871
  var init_checks2 = __esm({
26931
27872
  "../drizzle-orm/dist/sqlite-core/checks.js"() {
26932
27873
  "use strict";
26933
27874
  init_entity();
26934
- _a160 = entityKind;
27875
+ _a162 = entityKind;
26935
27876
  CheckBuilder2 = class {
26936
27877
  constructor(name2, value) {
26937
27878
  __publicField(this, "brand");
@@ -26942,8 +27883,8 @@ var init_checks2 = __esm({
26942
27883
  return new Check2(table4, this);
26943
27884
  }
26944
27885
  };
26945
- __publicField(CheckBuilder2, _a160, "SQLiteCheckBuilder");
26946
- _a161 = entityKind;
27886
+ __publicField(CheckBuilder2, _a162, "SQLiteCheckBuilder");
27887
+ _a163 = entityKind;
26947
27888
  Check2 = class {
26948
27889
  constructor(table4, builder) {
26949
27890
  __publicField(this, "name");
@@ -26953,18 +27894,18 @@ var init_checks2 = __esm({
26953
27894
  this.value = builder.value;
26954
27895
  }
26955
27896
  };
26956
- __publicField(Check2, _a161, "SQLiteCheck");
27897
+ __publicField(Check2, _a163, "SQLiteCheck");
26957
27898
  }
26958
27899
  });
26959
27900
 
26960
27901
  // ../drizzle-orm/dist/sqlite-core/foreign-keys.js
26961
- var _a162, ForeignKeyBuilder2, _a163, ForeignKey2;
27902
+ var _a164, ForeignKeyBuilder2, _a165, ForeignKey2;
26962
27903
  var init_foreign_keys2 = __esm({
26963
27904
  "../drizzle-orm/dist/sqlite-core/foreign-keys.js"() {
26964
27905
  "use strict";
26965
27906
  init_entity();
26966
27907
  init_table_utils();
26967
- _a162 = entityKind;
27908
+ _a164 = entityKind;
26968
27909
  ForeignKeyBuilder2 = class {
26969
27910
  constructor(config, actions) {
26970
27911
  /** @internal */
@@ -26995,8 +27936,8 @@ var init_foreign_keys2 = __esm({
26995
27936
  return new ForeignKey2(table4, this);
26996
27937
  }
26997
27938
  };
26998
- __publicField(ForeignKeyBuilder2, _a162, "SQLiteForeignKeyBuilder");
26999
- _a163 = entityKind;
27939
+ __publicField(ForeignKeyBuilder2, _a164, "SQLiteForeignKeyBuilder");
27940
+ _a165 = entityKind;
27000
27941
  ForeignKey2 = class {
27001
27942
  constructor(table4, builder) {
27002
27943
  __publicField(this, "reference");
@@ -27020,7 +27961,7 @@ var init_foreign_keys2 = __esm({
27020
27961
  return name2 ?? `${chunks.join("_")}_fk`;
27021
27962
  }
27022
27963
  };
27023
- __publicField(ForeignKey2, _a163, "SQLiteForeignKey");
27964
+ __publicField(ForeignKey2, _a165, "SQLiteForeignKey");
27024
27965
  }
27025
27966
  });
27026
27967
 
@@ -27028,13 +27969,13 @@ var init_foreign_keys2 = __esm({
27028
27969
  function uniqueKeyName2(table4, columns) {
27029
27970
  return `${table4[TableName]}_${columns.join("_")}_unique`;
27030
27971
  }
27031
- var _a164, UniqueConstraintBuilder2, _a165, UniqueOnConstraintBuilder2, _a166, UniqueConstraint2;
27972
+ var _a166, UniqueConstraintBuilder2, _a167, UniqueOnConstraintBuilder2, _a168, UniqueConstraint2;
27032
27973
  var init_unique_constraint2 = __esm({
27033
27974
  "../drizzle-orm/dist/sqlite-core/unique-constraint.js"() {
27034
27975
  "use strict";
27035
27976
  init_entity();
27036
27977
  init_table_utils();
27037
- _a164 = entityKind;
27978
+ _a166 = entityKind;
27038
27979
  UniqueConstraintBuilder2 = class {
27039
27980
  constructor(columns, name2) {
27040
27981
  /** @internal */
@@ -27047,8 +27988,8 @@ var init_unique_constraint2 = __esm({
27047
27988
  return new UniqueConstraint2(table4, this.columns, this.name);
27048
27989
  }
27049
27990
  };
27050
- __publicField(UniqueConstraintBuilder2, _a164, "SQLiteUniqueConstraintBuilder");
27051
- _a165 = entityKind;
27991
+ __publicField(UniqueConstraintBuilder2, _a166, "SQLiteUniqueConstraintBuilder");
27992
+ _a167 = entityKind;
27052
27993
  UniqueOnConstraintBuilder2 = class {
27053
27994
  constructor(name2) {
27054
27995
  /** @internal */
@@ -27059,8 +28000,8 @@ var init_unique_constraint2 = __esm({
27059
28000
  return new UniqueConstraintBuilder2(columns, this.name);
27060
28001
  }
27061
28002
  };
27062
- __publicField(UniqueOnConstraintBuilder2, _a165, "SQLiteUniqueOnConstraintBuilder");
27063
- _a166 = entityKind;
28003
+ __publicField(UniqueOnConstraintBuilder2, _a167, "SQLiteUniqueOnConstraintBuilder");
28004
+ _a168 = entityKind;
27064
28005
  UniqueConstraint2 = class {
27065
28006
  constructor(table4, columns, name2) {
27066
28007
  __publicField(this, "columns");
@@ -27073,12 +28014,12 @@ var init_unique_constraint2 = __esm({
27073
28014
  return this.name;
27074
28015
  }
27075
28016
  };
27076
- __publicField(UniqueConstraint2, _a166, "SQLiteUniqueConstraint");
28017
+ __publicField(UniqueConstraint2, _a168, "SQLiteUniqueConstraint");
27077
28018
  }
27078
28019
  });
27079
28020
 
27080
28021
  // ../drizzle-orm/dist/sqlite-core/columns/common.js
27081
- var _a167, _b114, SQLiteColumnBuilder, _a168, _b115, SQLiteColumn;
28022
+ var _a169, _b114, SQLiteColumnBuilder, _a170, _b115, SQLiteColumn;
27082
28023
  var init_common3 = __esm({
27083
28024
  "../drizzle-orm/dist/sqlite-core/columns/common.js"() {
27084
28025
  "use strict";
@@ -27087,7 +28028,7 @@ var init_common3 = __esm({
27087
28028
  init_entity();
27088
28029
  init_foreign_keys2();
27089
28030
  init_unique_constraint2();
27090
- SQLiteColumnBuilder = class extends (_b114 = ColumnBuilder, _a167 = entityKind, _b114) {
28031
+ SQLiteColumnBuilder = class extends (_b114 = ColumnBuilder, _a169 = entityKind, _b114) {
27091
28032
  constructor() {
27092
28033
  super(...arguments);
27093
28034
  __publicField(this, "foreignKeyConfigs", []);
@@ -27128,8 +28069,8 @@ var init_common3 = __esm({
27128
28069
  });
27129
28070
  }
27130
28071
  };
27131
- __publicField(SQLiteColumnBuilder, _a167, "SQLiteColumnBuilder");
27132
- SQLiteColumn = class extends (_b115 = Column2, _a168 = entityKind, _b115) {
28072
+ __publicField(SQLiteColumnBuilder, _a169, "SQLiteColumnBuilder");
28073
+ SQLiteColumn = class extends (_b115 = Column2, _a170 = entityKind, _b115) {
27133
28074
  constructor(table4, config) {
27134
28075
  if (!config.uniqueName) {
27135
28076
  config.uniqueName = uniqueKeyName2(table4, [config.name]);
@@ -27138,7 +28079,7 @@ var init_common3 = __esm({
27138
28079
  this.table = table4;
27139
28080
  }
27140
28081
  };
27141
- __publicField(SQLiteColumn, _a168, "SQLiteColumn");
28082
+ __publicField(SQLiteColumn, _a170, "SQLiteColumn");
27142
28083
  }
27143
28084
  });
27144
28085
 
@@ -27153,14 +28094,14 @@ function blob(a, b) {
27153
28094
  }
27154
28095
  return new SQLiteBlobBufferBuilder(name2);
27155
28096
  }
27156
- var _a169, _b116, SQLiteBigIntBuilder, _a170, _b117, SQLiteBigInt, _a171, _b118, SQLiteBlobJsonBuilder, _a172, _b119, SQLiteBlobJson, _a173, _b120, SQLiteBlobBufferBuilder, _a174, _b121, SQLiteBlobBuffer;
28097
+ var _a171, _b116, SQLiteBigIntBuilder, _a172, _b117, SQLiteBigInt, _a173, _b118, SQLiteBlobJsonBuilder, _a174, _b119, SQLiteBlobJson, _a175, _b120, SQLiteBlobBufferBuilder, _a176, _b121, SQLiteBlobBuffer;
27157
28098
  var init_blob = __esm({
27158
28099
  "../drizzle-orm/dist/sqlite-core/columns/blob.js"() {
27159
28100
  "use strict";
27160
28101
  init_entity();
27161
28102
  init_utils2();
27162
28103
  init_common3();
27163
- SQLiteBigIntBuilder = class extends (_b116 = SQLiteColumnBuilder, _a169 = entityKind, _b116) {
28104
+ SQLiteBigIntBuilder = class extends (_b116 = SQLiteColumnBuilder, _a171 = entityKind, _b116) {
27164
28105
  constructor(name2) {
27165
28106
  super(name2, "bigint", "SQLiteBigInt");
27166
28107
  }
@@ -27169,8 +28110,8 @@ var init_blob = __esm({
27169
28110
  return new SQLiteBigInt(table4, this.config);
27170
28111
  }
27171
28112
  };
27172
- __publicField(SQLiteBigIntBuilder, _a169, "SQLiteBigIntBuilder");
27173
- SQLiteBigInt = class extends (_b117 = SQLiteColumn, _a170 = entityKind, _b117) {
28113
+ __publicField(SQLiteBigIntBuilder, _a171, "SQLiteBigIntBuilder");
28114
+ SQLiteBigInt = class extends (_b117 = SQLiteColumn, _a172 = entityKind, _b117) {
27174
28115
  getSQLType() {
27175
28116
  return "blob";
27176
28117
  }
@@ -27181,8 +28122,8 @@ var init_blob = __esm({
27181
28122
  return Buffer.from(value.toString());
27182
28123
  }
27183
28124
  };
27184
- __publicField(SQLiteBigInt, _a170, "SQLiteBigInt");
27185
- SQLiteBlobJsonBuilder = class extends (_b118 = SQLiteColumnBuilder, _a171 = entityKind, _b118) {
28125
+ __publicField(SQLiteBigInt, _a172, "SQLiteBigInt");
28126
+ SQLiteBlobJsonBuilder = class extends (_b118 = SQLiteColumnBuilder, _a173 = entityKind, _b118) {
27186
28127
  constructor(name2) {
27187
28128
  super(name2, "json", "SQLiteBlobJson");
27188
28129
  }
@@ -27194,8 +28135,8 @@ var init_blob = __esm({
27194
28135
  );
27195
28136
  }
27196
28137
  };
27197
- __publicField(SQLiteBlobJsonBuilder, _a171, "SQLiteBlobJsonBuilder");
27198
- SQLiteBlobJson = class extends (_b119 = SQLiteColumn, _a172 = entityKind, _b119) {
28138
+ __publicField(SQLiteBlobJsonBuilder, _a173, "SQLiteBlobJsonBuilder");
28139
+ SQLiteBlobJson = class extends (_b119 = SQLiteColumn, _a174 = entityKind, _b119) {
27199
28140
  getSQLType() {
27200
28141
  return "blob";
27201
28142
  }
@@ -27206,8 +28147,8 @@ var init_blob = __esm({
27206
28147
  return Buffer.from(JSON.stringify(value));
27207
28148
  }
27208
28149
  };
27209
- __publicField(SQLiteBlobJson, _a172, "SQLiteBlobJson");
27210
- SQLiteBlobBufferBuilder = class extends (_b120 = SQLiteColumnBuilder, _a173 = entityKind, _b120) {
28150
+ __publicField(SQLiteBlobJson, _a174, "SQLiteBlobJson");
28151
+ SQLiteBlobBufferBuilder = class extends (_b120 = SQLiteColumnBuilder, _a175 = entityKind, _b120) {
27211
28152
  constructor(name2) {
27212
28153
  super(name2, "buffer", "SQLiteBlobBuffer");
27213
28154
  }
@@ -27216,13 +28157,13 @@ var init_blob = __esm({
27216
28157
  return new SQLiteBlobBuffer(table4, this.config);
27217
28158
  }
27218
28159
  };
27219
- __publicField(SQLiteBlobBufferBuilder, _a173, "SQLiteBlobBufferBuilder");
27220
- SQLiteBlobBuffer = class extends (_b121 = SQLiteColumn, _a174 = entityKind, _b121) {
28160
+ __publicField(SQLiteBlobBufferBuilder, _a175, "SQLiteBlobBufferBuilder");
28161
+ SQLiteBlobBuffer = class extends (_b121 = SQLiteColumn, _a176 = entityKind, _b121) {
27221
28162
  getSQLType() {
27222
28163
  return "blob";
27223
28164
  }
27224
28165
  };
27225
- __publicField(SQLiteBlobBuffer, _a174, "SQLiteBlobBuffer");
28166
+ __publicField(SQLiteBlobBuffer, _a176, "SQLiteBlobBuffer");
27226
28167
  }
27227
28168
  });
27228
28169
 
@@ -27237,14 +28178,14 @@ function customType2(customTypeParams) {
27237
28178
  );
27238
28179
  };
27239
28180
  }
27240
- var _a175, _b122, SQLiteCustomColumnBuilder, _a176, _b123, SQLiteCustomColumn;
28181
+ var _a177, _b122, SQLiteCustomColumnBuilder, _a178, _b123, SQLiteCustomColumn;
27241
28182
  var init_custom2 = __esm({
27242
28183
  "../drizzle-orm/dist/sqlite-core/columns/custom.js"() {
27243
28184
  "use strict";
27244
28185
  init_entity();
27245
28186
  init_utils2();
27246
28187
  init_common3();
27247
- SQLiteCustomColumnBuilder = class extends (_b122 = SQLiteColumnBuilder, _a175 = entityKind, _b122) {
28188
+ SQLiteCustomColumnBuilder = class extends (_b122 = SQLiteColumnBuilder, _a177 = entityKind, _b122) {
27248
28189
  constructor(name2, fieldConfig, customTypeParams) {
27249
28190
  super(name2, "custom", "SQLiteCustomColumn");
27250
28191
  this.config.fieldConfig = fieldConfig;
@@ -27258,8 +28199,8 @@ var init_custom2 = __esm({
27258
28199
  );
27259
28200
  }
27260
28201
  };
27261
- __publicField(SQLiteCustomColumnBuilder, _a175, "SQLiteCustomColumnBuilder");
27262
- SQLiteCustomColumn = class extends (_b123 = SQLiteColumn, _a176 = entityKind, _b123) {
28202
+ __publicField(SQLiteCustomColumnBuilder, _a177, "SQLiteCustomColumnBuilder");
28203
+ SQLiteCustomColumn = class extends (_b123 = SQLiteColumn, _a178 = entityKind, _b123) {
27263
28204
  constructor(table4, config) {
27264
28205
  super(table4, config);
27265
28206
  __publicField(this, "sqlName");
@@ -27279,7 +28220,7 @@ var init_custom2 = __esm({
27279
28220
  return typeof this.mapTo === "function" ? this.mapTo(value) : value;
27280
28221
  }
27281
28222
  };
27282
- __publicField(SQLiteCustomColumn, _a176, "SQLiteCustomColumn");
28223
+ __publicField(SQLiteCustomColumn, _a178, "SQLiteCustomColumn");
27283
28224
  }
27284
28225
  });
27285
28226
 
@@ -27294,7 +28235,7 @@ function integer2(a, b) {
27294
28235
  }
27295
28236
  return new SQLiteIntegerBuilder(name2);
27296
28237
  }
27297
- 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;
28238
+ 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;
27298
28239
  var init_integer2 = __esm({
27299
28240
  "../drizzle-orm/dist/sqlite-core/columns/integer.js"() {
27300
28241
  "use strict";
@@ -27302,7 +28243,7 @@ var init_integer2 = __esm({
27302
28243
  init_sql();
27303
28244
  init_utils2();
27304
28245
  init_common3();
27305
- SQLiteBaseIntegerBuilder = class extends (_b124 = SQLiteColumnBuilder, _a177 = entityKind, _b124) {
28246
+ SQLiteBaseIntegerBuilder = class extends (_b124 = SQLiteColumnBuilder, _a179 = entityKind, _b124) {
27306
28247
  constructor(name2, dataType, columnType) {
27307
28248
  super(name2, dataType, columnType);
27308
28249
  this.config.autoIncrement = false;
@@ -27315,8 +28256,8 @@ var init_integer2 = __esm({
27315
28256
  return super.primaryKey();
27316
28257
  }
27317
28258
  };
27318
- __publicField(SQLiteBaseIntegerBuilder, _a177, "SQLiteBaseIntegerBuilder");
27319
- SQLiteBaseInteger = class extends (_b125 = SQLiteColumn, _a178 = entityKind, _b125) {
28259
+ __publicField(SQLiteBaseIntegerBuilder, _a179, "SQLiteBaseIntegerBuilder");
28260
+ SQLiteBaseInteger = class extends (_b125 = SQLiteColumn, _a180 = entityKind, _b125) {
27320
28261
  constructor() {
27321
28262
  super(...arguments);
27322
28263
  __publicField(this, "autoIncrement", this.config.autoIncrement);
@@ -27325,8 +28266,8 @@ var init_integer2 = __esm({
27325
28266
  return "integer";
27326
28267
  }
27327
28268
  };
27328
- __publicField(SQLiteBaseInteger, _a178, "SQLiteBaseInteger");
27329
- SQLiteIntegerBuilder = class extends (_b126 = SQLiteBaseIntegerBuilder, _a179 = entityKind, _b126) {
28269
+ __publicField(SQLiteBaseInteger, _a180, "SQLiteBaseInteger");
28270
+ SQLiteIntegerBuilder = class extends (_b126 = SQLiteBaseIntegerBuilder, _a181 = entityKind, _b126) {
27330
28271
  constructor(name2) {
27331
28272
  super(name2, "number", "SQLiteInteger");
27332
28273
  }
@@ -27337,11 +28278,11 @@ var init_integer2 = __esm({
27337
28278
  );
27338
28279
  }
27339
28280
  };
27340
- __publicField(SQLiteIntegerBuilder, _a179, "SQLiteIntegerBuilder");
27341
- SQLiteInteger = class extends (_b127 = SQLiteBaseInteger, _a180 = entityKind, _b127) {
28281
+ __publicField(SQLiteIntegerBuilder, _a181, "SQLiteIntegerBuilder");
28282
+ SQLiteInteger = class extends (_b127 = SQLiteBaseInteger, _a182 = entityKind, _b127) {
27342
28283
  };
27343
- __publicField(SQLiteInteger, _a180, "SQLiteInteger");
27344
- SQLiteTimestampBuilder = class extends (_b128 = SQLiteBaseIntegerBuilder, _a181 = entityKind, _b128) {
28284
+ __publicField(SQLiteInteger, _a182, "SQLiteInteger");
28285
+ SQLiteTimestampBuilder = class extends (_b128 = SQLiteBaseIntegerBuilder, _a183 = entityKind, _b128) {
27345
28286
  constructor(name2, mode) {
27346
28287
  super(name2, "date", "SQLiteTimestamp");
27347
28288
  this.config.mode = mode;
@@ -27361,8 +28302,8 @@ var init_integer2 = __esm({
27361
28302
  );
27362
28303
  }
27363
28304
  };
27364
- __publicField(SQLiteTimestampBuilder, _a181, "SQLiteTimestampBuilder");
27365
- SQLiteTimestamp = class extends (_b129 = SQLiteBaseInteger, _a182 = entityKind, _b129) {
28305
+ __publicField(SQLiteTimestampBuilder, _a183, "SQLiteTimestampBuilder");
28306
+ SQLiteTimestamp = class extends (_b129 = SQLiteBaseInteger, _a184 = entityKind, _b129) {
27366
28307
  constructor() {
27367
28308
  super(...arguments);
27368
28309
  __publicField(this, "mode", this.config.mode);
@@ -27381,8 +28322,8 @@ var init_integer2 = __esm({
27381
28322
  return unix;
27382
28323
  }
27383
28324
  };
27384
- __publicField(SQLiteTimestamp, _a182, "SQLiteTimestamp");
27385
- SQLiteBooleanBuilder = class extends (_b130 = SQLiteBaseIntegerBuilder, _a183 = entityKind, _b130) {
28325
+ __publicField(SQLiteTimestamp, _a184, "SQLiteTimestamp");
28326
+ SQLiteBooleanBuilder = class extends (_b130 = SQLiteBaseIntegerBuilder, _a185 = entityKind, _b130) {
27386
28327
  constructor(name2, mode) {
27387
28328
  super(name2, "boolean", "SQLiteBoolean");
27388
28329
  this.config.mode = mode;
@@ -27394,8 +28335,8 @@ var init_integer2 = __esm({
27394
28335
  );
27395
28336
  }
27396
28337
  };
27397
- __publicField(SQLiteBooleanBuilder, _a183, "SQLiteBooleanBuilder");
27398
- SQLiteBoolean = class extends (_b131 = SQLiteBaseInteger, _a184 = entityKind, _b131) {
28338
+ __publicField(SQLiteBooleanBuilder, _a185, "SQLiteBooleanBuilder");
28339
+ SQLiteBoolean = class extends (_b131 = SQLiteBaseInteger, _a186 = entityKind, _b131) {
27399
28340
  constructor() {
27400
28341
  super(...arguments);
27401
28342
  __publicField(this, "mode", this.config.mode);
@@ -27407,7 +28348,7 @@ var init_integer2 = __esm({
27407
28348
  return value ? 1 : 0;
27408
28349
  }
27409
28350
  };
27410
- __publicField(SQLiteBoolean, _a184, "SQLiteBoolean");
28351
+ __publicField(SQLiteBoolean, _a186, "SQLiteBoolean");
27411
28352
  }
27412
28353
  });
27413
28354
 
@@ -27415,13 +28356,13 @@ var init_integer2 = __esm({
27415
28356
  function numeric2(name2) {
27416
28357
  return new SQLiteNumericBuilder(name2 ?? "");
27417
28358
  }
27418
- var _a185, _b132, SQLiteNumericBuilder, _a186, _b133, SQLiteNumeric;
28359
+ var _a187, _b132, SQLiteNumericBuilder, _a188, _b133, SQLiteNumeric;
27419
28360
  var init_numeric2 = __esm({
27420
28361
  "../drizzle-orm/dist/sqlite-core/columns/numeric.js"() {
27421
28362
  "use strict";
27422
28363
  init_entity();
27423
28364
  init_common3();
27424
- SQLiteNumericBuilder = class extends (_b132 = SQLiteColumnBuilder, _a185 = entityKind, _b132) {
28365
+ SQLiteNumericBuilder = class extends (_b132 = SQLiteColumnBuilder, _a187 = entityKind, _b132) {
27425
28366
  constructor(name2) {
27426
28367
  super(name2, "string", "SQLiteNumeric");
27427
28368
  }
@@ -27433,13 +28374,13 @@ var init_numeric2 = __esm({
27433
28374
  );
27434
28375
  }
27435
28376
  };
27436
- __publicField(SQLiteNumericBuilder, _a185, "SQLiteNumericBuilder");
27437
- SQLiteNumeric = class extends (_b133 = SQLiteColumn, _a186 = entityKind, _b133) {
28377
+ __publicField(SQLiteNumericBuilder, _a187, "SQLiteNumericBuilder");
28378
+ SQLiteNumeric = class extends (_b133 = SQLiteColumn, _a188 = entityKind, _b133) {
27438
28379
  getSQLType() {
27439
28380
  return "numeric";
27440
28381
  }
27441
28382
  };
27442
- __publicField(SQLiteNumeric, _a186, "SQLiteNumeric");
28383
+ __publicField(SQLiteNumeric, _a188, "SQLiteNumeric");
27443
28384
  }
27444
28385
  });
27445
28386
 
@@ -27447,13 +28388,13 @@ var init_numeric2 = __esm({
27447
28388
  function real2(name2) {
27448
28389
  return new SQLiteRealBuilder(name2 ?? "");
27449
28390
  }
27450
- var _a187, _b134, SQLiteRealBuilder, _a188, _b135, SQLiteReal;
28391
+ var _a189, _b134, SQLiteRealBuilder, _a190, _b135, SQLiteReal;
27451
28392
  var init_real2 = __esm({
27452
28393
  "../drizzle-orm/dist/sqlite-core/columns/real.js"() {
27453
28394
  "use strict";
27454
28395
  init_entity();
27455
28396
  init_common3();
27456
- SQLiteRealBuilder = class extends (_b134 = SQLiteColumnBuilder, _a187 = entityKind, _b134) {
28397
+ SQLiteRealBuilder = class extends (_b134 = SQLiteColumnBuilder, _a189 = entityKind, _b134) {
27457
28398
  constructor(name2) {
27458
28399
  super(name2, "number", "SQLiteReal");
27459
28400
  }
@@ -27462,13 +28403,13 @@ var init_real2 = __esm({
27462
28403
  return new SQLiteReal(table4, this.config);
27463
28404
  }
27464
28405
  };
27465
- __publicField(SQLiteRealBuilder, _a187, "SQLiteRealBuilder");
27466
- SQLiteReal = class extends (_b135 = SQLiteColumn, _a188 = entityKind, _b135) {
28406
+ __publicField(SQLiteRealBuilder, _a189, "SQLiteRealBuilder");
28407
+ SQLiteReal = class extends (_b135 = SQLiteColumn, _a190 = entityKind, _b135) {
27467
28408
  getSQLType() {
27468
28409
  return "real";
27469
28410
  }
27470
28411
  };
27471
- __publicField(SQLiteReal, _a188, "SQLiteReal");
28412
+ __publicField(SQLiteReal, _a190, "SQLiteReal");
27472
28413
  }
27473
28414
  });
27474
28415
 
@@ -27480,14 +28421,14 @@ function text2(a, b = {}) {
27480
28421
  }
27481
28422
  return new SQLiteTextBuilder(name2, config);
27482
28423
  }
27483
- var _a189, _b136, SQLiteTextBuilder, _a190, _b137, SQLiteText, _a191, _b138, SQLiteTextJsonBuilder, _a192, _b139, SQLiteTextJson;
28424
+ var _a191, _b136, SQLiteTextBuilder, _a192, _b137, SQLiteText, _a193, _b138, SQLiteTextJsonBuilder, _a194, _b139, SQLiteTextJson;
27484
28425
  var init_text2 = __esm({
27485
28426
  "../drizzle-orm/dist/sqlite-core/columns/text.js"() {
27486
28427
  "use strict";
27487
28428
  init_entity();
27488
28429
  init_utils2();
27489
28430
  init_common3();
27490
- SQLiteTextBuilder = class extends (_b136 = SQLiteColumnBuilder, _a189 = entityKind, _b136) {
28431
+ SQLiteTextBuilder = class extends (_b136 = SQLiteColumnBuilder, _a191 = entityKind, _b136) {
27491
28432
  constructor(name2, config) {
27492
28433
  super(name2, "string", "SQLiteText");
27493
28434
  this.config.enumValues = config.enum;
@@ -27498,8 +28439,8 @@ var init_text2 = __esm({
27498
28439
  return new SQLiteText(table4, this.config);
27499
28440
  }
27500
28441
  };
27501
- __publicField(SQLiteTextBuilder, _a189, "SQLiteTextBuilder");
27502
- SQLiteText = class extends (_b137 = SQLiteColumn, _a190 = entityKind, _b137) {
28442
+ __publicField(SQLiteTextBuilder, _a191, "SQLiteTextBuilder");
28443
+ SQLiteText = class extends (_b137 = SQLiteColumn, _a192 = entityKind, _b137) {
27503
28444
  constructor(table4, config) {
27504
28445
  super(table4, config);
27505
28446
  __publicField(this, "enumValues", this.config.enumValues);
@@ -27509,8 +28450,8 @@ var init_text2 = __esm({
27509
28450
  return `text${this.config.length ? `(${this.config.length})` : ""}`;
27510
28451
  }
27511
28452
  };
27512
- __publicField(SQLiteText, _a190, "SQLiteText");
27513
- SQLiteTextJsonBuilder = class extends (_b138 = SQLiteColumnBuilder, _a191 = entityKind, _b138) {
28453
+ __publicField(SQLiteText, _a192, "SQLiteText");
28454
+ SQLiteTextJsonBuilder = class extends (_b138 = SQLiteColumnBuilder, _a193 = entityKind, _b138) {
27514
28455
  constructor(name2) {
27515
28456
  super(name2, "json", "SQLiteTextJson");
27516
28457
  }
@@ -27522,8 +28463,8 @@ var init_text2 = __esm({
27522
28463
  );
27523
28464
  }
27524
28465
  };
27525
- __publicField(SQLiteTextJsonBuilder, _a191, "SQLiteTextJsonBuilder");
27526
- SQLiteTextJson = class extends (_b139 = SQLiteColumn, _a192 = entityKind, _b139) {
28466
+ __publicField(SQLiteTextJsonBuilder, _a193, "SQLiteTextJsonBuilder");
28467
+ SQLiteTextJson = class extends (_b139 = SQLiteColumn, _a194 = entityKind, _b139) {
27527
28468
  getSQLType() {
27528
28469
  return "text";
27529
28470
  }
@@ -27534,7 +28475,7 @@ var init_text2 = __esm({
27534
28475
  return JSON.stringify(value);
27535
28476
  }
27536
28477
  };
27537
- __publicField(SQLiteTextJson, _a192, "SQLiteTextJson");
28478
+ __publicField(SQLiteTextJson, _a194, "SQLiteTextJson");
27538
28479
  }
27539
28480
  });
27540
28481
 
@@ -27596,7 +28537,7 @@ function sqliteTableBase(name2, columns, extraConfig, schema4, baseName = name2)
27596
28537
  }
27597
28538
  return table4;
27598
28539
  }
27599
- var InlineForeignKeys2, _a193, _b140, _c6, _d3, _e2, SQLiteTable, sqliteTable;
28540
+ var InlineForeignKeys2, _a195, _b140, _c6, _d3, _e2, SQLiteTable, sqliteTable;
27600
28541
  var init_table3 = __esm({
27601
28542
  "../drizzle-orm/dist/sqlite-core/table.js"() {
27602
28543
  "use strict";
@@ -27604,7 +28545,7 @@ var init_table3 = __esm({
27604
28545
  init_table();
27605
28546
  init_all2();
27606
28547
  InlineForeignKeys2 = Symbol.for("drizzle:SQLiteInlineForeignKeys");
27607
- SQLiteTable = class extends (_e2 = Table, _d3 = entityKind, _c6 = Table.Symbol.Columns, _b140 = InlineForeignKeys2, _a193 = Table.Symbol.ExtraConfigBuilder, _e2) {
28548
+ SQLiteTable = class extends (_e2 = Table, _d3 = entityKind, _c6 = Table.Symbol.Columns, _b140 = InlineForeignKeys2, _a195 = Table.Symbol.ExtraConfigBuilder, _e2) {
27608
28549
  constructor() {
27609
28550
  super(...arguments);
27610
28551
  /** @internal */
@@ -27612,7 +28553,7 @@ var init_table3 = __esm({
27612
28553
  /** @internal */
27613
28554
  __publicField(this, _b140, []);
27614
28555
  /** @internal */
27615
- __publicField(this, _a193);
28556
+ __publicField(this, _a195);
27616
28557
  }
27617
28558
  };
27618
28559
  __publicField(SQLiteTable, _d3, "SQLiteTable");
@@ -27627,7 +28568,7 @@ var init_table3 = __esm({
27627
28568
  });
27628
28569
 
27629
28570
  // ../drizzle-orm/dist/sqlite-core/query-builders/delete.js
27630
- var _a194, _b141, SQLiteDeleteBase;
28571
+ var _a196, _b141, SQLiteDeleteBase;
27631
28572
  var init_delete2 = __esm({
27632
28573
  "../drizzle-orm/dist/sqlite-core/query-builders/delete.js"() {
27633
28574
  "use strict";
@@ -27635,7 +28576,7 @@ var init_delete2 = __esm({
27635
28576
  init_query_promise();
27636
28577
  init_table3();
27637
28578
  init_utils2();
27638
- SQLiteDeleteBase = class extends (_b141 = QueryPromise, _a194 = entityKind, _b141) {
28579
+ SQLiteDeleteBase = class extends (_b141 = QueryPromise, _a196 = entityKind, _b141) {
27639
28580
  constructor(table4, session, dialect4, withList) {
27640
28581
  super();
27641
28582
  /** @internal */
@@ -27721,12 +28662,12 @@ var init_delete2 = __esm({
27721
28662
  return this;
27722
28663
  }
27723
28664
  };
27724
- __publicField(SQLiteDeleteBase, _a194, "SQLiteDelete");
28665
+ __publicField(SQLiteDeleteBase, _a196, "SQLiteDelete");
27725
28666
  }
27726
28667
  });
27727
28668
 
27728
28669
  // ../drizzle-orm/dist/sqlite-core/query-builders/insert.js
27729
- var _a195, SQLiteInsertBuilder, _a196, _b142, SQLiteInsertBase;
28670
+ var _a197, SQLiteInsertBuilder, _a198, _b142, SQLiteInsertBase;
27730
28671
  var init_insert2 = __esm({
27731
28672
  "../drizzle-orm/dist/sqlite-core/query-builders/insert.js"() {
27732
28673
  "use strict";
@@ -27736,7 +28677,7 @@ var init_insert2 = __esm({
27736
28677
  init_table3();
27737
28678
  init_table();
27738
28679
  init_utils2();
27739
- _a195 = entityKind;
28680
+ _a197 = entityKind;
27740
28681
  SQLiteInsertBuilder = class {
27741
28682
  constructor(table4, session, dialect4, withList) {
27742
28683
  this.table = table4;
@@ -27761,8 +28702,8 @@ var init_insert2 = __esm({
27761
28702
  return new SQLiteInsertBase(this.table, mappedValues, this.session, this.dialect, this.withList);
27762
28703
  }
27763
28704
  };
27764
- __publicField(SQLiteInsertBuilder, _a195, "SQLiteInsertBuilder");
27765
- SQLiteInsertBase = class extends (_b142 = QueryPromise, _a196 = entityKind, _b142) {
28705
+ __publicField(SQLiteInsertBuilder, _a197, "SQLiteInsertBuilder");
28706
+ SQLiteInsertBase = class extends (_b142 = QueryPromise, _a198 = entityKind, _b142) {
27766
28707
  constructor(table4, values, session, dialect4, withList) {
27767
28708
  super();
27768
28709
  /** @internal */
@@ -27889,25 +28830,25 @@ var init_insert2 = __esm({
27889
28830
  return this;
27890
28831
  }
27891
28832
  };
27892
- __publicField(SQLiteInsertBase, _a196, "SQLiteInsert");
28833
+ __publicField(SQLiteInsertBase, _a198, "SQLiteInsert");
27893
28834
  }
27894
28835
  });
27895
28836
 
27896
28837
  // ../drizzle-orm/dist/sqlite-core/view-base.js
27897
- var _a197, _b143, SQLiteViewBase;
28838
+ var _a199, _b143, SQLiteViewBase;
27898
28839
  var init_view_base2 = __esm({
27899
28840
  "../drizzle-orm/dist/sqlite-core/view-base.js"() {
27900
28841
  "use strict";
27901
28842
  init_entity();
27902
28843
  init_sql();
27903
- SQLiteViewBase = class extends (_b143 = View, _a197 = entityKind, _b143) {
28844
+ SQLiteViewBase = class extends (_b143 = View, _a199 = entityKind, _b143) {
27904
28845
  };
27905
- __publicField(SQLiteViewBase, _a197, "SQLiteViewBase");
28846
+ __publicField(SQLiteViewBase, _a199, "SQLiteViewBase");
27906
28847
  }
27907
28848
  });
27908
28849
 
27909
28850
  // ../drizzle-orm/dist/sqlite-core/dialect.js
27910
- var _a198, SQLiteDialect, _a199, _b144, SQLiteSyncDialect, _a200, _b145, SQLiteAsyncDialect;
28851
+ var _a200, SQLiteDialect, _a201, _b144, SQLiteSyncDialect, _a202, _b145, SQLiteAsyncDialect;
27911
28852
  var init_dialect2 = __esm({
27912
28853
  "../drizzle-orm/dist/sqlite-core/dialect.js"() {
27913
28854
  "use strict";
@@ -27926,7 +28867,7 @@ var init_dialect2 = __esm({
27926
28867
  init_utils2();
27927
28868
  init_view_common();
27928
28869
  init_view_base2();
27929
- _a198 = entityKind;
28870
+ _a200 = entityKind;
27930
28871
  SQLiteDialect = class {
27931
28872
  constructor(config) {
27932
28873
  /** @internal */
@@ -28438,8 +29379,8 @@ var init_dialect2 = __esm({
28438
29379
  };
28439
29380
  }
28440
29381
  };
28441
- __publicField(SQLiteDialect, _a198, "SQLiteDialect");
28442
- SQLiteSyncDialect = class extends (_b144 = SQLiteDialect, _a199 = entityKind, _b144) {
29382
+ __publicField(SQLiteDialect, _a200, "SQLiteDialect");
29383
+ SQLiteSyncDialect = class extends (_b144 = SQLiteDialect, _a201 = entityKind, _b144) {
28443
29384
  migrate(migrations, session, config) {
28444
29385
  const migrationsTable = config === void 0 ? "__drizzle_migrations" : typeof config === "string" ? "__drizzle_migrations" : config.migrationsTable ?? "__drizzle_migrations";
28445
29386
  const migrationTableCreate = sql`
@@ -28473,8 +29414,8 @@ var init_dialect2 = __esm({
28473
29414
  }
28474
29415
  }
28475
29416
  };
28476
- __publicField(SQLiteSyncDialect, _a199, "SQLiteSyncDialect");
28477
- SQLiteAsyncDialect = class extends (_b145 = SQLiteDialect, _a200 = entityKind, _b145) {
29417
+ __publicField(SQLiteSyncDialect, _a201, "SQLiteSyncDialect");
29418
+ SQLiteAsyncDialect = class extends (_b145 = SQLiteDialect, _a202 = entityKind, _b145) {
28478
29419
  async migrate(migrations, session, config) {
28479
29420
  const migrationsTable = config === void 0 ? "__drizzle_migrations" : typeof config === "string" ? "__drizzle_migrations" : config.migrationsTable ?? "__drizzle_migrations";
28480
29421
  const migrationTableCreate = sql`
@@ -28503,7 +29444,7 @@ var init_dialect2 = __esm({
28503
29444
  });
28504
29445
  }
28505
29446
  };
28506
- __publicField(SQLiteAsyncDialect, _a200, "SQLiteAsyncDialect");
29447
+ __publicField(SQLiteAsyncDialect, _a202, "SQLiteAsyncDialect");
28507
29448
  }
28508
29449
  });
28509
29450
 
@@ -28525,7 +29466,7 @@ function createSetOperator2(type, isAll) {
28525
29466
  return leftSelect.addSetOperators(setOperators);
28526
29467
  };
28527
29468
  }
28528
- var _a201, SQLiteSelectBuilder, _a202, _b146, SQLiteSelectQueryBuilderBase, _a203, _b147, SQLiteSelectBase, getSQLiteSetOperators, union2, unionAll2, intersect2, except2;
29469
+ var _a203, SQLiteSelectBuilder, _a204, _b146, SQLiteSelectQueryBuilderBase, _a205, _b147, SQLiteSelectBase, getSQLiteSetOperators, union2, unionAll2, intersect2, except2;
28529
29470
  var init_select3 = __esm({
28530
29471
  "../drizzle-orm/dist/sqlite-core/query-builders/select.js"() {
28531
29472
  "use strict";
@@ -28539,7 +29480,7 @@ var init_select3 = __esm({
28539
29480
  init_utils2();
28540
29481
  init_view_common();
28541
29482
  init_view_base2();
28542
- _a201 = entityKind;
29483
+ _a203 = entityKind;
28543
29484
  SQLiteSelectBuilder = class {
28544
29485
  constructor(config) {
28545
29486
  __publicField(this, "fields");
@@ -28580,8 +29521,8 @@ var init_select3 = __esm({
28580
29521
  });
28581
29522
  }
28582
29523
  };
28583
- __publicField(SQLiteSelectBuilder, _a201, "SQLiteSelectBuilder");
28584
- SQLiteSelectQueryBuilderBase = class extends (_b146 = TypedQueryBuilder, _a202 = entityKind, _b146) {
29524
+ __publicField(SQLiteSelectBuilder, _a203, "SQLiteSelectBuilder");
29525
+ SQLiteSelectQueryBuilderBase = class extends (_b146 = TypedQueryBuilder, _a204 = entityKind, _b146) {
28585
29526
  constructor({ table: table4, fields, isPartialSelect, session, dialect: dialect4, withList, distinct }) {
28586
29527
  super();
28587
29528
  __publicField(this, "_");
@@ -29086,8 +30027,8 @@ var init_select3 = __esm({
29086
30027
  return this;
29087
30028
  }
29088
30029
  };
29089
- __publicField(SQLiteSelectQueryBuilderBase, _a202, "SQLiteSelectQueryBuilder");
29090
- SQLiteSelectBase = class extends (_b147 = SQLiteSelectQueryBuilderBase, _a203 = entityKind, _b147) {
30030
+ __publicField(SQLiteSelectQueryBuilderBase, _a204, "SQLiteSelectQueryBuilder");
30031
+ SQLiteSelectBase = class extends (_b147 = SQLiteSelectQueryBuilderBase, _a205 = entityKind, _b147) {
29091
30032
  constructor() {
29092
30033
  super(...arguments);
29093
30034
  __publicField(this, "run", (placeholderValues) => {
@@ -29125,7 +30066,7 @@ var init_select3 = __esm({
29125
30066
  return this.all();
29126
30067
  }
29127
30068
  };
29128
- __publicField(SQLiteSelectBase, _a203, "SQLiteSelect");
30069
+ __publicField(SQLiteSelectBase, _a205, "SQLiteSelect");
29129
30070
  applyMixins(SQLiteSelectBase, [QueryPromise]);
29130
30071
  getSQLiteSetOperators = () => ({
29131
30072
  union: union2,
@@ -29141,7 +30082,7 @@ var init_select3 = __esm({
29141
30082
  });
29142
30083
 
29143
30084
  // ../drizzle-orm/dist/sqlite-core/query-builders/query-builder.js
29144
- var _a204, QueryBuilder2;
30085
+ var _a206, QueryBuilder2;
29145
30086
  var init_query_builder3 = __esm({
29146
30087
  "../drizzle-orm/dist/sqlite-core/query-builders/query-builder.js"() {
29147
30088
  "use strict";
@@ -29150,7 +30091,7 @@ var init_query_builder3 = __esm({
29150
30091
  init_dialect2();
29151
30092
  init_subquery();
29152
30093
  init_select3();
29153
- _a204 = entityKind;
30094
+ _a206 = entityKind;
29154
30095
  QueryBuilder2 = class {
29155
30096
  constructor(dialect4) {
29156
30097
  __publicField(this, "dialect");
@@ -29212,7 +30153,7 @@ var init_query_builder3 = __esm({
29212
30153
  return this.dialect;
29213
30154
  }
29214
30155
  };
29215
- __publicField(QueryBuilder2, _a204, "SQLiteQueryBuilder");
30156
+ __publicField(QueryBuilder2, _a206, "SQLiteQueryBuilder");
29216
30157
  }
29217
30158
  });
29218
30159
 
@@ -29224,7 +30165,7 @@ var init_select_types2 = __esm({
29224
30165
  });
29225
30166
 
29226
30167
  // ../drizzle-orm/dist/sqlite-core/query-builders/update.js
29227
- var _a205, SQLiteUpdateBuilder, _a206, _b148, SQLiteUpdateBase;
30168
+ var _a207, SQLiteUpdateBuilder, _a208, _b148, SQLiteUpdateBase;
29228
30169
  var init_update2 = __esm({
29229
30170
  "../drizzle-orm/dist/sqlite-core/query-builders/update.js"() {
29230
30171
  "use strict";
@@ -29232,7 +30173,7 @@ var init_update2 = __esm({
29232
30173
  init_query_promise();
29233
30174
  init_table3();
29234
30175
  init_utils2();
29235
- _a205 = entityKind;
30176
+ _a207 = entityKind;
29236
30177
  SQLiteUpdateBuilder = class {
29237
30178
  constructor(table4, session, dialect4, withList) {
29238
30179
  this.table = table4;
@@ -29250,8 +30191,8 @@ var init_update2 = __esm({
29250
30191
  );
29251
30192
  }
29252
30193
  };
29253
- __publicField(SQLiteUpdateBuilder, _a205, "SQLiteUpdateBuilder");
29254
- SQLiteUpdateBase = class extends (_b148 = QueryPromise, _a206 = entityKind, _b148) {
30194
+ __publicField(SQLiteUpdateBuilder, _a207, "SQLiteUpdateBuilder");
30195
+ SQLiteUpdateBase = class extends (_b148 = QueryPromise, _a208 = entityKind, _b148) {
29255
30196
  constructor(table4, set, session, dialect4, withList) {
29256
30197
  super();
29257
30198
  /** @internal */
@@ -29340,7 +30281,7 @@ var init_update2 = __esm({
29340
30281
  return this;
29341
30282
  }
29342
30283
  };
29343
- __publicField(SQLiteUpdateBase, _a206, "SQLiteUpdate");
30284
+ __publicField(SQLiteUpdateBase, _a208, "SQLiteUpdate");
29344
30285
  }
29345
30286
  });
29346
30287
 
@@ -29358,17 +30299,17 @@ var init_query_builders2 = __esm({
29358
30299
  });
29359
30300
 
29360
30301
  // ../drizzle-orm/dist/sqlite-core/query-builders/count.js
29361
- var _a207, _b149, _c7, _SQLiteCountBuilder, SQLiteCountBuilder;
30302
+ var _a209, _b149, _c7, _SQLiteCountBuilder, SQLiteCountBuilder;
29362
30303
  var init_count2 = __esm({
29363
30304
  "../drizzle-orm/dist/sqlite-core/query-builders/count.js"() {
29364
30305
  "use strict";
29365
30306
  init_entity();
29366
30307
  init_sql();
29367
- _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b149 = entityKind, _a207 = Symbol.toStringTag, _c7) {
30308
+ _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b149 = entityKind, _a209 = Symbol.toStringTag, _c7) {
29368
30309
  constructor(params) {
29369
30310
  super(_SQLiteCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
29370
30311
  __publicField(this, "sql");
29371
- __publicField(this, _a207, "SQLiteCountBuilderAsync");
30312
+ __publicField(this, _a209, "SQLiteCountBuilderAsync");
29372
30313
  __publicField(this, "session");
29373
30314
  this.params = params;
29374
30315
  this.session = params.session;
@@ -29411,14 +30352,14 @@ var init_count2 = __esm({
29411
30352
  });
29412
30353
 
29413
30354
  // ../drizzle-orm/dist/sqlite-core/query-builders/query.js
29414
- var _a208, RelationalQueryBuilder2, _a209, _b150, SQLiteRelationalQuery, _a210, _b151, SQLiteSyncRelationalQuery;
30355
+ var _a210, RelationalQueryBuilder2, _a211, _b150, SQLiteRelationalQuery, _a212, _b151, SQLiteSyncRelationalQuery;
29415
30356
  var init_query2 = __esm({
29416
30357
  "../drizzle-orm/dist/sqlite-core/query-builders/query.js"() {
29417
30358
  "use strict";
29418
30359
  init_entity();
29419
30360
  init_query_promise();
29420
30361
  init_relations();
29421
- _a208 = entityKind;
30362
+ _a210 = entityKind;
29422
30363
  RelationalQueryBuilder2 = class {
29423
30364
  constructor(mode, fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session) {
29424
30365
  this.mode = mode;
@@ -29477,8 +30418,8 @@ var init_query2 = __esm({
29477
30418
  );
29478
30419
  }
29479
30420
  };
29480
- __publicField(RelationalQueryBuilder2, _a208, "SQLiteAsyncRelationalQueryBuilder");
29481
- SQLiteRelationalQuery = class extends (_b150 = QueryPromise, _a209 = entityKind, _b150) {
30421
+ __publicField(RelationalQueryBuilder2, _a210, "SQLiteAsyncRelationalQueryBuilder");
30422
+ SQLiteRelationalQuery = class extends (_b150 = QueryPromise, _a211 = entityKind, _b150) {
29482
30423
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, config, mode) {
29483
30424
  super();
29484
30425
  /** @internal */
@@ -29554,24 +30495,24 @@ var init_query2 = __esm({
29554
30495
  return this.executeRaw();
29555
30496
  }
29556
30497
  };
29557
- __publicField(SQLiteRelationalQuery, _a209, "SQLiteAsyncRelationalQuery");
29558
- SQLiteSyncRelationalQuery = class extends (_b151 = SQLiteRelationalQuery, _a210 = entityKind, _b151) {
30498
+ __publicField(SQLiteRelationalQuery, _a211, "SQLiteAsyncRelationalQuery");
30499
+ SQLiteSyncRelationalQuery = class extends (_b151 = SQLiteRelationalQuery, _a212 = entityKind, _b151) {
29559
30500
  sync() {
29560
30501
  return this.executeRaw();
29561
30502
  }
29562
30503
  };
29563
- __publicField(SQLiteSyncRelationalQuery, _a210, "SQLiteSyncRelationalQuery");
30504
+ __publicField(SQLiteSyncRelationalQuery, _a212, "SQLiteSyncRelationalQuery");
29564
30505
  }
29565
30506
  });
29566
30507
 
29567
30508
  // ../drizzle-orm/dist/sqlite-core/query-builders/raw.js
29568
- var _a211, _b152, SQLiteRaw;
30509
+ var _a213, _b152, SQLiteRaw;
29569
30510
  var init_raw2 = __esm({
29570
30511
  "../drizzle-orm/dist/sqlite-core/query-builders/raw.js"() {
29571
30512
  "use strict";
29572
30513
  init_entity();
29573
30514
  init_query_promise();
29574
- SQLiteRaw = class extends (_b152 = QueryPromise, _a211 = entityKind, _b152) {
30515
+ SQLiteRaw = class extends (_b152 = QueryPromise, _a213 = entityKind, _b152) {
29575
30516
  constructor(execute, getSQL, action, dialect4, mapBatchResult) {
29576
30517
  super();
29577
30518
  /** @internal */
@@ -29596,12 +30537,12 @@ var init_raw2 = __esm({
29596
30537
  return false;
29597
30538
  }
29598
30539
  };
29599
- __publicField(SQLiteRaw, _a211, "SQLiteRaw");
30540
+ __publicField(SQLiteRaw, _a213, "SQLiteRaw");
29600
30541
  }
29601
30542
  });
29602
30543
 
29603
30544
  // ../drizzle-orm/dist/sqlite-core/db.js
29604
- var _a212, BaseSQLiteDatabase;
30545
+ var _a214, BaseSQLiteDatabase;
29605
30546
  var init_db2 = __esm({
29606
30547
  "../drizzle-orm/dist/sqlite-core/db.js"() {
29607
30548
  "use strict";
@@ -29613,7 +30554,7 @@ var init_db2 = __esm({
29613
30554
  init_count2();
29614
30555
  init_query2();
29615
30556
  init_raw2();
29616
- _a212 = entityKind;
30557
+ _a214 = entityKind;
29617
30558
  BaseSQLiteDatabase = class {
29618
30559
  constructor(resultKind, dialect4, session, schema4) {
29619
30560
  __publicField(this, "query");
@@ -29895,17 +30836,17 @@ var init_db2 = __esm({
29895
30836
  return this.session.transaction(transaction, config);
29896
30837
  }
29897
30838
  };
29898
- __publicField(BaseSQLiteDatabase, _a212, "BaseSQLiteDatabase");
30839
+ __publicField(BaseSQLiteDatabase, _a214, "BaseSQLiteDatabase");
29899
30840
  }
29900
30841
  });
29901
30842
 
29902
30843
  // ../drizzle-orm/dist/sqlite-core/indexes.js
29903
- var _a213, IndexBuilderOn2, _a214, IndexBuilder2, _a215, Index4;
30844
+ var _a215, IndexBuilderOn2, _a216, IndexBuilder2, _a217, Index4;
29904
30845
  var init_indexes2 = __esm({
29905
30846
  "../drizzle-orm/dist/sqlite-core/indexes.js"() {
29906
30847
  "use strict";
29907
30848
  init_entity();
29908
- _a213 = entityKind;
30849
+ _a215 = entityKind;
29909
30850
  IndexBuilderOn2 = class {
29910
30851
  constructor(name2, unique) {
29911
30852
  this.name = name2;
@@ -29915,8 +30856,8 @@ var init_indexes2 = __esm({
29915
30856
  return new IndexBuilder2(this.name, columns, this.unique);
29916
30857
  }
29917
30858
  };
29918
- __publicField(IndexBuilderOn2, _a213, "SQLiteIndexBuilderOn");
29919
- _a214 = entityKind;
30859
+ __publicField(IndexBuilderOn2, _a215, "SQLiteIndexBuilderOn");
30860
+ _a216 = entityKind;
29920
30861
  IndexBuilder2 = class {
29921
30862
  constructor(name2, columns, unique) {
29922
30863
  /** @internal */
@@ -29940,26 +30881,26 @@ var init_indexes2 = __esm({
29940
30881
  return new Index4(this.config, table4);
29941
30882
  }
29942
30883
  };
29943
- __publicField(IndexBuilder2, _a214, "SQLiteIndexBuilder");
29944
- _a215 = entityKind;
30884
+ __publicField(IndexBuilder2, _a216, "SQLiteIndexBuilder");
30885
+ _a217 = entityKind;
29945
30886
  Index4 = class {
29946
30887
  constructor(config, table4) {
29947
30888
  __publicField(this, "config");
29948
30889
  this.config = { ...config, table: table4 };
29949
30890
  }
29950
30891
  };
29951
- __publicField(Index4, _a215, "SQLiteIndex");
30892
+ __publicField(Index4, _a217, "SQLiteIndex");
29952
30893
  }
29953
30894
  });
29954
30895
 
29955
30896
  // ../drizzle-orm/dist/sqlite-core/primary-keys.js
29956
- var _a216, PrimaryKeyBuilder2, _a217, PrimaryKey2;
30897
+ var _a218, PrimaryKeyBuilder2, _a219, PrimaryKey2;
29957
30898
  var init_primary_keys2 = __esm({
29958
30899
  "../drizzle-orm/dist/sqlite-core/primary-keys.js"() {
29959
30900
  "use strict";
29960
30901
  init_entity();
29961
30902
  init_table3();
29962
- _a216 = entityKind;
30903
+ _a218 = entityKind;
29963
30904
  PrimaryKeyBuilder2 = class {
29964
30905
  constructor(columns, name2) {
29965
30906
  /** @internal */
@@ -29974,8 +30915,8 @@ var init_primary_keys2 = __esm({
29974
30915
  return new PrimaryKey2(table4, this.columns, this.name);
29975
30916
  }
29976
30917
  };
29977
- __publicField(PrimaryKeyBuilder2, _a216, "SQLitePrimaryKeyBuilder");
29978
- _a217 = entityKind;
30918
+ __publicField(PrimaryKeyBuilder2, _a218, "SQLitePrimaryKeyBuilder");
30919
+ _a219 = entityKind;
29979
30920
  PrimaryKey2 = class {
29980
30921
  constructor(table4, columns, name2) {
29981
30922
  __publicField(this, "columns");
@@ -29988,12 +30929,12 @@ var init_primary_keys2 = __esm({
29988
30929
  return this.name ?? `${this.table[SQLiteTable.Symbol.Name]}_${this.columns.map((column4) => column4.name).join("_")}_pk`;
29989
30930
  }
29990
30931
  };
29991
- __publicField(PrimaryKey2, _a217, "SQLitePrimaryKey");
30932
+ __publicField(PrimaryKey2, _a219, "SQLitePrimaryKey");
29992
30933
  }
29993
30934
  });
29994
30935
 
29995
30936
  // ../drizzle-orm/dist/sqlite-core/session.js
29996
- var _a218, _b153, ExecuteResultSync, _a219, SQLitePreparedQuery, _a220, SQLiteSession, _a221, _b154, SQLiteTransaction;
30937
+ var _a220, _b153, ExecuteResultSync, _a221, SQLitePreparedQuery, _a222, SQLiteSession, _a223, _b154, SQLiteTransaction;
29997
30938
  var init_session2 = __esm({
29998
30939
  "../drizzle-orm/dist/sqlite-core/session.js"() {
29999
30940
  "use strict";
@@ -30001,7 +30942,7 @@ var init_session2 = __esm({
30001
30942
  init_errors();
30002
30943
  init_query_promise();
30003
30944
  init_db2();
30004
- ExecuteResultSync = class extends (_b153 = QueryPromise, _a218 = entityKind, _b153) {
30945
+ ExecuteResultSync = class extends (_b153 = QueryPromise, _a220 = entityKind, _b153) {
30005
30946
  constructor(resultCb) {
30006
30947
  super();
30007
30948
  this.resultCb = resultCb;
@@ -30013,8 +30954,8 @@ var init_session2 = __esm({
30013
30954
  return this.resultCb();
30014
30955
  }
30015
30956
  };
30016
- __publicField(ExecuteResultSync, _a218, "ExecuteResultSync");
30017
- _a219 = entityKind;
30957
+ __publicField(ExecuteResultSync, _a220, "ExecuteResultSync");
30958
+ _a221 = entityKind;
30018
30959
  SQLitePreparedQuery = class {
30019
30960
  constructor(mode, executeMethod, query) {
30020
30961
  /** @internal */
@@ -30055,8 +30996,8 @@ var init_session2 = __esm({
30055
30996
  }
30056
30997
  }
30057
30998
  };
30058
- __publicField(SQLitePreparedQuery, _a219, "PreparedQuery");
30059
- _a220 = entityKind;
30999
+ __publicField(SQLitePreparedQuery, _a221, "PreparedQuery");
31000
+ _a222 = entityKind;
30060
31001
  SQLiteSession = class {
30061
31002
  constructor(dialect4) {
30062
31003
  this.dialect = dialect4;
@@ -30102,8 +31043,8 @@ var init_session2 = __esm({
30102
31043
  throw new Error("Not implemented");
30103
31044
  }
30104
31045
  };
30105
- __publicField(SQLiteSession, _a220, "SQLiteSession");
30106
- SQLiteTransaction = class extends (_b154 = BaseSQLiteDatabase, _a221 = entityKind, _b154) {
31046
+ __publicField(SQLiteSession, _a222, "SQLiteSession");
31047
+ SQLiteTransaction = class extends (_b154 = BaseSQLiteDatabase, _a223 = entityKind, _b154) {
30107
31048
  constructor(resultType, dialect4, session, schema4, nestedIndex = 0) {
30108
31049
  super(resultType, dialect4, session, schema4);
30109
31050
  this.schema = schema4;
@@ -30113,7 +31054,7 @@ var init_session2 = __esm({
30113
31054
  throw new TransactionRollbackError();
30114
31055
  }
30115
31056
  };
30116
- __publicField(SQLiteTransaction, _a221, "SQLiteTransaction");
31057
+ __publicField(SQLiteTransaction, _a223, "SQLiteTransaction");
30117
31058
  }
30118
31059
  });
30119
31060
 
@@ -30184,7 +31125,7 @@ var init_utils6 = __esm({
30184
31125
  });
30185
31126
 
30186
31127
  // ../drizzle-orm/dist/sqlite-core/view.js
30187
- var _a222, ViewBuilderCore, _a223, _b155, ViewBuilder2, _a224, _b156, ManualViewBuilder2, _a225, _b157, _c8, SQLiteView;
31128
+ var _a224, ViewBuilderCore, _a225, _b155, ViewBuilder2, _a226, _b156, ManualViewBuilder2, _a227, _b157, _c8, SQLiteView;
30188
31129
  var init_view2 = __esm({
30189
31130
  "../drizzle-orm/dist/sqlite-core/view.js"() {
30190
31131
  "use strict";
@@ -30195,15 +31136,15 @@ var init_view2 = __esm({
30195
31136
  init_table3();
30196
31137
  init_view_base2();
30197
31138
  init_view_common3();
30198
- _a222 = entityKind;
31139
+ _a224 = entityKind;
30199
31140
  ViewBuilderCore = class {
30200
31141
  constructor(name2) {
30201
31142
  __publicField(this, "config", {});
30202
31143
  this.name = name2;
30203
31144
  }
30204
31145
  };
30205
- __publicField(ViewBuilderCore, _a222, "SQLiteViewBuilderCore");
30206
- ViewBuilder2 = class extends (_b155 = ViewBuilderCore, _a223 = entityKind, _b155) {
31146
+ __publicField(ViewBuilderCore, _a224, "SQLiteViewBuilderCore");
31147
+ ViewBuilder2 = class extends (_b155 = ViewBuilderCore, _a225 = entityKind, _b155) {
30207
31148
  as(qb) {
30208
31149
  if (typeof qb === "function") {
30209
31150
  qb = qb(new QueryBuilder2());
@@ -30229,8 +31170,8 @@ var init_view2 = __esm({
30229
31170
  );
30230
31171
  }
30231
31172
  };
30232
- __publicField(ViewBuilder2, _a223, "SQLiteViewBuilder");
30233
- ManualViewBuilder2 = class extends (_b156 = ViewBuilderCore, _a224 = entityKind, _b156) {
31173
+ __publicField(ViewBuilder2, _a225, "SQLiteViewBuilder");
31174
+ ManualViewBuilder2 = class extends (_b156 = ViewBuilderCore, _a226 = entityKind, _b156) {
30234
31175
  constructor(name2, columns) {
30235
31176
  super(name2);
30236
31177
  __publicField(this, "columns");
@@ -30275,12 +31216,12 @@ var init_view2 = __esm({
30275
31216
  );
30276
31217
  }
30277
31218
  };
30278
- __publicField(ManualViewBuilder2, _a224, "SQLiteManualViewBuilder");
30279
- SQLiteView = class extends (_c8 = SQLiteViewBase, _b157 = entityKind, _a225 = SQLiteViewConfig, _c8) {
31219
+ __publicField(ManualViewBuilder2, _a226, "SQLiteManualViewBuilder");
31220
+ SQLiteView = class extends (_c8 = SQLiteViewBase, _b157 = entityKind, _a227 = SQLiteViewConfig, _c8) {
30280
31221
  constructor({ sqliteConfig, config }) {
30281
31222
  super(config);
30282
31223
  /** @internal */
30283
- __publicField(this, _a225);
31224
+ __publicField(this, _a227);
30284
31225
  this[SQLiteViewConfig] = sqliteConfig;
30285
31226
  }
30286
31227
  };
@@ -30817,12 +31758,12 @@ var init_alias4 = __esm({
30817
31758
  });
30818
31759
 
30819
31760
  // ../drizzle-orm/dist/mysql-core/checks.js
30820
- var _a226, CheckBuilder3, _a227, Check3;
31761
+ var _a228, CheckBuilder3, _a229, Check3;
30821
31762
  var init_checks3 = __esm({
30822
31763
  "../drizzle-orm/dist/mysql-core/checks.js"() {
30823
31764
  "use strict";
30824
31765
  init_entity();
30825
- _a226 = entityKind;
31766
+ _a228 = entityKind;
30826
31767
  CheckBuilder3 = class {
30827
31768
  constructor(name2, value) {
30828
31769
  __publicField(this, "brand");
@@ -30834,8 +31775,8 @@ var init_checks3 = __esm({
30834
31775
  return new Check3(table4, this);
30835
31776
  }
30836
31777
  };
30837
- __publicField(CheckBuilder3, _a226, "MySqlCheckBuilder");
30838
- _a227 = entityKind;
31778
+ __publicField(CheckBuilder3, _a228, "MySqlCheckBuilder");
31779
+ _a229 = entityKind;
30839
31780
  Check3 = class {
30840
31781
  constructor(table4, builder) {
30841
31782
  __publicField(this, "name");
@@ -30845,18 +31786,18 @@ var init_checks3 = __esm({
30845
31786
  this.value = builder.value;
30846
31787
  }
30847
31788
  };
30848
- __publicField(Check3, _a227, "MySqlCheck");
31789
+ __publicField(Check3, _a229, "MySqlCheck");
30849
31790
  }
30850
31791
  });
30851
31792
 
30852
31793
  // ../drizzle-orm/dist/mysql-core/foreign-keys.js
30853
- var _a228, ForeignKeyBuilder3, _a229, ForeignKey3;
31794
+ var _a230, ForeignKeyBuilder3, _a231, ForeignKey3;
30854
31795
  var init_foreign_keys3 = __esm({
30855
31796
  "../drizzle-orm/dist/mysql-core/foreign-keys.js"() {
30856
31797
  "use strict";
30857
31798
  init_entity();
30858
31799
  init_table_utils();
30859
- _a228 = entityKind;
31800
+ _a230 = entityKind;
30860
31801
  ForeignKeyBuilder3 = class {
30861
31802
  constructor(config, actions) {
30862
31803
  /** @internal */
@@ -30887,8 +31828,8 @@ var init_foreign_keys3 = __esm({
30887
31828
  return new ForeignKey3(table4, this);
30888
31829
  }
30889
31830
  };
30890
- __publicField(ForeignKeyBuilder3, _a228, "MySqlForeignKeyBuilder");
30891
- _a229 = entityKind;
31831
+ __publicField(ForeignKeyBuilder3, _a230, "MySqlForeignKeyBuilder");
31832
+ _a231 = entityKind;
30892
31833
  ForeignKey3 = class {
30893
31834
  constructor(table4, builder) {
30894
31835
  __publicField(this, "reference");
@@ -30912,7 +31853,7 @@ var init_foreign_keys3 = __esm({
30912
31853
  return name2 ?? `${chunks.join("_")}_fk`;
30913
31854
  }
30914
31855
  };
30915
- __publicField(ForeignKey3, _a229, "MySqlForeignKey");
31856
+ __publicField(ForeignKey3, _a231, "MySqlForeignKey");
30916
31857
  }
30917
31858
  });
30918
31859
 
@@ -30920,13 +31861,13 @@ var init_foreign_keys3 = __esm({
30920
31861
  function uniqueKeyName3(table4, columns) {
30921
31862
  return `${table4[TableName]}_${columns.join("_")}_unique`;
30922
31863
  }
30923
- var _a230, UniqueConstraintBuilder3, _a231, UniqueOnConstraintBuilder3, _a232, UniqueConstraint3;
31864
+ var _a232, UniqueConstraintBuilder3, _a233, UniqueOnConstraintBuilder3, _a234, UniqueConstraint3;
30924
31865
  var init_unique_constraint3 = __esm({
30925
31866
  "../drizzle-orm/dist/mysql-core/unique-constraint.js"() {
30926
31867
  "use strict";
30927
31868
  init_entity();
30928
31869
  init_table_utils();
30929
- _a230 = entityKind;
31870
+ _a232 = entityKind;
30930
31871
  UniqueConstraintBuilder3 = class {
30931
31872
  constructor(columns, name2) {
30932
31873
  /** @internal */
@@ -30939,8 +31880,8 @@ var init_unique_constraint3 = __esm({
30939
31880
  return new UniqueConstraint3(table4, this.columns, this.name);
30940
31881
  }
30941
31882
  };
30942
- __publicField(UniqueConstraintBuilder3, _a230, "MySqlUniqueConstraintBuilder");
30943
- _a231 = entityKind;
31883
+ __publicField(UniqueConstraintBuilder3, _a232, "MySqlUniqueConstraintBuilder");
31884
+ _a233 = entityKind;
30944
31885
  UniqueOnConstraintBuilder3 = class {
30945
31886
  constructor(name2) {
30946
31887
  /** @internal */
@@ -30951,8 +31892,8 @@ var init_unique_constraint3 = __esm({
30951
31892
  return new UniqueConstraintBuilder3(columns, this.name);
30952
31893
  }
30953
31894
  };
30954
- __publicField(UniqueOnConstraintBuilder3, _a231, "MySqlUniqueOnConstraintBuilder");
30955
- _a232 = entityKind;
31895
+ __publicField(UniqueOnConstraintBuilder3, _a233, "MySqlUniqueOnConstraintBuilder");
31896
+ _a234 = entityKind;
30956
31897
  UniqueConstraint3 = class {
30957
31898
  constructor(table4, columns, name2) {
30958
31899
  __publicField(this, "columns");
@@ -30966,12 +31907,12 @@ var init_unique_constraint3 = __esm({
30966
31907
  return this.name;
30967
31908
  }
30968
31909
  };
30969
- __publicField(UniqueConstraint3, _a232, "MySqlUniqueConstraint");
31910
+ __publicField(UniqueConstraint3, _a234, "MySqlUniqueConstraint");
30970
31911
  }
30971
31912
  });
30972
31913
 
30973
31914
  // ../drizzle-orm/dist/mysql-core/columns/common.js
30974
- var _a233, _b158, MySqlColumnBuilder, _a234, _b159, MySqlColumn, _a235, _b160, MySqlColumnBuilderWithAutoIncrement, _a236, _b161, MySqlColumnWithAutoIncrement;
31915
+ var _a235, _b158, MySqlColumnBuilder, _a236, _b159, MySqlColumn, _a237, _b160, MySqlColumnBuilderWithAutoIncrement, _a238, _b161, MySqlColumnWithAutoIncrement;
30975
31916
  var init_common4 = __esm({
30976
31917
  "../drizzle-orm/dist/mysql-core/columns/common.js"() {
30977
31918
  "use strict";
@@ -30980,7 +31921,7 @@ var init_common4 = __esm({
30980
31921
  init_entity();
30981
31922
  init_foreign_keys3();
30982
31923
  init_unique_constraint3();
30983
- MySqlColumnBuilder = class extends (_b158 = ColumnBuilder, _a233 = entityKind, _b158) {
31924
+ MySqlColumnBuilder = class extends (_b158 = ColumnBuilder, _a235 = entityKind, _b158) {
30984
31925
  constructor() {
30985
31926
  super(...arguments);
30986
31927
  __publicField(this, "foreignKeyConfigs", []);
@@ -31021,8 +31962,8 @@ var init_common4 = __esm({
31021
31962
  });
31022
31963
  }
31023
31964
  };
31024
- __publicField(MySqlColumnBuilder, _a233, "MySqlColumnBuilder");
31025
- MySqlColumn = class extends (_b159 = Column2, _a234 = entityKind, _b159) {
31965
+ __publicField(MySqlColumnBuilder, _a235, "MySqlColumnBuilder");
31966
+ MySqlColumn = class extends (_b159 = Column2, _a236 = entityKind, _b159) {
31026
31967
  constructor(table4, config) {
31027
31968
  if (!config.uniqueName) {
31028
31969
  config.uniqueName = uniqueKeyName3(table4, [config.name]);
@@ -31031,8 +31972,8 @@ var init_common4 = __esm({
31031
31972
  this.table = table4;
31032
31973
  }
31033
31974
  };
31034
- __publicField(MySqlColumn, _a234, "MySqlColumn");
31035
- MySqlColumnBuilderWithAutoIncrement = class extends (_b160 = MySqlColumnBuilder, _a235 = entityKind, _b160) {
31975
+ __publicField(MySqlColumn, _a236, "MySqlColumn");
31976
+ MySqlColumnBuilderWithAutoIncrement = class extends (_b160 = MySqlColumnBuilder, _a237 = entityKind, _b160) {
31036
31977
  constructor(name2, dataType, columnType) {
31037
31978
  super(name2, dataType, columnType);
31038
31979
  this.config.autoIncrement = false;
@@ -31043,14 +31984,14 @@ var init_common4 = __esm({
31043
31984
  return this;
31044
31985
  }
31045
31986
  };
31046
- __publicField(MySqlColumnBuilderWithAutoIncrement, _a235, "MySqlColumnBuilderWithAutoIncrement");
31047
- MySqlColumnWithAutoIncrement = class extends (_b161 = MySqlColumn, _a236 = entityKind, _b161) {
31987
+ __publicField(MySqlColumnBuilderWithAutoIncrement, _a237, "MySqlColumnBuilderWithAutoIncrement");
31988
+ MySqlColumnWithAutoIncrement = class extends (_b161 = MySqlColumn, _a238 = entityKind, _b161) {
31048
31989
  constructor() {
31049
31990
  super(...arguments);
31050
31991
  __publicField(this, "autoIncrement", this.config.autoIncrement);
31051
31992
  }
31052
31993
  };
31053
- __publicField(MySqlColumnWithAutoIncrement, _a236, "MySqlColumnWithAutoIncrement");
31994
+ __publicField(MySqlColumnWithAutoIncrement, _a238, "MySqlColumnWithAutoIncrement");
31054
31995
  }
31055
31996
  });
31056
31997
 
@@ -31062,14 +32003,14 @@ function bigint2(a, b) {
31062
32003
  }
31063
32004
  return new MySqlBigInt64Builder(name2, config.unsigned);
31064
32005
  }
31065
- var _a237, _b162, MySqlBigInt53Builder, _a238, _b163, MySqlBigInt53, _a239, _b164, MySqlBigInt64Builder, _a240, _b165, MySqlBigInt64;
32006
+ var _a239, _b162, MySqlBigInt53Builder, _a240, _b163, MySqlBigInt53, _a241, _b164, MySqlBigInt64Builder, _a242, _b165, MySqlBigInt64;
31066
32007
  var init_bigint2 = __esm({
31067
32008
  "../drizzle-orm/dist/mysql-core/columns/bigint.js"() {
31068
32009
  "use strict";
31069
32010
  init_entity();
31070
32011
  init_utils2();
31071
32012
  init_common4();
31072
- MySqlBigInt53Builder = class extends (_b162 = MySqlColumnBuilderWithAutoIncrement, _a237 = entityKind, _b162) {
32013
+ MySqlBigInt53Builder = class extends (_b162 = MySqlColumnBuilderWithAutoIncrement, _a239 = entityKind, _b162) {
31073
32014
  constructor(name2, unsigned = false) {
31074
32015
  super(name2, "number", "MySqlBigInt53");
31075
32016
  this.config.unsigned = unsigned;
@@ -31082,8 +32023,8 @@ var init_bigint2 = __esm({
31082
32023
  );
31083
32024
  }
31084
32025
  };
31085
- __publicField(MySqlBigInt53Builder, _a237, "MySqlBigInt53Builder");
31086
- MySqlBigInt53 = class extends (_b163 = MySqlColumnWithAutoIncrement, _a238 = entityKind, _b163) {
32026
+ __publicField(MySqlBigInt53Builder, _a239, "MySqlBigInt53Builder");
32027
+ MySqlBigInt53 = class extends (_b163 = MySqlColumnWithAutoIncrement, _a240 = entityKind, _b163) {
31087
32028
  getSQLType() {
31088
32029
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
31089
32030
  }
@@ -31094,8 +32035,8 @@ var init_bigint2 = __esm({
31094
32035
  return Number(value);
31095
32036
  }
31096
32037
  };
31097
- __publicField(MySqlBigInt53, _a238, "MySqlBigInt53");
31098
- MySqlBigInt64Builder = class extends (_b164 = MySqlColumnBuilderWithAutoIncrement, _a239 = entityKind, _b164) {
32038
+ __publicField(MySqlBigInt53, _a240, "MySqlBigInt53");
32039
+ MySqlBigInt64Builder = class extends (_b164 = MySqlColumnBuilderWithAutoIncrement, _a241 = entityKind, _b164) {
31099
32040
  constructor(name2, unsigned = false) {
31100
32041
  super(name2, "bigint", "MySqlBigInt64");
31101
32042
  this.config.unsigned = unsigned;
@@ -31108,8 +32049,8 @@ var init_bigint2 = __esm({
31108
32049
  );
31109
32050
  }
31110
32051
  };
31111
- __publicField(MySqlBigInt64Builder, _a239, "MySqlBigInt64Builder");
31112
- MySqlBigInt64 = class extends (_b165 = MySqlColumnWithAutoIncrement, _a240 = entityKind, _b165) {
32052
+ __publicField(MySqlBigInt64Builder, _a241, "MySqlBigInt64Builder");
32053
+ MySqlBigInt64 = class extends (_b165 = MySqlColumnWithAutoIncrement, _a242 = entityKind, _b165) {
31113
32054
  getSQLType() {
31114
32055
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
31115
32056
  }
@@ -31118,7 +32059,7 @@ var init_bigint2 = __esm({
31118
32059
  return BigInt(value);
31119
32060
  }
31120
32061
  };
31121
- __publicField(MySqlBigInt64, _a240, "MySqlBigInt64");
32062
+ __publicField(MySqlBigInt64, _a242, "MySqlBigInt64");
31122
32063
  }
31123
32064
  });
31124
32065
 
@@ -31127,14 +32068,14 @@ function binary(a, b = {}) {
31127
32068
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31128
32069
  return new MySqlBinaryBuilder(name2, config.length);
31129
32070
  }
31130
- var _a241, _b166, MySqlBinaryBuilder, _a242, _b167, MySqlBinary;
32071
+ var _a243, _b166, MySqlBinaryBuilder, _a244, _b167, MySqlBinary;
31131
32072
  var init_binary = __esm({
31132
32073
  "../drizzle-orm/dist/mysql-core/columns/binary.js"() {
31133
32074
  "use strict";
31134
32075
  init_entity();
31135
32076
  init_utils2();
31136
32077
  init_common4();
31137
- MySqlBinaryBuilder = class extends (_b166 = MySqlColumnBuilder, _a241 = entityKind, _b166) {
32078
+ MySqlBinaryBuilder = class extends (_b166 = MySqlColumnBuilder, _a243 = entityKind, _b166) {
31138
32079
  constructor(name2, length) {
31139
32080
  super(name2, "string", "MySqlBinary");
31140
32081
  this.config.length = length;
@@ -31144,8 +32085,8 @@ var init_binary = __esm({
31144
32085
  return new MySqlBinary(table4, this.config);
31145
32086
  }
31146
32087
  };
31147
- __publicField(MySqlBinaryBuilder, _a241, "MySqlBinaryBuilder");
31148
- MySqlBinary = class extends (_b167 = MySqlColumn, _a242 = entityKind, _b167) {
32088
+ __publicField(MySqlBinaryBuilder, _a243, "MySqlBinaryBuilder");
32089
+ MySqlBinary = class extends (_b167 = MySqlColumn, _a244 = entityKind, _b167) {
31149
32090
  constructor() {
31150
32091
  super(...arguments);
31151
32092
  __publicField(this, "length", this.config.length);
@@ -31154,7 +32095,7 @@ var init_binary = __esm({
31154
32095
  return this.length === void 0 ? `binary` : `binary(${this.length})`;
31155
32096
  }
31156
32097
  };
31157
- __publicField(MySqlBinary, _a242, "MySqlBinary");
32098
+ __publicField(MySqlBinary, _a244, "MySqlBinary");
31158
32099
  }
31159
32100
  });
31160
32101
 
@@ -31162,13 +32103,13 @@ var init_binary = __esm({
31162
32103
  function boolean2(name2) {
31163
32104
  return new MySqlBooleanBuilder(name2 ?? "");
31164
32105
  }
31165
- var _a243, _b168, MySqlBooleanBuilder, _a244, _b169, MySqlBoolean;
32106
+ var _a245, _b168, MySqlBooleanBuilder, _a246, _b169, MySqlBoolean;
31166
32107
  var init_boolean2 = __esm({
31167
32108
  "../drizzle-orm/dist/mysql-core/columns/boolean.js"() {
31168
32109
  "use strict";
31169
32110
  init_entity();
31170
32111
  init_common4();
31171
- MySqlBooleanBuilder = class extends (_b168 = MySqlColumnBuilder, _a243 = entityKind, _b168) {
32112
+ MySqlBooleanBuilder = class extends (_b168 = MySqlColumnBuilder, _a245 = entityKind, _b168) {
31172
32113
  constructor(name2) {
31173
32114
  super(name2, "boolean", "MySqlBoolean");
31174
32115
  }
@@ -31180,8 +32121,8 @@ var init_boolean2 = __esm({
31180
32121
  );
31181
32122
  }
31182
32123
  };
31183
- __publicField(MySqlBooleanBuilder, _a243, "MySqlBooleanBuilder");
31184
- MySqlBoolean = class extends (_b169 = MySqlColumn, _a244 = entityKind, _b169) {
32124
+ __publicField(MySqlBooleanBuilder, _a245, "MySqlBooleanBuilder");
32125
+ MySqlBoolean = class extends (_b169 = MySqlColumn, _a246 = entityKind, _b169) {
31185
32126
  getSQLType() {
31186
32127
  return "boolean";
31187
32128
  }
@@ -31192,7 +32133,7 @@ var init_boolean2 = __esm({
31192
32133
  return value === 1;
31193
32134
  }
31194
32135
  };
31195
- __publicField(MySqlBoolean, _a244, "MySqlBoolean");
32136
+ __publicField(MySqlBoolean, _a246, "MySqlBoolean");
31196
32137
  }
31197
32138
  });
31198
32139
 
@@ -31201,14 +32142,14 @@ function char2(a, b = {}) {
31201
32142
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31202
32143
  return new MySqlCharBuilder(name2, config);
31203
32144
  }
31204
- var _a245, _b170, MySqlCharBuilder, _a246, _b171, MySqlChar;
32145
+ var _a247, _b170, MySqlCharBuilder, _a248, _b171, MySqlChar;
31205
32146
  var init_char2 = __esm({
31206
32147
  "../drizzle-orm/dist/mysql-core/columns/char.js"() {
31207
32148
  "use strict";
31208
32149
  init_entity();
31209
32150
  init_utils2();
31210
32151
  init_common4();
31211
- MySqlCharBuilder = class extends (_b170 = MySqlColumnBuilder, _a245 = entityKind, _b170) {
32152
+ MySqlCharBuilder = class extends (_b170 = MySqlColumnBuilder, _a247 = entityKind, _b170) {
31212
32153
  constructor(name2, config) {
31213
32154
  super(name2, "string", "MySqlChar");
31214
32155
  this.config.length = config.length;
@@ -31222,8 +32163,8 @@ var init_char2 = __esm({
31222
32163
  );
31223
32164
  }
31224
32165
  };
31225
- __publicField(MySqlCharBuilder, _a245, "MySqlCharBuilder");
31226
- MySqlChar = class extends (_b171 = MySqlColumn, _a246 = entityKind, _b171) {
32166
+ __publicField(MySqlCharBuilder, _a247, "MySqlCharBuilder");
32167
+ MySqlChar = class extends (_b171 = MySqlColumn, _a248 = entityKind, _b171) {
31227
32168
  constructor() {
31228
32169
  super(...arguments);
31229
32170
  __publicField(this, "length", this.config.length);
@@ -31233,7 +32174,7 @@ var init_char2 = __esm({
31233
32174
  return this.length === void 0 ? `char` : `char(${this.length})`;
31234
32175
  }
31235
32176
  };
31236
- __publicField(MySqlChar, _a246, "MySqlChar");
32177
+ __publicField(MySqlChar, _a248, "MySqlChar");
31237
32178
  }
31238
32179
  });
31239
32180
 
@@ -31244,14 +32185,14 @@ function customType3(customTypeParams) {
31244
32185
  return new MySqlCustomColumnBuilder(name2, config, customTypeParams);
31245
32186
  };
31246
32187
  }
31247
- var _a247, _b172, MySqlCustomColumnBuilder, _a248, _b173, MySqlCustomColumn;
32188
+ var _a249, _b172, MySqlCustomColumnBuilder, _a250, _b173, MySqlCustomColumn;
31248
32189
  var init_custom3 = __esm({
31249
32190
  "../drizzle-orm/dist/mysql-core/columns/custom.js"() {
31250
32191
  "use strict";
31251
32192
  init_entity();
31252
32193
  init_utils2();
31253
32194
  init_common4();
31254
- MySqlCustomColumnBuilder = class extends (_b172 = MySqlColumnBuilder, _a247 = entityKind, _b172) {
32195
+ MySqlCustomColumnBuilder = class extends (_b172 = MySqlColumnBuilder, _a249 = entityKind, _b172) {
31255
32196
  constructor(name2, fieldConfig, customTypeParams) {
31256
32197
  super(name2, "custom", "MySqlCustomColumn");
31257
32198
  this.config.fieldConfig = fieldConfig;
@@ -31265,8 +32206,8 @@ var init_custom3 = __esm({
31265
32206
  );
31266
32207
  }
31267
32208
  };
31268
- __publicField(MySqlCustomColumnBuilder, _a247, "MySqlCustomColumnBuilder");
31269
- MySqlCustomColumn = class extends (_b173 = MySqlColumn, _a248 = entityKind, _b173) {
32209
+ __publicField(MySqlCustomColumnBuilder, _a249, "MySqlCustomColumnBuilder");
32210
+ MySqlCustomColumn = class extends (_b173 = MySqlColumn, _a250 = entityKind, _b173) {
31270
32211
  constructor(table4, config) {
31271
32212
  super(table4, config);
31272
32213
  __publicField(this, "sqlName");
@@ -31286,7 +32227,7 @@ var init_custom3 = __esm({
31286
32227
  return typeof this.mapTo === "function" ? this.mapTo(value) : value;
31287
32228
  }
31288
32229
  };
31289
- __publicField(MySqlCustomColumn, _a248, "MySqlCustomColumn");
32230
+ __publicField(MySqlCustomColumn, _a250, "MySqlCustomColumn");
31290
32231
  }
31291
32232
  });
31292
32233
 
@@ -31298,14 +32239,14 @@ function date2(a, b) {
31298
32239
  }
31299
32240
  return new MySqlDateBuilder(name2);
31300
32241
  }
31301
- var _a249, _b174, MySqlDateBuilder, _a250, _b175, MySqlDate, _a251, _b176, MySqlDateStringBuilder, _a252, _b177, MySqlDateString;
32242
+ var _a251, _b174, MySqlDateBuilder, _a252, _b175, MySqlDate, _a253, _b176, MySqlDateStringBuilder, _a254, _b177, MySqlDateString;
31302
32243
  var init_date2 = __esm({
31303
32244
  "../drizzle-orm/dist/mysql-core/columns/date.js"() {
31304
32245
  "use strict";
31305
32246
  init_entity();
31306
32247
  init_utils2();
31307
32248
  init_common4();
31308
- MySqlDateBuilder = class extends (_b174 = MySqlColumnBuilder, _a249 = entityKind, _b174) {
32249
+ MySqlDateBuilder = class extends (_b174 = MySqlColumnBuilder, _a251 = entityKind, _b174) {
31309
32250
  constructor(name2) {
31310
32251
  super(name2, "date", "MySqlDate");
31311
32252
  }
@@ -31314,8 +32255,8 @@ var init_date2 = __esm({
31314
32255
  return new MySqlDate(table4, this.config);
31315
32256
  }
31316
32257
  };
31317
- __publicField(MySqlDateBuilder, _a249, "MySqlDateBuilder");
31318
- MySqlDate = class extends (_b175 = MySqlColumn, _a250 = entityKind, _b175) {
32258
+ __publicField(MySqlDateBuilder, _a251, "MySqlDateBuilder");
32259
+ MySqlDate = class extends (_b175 = MySqlColumn, _a252 = entityKind, _b175) {
31319
32260
  constructor(table4, config) {
31320
32261
  super(table4, config);
31321
32262
  }
@@ -31326,8 +32267,8 @@ var init_date2 = __esm({
31326
32267
  return new Date(value);
31327
32268
  }
31328
32269
  };
31329
- __publicField(MySqlDate, _a250, "MySqlDate");
31330
- MySqlDateStringBuilder = class extends (_b176 = MySqlColumnBuilder, _a251 = entityKind, _b176) {
32270
+ __publicField(MySqlDate, _a252, "MySqlDate");
32271
+ MySqlDateStringBuilder = class extends (_b176 = MySqlColumnBuilder, _a253 = entityKind, _b176) {
31331
32272
  constructor(name2) {
31332
32273
  super(name2, "string", "MySqlDateString");
31333
32274
  }
@@ -31339,8 +32280,8 @@ var init_date2 = __esm({
31339
32280
  );
31340
32281
  }
31341
32282
  };
31342
- __publicField(MySqlDateStringBuilder, _a251, "MySqlDateStringBuilder");
31343
- MySqlDateString = class extends (_b177 = MySqlColumn, _a252 = entityKind, _b177) {
32283
+ __publicField(MySqlDateStringBuilder, _a253, "MySqlDateStringBuilder");
32284
+ MySqlDateString = class extends (_b177 = MySqlColumn, _a254 = entityKind, _b177) {
31344
32285
  constructor(table4, config) {
31345
32286
  super(table4, config);
31346
32287
  }
@@ -31348,7 +32289,7 @@ var init_date2 = __esm({
31348
32289
  return `date`;
31349
32290
  }
31350
32291
  };
31351
- __publicField(MySqlDateString, _a252, "MySqlDateString");
32292
+ __publicField(MySqlDateString, _a254, "MySqlDateString");
31352
32293
  }
31353
32294
  });
31354
32295
 
@@ -31360,14 +32301,14 @@ function datetime(a, b) {
31360
32301
  }
31361
32302
  return new MySqlDateTimeBuilder(name2, config);
31362
32303
  }
31363
- var _a253, _b178, MySqlDateTimeBuilder, _a254, _b179, MySqlDateTime, _a255, _b180, MySqlDateTimeStringBuilder, _a256, _b181, MySqlDateTimeString;
32304
+ var _a255, _b178, MySqlDateTimeBuilder, _a256, _b179, MySqlDateTime, _a257, _b180, MySqlDateTimeStringBuilder, _a258, _b181, MySqlDateTimeString;
31364
32305
  var init_datetime = __esm({
31365
32306
  "../drizzle-orm/dist/mysql-core/columns/datetime.js"() {
31366
32307
  "use strict";
31367
32308
  init_entity();
31368
32309
  init_utils2();
31369
32310
  init_common4();
31370
- MySqlDateTimeBuilder = class extends (_b178 = MySqlColumnBuilder, _a253 = entityKind, _b178) {
32311
+ MySqlDateTimeBuilder = class extends (_b178 = MySqlColumnBuilder, _a255 = entityKind, _b178) {
31371
32312
  constructor(name2, config) {
31372
32313
  super(name2, "date", "MySqlDateTime");
31373
32314
  this.config.fsp = config?.fsp;
@@ -31380,8 +32321,8 @@ var init_datetime = __esm({
31380
32321
  );
31381
32322
  }
31382
32323
  };
31383
- __publicField(MySqlDateTimeBuilder, _a253, "MySqlDateTimeBuilder");
31384
- MySqlDateTime = class extends (_b179 = MySqlColumn, _a254 = entityKind, _b179) {
32324
+ __publicField(MySqlDateTimeBuilder, _a255, "MySqlDateTimeBuilder");
32325
+ MySqlDateTime = class extends (_b179 = MySqlColumn, _a256 = entityKind, _b179) {
31385
32326
  constructor(table4, config) {
31386
32327
  super(table4, config);
31387
32328
  __publicField(this, "fsp");
@@ -31398,8 +32339,8 @@ var init_datetime = __esm({
31398
32339
  return /* @__PURE__ */ new Date(value.replace(" ", "T") + "Z");
31399
32340
  }
31400
32341
  };
31401
- __publicField(MySqlDateTime, _a254, "MySqlDateTime");
31402
- MySqlDateTimeStringBuilder = class extends (_b180 = MySqlColumnBuilder, _a255 = entityKind, _b180) {
32342
+ __publicField(MySqlDateTime, _a256, "MySqlDateTime");
32343
+ MySqlDateTimeStringBuilder = class extends (_b180 = MySqlColumnBuilder, _a257 = entityKind, _b180) {
31403
32344
  constructor(name2, config) {
31404
32345
  super(name2, "string", "MySqlDateTimeString");
31405
32346
  this.config.fsp = config?.fsp;
@@ -31412,8 +32353,8 @@ var init_datetime = __esm({
31412
32353
  );
31413
32354
  }
31414
32355
  };
31415
- __publicField(MySqlDateTimeStringBuilder, _a255, "MySqlDateTimeStringBuilder");
31416
- MySqlDateTimeString = class extends (_b181 = MySqlColumn, _a256 = entityKind, _b181) {
32356
+ __publicField(MySqlDateTimeStringBuilder, _a257, "MySqlDateTimeStringBuilder");
32357
+ MySqlDateTimeString = class extends (_b181 = MySqlColumn, _a258 = entityKind, _b181) {
31417
32358
  constructor(table4, config) {
31418
32359
  super(table4, config);
31419
32360
  __publicField(this, "fsp");
@@ -31424,7 +32365,7 @@ var init_datetime = __esm({
31424
32365
  return `datetime${precision}`;
31425
32366
  }
31426
32367
  };
31427
- __publicField(MySqlDateTimeString, _a256, "MySqlDateTimeString");
32368
+ __publicField(MySqlDateTimeString, _a258, "MySqlDateTimeString");
31428
32369
  }
31429
32370
  });
31430
32371
 
@@ -31433,14 +32374,14 @@ function decimal(a, b = {}) {
31433
32374
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31434
32375
  return new MySqlDecimalBuilder(name2, config.precision, config.scale);
31435
32376
  }
31436
- var _a257, _b182, MySqlDecimalBuilder, _a258, _b183, MySqlDecimal;
32377
+ var _a259, _b182, MySqlDecimalBuilder, _a260, _b183, MySqlDecimal;
31437
32378
  var init_decimal = __esm({
31438
32379
  "../drizzle-orm/dist/mysql-core/columns/decimal.js"() {
31439
32380
  "use strict";
31440
32381
  init_entity();
31441
32382
  init_utils2();
31442
32383
  init_common4();
31443
- MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a257 = entityKind, _b182) {
32384
+ MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b182) {
31444
32385
  constructor(name2, precision, scale) {
31445
32386
  super(name2, "string", "MySqlDecimal");
31446
32387
  this.config.precision = precision;
@@ -31454,8 +32395,8 @@ var init_decimal = __esm({
31454
32395
  );
31455
32396
  }
31456
32397
  };
31457
- __publicField(MySqlDecimalBuilder, _a257, "MySqlDecimalBuilder");
31458
- MySqlDecimal = class extends (_b183 = MySqlColumnWithAutoIncrement, _a258 = entityKind, _b183) {
32398
+ __publicField(MySqlDecimalBuilder, _a259, "MySqlDecimalBuilder");
32399
+ MySqlDecimal = class extends (_b183 = MySqlColumnWithAutoIncrement, _a260 = entityKind, _b183) {
31459
32400
  constructor() {
31460
32401
  super(...arguments);
31461
32402
  __publicField(this, "precision", this.config.precision);
@@ -31471,7 +32412,7 @@ var init_decimal = __esm({
31471
32412
  }
31472
32413
  }
31473
32414
  };
31474
- __publicField(MySqlDecimal, _a258, "MySqlDecimal");
32415
+ __publicField(MySqlDecimal, _a260, "MySqlDecimal");
31475
32416
  }
31476
32417
  });
31477
32418
 
@@ -31480,14 +32421,14 @@ function double(a, b) {
31480
32421
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31481
32422
  return new MySqlDoubleBuilder(name2, config);
31482
32423
  }
31483
- var _a259, _b184, MySqlDoubleBuilder, _a260, _b185, MySqlDouble;
32424
+ var _a261, _b184, MySqlDoubleBuilder, _a262, _b185, MySqlDouble;
31484
32425
  var init_double = __esm({
31485
32426
  "../drizzle-orm/dist/mysql-core/columns/double.js"() {
31486
32427
  "use strict";
31487
32428
  init_entity();
31488
32429
  init_utils2();
31489
32430
  init_common4();
31490
- MySqlDoubleBuilder = class extends (_b184 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b184) {
32431
+ MySqlDoubleBuilder = class extends (_b184 = MySqlColumnBuilderWithAutoIncrement, _a261 = entityKind, _b184) {
31491
32432
  constructor(name2, config) {
31492
32433
  super(name2, "number", "MySqlDouble");
31493
32434
  this.config.precision = config?.precision;
@@ -31498,8 +32439,8 @@ var init_double = __esm({
31498
32439
  return new MySqlDouble(table4, this.config);
31499
32440
  }
31500
32441
  };
31501
- __publicField(MySqlDoubleBuilder, _a259, "MySqlDoubleBuilder");
31502
- MySqlDouble = class extends (_b185 = MySqlColumnWithAutoIncrement, _a260 = entityKind, _b185) {
32442
+ __publicField(MySqlDoubleBuilder, _a261, "MySqlDoubleBuilder");
32443
+ MySqlDouble = class extends (_b185 = MySqlColumnWithAutoIncrement, _a262 = entityKind, _b185) {
31503
32444
  constructor() {
31504
32445
  super(...arguments);
31505
32446
  __publicField(this, "precision", this.config.precision);
@@ -31515,7 +32456,7 @@ var init_double = __esm({
31515
32456
  }
31516
32457
  }
31517
32458
  };
31518
- __publicField(MySqlDouble, _a260, "MySqlDouble");
32459
+ __publicField(MySqlDouble, _a262, "MySqlDouble");
31519
32460
  }
31520
32461
  });
31521
32462
 
@@ -31527,14 +32468,14 @@ function mysqlEnum(a, b) {
31527
32468
  }
31528
32469
  return new MySqlEnumColumnBuilder(name2, values);
31529
32470
  }
31530
- var _a261, _b186, MySqlEnumColumnBuilder, _a262, _b187, MySqlEnumColumn;
32471
+ var _a263, _b186, MySqlEnumColumnBuilder, _a264, _b187, MySqlEnumColumn;
31531
32472
  var init_enum2 = __esm({
31532
32473
  "../drizzle-orm/dist/mysql-core/columns/enum.js"() {
31533
32474
  "use strict";
31534
32475
  init_entity();
31535
32476
  init_utils2();
31536
32477
  init_common4();
31537
- MySqlEnumColumnBuilder = class extends (_b186 = MySqlColumnBuilder, _a261 = entityKind, _b186) {
32478
+ MySqlEnumColumnBuilder = class extends (_b186 = MySqlColumnBuilder, _a263 = entityKind, _b186) {
31538
32479
  constructor(name2, values) {
31539
32480
  super(name2, "string", "MySqlEnumColumn");
31540
32481
  this.config.enumValues = values;
@@ -31547,8 +32488,8 @@ var init_enum2 = __esm({
31547
32488
  );
31548
32489
  }
31549
32490
  };
31550
- __publicField(MySqlEnumColumnBuilder, _a261, "MySqlEnumColumnBuilder");
31551
- MySqlEnumColumn = class extends (_b187 = MySqlColumn, _a262 = entityKind, _b187) {
32491
+ __publicField(MySqlEnumColumnBuilder, _a263, "MySqlEnumColumnBuilder");
32492
+ MySqlEnumColumn = class extends (_b187 = MySqlColumn, _a264 = entityKind, _b187) {
31552
32493
  constructor() {
31553
32494
  super(...arguments);
31554
32495
  __publicField(this, "enumValues", this.config.enumValues);
@@ -31557,7 +32498,7 @@ var init_enum2 = __esm({
31557
32498
  return `enum(${this.enumValues.map((value) => `'${value}'`).join(",")})`;
31558
32499
  }
31559
32500
  };
31560
- __publicField(MySqlEnumColumn, _a262, "MySqlEnumColumn");
32501
+ __publicField(MySqlEnumColumn, _a264, "MySqlEnumColumn");
31561
32502
  }
31562
32503
  });
31563
32504
 
@@ -31565,13 +32506,13 @@ var init_enum2 = __esm({
31565
32506
  function float(name2) {
31566
32507
  return new MySqlFloatBuilder(name2 ?? "");
31567
32508
  }
31568
- var _a263, _b188, MySqlFloatBuilder, _a264, _b189, MySqlFloat;
32509
+ var _a265, _b188, MySqlFloatBuilder, _a266, _b189, MySqlFloat;
31569
32510
  var init_float = __esm({
31570
32511
  "../drizzle-orm/dist/mysql-core/columns/float.js"() {
31571
32512
  "use strict";
31572
32513
  init_entity();
31573
32514
  init_common4();
31574
- MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a263 = entityKind, _b188) {
32515
+ MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b188) {
31575
32516
  constructor(name2) {
31576
32517
  super(name2, "number", "MySqlFloat");
31577
32518
  }
@@ -31580,13 +32521,13 @@ var init_float = __esm({
31580
32521
  return new MySqlFloat(table4, this.config);
31581
32522
  }
31582
32523
  };
31583
- __publicField(MySqlFloatBuilder, _a263, "MySqlFloatBuilder");
31584
- MySqlFloat = class extends (_b189 = MySqlColumnWithAutoIncrement, _a264 = entityKind, _b189) {
32524
+ __publicField(MySqlFloatBuilder, _a265, "MySqlFloatBuilder");
32525
+ MySqlFloat = class extends (_b189 = MySqlColumnWithAutoIncrement, _a266 = entityKind, _b189) {
31585
32526
  getSQLType() {
31586
32527
  return "float";
31587
32528
  }
31588
32529
  };
31589
- __publicField(MySqlFloat, _a264, "MySqlFloat");
32530
+ __publicField(MySqlFloat, _a266, "MySqlFloat");
31590
32531
  }
31591
32532
  });
31592
32533
 
@@ -31595,14 +32536,14 @@ function int(a, b) {
31595
32536
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31596
32537
  return new MySqlIntBuilder(name2, config);
31597
32538
  }
31598
- var _a265, _b190, MySqlIntBuilder, _a266, _b191, MySqlInt;
32539
+ var _a267, _b190, MySqlIntBuilder, _a268, _b191, MySqlInt;
31599
32540
  var init_int = __esm({
31600
32541
  "../drizzle-orm/dist/mysql-core/columns/int.js"() {
31601
32542
  "use strict";
31602
32543
  init_entity();
31603
32544
  init_utils2();
31604
32545
  init_common4();
31605
- MySqlIntBuilder = class extends (_b190 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b190) {
32546
+ MySqlIntBuilder = class extends (_b190 = MySqlColumnBuilderWithAutoIncrement, _a267 = entityKind, _b190) {
31606
32547
  constructor(name2, config) {
31607
32548
  super(name2, "number", "MySqlInt");
31608
32549
  this.config.unsigned = config ? config.unsigned : false;
@@ -31612,8 +32553,8 @@ var init_int = __esm({
31612
32553
  return new MySqlInt(table4, this.config);
31613
32554
  }
31614
32555
  };
31615
- __publicField(MySqlIntBuilder, _a265, "MySqlIntBuilder");
31616
- MySqlInt = class extends (_b191 = MySqlColumnWithAutoIncrement, _a266 = entityKind, _b191) {
32556
+ __publicField(MySqlIntBuilder, _a267, "MySqlIntBuilder");
32557
+ MySqlInt = class extends (_b191 = MySqlColumnWithAutoIncrement, _a268 = entityKind, _b191) {
31617
32558
  getSQLType() {
31618
32559
  return `int${this.config.unsigned ? " unsigned" : ""}`;
31619
32560
  }
@@ -31624,7 +32565,7 @@ var init_int = __esm({
31624
32565
  return value;
31625
32566
  }
31626
32567
  };
31627
- __publicField(MySqlInt, _a266, "MySqlInt");
32568
+ __publicField(MySqlInt, _a268, "MySqlInt");
31628
32569
  }
31629
32570
  });
31630
32571
 
@@ -31632,13 +32573,13 @@ var init_int = __esm({
31632
32573
  function json2(name2) {
31633
32574
  return new MySqlJsonBuilder(name2 ?? "");
31634
32575
  }
31635
- var _a267, _b192, MySqlJsonBuilder, _a268, _b193, MySqlJson;
32576
+ var _a269, _b192, MySqlJsonBuilder, _a270, _b193, MySqlJson;
31636
32577
  var init_json2 = __esm({
31637
32578
  "../drizzle-orm/dist/mysql-core/columns/json.js"() {
31638
32579
  "use strict";
31639
32580
  init_entity();
31640
32581
  init_common4();
31641
- MySqlJsonBuilder = class extends (_b192 = MySqlColumnBuilder, _a267 = entityKind, _b192) {
32582
+ MySqlJsonBuilder = class extends (_b192 = MySqlColumnBuilder, _a269 = entityKind, _b192) {
31642
32583
  constructor(name2) {
31643
32584
  super(name2, "json", "MySqlJson");
31644
32585
  }
@@ -31647,8 +32588,8 @@ var init_json2 = __esm({
31647
32588
  return new MySqlJson(table4, this.config);
31648
32589
  }
31649
32590
  };
31650
- __publicField(MySqlJsonBuilder, _a267, "MySqlJsonBuilder");
31651
- MySqlJson = class extends (_b193 = MySqlColumn, _a268 = entityKind, _b193) {
32591
+ __publicField(MySqlJsonBuilder, _a269, "MySqlJsonBuilder");
32592
+ MySqlJson = class extends (_b193 = MySqlColumn, _a270 = entityKind, _b193) {
31652
32593
  getSQLType() {
31653
32594
  return "json";
31654
32595
  }
@@ -31656,7 +32597,7 @@ var init_json2 = __esm({
31656
32597
  return JSON.stringify(value);
31657
32598
  }
31658
32599
  };
31659
- __publicField(MySqlJson, _a268, "MySqlJson");
32600
+ __publicField(MySqlJson, _a270, "MySqlJson");
31660
32601
  }
31661
32602
  });
31662
32603
 
@@ -31665,14 +32606,14 @@ function mediumint(a, b) {
31665
32606
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31666
32607
  return new MySqlMediumIntBuilder(name2, config);
31667
32608
  }
31668
- var _a269, _b194, MySqlMediumIntBuilder, _a270, _b195, MySqlMediumInt;
32609
+ var _a271, _b194, MySqlMediumIntBuilder, _a272, _b195, MySqlMediumInt;
31669
32610
  var init_mediumint = __esm({
31670
32611
  "../drizzle-orm/dist/mysql-core/columns/mediumint.js"() {
31671
32612
  "use strict";
31672
32613
  init_entity();
31673
32614
  init_utils2();
31674
32615
  init_common4();
31675
- MySqlMediumIntBuilder = class extends (_b194 = MySqlColumnBuilderWithAutoIncrement, _a269 = entityKind, _b194) {
32616
+ MySqlMediumIntBuilder = class extends (_b194 = MySqlColumnBuilderWithAutoIncrement, _a271 = entityKind, _b194) {
31676
32617
  constructor(name2, config) {
31677
32618
  super(name2, "number", "MySqlMediumInt");
31678
32619
  this.config.unsigned = config ? config.unsigned : false;
@@ -31685,8 +32626,8 @@ var init_mediumint = __esm({
31685
32626
  );
31686
32627
  }
31687
32628
  };
31688
- __publicField(MySqlMediumIntBuilder, _a269, "MySqlMediumIntBuilder");
31689
- MySqlMediumInt = class extends (_b195 = MySqlColumnWithAutoIncrement, _a270 = entityKind, _b195) {
32629
+ __publicField(MySqlMediumIntBuilder, _a271, "MySqlMediumIntBuilder");
32630
+ MySqlMediumInt = class extends (_b195 = MySqlColumnWithAutoIncrement, _a272 = entityKind, _b195) {
31690
32631
  getSQLType() {
31691
32632
  return `mediumint${this.config.unsigned ? " unsigned" : ""}`;
31692
32633
  }
@@ -31697,7 +32638,7 @@ var init_mediumint = __esm({
31697
32638
  return value;
31698
32639
  }
31699
32640
  };
31700
- __publicField(MySqlMediumInt, _a270, "MySqlMediumInt");
32641
+ __publicField(MySqlMediumInt, _a272, "MySqlMediumInt");
31701
32642
  }
31702
32643
  });
31703
32644
 
@@ -31706,14 +32647,14 @@ function real3(a, b = {}) {
31706
32647
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31707
32648
  return new MySqlRealBuilder(name2, config);
31708
32649
  }
31709
- var _a271, _b196, MySqlRealBuilder, _a272, _b197, MySqlReal;
32650
+ var _a273, _b196, MySqlRealBuilder, _a274, _b197, MySqlReal;
31710
32651
  var init_real3 = __esm({
31711
32652
  "../drizzle-orm/dist/mysql-core/columns/real.js"() {
31712
32653
  "use strict";
31713
32654
  init_entity();
31714
32655
  init_utils2();
31715
32656
  init_common4();
31716
- MySqlRealBuilder = class extends (_b196 = MySqlColumnBuilderWithAutoIncrement, _a271 = entityKind, _b196) {
32657
+ MySqlRealBuilder = class extends (_b196 = MySqlColumnBuilderWithAutoIncrement, _a273 = entityKind, _b196) {
31717
32658
  constructor(name2, config) {
31718
32659
  super(name2, "number", "MySqlReal");
31719
32660
  this.config.precision = config?.precision;
@@ -31724,8 +32665,8 @@ var init_real3 = __esm({
31724
32665
  return new MySqlReal(table4, this.config);
31725
32666
  }
31726
32667
  };
31727
- __publicField(MySqlRealBuilder, _a271, "MySqlRealBuilder");
31728
- MySqlReal = class extends (_b197 = MySqlColumnWithAutoIncrement, _a272 = entityKind, _b197) {
32668
+ __publicField(MySqlRealBuilder, _a273, "MySqlRealBuilder");
32669
+ MySqlReal = class extends (_b197 = MySqlColumnWithAutoIncrement, _a274 = entityKind, _b197) {
31729
32670
  constructor() {
31730
32671
  super(...arguments);
31731
32672
  __publicField(this, "precision", this.config.precision);
@@ -31741,7 +32682,7 @@ var init_real3 = __esm({
31741
32682
  }
31742
32683
  }
31743
32684
  };
31744
- __publicField(MySqlReal, _a272, "MySqlReal");
32685
+ __publicField(MySqlReal, _a274, "MySqlReal");
31745
32686
  }
31746
32687
  });
31747
32688
 
@@ -31749,13 +32690,13 @@ var init_real3 = __esm({
31749
32690
  function serial2(name2) {
31750
32691
  return new MySqlSerialBuilder(name2 ?? "");
31751
32692
  }
31752
- var _a273, _b198, MySqlSerialBuilder, _a274, _b199, MySqlSerial;
32693
+ var _a275, _b198, MySqlSerialBuilder, _a276, _b199, MySqlSerial;
31753
32694
  var init_serial2 = __esm({
31754
32695
  "../drizzle-orm/dist/mysql-core/columns/serial.js"() {
31755
32696
  "use strict";
31756
32697
  init_entity();
31757
32698
  init_common4();
31758
- MySqlSerialBuilder = class extends (_b198 = MySqlColumnBuilderWithAutoIncrement, _a273 = entityKind, _b198) {
32699
+ MySqlSerialBuilder = class extends (_b198 = MySqlColumnBuilderWithAutoIncrement, _a275 = entityKind, _b198) {
31759
32700
  constructor(name2) {
31760
32701
  super(name2, "number", "MySqlSerial");
31761
32702
  this.config.hasDefault = true;
@@ -31766,8 +32707,8 @@ var init_serial2 = __esm({
31766
32707
  return new MySqlSerial(table4, this.config);
31767
32708
  }
31768
32709
  };
31769
- __publicField(MySqlSerialBuilder, _a273, "MySqlSerialBuilder");
31770
- MySqlSerial = class extends (_b199 = MySqlColumnWithAutoIncrement, _a274 = entityKind, _b199) {
32710
+ __publicField(MySqlSerialBuilder, _a275, "MySqlSerialBuilder");
32711
+ MySqlSerial = class extends (_b199 = MySqlColumnWithAutoIncrement, _a276 = entityKind, _b199) {
31771
32712
  getSQLType() {
31772
32713
  return "serial";
31773
32714
  }
@@ -31778,7 +32719,7 @@ var init_serial2 = __esm({
31778
32719
  return value;
31779
32720
  }
31780
32721
  };
31781
- __publicField(MySqlSerial, _a274, "MySqlSerial");
32722
+ __publicField(MySqlSerial, _a276, "MySqlSerial");
31782
32723
  }
31783
32724
  });
31784
32725
 
@@ -31787,14 +32728,14 @@ function smallint2(a, b) {
31787
32728
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31788
32729
  return new MySqlSmallIntBuilder(name2, config);
31789
32730
  }
31790
- var _a275, _b200, MySqlSmallIntBuilder, _a276, _b201, MySqlSmallInt;
32731
+ var _a277, _b200, MySqlSmallIntBuilder, _a278, _b201, MySqlSmallInt;
31791
32732
  var init_smallint2 = __esm({
31792
32733
  "../drizzle-orm/dist/mysql-core/columns/smallint.js"() {
31793
32734
  "use strict";
31794
32735
  init_entity();
31795
32736
  init_utils2();
31796
32737
  init_common4();
31797
- MySqlSmallIntBuilder = class extends (_b200 = MySqlColumnBuilderWithAutoIncrement, _a275 = entityKind, _b200) {
32738
+ MySqlSmallIntBuilder = class extends (_b200 = MySqlColumnBuilderWithAutoIncrement, _a277 = entityKind, _b200) {
31798
32739
  constructor(name2, config) {
31799
32740
  super(name2, "number", "MySqlSmallInt");
31800
32741
  this.config.unsigned = config ? config.unsigned : false;
@@ -31807,8 +32748,8 @@ var init_smallint2 = __esm({
31807
32748
  );
31808
32749
  }
31809
32750
  };
31810
- __publicField(MySqlSmallIntBuilder, _a275, "MySqlSmallIntBuilder");
31811
- MySqlSmallInt = class extends (_b201 = MySqlColumnWithAutoIncrement, _a276 = entityKind, _b201) {
32751
+ __publicField(MySqlSmallIntBuilder, _a277, "MySqlSmallIntBuilder");
32752
+ MySqlSmallInt = class extends (_b201 = MySqlColumnWithAutoIncrement, _a278 = entityKind, _b201) {
31812
32753
  getSQLType() {
31813
32754
  return `smallint${this.config.unsigned ? " unsigned" : ""}`;
31814
32755
  }
@@ -31819,7 +32760,7 @@ var init_smallint2 = __esm({
31819
32760
  return value;
31820
32761
  }
31821
32762
  };
31822
- __publicField(MySqlSmallInt, _a276, "MySqlSmallInt");
32763
+ __publicField(MySqlSmallInt, _a278, "MySqlSmallInt");
31823
32764
  }
31824
32765
  });
31825
32766
 
@@ -31828,14 +32769,14 @@ function text3(a, b = {}) {
31828
32769
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31829
32770
  return new MySqlTextBuilder(name2, "text", config);
31830
32771
  }
31831
- var _a277, _b202, MySqlTextBuilder, _a278, _b203, MySqlText;
32772
+ var _a279, _b202, MySqlTextBuilder, _a280, _b203, MySqlText;
31832
32773
  var init_text3 = __esm({
31833
32774
  "../drizzle-orm/dist/mysql-core/columns/text.js"() {
31834
32775
  "use strict";
31835
32776
  init_entity();
31836
32777
  init_utils2();
31837
32778
  init_common4();
31838
- MySqlTextBuilder = class extends (_b202 = MySqlColumnBuilder, _a277 = entityKind, _b202) {
32779
+ MySqlTextBuilder = class extends (_b202 = MySqlColumnBuilder, _a279 = entityKind, _b202) {
31839
32780
  constructor(name2, textType, config) {
31840
32781
  super(name2, "string", "MySqlText");
31841
32782
  this.config.textType = textType;
@@ -31846,8 +32787,8 @@ var init_text3 = __esm({
31846
32787
  return new MySqlText(table4, this.config);
31847
32788
  }
31848
32789
  };
31849
- __publicField(MySqlTextBuilder, _a277, "MySqlTextBuilder");
31850
- MySqlText = class extends (_b203 = MySqlColumn, _a278 = entityKind, _b203) {
32790
+ __publicField(MySqlTextBuilder, _a279, "MySqlTextBuilder");
32791
+ MySqlText = class extends (_b203 = MySqlColumn, _a280 = entityKind, _b203) {
31851
32792
  constructor() {
31852
32793
  super(...arguments);
31853
32794
  __publicField(this, "textType", this.config.textType);
@@ -31857,7 +32798,7 @@ var init_text3 = __esm({
31857
32798
  return this.textType;
31858
32799
  }
31859
32800
  };
31860
- __publicField(MySqlText, _a278, "MySqlText");
32801
+ __publicField(MySqlText, _a280, "MySqlText");
31861
32802
  }
31862
32803
  });
31863
32804
 
@@ -31866,14 +32807,14 @@ function time2(a, b) {
31866
32807
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31867
32808
  return new MySqlTimeBuilder(name2, config);
31868
32809
  }
31869
- var _a279, _b204, MySqlTimeBuilder, _a280, _b205, MySqlTime;
32810
+ var _a281, _b204, MySqlTimeBuilder, _a282, _b205, MySqlTime;
31870
32811
  var init_time2 = __esm({
31871
32812
  "../drizzle-orm/dist/mysql-core/columns/time.js"() {
31872
32813
  "use strict";
31873
32814
  init_entity();
31874
32815
  init_utils2();
31875
32816
  init_common4();
31876
- MySqlTimeBuilder = class extends (_b204 = MySqlColumnBuilder, _a279 = entityKind, _b204) {
32817
+ MySqlTimeBuilder = class extends (_b204 = MySqlColumnBuilder, _a281 = entityKind, _b204) {
31877
32818
  constructor(name2, config) {
31878
32819
  super(name2, "string", "MySqlTime");
31879
32820
  this.config.fsp = config?.fsp;
@@ -31883,8 +32824,8 @@ var init_time2 = __esm({
31883
32824
  return new MySqlTime(table4, this.config);
31884
32825
  }
31885
32826
  };
31886
- __publicField(MySqlTimeBuilder, _a279, "MySqlTimeBuilder");
31887
- MySqlTime = class extends (_b205 = MySqlColumn, _a280 = entityKind, _b205) {
32827
+ __publicField(MySqlTimeBuilder, _a281, "MySqlTimeBuilder");
32828
+ MySqlTime = class extends (_b205 = MySqlColumn, _a282 = entityKind, _b205) {
31888
32829
  constructor() {
31889
32830
  super(...arguments);
31890
32831
  __publicField(this, "fsp", this.config.fsp);
@@ -31894,19 +32835,19 @@ var init_time2 = __esm({
31894
32835
  return `time${precision}`;
31895
32836
  }
31896
32837
  };
31897
- __publicField(MySqlTime, _a280, "MySqlTime");
32838
+ __publicField(MySqlTime, _a282, "MySqlTime");
31898
32839
  }
31899
32840
  });
31900
32841
 
31901
32842
  // ../drizzle-orm/dist/mysql-core/columns/date.common.js
31902
- var _a281, _b206, MySqlDateColumnBaseBuilder, _a282, _b207, MySqlDateBaseColumn;
32843
+ var _a283, _b206, MySqlDateColumnBaseBuilder, _a284, _b207, MySqlDateBaseColumn;
31903
32844
  var init_date_common2 = __esm({
31904
32845
  "../drizzle-orm/dist/mysql-core/columns/date.common.js"() {
31905
32846
  "use strict";
31906
32847
  init_entity();
31907
32848
  init_sql();
31908
32849
  init_common4();
31909
- MySqlDateColumnBaseBuilder = class extends (_b206 = MySqlColumnBuilder, _a281 = entityKind, _b206) {
32850
+ MySqlDateColumnBaseBuilder = class extends (_b206 = MySqlColumnBuilder, _a283 = entityKind, _b206) {
31910
32851
  defaultNow() {
31911
32852
  return this.default(sql`(now())`);
31912
32853
  }
@@ -31917,14 +32858,14 @@ var init_date_common2 = __esm({
31917
32858
  return this;
31918
32859
  }
31919
32860
  };
31920
- __publicField(MySqlDateColumnBaseBuilder, _a281, "MySqlDateColumnBuilder");
31921
- MySqlDateBaseColumn = class extends (_b207 = MySqlColumn, _a282 = entityKind, _b207) {
32861
+ __publicField(MySqlDateColumnBaseBuilder, _a283, "MySqlDateColumnBuilder");
32862
+ MySqlDateBaseColumn = class extends (_b207 = MySqlColumn, _a284 = entityKind, _b207) {
31922
32863
  constructor() {
31923
32864
  super(...arguments);
31924
32865
  __publicField(this, "hasOnUpdateNow", this.config.hasOnUpdateNow);
31925
32866
  }
31926
32867
  };
31927
- __publicField(MySqlDateBaseColumn, _a282, "MySqlDateColumn");
32868
+ __publicField(MySqlDateBaseColumn, _a284, "MySqlDateColumn");
31928
32869
  }
31929
32870
  });
31930
32871
 
@@ -31936,14 +32877,14 @@ function timestamp2(a, b = {}) {
31936
32877
  }
31937
32878
  return new MySqlTimestampBuilder(name2, config);
31938
32879
  }
31939
- var _a283, _b208, MySqlTimestampBuilder, _a284, _b209, MySqlTimestamp, _a285, _b210, MySqlTimestampStringBuilder, _a286, _b211, MySqlTimestampString;
32880
+ var _a285, _b208, MySqlTimestampBuilder, _a286, _b209, MySqlTimestamp, _a287, _b210, MySqlTimestampStringBuilder, _a288, _b211, MySqlTimestampString;
31940
32881
  var init_timestamp2 = __esm({
31941
32882
  "../drizzle-orm/dist/mysql-core/columns/timestamp.js"() {
31942
32883
  "use strict";
31943
32884
  init_entity();
31944
32885
  init_utils2();
31945
32886
  init_date_common2();
31946
- MySqlTimestampBuilder = class extends (_b208 = MySqlDateColumnBaseBuilder, _a283 = entityKind, _b208) {
32887
+ MySqlTimestampBuilder = class extends (_b208 = MySqlDateColumnBaseBuilder, _a285 = entityKind, _b208) {
31947
32888
  constructor(name2, config) {
31948
32889
  super(name2, "date", "MySqlTimestamp");
31949
32890
  this.config.fsp = config?.fsp;
@@ -31956,8 +32897,8 @@ var init_timestamp2 = __esm({
31956
32897
  );
31957
32898
  }
31958
32899
  };
31959
- __publicField(MySqlTimestampBuilder, _a283, "MySqlTimestampBuilder");
31960
- MySqlTimestamp = class extends (_b209 = MySqlDateBaseColumn, _a284 = entityKind, _b209) {
32900
+ __publicField(MySqlTimestampBuilder, _a285, "MySqlTimestampBuilder");
32901
+ MySqlTimestamp = class extends (_b209 = MySqlDateBaseColumn, _a286 = entityKind, _b209) {
31961
32902
  constructor() {
31962
32903
  super(...arguments);
31963
32904
  __publicField(this, "fsp", this.config.fsp);
@@ -31973,8 +32914,8 @@ var init_timestamp2 = __esm({
31973
32914
  return value.toISOString().slice(0, -1).replace("T", " ");
31974
32915
  }
31975
32916
  };
31976
- __publicField(MySqlTimestamp, _a284, "MySqlTimestamp");
31977
- MySqlTimestampStringBuilder = class extends (_b210 = MySqlDateColumnBaseBuilder, _a285 = entityKind, _b210) {
32917
+ __publicField(MySqlTimestamp, _a286, "MySqlTimestamp");
32918
+ MySqlTimestampStringBuilder = class extends (_b210 = MySqlDateColumnBaseBuilder, _a287 = entityKind, _b210) {
31978
32919
  constructor(name2, config) {
31979
32920
  super(name2, "string", "MySqlTimestampString");
31980
32921
  this.config.fsp = config?.fsp;
@@ -31987,8 +32928,8 @@ var init_timestamp2 = __esm({
31987
32928
  );
31988
32929
  }
31989
32930
  };
31990
- __publicField(MySqlTimestampStringBuilder, _a285, "MySqlTimestampStringBuilder");
31991
- MySqlTimestampString = class extends (_b211 = MySqlDateBaseColumn, _a286 = entityKind, _b211) {
32931
+ __publicField(MySqlTimestampStringBuilder, _a287, "MySqlTimestampStringBuilder");
32932
+ MySqlTimestampString = class extends (_b211 = MySqlDateBaseColumn, _a288 = entityKind, _b211) {
31992
32933
  constructor() {
31993
32934
  super(...arguments);
31994
32935
  __publicField(this, "fsp", this.config.fsp);
@@ -31998,7 +32939,7 @@ var init_timestamp2 = __esm({
31998
32939
  return `timestamp${precision}`;
31999
32940
  }
32000
32941
  };
32001
- __publicField(MySqlTimestampString, _a286, "MySqlTimestampString");
32942
+ __publicField(MySqlTimestampString, _a288, "MySqlTimestampString");
32002
32943
  }
32003
32944
  });
32004
32945
 
@@ -32007,14 +32948,14 @@ function tinyint(a, b) {
32007
32948
  const { name: name2, config } = getColumnNameAndConfig(a, b);
32008
32949
  return new MySqlTinyIntBuilder(name2, config);
32009
32950
  }
32010
- var _a287, _b212, MySqlTinyIntBuilder, _a288, _b213, MySqlTinyInt;
32951
+ var _a289, _b212, MySqlTinyIntBuilder, _a290, _b213, MySqlTinyInt;
32011
32952
  var init_tinyint = __esm({
32012
32953
  "../drizzle-orm/dist/mysql-core/columns/tinyint.js"() {
32013
32954
  "use strict";
32014
32955
  init_entity();
32015
32956
  init_utils2();
32016
32957
  init_common4();
32017
- MySqlTinyIntBuilder = class extends (_b212 = MySqlColumnBuilderWithAutoIncrement, _a287 = entityKind, _b212) {
32958
+ MySqlTinyIntBuilder = class extends (_b212 = MySqlColumnBuilderWithAutoIncrement, _a289 = entityKind, _b212) {
32018
32959
  constructor(name2, config) {
32019
32960
  super(name2, "number", "MySqlTinyInt");
32020
32961
  this.config.unsigned = config ? config.unsigned : false;
@@ -32027,8 +32968,8 @@ var init_tinyint = __esm({
32027
32968
  );
32028
32969
  }
32029
32970
  };
32030
- __publicField(MySqlTinyIntBuilder, _a287, "MySqlTinyIntBuilder");
32031
- MySqlTinyInt = class extends (_b213 = MySqlColumnWithAutoIncrement, _a288 = entityKind, _b213) {
32971
+ __publicField(MySqlTinyIntBuilder, _a289, "MySqlTinyIntBuilder");
32972
+ MySqlTinyInt = class extends (_b213 = MySqlColumnWithAutoIncrement, _a290 = entityKind, _b213) {
32032
32973
  getSQLType() {
32033
32974
  return `tinyint${this.config.unsigned ? " unsigned" : ""}`;
32034
32975
  }
@@ -32039,7 +32980,7 @@ var init_tinyint = __esm({
32039
32980
  return value;
32040
32981
  }
32041
32982
  };
32042
- __publicField(MySqlTinyInt, _a288, "MySqlTinyInt");
32983
+ __publicField(MySqlTinyInt, _a290, "MySqlTinyInt");
32043
32984
  }
32044
32985
  });
32045
32986
 
@@ -32048,14 +32989,14 @@ function varbinary(a, b) {
32048
32989
  const { name: name2, config } = getColumnNameAndConfig(a, b);
32049
32990
  return new MySqlVarBinaryBuilder(name2, config);
32050
32991
  }
32051
- var _a289, _b214, MySqlVarBinaryBuilder, _a290, _b215, MySqlVarBinary;
32992
+ var _a291, _b214, MySqlVarBinaryBuilder, _a292, _b215, MySqlVarBinary;
32052
32993
  var init_varbinary = __esm({
32053
32994
  "../drizzle-orm/dist/mysql-core/columns/varbinary.js"() {
32054
32995
  "use strict";
32055
32996
  init_entity();
32056
32997
  init_utils2();
32057
32998
  init_common4();
32058
- MySqlVarBinaryBuilder = class extends (_b214 = MySqlColumnBuilder, _a289 = entityKind, _b214) {
32999
+ MySqlVarBinaryBuilder = class extends (_b214 = MySqlColumnBuilder, _a291 = entityKind, _b214) {
32059
33000
  /** @internal */
32060
33001
  constructor(name2, config) {
32061
33002
  super(name2, "string", "MySqlVarBinary");
@@ -32069,8 +33010,8 @@ var init_varbinary = __esm({
32069
33010
  );
32070
33011
  }
32071
33012
  };
32072
- __publicField(MySqlVarBinaryBuilder, _a289, "MySqlVarBinaryBuilder");
32073
- MySqlVarBinary = class extends (_b215 = MySqlColumn, _a290 = entityKind, _b215) {
33013
+ __publicField(MySqlVarBinaryBuilder, _a291, "MySqlVarBinaryBuilder");
33014
+ MySqlVarBinary = class extends (_b215 = MySqlColumn, _a292 = entityKind, _b215) {
32074
33015
  constructor() {
32075
33016
  super(...arguments);
32076
33017
  __publicField(this, "length", this.config.length);
@@ -32079,7 +33020,7 @@ var init_varbinary = __esm({
32079
33020
  return this.length === void 0 ? `varbinary` : `varbinary(${this.length})`;
32080
33021
  }
32081
33022
  };
32082
- __publicField(MySqlVarBinary, _a290, "MySqlVarBinary");
33023
+ __publicField(MySqlVarBinary, _a292, "MySqlVarBinary");
32083
33024
  }
32084
33025
  });
32085
33026
 
@@ -32088,14 +33029,14 @@ function varchar2(a, b) {
32088
33029
  const { name: name2, config } = getColumnNameAndConfig(a, b);
32089
33030
  return new MySqlVarCharBuilder(name2, config);
32090
33031
  }
32091
- var _a291, _b216, MySqlVarCharBuilder, _a292, _b217, MySqlVarChar;
33032
+ var _a293, _b216, MySqlVarCharBuilder, _a294, _b217, MySqlVarChar;
32092
33033
  var init_varchar2 = __esm({
32093
33034
  "../drizzle-orm/dist/mysql-core/columns/varchar.js"() {
32094
33035
  "use strict";
32095
33036
  init_entity();
32096
33037
  init_utils2();
32097
33038
  init_common4();
32098
- MySqlVarCharBuilder = class extends (_b216 = MySqlColumnBuilder, _a291 = entityKind, _b216) {
33039
+ MySqlVarCharBuilder = class extends (_b216 = MySqlColumnBuilder, _a293 = entityKind, _b216) {
32099
33040
  /** @internal */
32100
33041
  constructor(name2, config) {
32101
33042
  super(name2, "string", "MySqlVarChar");
@@ -32110,8 +33051,8 @@ var init_varchar2 = __esm({
32110
33051
  );
32111
33052
  }
32112
33053
  };
32113
- __publicField(MySqlVarCharBuilder, _a291, "MySqlVarCharBuilder");
32114
- MySqlVarChar = class extends (_b217 = MySqlColumn, _a292 = entityKind, _b217) {
33054
+ __publicField(MySqlVarCharBuilder, _a293, "MySqlVarCharBuilder");
33055
+ MySqlVarChar = class extends (_b217 = MySqlColumn, _a294 = entityKind, _b217) {
32115
33056
  constructor() {
32116
33057
  super(...arguments);
32117
33058
  __publicField(this, "length", this.config.length);
@@ -32121,7 +33062,7 @@ var init_varchar2 = __esm({
32121
33062
  return this.length === void 0 ? `varchar` : `varchar(${this.length})`;
32122
33063
  }
32123
33064
  };
32124
- __publicField(MySqlVarChar, _a292, "MySqlVarChar");
33065
+ __publicField(MySqlVarChar, _a294, "MySqlVarChar");
32125
33066
  }
32126
33067
  });
32127
33068
 
@@ -32129,13 +33070,13 @@ var init_varchar2 = __esm({
32129
33070
  function year(name2) {
32130
33071
  return new MySqlYearBuilder(name2 ?? "");
32131
33072
  }
32132
- var _a293, _b218, MySqlYearBuilder, _a294, _b219, MySqlYear;
33073
+ var _a295, _b218, MySqlYearBuilder, _a296, _b219, MySqlYear;
32133
33074
  var init_year = __esm({
32134
33075
  "../drizzle-orm/dist/mysql-core/columns/year.js"() {
32135
33076
  "use strict";
32136
33077
  init_entity();
32137
33078
  init_common4();
32138
- MySqlYearBuilder = class extends (_b218 = MySqlColumnBuilder, _a293 = entityKind, _b218) {
33079
+ MySqlYearBuilder = class extends (_b218 = MySqlColumnBuilder, _a295 = entityKind, _b218) {
32139
33080
  constructor(name2) {
32140
33081
  super(name2, "number", "MySqlYear");
32141
33082
  }
@@ -32144,13 +33085,13 @@ var init_year = __esm({
32144
33085
  return new MySqlYear(table4, this.config);
32145
33086
  }
32146
33087
  };
32147
- __publicField(MySqlYearBuilder, _a293, "MySqlYearBuilder");
32148
- MySqlYear = class extends (_b219 = MySqlColumn, _a294 = entityKind, _b219) {
33088
+ __publicField(MySqlYearBuilder, _a295, "MySqlYearBuilder");
33089
+ MySqlYear = class extends (_b219 = MySqlColumn, _a296 = entityKind, _b219) {
32149
33090
  getSQLType() {
32150
33091
  return `year`;
32151
33092
  }
32152
33093
  };
32153
- __publicField(MySqlYear, _a294, "MySqlYear");
33094
+ __publicField(MySqlYear, _a296, "MySqlYear");
32154
33095
  }
32155
33096
  });
32156
33097
 
@@ -32187,17 +33128,17 @@ var init_columns3 = __esm({
32187
33128
  });
32188
33129
 
32189
33130
  // ../drizzle-orm/dist/mysql-core/query-builders/count.js
32190
- var _a295, _b220, _c9, _MySqlCountBuilder, MySqlCountBuilder;
33131
+ var _a297, _b220, _c9, _MySqlCountBuilder, MySqlCountBuilder;
32191
33132
  var init_count3 = __esm({
32192
33133
  "../drizzle-orm/dist/mysql-core/query-builders/count.js"() {
32193
33134
  "use strict";
32194
33135
  init_entity();
32195
33136
  init_sql();
32196
- _MySqlCountBuilder = class _MySqlCountBuilder extends (_c9 = SQL, _b220 = entityKind, _a295 = Symbol.toStringTag, _c9) {
33137
+ _MySqlCountBuilder = class _MySqlCountBuilder extends (_c9 = SQL, _b220 = entityKind, _a297 = Symbol.toStringTag, _c9) {
32197
33138
  constructor(params) {
32198
33139
  super(_MySqlCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
32199
33140
  __publicField(this, "sql");
32200
- __publicField(this, _a295, "MySqlCountBuilder");
33141
+ __publicField(this, _a297, "MySqlCountBuilder");
32201
33142
  __publicField(this, "session");
32202
33143
  this.params = params;
32203
33144
  this.mapWith(Number);
@@ -32241,13 +33182,13 @@ var init_count3 = __esm({
32241
33182
  });
32242
33183
 
32243
33184
  // ../drizzle-orm/dist/mysql-core/query-builders/delete.js
32244
- var _a296, _b221, MySqlDeleteBase;
33185
+ var _a298, _b221, MySqlDeleteBase;
32245
33186
  var init_delete3 = __esm({
32246
33187
  "../drizzle-orm/dist/mysql-core/query-builders/delete.js"() {
32247
33188
  "use strict";
32248
33189
  init_entity();
32249
33190
  init_query_promise();
32250
- MySqlDeleteBase = class extends (_b221 = QueryPromise, _a296 = entityKind, _b221) {
33191
+ MySqlDeleteBase = class extends (_b221 = QueryPromise, _a298 = entityKind, _b221) {
32251
33192
  constructor(table4, session, dialect4, withList) {
32252
33193
  super();
32253
33194
  __publicField(this, "config");
@@ -32317,12 +33258,12 @@ var init_delete3 = __esm({
32317
33258
  return this;
32318
33259
  }
32319
33260
  };
32320
- __publicField(MySqlDeleteBase, _a296, "MySqlDelete");
33261
+ __publicField(MySqlDeleteBase, _a298, "MySqlDelete");
32321
33262
  }
32322
33263
  });
32323
33264
 
32324
33265
  // ../drizzle-orm/dist/mysql-core/query-builders/insert.js
32325
- var _a297, MySqlInsertBuilder, _a298, _b222, MySqlInsertBase;
33266
+ var _a299, MySqlInsertBuilder, _a300, _b222, MySqlInsertBase;
32326
33267
  var init_insert3 = __esm({
32327
33268
  "../drizzle-orm/dist/mysql-core/query-builders/insert.js"() {
32328
33269
  "use strict";
@@ -32331,7 +33272,7 @@ var init_insert3 = __esm({
32331
33272
  init_sql();
32332
33273
  init_table();
32333
33274
  init_utils2();
32334
- _a297 = entityKind;
33275
+ _a299 = entityKind;
32335
33276
  MySqlInsertBuilder = class {
32336
33277
  constructor(table4, session, dialect4) {
32337
33278
  __publicField(this, "shouldIgnore", false);
@@ -32360,8 +33301,8 @@ var init_insert3 = __esm({
32360
33301
  return new MySqlInsertBase(this.table, mappedValues, this.shouldIgnore, this.session, this.dialect);
32361
33302
  }
32362
33303
  };
32363
- __publicField(MySqlInsertBuilder, _a297, "MySqlInsertBuilder");
32364
- MySqlInsertBase = class extends (_b222 = QueryPromise, _a298 = entityKind, _b222) {
33304
+ __publicField(MySqlInsertBuilder, _a299, "MySqlInsertBuilder");
33305
+ MySqlInsertBase = class extends (_b222 = QueryPromise, _a300 = entityKind, _b222) {
32365
33306
  constructor(table4, values, ignore, session, dialect4) {
32366
33307
  super();
32367
33308
  __publicField(this, "config");
@@ -32442,7 +33383,7 @@ var init_insert3 = __esm({
32442
33383
  return this;
32443
33384
  }
32444
33385
  };
32445
- __publicField(MySqlInsertBase, _a298, "MySqlInsert");
33386
+ __publicField(MySqlInsertBase, _a300, "MySqlInsert");
32446
33387
  }
32447
33388
  });
32448
33389
 
@@ -32526,7 +33467,7 @@ function mysqlTableWithSchema(name2, columns, extraConfig, schema4, baseName = n
32526
33467
  }
32527
33468
  return table4;
32528
33469
  }
32529
- var InlineForeignKeys3, _a299, _b223, _c10, _d4, _e3, MySqlTable, mysqlTable;
33470
+ var InlineForeignKeys3, _a301, _b223, _c10, _d4, _e3, MySqlTable, mysqlTable;
32530
33471
  var init_table4 = __esm({
32531
33472
  "../drizzle-orm/dist/mysql-core/table.js"() {
32532
33473
  "use strict";
@@ -32534,7 +33475,7 @@ var init_table4 = __esm({
32534
33475
  init_table();
32535
33476
  init_all3();
32536
33477
  InlineForeignKeys3 = Symbol.for("drizzle:MySqlInlineForeignKeys");
32537
- MySqlTable = class extends (_e3 = Table, _d4 = entityKind, _c10 = Table.Symbol.Columns, _b223 = InlineForeignKeys3, _a299 = Table.Symbol.ExtraConfigBuilder, _e3) {
33478
+ MySqlTable = class extends (_e3 = Table, _d4 = entityKind, _c10 = Table.Symbol.Columns, _b223 = InlineForeignKeys3, _a301 = Table.Symbol.ExtraConfigBuilder, _e3) {
32538
33479
  constructor() {
32539
33480
  super(...arguments);
32540
33481
  /** @internal */
@@ -32542,7 +33483,7 @@ var init_table4 = __esm({
32542
33483
  /** @internal */
32543
33484
  __publicField(this, _b223, []);
32544
33485
  /** @internal */
32545
- __publicField(this, _a299);
33486
+ __publicField(this, _a301);
32546
33487
  }
32547
33488
  };
32548
33489
  __publicField(MySqlTable, _d4, "MySqlTable");
@@ -32557,20 +33498,20 @@ var init_table4 = __esm({
32557
33498
  });
32558
33499
 
32559
33500
  // ../drizzle-orm/dist/mysql-core/view-base.js
32560
- var _a300, _b224, MySqlViewBase;
33501
+ var _a302, _b224, MySqlViewBase;
32561
33502
  var init_view_base3 = __esm({
32562
33503
  "../drizzle-orm/dist/mysql-core/view-base.js"() {
32563
33504
  "use strict";
32564
33505
  init_entity();
32565
33506
  init_sql();
32566
- MySqlViewBase = class extends (_b224 = View, _a300 = entityKind, _b224) {
33507
+ MySqlViewBase = class extends (_b224 = View, _a302 = entityKind, _b224) {
32567
33508
  };
32568
- __publicField(MySqlViewBase, _a300, "MySqlViewBase");
33509
+ __publicField(MySqlViewBase, _a302, "MySqlViewBase");
32569
33510
  }
32570
33511
  });
32571
33512
 
32572
33513
  // ../drizzle-orm/dist/mysql-core/dialect.js
32573
- var _a301, MySqlDialect;
33514
+ var _a303, MySqlDialect;
32574
33515
  var init_dialect3 = __esm({
32575
33516
  "../drizzle-orm/dist/mysql-core/dialect.js"() {
32576
33517
  "use strict";
@@ -32589,7 +33530,7 @@ var init_dialect3 = __esm({
32589
33530
  init_common4();
32590
33531
  init_table4();
32591
33532
  init_view_base3();
32592
- _a301 = entityKind;
33533
+ _a303 = entityKind;
32593
33534
  MySqlDialect = class {
32594
33535
  constructor(config) {
32595
33536
  /** @internal */
@@ -33371,7 +34312,7 @@ var init_dialect3 = __esm({
33371
34312
  };
33372
34313
  }
33373
34314
  };
33374
- __publicField(MySqlDialect, _a301, "MySqlDialect");
34315
+ __publicField(MySqlDialect, _a303, "MySqlDialect");
33375
34316
  }
33376
34317
  });
33377
34318
 
@@ -33393,7 +34334,7 @@ function createSetOperator3(type, isAll) {
33393
34334
  return leftSelect.addSetOperators(setOperators);
33394
34335
  };
33395
34336
  }
33396
- var _a302, MySqlSelectBuilder, _a303, _b225, MySqlSelectQueryBuilderBase, _a304, _b226, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
34337
+ var _a304, MySqlSelectBuilder, _a305, _b225, MySqlSelectQueryBuilderBase, _a306, _b226, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
33397
34338
  var init_select4 = __esm({
33398
34339
  "../drizzle-orm/dist/mysql-core/query-builders/select.js"() {
33399
34340
  "use strict";
@@ -33408,7 +34349,7 @@ var init_select4 = __esm({
33408
34349
  init_utils2();
33409
34350
  init_view_common();
33410
34351
  init_view_base3();
33411
- _a302 = entityKind;
34352
+ _a304 = entityKind;
33412
34353
  MySqlSelectBuilder = class {
33413
34354
  constructor(config) {
33414
34355
  __publicField(this, "fields");
@@ -33453,8 +34394,8 @@ var init_select4 = __esm({
33453
34394
  );
33454
34395
  }
33455
34396
  };
33456
- __publicField(MySqlSelectBuilder, _a302, "MySqlSelectBuilder");
33457
- MySqlSelectQueryBuilderBase = class extends (_b225 = TypedQueryBuilder, _a303 = entityKind, _b225) {
34397
+ __publicField(MySqlSelectBuilder, _a304, "MySqlSelectBuilder");
34398
+ MySqlSelectQueryBuilderBase = class extends (_b225 = TypedQueryBuilder, _a305 = entityKind, _b225) {
33458
34399
  constructor({ table: table4, fields, isPartialSelect, session, dialect: dialect4, withList, distinct }) {
33459
34400
  super();
33460
34401
  __publicField(this, "_");
@@ -34055,8 +34996,8 @@ var init_select4 = __esm({
34055
34996
  return this;
34056
34997
  }
34057
34998
  };
34058
- __publicField(MySqlSelectQueryBuilderBase, _a303, "MySqlSelectQueryBuilder");
34059
- MySqlSelectBase = class extends (_b226 = MySqlSelectQueryBuilderBase, _a304 = entityKind, _b226) {
34999
+ __publicField(MySqlSelectQueryBuilderBase, _a305, "MySqlSelectQueryBuilder");
35000
+ MySqlSelectBase = class extends (_b226 = MySqlSelectQueryBuilderBase, _a306 = entityKind, _b226) {
34060
35001
  constructor() {
34061
35002
  super(...arguments);
34062
35003
  __publicField(this, "execute", (placeholderValues) => {
@@ -34080,7 +35021,7 @@ var init_select4 = __esm({
34080
35021
  return query;
34081
35022
  }
34082
35023
  };
34083
- __publicField(MySqlSelectBase, _a304, "MySqlSelect");
35024
+ __publicField(MySqlSelectBase, _a306, "MySqlSelect");
34084
35025
  applyMixins(MySqlSelectBase, [QueryPromise]);
34085
35026
  getMySqlSetOperators = () => ({
34086
35027
  union: union3,
@@ -34100,7 +35041,7 @@ var init_select4 = __esm({
34100
35041
  });
34101
35042
 
34102
35043
  // ../drizzle-orm/dist/mysql-core/query-builders/query-builder.js
34103
- var _a305, QueryBuilder3;
35044
+ var _a307, QueryBuilder3;
34104
35045
  var init_query_builder4 = __esm({
34105
35046
  "../drizzle-orm/dist/mysql-core/query-builders/query-builder.js"() {
34106
35047
  "use strict";
@@ -34109,7 +35050,7 @@ var init_query_builder4 = __esm({
34109
35050
  init_selection_proxy();
34110
35051
  init_subquery();
34111
35052
  init_select4();
34112
- _a305 = entityKind;
35053
+ _a307 = entityKind;
34113
35054
  QueryBuilder3 = class {
34114
35055
  constructor(dialect4) {
34115
35056
  __publicField(this, "dialect");
@@ -34171,7 +35112,7 @@ var init_query_builder4 = __esm({
34171
35112
  return this.dialect;
34172
35113
  }
34173
35114
  };
34174
- __publicField(QueryBuilder3, _a305, "MySqlQueryBuilder");
35115
+ __publicField(QueryBuilder3, _a307, "MySqlQueryBuilder");
34175
35116
  }
34176
35117
  });
34177
35118
 
@@ -34183,14 +35124,14 @@ var init_select_types3 = __esm({
34183
35124
  });
34184
35125
 
34185
35126
  // ../drizzle-orm/dist/mysql-core/query-builders/update.js
34186
- var _a306, MySqlUpdateBuilder, _a307, _b227, MySqlUpdateBase;
35127
+ var _a308, MySqlUpdateBuilder, _a309, _b227, MySqlUpdateBase;
34187
35128
  var init_update3 = __esm({
34188
35129
  "../drizzle-orm/dist/mysql-core/query-builders/update.js"() {
34189
35130
  "use strict";
34190
35131
  init_entity();
34191
35132
  init_query_promise();
34192
35133
  init_utils2();
34193
- _a306 = entityKind;
35134
+ _a308 = entityKind;
34194
35135
  MySqlUpdateBuilder = class {
34195
35136
  constructor(table4, session, dialect4, withList) {
34196
35137
  this.table = table4;
@@ -34202,8 +35143,8 @@ var init_update3 = __esm({
34202
35143
  return new MySqlUpdateBase(this.table, mapUpdateSet(this.table, values), this.session, this.dialect, this.withList);
34203
35144
  }
34204
35145
  };
34205
- __publicField(MySqlUpdateBuilder, _a306, "MySqlUpdateBuilder");
34206
- MySqlUpdateBase = class extends (_b227 = QueryPromise, _a307 = entityKind, _b227) {
35146
+ __publicField(MySqlUpdateBuilder, _a308, "MySqlUpdateBuilder");
35147
+ MySqlUpdateBase = class extends (_b227 = QueryPromise, _a309 = entityKind, _b227) {
34207
35148
  constructor(table4, set, session, dialect4, withList) {
34208
35149
  super();
34209
35150
  __publicField(this, "config");
@@ -34276,7 +35217,7 @@ var init_update3 = __esm({
34276
35217
  return this;
34277
35218
  }
34278
35219
  };
34279
- __publicField(MySqlUpdateBase, _a307, "MySqlUpdate");
35220
+ __publicField(MySqlUpdateBase, _a309, "MySqlUpdate");
34280
35221
  }
34281
35222
  });
34282
35223
 
@@ -34294,14 +35235,14 @@ var init_query_builders3 = __esm({
34294
35235
  });
34295
35236
 
34296
35237
  // ../drizzle-orm/dist/mysql-core/query-builders/query.js
34297
- var _a308, RelationalQueryBuilder3, _a309, _b228, MySqlRelationalQuery;
35238
+ var _a310, RelationalQueryBuilder3, _a311, _b228, MySqlRelationalQuery;
34298
35239
  var init_query3 = __esm({
34299
35240
  "../drizzle-orm/dist/mysql-core/query-builders/query.js"() {
34300
35241
  "use strict";
34301
35242
  init_entity();
34302
35243
  init_query_promise();
34303
35244
  init_relations();
34304
- _a308 = entityKind;
35245
+ _a310 = entityKind;
34305
35246
  RelationalQueryBuilder3 = class {
34306
35247
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, mode) {
34307
35248
  this.fullSchema = fullSchema;
@@ -34342,8 +35283,8 @@ var init_query3 = __esm({
34342
35283
  );
34343
35284
  }
34344
35285
  };
34345
- __publicField(RelationalQueryBuilder3, _a308, "MySqlRelationalQueryBuilder");
34346
- MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a309 = entityKind, _b228) {
35286
+ __publicField(RelationalQueryBuilder3, _a310, "MySqlRelationalQueryBuilder");
35287
+ MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a311 = entityKind, _b228) {
34347
35288
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, config, queryMode, mode) {
34348
35289
  super();
34349
35290
  this.fullSchema = fullSchema;
@@ -34407,12 +35348,12 @@ var init_query3 = __esm({
34407
35348
  return this.prepare().execute();
34408
35349
  }
34409
35350
  };
34410
- __publicField(MySqlRelationalQuery, _a309, "MySqlRelationalQuery");
35351
+ __publicField(MySqlRelationalQuery, _a311, "MySqlRelationalQuery");
34411
35352
  }
34412
35353
  });
34413
35354
 
34414
35355
  // ../drizzle-orm/dist/mysql-core/db.js
34415
- var _a310, MySqlDatabase;
35356
+ var _a312, MySqlDatabase;
34416
35357
  var init_db3 = __esm({
34417
35358
  "../drizzle-orm/dist/mysql-core/db.js"() {
34418
35359
  "use strict";
@@ -34423,7 +35364,7 @@ var init_db3 = __esm({
34423
35364
  init_count3();
34424
35365
  init_query_builders3();
34425
35366
  init_query3();
34426
- _a310 = entityKind;
35367
+ _a312 = entityKind;
34427
35368
  MySqlDatabase = class {
34428
35369
  constructor(dialect4, session, schema4, mode) {
34429
35370
  __publicField(this, "query");
@@ -34636,17 +35577,17 @@ var init_db3 = __esm({
34636
35577
  return this.session.transaction(transaction, config);
34637
35578
  }
34638
35579
  };
34639
- __publicField(MySqlDatabase, _a310, "MySqlDatabase");
35580
+ __publicField(MySqlDatabase, _a312, "MySqlDatabase");
34640
35581
  }
34641
35582
  });
34642
35583
 
34643
35584
  // ../drizzle-orm/dist/mysql-core/indexes.js
34644
- var _a311, IndexBuilderOn3, _a312, IndexBuilder3, _a313, Index5;
35585
+ var _a313, IndexBuilderOn3, _a314, IndexBuilder3, _a315, Index5;
34645
35586
  var init_indexes3 = __esm({
34646
35587
  "../drizzle-orm/dist/mysql-core/indexes.js"() {
34647
35588
  "use strict";
34648
35589
  init_entity();
34649
- _a311 = entityKind;
35590
+ _a313 = entityKind;
34650
35591
  IndexBuilderOn3 = class {
34651
35592
  constructor(name2, unique) {
34652
35593
  this.name = name2;
@@ -34656,8 +35597,8 @@ var init_indexes3 = __esm({
34656
35597
  return new IndexBuilder3(this.name, columns, this.unique);
34657
35598
  }
34658
35599
  };
34659
- __publicField(IndexBuilderOn3, _a311, "MySqlIndexBuilderOn");
34660
- _a312 = entityKind;
35600
+ __publicField(IndexBuilderOn3, _a313, "MySqlIndexBuilderOn");
35601
+ _a314 = entityKind;
34661
35602
  IndexBuilder3 = class {
34662
35603
  constructor(name2, columns, unique) {
34663
35604
  /** @internal */
@@ -34685,26 +35626,26 @@ var init_indexes3 = __esm({
34685
35626
  return new Index5(this.config, table4);
34686
35627
  }
34687
35628
  };
34688
- __publicField(IndexBuilder3, _a312, "MySqlIndexBuilder");
34689
- _a313 = entityKind;
35629
+ __publicField(IndexBuilder3, _a314, "MySqlIndexBuilder");
35630
+ _a315 = entityKind;
34690
35631
  Index5 = class {
34691
35632
  constructor(config, table4) {
34692
35633
  __publicField(this, "config");
34693
35634
  this.config = { ...config, table: table4 };
34694
35635
  }
34695
35636
  };
34696
- __publicField(Index5, _a313, "MySqlIndex");
35637
+ __publicField(Index5, _a315, "MySqlIndex");
34697
35638
  }
34698
35639
  });
34699
35640
 
34700
35641
  // ../drizzle-orm/dist/mysql-core/primary-keys.js
34701
- var _a314, PrimaryKeyBuilder3, _a315, PrimaryKey3;
35642
+ var _a316, PrimaryKeyBuilder3, _a317, PrimaryKey3;
34702
35643
  var init_primary_keys3 = __esm({
34703
35644
  "../drizzle-orm/dist/mysql-core/primary-keys.js"() {
34704
35645
  "use strict";
34705
35646
  init_entity();
34706
35647
  init_table4();
34707
- _a314 = entityKind;
35648
+ _a316 = entityKind;
34708
35649
  PrimaryKeyBuilder3 = class {
34709
35650
  constructor(columns, name2) {
34710
35651
  /** @internal */
@@ -34719,8 +35660,8 @@ var init_primary_keys3 = __esm({
34719
35660
  return new PrimaryKey3(table4, this.columns, this.name);
34720
35661
  }
34721
35662
  };
34722
- __publicField(PrimaryKeyBuilder3, _a314, "MySqlPrimaryKeyBuilder");
34723
- _a315 = entityKind;
35663
+ __publicField(PrimaryKeyBuilder3, _a316, "MySqlPrimaryKeyBuilder");
35664
+ _a317 = entityKind;
34724
35665
  PrimaryKey3 = class {
34725
35666
  constructor(table4, columns, name2) {
34726
35667
  __publicField(this, "columns");
@@ -34733,7 +35674,7 @@ var init_primary_keys3 = __esm({
34733
35674
  return this.name ?? `${this.table[MySqlTable.Symbol.Name]}_${this.columns.map((column4) => column4.name).join("_")}_pk`;
34734
35675
  }
34735
35676
  };
34736
- __publicField(PrimaryKey3, _a315, "MySqlPrimaryKey");
35677
+ __publicField(PrimaryKey3, _a317, "MySqlPrimaryKey");
34737
35678
  }
34738
35679
  });
34739
35680
 
@@ -34753,7 +35694,7 @@ function mysqlViewWithSchema(name2, selection, schema4) {
34753
35694
  }
34754
35695
  return new ViewBuilder3(name2, schema4);
34755
35696
  }
34756
- var _a316, ViewBuilderCore2, _a317, _b229, ViewBuilder3, _a318, _b230, ManualViewBuilder3, _a319, _b231, _c11, MySqlView;
35697
+ var _a318, ViewBuilderCore2, _a319, _b229, ViewBuilder3, _a320, _b230, ManualViewBuilder3, _a321, _b231, _c11, MySqlView;
34757
35698
  var init_view3 = __esm({
34758
35699
  "../drizzle-orm/dist/mysql-core/view.js"() {
34759
35700
  "use strict";
@@ -34764,7 +35705,7 @@ var init_view3 = __esm({
34764
35705
  init_table4();
34765
35706
  init_view_base3();
34766
35707
  init_view_common4();
34767
- _a316 = entityKind;
35708
+ _a318 = entityKind;
34768
35709
  ViewBuilderCore2 = class {
34769
35710
  constructor(name2, schema4) {
34770
35711
  __publicField(this, "config", {});
@@ -34788,8 +35729,8 @@ var init_view3 = __esm({
34788
35729
  return this;
34789
35730
  }
34790
35731
  };
34791
- __publicField(ViewBuilderCore2, _a316, "MySqlViewBuilder");
34792
- ViewBuilder3 = class extends (_b229 = ViewBuilderCore2, _a317 = entityKind, _b229) {
35732
+ __publicField(ViewBuilderCore2, _a318, "MySqlViewBuilder");
35733
+ ViewBuilder3 = class extends (_b229 = ViewBuilderCore2, _a319 = entityKind, _b229) {
34793
35734
  as(qb) {
34794
35735
  if (typeof qb === "function") {
34795
35736
  qb = qb(new QueryBuilder3());
@@ -34815,8 +35756,8 @@ var init_view3 = __esm({
34815
35756
  );
34816
35757
  }
34817
35758
  };
34818
- __publicField(ViewBuilder3, _a317, "MySqlViewBuilder");
34819
- ManualViewBuilder3 = class extends (_b230 = ViewBuilderCore2, _a318 = entityKind, _b230) {
35759
+ __publicField(ViewBuilder3, _a319, "MySqlViewBuilder");
35760
+ ManualViewBuilder3 = class extends (_b230 = ViewBuilderCore2, _a320 = entityKind, _b230) {
34820
35761
  constructor(name2, columns, schema4) {
34821
35762
  super(name2, schema4);
34822
35763
  __publicField(this, "columns");
@@ -34861,11 +35802,11 @@ var init_view3 = __esm({
34861
35802
  );
34862
35803
  }
34863
35804
  };
34864
- __publicField(ManualViewBuilder3, _a318, "MySqlManualViewBuilder");
34865
- MySqlView = class extends (_c11 = MySqlViewBase, _b231 = entityKind, _a319 = MySqlViewConfig, _c11) {
35805
+ __publicField(ManualViewBuilder3, _a320, "MySqlManualViewBuilder");
35806
+ MySqlView = class extends (_c11 = MySqlViewBase, _b231 = entityKind, _a321 = MySqlViewConfig, _c11) {
34866
35807
  constructor({ mysqlConfig, config }) {
34867
35808
  super(config);
34868
- __publicField(this, _a319);
35809
+ __publicField(this, _a321);
34869
35810
  this[MySqlViewConfig] = mysqlConfig;
34870
35811
  }
34871
35812
  };
@@ -34874,14 +35815,14 @@ var init_view3 = __esm({
34874
35815
  });
34875
35816
 
34876
35817
  // ../drizzle-orm/dist/mysql-core/schema.js
34877
- var _a320, MySqlSchema5;
35818
+ var _a322, MySqlSchema5;
34878
35819
  var init_schema2 = __esm({
34879
35820
  "../drizzle-orm/dist/mysql-core/schema.js"() {
34880
35821
  "use strict";
34881
35822
  init_entity();
34882
35823
  init_table4();
34883
35824
  init_view3();
34884
- _a320 = entityKind;
35825
+ _a322 = entityKind;
34885
35826
  MySqlSchema5 = class {
34886
35827
  constructor(schemaName) {
34887
35828
  __publicField(this, "table", (name2, columns, extraConfig) => {
@@ -34893,12 +35834,12 @@ var init_schema2 = __esm({
34893
35834
  this.schemaName = schemaName;
34894
35835
  }
34895
35836
  };
34896
- __publicField(MySqlSchema5, _a320, "MySqlSchema");
35837
+ __publicField(MySqlSchema5, _a322, "MySqlSchema");
34897
35838
  }
34898
35839
  });
34899
35840
 
34900
35841
  // ../drizzle-orm/dist/mysql-core/session.js
34901
- var _a321, MySqlPreparedQuery, _a322, MySqlSession, _a323, _b232, MySqlTransaction;
35842
+ var _a323, MySqlPreparedQuery, _a324, MySqlSession, _a325, _b232, MySqlTransaction;
34902
35843
  var init_session3 = __esm({
34903
35844
  "../drizzle-orm/dist/mysql-core/session.js"() {
34904
35845
  "use strict";
@@ -34906,15 +35847,15 @@ var init_session3 = __esm({
34906
35847
  init_errors();
34907
35848
  init_sql();
34908
35849
  init_db3();
34909
- _a321 = entityKind;
35850
+ _a323 = entityKind;
34910
35851
  MySqlPreparedQuery = class {
34911
35852
  constructor() {
34912
35853
  /** @internal */
34913
35854
  __publicField(this, "joinsNotNullableMap");
34914
35855
  }
34915
35856
  };
34916
- __publicField(MySqlPreparedQuery, _a321, "MySqlPreparedQuery");
34917
- _a322 = entityKind;
35857
+ __publicField(MySqlPreparedQuery, _a323, "MySqlPreparedQuery");
35858
+ _a324 = entityKind;
34918
35859
  MySqlSession = class {
34919
35860
  constructor(dialect4) {
34920
35861
  this.dialect = dialect4;
@@ -34949,8 +35890,8 @@ var init_session3 = __esm({
34949
35890
  return parts.length ? sql`start transaction ${sql.raw(parts.join(" "))}` : void 0;
34950
35891
  }
34951
35892
  };
34952
- __publicField(MySqlSession, _a322, "MySqlSession");
34953
- MySqlTransaction = class extends (_b232 = MySqlDatabase, _a323 = entityKind, _b232) {
35893
+ __publicField(MySqlSession, _a324, "MySqlSession");
35894
+ MySqlTransaction = class extends (_b232 = MySqlDatabase, _a325 = entityKind, _b232) {
34954
35895
  constructor(dialect4, session, schema4, nestedIndex, mode) {
34955
35896
  super(dialect4, session, schema4, mode);
34956
35897
  this.schema = schema4;
@@ -34960,7 +35901,7 @@ var init_session3 = __esm({
34960
35901
  throw new TransactionRollbackError();
34961
35902
  }
34962
35903
  };
34963
- __publicField(MySqlTransaction, _a323, "MySqlTransaction");
35904
+ __publicField(MySqlTransaction, _a325, "MySqlTransaction");
34964
35905
  }
34965
35906
  });
34966
35907
 
@@ -35658,6 +36599,13 @@ var init_cli = __esm({
35658
36599
  breakpoints: booleanType().optional().default(true),
35659
36600
  migrations: objectType({
35660
36601
  prefix: prefix.optional().default("index")
36602
+ }).optional(),
36603
+ entities: objectType({
36604
+ roles: booleanType().or(objectType({
36605
+ provider: stringType().optional(),
36606
+ include: stringType().array().optional(),
36607
+ exclude: stringType().array().optional()
36608
+ })).optional().default(false)
35661
36609
  }).optional()
35662
36610
  }).passthrough();
35663
36611
  configCheck = objectType({
@@ -35924,6 +36872,7 @@ var init_pgImports = __esm({
35924
36872
  const enums = [];
35925
36873
  const schemas = [];
35926
36874
  const sequences = [];
36875
+ const roles = [];
35927
36876
  const i0values = Object.values(exports2);
35928
36877
  i0values.forEach((t) => {
35929
36878
  if (isPgEnum(t)) {
@@ -35939,8 +36888,11 @@ var init_pgImports = __esm({
35939
36888
  if (isPgSequence(t)) {
35940
36889
  sequences.push(t);
35941
36890
  }
36891
+ if (is(t, PgRole)) {
36892
+ roles.push(t);
36893
+ }
35942
36894
  });
35943
- return { tables, enums, schemas, sequences };
36895
+ return { tables, enums, schemas, sequences, roles };
35944
36896
  };
35945
36897
  }
35946
36898
  });
@@ -36348,7 +37300,7 @@ init_mjs();
36348
37300
  init_global();
36349
37301
  init_pgSerializer();
36350
37302
  init_views();
36351
- var pgPushIntrospect = async (db, filters, schemaFilters) => {
37303
+ var pgPushIntrospect = async (db, filters, schemaFilters, entities = { roles: true }) => {
36352
37304
  const matchers = filters.map((it) => {
36353
37305
  return new Minimatch(it);
36354
37306
  });
@@ -36376,7 +37328,7 @@ var pgPushIntrospect = async (db, filters, schemaFilters) => {
36376
37328
  );
36377
37329
  const res = await (0, import_hanji3.renderWithTask)(
36378
37330
  progress,
36379
- fromDatabase(db, filter2, schemaFilters)
37331
+ fromDatabase(db, filter2, schemaFilters, entities)
36380
37332
  );
36381
37333
  const schema4 = { id: originUUID, prevId: "", ...res };
36382
37334
  const { internal, ...schemaWithoutInternals } = schema4;
@@ -36854,6 +37806,7 @@ var generateDrizzleJson = (imports, prevId, schemaFilters, casing2) => {
36854
37806
  prepared.enums,
36855
37807
  prepared.schemas,
36856
37808
  prepared.sequences,
37809
+ prepared.roles,
36857
37810
  casing2,
36858
37811
  schemaFilters
36859
37812
  );
@@ -36875,6 +37828,8 @@ var generateMigration = async (prev, cur) => {
36875
37828
  schemasResolver,
36876
37829
  enumsResolver,
36877
37830
  sequencesResolver,
37831
+ policyResolver,
37832
+ roleResolver,
36878
37833
  tablesResolver,
36879
37834
  columnsResolver,
36880
37835
  validatedPrev,
@@ -36907,6 +37862,8 @@ var pushSchema = async (imports, drizzleInstance, schemaFilters) => {
36907
37862
  schemasResolver,
36908
37863
  enumsResolver,
36909
37864
  sequencesResolver,
37865
+ policyResolver,
37866
+ roleResolver,
36910
37867
  tablesResolver,
36911
37868
  columnsResolver,
36912
37869
  validatedPrev,