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.mjs CHANGED
@@ -2480,9 +2480,9 @@ var require_inflight = __commonJS({
2480
2480
  }
2481
2481
  function slice(args) {
2482
2482
  var length = args.length;
2483
- var array = [];
2484
- for (var i = 0; i < length; i++) array[i] = args[i];
2485
- return array;
2483
+ var array2 = [];
2484
+ for (var i = 0; i < length; i++) array2[i] = args[i];
2485
+ return array2;
2486
2486
  }
2487
2487
  }
2488
2488
  });
@@ -3652,13 +3652,13 @@ function processCreateParams(params) {
3652
3652
  if (errorMap2)
3653
3653
  return { errorMap: errorMap2, description };
3654
3654
  const customMap = (iss, ctx) => {
3655
- var _a324, _b233;
3655
+ var _a326, _b233;
3656
3656
  const { message } = params;
3657
3657
  if (iss.code === "invalid_enum_value") {
3658
3658
  return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
3659
3659
  }
3660
3660
  if (typeof ctx.data === "undefined") {
3661
- return { message: (_a324 = message !== null && message !== void 0 ? message : required_error) !== null && _a324 !== void 0 ? _a324 : ctx.defaultError };
3661
+ return { message: (_a326 = message !== null && message !== void 0 ? message : required_error) !== null && _a326 !== void 0 ? _a326 : ctx.defaultError };
3662
3662
  }
3663
3663
  if (iss.code !== "invalid_type")
3664
3664
  return { message: ctx.defaultError };
@@ -3825,8 +3825,8 @@ var init_lib = __esm({
3825
3825
  return void 0;
3826
3826
  };
3827
3827
  util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
3828
- function joinValues(array, separator = " | ") {
3829
- return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
3828
+ function joinValues(array2, separator = " | ") {
3829
+ return array2.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
3830
3830
  }
3831
3831
  util2.joinValues = joinValues;
3832
3832
  util2.jsonStringifyReplacer = (_2, value) => {
@@ -4324,11 +4324,11 @@ var init_lib = __esm({
4324
4324
  throw result.error;
4325
4325
  }
4326
4326
  safeParse(data, params) {
4327
- var _a324;
4327
+ var _a326;
4328
4328
  const ctx = {
4329
4329
  common: {
4330
4330
  issues: [],
4331
- async: (_a324 = params === null || params === void 0 ? void 0 : params.async) !== null && _a324 !== void 0 ? _a324 : false,
4331
+ async: (_a326 = params === null || params === void 0 ? void 0 : params.async) !== null && _a326 !== void 0 ? _a326 : false,
4332
4332
  contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
4333
4333
  },
4334
4334
  path: (params === null || params === void 0 ? void 0 : params.path) || [],
@@ -4650,7 +4650,7 @@ var init_lib = __esm({
4650
4650
  } else if (check.kind === "url") {
4651
4651
  try {
4652
4652
  new URL(input.data);
4653
- } catch (_a324) {
4653
+ } catch (_a326) {
4654
4654
  ctx = this._getOrReturnCtx(input, ctx);
4655
4655
  addIssueToContext(ctx, {
4656
4656
  validation: "url",
@@ -4820,7 +4820,7 @@ var init_lib = __esm({
4820
4820
  return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
4821
4821
  }
4822
4822
  datetime(options) {
4823
- var _a324, _b233;
4823
+ var _a326, _b233;
4824
4824
  if (typeof options === "string") {
4825
4825
  return this._addCheck({
4826
4826
  kind: "datetime",
@@ -4833,7 +4833,7 @@ var init_lib = __esm({
4833
4833
  return this._addCheck({
4834
4834
  kind: "datetime",
4835
4835
  precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
4836
- offset: (_a324 = options === null || options === void 0 ? void 0 : options.offset) !== null && _a324 !== void 0 ? _a324 : false,
4836
+ offset: (_a326 = options === null || options === void 0 ? void 0 : options.offset) !== null && _a326 !== void 0 ? _a326 : false,
4837
4837
  local: (_b233 = options === null || options === void 0 ? void 0 : options.local) !== null && _b233 !== void 0 ? _b233 : false,
4838
4838
  ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
4839
4839
  });
@@ -4997,11 +4997,11 @@ var init_lib = __esm({
4997
4997
  }
4998
4998
  };
4999
4999
  ZodString.create = (params) => {
5000
- var _a324;
5000
+ var _a326;
5001
5001
  return new ZodString({
5002
5002
  checks: [],
5003
5003
  typeName: ZodFirstPartyTypeKind.ZodString,
5004
- coerce: (_a324 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a324 !== void 0 ? _a324 : false,
5004
+ coerce: (_a326 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a326 !== void 0 ? _a326 : false,
5005
5005
  ...processCreateParams(params)
5006
5006
  });
5007
5007
  };
@@ -5394,11 +5394,11 @@ var init_lib = __esm({
5394
5394
  }
5395
5395
  };
5396
5396
  ZodBigInt.create = (params) => {
5397
- var _a324;
5397
+ var _a326;
5398
5398
  return new ZodBigInt({
5399
5399
  checks: [],
5400
5400
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
5401
- coerce: (_a324 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a324 !== void 0 ? _a324 : false,
5401
+ coerce: (_a326 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a326 !== void 0 ? _a326 : false,
5402
5402
  ...processCreateParams(params)
5403
5403
  });
5404
5404
  };
@@ -5878,8 +5878,8 @@ var init_lib = __esm({
5878
5878
  unknownKeys: "strict",
5879
5879
  ...message !== void 0 ? {
5880
5880
  errorMap: (issue, ctx) => {
5881
- var _a324, _b233, _c12, _d5;
5882
- 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;
5881
+ var _a326, _b233, _c12, _d5;
5882
+ 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;
5883
5883
  if (issue.code === "unrecognized_keys")
5884
5884
  return {
5885
5885
  message: (_d5 = errorUtil.errToObj(message).message) !== null && _d5 !== void 0 ? _d5 : defaultError
@@ -7666,7 +7666,7 @@ var init_vector = __esm({
7666
7666
  });
7667
7667
 
7668
7668
  // src/serializer/pgSchema.ts
7669
- 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;
7669
+ 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;
7670
7670
  var init_pgSchema = __esm({
7671
7671
  "src/serializer/pgSchema.ts"() {
7672
7672
  "use strict";
@@ -7798,6 +7798,12 @@ var init_pgSchema = __esm({
7798
7798
  cycle: booleanType().optional(),
7799
7799
  schema: stringType()
7800
7800
  }).strict();
7801
+ roleSchema = objectType({
7802
+ name: stringType(),
7803
+ createDb: booleanType().optional(),
7804
+ createRole: booleanType().optional(),
7805
+ inherit: booleanType().optional()
7806
+ }).strict();
7801
7807
  sequenceSquashed = objectType({
7802
7808
  name: stringType(),
7803
7809
  schema: stringType(),
@@ -7861,6 +7867,14 @@ var init_pgSchema = __esm({
7861
7867
  columns: stringType().array(),
7862
7868
  nullsNotDistinct: booleanType()
7863
7869
  }).strict();
7870
+ policy = objectType({
7871
+ name: stringType(),
7872
+ as: enumType(["PERMISSIVE", "RESTRICTIVE"]).optional(),
7873
+ for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
7874
+ to: stringType().array().optional(),
7875
+ using: stringType().optional(),
7876
+ withCheck: stringType().optional()
7877
+ }).strict();
7864
7878
  tableV42 = objectType({
7865
7879
  name: stringType(),
7866
7880
  schema: stringType(),
@@ -7902,7 +7916,8 @@ var init_pgSchema = __esm({
7902
7916
  indexes: recordType(stringType(), index2),
7903
7917
  foreignKeys: recordType(stringType(), fk2),
7904
7918
  compositePrimaryKeys: recordType(stringType(), compositePK2),
7905
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
7919
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
7920
+ policies: recordType(stringType(), policy).default({})
7906
7921
  }).strict();
7907
7922
  schemaHash2 = objectType({
7908
7923
  id: stringType(),
@@ -7996,6 +8011,7 @@ var init_pgSchema = __esm({
7996
8011
  enums: recordType(stringType(), enumSchema),
7997
8012
  schemas: recordType(stringType(), stringType()),
7998
8013
  sequences: recordType(stringType(), sequenceSchema).default({}),
8014
+ roles: recordType(stringType(), roleSchema).default({}),
7999
8015
  _meta: objectType({
8000
8016
  schemas: recordType(stringType(), stringType()),
8001
8017
  tables: recordType(stringType(), stringType()),
@@ -8010,7 +8026,8 @@ var init_pgSchema = __esm({
8010
8026
  indexes: recordType(stringType(), stringType()),
8011
8027
  foreignKeys: recordType(stringType(), stringType()),
8012
8028
  compositePrimaryKeys: recordType(stringType(), stringType()),
8013
- uniqueConstraints: recordType(stringType(), stringType())
8029
+ uniqueConstraints: recordType(stringType(), stringType()),
8030
+ policies: recordType(stringType(), stringType())
8014
8031
  }).strict();
8015
8032
  tableSquashedV42 = objectType({
8016
8033
  name: stringType(),
@@ -8039,7 +8056,8 @@ var init_pgSchema = __esm({
8039
8056
  tables: recordType(stringType(), tableSquashed2),
8040
8057
  enums: recordType(stringType(), enumSchema),
8041
8058
  schemas: recordType(stringType(), stringType()),
8042
- sequences: recordType(stringType(), sequenceSquashed)
8059
+ sequences: recordType(stringType(), sequenceSquashed),
8060
+ roles: recordType(stringType(), roleSchema).default({})
8043
8061
  }).strict();
8044
8062
  pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
8045
8063
  pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
@@ -8122,6 +8140,23 @@ var init_pgSchema = __esm({
8122
8140
  squashFK: (fk4) => {
8123
8141
  return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${fk4.onUpdate ?? ""};${fk4.onDelete ?? ""};${fk4.schemaTo || "public"}`;
8124
8142
  },
8143
+ squashPolicy: (policy2) => {
8144
+ return `${policy2.name}--${policy2.as}--${policy2.for}--${policy2.to?.join(",")}--${policy2.using}--${policy2.withCheck}`;
8145
+ },
8146
+ unsquashPolicy: (policy2) => {
8147
+ const splitted = policy2.split("--");
8148
+ return {
8149
+ name: splitted[0],
8150
+ as: splitted[1],
8151
+ for: splitted[2],
8152
+ to: splitted[3].split(","),
8153
+ using: splitted[4] !== "undefined" ? splitted[4] : void 0,
8154
+ withCheck: splitted[5] !== "undefined" ? splitted[5] : void 0
8155
+ };
8156
+ },
8157
+ squashPolicyPush: (policy2) => {
8158
+ return `${policy2.name}--${policy2.as}--${policy2.for}--${policy2.to?.join(",")}`;
8159
+ },
8125
8160
  squashPK: (pk) => {
8126
8161
  return `${pk.columns.join(",")};${pk.name}`;
8127
8162
  },
@@ -8224,6 +8259,9 @@ var init_pgSchema = __esm({
8224
8259
  return PgSquasher.squashUnique(unq);
8225
8260
  }
8226
8261
  );
8262
+ const squashedPolicies = mapValues(it[1].policies, (policy2) => {
8263
+ return action === "push" ? PgSquasher.squashPolicyPush(policy2) : PgSquasher.squashPolicy(policy2);
8264
+ });
8227
8265
  return [
8228
8266
  it[0],
8229
8267
  {
@@ -8233,7 +8271,8 @@ var init_pgSchema = __esm({
8233
8271
  indexes: squashedIndexes,
8234
8272
  foreignKeys: squashedFKs,
8235
8273
  compositePrimaryKeys: squashedPKs,
8236
- uniqueConstraints: squashedUniqueConstraints
8274
+ uniqueConstraints: squashedUniqueConstraints,
8275
+ policies: squashedPolicies
8237
8276
  }
8238
8277
  ];
8239
8278
  })
@@ -8256,7 +8295,8 @@ var init_pgSchema = __esm({
8256
8295
  tables: mappedTables,
8257
8296
  enums: json3.enums,
8258
8297
  schemas: json3.schemas,
8259
- sequences: mappedSequences
8298
+ sequences: mappedSequences,
8299
+ roles: json3.roles
8260
8300
  };
8261
8301
  };
8262
8302
  dryPg = pgSchema.parse({
@@ -8606,7 +8646,7 @@ var init_utils = __esm({
8606
8646
  });
8607
8647
 
8608
8648
  // src/cli/views.ts
8609
- var import_hanji, warning, error, isRenamePromptItem, ResolveColumnSelect, tableKey, ResolveSelect, ResolveSchemasSelect, Spinner, ProgressView;
8649
+ var import_hanji, warning, error, isRenamePromptItem, ResolveColumnSelect, tableKey, ResolveSelectNamed, ResolveSelect, ResolveSchemasSelect, Spinner, ProgressView;
8610
8650
  var init_views = __esm({
8611
8651
  "src/cli/views.ts"() {
8612
8652
  "use strict";
@@ -8671,6 +8711,53 @@ Is ${source_default.bold.blue(
8671
8711
  tableKey = (it) => {
8672
8712
  return it.schema === "public" || !it.schema ? it.name : `${it.schema}.${it.name}`;
8673
8713
  };
8714
+ ResolveSelectNamed = class extends import_hanji.Prompt {
8715
+ constructor(base, data, entityType) {
8716
+ super();
8717
+ this.base = base;
8718
+ this.entityType = entityType;
8719
+ this.on("attach", (terminal) => terminal.toggleCursor("hide"));
8720
+ this.state = new import_hanji.SelectState(data);
8721
+ this.state.bind(this);
8722
+ this.base = base;
8723
+ }
8724
+ render(status) {
8725
+ if (status === "submitted" || status === "aborted") {
8726
+ return "";
8727
+ }
8728
+ const key = this.base.name;
8729
+ let text4 = `
8730
+ Is ${source_default.bold.blue(key)} ${this.entityType} created or renamed from another ${this.entityType}?
8731
+ `;
8732
+ const isSelectedRenamed = isRenamePromptItem(
8733
+ this.state.items[this.state.selectedIdx]
8734
+ );
8735
+ const selectedPrefix = isSelectedRenamed ? source_default.yellow("\u276F ") : source_default.green("\u276F ");
8736
+ const labelLength = this.state.items.filter((it) => isRenamePromptItem(it)).map((_2) => {
8737
+ const it = _2;
8738
+ const keyFrom = it.from.name;
8739
+ return key.length + 3 + keyFrom.length;
8740
+ }).reduce((a, b) => {
8741
+ if (a > b) {
8742
+ return a;
8743
+ }
8744
+ return b;
8745
+ }, 0);
8746
+ const entityType = this.entityType;
8747
+ this.state.items.forEach((it, idx) => {
8748
+ const isSelected = idx === this.state.selectedIdx;
8749
+ const isRenamed = isRenamePromptItem(it);
8750
+ const title = isRenamed ? `${it.from.name} \u203A ${it.to.name}`.padEnd(labelLength, " ") : it.name.padEnd(labelLength, " ");
8751
+ const label = isRenamed ? `${source_default.yellow("~")} ${title} ${source_default.gray(`rename ${entityType}`)}` : `${source_default.green("+")} ${title} ${source_default.gray(`create ${entityType}`)}`;
8752
+ text4 += isSelected ? `${selectedPrefix}${label}` : ` ${label}`;
8753
+ text4 += idx != this.state.items.length - 1 ? "\n" : "";
8754
+ });
8755
+ return text4;
8756
+ }
8757
+ result() {
8758
+ return this.state.items[this.state.selectedIdx];
8759
+ }
8760
+ };
8674
8761
  ResolveSelect = class extends import_hanji.Prompt {
8675
8762
  constructor(base, data, entityType) {
8676
8763
  super();
@@ -8887,57 +8974,57 @@ var require_heap = __commonJS({
8887
8974
  }
8888
8975
  return [].splice.apply(a, [lo, lo - lo].concat(x)), x;
8889
8976
  };
8890
- heappush = function(array, item, cmp) {
8977
+ heappush = function(array2, item, cmp) {
8891
8978
  if (cmp == null) {
8892
8979
  cmp = defaultCmp;
8893
8980
  }
8894
- array.push(item);
8895
- return _siftdown(array, 0, array.length - 1, cmp);
8981
+ array2.push(item);
8982
+ return _siftdown(array2, 0, array2.length - 1, cmp);
8896
8983
  };
8897
- heappop = function(array, cmp) {
8984
+ heappop = function(array2, cmp) {
8898
8985
  var lastelt, returnitem;
8899
8986
  if (cmp == null) {
8900
8987
  cmp = defaultCmp;
8901
8988
  }
8902
- lastelt = array.pop();
8903
- if (array.length) {
8904
- returnitem = array[0];
8905
- array[0] = lastelt;
8906
- _siftup(array, 0, cmp);
8989
+ lastelt = array2.pop();
8990
+ if (array2.length) {
8991
+ returnitem = array2[0];
8992
+ array2[0] = lastelt;
8993
+ _siftup(array2, 0, cmp);
8907
8994
  } else {
8908
8995
  returnitem = lastelt;
8909
8996
  }
8910
8997
  return returnitem;
8911
8998
  };
8912
- heapreplace = function(array, item, cmp) {
8999
+ heapreplace = function(array2, item, cmp) {
8913
9000
  var returnitem;
8914
9001
  if (cmp == null) {
8915
9002
  cmp = defaultCmp;
8916
9003
  }
8917
- returnitem = array[0];
8918
- array[0] = item;
8919
- _siftup(array, 0, cmp);
9004
+ returnitem = array2[0];
9005
+ array2[0] = item;
9006
+ _siftup(array2, 0, cmp);
8920
9007
  return returnitem;
8921
9008
  };
8922
- heappushpop = function(array, item, cmp) {
9009
+ heappushpop = function(array2, item, cmp) {
8923
9010
  var _ref;
8924
9011
  if (cmp == null) {
8925
9012
  cmp = defaultCmp;
8926
9013
  }
8927
- if (array.length && cmp(array[0], item) < 0) {
8928
- _ref = [array[0], item], item = _ref[0], array[0] = _ref[1];
8929
- _siftup(array, 0, cmp);
9014
+ if (array2.length && cmp(array2[0], item) < 0) {
9015
+ _ref = [array2[0], item], item = _ref[0], array2[0] = _ref[1];
9016
+ _siftup(array2, 0, cmp);
8930
9017
  }
8931
9018
  return item;
8932
9019
  };
8933
- heapify = function(array, cmp) {
9020
+ heapify = function(array2, cmp) {
8934
9021
  var i, _i2, _j2, _len, _ref, _ref1, _results, _results1;
8935
9022
  if (cmp == null) {
8936
9023
  cmp = defaultCmp;
8937
9024
  }
8938
9025
  _ref1 = function() {
8939
9026
  _results1 = [];
8940
- for (var _j3 = 0, _ref2 = floor(array.length / 2); 0 <= _ref2 ? _j3 < _ref2 : _j3 > _ref2; 0 <= _ref2 ? _j3++ : _j3--) {
9027
+ for (var _j3 = 0, _ref2 = floor(array2.length / 2); 0 <= _ref2 ? _j3 < _ref2 : _j3 > _ref2; 0 <= _ref2 ? _j3++ : _j3--) {
8941
9028
  _results1.push(_j3);
8942
9029
  }
8943
9030
  return _results1;
@@ -8945,51 +9032,51 @@ var require_heap = __commonJS({
8945
9032
  _results = [];
8946
9033
  for (_i2 = 0, _len = _ref1.length; _i2 < _len; _i2++) {
8947
9034
  i = _ref1[_i2];
8948
- _results.push(_siftup(array, i, cmp));
9035
+ _results.push(_siftup(array2, i, cmp));
8949
9036
  }
8950
9037
  return _results;
8951
9038
  };
8952
- updateItem = function(array, item, cmp) {
9039
+ updateItem = function(array2, item, cmp) {
8953
9040
  var pos;
8954
9041
  if (cmp == null) {
8955
9042
  cmp = defaultCmp;
8956
9043
  }
8957
- pos = array.indexOf(item);
9044
+ pos = array2.indexOf(item);
8958
9045
  if (pos === -1) {
8959
9046
  return;
8960
9047
  }
8961
- _siftdown(array, 0, pos, cmp);
8962
- return _siftup(array, pos, cmp);
9048
+ _siftdown(array2, 0, pos, cmp);
9049
+ return _siftup(array2, pos, cmp);
8963
9050
  };
8964
- nlargest = function(array, n, cmp) {
9051
+ nlargest = function(array2, n, cmp) {
8965
9052
  var elem, result, _i2, _len, _ref;
8966
9053
  if (cmp == null) {
8967
9054
  cmp = defaultCmp;
8968
9055
  }
8969
- result = array.slice(0, n);
9056
+ result = array2.slice(0, n);
8970
9057
  if (!result.length) {
8971
9058
  return result;
8972
9059
  }
8973
9060
  heapify(result, cmp);
8974
- _ref = array.slice(n);
9061
+ _ref = array2.slice(n);
8975
9062
  for (_i2 = 0, _len = _ref.length; _i2 < _len; _i2++) {
8976
9063
  elem = _ref[_i2];
8977
9064
  heappushpop(result, elem, cmp);
8978
9065
  }
8979
9066
  return result.sort(cmp).reverse();
8980
9067
  };
8981
- nsmallest = function(array, n, cmp) {
9068
+ nsmallest = function(array2, n, cmp) {
8982
9069
  var elem, i, los, result, _i2, _j2, _len, _ref, _ref1, _results;
8983
9070
  if (cmp == null) {
8984
9071
  cmp = defaultCmp;
8985
9072
  }
8986
- if (n * 10 <= array.length) {
8987
- result = array.slice(0, n).sort(cmp);
9073
+ if (n * 10 <= array2.length) {
9074
+ result = array2.slice(0, n).sort(cmp);
8988
9075
  if (!result.length) {
8989
9076
  return result;
8990
9077
  }
8991
9078
  los = result[result.length - 1];
8992
- _ref = array.slice(n);
9079
+ _ref = array2.slice(n);
8993
9080
  for (_i2 = 0, _len = _ref.length; _i2 < _len; _i2++) {
8994
9081
  elem = _ref[_i2];
8995
9082
  if (cmp(elem, los) < 0) {
@@ -9000,51 +9087,51 @@ var require_heap = __commonJS({
9000
9087
  }
9001
9088
  return result;
9002
9089
  }
9003
- heapify(array, cmp);
9090
+ heapify(array2, cmp);
9004
9091
  _results = [];
9005
- for (i = _j2 = 0, _ref1 = min2(n, array.length); 0 <= _ref1 ? _j2 < _ref1 : _j2 > _ref1; i = 0 <= _ref1 ? ++_j2 : --_j2) {
9006
- _results.push(heappop(array, cmp));
9092
+ for (i = _j2 = 0, _ref1 = min2(n, array2.length); 0 <= _ref1 ? _j2 < _ref1 : _j2 > _ref1; i = 0 <= _ref1 ? ++_j2 : --_j2) {
9093
+ _results.push(heappop(array2, cmp));
9007
9094
  }
9008
9095
  return _results;
9009
9096
  };
9010
- _siftdown = function(array, startpos, pos, cmp) {
9097
+ _siftdown = function(array2, startpos, pos, cmp) {
9011
9098
  var newitem, parent, parentpos;
9012
9099
  if (cmp == null) {
9013
9100
  cmp = defaultCmp;
9014
9101
  }
9015
- newitem = array[pos];
9102
+ newitem = array2[pos];
9016
9103
  while (pos > startpos) {
9017
9104
  parentpos = pos - 1 >> 1;
9018
- parent = array[parentpos];
9105
+ parent = array2[parentpos];
9019
9106
  if (cmp(newitem, parent) < 0) {
9020
- array[pos] = parent;
9107
+ array2[pos] = parent;
9021
9108
  pos = parentpos;
9022
9109
  continue;
9023
9110
  }
9024
9111
  break;
9025
9112
  }
9026
- return array[pos] = newitem;
9113
+ return array2[pos] = newitem;
9027
9114
  };
9028
- _siftup = function(array, pos, cmp) {
9115
+ _siftup = function(array2, pos, cmp) {
9029
9116
  var childpos, endpos, newitem, rightpos, startpos;
9030
9117
  if (cmp == null) {
9031
9118
  cmp = defaultCmp;
9032
9119
  }
9033
- endpos = array.length;
9120
+ endpos = array2.length;
9034
9121
  startpos = pos;
9035
- newitem = array[pos];
9122
+ newitem = array2[pos];
9036
9123
  childpos = 2 * pos + 1;
9037
9124
  while (childpos < endpos) {
9038
9125
  rightpos = childpos + 1;
9039
- if (rightpos < endpos && !(cmp(array[childpos], array[rightpos]) < 0)) {
9126
+ if (rightpos < endpos && !(cmp(array2[childpos], array2[rightpos]) < 0)) {
9040
9127
  childpos = rightpos;
9041
9128
  }
9042
- array[pos] = array[childpos];
9129
+ array2[pos] = array2[childpos];
9043
9130
  pos = childpos;
9044
9131
  childpos = 2 * pos + 1;
9045
9132
  }
9046
- array[pos] = newitem;
9047
- return _siftdown(array, startpos, pos, cmp);
9133
+ array2[pos] = newitem;
9134
+ return _siftdown(array2, startpos, pos, cmp);
9048
9135
  };
9049
9136
  Heap = function() {
9050
9137
  Heap2.push = heappush;
@@ -10971,12 +11058,12 @@ var require_lib = __commonJS({
10971
11058
  }
10972
11059
  return bestMatch;
10973
11060
  }
10974
- scalarize(array, originals, fuzzyOriginals) {
11061
+ scalarize(array2, originals, fuzzyOriginals) {
10975
11062
  const fuzzyMatches = [];
10976
11063
  if (fuzzyOriginals) {
10977
11064
  const keyScores = {};
10978
- for (let index4 = 0; index4 < array.length; index4++) {
10979
- const item = array[index4];
11065
+ for (let index4 = 0; index4 < array2.length; index4++) {
11066
+ const item = array2[index4];
10980
11067
  if (this.isScalar(item)) {
10981
11068
  continue;
10982
11069
  }
@@ -10990,8 +11077,8 @@ var require_lib = __commonJS({
10990
11077
  }
10991
11078
  }
10992
11079
  const result = [];
10993
- for (let index4 = 0; index4 < array.length; index4++) {
10994
- const item = array[index4];
11080
+ for (let index4 = 0; index4 < array2.length; index4++) {
11081
+ const item = array2[index4];
10995
11082
  if (this.isScalar(item)) {
10996
11083
  result.push(item);
10997
11084
  } else {
@@ -11213,6 +11300,37 @@ function diffColumns(left, right) {
11213
11300
  );
11214
11301
  return alteredTables;
11215
11302
  }
11303
+ function diffPolicies(left, right) {
11304
+ left = JSON.parse(JSON.stringify(left));
11305
+ right = JSON.parse(JSON.stringify(right));
11306
+ const result = (0, import_json_diff.diff)(left, right) ?? {};
11307
+ const alteredTables = Object.fromEntries(
11308
+ Object.entries(result).filter((it) => {
11309
+ return !(it[0].includes("__added") || it[0].includes("__deleted"));
11310
+ }).map((tableEntry) => {
11311
+ const deletedPolicies = Object.entries(tableEntry[1].policies ?? {}).filter((it) => {
11312
+ return it[0].endsWith("__deleted");
11313
+ }).map((it) => {
11314
+ return it[1];
11315
+ });
11316
+ const addedPolicies = Object.entries(tableEntry[1].policies ?? {}).filter((it) => {
11317
+ return it[0].endsWith("__added");
11318
+ }).map((it) => {
11319
+ return it[1];
11320
+ });
11321
+ tableEntry[1].policies = {
11322
+ added: addedPolicies,
11323
+ deleted: deletedPolicies
11324
+ };
11325
+ const table4 = left[tableEntry[0]];
11326
+ return [
11327
+ tableEntry[0],
11328
+ { name: table4.name, schema: table4.schema, ...tableEntry[1] }
11329
+ ];
11330
+ })
11331
+ );
11332
+ return alteredTables;
11333
+ }
11216
11334
  function applyJsonDiff(json1, json22) {
11217
11335
  json1 = JSON.parse(JSON.stringify(json1));
11218
11336
  json22 = JSON.parse(JSON.stringify(json22));
@@ -11222,6 +11340,7 @@ function applyJsonDiff(json1, json22) {
11222
11340
  difference.tables = difference.tables || {};
11223
11341
  difference.enums = difference.enums || {};
11224
11342
  difference.sequences = difference.sequences || {};
11343
+ difference.roles = difference.roles || {};
11225
11344
  const schemaKeys = Object.keys(difference.schemas);
11226
11345
  for (let key of schemaKeys) {
11227
11346
  if (key.endsWith("__added") || key.endsWith("__deleted")) {
@@ -11277,6 +11396,10 @@ function applyJsonDiff(json1, json22) {
11277
11396
  const alteredSequences = sequencesEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted")) && "values" in it[1]).map((it) => {
11278
11397
  return json22.sequences[it[0]];
11279
11398
  });
11399
+ const rolesEntries = Object.entries(difference.roles);
11400
+ const alteredRoles = rolesEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted"))).map((it) => {
11401
+ return json22.roles[it[0]];
11402
+ });
11280
11403
  const alteredTablesWithColumns = Object.values(difference.tables).map(
11281
11404
  (table4) => {
11282
11405
  return findAlternationsInTable(table4);
@@ -11285,7 +11408,8 @@ function applyJsonDiff(json1, json22) {
11285
11408
  return {
11286
11409
  alteredTablesWithColumns,
11287
11410
  alteredEnums,
11288
- alteredSequences
11411
+ alteredSequences,
11412
+ alteredRoles
11289
11413
  };
11290
11414
  }
11291
11415
  var import_json_diff, mapArraysDiff, findAlternationsInTable, alternationsInColumn;
@@ -11345,6 +11469,21 @@ var init_jsonDiffer = __esm({
11345
11469
  return !it[0].endsWith("__deleted") && !it[0].endsWith("__added");
11346
11470
  })
11347
11471
  );
11472
+ const deletedPolicies = Object.fromEntries(
11473
+ Object.entries(table4.policies__deleted || {}).concat(
11474
+ Object.entries(table4.policies || {}).filter((it) => it[0].includes("__deleted"))
11475
+ ).map((entry) => [entry[0].replace("__deleted", ""), entry[1]])
11476
+ );
11477
+ const addedPolicies = Object.fromEntries(
11478
+ Object.entries(table4.policies__added || {}).concat(
11479
+ Object.entries(table4.policies || {}).filter((it) => it[0].includes("__added"))
11480
+ ).map((entry) => [entry[0].replace("__added", ""), entry[1]])
11481
+ );
11482
+ const alteredPolicies = Object.fromEntries(
11483
+ Object.entries(table4.policies || {}).filter((it) => {
11484
+ return !it[0].endsWith("__deleted") && !it[0].endsWith("__added");
11485
+ })
11486
+ );
11348
11487
  const deletedForeignKeys = Object.fromEntries(
11349
11488
  Object.entries(table4.foreignKeys__deleted || {}).concat(
11350
11489
  Object.entries(table4.foreignKeys || {}).filter((it) => it[0].includes("__deleted"))
@@ -11406,7 +11545,10 @@ var init_jsonDiffer = __esm({
11406
11545
  alteredCompositePKs,
11407
11546
  addedUniqueConstraints,
11408
11547
  deletedUniqueConstraints,
11409
- alteredUniqueConstraints
11548
+ alteredUniqueConstraints,
11549
+ deletedPolicies,
11550
+ addedPolicies,
11551
+ alteredPolicies
11410
11552
  };
11411
11553
  };
11412
11554
  alternationsInColumn = (column4) => {
@@ -11680,7 +11822,7 @@ function fromJson(statements, dialect4, action, json22) {
11680
11822
  }).filter((it) => it !== "");
11681
11823
  return result;
11682
11824
  }
11683
- 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;
11825
+ 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;
11684
11826
  var init_sqlgenerator = __esm({
11685
11827
  "src/sqlgenerator.ts"() {
11686
11828
  "use strict";
@@ -11736,12 +11878,109 @@ var init_sqlgenerator = __esm({
11736
11878
  };
11737
11879
  Convertor = class {
11738
11880
  };
11881
+ PgCreateRoleConvertor = class extends Convertor {
11882
+ can(statement, dialect4) {
11883
+ return statement.type === "create_role" && dialect4 === "postgresql";
11884
+ }
11885
+ convert(statement) {
11886
+ 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"}` : ""};`;
11887
+ }
11888
+ };
11889
+ PgDropRoleConvertor = class extends Convertor {
11890
+ can(statement, dialect4) {
11891
+ return statement.type === "drop_role" && dialect4 === "postgresql";
11892
+ }
11893
+ convert(statement) {
11894
+ return `DROP ROLE "${statement.name}";`;
11895
+ }
11896
+ };
11897
+ PgRenameRoleConvertor = class extends Convertor {
11898
+ can(statement, dialect4) {
11899
+ return statement.type === "rename_role" && dialect4 === "postgresql";
11900
+ }
11901
+ convert(statement) {
11902
+ return `ALTER ROLE "${statement.nameFrom}" RENAME TO "${statement.nameTo}";`;
11903
+ }
11904
+ };
11905
+ PgAlterRoleConvertor = class extends Convertor {
11906
+ can(statement, dialect4) {
11907
+ return statement.type === "alter_role" && dialect4 === "postgresql";
11908
+ }
11909
+ convert(statement) {
11910
+ return `ALTER ROLE "${statement.name}"${` WITH${statement.values.createDb ? " CREATEDB" : " NOCREATEDB"}${statement.values.createRole ? " CREATEROLE" : " NOCREATEROLE"}${statement.values.inherit ? " INHERIT" : " NOINHERIT"}`};`;
11911
+ }
11912
+ };
11913
+ PgCreatePolicyConvertor = class extends Convertor {
11914
+ can(statement, dialect4) {
11915
+ return statement.type === "create_policy" && dialect4 === "postgresql";
11916
+ }
11917
+ convert(statement) {
11918
+ const policy2 = statement.data;
11919
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
11920
+ const usingPart = policy2.using ? ` USING (${policy2.using})` : "";
11921
+ const withCheckPart = policy2.withCheck ? ` WITH CHECK (${policy2.withCheck})` : "";
11922
+ const policyToPart = policy2.to?.map(
11923
+ (v) => ["current_user", "current_role", "session_user", "public"].includes(v) ? v : `"${v}"`
11924
+ ).join(", ");
11925
+ return `CREATE POLICY "${policy2.name}" ON ${tableNameWithSchema} AS ${policy2.as?.toUpperCase()} FOR ${policy2.for?.toUpperCase()} TO ${policyToPart}${usingPart}${withCheckPart};`;
11926
+ }
11927
+ };
11928
+ PgDropPolicyConvertor = class extends Convertor {
11929
+ can(statement, dialect4) {
11930
+ return statement.type === "drop_policy" && dialect4 === "postgresql";
11931
+ }
11932
+ convert(statement) {
11933
+ const policy2 = statement.data;
11934
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
11935
+ return `DROP POLICY "${policy2.name}" ON ${tableNameWithSchema} CASCADE;`;
11936
+ }
11937
+ };
11938
+ PgRenamePolicyConvertor = class extends Convertor {
11939
+ can(statement, dialect4) {
11940
+ return statement.type === "rename_policy" && dialect4 === "postgresql";
11941
+ }
11942
+ convert(statement) {
11943
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
11944
+ return `ALTER POLICY "${statement.oldName}" ON ${tableNameWithSchema} RENAME TO "${statement.newName}";`;
11945
+ }
11946
+ };
11947
+ PgAlterPolicyConvertor = class extends Convertor {
11948
+ can(statement, dialect4) {
11949
+ return statement.type === "alter_policy" && dialect4 === "postgresql";
11950
+ }
11951
+ convert(statement) {
11952
+ const newPolicy = PgSquasher.unsquashPolicy(statement.newData);
11953
+ const oldPolicy = PgSquasher.unsquashPolicy(statement.oldData);
11954
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
11955
+ const usingPart = newPolicy.using ? ` USING (${newPolicy.using})` : oldPolicy.using ? ` USING (${oldPolicy.using})` : "";
11956
+ const withCheckPart = newPolicy.withCheck ? ` WITH CHECK (${newPolicy.withCheck})` : oldPolicy.withCheck ? ` WITH CHECK (${oldPolicy.withCheck})` : "";
11957
+ return `ALTER POLICY "${oldPolicy.name}" ON ${tableNameWithSchema} TO ${newPolicy.to}${usingPart}${withCheckPart};`;
11958
+ }
11959
+ };
11960
+ PgEnableRlsConvertor = class extends Convertor {
11961
+ can(statement, dialect4) {
11962
+ return statement.type === "enable_rls" && dialect4 === "postgresql";
11963
+ }
11964
+ convert(statement) {
11965
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
11966
+ return `ALTER TABLE ${tableNameWithSchema} ENABLE ROW LEVEL SECURITY;`;
11967
+ }
11968
+ };
11969
+ PgDisableRlsConvertor = class extends Convertor {
11970
+ can(statement, dialect4) {
11971
+ return statement.type === "disable_rls" && dialect4 === "postgresql";
11972
+ }
11973
+ convert(statement) {
11974
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
11975
+ return `ALTER TABLE ${tableNameWithSchema} DISABLE ROW LEVEL SECURITY;`;
11976
+ }
11977
+ };
11739
11978
  PgCreateTableConvertor = class extends Convertor {
11740
11979
  can(statement, dialect4) {
11741
11980
  return statement.type === "create_table" && dialect4 === "postgresql";
11742
11981
  }
11743
11982
  convert(st) {
11744
- const { tableName, schema: schema4, columns, compositePKs, uniqueConstraints } = st;
11983
+ const { tableName, schema: schema4, columns, compositePKs, uniqueConstraints, policies } = st;
11745
11984
  let statement = "";
11746
11985
  const name2 = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
11747
11986
  statement += `CREATE TABLE IF NOT EXISTS ${name2} (
@@ -11778,7 +12017,12 @@ var init_sqlgenerator = __esm({
11778
12017
  );`;
11779
12018
  statement += `
11780
12019
  `;
11781
- return statement;
12020
+ const enableRls = new PgEnableRlsConvertor().convert({
12021
+ type: "enable_rls",
12022
+ tableName,
12023
+ schema: schema4
12024
+ });
12025
+ return [statement, ...policies && policies.length > 0 ? [enableRls] : []];
11782
12026
  }
11783
12027
  };
11784
12028
  MySqlCreateTableConvertor = class extends Convertor {
@@ -12061,20 +12305,22 @@ var init_sqlgenerator = __esm({
12061
12305
  }
12062
12306
  convert(st) {
12063
12307
  const { name: name2, values, schema: schema4 } = st;
12064
- const tableNameWithSchema = schema4 ? `"${schema4}"."${name2}"` : `"${name2}"`;
12308
+ const enumNameWithSchema = schema4 ? `"${schema4}"."${name2}"` : `"${name2}"`;
12065
12309
  let valuesStatement = "(";
12066
12310
  valuesStatement += values.map((it) => `'${it}'`).join(", ");
12067
12311
  valuesStatement += ")";
12068
- let statement = "DO $$ BEGIN";
12069
- statement += "\n";
12070
- statement += ` CREATE TYPE ${tableNameWithSchema} AS ENUM${valuesStatement};`;
12071
- statement += "\n";
12072
- statement += "EXCEPTION";
12073
- statement += "\n";
12074
- statement += " WHEN duplicate_object THEN null;";
12075
- statement += "\n";
12076
- statement += "END $$;";
12077
- statement += "\n";
12312
+ let statement = `CREATE TYPE ${enumNameWithSchema} AS ENUM${valuesStatement};`;
12313
+ return statement;
12314
+ }
12315
+ };
12316
+ DropTypeEnumConvertor = class extends Convertor {
12317
+ can(statement) {
12318
+ return statement.type === "drop_type_enum";
12319
+ }
12320
+ convert(st) {
12321
+ const { name: name2, schema: schema4 } = st;
12322
+ const enumNameWithSchema = schema4 ? `"${schema4}"."${name2}"` : `"${name2}"`;
12323
+ let statement = `DROP TYPE ${enumNameWithSchema};`;
12078
12324
  return statement;
12079
12325
  }
12080
12326
  };
@@ -12083,9 +12329,56 @@ var init_sqlgenerator = __esm({
12083
12329
  return statement.type === "alter_type_add_value";
12084
12330
  }
12085
12331
  convert(st) {
12086
- const { name: name2, schema: schema4, value } = st;
12087
- const schemaPrefix = schema4 && schema4 !== "public" ? `"${schema4}".` : "";
12088
- return `ALTER TYPE ${schemaPrefix}"${name2}" ADD VALUE '${value}';`;
12332
+ const { name: name2, schema: schema4, value, before } = st;
12333
+ const enumNameWithSchema = schema4 ? `"${schema4}"."${name2}"` : `"${name2}"`;
12334
+ return `ALTER TYPE ${enumNameWithSchema} ADD VALUE '${value}'${before.length ? ` BEFORE '${before}'` : ""};`;
12335
+ }
12336
+ };
12337
+ AlterTypeSetSchemaConvertor = class extends Convertor {
12338
+ can(statement) {
12339
+ return statement.type === "move_type_enum";
12340
+ }
12341
+ convert(st) {
12342
+ const { name: name2, schemaFrom, schemaTo } = st;
12343
+ const enumNameWithSchema = schemaFrom ? `"${schemaFrom}"."${name2}"` : `"${name2}"`;
12344
+ return `ALTER TYPE ${enumNameWithSchema} SET SCHEMA "${schemaTo}";`;
12345
+ }
12346
+ };
12347
+ AlterRenameTypeConvertor = class extends Convertor {
12348
+ can(statement) {
12349
+ return statement.type === "rename_type_enum";
12350
+ }
12351
+ convert(st) {
12352
+ const { nameTo, nameFrom, schema: schema4 } = st;
12353
+ const enumNameWithSchema = schema4 ? `"${schema4}"."${nameFrom}"` : `"${nameFrom}"`;
12354
+ return `ALTER TYPE ${enumNameWithSchema} RENAME TO "${nameTo}";`;
12355
+ }
12356
+ };
12357
+ AlterTypeDropValueConvertor = class extends Convertor {
12358
+ can(statement) {
12359
+ return statement.type === "alter_type_drop_value";
12360
+ }
12361
+ convert(st) {
12362
+ const { columnsWithEnum, name: name2, newValues, schema: schema4 } = st;
12363
+ const statements = [];
12364
+ for (const withEnum of columnsWithEnum) {
12365
+ statements.push(
12366
+ `ALTER TABLE "${withEnum.schema}"."${withEnum.table}" ALTER COLUMN "${withEnum.column}" SET DATA TYPE text;`
12367
+ );
12368
+ }
12369
+ statements.push(new DropTypeEnumConvertor().convert({ name: name2, schema: schema4, type: "drop_type_enum" }));
12370
+ statements.push(new CreateTypeEnumConvertor().convert({
12371
+ name: name2,
12372
+ schema: schema4,
12373
+ values: newValues,
12374
+ type: "create_type_enum"
12375
+ }));
12376
+ for (const withEnum of columnsWithEnum) {
12377
+ statements.push(
12378
+ `ALTER TABLE "${withEnum.schema}"."${withEnum.table}" ALTER COLUMN "${withEnum.column}" SET DATA TYPE "${schema4}"."${name2}" USING "${withEnum.column}"::"${schema4}"."${name2}";`
12379
+ );
12380
+ }
12381
+ return statements;
12089
12382
  }
12090
12383
  };
12091
12384
  PgDropTableConvertor = class extends Convertor {
@@ -12093,9 +12386,21 @@ var init_sqlgenerator = __esm({
12093
12386
  return statement.type === "drop_table" && dialect4 === "postgresql";
12094
12387
  }
12095
12388
  convert(statement) {
12096
- const { tableName, schema: schema4 } = statement;
12389
+ const { tableName, schema: schema4, policies } = statement;
12097
12390
  const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
12098
- return `DROP TABLE ${tableNameWithSchema};`;
12391
+ const dropPolicyConvertor = new PgDropPolicyConvertor();
12392
+ const droppedPolicies = policies?.map((p) => {
12393
+ return dropPolicyConvertor.convert({
12394
+ type: "drop_policy",
12395
+ tableName,
12396
+ data: PgSquasher.unsquashPolicy(p),
12397
+ schema: schema4
12398
+ });
12399
+ }) ?? [];
12400
+ return [
12401
+ ...droppedPolicies,
12402
+ `DROP TABLE ${tableNameWithSchema};`
12403
+ ];
12099
12404
  }
12100
12405
  };
12101
12406
  MySQLDropTableConvertor = class extends Convertor {
@@ -13229,6 +13534,11 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
13229
13534
  convertors.push(new SQLiteRecreateTableConvertor());
13230
13535
  convertors.push(new LibSQLRecreateTableConvertor());
13231
13536
  convertors.push(new CreateTypeEnumConvertor());
13537
+ convertors.push(new DropTypeEnumConvertor());
13538
+ convertors.push(new AlterTypeAddValueConvertor());
13539
+ convertors.push(new AlterTypeSetSchemaConvertor());
13540
+ convertors.push(new AlterRenameTypeConvertor());
13541
+ convertors.push(new AlterTypeDropValueConvertor());
13232
13542
  convertors.push(new CreatePgSequenceConvertor());
13233
13543
  convertors.push(new DropPgSequenceConvertor());
13234
13544
  convertors.push(new RenamePgSequenceConvertor());
@@ -13260,13 +13570,22 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
13260
13570
  convertors.push(new PgDropIndexConvertor());
13261
13571
  convertors.push(new SqliteDropIndexConvertor());
13262
13572
  convertors.push(new MySqlDropIndexConvertor());
13263
- convertors.push(new AlterTypeAddValueConvertor());
13264
13573
  convertors.push(new PgAlterTableAlterColumnSetPrimaryKeyConvertor());
13265
13574
  convertors.push(new PgAlterTableAlterColumnDropPrimaryKeyConvertor());
13266
13575
  convertors.push(new PgAlterTableAlterColumnSetNotNullConvertor());
13267
13576
  convertors.push(new PgAlterTableAlterColumnDropNotNullConvertor());
13268
13577
  convertors.push(new PgAlterTableAlterColumnSetDefaultConvertor());
13269
13578
  convertors.push(new PgAlterTableAlterColumnDropDefaultConvertor());
13579
+ convertors.push(new PgAlterPolicyConvertor());
13580
+ convertors.push(new PgCreatePolicyConvertor());
13581
+ convertors.push(new PgDropPolicyConvertor());
13582
+ convertors.push(new PgRenamePolicyConvertor());
13583
+ convertors.push(new PgEnableRlsConvertor());
13584
+ convertors.push(new PgDisableRlsConvertor());
13585
+ convertors.push(new PgDropRoleConvertor());
13586
+ convertors.push(new PgAlterRoleConvertor());
13587
+ convertors.push(new PgCreateRoleConvertor());
13588
+ convertors.push(new PgRenameRoleConvertor());
13270
13589
  convertors.push(new PgAlterTableAlterColumnSetExpressionConvertor());
13271
13590
  convertors.push(new PgAlterTableAlterColumnDropGeneratedConvertor());
13272
13591
  convertors.push(new PgAlterTableAlterColumnAlterrGeneratedConvertor());
@@ -13561,7 +13880,7 @@ var init_sqlitePushUtils = __esm({
13561
13880
  });
13562
13881
 
13563
13882
  // src/jsonStatements.ts
13564
- 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;
13883
+ 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;
13565
13884
  var init_jsonStatements = __esm({
13566
13885
  "src/jsonStatements.ts"() {
13567
13886
  "use strict";
@@ -13572,7 +13891,7 @@ var init_jsonStatements = __esm({
13572
13891
  init_pgSchema();
13573
13892
  init_sqliteSchema();
13574
13893
  preparePgCreateTableJson = (table4, json22) => {
13575
- const { name: name2, schema: schema4, columns, compositePrimaryKeys, uniqueConstraints } = table4;
13894
+ const { name: name2, schema: schema4, columns, compositePrimaryKeys, uniqueConstraints, policies } = table4;
13576
13895
  const tableKey2 = `${schema4 || "public"}.${name2}`;
13577
13896
  const compositePkName = Object.values(compositePrimaryKeys).length > 0 ? json22.tables[tableKey2].compositePrimaryKeys[`${PgSquasher.unsquashPK(Object.values(compositePrimaryKeys)[0]).name}`].name : "";
13578
13897
  return {
@@ -13582,7 +13901,8 @@ var init_jsonStatements = __esm({
13582
13901
  columns: Object.values(columns),
13583
13902
  compositePKs: Object.values(compositePrimaryKeys),
13584
13903
  compositePkName,
13585
- uniqueConstraints: Object.values(uniqueConstraints)
13904
+ uniqueConstraints: Object.values(uniqueConstraints),
13905
+ policies: Object.values(policies)
13586
13906
  };
13587
13907
  };
13588
13908
  prepareMySqlCreateTableJson = (table4, json22, internals) => {
@@ -13620,7 +13940,8 @@ var init_jsonStatements = __esm({
13620
13940
  return {
13621
13941
  type: "drop_table",
13622
13942
  tableName: table4.name,
13623
- schema: table4.schema
13943
+ schema: table4.schema,
13944
+ policies: table4.policies ? Object.values(table4.policies) : []
13624
13945
  };
13625
13946
  };
13626
13947
  prepareRenameTableJson = (tableFrom, tableTo) => {
@@ -13651,6 +13972,27 @@ var init_jsonStatements = __esm({
13651
13972
  };
13652
13973
  });
13653
13974
  };
13975
+ prepareDropEnumValues = (name2, schema4, removedValues, json22) => {
13976
+ if (!removedValues.length) return [];
13977
+ const affectedColumns = [];
13978
+ for (const tableKey2 in json22.tables) {
13979
+ const table4 = json22.tables[tableKey2];
13980
+ for (const columnKey in table4.columns) {
13981
+ const column4 = table4.columns[columnKey];
13982
+ if (column4.type === name2 && column4.typeSchema === schema4) {
13983
+ affectedColumns.push({ schema: table4.schema || "public", table: table4.name, column: column4.name });
13984
+ }
13985
+ }
13986
+ }
13987
+ return [{
13988
+ type: "alter_type_drop_value",
13989
+ name: name2,
13990
+ schema: schema4,
13991
+ deletedValues: removedValues,
13992
+ newValues: json22.enums[`${schema4}.${name2}`].values,
13993
+ columnsWithEnum: affectedColumns
13994
+ }];
13995
+ };
13654
13996
  prepareDropEnumJson = (name2, schema4) => {
13655
13997
  return {
13656
13998
  type: "drop_type_enum",
@@ -13717,6 +14059,41 @@ var init_jsonStatements = __esm({
13717
14059
  schema: schema4
13718
14060
  };
13719
14061
  };
14062
+ prepareCreateRoleJson = (role) => {
14063
+ return {
14064
+ type: "create_role",
14065
+ name: role.name,
14066
+ values: {
14067
+ createDb: role.createDb,
14068
+ createRole: role.createRole,
14069
+ inherit: role.inherit
14070
+ }
14071
+ };
14072
+ };
14073
+ prepareAlterRoleJson = (role) => {
14074
+ return {
14075
+ type: "alter_role",
14076
+ name: role.name,
14077
+ values: {
14078
+ createDb: role.createDb,
14079
+ createRole: role.createRole,
14080
+ inherit: role.inherit
14081
+ }
14082
+ };
14083
+ };
14084
+ prepareDropRoleJson = (name2) => {
14085
+ return {
14086
+ type: "drop_role",
14087
+ name: name2
14088
+ };
14089
+ };
14090
+ prepareRenameRoleJson = (nameFrom, nameTo) => {
14091
+ return {
14092
+ type: "rename_role",
14093
+ nameFrom,
14094
+ nameTo
14095
+ };
14096
+ };
13720
14097
  prepareCreateSchemasJson = (values) => {
13721
14098
  return values.map((it) => {
13722
14099
  return {
@@ -14613,6 +14990,46 @@ var init_jsonStatements = __esm({
14613
14990
  }
14614
14991
  return [...dropPkStatements, ...setPkStatements, ...statements];
14615
14992
  };
14993
+ prepareRenamePolicyJsons = (tableName, schema4, renames) => {
14994
+ return renames.map((it) => {
14995
+ return {
14996
+ type: "rename_policy",
14997
+ tableName,
14998
+ oldName: it.from.name,
14999
+ newName: it.to.name,
15000
+ schema: schema4
15001
+ };
15002
+ });
15003
+ };
15004
+ prepareCreatePolicyJsons = (tableName, schema4, policies) => {
15005
+ return policies.map((it) => {
15006
+ return {
15007
+ type: "create_policy",
15008
+ tableName,
15009
+ data: it,
15010
+ schema: schema4
15011
+ };
15012
+ });
15013
+ };
15014
+ prepareDropPolicyJsons = (tableName, schema4, policies) => {
15015
+ return policies.map((it) => {
15016
+ return {
15017
+ type: "drop_policy",
15018
+ tableName,
15019
+ data: it,
15020
+ schema: schema4
15021
+ };
15022
+ });
15023
+ };
15024
+ prepareAlterPolicyJson = (tableName, schema4, oldPolicy, newPolicy) => {
15025
+ return {
15026
+ type: "alter_policy",
15027
+ tableName,
15028
+ oldData: oldPolicy,
15029
+ newData: newPolicy,
15030
+ schema: schema4
15031
+ };
15032
+ };
14616
15033
  preparePgCreateIndexesJson = (tableName, schema4, indexes, fullSchema, action) => {
14617
15034
  if (action === "push") {
14618
15035
  return Object.values(indexes).map((indexData) => {
@@ -15318,7 +15735,8 @@ var init_snapshotsDiffer = __esm({
15318
15735
  indexes: recordType(stringType(), stringType()),
15319
15736
  foreignKeys: recordType(stringType(), stringType()),
15320
15737
  compositePrimaryKeys: recordType(stringType(), stringType()).default({}),
15321
- uniqueConstraints: recordType(stringType(), stringType()).default({})
15738
+ uniqueConstraints: recordType(stringType(), stringType()).default({}),
15739
+ policies: recordType(stringType(), stringType()).default({})
15322
15740
  }).strict();
15323
15741
  alteredTableScheme = objectType({
15324
15742
  name: stringType(),
@@ -15359,12 +15777,22 @@ var init_snapshotsDiffer = __esm({
15359
15777
  __new: stringType(),
15360
15778
  __old: stringType()
15361
15779
  })
15780
+ ),
15781
+ addedPolicies: recordType(stringType(), stringType()),
15782
+ deletedPolicies: recordType(stringType(), stringType()),
15783
+ alteredPolicies: recordType(
15784
+ stringType(),
15785
+ objectType({
15786
+ __new: stringType(),
15787
+ __old: stringType()
15788
+ })
15362
15789
  )
15363
15790
  }).strict();
15364
15791
  diffResultScheme = objectType({
15365
15792
  alteredTablesWithColumns: alteredTableScheme.array(),
15366
15793
  alteredEnums: changedEnumSchema.array(),
15367
- alteredSequences: sequenceSquashed.array()
15794
+ alteredSequences: sequenceSquashed.array(),
15795
+ alteredRoles: roleSchema.array()
15368
15796
  }).strict();
15369
15797
  diffResultSchemeMysql = objectType({
15370
15798
  alteredTablesWithColumns: alteredTableScheme.array(),
@@ -15419,7 +15847,7 @@ var init_snapshotsDiffer = __esm({
15419
15847
  }
15420
15848
  return column4;
15421
15849
  };
15422
- applyPgSnapshotsDiff = async (json1, json22, schemasResolver2, enumsResolver2, sequencesResolver2, tablesResolver2, columnsResolver2, prevFull, curFull, action) => {
15850
+ applyPgSnapshotsDiff = async (json1, json22, schemasResolver2, enumsResolver2, sequencesResolver2, policyResolver2, roleResolver2, tablesResolver2, columnsResolver2, prevFull, curFull, action) => {
15423
15851
  const schemasDiff = diffSchemasOrTables(json1.schemas, json22.schemas);
15424
15852
  const {
15425
15853
  created: createdSchemas,
@@ -15569,6 +15997,47 @@ var init_snapshotsDiffer = __esm({
15569
15997
  return [tableKey2, tableValue];
15570
15998
  }
15571
15999
  );
16000
+ const rolesDiff = diffSchemasOrTables(
16001
+ schemasPatchedSnap1.roles,
16002
+ json22.roles
16003
+ );
16004
+ const {
16005
+ created: createdRoles,
16006
+ deleted: deletedRoles,
16007
+ renamed: renamedRoles
16008
+ } = await roleResolver2({
16009
+ created: rolesDiff.added,
16010
+ deleted: rolesDiff.deleted
16011
+ });
16012
+ schemasPatchedSnap1.roles = mapEntries(
16013
+ schemasPatchedSnap1.roles,
16014
+ (_2, it) => {
16015
+ const { name: name2 } = nameChangeFor(it, renamedRoles);
16016
+ it.name = name2;
16017
+ return [name2, it];
16018
+ }
16019
+ );
16020
+ const rolesChangeMap = renamedRoles.reduce(
16021
+ (acc, it) => {
16022
+ acc[it.from.name] = {
16023
+ nameFrom: it.from.name,
16024
+ nameTo: it.to.name
16025
+ };
16026
+ return acc;
16027
+ },
16028
+ {}
16029
+ );
16030
+ schemasPatchedSnap1.roles = mapEntries(
16031
+ schemasPatchedSnap1.roles,
16032
+ (roleKey, roleValue) => {
16033
+ const key = roleKey;
16034
+ const change = rolesChangeMap[key];
16035
+ if (change) {
16036
+ roleValue.name = change.nameTo;
16037
+ }
16038
+ return [roleKey, roleValue];
16039
+ }
16040
+ );
15572
16041
  const tablesDiff = diffSchemasOrTables(
15573
16042
  schemasPatchedSnap1.tables,
15574
16043
  json22.tables
@@ -15647,6 +16116,65 @@ var init_snapshotsDiffer = __esm({
15647
16116
  return [tableKey2, tableValue];
15648
16117
  }
15649
16118
  );
16119
+ const policyRes = diffPolicies(tablesPatchedSnap1.tables, json22.tables);
16120
+ const policyRenames = [];
16121
+ const policyCreates = [];
16122
+ const policyDeletes = [];
16123
+ for (let entry of Object.values(policyRes)) {
16124
+ const { renamed, created, deleted } = await policyResolver2({
16125
+ tableName: entry.name,
16126
+ schema: entry.schema,
16127
+ deleted: entry.policies.deleted.map(PgSquasher.unsquashPolicy),
16128
+ created: entry.policies.added.map(PgSquasher.unsquashPolicy)
16129
+ });
16130
+ if (created.length > 0) {
16131
+ policyCreates.push({
16132
+ table: entry.name,
16133
+ schema: entry.schema,
16134
+ columns: created
16135
+ });
16136
+ }
16137
+ if (deleted.length > 0) {
16138
+ policyDeletes.push({
16139
+ table: entry.name,
16140
+ schema: entry.schema,
16141
+ columns: deleted
16142
+ });
16143
+ }
16144
+ if (renamed.length > 0) {
16145
+ policyRenames.push({
16146
+ table: entry.name,
16147
+ schema: entry.schema,
16148
+ renames: renamed
16149
+ });
16150
+ }
16151
+ }
16152
+ const policyRenamesDict = columnRenames.reduce(
16153
+ (acc, it) => {
16154
+ acc[`${it.schema || "public"}.${it.table}`] = it.renames;
16155
+ return acc;
16156
+ },
16157
+ {}
16158
+ );
16159
+ const policyPatchedSnap1 = copy(tablesPatchedSnap1);
16160
+ policyPatchedSnap1.tables = mapEntries(
16161
+ policyPatchedSnap1.tables,
16162
+ (tableKey2, tableValue) => {
16163
+ const patchedPolicies = mapKeys(
16164
+ tableValue.policies,
16165
+ (policyKey, policy2) => {
16166
+ const rens = policyRenamesDict[`${tableValue.schema || "public"}.${tableValue.name}`] || [];
16167
+ const newName = columnChangeFor(policyKey, rens);
16168
+ const unsquashedPolicy = PgSquasher.unsquashPolicy(policy2);
16169
+ unsquashedPolicy.name = newName;
16170
+ policy2 = PgSquasher.squashPolicy(unsquashedPolicy);
16171
+ return newName;
16172
+ }
16173
+ );
16174
+ tableValue.policies = patchedPolicies;
16175
+ return [tableKey2, tableValue];
16176
+ }
16177
+ );
15650
16178
  const diffResult = applyJsonDiff(columnsPatchedSnap1, json22);
15651
16179
  const typedResult = diffResultScheme.parse(diffResult);
15652
16180
  const jsonStatements = [];
@@ -15691,13 +16219,15 @@ var init_snapshotsDiffer = __esm({
15691
16219
  const jsonDeletedUniqueConstraints = [];
15692
16220
  const jsonAlteredUniqueConstraints = [];
15693
16221
  const jsonSetTableSchemas = [];
15694
- for (let it of movedTables) {
15695
- jsonSetTableSchemas.push({
15696
- type: "alter_table_set_schema",
15697
- tableName: it.name,
15698
- schemaFrom: it.schemaFrom || "public",
15699
- schemaTo: it.schemaTo || "public"
15700
- });
16222
+ if (movedTables) {
16223
+ for (let it of movedTables) {
16224
+ jsonSetTableSchemas.push({
16225
+ type: "alter_table_set_schema",
16226
+ tableName: it.name,
16227
+ schemaFrom: it.schemaFrom || "public",
16228
+ schemaTo: it.schemaTo || "public"
16229
+ });
16230
+ }
15701
16231
  }
15702
16232
  for (let it of alteredTables) {
15703
16233
  let addedColumns = [];
@@ -15802,7 +16332,99 @@ var init_snapshotsDiffer = __esm({
15802
16332
  it.deletedIndexes || {}
15803
16333
  );
15804
16334
  }).flat();
16335
+ const jsonCreatePoliciesStatements = [];
16336
+ const jsonDropPoliciesStatements = [];
16337
+ const jsonAlterPoliciesStatements = [];
16338
+ const jsonRenamePoliciesStatements = [];
16339
+ const jsonEnableRLSStatements = [];
16340
+ const jsonDisableRLSStatements = [];
16341
+ for (let it of policyRenames) {
16342
+ jsonRenamePoliciesStatements.push(
16343
+ ...prepareRenamePolicyJsons(it.table, it.schema, it.renames)
16344
+ );
16345
+ }
16346
+ for (const it of policyCreates) {
16347
+ jsonCreatePoliciesStatements.push(
16348
+ ...prepareCreatePolicyJsons(
16349
+ it.table,
16350
+ it.schema,
16351
+ it.columns
16352
+ )
16353
+ );
16354
+ }
16355
+ for (const it of policyDeletes) {
16356
+ jsonDropPoliciesStatements.push(
16357
+ ...prepareDropPolicyJsons(
16358
+ it.table,
16359
+ it.schema,
16360
+ it.columns
16361
+ )
16362
+ );
16363
+ }
15805
16364
  alteredTables.forEach((it) => {
16365
+ Object.keys(it.alteredPolicies).forEach((policyName) => {
16366
+ const newPolicy = PgSquasher.unsquashPolicy(it.alteredPolicies[policyName].__new);
16367
+ const oldPolicy = PgSquasher.unsquashPolicy(it.alteredPolicies[policyName].__old);
16368
+ if (newPolicy.as !== oldPolicy.as) {
16369
+ jsonDropPoliciesStatements.push(
16370
+ ...prepareDropPolicyJsons(
16371
+ it.name,
16372
+ it.schema,
16373
+ [oldPolicy]
16374
+ )
16375
+ );
16376
+ jsonCreatePoliciesStatements.push(
16377
+ ...prepareCreatePolicyJsons(
16378
+ it.name,
16379
+ it.schema,
16380
+ [newPolicy]
16381
+ )
16382
+ );
16383
+ return;
16384
+ }
16385
+ if (newPolicy.for !== oldPolicy.for) {
16386
+ jsonDropPoliciesStatements.push(
16387
+ ...prepareDropPolicyJsons(
16388
+ it.name,
16389
+ it.schema,
16390
+ [oldPolicy]
16391
+ )
16392
+ );
16393
+ jsonCreatePoliciesStatements.push(
16394
+ ...prepareCreatePolicyJsons(
16395
+ it.name,
16396
+ it.schema,
16397
+ [newPolicy]
16398
+ )
16399
+ );
16400
+ return;
16401
+ }
16402
+ jsonAlterPoliciesStatements.push(
16403
+ prepareAlterPolicyJson(
16404
+ it.name,
16405
+ it.schema,
16406
+ it.alteredPolicies[policyName].__old,
16407
+ it.alteredPolicies[policyName].__new
16408
+ )
16409
+ );
16410
+ });
16411
+ for (const table4 of Object.values(json22.tables)) {
16412
+ const policiesInCurrentState = Object.keys(table4.policies);
16413
+ const tableInPreviousState = columnsPatchedSnap1.tables[`${table4.schema === "" ? "public" : table4.schema}.${table4.name}`];
16414
+ const policiesInPreviousState = tableInPreviousState ? Object.keys(tableInPreviousState.policies) : [];
16415
+ if (policiesInPreviousState.length === 0 && policiesInCurrentState.length > 0) {
16416
+ jsonEnableRLSStatements.push({ type: "enable_rls", tableName: table4.name, schema: table4.schema });
16417
+ }
16418
+ if (policiesInPreviousState.length > 0 && policiesInCurrentState.length === 0) {
16419
+ jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
16420
+ }
16421
+ }
16422
+ for (const table4 of Object.values(columnsPatchedSnap1.tables)) {
16423
+ const tableInCurrentState = json22.tables[`${table4.schema === "" ? "public" : table4.schema}.${table4.name}`];
16424
+ if (tableInCurrentState === void 0) {
16425
+ jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
16426
+ }
16427
+ }
15806
16428
  const droppedIndexes = Object.keys(it.alteredIndexes).reduce(
15807
16429
  (current, item) => {
15808
16430
  current[item] = it.alteredIndexes[item].__old;
@@ -15872,6 +16494,9 @@ var init_snapshotsDiffer = __esm({
15872
16494
  const jsonAlterEnumsWithAddedValues = typedResult.alteredEnums.map((it) => {
15873
16495
  return prepareAddValuesToEnumJson(it.name, it.schema, it.addedValues);
15874
16496
  }).flat() ?? [];
16497
+ const jsonAlterEnumsWithDroppedValues = typedResult.alteredEnums.map((it) => {
16498
+ return prepareDropEnumValues(it.name, it.schema, it.deletedValues, curFull);
16499
+ }).flat() ?? [];
15875
16500
  const createSequences = createdSequences.map((it) => {
15876
16501
  return prepareCreateSequenceJson(it);
15877
16502
  }) ?? [];
@@ -15887,6 +16512,18 @@ var init_snapshotsDiffer = __esm({
15887
16512
  const jsonAlterSequences = typedResult.alteredSequences.map((it) => {
15888
16513
  return prepareAlterSequenceJson(it);
15889
16514
  }).flat() ?? [];
16515
+ const createRoles = createdRoles.map((it) => {
16516
+ return prepareCreateRoleJson(it);
16517
+ }) ?? [];
16518
+ const dropRoles = deletedRoles.map((it) => {
16519
+ return prepareDropRoleJson(it.name);
16520
+ });
16521
+ const renameRoles = renamedRoles.map((it) => {
16522
+ return prepareRenameRoleJson(it.from.name, it.to.name);
16523
+ });
16524
+ const jsonAlterRoles = typedResult.alteredRoles.map((it) => {
16525
+ return prepareAlterRoleJson(it);
16526
+ }).flat() ?? [];
15890
16527
  const createSchemas = prepareCreateSchemasJson(
15891
16528
  createdSchemas.map((it) => it.name)
15892
16529
  );
@@ -15899,6 +16536,11 @@ var init_snapshotsDiffer = __esm({
15899
16536
  const createTables = createdTables.map((it) => {
15900
16537
  return preparePgCreateTableJson(it, curFull);
15901
16538
  });
16539
+ jsonCreatePoliciesStatements.push(...[].concat(
16540
+ ...createdTables.map(
16541
+ (it) => prepareCreatePolicyJsons(it.name, it.schema, Object.values(it.policies).map(PgSquasher.unsquashPolicy))
16542
+ )
16543
+ ));
15902
16544
  jsonStatements.push(...createSchemas);
15903
16545
  jsonStatements.push(...renameSchemas);
15904
16546
  jsonStatements.push(...createEnums);
@@ -15909,7 +16551,13 @@ var init_snapshotsDiffer = __esm({
15909
16551
  jsonStatements.push(...moveSequences);
15910
16552
  jsonStatements.push(...renameSequences);
15911
16553
  jsonStatements.push(...jsonAlterSequences);
16554
+ jsonStatements.push(...renameRoles);
16555
+ jsonStatements.push(...dropRoles);
16556
+ jsonStatements.push(...createRoles);
16557
+ jsonStatements.push(...jsonAlterRoles);
15912
16558
  jsonStatements.push(...createTables);
16559
+ jsonStatements.push(...jsonEnableRLSStatements);
16560
+ jsonStatements.push(...jsonDisableRLSStatements);
15913
16561
  jsonStatements.push(...jsonDropTables);
15914
16562
  jsonStatements.push(...jsonSetTableSchemas);
15915
16563
  jsonStatements.push(...jsonRenameTables);
@@ -15929,6 +16577,11 @@ var init_snapshotsDiffer = __esm({
15929
16577
  jsonStatements.push(...jsonAlteredCompositePKs);
15930
16578
  jsonStatements.push(...jsonAddedUniqueConstraints);
15931
16579
  jsonStatements.push(...jsonAlteredUniqueConstraints);
16580
+ jsonStatements.push(...jsonAlterEnumsWithDroppedValues);
16581
+ jsonStatements.push(...jsonRenamePoliciesStatements);
16582
+ jsonStatements.push(...jsonDropPoliciesStatements);
16583
+ jsonStatements.push(...jsonCreatePoliciesStatements);
16584
+ jsonStatements.push(...jsonAlterPoliciesStatements);
15932
16585
  jsonStatements.push(...dropEnums);
15933
16586
  jsonStatements.push(...dropSequences);
15934
16587
  jsonStatements.push(...dropSchemas);
@@ -15949,7 +16602,17 @@ var init_snapshotsDiffer = __esm({
15949
16602
  }
15950
16603
  return true;
15951
16604
  });
15952
- const sqlStatements = fromJson(filteredJsonStatements, "postgresql");
16605
+ const filteredEnumsJsonStatements = filteredJsonStatements.filter((st) => {
16606
+ if (st.type === "alter_type_add_value") {
16607
+ if (jsonStatements.find(
16608
+ (it) => it.type === "alter_type_drop_value" && it.name === st.name && it.schema === st.schema
16609
+ )) {
16610
+ return false;
16611
+ }
16612
+ }
16613
+ return true;
16614
+ });
16615
+ const sqlStatements = fromJson(filteredEnumsJsonStatements, "postgresql");
15953
16616
  const uniqueSqlStatements = [];
15954
16617
  sqlStatements.forEach((ss) => {
15955
16618
  if (!uniqueSqlStatements.includes(ss)) {
@@ -15965,7 +16628,7 @@ var init_snapshotsDiffer = __esm({
15965
16628
  });
15966
16629
  const _meta = prepareMigrationMeta(rSchemas, rTables, rColumns);
15967
16630
  return {
15968
- statements: filteredJsonStatements,
16631
+ statements: filteredEnumsJsonStatements,
15969
16632
  sqlStatements: uniqueSqlStatements,
15970
16633
  _meta
15971
16634
  };
@@ -17000,7 +17663,7 @@ var init_outputs = __esm({
17000
17663
  });
17001
17664
 
17002
17665
  // src/cli/commands/migrate.ts
17003
- var import_hanji2, schemasResolver, tablesResolver, sequencesResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT;
17666
+ var import_hanji2, schemasResolver, tablesResolver, sequencesResolver, roleResolver, policyResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedConflict, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT;
17004
17667
  var init_migrate = __esm({
17005
17668
  "src/cli/commands/migrate.ts"() {
17006
17669
  "use strict";
@@ -17063,6 +17726,32 @@ var init_migrate = __esm({
17063
17726
  throw e;
17064
17727
  }
17065
17728
  };
17729
+ roleResolver = async (input) => {
17730
+ const result = await promptNamedConflict(
17731
+ input.created,
17732
+ input.deleted,
17733
+ "role"
17734
+ );
17735
+ return {
17736
+ created: result.created,
17737
+ deleted: result.deleted,
17738
+ renamed: result.renamed
17739
+ };
17740
+ };
17741
+ policyResolver = async (input) => {
17742
+ const result = await promptColumnsConflicts(
17743
+ input.tableName,
17744
+ input.created,
17745
+ input.deleted
17746
+ );
17747
+ return {
17748
+ tableName: input.tableName,
17749
+ schema: input.schema,
17750
+ created: result.created,
17751
+ deleted: result.deleted,
17752
+ renamed: result.renamed
17753
+ };
17754
+ };
17066
17755
  enumsResolver = async (input) => {
17067
17756
  try {
17068
17757
  const { created, deleted, moved, renamed } = await promptNamedWithSchemasConflict(
@@ -17145,6 +17834,56 @@ var init_migrate = __esm({
17145
17834
  result.deleted.push(...leftMissing);
17146
17835
  return result;
17147
17836
  };
17837
+ promptNamedConflict = async (newItems, missingItems, entity) => {
17838
+ if (missingItems.length === 0 || newItems.length === 0) {
17839
+ return {
17840
+ created: newItems,
17841
+ renamed: [],
17842
+ deleted: missingItems
17843
+ };
17844
+ }
17845
+ const result = { created: [], renamed: [], deleted: [] };
17846
+ let index4 = 0;
17847
+ let leftMissing = [...missingItems];
17848
+ do {
17849
+ const created = newItems[index4];
17850
+ const renames = leftMissing.map((it) => {
17851
+ return { from: it, to: created };
17852
+ });
17853
+ const promptData = [created, ...renames];
17854
+ const { status, data } = await (0, import_hanji2.render)(
17855
+ new ResolveSelectNamed(created, promptData, entity)
17856
+ );
17857
+ if (status === "aborted") {
17858
+ console.error("ERROR");
17859
+ process.exit(1);
17860
+ }
17861
+ if (isRenamePromptItem(data)) {
17862
+ console.log(
17863
+ `${source_default.yellow("~")} ${data.from.name} \u203A ${data.to.name} ${source_default.gray(
17864
+ `${entity} will be renamed/moved`
17865
+ )}`
17866
+ );
17867
+ if (data.from.name !== data.to.name) {
17868
+ result.renamed.push(data);
17869
+ }
17870
+ delete leftMissing[leftMissing.indexOf(data.from)];
17871
+ leftMissing = leftMissing.filter(Boolean);
17872
+ } else {
17873
+ console.log(
17874
+ `${source_default.green("+")} ${data.name} ${source_default.gray(
17875
+ `${entity} will be created`
17876
+ )}`
17877
+ );
17878
+ result.created.push(created);
17879
+ }
17880
+ index4 += 1;
17881
+ } while (index4 < newItems.length);
17882
+ console.log(source_default.gray(`--- all ${entity} conflicts resolved ---
17883
+ `));
17884
+ result.deleted.push(...leftMissing);
17885
+ return result;
17886
+ };
17148
17887
  promptNamedWithSchemasConflict = async (newItems, missingItems, entity) => {
17149
17888
  if (missingItems.length === 0 || newItems.length === 0) {
17150
17889
  return {
@@ -18701,8 +19440,8 @@ function parsePgArray(arrayString) {
18701
19440
  const [result] = parsePgNestedArray(arrayString, 1);
18702
19441
  return result;
18703
19442
  }
18704
- function makePgArray(array) {
18705
- return `{${array.map((item) => {
19443
+ function makePgArray(array2) {
19444
+ return `{${array2.map((item) => {
18706
19445
  if (Array.isArray(item)) {
18707
19446
  return makePgArray(item);
18708
19447
  }
@@ -19410,8 +20149,8 @@ var init_sql = __esm({
19410
20149
  sql2.param = param2;
19411
20150
  })(sql || (sql = {}));
19412
20151
  ((SQL2) => {
19413
- var _a324;
19414
- _a324 = entityKind;
20152
+ var _a326;
20153
+ _a326 = entityKind;
19415
20154
  const _Aliased = class _Aliased {
19416
20155
  constructor(sql2, fieldAlias) {
19417
20156
  /** @internal */
@@ -19427,7 +20166,7 @@ var init_sql = __esm({
19427
20166
  return new _Aliased(this.sql, this.fieldAlias);
19428
20167
  }
19429
20168
  };
19430
- __publicField(_Aliased, _a324, "SQL.Aliased");
20169
+ __publicField(_Aliased, _a326, "SQL.Aliased");
19431
20170
  let Aliased = _Aliased;
19432
20171
  SQL2.Aliased = Aliased;
19433
20172
  })(SQL || (SQL = {}));
@@ -19710,8 +20449,8 @@ function arrayContains(column4, values) {
19710
20449
  if (values.length === 0) {
19711
20450
  throw new Error("arrayContains requires at least one value");
19712
20451
  }
19713
- const array = sql`${bindIfParam(values, column4)}`;
19714
- return sql`${column4} @> ${array}`;
20452
+ const array2 = sql`${bindIfParam(values, column4)}`;
20453
+ return sql`${column4} @> ${array2}`;
19715
20454
  }
19716
20455
  return sql`${column4} @> ${bindIfParam(values, column4)}`;
19717
20456
  }
@@ -19720,8 +20459,8 @@ function arrayContained(column4, values) {
19720
20459
  if (values.length === 0) {
19721
20460
  throw new Error("arrayContained requires at least one value");
19722
20461
  }
19723
- const array = sql`${bindIfParam(values, column4)}`;
19724
- return sql`${column4} <@ ${array}`;
20462
+ const array2 = sql`${bindIfParam(values, column4)}`;
20463
+ return sql`${column4} <@ ${array2}`;
19725
20464
  }
19726
20465
  return sql`${column4} <@ ${bindIfParam(values, column4)}`;
19727
20466
  }
@@ -19730,8 +20469,8 @@ function arrayOverlaps(column4, values) {
19730
20469
  if (values.length === 0) {
19731
20470
  throw new Error("arrayOverlaps requires at least one value");
19732
20471
  }
19733
- const array = sql`${bindIfParam(values, column4)}`;
19734
- return sql`${column4} && ${array}`;
20472
+ const array2 = sql`${bindIfParam(values, column4)}`;
20473
+ return sql`${column4} && ${array2}`;
19735
20474
  }
19736
20475
  return sql`${column4} && ${bindIfParam(values, column4)}`;
19737
20476
  }
@@ -25397,6 +26136,67 @@ var init_indexes = __esm({
25397
26136
  }
25398
26137
  });
25399
26138
 
26139
+ // ../drizzle-orm/dist/pg-core/policies.js
26140
+ var _a147, PgPolicy;
26141
+ var init_policies = __esm({
26142
+ "../drizzle-orm/dist/pg-core/policies.js"() {
26143
+ "use strict";
26144
+ init_entity();
26145
+ _a147 = entityKind;
26146
+ PgPolicy = class {
26147
+ constructor(name2, config) {
26148
+ __publicField(this, "as");
26149
+ __publicField(this, "for");
26150
+ __publicField(this, "to");
26151
+ __publicField(this, "using");
26152
+ __publicField(this, "withCheck");
26153
+ this.name = name2;
26154
+ if (config) {
26155
+ this.as = config.as;
26156
+ this.for = config.for;
26157
+ this.to = config.to;
26158
+ this.using = config.using;
26159
+ this.withCheck = config.withCheck;
26160
+ }
26161
+ }
26162
+ };
26163
+ __publicField(PgPolicy, _a147, "PgPolicy");
26164
+ }
26165
+ });
26166
+
26167
+ // ../drizzle-orm/dist/pg-core/roles.js
26168
+ var _a148, PgRole;
26169
+ var init_roles = __esm({
26170
+ "../drizzle-orm/dist/pg-core/roles.js"() {
26171
+ "use strict";
26172
+ init_entity();
26173
+ _a148 = entityKind;
26174
+ PgRole = class {
26175
+ constructor(name2, config) {
26176
+ /** @internal */
26177
+ __publicField(this, "_existing");
26178
+ /** @internal */
26179
+ __publicField(this, "createDb");
26180
+ /** @internal */
26181
+ __publicField(this, "createRole");
26182
+ /** @internal */
26183
+ __publicField(this, "inherit");
26184
+ this.name = name2;
26185
+ if (config) {
26186
+ this.createDb = config.createDb;
26187
+ this.createRole = config.createRole;
26188
+ this.inherit = config.inherit;
26189
+ }
26190
+ }
26191
+ existing() {
26192
+ this._existing = true;
26193
+ return this;
26194
+ }
26195
+ };
26196
+ __publicField(PgRole, _a148, "PgRole");
26197
+ }
26198
+ });
26199
+
25400
26200
  // ../drizzle-orm/dist/pg-core/sequence.js
25401
26201
  function pgSequenceWithSchema(name2, options, schema4) {
25402
26202
  return new PgSequence(name2, options, schema4);
@@ -25404,12 +26204,12 @@ function pgSequenceWithSchema(name2, options, schema4) {
25404
26204
  function isPgSequence(obj) {
25405
26205
  return is(obj, PgSequence);
25406
26206
  }
25407
- var _a147, PgSequence;
26207
+ var _a149, PgSequence;
25408
26208
  var init_sequence = __esm({
25409
26209
  "../drizzle-orm/dist/pg-core/sequence.js"() {
25410
26210
  "use strict";
25411
26211
  init_entity();
25412
- _a147 = entityKind;
26212
+ _a149 = entityKind;
25413
26213
  PgSequence = class {
25414
26214
  constructor(seqName, seqOptions, schema4) {
25415
26215
  this.seqName = seqName;
@@ -25417,7 +26217,7 @@ var init_sequence = __esm({
25417
26217
  this.schema = schema4;
25418
26218
  }
25419
26219
  };
25420
- __publicField(PgSequence, _a147, "PgSequence");
26220
+ __publicField(PgSequence, _a149, "PgSequence");
25421
26221
  }
25422
26222
  });
25423
26223
 
@@ -25443,7 +26243,7 @@ function pgMaterializedViewWithSchema(name2, selection, schema4) {
25443
26243
  }
25444
26244
  return new MaterializedViewBuilder(name2, schema4);
25445
26245
  }
25446
- 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;
26246
+ 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;
25447
26247
  var init_view = __esm({
25448
26248
  "../drizzle-orm/dist/pg-core/view.js"() {
25449
26249
  "use strict";
@@ -25454,7 +26254,7 @@ var init_view = __esm({
25454
26254
  init_table2();
25455
26255
  init_view_base();
25456
26256
  init_view_common2();
25457
- _a148 = entityKind;
26257
+ _a150 = entityKind;
25458
26258
  DefaultViewBuilderCore = class {
25459
26259
  constructor(name2, schema4) {
25460
26260
  __publicField(this, "config", {});
@@ -25466,8 +26266,8 @@ var init_view = __esm({
25466
26266
  return this;
25467
26267
  }
25468
26268
  };
25469
- __publicField(DefaultViewBuilderCore, _a148, "PgDefaultViewBuilderCore");
25470
- ViewBuilder = class extends (_b107 = DefaultViewBuilderCore, _a149 = entityKind, _b107) {
26269
+ __publicField(DefaultViewBuilderCore, _a150, "PgDefaultViewBuilderCore");
26270
+ ViewBuilder = class extends (_b107 = DefaultViewBuilderCore, _a151 = entityKind, _b107) {
25471
26271
  as(qb) {
25472
26272
  if (typeof qb === "function") {
25473
26273
  qb = qb(new QueryBuilder());
@@ -25493,8 +26293,8 @@ var init_view = __esm({
25493
26293
  );
25494
26294
  }
25495
26295
  };
25496
- __publicField(ViewBuilder, _a149, "PgViewBuilder");
25497
- ManualViewBuilder = class extends (_b108 = DefaultViewBuilderCore, _a150 = entityKind, _b108) {
26296
+ __publicField(ViewBuilder, _a151, "PgViewBuilder");
26297
+ ManualViewBuilder = class extends (_b108 = DefaultViewBuilderCore, _a152 = entityKind, _b108) {
25498
26298
  constructor(name2, columns, schema4) {
25499
26299
  super(name2, schema4);
25500
26300
  __publicField(this, "columns");
@@ -25539,8 +26339,8 @@ var init_view = __esm({
25539
26339
  );
25540
26340
  }
25541
26341
  };
25542
- __publicField(ManualViewBuilder, _a150, "PgManualViewBuilder");
25543
- _a151 = entityKind;
26342
+ __publicField(ManualViewBuilder, _a152, "PgManualViewBuilder");
26343
+ _a153 = entityKind;
25544
26344
  MaterializedViewBuilderCore = class {
25545
26345
  constructor(name2, schema4) {
25546
26346
  __publicField(this, "config", {});
@@ -25564,8 +26364,8 @@ var init_view = __esm({
25564
26364
  return this;
25565
26365
  }
25566
26366
  };
25567
- __publicField(MaterializedViewBuilderCore, _a151, "PgMaterializedViewBuilderCore");
25568
- MaterializedViewBuilder = class extends (_b109 = MaterializedViewBuilderCore, _a152 = entityKind, _b109) {
26367
+ __publicField(MaterializedViewBuilderCore, _a153, "PgMaterializedViewBuilderCore");
26368
+ MaterializedViewBuilder = class extends (_b109 = MaterializedViewBuilderCore, _a154 = entityKind, _b109) {
25569
26369
  as(qb) {
25570
26370
  if (typeof qb === "function") {
25571
26371
  qb = qb(new QueryBuilder());
@@ -25596,8 +26396,8 @@ var init_view = __esm({
25596
26396
  );
25597
26397
  }
25598
26398
  };
25599
- __publicField(MaterializedViewBuilder, _a152, "PgMaterializedViewBuilder");
25600
- ManualMaterializedViewBuilder = class extends (_b110 = MaterializedViewBuilderCore, _a153 = entityKind, _b110) {
26399
+ __publicField(MaterializedViewBuilder, _a154, "PgMaterializedViewBuilder");
26400
+ ManualMaterializedViewBuilder = class extends (_b110 = MaterializedViewBuilderCore, _a155 = entityKind, _b110) {
25601
26401
  constructor(name2, columns, schema4) {
25602
26402
  super(name2, schema4);
25603
26403
  __publicField(this, "columns");
@@ -25642,11 +26442,11 @@ var init_view = __esm({
25642
26442
  );
25643
26443
  }
25644
26444
  };
25645
- __publicField(ManualMaterializedViewBuilder, _a153, "PgManualMaterializedViewBuilder");
25646
- PgView = class extends (_c4 = PgViewBase, _b111 = entityKind, _a154 = PgViewConfig, _c4) {
26445
+ __publicField(ManualMaterializedViewBuilder, _a155, "PgManualMaterializedViewBuilder");
26446
+ PgView = class extends (_c4 = PgViewBase, _b111 = entityKind, _a156 = PgViewConfig, _c4) {
25647
26447
  constructor({ pgConfig, config }) {
25648
26448
  super(config);
25649
- __publicField(this, _a154);
26449
+ __publicField(this, _a156);
25650
26450
  if (pgConfig) {
25651
26451
  this[PgViewConfig] = {
25652
26452
  with: pgConfig.with
@@ -25656,10 +26456,10 @@ var init_view = __esm({
25656
26456
  };
25657
26457
  __publicField(PgView, _b111, "PgView");
25658
26458
  PgMaterializedViewConfig = Symbol.for("drizzle:PgMaterializedViewConfig");
25659
- PgMaterializedView = class extends (_c5 = PgViewBase, _b112 = entityKind, _a155 = PgMaterializedViewConfig, _c5) {
26459
+ PgMaterializedView = class extends (_c5 = PgViewBase, _b112 = entityKind, _a157 = PgMaterializedViewConfig, _c5) {
25660
26460
  constructor({ pgConfig, config }) {
25661
26461
  super(config);
25662
- __publicField(this, _a155);
26462
+ __publicField(this, _a157);
25663
26463
  this[PgMaterializedViewConfig] = {
25664
26464
  with: pgConfig?.with,
25665
26465
  using: pgConfig?.using,
@@ -25673,7 +26473,7 @@ var init_view = __esm({
25673
26473
  });
25674
26474
 
25675
26475
  // ../drizzle-orm/dist/pg-core/schema.js
25676
- var _a156, PgSchema5;
26476
+ var _a158, PgSchema5;
25677
26477
  var init_schema = __esm({
25678
26478
  "../drizzle-orm/dist/pg-core/schema.js"() {
25679
26479
  "use strict";
@@ -25683,7 +26483,7 @@ var init_schema = __esm({
25683
26483
  init_sequence();
25684
26484
  init_table2();
25685
26485
  init_view();
25686
- _a156 = entityKind;
26486
+ _a158 = entityKind;
25687
26487
  PgSchema5 = class {
25688
26488
  constructor(schemaName) {
25689
26489
  __publicField(this, "table", (name2, columns, extraConfig) => {
@@ -25710,12 +26510,12 @@ var init_schema = __esm({
25710
26510
  return true;
25711
26511
  }
25712
26512
  };
25713
- __publicField(PgSchema5, _a156, "PgSchema");
26513
+ __publicField(PgSchema5, _a158, "PgSchema");
25714
26514
  }
25715
26515
  });
25716
26516
 
25717
26517
  // ../drizzle-orm/dist/pg-core/session.js
25718
- var _a157, PgPreparedQuery, _a158, PgSession, _a159, _b113, PgTransaction;
26518
+ var _a159, PgPreparedQuery, _a160, PgSession, _a161, _b113, PgTransaction;
25719
26519
  var init_session = __esm({
25720
26520
  "../drizzle-orm/dist/pg-core/session.js"() {
25721
26521
  "use strict";
@@ -25724,7 +26524,7 @@ var init_session = __esm({
25724
26524
  init_sql2();
25725
26525
  init_tracing();
25726
26526
  init_db();
25727
- _a157 = entityKind;
26527
+ _a159 = entityKind;
25728
26528
  PgPreparedQuery = class {
25729
26529
  constructor(query) {
25730
26530
  /** @internal */
@@ -25738,8 +26538,8 @@ var init_session = __esm({
25738
26538
  return response;
25739
26539
  }
25740
26540
  };
25741
- __publicField(PgPreparedQuery, _a157, "PgPreparedQuery");
25742
- _a158 = entityKind;
26541
+ __publicField(PgPreparedQuery, _a159, "PgPreparedQuery");
26542
+ _a160 = entityKind;
25743
26543
  PgSession = class {
25744
26544
  constructor(dialect4) {
25745
26545
  this.dialect = dialect4;
@@ -25772,8 +26572,8 @@ var init_session = __esm({
25772
26572
  );
25773
26573
  }
25774
26574
  };
25775
- __publicField(PgSession, _a158, "PgSession");
25776
- PgTransaction = class extends (_b113 = PgDatabase, _a159 = entityKind, _b113) {
26575
+ __publicField(PgSession, _a160, "PgSession");
26576
+ PgTransaction = class extends (_b113 = PgDatabase, _a161 = entityKind, _b113) {
25777
26577
  constructor(dialect4, session, schema4, nestedIndex = 0) {
25778
26578
  super(dialect4, session, schema4);
25779
26579
  this.schema = schema4;
@@ -25800,7 +26600,7 @@ var init_session = __esm({
25800
26600
  return this.session.execute(sql`set transaction ${this.getTransactionConfigSQL(config)}`);
25801
26601
  }
25802
26602
  };
25803
- __publicField(PgTransaction, _a159, "PgTransaction");
26603
+ __publicField(PgTransaction, _a161, "PgTransaction");
25804
26604
  }
25805
26605
  });
25806
26606
 
@@ -25821,10 +26621,12 @@ function getTableConfig(table4) {
25821
26621
  const uniqueConstraints = [];
25822
26622
  const name2 = table4[Table.Symbol.Name];
25823
26623
  const schema4 = table4[Table.Symbol.Schema];
26624
+ const policies = [];
25824
26625
  const extraConfigBuilder = table4[PgTable.Symbol.ExtraConfigBuilder];
25825
26626
  if (extraConfigBuilder !== void 0) {
25826
26627
  const extraConfig = extraConfigBuilder(table4[Table.Symbol.ExtraConfigColumns]);
25827
- for (const builder of Object.values(extraConfig)) {
26628
+ const extraValues = Array.isArray(extraConfig) ? extraConfig.flat(1) : Object.values(extraConfig);
26629
+ for (const builder of extraValues) {
25828
26630
  if (is(builder, IndexBuilder)) {
25829
26631
  indexes.push(builder.build(table4));
25830
26632
  } else if (is(builder, CheckBuilder)) {
@@ -25835,6 +26637,8 @@ function getTableConfig(table4) {
25835
26637
  primaryKeys.push(builder.build(table4));
25836
26638
  } else if (is(builder, ForeignKeyBuilder)) {
25837
26639
  foreignKeys.push(builder.build(table4));
26640
+ } else if (is(builder, PgPolicy)) {
26641
+ policies.push(builder);
25838
26642
  }
25839
26643
  }
25840
26644
  }
@@ -25846,7 +26650,8 @@ function getTableConfig(table4) {
25846
26650
  primaryKeys,
25847
26651
  uniqueConstraints,
25848
26652
  name: name2,
25849
- schema: schema4
26653
+ schema: schema4,
26654
+ policies
25850
26655
  };
25851
26656
  }
25852
26657
  var init_utils4 = __esm({
@@ -25858,6 +26663,7 @@ var init_utils4 = __esm({
25858
26663
  init_checks();
25859
26664
  init_foreign_keys();
25860
26665
  init_indexes();
26666
+ init_policies();
25861
26667
  init_primary_keys();
25862
26668
  init_unique_constraint();
25863
26669
  }
@@ -25882,8 +26688,10 @@ var init_pg_core = __esm({
25882
26688
  init_dialect();
25883
26689
  init_foreign_keys();
25884
26690
  init_indexes();
26691
+ init_policies();
25885
26692
  init_primary_keys();
25886
26693
  init_query_builders();
26694
+ init_roles();
25887
26695
  init_schema();
25888
26696
  init_sequence();
25889
26697
  init_session();
@@ -25910,9 +26718,9 @@ function minRangeForIdentityBasedOn(columnType) {
25910
26718
  function stringFromDatabaseIdentityProperty(field) {
25911
26719
  return typeof field === "string" ? field : typeof field === "undefined" ? void 0 : typeof field === "bigint" ? field.toString() : String(field);
25912
26720
  }
25913
- function buildArrayString(array, sqlType) {
26721
+ function buildArrayString(array2, sqlType) {
25914
26722
  sqlType = sqlType.split("[")[0];
25915
- const values = array.map((value) => {
26723
+ const values = array2.map((value) => {
25916
26724
  if (typeof value === "number" || typeof value === "bigint") {
25917
26725
  return value.toString();
25918
26726
  } else if (typeof value === "boolean") {
@@ -25934,6 +26742,40 @@ function buildArrayString(array, sqlType) {
25934
26742
  }).join(",");
25935
26743
  return `{${values}}`;
25936
26744
  }
26745
+ function prepareRoles(entities) {
26746
+ let useRoles = false;
26747
+ const includeRoles = [];
26748
+ const excludeRoles = [];
26749
+ if (entities && entities.roles) {
26750
+ if (typeof entities.roles === "object") {
26751
+ if (entities.roles.provider) {
26752
+ if (entities.roles.provider === "supabase") {
26753
+ excludeRoles.push(...[
26754
+ "anon",
26755
+ "authenticator",
26756
+ "authenticated",
26757
+ "service_role",
26758
+ "supabase_auth_admin",
26759
+ "supabase_storage_admin",
26760
+ "dashboard_user",
26761
+ "supabase_admin"
26762
+ ]);
26763
+ } else if (entities.roles.provider === "neon") {
26764
+ excludeRoles.push(...["authenticated", "anonymous"]);
26765
+ }
26766
+ }
26767
+ if (entities.roles.include) {
26768
+ includeRoles.push(...entities.roles.include);
26769
+ }
26770
+ if (entities.roles.exclude) {
26771
+ excludeRoles.push(...entities.roles.exclude);
26772
+ }
26773
+ } else {
26774
+ useRoles = entities.roles;
26775
+ }
26776
+ }
26777
+ return { useRoles, includeRoles, excludeRoles };
26778
+ }
25937
26779
  var indexName, generatePgSnapshot, trimChar, fromDatabase, defaultForColumn;
25938
26780
  var init_pgSerializer = __esm({
25939
26781
  "src/serializer/pgSerializer.ts"() {
@@ -25949,10 +26791,11 @@ var init_pgSerializer = __esm({
25949
26791
  indexName = (tableName, columns) => {
25950
26792
  return `${tableName}_${columns.join("_")}_index`;
25951
26793
  };
25952
- generatePgSnapshot = (tables, enums, schemas, sequences, casing2, schemaFilter) => {
26794
+ generatePgSnapshot = (tables, enums, schemas, sequences, roles, casing2, schemaFilter) => {
25953
26795
  const dialect4 = new PgDialect({ casing: casing2 });
25954
26796
  const result = {};
25955
26797
  const sequencesToReturn = {};
26798
+ const rolesToReturn = {};
25956
26799
  const indexesInSchema = {};
25957
26800
  for (const table4 of tables) {
25958
26801
  const {
@@ -25963,7 +26806,8 @@ var init_pgSerializer = __esm({
25963
26806
  checks,
25964
26807
  schema: schema4,
25965
26808
  primaryKeys,
25966
- uniqueConstraints
26809
+ uniqueConstraints,
26810
+ policies
25967
26811
  } = getTableConfig(table4);
25968
26812
  if (schemaFilter && !schemaFilter.includes(schema4 ?? "public")) {
25969
26813
  continue;
@@ -25973,6 +26817,7 @@ var init_pgSerializer = __esm({
25973
26817
  const foreignKeysObject = {};
25974
26818
  const primaryKeysObject = {};
25975
26819
  const uniqueConstraintObject = {};
26820
+ const policiesObject = {};
25976
26821
  columns.forEach((column4) => {
25977
26822
  const name2 = getColumnCasing(column4, casing2);
25978
26823
  const notNull = column4.notNull;
@@ -26235,6 +27080,34 @@ ${withStyle.errorWarning(
26235
27080
  with: value.config.with ?? {}
26236
27081
  };
26237
27082
  });
27083
+ policies.forEach((policy2) => {
27084
+ const mappedTo = [];
27085
+ if (!policy2.to) {
27086
+ mappedTo.push("public");
27087
+ } else {
27088
+ if (policy2.to && typeof policy2.to === "string") {
27089
+ mappedTo.push(policy2.to);
27090
+ } else if (policy2.to && is(policy2.to, PgRole)) {
27091
+ mappedTo.push(policy2.to.name);
27092
+ } else if (policy2.to && Array.isArray(policy2.to)) {
27093
+ policy2.to.forEach((it) => {
27094
+ if (typeof it === "string") {
27095
+ mappedTo.push(it);
27096
+ } else if (is(it, PgRole)) {
27097
+ mappedTo.push(it.name);
27098
+ }
27099
+ });
27100
+ }
27101
+ }
27102
+ policiesObject[policy2.name] = {
27103
+ name: policy2.name,
27104
+ as: policy2.as?.toUpperCase() ?? "PERMISSIVE",
27105
+ for: policy2.for?.toUpperCase() ?? "ALL",
27106
+ to: mappedTo.sort(),
27107
+ using: is(policy2.using, SQL) ? dialect4.sqlToQuery(policy2.using).sql : void 0,
27108
+ withCheck: is(policy2.withCheck, SQL) ? dialect4.sqlToQuery(policy2.withCheck).sql : void 0
27109
+ };
27110
+ });
26238
27111
  const tableKey2 = `${schema4 ?? "public"}.${tableName}`;
26239
27112
  result[tableKey2] = {
26240
27113
  name: tableName,
@@ -26243,7 +27116,8 @@ ${withStyle.errorWarning(
26243
27116
  indexes: indexesObject,
26244
27117
  foreignKeys: foreignKeysObject,
26245
27118
  compositePrimaryKeys: primaryKeysObject,
26246
- uniqueConstraints: uniqueConstraintObject
27119
+ uniqueConstraints: uniqueConstraintObject,
27120
+ policies: policiesObject
26247
27121
  };
26248
27122
  }
26249
27123
  for (const sequence of sequences) {
@@ -26267,6 +27141,16 @@ ${withStyle.errorWarning(
26267
27141
  } else {
26268
27142
  }
26269
27143
  }
27144
+ for (const role of roles) {
27145
+ if (!role._existing) {
27146
+ rolesToReturn[role.name] = {
27147
+ name: role.name,
27148
+ createDb: role.createDb === void 0 ? false : role.createDb,
27149
+ createRole: role.createRole === void 0 ? false : role.createRole,
27150
+ inherit: role.inherit === void 0 ? true : role.inherit
27151
+ };
27152
+ }
27153
+ }
26270
27154
  const enumsToReturn = enums.reduce((map, obj) => {
26271
27155
  const enumSchema3 = obj.schema || "public";
26272
27156
  const key = `${enumSchema3}.${obj.enumName}`;
@@ -26293,6 +27177,7 @@ ${withStyle.errorWarning(
26293
27177
  enums: enumsToReturn,
26294
27178
  schemas: schemasObject,
26295
27179
  sequences: sequencesToReturn,
27180
+ roles: rolesToReturn,
26296
27181
  _meta: {
26297
27182
  schemas: {},
26298
27183
  tables: {},
@@ -26307,7 +27192,7 @@ ${withStyle.errorWarning(
26307
27192
  while (end > start && str[end - 1] === char3) --end;
26308
27193
  return start > 0 || end < str.length ? str.substring(start, end) : str.toString();
26309
27194
  };
26310
- fromDatabase = async (db, tablesFilter = () => true, schemaFilters, progressCallback) => {
27195
+ fromDatabase = async (db, tablesFilter = () => true, schemaFilters, entities, progressCallback) => {
26311
27196
  const result = {};
26312
27197
  const internals = { tables: {} };
26313
27198
  const where = schemaFilters.map((t) => `table_schema = '${t}'`).join(" or ");
@@ -26389,6 +27274,60 @@ ${withStyle.errorWarning(
26389
27274
  if (progressCallback) {
26390
27275
  progressCallback("enums", Object.keys(enumsToReturn).length, "done");
26391
27276
  }
27277
+ const allRoles = await db.query(
27278
+ `SELECT rolname, rolinherit, rolcreatedb, rolcreaterole FROM pg_roles;`
27279
+ );
27280
+ const rolesToReturn = {};
27281
+ const preparedRoles = prepareRoles(entities);
27282
+ if (preparedRoles.useRoles || !(preparedRoles.includeRoles.length === 0 && preparedRoles.excludeRoles.length === 0)) {
27283
+ for (const dbRole of allRoles) {
27284
+ if (preparedRoles.useRoles) {
27285
+ rolesToReturn[dbRole.rolname] = {
27286
+ createDb: dbRole.rolcreatedb,
27287
+ createRole: dbRole.rolcreatedb,
27288
+ inherit: dbRole.rolinherit,
27289
+ name: dbRole.rolname
27290
+ };
27291
+ } else {
27292
+ if (preparedRoles.includeRoles.length === 0 && preparedRoles.excludeRoles.length === 0) continue;
27293
+ if (preparedRoles.includeRoles.includes(dbRole.rolname) && preparedRoles.excludeRoles.includes(dbRole.rolname)) continue;
27294
+ if (preparedRoles.excludeRoles.includes(dbRole.rolname)) continue;
27295
+ if (!preparedRoles.includeRoles.includes(dbRole.rolname)) continue;
27296
+ rolesToReturn[dbRole.rolname] = {
27297
+ createDb: dbRole.rolcreatedb,
27298
+ createRole: dbRole.rolcreaterole,
27299
+ inherit: dbRole.rolinherit,
27300
+ name: dbRole.rolname
27301
+ };
27302
+ }
27303
+ }
27304
+ }
27305
+ const wherePolicies = schemaFilters.map((t) => `schemaname = '${t}'`).join(" or ");
27306
+ const policiesByTable = {};
27307
+ 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}`};`);
27308
+ for (const dbPolicy of allPolicies) {
27309
+ const { tablename, schemaname, to, withCheck, using, ...rest } = dbPolicy;
27310
+ const tableForPolicy = policiesByTable[`${schemaname}.${tablename}`];
27311
+ const parsedTo = to;
27312
+ const parsedWithCheck = withCheck === null ? void 0 : withCheck;
27313
+ const parsedUsing = using === null ? void 0 : using;
27314
+ if (tableForPolicy) {
27315
+ tableForPolicy[dbPolicy.name] = { ...rest, to: parsedTo };
27316
+ } else {
27317
+ policiesByTable[`${schemaname}.${tablename}`] = {
27318
+ [dbPolicy.name]: { ...rest, to: parsedTo, withCheck: parsedWithCheck, using: parsedUsing }
27319
+ };
27320
+ }
27321
+ }
27322
+ if (progressCallback) {
27323
+ progressCallback(
27324
+ "policies",
27325
+ Object.values(policiesByTable).reduce((total, innerRecord) => {
27326
+ return total + Object.keys(innerRecord).length;
27327
+ }, 0),
27328
+ "done"
27329
+ );
27330
+ }
26392
27331
  const sequencesInColumns = [];
26393
27332
  const all = allTables.map((row) => {
26394
27333
  return new Promise(async (res, rej) => {
@@ -26782,7 +27721,8 @@ ${withStyle.errorWarning(
26782
27721
  indexes: indexToReturn,
26783
27722
  foreignKeys: foreignKeysToReturn,
26784
27723
  compositePrimaryKeys: primaryKeys,
26785
- uniqueConstraints: uniqueConstrains
27724
+ uniqueConstraints: uniqueConstrains,
27725
+ policies: policiesByTable[`${tableSchema}.${tableName}`] ?? {}
26786
27726
  };
26787
27727
  } catch (e) {
26788
27728
  rej(e);
@@ -26809,6 +27749,7 @@ ${withStyle.errorWarning(
26809
27749
  enums: enumsToReturn,
26810
27750
  schemas: schemasObject,
26811
27751
  sequences: sequencesToReturn,
27752
+ roles: rolesToReturn,
26812
27753
  _meta: {
26813
27754
  schemas: {},
26814
27755
  tables: {},
@@ -26931,12 +27872,12 @@ var init_alias3 = __esm({
26931
27872
  });
26932
27873
 
26933
27874
  // ../drizzle-orm/dist/sqlite-core/checks.js
26934
- var _a160, CheckBuilder2, _a161, Check2;
27875
+ var _a162, CheckBuilder2, _a163, Check2;
26935
27876
  var init_checks2 = __esm({
26936
27877
  "../drizzle-orm/dist/sqlite-core/checks.js"() {
26937
27878
  "use strict";
26938
27879
  init_entity();
26939
- _a160 = entityKind;
27880
+ _a162 = entityKind;
26940
27881
  CheckBuilder2 = class {
26941
27882
  constructor(name2, value) {
26942
27883
  __publicField(this, "brand");
@@ -26947,8 +27888,8 @@ var init_checks2 = __esm({
26947
27888
  return new Check2(table4, this);
26948
27889
  }
26949
27890
  };
26950
- __publicField(CheckBuilder2, _a160, "SQLiteCheckBuilder");
26951
- _a161 = entityKind;
27891
+ __publicField(CheckBuilder2, _a162, "SQLiteCheckBuilder");
27892
+ _a163 = entityKind;
26952
27893
  Check2 = class {
26953
27894
  constructor(table4, builder) {
26954
27895
  __publicField(this, "name");
@@ -26958,18 +27899,18 @@ var init_checks2 = __esm({
26958
27899
  this.value = builder.value;
26959
27900
  }
26960
27901
  };
26961
- __publicField(Check2, _a161, "SQLiteCheck");
27902
+ __publicField(Check2, _a163, "SQLiteCheck");
26962
27903
  }
26963
27904
  });
26964
27905
 
26965
27906
  // ../drizzle-orm/dist/sqlite-core/foreign-keys.js
26966
- var _a162, ForeignKeyBuilder2, _a163, ForeignKey2;
27907
+ var _a164, ForeignKeyBuilder2, _a165, ForeignKey2;
26967
27908
  var init_foreign_keys2 = __esm({
26968
27909
  "../drizzle-orm/dist/sqlite-core/foreign-keys.js"() {
26969
27910
  "use strict";
26970
27911
  init_entity();
26971
27912
  init_table_utils();
26972
- _a162 = entityKind;
27913
+ _a164 = entityKind;
26973
27914
  ForeignKeyBuilder2 = class {
26974
27915
  constructor(config, actions) {
26975
27916
  /** @internal */
@@ -27000,8 +27941,8 @@ var init_foreign_keys2 = __esm({
27000
27941
  return new ForeignKey2(table4, this);
27001
27942
  }
27002
27943
  };
27003
- __publicField(ForeignKeyBuilder2, _a162, "SQLiteForeignKeyBuilder");
27004
- _a163 = entityKind;
27944
+ __publicField(ForeignKeyBuilder2, _a164, "SQLiteForeignKeyBuilder");
27945
+ _a165 = entityKind;
27005
27946
  ForeignKey2 = class {
27006
27947
  constructor(table4, builder) {
27007
27948
  __publicField(this, "reference");
@@ -27025,7 +27966,7 @@ var init_foreign_keys2 = __esm({
27025
27966
  return name2 ?? `${chunks.join("_")}_fk`;
27026
27967
  }
27027
27968
  };
27028
- __publicField(ForeignKey2, _a163, "SQLiteForeignKey");
27969
+ __publicField(ForeignKey2, _a165, "SQLiteForeignKey");
27029
27970
  }
27030
27971
  });
27031
27972
 
@@ -27033,13 +27974,13 @@ var init_foreign_keys2 = __esm({
27033
27974
  function uniqueKeyName2(table4, columns) {
27034
27975
  return `${table4[TableName]}_${columns.join("_")}_unique`;
27035
27976
  }
27036
- var _a164, UniqueConstraintBuilder2, _a165, UniqueOnConstraintBuilder2, _a166, UniqueConstraint2;
27977
+ var _a166, UniqueConstraintBuilder2, _a167, UniqueOnConstraintBuilder2, _a168, UniqueConstraint2;
27037
27978
  var init_unique_constraint2 = __esm({
27038
27979
  "../drizzle-orm/dist/sqlite-core/unique-constraint.js"() {
27039
27980
  "use strict";
27040
27981
  init_entity();
27041
27982
  init_table_utils();
27042
- _a164 = entityKind;
27983
+ _a166 = entityKind;
27043
27984
  UniqueConstraintBuilder2 = class {
27044
27985
  constructor(columns, name2) {
27045
27986
  /** @internal */
@@ -27052,8 +27993,8 @@ var init_unique_constraint2 = __esm({
27052
27993
  return new UniqueConstraint2(table4, this.columns, this.name);
27053
27994
  }
27054
27995
  };
27055
- __publicField(UniqueConstraintBuilder2, _a164, "SQLiteUniqueConstraintBuilder");
27056
- _a165 = entityKind;
27996
+ __publicField(UniqueConstraintBuilder2, _a166, "SQLiteUniqueConstraintBuilder");
27997
+ _a167 = entityKind;
27057
27998
  UniqueOnConstraintBuilder2 = class {
27058
27999
  constructor(name2) {
27059
28000
  /** @internal */
@@ -27064,8 +28005,8 @@ var init_unique_constraint2 = __esm({
27064
28005
  return new UniqueConstraintBuilder2(columns, this.name);
27065
28006
  }
27066
28007
  };
27067
- __publicField(UniqueOnConstraintBuilder2, _a165, "SQLiteUniqueOnConstraintBuilder");
27068
- _a166 = entityKind;
28008
+ __publicField(UniqueOnConstraintBuilder2, _a167, "SQLiteUniqueOnConstraintBuilder");
28009
+ _a168 = entityKind;
27069
28010
  UniqueConstraint2 = class {
27070
28011
  constructor(table4, columns, name2) {
27071
28012
  __publicField(this, "columns");
@@ -27078,12 +28019,12 @@ var init_unique_constraint2 = __esm({
27078
28019
  return this.name;
27079
28020
  }
27080
28021
  };
27081
- __publicField(UniqueConstraint2, _a166, "SQLiteUniqueConstraint");
28022
+ __publicField(UniqueConstraint2, _a168, "SQLiteUniqueConstraint");
27082
28023
  }
27083
28024
  });
27084
28025
 
27085
28026
  // ../drizzle-orm/dist/sqlite-core/columns/common.js
27086
- var _a167, _b114, SQLiteColumnBuilder, _a168, _b115, SQLiteColumn;
28027
+ var _a169, _b114, SQLiteColumnBuilder, _a170, _b115, SQLiteColumn;
27087
28028
  var init_common3 = __esm({
27088
28029
  "../drizzle-orm/dist/sqlite-core/columns/common.js"() {
27089
28030
  "use strict";
@@ -27092,7 +28033,7 @@ var init_common3 = __esm({
27092
28033
  init_entity();
27093
28034
  init_foreign_keys2();
27094
28035
  init_unique_constraint2();
27095
- SQLiteColumnBuilder = class extends (_b114 = ColumnBuilder, _a167 = entityKind, _b114) {
28036
+ SQLiteColumnBuilder = class extends (_b114 = ColumnBuilder, _a169 = entityKind, _b114) {
27096
28037
  constructor() {
27097
28038
  super(...arguments);
27098
28039
  __publicField(this, "foreignKeyConfigs", []);
@@ -27133,8 +28074,8 @@ var init_common3 = __esm({
27133
28074
  });
27134
28075
  }
27135
28076
  };
27136
- __publicField(SQLiteColumnBuilder, _a167, "SQLiteColumnBuilder");
27137
- SQLiteColumn = class extends (_b115 = Column2, _a168 = entityKind, _b115) {
28077
+ __publicField(SQLiteColumnBuilder, _a169, "SQLiteColumnBuilder");
28078
+ SQLiteColumn = class extends (_b115 = Column2, _a170 = entityKind, _b115) {
27138
28079
  constructor(table4, config) {
27139
28080
  if (!config.uniqueName) {
27140
28081
  config.uniqueName = uniqueKeyName2(table4, [config.name]);
@@ -27143,7 +28084,7 @@ var init_common3 = __esm({
27143
28084
  this.table = table4;
27144
28085
  }
27145
28086
  };
27146
- __publicField(SQLiteColumn, _a168, "SQLiteColumn");
28087
+ __publicField(SQLiteColumn, _a170, "SQLiteColumn");
27147
28088
  }
27148
28089
  });
27149
28090
 
@@ -27158,14 +28099,14 @@ function blob(a, b) {
27158
28099
  }
27159
28100
  return new SQLiteBlobBufferBuilder(name2);
27160
28101
  }
27161
- var _a169, _b116, SQLiteBigIntBuilder, _a170, _b117, SQLiteBigInt, _a171, _b118, SQLiteBlobJsonBuilder, _a172, _b119, SQLiteBlobJson, _a173, _b120, SQLiteBlobBufferBuilder, _a174, _b121, SQLiteBlobBuffer;
28102
+ var _a171, _b116, SQLiteBigIntBuilder, _a172, _b117, SQLiteBigInt, _a173, _b118, SQLiteBlobJsonBuilder, _a174, _b119, SQLiteBlobJson, _a175, _b120, SQLiteBlobBufferBuilder, _a176, _b121, SQLiteBlobBuffer;
27162
28103
  var init_blob = __esm({
27163
28104
  "../drizzle-orm/dist/sqlite-core/columns/blob.js"() {
27164
28105
  "use strict";
27165
28106
  init_entity();
27166
28107
  init_utils2();
27167
28108
  init_common3();
27168
- SQLiteBigIntBuilder = class extends (_b116 = SQLiteColumnBuilder, _a169 = entityKind, _b116) {
28109
+ SQLiteBigIntBuilder = class extends (_b116 = SQLiteColumnBuilder, _a171 = entityKind, _b116) {
27169
28110
  constructor(name2) {
27170
28111
  super(name2, "bigint", "SQLiteBigInt");
27171
28112
  }
@@ -27174,8 +28115,8 @@ var init_blob = __esm({
27174
28115
  return new SQLiteBigInt(table4, this.config);
27175
28116
  }
27176
28117
  };
27177
- __publicField(SQLiteBigIntBuilder, _a169, "SQLiteBigIntBuilder");
27178
- SQLiteBigInt = class extends (_b117 = SQLiteColumn, _a170 = entityKind, _b117) {
28118
+ __publicField(SQLiteBigIntBuilder, _a171, "SQLiteBigIntBuilder");
28119
+ SQLiteBigInt = class extends (_b117 = SQLiteColumn, _a172 = entityKind, _b117) {
27179
28120
  getSQLType() {
27180
28121
  return "blob";
27181
28122
  }
@@ -27186,8 +28127,8 @@ var init_blob = __esm({
27186
28127
  return Buffer.from(value.toString());
27187
28128
  }
27188
28129
  };
27189
- __publicField(SQLiteBigInt, _a170, "SQLiteBigInt");
27190
- SQLiteBlobJsonBuilder = class extends (_b118 = SQLiteColumnBuilder, _a171 = entityKind, _b118) {
28130
+ __publicField(SQLiteBigInt, _a172, "SQLiteBigInt");
28131
+ SQLiteBlobJsonBuilder = class extends (_b118 = SQLiteColumnBuilder, _a173 = entityKind, _b118) {
27191
28132
  constructor(name2) {
27192
28133
  super(name2, "json", "SQLiteBlobJson");
27193
28134
  }
@@ -27199,8 +28140,8 @@ var init_blob = __esm({
27199
28140
  );
27200
28141
  }
27201
28142
  };
27202
- __publicField(SQLiteBlobJsonBuilder, _a171, "SQLiteBlobJsonBuilder");
27203
- SQLiteBlobJson = class extends (_b119 = SQLiteColumn, _a172 = entityKind, _b119) {
28143
+ __publicField(SQLiteBlobJsonBuilder, _a173, "SQLiteBlobJsonBuilder");
28144
+ SQLiteBlobJson = class extends (_b119 = SQLiteColumn, _a174 = entityKind, _b119) {
27204
28145
  getSQLType() {
27205
28146
  return "blob";
27206
28147
  }
@@ -27211,8 +28152,8 @@ var init_blob = __esm({
27211
28152
  return Buffer.from(JSON.stringify(value));
27212
28153
  }
27213
28154
  };
27214
- __publicField(SQLiteBlobJson, _a172, "SQLiteBlobJson");
27215
- SQLiteBlobBufferBuilder = class extends (_b120 = SQLiteColumnBuilder, _a173 = entityKind, _b120) {
28155
+ __publicField(SQLiteBlobJson, _a174, "SQLiteBlobJson");
28156
+ SQLiteBlobBufferBuilder = class extends (_b120 = SQLiteColumnBuilder, _a175 = entityKind, _b120) {
27216
28157
  constructor(name2) {
27217
28158
  super(name2, "buffer", "SQLiteBlobBuffer");
27218
28159
  }
@@ -27221,13 +28162,13 @@ var init_blob = __esm({
27221
28162
  return new SQLiteBlobBuffer(table4, this.config);
27222
28163
  }
27223
28164
  };
27224
- __publicField(SQLiteBlobBufferBuilder, _a173, "SQLiteBlobBufferBuilder");
27225
- SQLiteBlobBuffer = class extends (_b121 = SQLiteColumn, _a174 = entityKind, _b121) {
28165
+ __publicField(SQLiteBlobBufferBuilder, _a175, "SQLiteBlobBufferBuilder");
28166
+ SQLiteBlobBuffer = class extends (_b121 = SQLiteColumn, _a176 = entityKind, _b121) {
27226
28167
  getSQLType() {
27227
28168
  return "blob";
27228
28169
  }
27229
28170
  };
27230
- __publicField(SQLiteBlobBuffer, _a174, "SQLiteBlobBuffer");
28171
+ __publicField(SQLiteBlobBuffer, _a176, "SQLiteBlobBuffer");
27231
28172
  }
27232
28173
  });
27233
28174
 
@@ -27242,14 +28183,14 @@ function customType2(customTypeParams) {
27242
28183
  );
27243
28184
  };
27244
28185
  }
27245
- var _a175, _b122, SQLiteCustomColumnBuilder, _a176, _b123, SQLiteCustomColumn;
28186
+ var _a177, _b122, SQLiteCustomColumnBuilder, _a178, _b123, SQLiteCustomColumn;
27246
28187
  var init_custom2 = __esm({
27247
28188
  "../drizzle-orm/dist/sqlite-core/columns/custom.js"() {
27248
28189
  "use strict";
27249
28190
  init_entity();
27250
28191
  init_utils2();
27251
28192
  init_common3();
27252
- SQLiteCustomColumnBuilder = class extends (_b122 = SQLiteColumnBuilder, _a175 = entityKind, _b122) {
28193
+ SQLiteCustomColumnBuilder = class extends (_b122 = SQLiteColumnBuilder, _a177 = entityKind, _b122) {
27253
28194
  constructor(name2, fieldConfig, customTypeParams) {
27254
28195
  super(name2, "custom", "SQLiteCustomColumn");
27255
28196
  this.config.fieldConfig = fieldConfig;
@@ -27263,8 +28204,8 @@ var init_custom2 = __esm({
27263
28204
  );
27264
28205
  }
27265
28206
  };
27266
- __publicField(SQLiteCustomColumnBuilder, _a175, "SQLiteCustomColumnBuilder");
27267
- SQLiteCustomColumn = class extends (_b123 = SQLiteColumn, _a176 = entityKind, _b123) {
28207
+ __publicField(SQLiteCustomColumnBuilder, _a177, "SQLiteCustomColumnBuilder");
28208
+ SQLiteCustomColumn = class extends (_b123 = SQLiteColumn, _a178 = entityKind, _b123) {
27268
28209
  constructor(table4, config) {
27269
28210
  super(table4, config);
27270
28211
  __publicField(this, "sqlName");
@@ -27284,7 +28225,7 @@ var init_custom2 = __esm({
27284
28225
  return typeof this.mapTo === "function" ? this.mapTo(value) : value;
27285
28226
  }
27286
28227
  };
27287
- __publicField(SQLiteCustomColumn, _a176, "SQLiteCustomColumn");
28228
+ __publicField(SQLiteCustomColumn, _a178, "SQLiteCustomColumn");
27288
28229
  }
27289
28230
  });
27290
28231
 
@@ -27299,7 +28240,7 @@ function integer2(a, b) {
27299
28240
  }
27300
28241
  return new SQLiteIntegerBuilder(name2);
27301
28242
  }
27302
- 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;
28243
+ 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;
27303
28244
  var init_integer2 = __esm({
27304
28245
  "../drizzle-orm/dist/sqlite-core/columns/integer.js"() {
27305
28246
  "use strict";
@@ -27307,7 +28248,7 @@ var init_integer2 = __esm({
27307
28248
  init_sql();
27308
28249
  init_utils2();
27309
28250
  init_common3();
27310
- SQLiteBaseIntegerBuilder = class extends (_b124 = SQLiteColumnBuilder, _a177 = entityKind, _b124) {
28251
+ SQLiteBaseIntegerBuilder = class extends (_b124 = SQLiteColumnBuilder, _a179 = entityKind, _b124) {
27311
28252
  constructor(name2, dataType, columnType) {
27312
28253
  super(name2, dataType, columnType);
27313
28254
  this.config.autoIncrement = false;
@@ -27320,8 +28261,8 @@ var init_integer2 = __esm({
27320
28261
  return super.primaryKey();
27321
28262
  }
27322
28263
  };
27323
- __publicField(SQLiteBaseIntegerBuilder, _a177, "SQLiteBaseIntegerBuilder");
27324
- SQLiteBaseInteger = class extends (_b125 = SQLiteColumn, _a178 = entityKind, _b125) {
28264
+ __publicField(SQLiteBaseIntegerBuilder, _a179, "SQLiteBaseIntegerBuilder");
28265
+ SQLiteBaseInteger = class extends (_b125 = SQLiteColumn, _a180 = entityKind, _b125) {
27325
28266
  constructor() {
27326
28267
  super(...arguments);
27327
28268
  __publicField(this, "autoIncrement", this.config.autoIncrement);
@@ -27330,8 +28271,8 @@ var init_integer2 = __esm({
27330
28271
  return "integer";
27331
28272
  }
27332
28273
  };
27333
- __publicField(SQLiteBaseInteger, _a178, "SQLiteBaseInteger");
27334
- SQLiteIntegerBuilder = class extends (_b126 = SQLiteBaseIntegerBuilder, _a179 = entityKind, _b126) {
28274
+ __publicField(SQLiteBaseInteger, _a180, "SQLiteBaseInteger");
28275
+ SQLiteIntegerBuilder = class extends (_b126 = SQLiteBaseIntegerBuilder, _a181 = entityKind, _b126) {
27335
28276
  constructor(name2) {
27336
28277
  super(name2, "number", "SQLiteInteger");
27337
28278
  }
@@ -27342,11 +28283,11 @@ var init_integer2 = __esm({
27342
28283
  );
27343
28284
  }
27344
28285
  };
27345
- __publicField(SQLiteIntegerBuilder, _a179, "SQLiteIntegerBuilder");
27346
- SQLiteInteger = class extends (_b127 = SQLiteBaseInteger, _a180 = entityKind, _b127) {
28286
+ __publicField(SQLiteIntegerBuilder, _a181, "SQLiteIntegerBuilder");
28287
+ SQLiteInteger = class extends (_b127 = SQLiteBaseInteger, _a182 = entityKind, _b127) {
27347
28288
  };
27348
- __publicField(SQLiteInteger, _a180, "SQLiteInteger");
27349
- SQLiteTimestampBuilder = class extends (_b128 = SQLiteBaseIntegerBuilder, _a181 = entityKind, _b128) {
28289
+ __publicField(SQLiteInteger, _a182, "SQLiteInteger");
28290
+ SQLiteTimestampBuilder = class extends (_b128 = SQLiteBaseIntegerBuilder, _a183 = entityKind, _b128) {
27350
28291
  constructor(name2, mode) {
27351
28292
  super(name2, "date", "SQLiteTimestamp");
27352
28293
  this.config.mode = mode;
@@ -27366,8 +28307,8 @@ var init_integer2 = __esm({
27366
28307
  );
27367
28308
  }
27368
28309
  };
27369
- __publicField(SQLiteTimestampBuilder, _a181, "SQLiteTimestampBuilder");
27370
- SQLiteTimestamp = class extends (_b129 = SQLiteBaseInteger, _a182 = entityKind, _b129) {
28310
+ __publicField(SQLiteTimestampBuilder, _a183, "SQLiteTimestampBuilder");
28311
+ SQLiteTimestamp = class extends (_b129 = SQLiteBaseInteger, _a184 = entityKind, _b129) {
27371
28312
  constructor() {
27372
28313
  super(...arguments);
27373
28314
  __publicField(this, "mode", this.config.mode);
@@ -27386,8 +28327,8 @@ var init_integer2 = __esm({
27386
28327
  return unix;
27387
28328
  }
27388
28329
  };
27389
- __publicField(SQLiteTimestamp, _a182, "SQLiteTimestamp");
27390
- SQLiteBooleanBuilder = class extends (_b130 = SQLiteBaseIntegerBuilder, _a183 = entityKind, _b130) {
28330
+ __publicField(SQLiteTimestamp, _a184, "SQLiteTimestamp");
28331
+ SQLiteBooleanBuilder = class extends (_b130 = SQLiteBaseIntegerBuilder, _a185 = entityKind, _b130) {
27391
28332
  constructor(name2, mode) {
27392
28333
  super(name2, "boolean", "SQLiteBoolean");
27393
28334
  this.config.mode = mode;
@@ -27399,8 +28340,8 @@ var init_integer2 = __esm({
27399
28340
  );
27400
28341
  }
27401
28342
  };
27402
- __publicField(SQLiteBooleanBuilder, _a183, "SQLiteBooleanBuilder");
27403
- SQLiteBoolean = class extends (_b131 = SQLiteBaseInteger, _a184 = entityKind, _b131) {
28343
+ __publicField(SQLiteBooleanBuilder, _a185, "SQLiteBooleanBuilder");
28344
+ SQLiteBoolean = class extends (_b131 = SQLiteBaseInteger, _a186 = entityKind, _b131) {
27404
28345
  constructor() {
27405
28346
  super(...arguments);
27406
28347
  __publicField(this, "mode", this.config.mode);
@@ -27412,7 +28353,7 @@ var init_integer2 = __esm({
27412
28353
  return value ? 1 : 0;
27413
28354
  }
27414
28355
  };
27415
- __publicField(SQLiteBoolean, _a184, "SQLiteBoolean");
28356
+ __publicField(SQLiteBoolean, _a186, "SQLiteBoolean");
27416
28357
  }
27417
28358
  });
27418
28359
 
@@ -27420,13 +28361,13 @@ var init_integer2 = __esm({
27420
28361
  function numeric2(name2) {
27421
28362
  return new SQLiteNumericBuilder(name2 ?? "");
27422
28363
  }
27423
- var _a185, _b132, SQLiteNumericBuilder, _a186, _b133, SQLiteNumeric;
28364
+ var _a187, _b132, SQLiteNumericBuilder, _a188, _b133, SQLiteNumeric;
27424
28365
  var init_numeric2 = __esm({
27425
28366
  "../drizzle-orm/dist/sqlite-core/columns/numeric.js"() {
27426
28367
  "use strict";
27427
28368
  init_entity();
27428
28369
  init_common3();
27429
- SQLiteNumericBuilder = class extends (_b132 = SQLiteColumnBuilder, _a185 = entityKind, _b132) {
28370
+ SQLiteNumericBuilder = class extends (_b132 = SQLiteColumnBuilder, _a187 = entityKind, _b132) {
27430
28371
  constructor(name2) {
27431
28372
  super(name2, "string", "SQLiteNumeric");
27432
28373
  }
@@ -27438,13 +28379,13 @@ var init_numeric2 = __esm({
27438
28379
  );
27439
28380
  }
27440
28381
  };
27441
- __publicField(SQLiteNumericBuilder, _a185, "SQLiteNumericBuilder");
27442
- SQLiteNumeric = class extends (_b133 = SQLiteColumn, _a186 = entityKind, _b133) {
28382
+ __publicField(SQLiteNumericBuilder, _a187, "SQLiteNumericBuilder");
28383
+ SQLiteNumeric = class extends (_b133 = SQLiteColumn, _a188 = entityKind, _b133) {
27443
28384
  getSQLType() {
27444
28385
  return "numeric";
27445
28386
  }
27446
28387
  };
27447
- __publicField(SQLiteNumeric, _a186, "SQLiteNumeric");
28388
+ __publicField(SQLiteNumeric, _a188, "SQLiteNumeric");
27448
28389
  }
27449
28390
  });
27450
28391
 
@@ -27452,13 +28393,13 @@ var init_numeric2 = __esm({
27452
28393
  function real2(name2) {
27453
28394
  return new SQLiteRealBuilder(name2 ?? "");
27454
28395
  }
27455
- var _a187, _b134, SQLiteRealBuilder, _a188, _b135, SQLiteReal;
28396
+ var _a189, _b134, SQLiteRealBuilder, _a190, _b135, SQLiteReal;
27456
28397
  var init_real2 = __esm({
27457
28398
  "../drizzle-orm/dist/sqlite-core/columns/real.js"() {
27458
28399
  "use strict";
27459
28400
  init_entity();
27460
28401
  init_common3();
27461
- SQLiteRealBuilder = class extends (_b134 = SQLiteColumnBuilder, _a187 = entityKind, _b134) {
28402
+ SQLiteRealBuilder = class extends (_b134 = SQLiteColumnBuilder, _a189 = entityKind, _b134) {
27462
28403
  constructor(name2) {
27463
28404
  super(name2, "number", "SQLiteReal");
27464
28405
  }
@@ -27467,13 +28408,13 @@ var init_real2 = __esm({
27467
28408
  return new SQLiteReal(table4, this.config);
27468
28409
  }
27469
28410
  };
27470
- __publicField(SQLiteRealBuilder, _a187, "SQLiteRealBuilder");
27471
- SQLiteReal = class extends (_b135 = SQLiteColumn, _a188 = entityKind, _b135) {
28411
+ __publicField(SQLiteRealBuilder, _a189, "SQLiteRealBuilder");
28412
+ SQLiteReal = class extends (_b135 = SQLiteColumn, _a190 = entityKind, _b135) {
27472
28413
  getSQLType() {
27473
28414
  return "real";
27474
28415
  }
27475
28416
  };
27476
- __publicField(SQLiteReal, _a188, "SQLiteReal");
28417
+ __publicField(SQLiteReal, _a190, "SQLiteReal");
27477
28418
  }
27478
28419
  });
27479
28420
 
@@ -27485,14 +28426,14 @@ function text2(a, b = {}) {
27485
28426
  }
27486
28427
  return new SQLiteTextBuilder(name2, config);
27487
28428
  }
27488
- var _a189, _b136, SQLiteTextBuilder, _a190, _b137, SQLiteText, _a191, _b138, SQLiteTextJsonBuilder, _a192, _b139, SQLiteTextJson;
28429
+ var _a191, _b136, SQLiteTextBuilder, _a192, _b137, SQLiteText, _a193, _b138, SQLiteTextJsonBuilder, _a194, _b139, SQLiteTextJson;
27489
28430
  var init_text2 = __esm({
27490
28431
  "../drizzle-orm/dist/sqlite-core/columns/text.js"() {
27491
28432
  "use strict";
27492
28433
  init_entity();
27493
28434
  init_utils2();
27494
28435
  init_common3();
27495
- SQLiteTextBuilder = class extends (_b136 = SQLiteColumnBuilder, _a189 = entityKind, _b136) {
28436
+ SQLiteTextBuilder = class extends (_b136 = SQLiteColumnBuilder, _a191 = entityKind, _b136) {
27496
28437
  constructor(name2, config) {
27497
28438
  super(name2, "string", "SQLiteText");
27498
28439
  this.config.enumValues = config.enum;
@@ -27503,8 +28444,8 @@ var init_text2 = __esm({
27503
28444
  return new SQLiteText(table4, this.config);
27504
28445
  }
27505
28446
  };
27506
- __publicField(SQLiteTextBuilder, _a189, "SQLiteTextBuilder");
27507
- SQLiteText = class extends (_b137 = SQLiteColumn, _a190 = entityKind, _b137) {
28447
+ __publicField(SQLiteTextBuilder, _a191, "SQLiteTextBuilder");
28448
+ SQLiteText = class extends (_b137 = SQLiteColumn, _a192 = entityKind, _b137) {
27508
28449
  constructor(table4, config) {
27509
28450
  super(table4, config);
27510
28451
  __publicField(this, "enumValues", this.config.enumValues);
@@ -27514,8 +28455,8 @@ var init_text2 = __esm({
27514
28455
  return `text${this.config.length ? `(${this.config.length})` : ""}`;
27515
28456
  }
27516
28457
  };
27517
- __publicField(SQLiteText, _a190, "SQLiteText");
27518
- SQLiteTextJsonBuilder = class extends (_b138 = SQLiteColumnBuilder, _a191 = entityKind, _b138) {
28458
+ __publicField(SQLiteText, _a192, "SQLiteText");
28459
+ SQLiteTextJsonBuilder = class extends (_b138 = SQLiteColumnBuilder, _a193 = entityKind, _b138) {
27519
28460
  constructor(name2) {
27520
28461
  super(name2, "json", "SQLiteTextJson");
27521
28462
  }
@@ -27527,8 +28468,8 @@ var init_text2 = __esm({
27527
28468
  );
27528
28469
  }
27529
28470
  };
27530
- __publicField(SQLiteTextJsonBuilder, _a191, "SQLiteTextJsonBuilder");
27531
- SQLiteTextJson = class extends (_b139 = SQLiteColumn, _a192 = entityKind, _b139) {
28471
+ __publicField(SQLiteTextJsonBuilder, _a193, "SQLiteTextJsonBuilder");
28472
+ SQLiteTextJson = class extends (_b139 = SQLiteColumn, _a194 = entityKind, _b139) {
27532
28473
  getSQLType() {
27533
28474
  return "text";
27534
28475
  }
@@ -27539,7 +28480,7 @@ var init_text2 = __esm({
27539
28480
  return JSON.stringify(value);
27540
28481
  }
27541
28482
  };
27542
- __publicField(SQLiteTextJson, _a192, "SQLiteTextJson");
28483
+ __publicField(SQLiteTextJson, _a194, "SQLiteTextJson");
27543
28484
  }
27544
28485
  });
27545
28486
 
@@ -27601,7 +28542,7 @@ function sqliteTableBase(name2, columns, extraConfig, schema4, baseName = name2)
27601
28542
  }
27602
28543
  return table4;
27603
28544
  }
27604
- var InlineForeignKeys2, _a193, _b140, _c6, _d3, _e2, SQLiteTable, sqliteTable;
28545
+ var InlineForeignKeys2, _a195, _b140, _c6, _d3, _e2, SQLiteTable, sqliteTable;
27605
28546
  var init_table3 = __esm({
27606
28547
  "../drizzle-orm/dist/sqlite-core/table.js"() {
27607
28548
  "use strict";
@@ -27609,7 +28550,7 @@ var init_table3 = __esm({
27609
28550
  init_table();
27610
28551
  init_all2();
27611
28552
  InlineForeignKeys2 = Symbol.for("drizzle:SQLiteInlineForeignKeys");
27612
- SQLiteTable = class extends (_e2 = Table, _d3 = entityKind, _c6 = Table.Symbol.Columns, _b140 = InlineForeignKeys2, _a193 = Table.Symbol.ExtraConfigBuilder, _e2) {
28553
+ SQLiteTable = class extends (_e2 = Table, _d3 = entityKind, _c6 = Table.Symbol.Columns, _b140 = InlineForeignKeys2, _a195 = Table.Symbol.ExtraConfigBuilder, _e2) {
27613
28554
  constructor() {
27614
28555
  super(...arguments);
27615
28556
  /** @internal */
@@ -27617,7 +28558,7 @@ var init_table3 = __esm({
27617
28558
  /** @internal */
27618
28559
  __publicField(this, _b140, []);
27619
28560
  /** @internal */
27620
- __publicField(this, _a193);
28561
+ __publicField(this, _a195);
27621
28562
  }
27622
28563
  };
27623
28564
  __publicField(SQLiteTable, _d3, "SQLiteTable");
@@ -27632,7 +28573,7 @@ var init_table3 = __esm({
27632
28573
  });
27633
28574
 
27634
28575
  // ../drizzle-orm/dist/sqlite-core/query-builders/delete.js
27635
- var _a194, _b141, SQLiteDeleteBase;
28576
+ var _a196, _b141, SQLiteDeleteBase;
27636
28577
  var init_delete2 = __esm({
27637
28578
  "../drizzle-orm/dist/sqlite-core/query-builders/delete.js"() {
27638
28579
  "use strict";
@@ -27640,7 +28581,7 @@ var init_delete2 = __esm({
27640
28581
  init_query_promise();
27641
28582
  init_table3();
27642
28583
  init_utils2();
27643
- SQLiteDeleteBase = class extends (_b141 = QueryPromise, _a194 = entityKind, _b141) {
28584
+ SQLiteDeleteBase = class extends (_b141 = QueryPromise, _a196 = entityKind, _b141) {
27644
28585
  constructor(table4, session, dialect4, withList) {
27645
28586
  super();
27646
28587
  /** @internal */
@@ -27726,12 +28667,12 @@ var init_delete2 = __esm({
27726
28667
  return this;
27727
28668
  }
27728
28669
  };
27729
- __publicField(SQLiteDeleteBase, _a194, "SQLiteDelete");
28670
+ __publicField(SQLiteDeleteBase, _a196, "SQLiteDelete");
27730
28671
  }
27731
28672
  });
27732
28673
 
27733
28674
  // ../drizzle-orm/dist/sqlite-core/query-builders/insert.js
27734
- var _a195, SQLiteInsertBuilder, _a196, _b142, SQLiteInsertBase;
28675
+ var _a197, SQLiteInsertBuilder, _a198, _b142, SQLiteInsertBase;
27735
28676
  var init_insert2 = __esm({
27736
28677
  "../drizzle-orm/dist/sqlite-core/query-builders/insert.js"() {
27737
28678
  "use strict";
@@ -27741,7 +28682,7 @@ var init_insert2 = __esm({
27741
28682
  init_table3();
27742
28683
  init_table();
27743
28684
  init_utils2();
27744
- _a195 = entityKind;
28685
+ _a197 = entityKind;
27745
28686
  SQLiteInsertBuilder = class {
27746
28687
  constructor(table4, session, dialect4, withList) {
27747
28688
  this.table = table4;
@@ -27766,8 +28707,8 @@ var init_insert2 = __esm({
27766
28707
  return new SQLiteInsertBase(this.table, mappedValues, this.session, this.dialect, this.withList);
27767
28708
  }
27768
28709
  };
27769
- __publicField(SQLiteInsertBuilder, _a195, "SQLiteInsertBuilder");
27770
- SQLiteInsertBase = class extends (_b142 = QueryPromise, _a196 = entityKind, _b142) {
28710
+ __publicField(SQLiteInsertBuilder, _a197, "SQLiteInsertBuilder");
28711
+ SQLiteInsertBase = class extends (_b142 = QueryPromise, _a198 = entityKind, _b142) {
27771
28712
  constructor(table4, values, session, dialect4, withList) {
27772
28713
  super();
27773
28714
  /** @internal */
@@ -27894,25 +28835,25 @@ var init_insert2 = __esm({
27894
28835
  return this;
27895
28836
  }
27896
28837
  };
27897
- __publicField(SQLiteInsertBase, _a196, "SQLiteInsert");
28838
+ __publicField(SQLiteInsertBase, _a198, "SQLiteInsert");
27898
28839
  }
27899
28840
  });
27900
28841
 
27901
28842
  // ../drizzle-orm/dist/sqlite-core/view-base.js
27902
- var _a197, _b143, SQLiteViewBase;
28843
+ var _a199, _b143, SQLiteViewBase;
27903
28844
  var init_view_base2 = __esm({
27904
28845
  "../drizzle-orm/dist/sqlite-core/view-base.js"() {
27905
28846
  "use strict";
27906
28847
  init_entity();
27907
28848
  init_sql();
27908
- SQLiteViewBase = class extends (_b143 = View, _a197 = entityKind, _b143) {
28849
+ SQLiteViewBase = class extends (_b143 = View, _a199 = entityKind, _b143) {
27909
28850
  };
27910
- __publicField(SQLiteViewBase, _a197, "SQLiteViewBase");
28851
+ __publicField(SQLiteViewBase, _a199, "SQLiteViewBase");
27911
28852
  }
27912
28853
  });
27913
28854
 
27914
28855
  // ../drizzle-orm/dist/sqlite-core/dialect.js
27915
- var _a198, SQLiteDialect, _a199, _b144, SQLiteSyncDialect, _a200, _b145, SQLiteAsyncDialect;
28856
+ var _a200, SQLiteDialect, _a201, _b144, SQLiteSyncDialect, _a202, _b145, SQLiteAsyncDialect;
27916
28857
  var init_dialect2 = __esm({
27917
28858
  "../drizzle-orm/dist/sqlite-core/dialect.js"() {
27918
28859
  "use strict";
@@ -27931,7 +28872,7 @@ var init_dialect2 = __esm({
27931
28872
  init_utils2();
27932
28873
  init_view_common();
27933
28874
  init_view_base2();
27934
- _a198 = entityKind;
28875
+ _a200 = entityKind;
27935
28876
  SQLiteDialect = class {
27936
28877
  constructor(config) {
27937
28878
  /** @internal */
@@ -28443,8 +29384,8 @@ var init_dialect2 = __esm({
28443
29384
  };
28444
29385
  }
28445
29386
  };
28446
- __publicField(SQLiteDialect, _a198, "SQLiteDialect");
28447
- SQLiteSyncDialect = class extends (_b144 = SQLiteDialect, _a199 = entityKind, _b144) {
29387
+ __publicField(SQLiteDialect, _a200, "SQLiteDialect");
29388
+ SQLiteSyncDialect = class extends (_b144 = SQLiteDialect, _a201 = entityKind, _b144) {
28448
29389
  migrate(migrations, session, config) {
28449
29390
  const migrationsTable = config === void 0 ? "__drizzle_migrations" : typeof config === "string" ? "__drizzle_migrations" : config.migrationsTable ?? "__drizzle_migrations";
28450
29391
  const migrationTableCreate = sql`
@@ -28478,8 +29419,8 @@ var init_dialect2 = __esm({
28478
29419
  }
28479
29420
  }
28480
29421
  };
28481
- __publicField(SQLiteSyncDialect, _a199, "SQLiteSyncDialect");
28482
- SQLiteAsyncDialect = class extends (_b145 = SQLiteDialect, _a200 = entityKind, _b145) {
29422
+ __publicField(SQLiteSyncDialect, _a201, "SQLiteSyncDialect");
29423
+ SQLiteAsyncDialect = class extends (_b145 = SQLiteDialect, _a202 = entityKind, _b145) {
28483
29424
  async migrate(migrations, session, config) {
28484
29425
  const migrationsTable = config === void 0 ? "__drizzle_migrations" : typeof config === "string" ? "__drizzle_migrations" : config.migrationsTable ?? "__drizzle_migrations";
28485
29426
  const migrationTableCreate = sql`
@@ -28508,7 +29449,7 @@ var init_dialect2 = __esm({
28508
29449
  });
28509
29450
  }
28510
29451
  };
28511
- __publicField(SQLiteAsyncDialect, _a200, "SQLiteAsyncDialect");
29452
+ __publicField(SQLiteAsyncDialect, _a202, "SQLiteAsyncDialect");
28512
29453
  }
28513
29454
  });
28514
29455
 
@@ -28530,7 +29471,7 @@ function createSetOperator2(type, isAll) {
28530
29471
  return leftSelect.addSetOperators(setOperators);
28531
29472
  };
28532
29473
  }
28533
- var _a201, SQLiteSelectBuilder, _a202, _b146, SQLiteSelectQueryBuilderBase, _a203, _b147, SQLiteSelectBase, getSQLiteSetOperators, union2, unionAll2, intersect2, except2;
29474
+ var _a203, SQLiteSelectBuilder, _a204, _b146, SQLiteSelectQueryBuilderBase, _a205, _b147, SQLiteSelectBase, getSQLiteSetOperators, union2, unionAll2, intersect2, except2;
28534
29475
  var init_select3 = __esm({
28535
29476
  "../drizzle-orm/dist/sqlite-core/query-builders/select.js"() {
28536
29477
  "use strict";
@@ -28544,7 +29485,7 @@ var init_select3 = __esm({
28544
29485
  init_utils2();
28545
29486
  init_view_common();
28546
29487
  init_view_base2();
28547
- _a201 = entityKind;
29488
+ _a203 = entityKind;
28548
29489
  SQLiteSelectBuilder = class {
28549
29490
  constructor(config) {
28550
29491
  __publicField(this, "fields");
@@ -28585,8 +29526,8 @@ var init_select3 = __esm({
28585
29526
  });
28586
29527
  }
28587
29528
  };
28588
- __publicField(SQLiteSelectBuilder, _a201, "SQLiteSelectBuilder");
28589
- SQLiteSelectQueryBuilderBase = class extends (_b146 = TypedQueryBuilder, _a202 = entityKind, _b146) {
29529
+ __publicField(SQLiteSelectBuilder, _a203, "SQLiteSelectBuilder");
29530
+ SQLiteSelectQueryBuilderBase = class extends (_b146 = TypedQueryBuilder, _a204 = entityKind, _b146) {
28590
29531
  constructor({ table: table4, fields, isPartialSelect, session, dialect: dialect4, withList, distinct }) {
28591
29532
  super();
28592
29533
  __publicField(this, "_");
@@ -29091,8 +30032,8 @@ var init_select3 = __esm({
29091
30032
  return this;
29092
30033
  }
29093
30034
  };
29094
- __publicField(SQLiteSelectQueryBuilderBase, _a202, "SQLiteSelectQueryBuilder");
29095
- SQLiteSelectBase = class extends (_b147 = SQLiteSelectQueryBuilderBase, _a203 = entityKind, _b147) {
30035
+ __publicField(SQLiteSelectQueryBuilderBase, _a204, "SQLiteSelectQueryBuilder");
30036
+ SQLiteSelectBase = class extends (_b147 = SQLiteSelectQueryBuilderBase, _a205 = entityKind, _b147) {
29096
30037
  constructor() {
29097
30038
  super(...arguments);
29098
30039
  __publicField(this, "run", (placeholderValues) => {
@@ -29130,7 +30071,7 @@ var init_select3 = __esm({
29130
30071
  return this.all();
29131
30072
  }
29132
30073
  };
29133
- __publicField(SQLiteSelectBase, _a203, "SQLiteSelect");
30074
+ __publicField(SQLiteSelectBase, _a205, "SQLiteSelect");
29134
30075
  applyMixins(SQLiteSelectBase, [QueryPromise]);
29135
30076
  getSQLiteSetOperators = () => ({
29136
30077
  union: union2,
@@ -29146,7 +30087,7 @@ var init_select3 = __esm({
29146
30087
  });
29147
30088
 
29148
30089
  // ../drizzle-orm/dist/sqlite-core/query-builders/query-builder.js
29149
- var _a204, QueryBuilder2;
30090
+ var _a206, QueryBuilder2;
29150
30091
  var init_query_builder3 = __esm({
29151
30092
  "../drizzle-orm/dist/sqlite-core/query-builders/query-builder.js"() {
29152
30093
  "use strict";
@@ -29155,7 +30096,7 @@ var init_query_builder3 = __esm({
29155
30096
  init_dialect2();
29156
30097
  init_subquery();
29157
30098
  init_select3();
29158
- _a204 = entityKind;
30099
+ _a206 = entityKind;
29159
30100
  QueryBuilder2 = class {
29160
30101
  constructor(dialect4) {
29161
30102
  __publicField(this, "dialect");
@@ -29217,7 +30158,7 @@ var init_query_builder3 = __esm({
29217
30158
  return this.dialect;
29218
30159
  }
29219
30160
  };
29220
- __publicField(QueryBuilder2, _a204, "SQLiteQueryBuilder");
30161
+ __publicField(QueryBuilder2, _a206, "SQLiteQueryBuilder");
29221
30162
  }
29222
30163
  });
29223
30164
 
@@ -29229,7 +30170,7 @@ var init_select_types2 = __esm({
29229
30170
  });
29230
30171
 
29231
30172
  // ../drizzle-orm/dist/sqlite-core/query-builders/update.js
29232
- var _a205, SQLiteUpdateBuilder, _a206, _b148, SQLiteUpdateBase;
30173
+ var _a207, SQLiteUpdateBuilder, _a208, _b148, SQLiteUpdateBase;
29233
30174
  var init_update2 = __esm({
29234
30175
  "../drizzle-orm/dist/sqlite-core/query-builders/update.js"() {
29235
30176
  "use strict";
@@ -29237,7 +30178,7 @@ var init_update2 = __esm({
29237
30178
  init_query_promise();
29238
30179
  init_table3();
29239
30180
  init_utils2();
29240
- _a205 = entityKind;
30181
+ _a207 = entityKind;
29241
30182
  SQLiteUpdateBuilder = class {
29242
30183
  constructor(table4, session, dialect4, withList) {
29243
30184
  this.table = table4;
@@ -29255,8 +30196,8 @@ var init_update2 = __esm({
29255
30196
  );
29256
30197
  }
29257
30198
  };
29258
- __publicField(SQLiteUpdateBuilder, _a205, "SQLiteUpdateBuilder");
29259
- SQLiteUpdateBase = class extends (_b148 = QueryPromise, _a206 = entityKind, _b148) {
30199
+ __publicField(SQLiteUpdateBuilder, _a207, "SQLiteUpdateBuilder");
30200
+ SQLiteUpdateBase = class extends (_b148 = QueryPromise, _a208 = entityKind, _b148) {
29260
30201
  constructor(table4, set, session, dialect4, withList) {
29261
30202
  super();
29262
30203
  /** @internal */
@@ -29345,7 +30286,7 @@ var init_update2 = __esm({
29345
30286
  return this;
29346
30287
  }
29347
30288
  };
29348
- __publicField(SQLiteUpdateBase, _a206, "SQLiteUpdate");
30289
+ __publicField(SQLiteUpdateBase, _a208, "SQLiteUpdate");
29349
30290
  }
29350
30291
  });
29351
30292
 
@@ -29363,17 +30304,17 @@ var init_query_builders2 = __esm({
29363
30304
  });
29364
30305
 
29365
30306
  // ../drizzle-orm/dist/sqlite-core/query-builders/count.js
29366
- var _a207, _b149, _c7, _SQLiteCountBuilder, SQLiteCountBuilder;
30307
+ var _a209, _b149, _c7, _SQLiteCountBuilder, SQLiteCountBuilder;
29367
30308
  var init_count2 = __esm({
29368
30309
  "../drizzle-orm/dist/sqlite-core/query-builders/count.js"() {
29369
30310
  "use strict";
29370
30311
  init_entity();
29371
30312
  init_sql();
29372
- _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b149 = entityKind, _a207 = Symbol.toStringTag, _c7) {
30313
+ _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b149 = entityKind, _a209 = Symbol.toStringTag, _c7) {
29373
30314
  constructor(params) {
29374
30315
  super(_SQLiteCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
29375
30316
  __publicField(this, "sql");
29376
- __publicField(this, _a207, "SQLiteCountBuilderAsync");
30317
+ __publicField(this, _a209, "SQLiteCountBuilderAsync");
29377
30318
  __publicField(this, "session");
29378
30319
  this.params = params;
29379
30320
  this.session = params.session;
@@ -29416,14 +30357,14 @@ var init_count2 = __esm({
29416
30357
  });
29417
30358
 
29418
30359
  // ../drizzle-orm/dist/sqlite-core/query-builders/query.js
29419
- var _a208, RelationalQueryBuilder2, _a209, _b150, SQLiteRelationalQuery, _a210, _b151, SQLiteSyncRelationalQuery;
30360
+ var _a210, RelationalQueryBuilder2, _a211, _b150, SQLiteRelationalQuery, _a212, _b151, SQLiteSyncRelationalQuery;
29420
30361
  var init_query2 = __esm({
29421
30362
  "../drizzle-orm/dist/sqlite-core/query-builders/query.js"() {
29422
30363
  "use strict";
29423
30364
  init_entity();
29424
30365
  init_query_promise();
29425
30366
  init_relations();
29426
- _a208 = entityKind;
30367
+ _a210 = entityKind;
29427
30368
  RelationalQueryBuilder2 = class {
29428
30369
  constructor(mode, fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session) {
29429
30370
  this.mode = mode;
@@ -29482,8 +30423,8 @@ var init_query2 = __esm({
29482
30423
  );
29483
30424
  }
29484
30425
  };
29485
- __publicField(RelationalQueryBuilder2, _a208, "SQLiteAsyncRelationalQueryBuilder");
29486
- SQLiteRelationalQuery = class extends (_b150 = QueryPromise, _a209 = entityKind, _b150) {
30426
+ __publicField(RelationalQueryBuilder2, _a210, "SQLiteAsyncRelationalQueryBuilder");
30427
+ SQLiteRelationalQuery = class extends (_b150 = QueryPromise, _a211 = entityKind, _b150) {
29487
30428
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, config, mode) {
29488
30429
  super();
29489
30430
  /** @internal */
@@ -29559,24 +30500,24 @@ var init_query2 = __esm({
29559
30500
  return this.executeRaw();
29560
30501
  }
29561
30502
  };
29562
- __publicField(SQLiteRelationalQuery, _a209, "SQLiteAsyncRelationalQuery");
29563
- SQLiteSyncRelationalQuery = class extends (_b151 = SQLiteRelationalQuery, _a210 = entityKind, _b151) {
30503
+ __publicField(SQLiteRelationalQuery, _a211, "SQLiteAsyncRelationalQuery");
30504
+ SQLiteSyncRelationalQuery = class extends (_b151 = SQLiteRelationalQuery, _a212 = entityKind, _b151) {
29564
30505
  sync() {
29565
30506
  return this.executeRaw();
29566
30507
  }
29567
30508
  };
29568
- __publicField(SQLiteSyncRelationalQuery, _a210, "SQLiteSyncRelationalQuery");
30509
+ __publicField(SQLiteSyncRelationalQuery, _a212, "SQLiteSyncRelationalQuery");
29569
30510
  }
29570
30511
  });
29571
30512
 
29572
30513
  // ../drizzle-orm/dist/sqlite-core/query-builders/raw.js
29573
- var _a211, _b152, SQLiteRaw;
30514
+ var _a213, _b152, SQLiteRaw;
29574
30515
  var init_raw2 = __esm({
29575
30516
  "../drizzle-orm/dist/sqlite-core/query-builders/raw.js"() {
29576
30517
  "use strict";
29577
30518
  init_entity();
29578
30519
  init_query_promise();
29579
- SQLiteRaw = class extends (_b152 = QueryPromise, _a211 = entityKind, _b152) {
30520
+ SQLiteRaw = class extends (_b152 = QueryPromise, _a213 = entityKind, _b152) {
29580
30521
  constructor(execute, getSQL, action, dialect4, mapBatchResult) {
29581
30522
  super();
29582
30523
  /** @internal */
@@ -29601,12 +30542,12 @@ var init_raw2 = __esm({
29601
30542
  return false;
29602
30543
  }
29603
30544
  };
29604
- __publicField(SQLiteRaw, _a211, "SQLiteRaw");
30545
+ __publicField(SQLiteRaw, _a213, "SQLiteRaw");
29605
30546
  }
29606
30547
  });
29607
30548
 
29608
30549
  // ../drizzle-orm/dist/sqlite-core/db.js
29609
- var _a212, BaseSQLiteDatabase;
30550
+ var _a214, BaseSQLiteDatabase;
29610
30551
  var init_db2 = __esm({
29611
30552
  "../drizzle-orm/dist/sqlite-core/db.js"() {
29612
30553
  "use strict";
@@ -29618,7 +30559,7 @@ var init_db2 = __esm({
29618
30559
  init_count2();
29619
30560
  init_query2();
29620
30561
  init_raw2();
29621
- _a212 = entityKind;
30562
+ _a214 = entityKind;
29622
30563
  BaseSQLiteDatabase = class {
29623
30564
  constructor(resultKind, dialect4, session, schema4) {
29624
30565
  __publicField(this, "query");
@@ -29900,17 +30841,17 @@ var init_db2 = __esm({
29900
30841
  return this.session.transaction(transaction, config);
29901
30842
  }
29902
30843
  };
29903
- __publicField(BaseSQLiteDatabase, _a212, "BaseSQLiteDatabase");
30844
+ __publicField(BaseSQLiteDatabase, _a214, "BaseSQLiteDatabase");
29904
30845
  }
29905
30846
  });
29906
30847
 
29907
30848
  // ../drizzle-orm/dist/sqlite-core/indexes.js
29908
- var _a213, IndexBuilderOn2, _a214, IndexBuilder2, _a215, Index4;
30849
+ var _a215, IndexBuilderOn2, _a216, IndexBuilder2, _a217, Index4;
29909
30850
  var init_indexes2 = __esm({
29910
30851
  "../drizzle-orm/dist/sqlite-core/indexes.js"() {
29911
30852
  "use strict";
29912
30853
  init_entity();
29913
- _a213 = entityKind;
30854
+ _a215 = entityKind;
29914
30855
  IndexBuilderOn2 = class {
29915
30856
  constructor(name2, unique) {
29916
30857
  this.name = name2;
@@ -29920,8 +30861,8 @@ var init_indexes2 = __esm({
29920
30861
  return new IndexBuilder2(this.name, columns, this.unique);
29921
30862
  }
29922
30863
  };
29923
- __publicField(IndexBuilderOn2, _a213, "SQLiteIndexBuilderOn");
29924
- _a214 = entityKind;
30864
+ __publicField(IndexBuilderOn2, _a215, "SQLiteIndexBuilderOn");
30865
+ _a216 = entityKind;
29925
30866
  IndexBuilder2 = class {
29926
30867
  constructor(name2, columns, unique) {
29927
30868
  /** @internal */
@@ -29945,26 +30886,26 @@ var init_indexes2 = __esm({
29945
30886
  return new Index4(this.config, table4);
29946
30887
  }
29947
30888
  };
29948
- __publicField(IndexBuilder2, _a214, "SQLiteIndexBuilder");
29949
- _a215 = entityKind;
30889
+ __publicField(IndexBuilder2, _a216, "SQLiteIndexBuilder");
30890
+ _a217 = entityKind;
29950
30891
  Index4 = class {
29951
30892
  constructor(config, table4) {
29952
30893
  __publicField(this, "config");
29953
30894
  this.config = { ...config, table: table4 };
29954
30895
  }
29955
30896
  };
29956
- __publicField(Index4, _a215, "SQLiteIndex");
30897
+ __publicField(Index4, _a217, "SQLiteIndex");
29957
30898
  }
29958
30899
  });
29959
30900
 
29960
30901
  // ../drizzle-orm/dist/sqlite-core/primary-keys.js
29961
- var _a216, PrimaryKeyBuilder2, _a217, PrimaryKey2;
30902
+ var _a218, PrimaryKeyBuilder2, _a219, PrimaryKey2;
29962
30903
  var init_primary_keys2 = __esm({
29963
30904
  "../drizzle-orm/dist/sqlite-core/primary-keys.js"() {
29964
30905
  "use strict";
29965
30906
  init_entity();
29966
30907
  init_table3();
29967
- _a216 = entityKind;
30908
+ _a218 = entityKind;
29968
30909
  PrimaryKeyBuilder2 = class {
29969
30910
  constructor(columns, name2) {
29970
30911
  /** @internal */
@@ -29979,8 +30920,8 @@ var init_primary_keys2 = __esm({
29979
30920
  return new PrimaryKey2(table4, this.columns, this.name);
29980
30921
  }
29981
30922
  };
29982
- __publicField(PrimaryKeyBuilder2, _a216, "SQLitePrimaryKeyBuilder");
29983
- _a217 = entityKind;
30923
+ __publicField(PrimaryKeyBuilder2, _a218, "SQLitePrimaryKeyBuilder");
30924
+ _a219 = entityKind;
29984
30925
  PrimaryKey2 = class {
29985
30926
  constructor(table4, columns, name2) {
29986
30927
  __publicField(this, "columns");
@@ -29993,12 +30934,12 @@ var init_primary_keys2 = __esm({
29993
30934
  return this.name ?? `${this.table[SQLiteTable.Symbol.Name]}_${this.columns.map((column4) => column4.name).join("_")}_pk`;
29994
30935
  }
29995
30936
  };
29996
- __publicField(PrimaryKey2, _a217, "SQLitePrimaryKey");
30937
+ __publicField(PrimaryKey2, _a219, "SQLitePrimaryKey");
29997
30938
  }
29998
30939
  });
29999
30940
 
30000
30941
  // ../drizzle-orm/dist/sqlite-core/session.js
30001
- var _a218, _b153, ExecuteResultSync, _a219, SQLitePreparedQuery, _a220, SQLiteSession, _a221, _b154, SQLiteTransaction;
30942
+ var _a220, _b153, ExecuteResultSync, _a221, SQLitePreparedQuery, _a222, SQLiteSession, _a223, _b154, SQLiteTransaction;
30002
30943
  var init_session2 = __esm({
30003
30944
  "../drizzle-orm/dist/sqlite-core/session.js"() {
30004
30945
  "use strict";
@@ -30006,7 +30947,7 @@ var init_session2 = __esm({
30006
30947
  init_errors();
30007
30948
  init_query_promise();
30008
30949
  init_db2();
30009
- ExecuteResultSync = class extends (_b153 = QueryPromise, _a218 = entityKind, _b153) {
30950
+ ExecuteResultSync = class extends (_b153 = QueryPromise, _a220 = entityKind, _b153) {
30010
30951
  constructor(resultCb) {
30011
30952
  super();
30012
30953
  this.resultCb = resultCb;
@@ -30018,8 +30959,8 @@ var init_session2 = __esm({
30018
30959
  return this.resultCb();
30019
30960
  }
30020
30961
  };
30021
- __publicField(ExecuteResultSync, _a218, "ExecuteResultSync");
30022
- _a219 = entityKind;
30962
+ __publicField(ExecuteResultSync, _a220, "ExecuteResultSync");
30963
+ _a221 = entityKind;
30023
30964
  SQLitePreparedQuery = class {
30024
30965
  constructor(mode, executeMethod, query) {
30025
30966
  /** @internal */
@@ -30060,8 +31001,8 @@ var init_session2 = __esm({
30060
31001
  }
30061
31002
  }
30062
31003
  };
30063
- __publicField(SQLitePreparedQuery, _a219, "PreparedQuery");
30064
- _a220 = entityKind;
31004
+ __publicField(SQLitePreparedQuery, _a221, "PreparedQuery");
31005
+ _a222 = entityKind;
30065
31006
  SQLiteSession = class {
30066
31007
  constructor(dialect4) {
30067
31008
  this.dialect = dialect4;
@@ -30107,8 +31048,8 @@ var init_session2 = __esm({
30107
31048
  throw new Error("Not implemented");
30108
31049
  }
30109
31050
  };
30110
- __publicField(SQLiteSession, _a220, "SQLiteSession");
30111
- SQLiteTransaction = class extends (_b154 = BaseSQLiteDatabase, _a221 = entityKind, _b154) {
31051
+ __publicField(SQLiteSession, _a222, "SQLiteSession");
31052
+ SQLiteTransaction = class extends (_b154 = BaseSQLiteDatabase, _a223 = entityKind, _b154) {
30112
31053
  constructor(resultType, dialect4, session, schema4, nestedIndex = 0) {
30113
31054
  super(resultType, dialect4, session, schema4);
30114
31055
  this.schema = schema4;
@@ -30118,7 +31059,7 @@ var init_session2 = __esm({
30118
31059
  throw new TransactionRollbackError();
30119
31060
  }
30120
31061
  };
30121
- __publicField(SQLiteTransaction, _a221, "SQLiteTransaction");
31062
+ __publicField(SQLiteTransaction, _a223, "SQLiteTransaction");
30122
31063
  }
30123
31064
  });
30124
31065
 
@@ -30189,7 +31130,7 @@ var init_utils6 = __esm({
30189
31130
  });
30190
31131
 
30191
31132
  // ../drizzle-orm/dist/sqlite-core/view.js
30192
- var _a222, ViewBuilderCore, _a223, _b155, ViewBuilder2, _a224, _b156, ManualViewBuilder2, _a225, _b157, _c8, SQLiteView;
31133
+ var _a224, ViewBuilderCore, _a225, _b155, ViewBuilder2, _a226, _b156, ManualViewBuilder2, _a227, _b157, _c8, SQLiteView;
30193
31134
  var init_view2 = __esm({
30194
31135
  "../drizzle-orm/dist/sqlite-core/view.js"() {
30195
31136
  "use strict";
@@ -30200,15 +31141,15 @@ var init_view2 = __esm({
30200
31141
  init_table3();
30201
31142
  init_view_base2();
30202
31143
  init_view_common3();
30203
- _a222 = entityKind;
31144
+ _a224 = entityKind;
30204
31145
  ViewBuilderCore = class {
30205
31146
  constructor(name2) {
30206
31147
  __publicField(this, "config", {});
30207
31148
  this.name = name2;
30208
31149
  }
30209
31150
  };
30210
- __publicField(ViewBuilderCore, _a222, "SQLiteViewBuilderCore");
30211
- ViewBuilder2 = class extends (_b155 = ViewBuilderCore, _a223 = entityKind, _b155) {
31151
+ __publicField(ViewBuilderCore, _a224, "SQLiteViewBuilderCore");
31152
+ ViewBuilder2 = class extends (_b155 = ViewBuilderCore, _a225 = entityKind, _b155) {
30212
31153
  as(qb) {
30213
31154
  if (typeof qb === "function") {
30214
31155
  qb = qb(new QueryBuilder2());
@@ -30234,8 +31175,8 @@ var init_view2 = __esm({
30234
31175
  );
30235
31176
  }
30236
31177
  };
30237
- __publicField(ViewBuilder2, _a223, "SQLiteViewBuilder");
30238
- ManualViewBuilder2 = class extends (_b156 = ViewBuilderCore, _a224 = entityKind, _b156) {
31178
+ __publicField(ViewBuilder2, _a225, "SQLiteViewBuilder");
31179
+ ManualViewBuilder2 = class extends (_b156 = ViewBuilderCore, _a226 = entityKind, _b156) {
30239
31180
  constructor(name2, columns) {
30240
31181
  super(name2);
30241
31182
  __publicField(this, "columns");
@@ -30280,12 +31221,12 @@ var init_view2 = __esm({
30280
31221
  );
30281
31222
  }
30282
31223
  };
30283
- __publicField(ManualViewBuilder2, _a224, "SQLiteManualViewBuilder");
30284
- SQLiteView = class extends (_c8 = SQLiteViewBase, _b157 = entityKind, _a225 = SQLiteViewConfig, _c8) {
31224
+ __publicField(ManualViewBuilder2, _a226, "SQLiteManualViewBuilder");
31225
+ SQLiteView = class extends (_c8 = SQLiteViewBase, _b157 = entityKind, _a227 = SQLiteViewConfig, _c8) {
30285
31226
  constructor({ sqliteConfig, config }) {
30286
31227
  super(config);
30287
31228
  /** @internal */
30288
- __publicField(this, _a225);
31229
+ __publicField(this, _a227);
30289
31230
  this[SQLiteViewConfig] = sqliteConfig;
30290
31231
  }
30291
31232
  };
@@ -30822,12 +31763,12 @@ var init_alias4 = __esm({
30822
31763
  });
30823
31764
 
30824
31765
  // ../drizzle-orm/dist/mysql-core/checks.js
30825
- var _a226, CheckBuilder3, _a227, Check3;
31766
+ var _a228, CheckBuilder3, _a229, Check3;
30826
31767
  var init_checks3 = __esm({
30827
31768
  "../drizzle-orm/dist/mysql-core/checks.js"() {
30828
31769
  "use strict";
30829
31770
  init_entity();
30830
- _a226 = entityKind;
31771
+ _a228 = entityKind;
30831
31772
  CheckBuilder3 = class {
30832
31773
  constructor(name2, value) {
30833
31774
  __publicField(this, "brand");
@@ -30839,8 +31780,8 @@ var init_checks3 = __esm({
30839
31780
  return new Check3(table4, this);
30840
31781
  }
30841
31782
  };
30842
- __publicField(CheckBuilder3, _a226, "MySqlCheckBuilder");
30843
- _a227 = entityKind;
31783
+ __publicField(CheckBuilder3, _a228, "MySqlCheckBuilder");
31784
+ _a229 = entityKind;
30844
31785
  Check3 = class {
30845
31786
  constructor(table4, builder) {
30846
31787
  __publicField(this, "name");
@@ -30850,18 +31791,18 @@ var init_checks3 = __esm({
30850
31791
  this.value = builder.value;
30851
31792
  }
30852
31793
  };
30853
- __publicField(Check3, _a227, "MySqlCheck");
31794
+ __publicField(Check3, _a229, "MySqlCheck");
30854
31795
  }
30855
31796
  });
30856
31797
 
30857
31798
  // ../drizzle-orm/dist/mysql-core/foreign-keys.js
30858
- var _a228, ForeignKeyBuilder3, _a229, ForeignKey3;
31799
+ var _a230, ForeignKeyBuilder3, _a231, ForeignKey3;
30859
31800
  var init_foreign_keys3 = __esm({
30860
31801
  "../drizzle-orm/dist/mysql-core/foreign-keys.js"() {
30861
31802
  "use strict";
30862
31803
  init_entity();
30863
31804
  init_table_utils();
30864
- _a228 = entityKind;
31805
+ _a230 = entityKind;
30865
31806
  ForeignKeyBuilder3 = class {
30866
31807
  constructor(config, actions) {
30867
31808
  /** @internal */
@@ -30892,8 +31833,8 @@ var init_foreign_keys3 = __esm({
30892
31833
  return new ForeignKey3(table4, this);
30893
31834
  }
30894
31835
  };
30895
- __publicField(ForeignKeyBuilder3, _a228, "MySqlForeignKeyBuilder");
30896
- _a229 = entityKind;
31836
+ __publicField(ForeignKeyBuilder3, _a230, "MySqlForeignKeyBuilder");
31837
+ _a231 = entityKind;
30897
31838
  ForeignKey3 = class {
30898
31839
  constructor(table4, builder) {
30899
31840
  __publicField(this, "reference");
@@ -30917,7 +31858,7 @@ var init_foreign_keys3 = __esm({
30917
31858
  return name2 ?? `${chunks.join("_")}_fk`;
30918
31859
  }
30919
31860
  };
30920
- __publicField(ForeignKey3, _a229, "MySqlForeignKey");
31861
+ __publicField(ForeignKey3, _a231, "MySqlForeignKey");
30921
31862
  }
30922
31863
  });
30923
31864
 
@@ -30925,13 +31866,13 @@ var init_foreign_keys3 = __esm({
30925
31866
  function uniqueKeyName3(table4, columns) {
30926
31867
  return `${table4[TableName]}_${columns.join("_")}_unique`;
30927
31868
  }
30928
- var _a230, UniqueConstraintBuilder3, _a231, UniqueOnConstraintBuilder3, _a232, UniqueConstraint3;
31869
+ var _a232, UniqueConstraintBuilder3, _a233, UniqueOnConstraintBuilder3, _a234, UniqueConstraint3;
30929
31870
  var init_unique_constraint3 = __esm({
30930
31871
  "../drizzle-orm/dist/mysql-core/unique-constraint.js"() {
30931
31872
  "use strict";
30932
31873
  init_entity();
30933
31874
  init_table_utils();
30934
- _a230 = entityKind;
31875
+ _a232 = entityKind;
30935
31876
  UniqueConstraintBuilder3 = class {
30936
31877
  constructor(columns, name2) {
30937
31878
  /** @internal */
@@ -30944,8 +31885,8 @@ var init_unique_constraint3 = __esm({
30944
31885
  return new UniqueConstraint3(table4, this.columns, this.name);
30945
31886
  }
30946
31887
  };
30947
- __publicField(UniqueConstraintBuilder3, _a230, "MySqlUniqueConstraintBuilder");
30948
- _a231 = entityKind;
31888
+ __publicField(UniqueConstraintBuilder3, _a232, "MySqlUniqueConstraintBuilder");
31889
+ _a233 = entityKind;
30949
31890
  UniqueOnConstraintBuilder3 = class {
30950
31891
  constructor(name2) {
30951
31892
  /** @internal */
@@ -30956,8 +31897,8 @@ var init_unique_constraint3 = __esm({
30956
31897
  return new UniqueConstraintBuilder3(columns, this.name);
30957
31898
  }
30958
31899
  };
30959
- __publicField(UniqueOnConstraintBuilder3, _a231, "MySqlUniqueOnConstraintBuilder");
30960
- _a232 = entityKind;
31900
+ __publicField(UniqueOnConstraintBuilder3, _a233, "MySqlUniqueOnConstraintBuilder");
31901
+ _a234 = entityKind;
30961
31902
  UniqueConstraint3 = class {
30962
31903
  constructor(table4, columns, name2) {
30963
31904
  __publicField(this, "columns");
@@ -30971,12 +31912,12 @@ var init_unique_constraint3 = __esm({
30971
31912
  return this.name;
30972
31913
  }
30973
31914
  };
30974
- __publicField(UniqueConstraint3, _a232, "MySqlUniqueConstraint");
31915
+ __publicField(UniqueConstraint3, _a234, "MySqlUniqueConstraint");
30975
31916
  }
30976
31917
  });
30977
31918
 
30978
31919
  // ../drizzle-orm/dist/mysql-core/columns/common.js
30979
- var _a233, _b158, MySqlColumnBuilder, _a234, _b159, MySqlColumn, _a235, _b160, MySqlColumnBuilderWithAutoIncrement, _a236, _b161, MySqlColumnWithAutoIncrement;
31920
+ var _a235, _b158, MySqlColumnBuilder, _a236, _b159, MySqlColumn, _a237, _b160, MySqlColumnBuilderWithAutoIncrement, _a238, _b161, MySqlColumnWithAutoIncrement;
30980
31921
  var init_common4 = __esm({
30981
31922
  "../drizzle-orm/dist/mysql-core/columns/common.js"() {
30982
31923
  "use strict";
@@ -30985,7 +31926,7 @@ var init_common4 = __esm({
30985
31926
  init_entity();
30986
31927
  init_foreign_keys3();
30987
31928
  init_unique_constraint3();
30988
- MySqlColumnBuilder = class extends (_b158 = ColumnBuilder, _a233 = entityKind, _b158) {
31929
+ MySqlColumnBuilder = class extends (_b158 = ColumnBuilder, _a235 = entityKind, _b158) {
30989
31930
  constructor() {
30990
31931
  super(...arguments);
30991
31932
  __publicField(this, "foreignKeyConfigs", []);
@@ -31026,8 +31967,8 @@ var init_common4 = __esm({
31026
31967
  });
31027
31968
  }
31028
31969
  };
31029
- __publicField(MySqlColumnBuilder, _a233, "MySqlColumnBuilder");
31030
- MySqlColumn = class extends (_b159 = Column2, _a234 = entityKind, _b159) {
31970
+ __publicField(MySqlColumnBuilder, _a235, "MySqlColumnBuilder");
31971
+ MySqlColumn = class extends (_b159 = Column2, _a236 = entityKind, _b159) {
31031
31972
  constructor(table4, config) {
31032
31973
  if (!config.uniqueName) {
31033
31974
  config.uniqueName = uniqueKeyName3(table4, [config.name]);
@@ -31036,8 +31977,8 @@ var init_common4 = __esm({
31036
31977
  this.table = table4;
31037
31978
  }
31038
31979
  };
31039
- __publicField(MySqlColumn, _a234, "MySqlColumn");
31040
- MySqlColumnBuilderWithAutoIncrement = class extends (_b160 = MySqlColumnBuilder, _a235 = entityKind, _b160) {
31980
+ __publicField(MySqlColumn, _a236, "MySqlColumn");
31981
+ MySqlColumnBuilderWithAutoIncrement = class extends (_b160 = MySqlColumnBuilder, _a237 = entityKind, _b160) {
31041
31982
  constructor(name2, dataType, columnType) {
31042
31983
  super(name2, dataType, columnType);
31043
31984
  this.config.autoIncrement = false;
@@ -31048,14 +31989,14 @@ var init_common4 = __esm({
31048
31989
  return this;
31049
31990
  }
31050
31991
  };
31051
- __publicField(MySqlColumnBuilderWithAutoIncrement, _a235, "MySqlColumnBuilderWithAutoIncrement");
31052
- MySqlColumnWithAutoIncrement = class extends (_b161 = MySqlColumn, _a236 = entityKind, _b161) {
31992
+ __publicField(MySqlColumnBuilderWithAutoIncrement, _a237, "MySqlColumnBuilderWithAutoIncrement");
31993
+ MySqlColumnWithAutoIncrement = class extends (_b161 = MySqlColumn, _a238 = entityKind, _b161) {
31053
31994
  constructor() {
31054
31995
  super(...arguments);
31055
31996
  __publicField(this, "autoIncrement", this.config.autoIncrement);
31056
31997
  }
31057
31998
  };
31058
- __publicField(MySqlColumnWithAutoIncrement, _a236, "MySqlColumnWithAutoIncrement");
31999
+ __publicField(MySqlColumnWithAutoIncrement, _a238, "MySqlColumnWithAutoIncrement");
31059
32000
  }
31060
32001
  });
31061
32002
 
@@ -31067,14 +32008,14 @@ function bigint2(a, b) {
31067
32008
  }
31068
32009
  return new MySqlBigInt64Builder(name2, config.unsigned);
31069
32010
  }
31070
- var _a237, _b162, MySqlBigInt53Builder, _a238, _b163, MySqlBigInt53, _a239, _b164, MySqlBigInt64Builder, _a240, _b165, MySqlBigInt64;
32011
+ var _a239, _b162, MySqlBigInt53Builder, _a240, _b163, MySqlBigInt53, _a241, _b164, MySqlBigInt64Builder, _a242, _b165, MySqlBigInt64;
31071
32012
  var init_bigint2 = __esm({
31072
32013
  "../drizzle-orm/dist/mysql-core/columns/bigint.js"() {
31073
32014
  "use strict";
31074
32015
  init_entity();
31075
32016
  init_utils2();
31076
32017
  init_common4();
31077
- MySqlBigInt53Builder = class extends (_b162 = MySqlColumnBuilderWithAutoIncrement, _a237 = entityKind, _b162) {
32018
+ MySqlBigInt53Builder = class extends (_b162 = MySqlColumnBuilderWithAutoIncrement, _a239 = entityKind, _b162) {
31078
32019
  constructor(name2, unsigned = false) {
31079
32020
  super(name2, "number", "MySqlBigInt53");
31080
32021
  this.config.unsigned = unsigned;
@@ -31087,8 +32028,8 @@ var init_bigint2 = __esm({
31087
32028
  );
31088
32029
  }
31089
32030
  };
31090
- __publicField(MySqlBigInt53Builder, _a237, "MySqlBigInt53Builder");
31091
- MySqlBigInt53 = class extends (_b163 = MySqlColumnWithAutoIncrement, _a238 = entityKind, _b163) {
32031
+ __publicField(MySqlBigInt53Builder, _a239, "MySqlBigInt53Builder");
32032
+ MySqlBigInt53 = class extends (_b163 = MySqlColumnWithAutoIncrement, _a240 = entityKind, _b163) {
31092
32033
  getSQLType() {
31093
32034
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
31094
32035
  }
@@ -31099,8 +32040,8 @@ var init_bigint2 = __esm({
31099
32040
  return Number(value);
31100
32041
  }
31101
32042
  };
31102
- __publicField(MySqlBigInt53, _a238, "MySqlBigInt53");
31103
- MySqlBigInt64Builder = class extends (_b164 = MySqlColumnBuilderWithAutoIncrement, _a239 = entityKind, _b164) {
32043
+ __publicField(MySqlBigInt53, _a240, "MySqlBigInt53");
32044
+ MySqlBigInt64Builder = class extends (_b164 = MySqlColumnBuilderWithAutoIncrement, _a241 = entityKind, _b164) {
31104
32045
  constructor(name2, unsigned = false) {
31105
32046
  super(name2, "bigint", "MySqlBigInt64");
31106
32047
  this.config.unsigned = unsigned;
@@ -31113,8 +32054,8 @@ var init_bigint2 = __esm({
31113
32054
  );
31114
32055
  }
31115
32056
  };
31116
- __publicField(MySqlBigInt64Builder, _a239, "MySqlBigInt64Builder");
31117
- MySqlBigInt64 = class extends (_b165 = MySqlColumnWithAutoIncrement, _a240 = entityKind, _b165) {
32057
+ __publicField(MySqlBigInt64Builder, _a241, "MySqlBigInt64Builder");
32058
+ MySqlBigInt64 = class extends (_b165 = MySqlColumnWithAutoIncrement, _a242 = entityKind, _b165) {
31118
32059
  getSQLType() {
31119
32060
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
31120
32061
  }
@@ -31123,7 +32064,7 @@ var init_bigint2 = __esm({
31123
32064
  return BigInt(value);
31124
32065
  }
31125
32066
  };
31126
- __publicField(MySqlBigInt64, _a240, "MySqlBigInt64");
32067
+ __publicField(MySqlBigInt64, _a242, "MySqlBigInt64");
31127
32068
  }
31128
32069
  });
31129
32070
 
@@ -31132,14 +32073,14 @@ function binary(a, b = {}) {
31132
32073
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31133
32074
  return new MySqlBinaryBuilder(name2, config.length);
31134
32075
  }
31135
- var _a241, _b166, MySqlBinaryBuilder, _a242, _b167, MySqlBinary;
32076
+ var _a243, _b166, MySqlBinaryBuilder, _a244, _b167, MySqlBinary;
31136
32077
  var init_binary = __esm({
31137
32078
  "../drizzle-orm/dist/mysql-core/columns/binary.js"() {
31138
32079
  "use strict";
31139
32080
  init_entity();
31140
32081
  init_utils2();
31141
32082
  init_common4();
31142
- MySqlBinaryBuilder = class extends (_b166 = MySqlColumnBuilder, _a241 = entityKind, _b166) {
32083
+ MySqlBinaryBuilder = class extends (_b166 = MySqlColumnBuilder, _a243 = entityKind, _b166) {
31143
32084
  constructor(name2, length) {
31144
32085
  super(name2, "string", "MySqlBinary");
31145
32086
  this.config.length = length;
@@ -31149,8 +32090,8 @@ var init_binary = __esm({
31149
32090
  return new MySqlBinary(table4, this.config);
31150
32091
  }
31151
32092
  };
31152
- __publicField(MySqlBinaryBuilder, _a241, "MySqlBinaryBuilder");
31153
- MySqlBinary = class extends (_b167 = MySqlColumn, _a242 = entityKind, _b167) {
32093
+ __publicField(MySqlBinaryBuilder, _a243, "MySqlBinaryBuilder");
32094
+ MySqlBinary = class extends (_b167 = MySqlColumn, _a244 = entityKind, _b167) {
31154
32095
  constructor() {
31155
32096
  super(...arguments);
31156
32097
  __publicField(this, "length", this.config.length);
@@ -31159,7 +32100,7 @@ var init_binary = __esm({
31159
32100
  return this.length === void 0 ? `binary` : `binary(${this.length})`;
31160
32101
  }
31161
32102
  };
31162
- __publicField(MySqlBinary, _a242, "MySqlBinary");
32103
+ __publicField(MySqlBinary, _a244, "MySqlBinary");
31163
32104
  }
31164
32105
  });
31165
32106
 
@@ -31167,13 +32108,13 @@ var init_binary = __esm({
31167
32108
  function boolean2(name2) {
31168
32109
  return new MySqlBooleanBuilder(name2 ?? "");
31169
32110
  }
31170
- var _a243, _b168, MySqlBooleanBuilder, _a244, _b169, MySqlBoolean;
32111
+ var _a245, _b168, MySqlBooleanBuilder, _a246, _b169, MySqlBoolean;
31171
32112
  var init_boolean2 = __esm({
31172
32113
  "../drizzle-orm/dist/mysql-core/columns/boolean.js"() {
31173
32114
  "use strict";
31174
32115
  init_entity();
31175
32116
  init_common4();
31176
- MySqlBooleanBuilder = class extends (_b168 = MySqlColumnBuilder, _a243 = entityKind, _b168) {
32117
+ MySqlBooleanBuilder = class extends (_b168 = MySqlColumnBuilder, _a245 = entityKind, _b168) {
31177
32118
  constructor(name2) {
31178
32119
  super(name2, "boolean", "MySqlBoolean");
31179
32120
  }
@@ -31185,8 +32126,8 @@ var init_boolean2 = __esm({
31185
32126
  );
31186
32127
  }
31187
32128
  };
31188
- __publicField(MySqlBooleanBuilder, _a243, "MySqlBooleanBuilder");
31189
- MySqlBoolean = class extends (_b169 = MySqlColumn, _a244 = entityKind, _b169) {
32129
+ __publicField(MySqlBooleanBuilder, _a245, "MySqlBooleanBuilder");
32130
+ MySqlBoolean = class extends (_b169 = MySqlColumn, _a246 = entityKind, _b169) {
31190
32131
  getSQLType() {
31191
32132
  return "boolean";
31192
32133
  }
@@ -31197,7 +32138,7 @@ var init_boolean2 = __esm({
31197
32138
  return value === 1;
31198
32139
  }
31199
32140
  };
31200
- __publicField(MySqlBoolean, _a244, "MySqlBoolean");
32141
+ __publicField(MySqlBoolean, _a246, "MySqlBoolean");
31201
32142
  }
31202
32143
  });
31203
32144
 
@@ -31206,14 +32147,14 @@ function char2(a, b = {}) {
31206
32147
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31207
32148
  return new MySqlCharBuilder(name2, config);
31208
32149
  }
31209
- var _a245, _b170, MySqlCharBuilder, _a246, _b171, MySqlChar;
32150
+ var _a247, _b170, MySqlCharBuilder, _a248, _b171, MySqlChar;
31210
32151
  var init_char2 = __esm({
31211
32152
  "../drizzle-orm/dist/mysql-core/columns/char.js"() {
31212
32153
  "use strict";
31213
32154
  init_entity();
31214
32155
  init_utils2();
31215
32156
  init_common4();
31216
- MySqlCharBuilder = class extends (_b170 = MySqlColumnBuilder, _a245 = entityKind, _b170) {
32157
+ MySqlCharBuilder = class extends (_b170 = MySqlColumnBuilder, _a247 = entityKind, _b170) {
31217
32158
  constructor(name2, config) {
31218
32159
  super(name2, "string", "MySqlChar");
31219
32160
  this.config.length = config.length;
@@ -31227,8 +32168,8 @@ var init_char2 = __esm({
31227
32168
  );
31228
32169
  }
31229
32170
  };
31230
- __publicField(MySqlCharBuilder, _a245, "MySqlCharBuilder");
31231
- MySqlChar = class extends (_b171 = MySqlColumn, _a246 = entityKind, _b171) {
32171
+ __publicField(MySqlCharBuilder, _a247, "MySqlCharBuilder");
32172
+ MySqlChar = class extends (_b171 = MySqlColumn, _a248 = entityKind, _b171) {
31232
32173
  constructor() {
31233
32174
  super(...arguments);
31234
32175
  __publicField(this, "length", this.config.length);
@@ -31238,7 +32179,7 @@ var init_char2 = __esm({
31238
32179
  return this.length === void 0 ? `char` : `char(${this.length})`;
31239
32180
  }
31240
32181
  };
31241
- __publicField(MySqlChar, _a246, "MySqlChar");
32182
+ __publicField(MySqlChar, _a248, "MySqlChar");
31242
32183
  }
31243
32184
  });
31244
32185
 
@@ -31249,14 +32190,14 @@ function customType3(customTypeParams) {
31249
32190
  return new MySqlCustomColumnBuilder(name2, config, customTypeParams);
31250
32191
  };
31251
32192
  }
31252
- var _a247, _b172, MySqlCustomColumnBuilder, _a248, _b173, MySqlCustomColumn;
32193
+ var _a249, _b172, MySqlCustomColumnBuilder, _a250, _b173, MySqlCustomColumn;
31253
32194
  var init_custom3 = __esm({
31254
32195
  "../drizzle-orm/dist/mysql-core/columns/custom.js"() {
31255
32196
  "use strict";
31256
32197
  init_entity();
31257
32198
  init_utils2();
31258
32199
  init_common4();
31259
- MySqlCustomColumnBuilder = class extends (_b172 = MySqlColumnBuilder, _a247 = entityKind, _b172) {
32200
+ MySqlCustomColumnBuilder = class extends (_b172 = MySqlColumnBuilder, _a249 = entityKind, _b172) {
31260
32201
  constructor(name2, fieldConfig, customTypeParams) {
31261
32202
  super(name2, "custom", "MySqlCustomColumn");
31262
32203
  this.config.fieldConfig = fieldConfig;
@@ -31270,8 +32211,8 @@ var init_custom3 = __esm({
31270
32211
  );
31271
32212
  }
31272
32213
  };
31273
- __publicField(MySqlCustomColumnBuilder, _a247, "MySqlCustomColumnBuilder");
31274
- MySqlCustomColumn = class extends (_b173 = MySqlColumn, _a248 = entityKind, _b173) {
32214
+ __publicField(MySqlCustomColumnBuilder, _a249, "MySqlCustomColumnBuilder");
32215
+ MySqlCustomColumn = class extends (_b173 = MySqlColumn, _a250 = entityKind, _b173) {
31275
32216
  constructor(table4, config) {
31276
32217
  super(table4, config);
31277
32218
  __publicField(this, "sqlName");
@@ -31291,7 +32232,7 @@ var init_custom3 = __esm({
31291
32232
  return typeof this.mapTo === "function" ? this.mapTo(value) : value;
31292
32233
  }
31293
32234
  };
31294
- __publicField(MySqlCustomColumn, _a248, "MySqlCustomColumn");
32235
+ __publicField(MySqlCustomColumn, _a250, "MySqlCustomColumn");
31295
32236
  }
31296
32237
  });
31297
32238
 
@@ -31303,14 +32244,14 @@ function date2(a, b) {
31303
32244
  }
31304
32245
  return new MySqlDateBuilder(name2);
31305
32246
  }
31306
- var _a249, _b174, MySqlDateBuilder, _a250, _b175, MySqlDate, _a251, _b176, MySqlDateStringBuilder, _a252, _b177, MySqlDateString;
32247
+ var _a251, _b174, MySqlDateBuilder, _a252, _b175, MySqlDate, _a253, _b176, MySqlDateStringBuilder, _a254, _b177, MySqlDateString;
31307
32248
  var init_date2 = __esm({
31308
32249
  "../drizzle-orm/dist/mysql-core/columns/date.js"() {
31309
32250
  "use strict";
31310
32251
  init_entity();
31311
32252
  init_utils2();
31312
32253
  init_common4();
31313
- MySqlDateBuilder = class extends (_b174 = MySqlColumnBuilder, _a249 = entityKind, _b174) {
32254
+ MySqlDateBuilder = class extends (_b174 = MySqlColumnBuilder, _a251 = entityKind, _b174) {
31314
32255
  constructor(name2) {
31315
32256
  super(name2, "date", "MySqlDate");
31316
32257
  }
@@ -31319,8 +32260,8 @@ var init_date2 = __esm({
31319
32260
  return new MySqlDate(table4, this.config);
31320
32261
  }
31321
32262
  };
31322
- __publicField(MySqlDateBuilder, _a249, "MySqlDateBuilder");
31323
- MySqlDate = class extends (_b175 = MySqlColumn, _a250 = entityKind, _b175) {
32263
+ __publicField(MySqlDateBuilder, _a251, "MySqlDateBuilder");
32264
+ MySqlDate = class extends (_b175 = MySqlColumn, _a252 = entityKind, _b175) {
31324
32265
  constructor(table4, config) {
31325
32266
  super(table4, config);
31326
32267
  }
@@ -31331,8 +32272,8 @@ var init_date2 = __esm({
31331
32272
  return new Date(value);
31332
32273
  }
31333
32274
  };
31334
- __publicField(MySqlDate, _a250, "MySqlDate");
31335
- MySqlDateStringBuilder = class extends (_b176 = MySqlColumnBuilder, _a251 = entityKind, _b176) {
32275
+ __publicField(MySqlDate, _a252, "MySqlDate");
32276
+ MySqlDateStringBuilder = class extends (_b176 = MySqlColumnBuilder, _a253 = entityKind, _b176) {
31336
32277
  constructor(name2) {
31337
32278
  super(name2, "string", "MySqlDateString");
31338
32279
  }
@@ -31344,8 +32285,8 @@ var init_date2 = __esm({
31344
32285
  );
31345
32286
  }
31346
32287
  };
31347
- __publicField(MySqlDateStringBuilder, _a251, "MySqlDateStringBuilder");
31348
- MySqlDateString = class extends (_b177 = MySqlColumn, _a252 = entityKind, _b177) {
32288
+ __publicField(MySqlDateStringBuilder, _a253, "MySqlDateStringBuilder");
32289
+ MySqlDateString = class extends (_b177 = MySqlColumn, _a254 = entityKind, _b177) {
31349
32290
  constructor(table4, config) {
31350
32291
  super(table4, config);
31351
32292
  }
@@ -31353,7 +32294,7 @@ var init_date2 = __esm({
31353
32294
  return `date`;
31354
32295
  }
31355
32296
  };
31356
- __publicField(MySqlDateString, _a252, "MySqlDateString");
32297
+ __publicField(MySqlDateString, _a254, "MySqlDateString");
31357
32298
  }
31358
32299
  });
31359
32300
 
@@ -31365,14 +32306,14 @@ function datetime(a, b) {
31365
32306
  }
31366
32307
  return new MySqlDateTimeBuilder(name2, config);
31367
32308
  }
31368
- var _a253, _b178, MySqlDateTimeBuilder, _a254, _b179, MySqlDateTime, _a255, _b180, MySqlDateTimeStringBuilder, _a256, _b181, MySqlDateTimeString;
32309
+ var _a255, _b178, MySqlDateTimeBuilder, _a256, _b179, MySqlDateTime, _a257, _b180, MySqlDateTimeStringBuilder, _a258, _b181, MySqlDateTimeString;
31369
32310
  var init_datetime = __esm({
31370
32311
  "../drizzle-orm/dist/mysql-core/columns/datetime.js"() {
31371
32312
  "use strict";
31372
32313
  init_entity();
31373
32314
  init_utils2();
31374
32315
  init_common4();
31375
- MySqlDateTimeBuilder = class extends (_b178 = MySqlColumnBuilder, _a253 = entityKind, _b178) {
32316
+ MySqlDateTimeBuilder = class extends (_b178 = MySqlColumnBuilder, _a255 = entityKind, _b178) {
31376
32317
  constructor(name2, config) {
31377
32318
  super(name2, "date", "MySqlDateTime");
31378
32319
  this.config.fsp = config?.fsp;
@@ -31385,8 +32326,8 @@ var init_datetime = __esm({
31385
32326
  );
31386
32327
  }
31387
32328
  };
31388
- __publicField(MySqlDateTimeBuilder, _a253, "MySqlDateTimeBuilder");
31389
- MySqlDateTime = class extends (_b179 = MySqlColumn, _a254 = entityKind, _b179) {
32329
+ __publicField(MySqlDateTimeBuilder, _a255, "MySqlDateTimeBuilder");
32330
+ MySqlDateTime = class extends (_b179 = MySqlColumn, _a256 = entityKind, _b179) {
31390
32331
  constructor(table4, config) {
31391
32332
  super(table4, config);
31392
32333
  __publicField(this, "fsp");
@@ -31403,8 +32344,8 @@ var init_datetime = __esm({
31403
32344
  return /* @__PURE__ */ new Date(value.replace(" ", "T") + "Z");
31404
32345
  }
31405
32346
  };
31406
- __publicField(MySqlDateTime, _a254, "MySqlDateTime");
31407
- MySqlDateTimeStringBuilder = class extends (_b180 = MySqlColumnBuilder, _a255 = entityKind, _b180) {
32347
+ __publicField(MySqlDateTime, _a256, "MySqlDateTime");
32348
+ MySqlDateTimeStringBuilder = class extends (_b180 = MySqlColumnBuilder, _a257 = entityKind, _b180) {
31408
32349
  constructor(name2, config) {
31409
32350
  super(name2, "string", "MySqlDateTimeString");
31410
32351
  this.config.fsp = config?.fsp;
@@ -31417,8 +32358,8 @@ var init_datetime = __esm({
31417
32358
  );
31418
32359
  }
31419
32360
  };
31420
- __publicField(MySqlDateTimeStringBuilder, _a255, "MySqlDateTimeStringBuilder");
31421
- MySqlDateTimeString = class extends (_b181 = MySqlColumn, _a256 = entityKind, _b181) {
32361
+ __publicField(MySqlDateTimeStringBuilder, _a257, "MySqlDateTimeStringBuilder");
32362
+ MySqlDateTimeString = class extends (_b181 = MySqlColumn, _a258 = entityKind, _b181) {
31422
32363
  constructor(table4, config) {
31423
32364
  super(table4, config);
31424
32365
  __publicField(this, "fsp");
@@ -31429,7 +32370,7 @@ var init_datetime = __esm({
31429
32370
  return `datetime${precision}`;
31430
32371
  }
31431
32372
  };
31432
- __publicField(MySqlDateTimeString, _a256, "MySqlDateTimeString");
32373
+ __publicField(MySqlDateTimeString, _a258, "MySqlDateTimeString");
31433
32374
  }
31434
32375
  });
31435
32376
 
@@ -31438,14 +32379,14 @@ function decimal(a, b = {}) {
31438
32379
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31439
32380
  return new MySqlDecimalBuilder(name2, config.precision, config.scale);
31440
32381
  }
31441
- var _a257, _b182, MySqlDecimalBuilder, _a258, _b183, MySqlDecimal;
32382
+ var _a259, _b182, MySqlDecimalBuilder, _a260, _b183, MySqlDecimal;
31442
32383
  var init_decimal = __esm({
31443
32384
  "../drizzle-orm/dist/mysql-core/columns/decimal.js"() {
31444
32385
  "use strict";
31445
32386
  init_entity();
31446
32387
  init_utils2();
31447
32388
  init_common4();
31448
- MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a257 = entityKind, _b182) {
32389
+ MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b182) {
31449
32390
  constructor(name2, precision, scale) {
31450
32391
  super(name2, "string", "MySqlDecimal");
31451
32392
  this.config.precision = precision;
@@ -31459,8 +32400,8 @@ var init_decimal = __esm({
31459
32400
  );
31460
32401
  }
31461
32402
  };
31462
- __publicField(MySqlDecimalBuilder, _a257, "MySqlDecimalBuilder");
31463
- MySqlDecimal = class extends (_b183 = MySqlColumnWithAutoIncrement, _a258 = entityKind, _b183) {
32403
+ __publicField(MySqlDecimalBuilder, _a259, "MySqlDecimalBuilder");
32404
+ MySqlDecimal = class extends (_b183 = MySqlColumnWithAutoIncrement, _a260 = entityKind, _b183) {
31464
32405
  constructor() {
31465
32406
  super(...arguments);
31466
32407
  __publicField(this, "precision", this.config.precision);
@@ -31476,7 +32417,7 @@ var init_decimal = __esm({
31476
32417
  }
31477
32418
  }
31478
32419
  };
31479
- __publicField(MySqlDecimal, _a258, "MySqlDecimal");
32420
+ __publicField(MySqlDecimal, _a260, "MySqlDecimal");
31480
32421
  }
31481
32422
  });
31482
32423
 
@@ -31485,14 +32426,14 @@ function double(a, b) {
31485
32426
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31486
32427
  return new MySqlDoubleBuilder(name2, config);
31487
32428
  }
31488
- var _a259, _b184, MySqlDoubleBuilder, _a260, _b185, MySqlDouble;
32429
+ var _a261, _b184, MySqlDoubleBuilder, _a262, _b185, MySqlDouble;
31489
32430
  var init_double = __esm({
31490
32431
  "../drizzle-orm/dist/mysql-core/columns/double.js"() {
31491
32432
  "use strict";
31492
32433
  init_entity();
31493
32434
  init_utils2();
31494
32435
  init_common4();
31495
- MySqlDoubleBuilder = class extends (_b184 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b184) {
32436
+ MySqlDoubleBuilder = class extends (_b184 = MySqlColumnBuilderWithAutoIncrement, _a261 = entityKind, _b184) {
31496
32437
  constructor(name2, config) {
31497
32438
  super(name2, "number", "MySqlDouble");
31498
32439
  this.config.precision = config?.precision;
@@ -31503,8 +32444,8 @@ var init_double = __esm({
31503
32444
  return new MySqlDouble(table4, this.config);
31504
32445
  }
31505
32446
  };
31506
- __publicField(MySqlDoubleBuilder, _a259, "MySqlDoubleBuilder");
31507
- MySqlDouble = class extends (_b185 = MySqlColumnWithAutoIncrement, _a260 = entityKind, _b185) {
32447
+ __publicField(MySqlDoubleBuilder, _a261, "MySqlDoubleBuilder");
32448
+ MySqlDouble = class extends (_b185 = MySqlColumnWithAutoIncrement, _a262 = entityKind, _b185) {
31508
32449
  constructor() {
31509
32450
  super(...arguments);
31510
32451
  __publicField(this, "precision", this.config.precision);
@@ -31520,7 +32461,7 @@ var init_double = __esm({
31520
32461
  }
31521
32462
  }
31522
32463
  };
31523
- __publicField(MySqlDouble, _a260, "MySqlDouble");
32464
+ __publicField(MySqlDouble, _a262, "MySqlDouble");
31524
32465
  }
31525
32466
  });
31526
32467
 
@@ -31532,14 +32473,14 @@ function mysqlEnum(a, b) {
31532
32473
  }
31533
32474
  return new MySqlEnumColumnBuilder(name2, values);
31534
32475
  }
31535
- var _a261, _b186, MySqlEnumColumnBuilder, _a262, _b187, MySqlEnumColumn;
32476
+ var _a263, _b186, MySqlEnumColumnBuilder, _a264, _b187, MySqlEnumColumn;
31536
32477
  var init_enum2 = __esm({
31537
32478
  "../drizzle-orm/dist/mysql-core/columns/enum.js"() {
31538
32479
  "use strict";
31539
32480
  init_entity();
31540
32481
  init_utils2();
31541
32482
  init_common4();
31542
- MySqlEnumColumnBuilder = class extends (_b186 = MySqlColumnBuilder, _a261 = entityKind, _b186) {
32483
+ MySqlEnumColumnBuilder = class extends (_b186 = MySqlColumnBuilder, _a263 = entityKind, _b186) {
31543
32484
  constructor(name2, values) {
31544
32485
  super(name2, "string", "MySqlEnumColumn");
31545
32486
  this.config.enumValues = values;
@@ -31552,8 +32493,8 @@ var init_enum2 = __esm({
31552
32493
  );
31553
32494
  }
31554
32495
  };
31555
- __publicField(MySqlEnumColumnBuilder, _a261, "MySqlEnumColumnBuilder");
31556
- MySqlEnumColumn = class extends (_b187 = MySqlColumn, _a262 = entityKind, _b187) {
32496
+ __publicField(MySqlEnumColumnBuilder, _a263, "MySqlEnumColumnBuilder");
32497
+ MySqlEnumColumn = class extends (_b187 = MySqlColumn, _a264 = entityKind, _b187) {
31557
32498
  constructor() {
31558
32499
  super(...arguments);
31559
32500
  __publicField(this, "enumValues", this.config.enumValues);
@@ -31562,7 +32503,7 @@ var init_enum2 = __esm({
31562
32503
  return `enum(${this.enumValues.map((value) => `'${value}'`).join(",")})`;
31563
32504
  }
31564
32505
  };
31565
- __publicField(MySqlEnumColumn, _a262, "MySqlEnumColumn");
32506
+ __publicField(MySqlEnumColumn, _a264, "MySqlEnumColumn");
31566
32507
  }
31567
32508
  });
31568
32509
 
@@ -31570,13 +32511,13 @@ var init_enum2 = __esm({
31570
32511
  function float(name2) {
31571
32512
  return new MySqlFloatBuilder(name2 ?? "");
31572
32513
  }
31573
- var _a263, _b188, MySqlFloatBuilder, _a264, _b189, MySqlFloat;
32514
+ var _a265, _b188, MySqlFloatBuilder, _a266, _b189, MySqlFloat;
31574
32515
  var init_float = __esm({
31575
32516
  "../drizzle-orm/dist/mysql-core/columns/float.js"() {
31576
32517
  "use strict";
31577
32518
  init_entity();
31578
32519
  init_common4();
31579
- MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a263 = entityKind, _b188) {
32520
+ MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b188) {
31580
32521
  constructor(name2) {
31581
32522
  super(name2, "number", "MySqlFloat");
31582
32523
  }
@@ -31585,13 +32526,13 @@ var init_float = __esm({
31585
32526
  return new MySqlFloat(table4, this.config);
31586
32527
  }
31587
32528
  };
31588
- __publicField(MySqlFloatBuilder, _a263, "MySqlFloatBuilder");
31589
- MySqlFloat = class extends (_b189 = MySqlColumnWithAutoIncrement, _a264 = entityKind, _b189) {
32529
+ __publicField(MySqlFloatBuilder, _a265, "MySqlFloatBuilder");
32530
+ MySqlFloat = class extends (_b189 = MySqlColumnWithAutoIncrement, _a266 = entityKind, _b189) {
31590
32531
  getSQLType() {
31591
32532
  return "float";
31592
32533
  }
31593
32534
  };
31594
- __publicField(MySqlFloat, _a264, "MySqlFloat");
32535
+ __publicField(MySqlFloat, _a266, "MySqlFloat");
31595
32536
  }
31596
32537
  });
31597
32538
 
@@ -31600,14 +32541,14 @@ function int(a, b) {
31600
32541
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31601
32542
  return new MySqlIntBuilder(name2, config);
31602
32543
  }
31603
- var _a265, _b190, MySqlIntBuilder, _a266, _b191, MySqlInt;
32544
+ var _a267, _b190, MySqlIntBuilder, _a268, _b191, MySqlInt;
31604
32545
  var init_int = __esm({
31605
32546
  "../drizzle-orm/dist/mysql-core/columns/int.js"() {
31606
32547
  "use strict";
31607
32548
  init_entity();
31608
32549
  init_utils2();
31609
32550
  init_common4();
31610
- MySqlIntBuilder = class extends (_b190 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b190) {
32551
+ MySqlIntBuilder = class extends (_b190 = MySqlColumnBuilderWithAutoIncrement, _a267 = entityKind, _b190) {
31611
32552
  constructor(name2, config) {
31612
32553
  super(name2, "number", "MySqlInt");
31613
32554
  this.config.unsigned = config ? config.unsigned : false;
@@ -31617,8 +32558,8 @@ var init_int = __esm({
31617
32558
  return new MySqlInt(table4, this.config);
31618
32559
  }
31619
32560
  };
31620
- __publicField(MySqlIntBuilder, _a265, "MySqlIntBuilder");
31621
- MySqlInt = class extends (_b191 = MySqlColumnWithAutoIncrement, _a266 = entityKind, _b191) {
32561
+ __publicField(MySqlIntBuilder, _a267, "MySqlIntBuilder");
32562
+ MySqlInt = class extends (_b191 = MySqlColumnWithAutoIncrement, _a268 = entityKind, _b191) {
31622
32563
  getSQLType() {
31623
32564
  return `int${this.config.unsigned ? " unsigned" : ""}`;
31624
32565
  }
@@ -31629,7 +32570,7 @@ var init_int = __esm({
31629
32570
  return value;
31630
32571
  }
31631
32572
  };
31632
- __publicField(MySqlInt, _a266, "MySqlInt");
32573
+ __publicField(MySqlInt, _a268, "MySqlInt");
31633
32574
  }
31634
32575
  });
31635
32576
 
@@ -31637,13 +32578,13 @@ var init_int = __esm({
31637
32578
  function json2(name2) {
31638
32579
  return new MySqlJsonBuilder(name2 ?? "");
31639
32580
  }
31640
- var _a267, _b192, MySqlJsonBuilder, _a268, _b193, MySqlJson;
32581
+ var _a269, _b192, MySqlJsonBuilder, _a270, _b193, MySqlJson;
31641
32582
  var init_json2 = __esm({
31642
32583
  "../drizzle-orm/dist/mysql-core/columns/json.js"() {
31643
32584
  "use strict";
31644
32585
  init_entity();
31645
32586
  init_common4();
31646
- MySqlJsonBuilder = class extends (_b192 = MySqlColumnBuilder, _a267 = entityKind, _b192) {
32587
+ MySqlJsonBuilder = class extends (_b192 = MySqlColumnBuilder, _a269 = entityKind, _b192) {
31647
32588
  constructor(name2) {
31648
32589
  super(name2, "json", "MySqlJson");
31649
32590
  }
@@ -31652,8 +32593,8 @@ var init_json2 = __esm({
31652
32593
  return new MySqlJson(table4, this.config);
31653
32594
  }
31654
32595
  };
31655
- __publicField(MySqlJsonBuilder, _a267, "MySqlJsonBuilder");
31656
- MySqlJson = class extends (_b193 = MySqlColumn, _a268 = entityKind, _b193) {
32596
+ __publicField(MySqlJsonBuilder, _a269, "MySqlJsonBuilder");
32597
+ MySqlJson = class extends (_b193 = MySqlColumn, _a270 = entityKind, _b193) {
31657
32598
  getSQLType() {
31658
32599
  return "json";
31659
32600
  }
@@ -31661,7 +32602,7 @@ var init_json2 = __esm({
31661
32602
  return JSON.stringify(value);
31662
32603
  }
31663
32604
  };
31664
- __publicField(MySqlJson, _a268, "MySqlJson");
32605
+ __publicField(MySqlJson, _a270, "MySqlJson");
31665
32606
  }
31666
32607
  });
31667
32608
 
@@ -31670,14 +32611,14 @@ function mediumint(a, b) {
31670
32611
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31671
32612
  return new MySqlMediumIntBuilder(name2, config);
31672
32613
  }
31673
- var _a269, _b194, MySqlMediumIntBuilder, _a270, _b195, MySqlMediumInt;
32614
+ var _a271, _b194, MySqlMediumIntBuilder, _a272, _b195, MySqlMediumInt;
31674
32615
  var init_mediumint = __esm({
31675
32616
  "../drizzle-orm/dist/mysql-core/columns/mediumint.js"() {
31676
32617
  "use strict";
31677
32618
  init_entity();
31678
32619
  init_utils2();
31679
32620
  init_common4();
31680
- MySqlMediumIntBuilder = class extends (_b194 = MySqlColumnBuilderWithAutoIncrement, _a269 = entityKind, _b194) {
32621
+ MySqlMediumIntBuilder = class extends (_b194 = MySqlColumnBuilderWithAutoIncrement, _a271 = entityKind, _b194) {
31681
32622
  constructor(name2, config) {
31682
32623
  super(name2, "number", "MySqlMediumInt");
31683
32624
  this.config.unsigned = config ? config.unsigned : false;
@@ -31690,8 +32631,8 @@ var init_mediumint = __esm({
31690
32631
  );
31691
32632
  }
31692
32633
  };
31693
- __publicField(MySqlMediumIntBuilder, _a269, "MySqlMediumIntBuilder");
31694
- MySqlMediumInt = class extends (_b195 = MySqlColumnWithAutoIncrement, _a270 = entityKind, _b195) {
32634
+ __publicField(MySqlMediumIntBuilder, _a271, "MySqlMediumIntBuilder");
32635
+ MySqlMediumInt = class extends (_b195 = MySqlColumnWithAutoIncrement, _a272 = entityKind, _b195) {
31695
32636
  getSQLType() {
31696
32637
  return `mediumint${this.config.unsigned ? " unsigned" : ""}`;
31697
32638
  }
@@ -31702,7 +32643,7 @@ var init_mediumint = __esm({
31702
32643
  return value;
31703
32644
  }
31704
32645
  };
31705
- __publicField(MySqlMediumInt, _a270, "MySqlMediumInt");
32646
+ __publicField(MySqlMediumInt, _a272, "MySqlMediumInt");
31706
32647
  }
31707
32648
  });
31708
32649
 
@@ -31711,14 +32652,14 @@ function real3(a, b = {}) {
31711
32652
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31712
32653
  return new MySqlRealBuilder(name2, config);
31713
32654
  }
31714
- var _a271, _b196, MySqlRealBuilder, _a272, _b197, MySqlReal;
32655
+ var _a273, _b196, MySqlRealBuilder, _a274, _b197, MySqlReal;
31715
32656
  var init_real3 = __esm({
31716
32657
  "../drizzle-orm/dist/mysql-core/columns/real.js"() {
31717
32658
  "use strict";
31718
32659
  init_entity();
31719
32660
  init_utils2();
31720
32661
  init_common4();
31721
- MySqlRealBuilder = class extends (_b196 = MySqlColumnBuilderWithAutoIncrement, _a271 = entityKind, _b196) {
32662
+ MySqlRealBuilder = class extends (_b196 = MySqlColumnBuilderWithAutoIncrement, _a273 = entityKind, _b196) {
31722
32663
  constructor(name2, config) {
31723
32664
  super(name2, "number", "MySqlReal");
31724
32665
  this.config.precision = config?.precision;
@@ -31729,8 +32670,8 @@ var init_real3 = __esm({
31729
32670
  return new MySqlReal(table4, this.config);
31730
32671
  }
31731
32672
  };
31732
- __publicField(MySqlRealBuilder, _a271, "MySqlRealBuilder");
31733
- MySqlReal = class extends (_b197 = MySqlColumnWithAutoIncrement, _a272 = entityKind, _b197) {
32673
+ __publicField(MySqlRealBuilder, _a273, "MySqlRealBuilder");
32674
+ MySqlReal = class extends (_b197 = MySqlColumnWithAutoIncrement, _a274 = entityKind, _b197) {
31734
32675
  constructor() {
31735
32676
  super(...arguments);
31736
32677
  __publicField(this, "precision", this.config.precision);
@@ -31746,7 +32687,7 @@ var init_real3 = __esm({
31746
32687
  }
31747
32688
  }
31748
32689
  };
31749
- __publicField(MySqlReal, _a272, "MySqlReal");
32690
+ __publicField(MySqlReal, _a274, "MySqlReal");
31750
32691
  }
31751
32692
  });
31752
32693
 
@@ -31754,13 +32695,13 @@ var init_real3 = __esm({
31754
32695
  function serial2(name2) {
31755
32696
  return new MySqlSerialBuilder(name2 ?? "");
31756
32697
  }
31757
- var _a273, _b198, MySqlSerialBuilder, _a274, _b199, MySqlSerial;
32698
+ var _a275, _b198, MySqlSerialBuilder, _a276, _b199, MySqlSerial;
31758
32699
  var init_serial2 = __esm({
31759
32700
  "../drizzle-orm/dist/mysql-core/columns/serial.js"() {
31760
32701
  "use strict";
31761
32702
  init_entity();
31762
32703
  init_common4();
31763
- MySqlSerialBuilder = class extends (_b198 = MySqlColumnBuilderWithAutoIncrement, _a273 = entityKind, _b198) {
32704
+ MySqlSerialBuilder = class extends (_b198 = MySqlColumnBuilderWithAutoIncrement, _a275 = entityKind, _b198) {
31764
32705
  constructor(name2) {
31765
32706
  super(name2, "number", "MySqlSerial");
31766
32707
  this.config.hasDefault = true;
@@ -31771,8 +32712,8 @@ var init_serial2 = __esm({
31771
32712
  return new MySqlSerial(table4, this.config);
31772
32713
  }
31773
32714
  };
31774
- __publicField(MySqlSerialBuilder, _a273, "MySqlSerialBuilder");
31775
- MySqlSerial = class extends (_b199 = MySqlColumnWithAutoIncrement, _a274 = entityKind, _b199) {
32715
+ __publicField(MySqlSerialBuilder, _a275, "MySqlSerialBuilder");
32716
+ MySqlSerial = class extends (_b199 = MySqlColumnWithAutoIncrement, _a276 = entityKind, _b199) {
31776
32717
  getSQLType() {
31777
32718
  return "serial";
31778
32719
  }
@@ -31783,7 +32724,7 @@ var init_serial2 = __esm({
31783
32724
  return value;
31784
32725
  }
31785
32726
  };
31786
- __publicField(MySqlSerial, _a274, "MySqlSerial");
32727
+ __publicField(MySqlSerial, _a276, "MySqlSerial");
31787
32728
  }
31788
32729
  });
31789
32730
 
@@ -31792,14 +32733,14 @@ function smallint2(a, b) {
31792
32733
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31793
32734
  return new MySqlSmallIntBuilder(name2, config);
31794
32735
  }
31795
- var _a275, _b200, MySqlSmallIntBuilder, _a276, _b201, MySqlSmallInt;
32736
+ var _a277, _b200, MySqlSmallIntBuilder, _a278, _b201, MySqlSmallInt;
31796
32737
  var init_smallint2 = __esm({
31797
32738
  "../drizzle-orm/dist/mysql-core/columns/smallint.js"() {
31798
32739
  "use strict";
31799
32740
  init_entity();
31800
32741
  init_utils2();
31801
32742
  init_common4();
31802
- MySqlSmallIntBuilder = class extends (_b200 = MySqlColumnBuilderWithAutoIncrement, _a275 = entityKind, _b200) {
32743
+ MySqlSmallIntBuilder = class extends (_b200 = MySqlColumnBuilderWithAutoIncrement, _a277 = entityKind, _b200) {
31803
32744
  constructor(name2, config) {
31804
32745
  super(name2, "number", "MySqlSmallInt");
31805
32746
  this.config.unsigned = config ? config.unsigned : false;
@@ -31812,8 +32753,8 @@ var init_smallint2 = __esm({
31812
32753
  );
31813
32754
  }
31814
32755
  };
31815
- __publicField(MySqlSmallIntBuilder, _a275, "MySqlSmallIntBuilder");
31816
- MySqlSmallInt = class extends (_b201 = MySqlColumnWithAutoIncrement, _a276 = entityKind, _b201) {
32756
+ __publicField(MySqlSmallIntBuilder, _a277, "MySqlSmallIntBuilder");
32757
+ MySqlSmallInt = class extends (_b201 = MySqlColumnWithAutoIncrement, _a278 = entityKind, _b201) {
31817
32758
  getSQLType() {
31818
32759
  return `smallint${this.config.unsigned ? " unsigned" : ""}`;
31819
32760
  }
@@ -31824,7 +32765,7 @@ var init_smallint2 = __esm({
31824
32765
  return value;
31825
32766
  }
31826
32767
  };
31827
- __publicField(MySqlSmallInt, _a276, "MySqlSmallInt");
32768
+ __publicField(MySqlSmallInt, _a278, "MySqlSmallInt");
31828
32769
  }
31829
32770
  });
31830
32771
 
@@ -31833,14 +32774,14 @@ function text3(a, b = {}) {
31833
32774
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31834
32775
  return new MySqlTextBuilder(name2, "text", config);
31835
32776
  }
31836
- var _a277, _b202, MySqlTextBuilder, _a278, _b203, MySqlText;
32777
+ var _a279, _b202, MySqlTextBuilder, _a280, _b203, MySqlText;
31837
32778
  var init_text3 = __esm({
31838
32779
  "../drizzle-orm/dist/mysql-core/columns/text.js"() {
31839
32780
  "use strict";
31840
32781
  init_entity();
31841
32782
  init_utils2();
31842
32783
  init_common4();
31843
- MySqlTextBuilder = class extends (_b202 = MySqlColumnBuilder, _a277 = entityKind, _b202) {
32784
+ MySqlTextBuilder = class extends (_b202 = MySqlColumnBuilder, _a279 = entityKind, _b202) {
31844
32785
  constructor(name2, textType, config) {
31845
32786
  super(name2, "string", "MySqlText");
31846
32787
  this.config.textType = textType;
@@ -31851,8 +32792,8 @@ var init_text3 = __esm({
31851
32792
  return new MySqlText(table4, this.config);
31852
32793
  }
31853
32794
  };
31854
- __publicField(MySqlTextBuilder, _a277, "MySqlTextBuilder");
31855
- MySqlText = class extends (_b203 = MySqlColumn, _a278 = entityKind, _b203) {
32795
+ __publicField(MySqlTextBuilder, _a279, "MySqlTextBuilder");
32796
+ MySqlText = class extends (_b203 = MySqlColumn, _a280 = entityKind, _b203) {
31856
32797
  constructor() {
31857
32798
  super(...arguments);
31858
32799
  __publicField(this, "textType", this.config.textType);
@@ -31862,7 +32803,7 @@ var init_text3 = __esm({
31862
32803
  return this.textType;
31863
32804
  }
31864
32805
  };
31865
- __publicField(MySqlText, _a278, "MySqlText");
32806
+ __publicField(MySqlText, _a280, "MySqlText");
31866
32807
  }
31867
32808
  });
31868
32809
 
@@ -31871,14 +32812,14 @@ function time2(a, b) {
31871
32812
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31872
32813
  return new MySqlTimeBuilder(name2, config);
31873
32814
  }
31874
- var _a279, _b204, MySqlTimeBuilder, _a280, _b205, MySqlTime;
32815
+ var _a281, _b204, MySqlTimeBuilder, _a282, _b205, MySqlTime;
31875
32816
  var init_time2 = __esm({
31876
32817
  "../drizzle-orm/dist/mysql-core/columns/time.js"() {
31877
32818
  "use strict";
31878
32819
  init_entity();
31879
32820
  init_utils2();
31880
32821
  init_common4();
31881
- MySqlTimeBuilder = class extends (_b204 = MySqlColumnBuilder, _a279 = entityKind, _b204) {
32822
+ MySqlTimeBuilder = class extends (_b204 = MySqlColumnBuilder, _a281 = entityKind, _b204) {
31882
32823
  constructor(name2, config) {
31883
32824
  super(name2, "string", "MySqlTime");
31884
32825
  this.config.fsp = config?.fsp;
@@ -31888,8 +32829,8 @@ var init_time2 = __esm({
31888
32829
  return new MySqlTime(table4, this.config);
31889
32830
  }
31890
32831
  };
31891
- __publicField(MySqlTimeBuilder, _a279, "MySqlTimeBuilder");
31892
- MySqlTime = class extends (_b205 = MySqlColumn, _a280 = entityKind, _b205) {
32832
+ __publicField(MySqlTimeBuilder, _a281, "MySqlTimeBuilder");
32833
+ MySqlTime = class extends (_b205 = MySqlColumn, _a282 = entityKind, _b205) {
31893
32834
  constructor() {
31894
32835
  super(...arguments);
31895
32836
  __publicField(this, "fsp", this.config.fsp);
@@ -31899,19 +32840,19 @@ var init_time2 = __esm({
31899
32840
  return `time${precision}`;
31900
32841
  }
31901
32842
  };
31902
- __publicField(MySqlTime, _a280, "MySqlTime");
32843
+ __publicField(MySqlTime, _a282, "MySqlTime");
31903
32844
  }
31904
32845
  });
31905
32846
 
31906
32847
  // ../drizzle-orm/dist/mysql-core/columns/date.common.js
31907
- var _a281, _b206, MySqlDateColumnBaseBuilder, _a282, _b207, MySqlDateBaseColumn;
32848
+ var _a283, _b206, MySqlDateColumnBaseBuilder, _a284, _b207, MySqlDateBaseColumn;
31908
32849
  var init_date_common2 = __esm({
31909
32850
  "../drizzle-orm/dist/mysql-core/columns/date.common.js"() {
31910
32851
  "use strict";
31911
32852
  init_entity();
31912
32853
  init_sql();
31913
32854
  init_common4();
31914
- MySqlDateColumnBaseBuilder = class extends (_b206 = MySqlColumnBuilder, _a281 = entityKind, _b206) {
32855
+ MySqlDateColumnBaseBuilder = class extends (_b206 = MySqlColumnBuilder, _a283 = entityKind, _b206) {
31915
32856
  defaultNow() {
31916
32857
  return this.default(sql`(now())`);
31917
32858
  }
@@ -31922,14 +32863,14 @@ var init_date_common2 = __esm({
31922
32863
  return this;
31923
32864
  }
31924
32865
  };
31925
- __publicField(MySqlDateColumnBaseBuilder, _a281, "MySqlDateColumnBuilder");
31926
- MySqlDateBaseColumn = class extends (_b207 = MySqlColumn, _a282 = entityKind, _b207) {
32866
+ __publicField(MySqlDateColumnBaseBuilder, _a283, "MySqlDateColumnBuilder");
32867
+ MySqlDateBaseColumn = class extends (_b207 = MySqlColumn, _a284 = entityKind, _b207) {
31927
32868
  constructor() {
31928
32869
  super(...arguments);
31929
32870
  __publicField(this, "hasOnUpdateNow", this.config.hasOnUpdateNow);
31930
32871
  }
31931
32872
  };
31932
- __publicField(MySqlDateBaseColumn, _a282, "MySqlDateColumn");
32873
+ __publicField(MySqlDateBaseColumn, _a284, "MySqlDateColumn");
31933
32874
  }
31934
32875
  });
31935
32876
 
@@ -31941,14 +32882,14 @@ function timestamp2(a, b = {}) {
31941
32882
  }
31942
32883
  return new MySqlTimestampBuilder(name2, config);
31943
32884
  }
31944
- var _a283, _b208, MySqlTimestampBuilder, _a284, _b209, MySqlTimestamp, _a285, _b210, MySqlTimestampStringBuilder, _a286, _b211, MySqlTimestampString;
32885
+ var _a285, _b208, MySqlTimestampBuilder, _a286, _b209, MySqlTimestamp, _a287, _b210, MySqlTimestampStringBuilder, _a288, _b211, MySqlTimestampString;
31945
32886
  var init_timestamp2 = __esm({
31946
32887
  "../drizzle-orm/dist/mysql-core/columns/timestamp.js"() {
31947
32888
  "use strict";
31948
32889
  init_entity();
31949
32890
  init_utils2();
31950
32891
  init_date_common2();
31951
- MySqlTimestampBuilder = class extends (_b208 = MySqlDateColumnBaseBuilder, _a283 = entityKind, _b208) {
32892
+ MySqlTimestampBuilder = class extends (_b208 = MySqlDateColumnBaseBuilder, _a285 = entityKind, _b208) {
31952
32893
  constructor(name2, config) {
31953
32894
  super(name2, "date", "MySqlTimestamp");
31954
32895
  this.config.fsp = config?.fsp;
@@ -31961,8 +32902,8 @@ var init_timestamp2 = __esm({
31961
32902
  );
31962
32903
  }
31963
32904
  };
31964
- __publicField(MySqlTimestampBuilder, _a283, "MySqlTimestampBuilder");
31965
- MySqlTimestamp = class extends (_b209 = MySqlDateBaseColumn, _a284 = entityKind, _b209) {
32905
+ __publicField(MySqlTimestampBuilder, _a285, "MySqlTimestampBuilder");
32906
+ MySqlTimestamp = class extends (_b209 = MySqlDateBaseColumn, _a286 = entityKind, _b209) {
31966
32907
  constructor() {
31967
32908
  super(...arguments);
31968
32909
  __publicField(this, "fsp", this.config.fsp);
@@ -31978,8 +32919,8 @@ var init_timestamp2 = __esm({
31978
32919
  return value.toISOString().slice(0, -1).replace("T", " ");
31979
32920
  }
31980
32921
  };
31981
- __publicField(MySqlTimestamp, _a284, "MySqlTimestamp");
31982
- MySqlTimestampStringBuilder = class extends (_b210 = MySqlDateColumnBaseBuilder, _a285 = entityKind, _b210) {
32922
+ __publicField(MySqlTimestamp, _a286, "MySqlTimestamp");
32923
+ MySqlTimestampStringBuilder = class extends (_b210 = MySqlDateColumnBaseBuilder, _a287 = entityKind, _b210) {
31983
32924
  constructor(name2, config) {
31984
32925
  super(name2, "string", "MySqlTimestampString");
31985
32926
  this.config.fsp = config?.fsp;
@@ -31992,8 +32933,8 @@ var init_timestamp2 = __esm({
31992
32933
  );
31993
32934
  }
31994
32935
  };
31995
- __publicField(MySqlTimestampStringBuilder, _a285, "MySqlTimestampStringBuilder");
31996
- MySqlTimestampString = class extends (_b211 = MySqlDateBaseColumn, _a286 = entityKind, _b211) {
32936
+ __publicField(MySqlTimestampStringBuilder, _a287, "MySqlTimestampStringBuilder");
32937
+ MySqlTimestampString = class extends (_b211 = MySqlDateBaseColumn, _a288 = entityKind, _b211) {
31997
32938
  constructor() {
31998
32939
  super(...arguments);
31999
32940
  __publicField(this, "fsp", this.config.fsp);
@@ -32003,7 +32944,7 @@ var init_timestamp2 = __esm({
32003
32944
  return `timestamp${precision}`;
32004
32945
  }
32005
32946
  };
32006
- __publicField(MySqlTimestampString, _a286, "MySqlTimestampString");
32947
+ __publicField(MySqlTimestampString, _a288, "MySqlTimestampString");
32007
32948
  }
32008
32949
  });
32009
32950
 
@@ -32012,14 +32953,14 @@ function tinyint(a, b) {
32012
32953
  const { name: name2, config } = getColumnNameAndConfig(a, b);
32013
32954
  return new MySqlTinyIntBuilder(name2, config);
32014
32955
  }
32015
- var _a287, _b212, MySqlTinyIntBuilder, _a288, _b213, MySqlTinyInt;
32956
+ var _a289, _b212, MySqlTinyIntBuilder, _a290, _b213, MySqlTinyInt;
32016
32957
  var init_tinyint = __esm({
32017
32958
  "../drizzle-orm/dist/mysql-core/columns/tinyint.js"() {
32018
32959
  "use strict";
32019
32960
  init_entity();
32020
32961
  init_utils2();
32021
32962
  init_common4();
32022
- MySqlTinyIntBuilder = class extends (_b212 = MySqlColumnBuilderWithAutoIncrement, _a287 = entityKind, _b212) {
32963
+ MySqlTinyIntBuilder = class extends (_b212 = MySqlColumnBuilderWithAutoIncrement, _a289 = entityKind, _b212) {
32023
32964
  constructor(name2, config) {
32024
32965
  super(name2, "number", "MySqlTinyInt");
32025
32966
  this.config.unsigned = config ? config.unsigned : false;
@@ -32032,8 +32973,8 @@ var init_tinyint = __esm({
32032
32973
  );
32033
32974
  }
32034
32975
  };
32035
- __publicField(MySqlTinyIntBuilder, _a287, "MySqlTinyIntBuilder");
32036
- MySqlTinyInt = class extends (_b213 = MySqlColumnWithAutoIncrement, _a288 = entityKind, _b213) {
32976
+ __publicField(MySqlTinyIntBuilder, _a289, "MySqlTinyIntBuilder");
32977
+ MySqlTinyInt = class extends (_b213 = MySqlColumnWithAutoIncrement, _a290 = entityKind, _b213) {
32037
32978
  getSQLType() {
32038
32979
  return `tinyint${this.config.unsigned ? " unsigned" : ""}`;
32039
32980
  }
@@ -32044,7 +32985,7 @@ var init_tinyint = __esm({
32044
32985
  return value;
32045
32986
  }
32046
32987
  };
32047
- __publicField(MySqlTinyInt, _a288, "MySqlTinyInt");
32988
+ __publicField(MySqlTinyInt, _a290, "MySqlTinyInt");
32048
32989
  }
32049
32990
  });
32050
32991
 
@@ -32053,14 +32994,14 @@ function varbinary(a, b) {
32053
32994
  const { name: name2, config } = getColumnNameAndConfig(a, b);
32054
32995
  return new MySqlVarBinaryBuilder(name2, config);
32055
32996
  }
32056
- var _a289, _b214, MySqlVarBinaryBuilder, _a290, _b215, MySqlVarBinary;
32997
+ var _a291, _b214, MySqlVarBinaryBuilder, _a292, _b215, MySqlVarBinary;
32057
32998
  var init_varbinary = __esm({
32058
32999
  "../drizzle-orm/dist/mysql-core/columns/varbinary.js"() {
32059
33000
  "use strict";
32060
33001
  init_entity();
32061
33002
  init_utils2();
32062
33003
  init_common4();
32063
- MySqlVarBinaryBuilder = class extends (_b214 = MySqlColumnBuilder, _a289 = entityKind, _b214) {
33004
+ MySqlVarBinaryBuilder = class extends (_b214 = MySqlColumnBuilder, _a291 = entityKind, _b214) {
32064
33005
  /** @internal */
32065
33006
  constructor(name2, config) {
32066
33007
  super(name2, "string", "MySqlVarBinary");
@@ -32074,8 +33015,8 @@ var init_varbinary = __esm({
32074
33015
  );
32075
33016
  }
32076
33017
  };
32077
- __publicField(MySqlVarBinaryBuilder, _a289, "MySqlVarBinaryBuilder");
32078
- MySqlVarBinary = class extends (_b215 = MySqlColumn, _a290 = entityKind, _b215) {
33018
+ __publicField(MySqlVarBinaryBuilder, _a291, "MySqlVarBinaryBuilder");
33019
+ MySqlVarBinary = class extends (_b215 = MySqlColumn, _a292 = entityKind, _b215) {
32079
33020
  constructor() {
32080
33021
  super(...arguments);
32081
33022
  __publicField(this, "length", this.config.length);
@@ -32084,7 +33025,7 @@ var init_varbinary = __esm({
32084
33025
  return this.length === void 0 ? `varbinary` : `varbinary(${this.length})`;
32085
33026
  }
32086
33027
  };
32087
- __publicField(MySqlVarBinary, _a290, "MySqlVarBinary");
33028
+ __publicField(MySqlVarBinary, _a292, "MySqlVarBinary");
32088
33029
  }
32089
33030
  });
32090
33031
 
@@ -32093,14 +33034,14 @@ function varchar2(a, b) {
32093
33034
  const { name: name2, config } = getColumnNameAndConfig(a, b);
32094
33035
  return new MySqlVarCharBuilder(name2, config);
32095
33036
  }
32096
- var _a291, _b216, MySqlVarCharBuilder, _a292, _b217, MySqlVarChar;
33037
+ var _a293, _b216, MySqlVarCharBuilder, _a294, _b217, MySqlVarChar;
32097
33038
  var init_varchar2 = __esm({
32098
33039
  "../drizzle-orm/dist/mysql-core/columns/varchar.js"() {
32099
33040
  "use strict";
32100
33041
  init_entity();
32101
33042
  init_utils2();
32102
33043
  init_common4();
32103
- MySqlVarCharBuilder = class extends (_b216 = MySqlColumnBuilder, _a291 = entityKind, _b216) {
33044
+ MySqlVarCharBuilder = class extends (_b216 = MySqlColumnBuilder, _a293 = entityKind, _b216) {
32104
33045
  /** @internal */
32105
33046
  constructor(name2, config) {
32106
33047
  super(name2, "string", "MySqlVarChar");
@@ -32115,8 +33056,8 @@ var init_varchar2 = __esm({
32115
33056
  );
32116
33057
  }
32117
33058
  };
32118
- __publicField(MySqlVarCharBuilder, _a291, "MySqlVarCharBuilder");
32119
- MySqlVarChar = class extends (_b217 = MySqlColumn, _a292 = entityKind, _b217) {
33059
+ __publicField(MySqlVarCharBuilder, _a293, "MySqlVarCharBuilder");
33060
+ MySqlVarChar = class extends (_b217 = MySqlColumn, _a294 = entityKind, _b217) {
32120
33061
  constructor() {
32121
33062
  super(...arguments);
32122
33063
  __publicField(this, "length", this.config.length);
@@ -32126,7 +33067,7 @@ var init_varchar2 = __esm({
32126
33067
  return this.length === void 0 ? `varchar` : `varchar(${this.length})`;
32127
33068
  }
32128
33069
  };
32129
- __publicField(MySqlVarChar, _a292, "MySqlVarChar");
33070
+ __publicField(MySqlVarChar, _a294, "MySqlVarChar");
32130
33071
  }
32131
33072
  });
32132
33073
 
@@ -32134,13 +33075,13 @@ var init_varchar2 = __esm({
32134
33075
  function year(name2) {
32135
33076
  return new MySqlYearBuilder(name2 ?? "");
32136
33077
  }
32137
- var _a293, _b218, MySqlYearBuilder, _a294, _b219, MySqlYear;
33078
+ var _a295, _b218, MySqlYearBuilder, _a296, _b219, MySqlYear;
32138
33079
  var init_year = __esm({
32139
33080
  "../drizzle-orm/dist/mysql-core/columns/year.js"() {
32140
33081
  "use strict";
32141
33082
  init_entity();
32142
33083
  init_common4();
32143
- MySqlYearBuilder = class extends (_b218 = MySqlColumnBuilder, _a293 = entityKind, _b218) {
33084
+ MySqlYearBuilder = class extends (_b218 = MySqlColumnBuilder, _a295 = entityKind, _b218) {
32144
33085
  constructor(name2) {
32145
33086
  super(name2, "number", "MySqlYear");
32146
33087
  }
@@ -32149,13 +33090,13 @@ var init_year = __esm({
32149
33090
  return new MySqlYear(table4, this.config);
32150
33091
  }
32151
33092
  };
32152
- __publicField(MySqlYearBuilder, _a293, "MySqlYearBuilder");
32153
- MySqlYear = class extends (_b219 = MySqlColumn, _a294 = entityKind, _b219) {
33093
+ __publicField(MySqlYearBuilder, _a295, "MySqlYearBuilder");
33094
+ MySqlYear = class extends (_b219 = MySqlColumn, _a296 = entityKind, _b219) {
32154
33095
  getSQLType() {
32155
33096
  return `year`;
32156
33097
  }
32157
33098
  };
32158
- __publicField(MySqlYear, _a294, "MySqlYear");
33099
+ __publicField(MySqlYear, _a296, "MySqlYear");
32159
33100
  }
32160
33101
  });
32161
33102
 
@@ -32192,17 +33133,17 @@ var init_columns3 = __esm({
32192
33133
  });
32193
33134
 
32194
33135
  // ../drizzle-orm/dist/mysql-core/query-builders/count.js
32195
- var _a295, _b220, _c9, _MySqlCountBuilder, MySqlCountBuilder;
33136
+ var _a297, _b220, _c9, _MySqlCountBuilder, MySqlCountBuilder;
32196
33137
  var init_count3 = __esm({
32197
33138
  "../drizzle-orm/dist/mysql-core/query-builders/count.js"() {
32198
33139
  "use strict";
32199
33140
  init_entity();
32200
33141
  init_sql();
32201
- _MySqlCountBuilder = class _MySqlCountBuilder extends (_c9 = SQL, _b220 = entityKind, _a295 = Symbol.toStringTag, _c9) {
33142
+ _MySqlCountBuilder = class _MySqlCountBuilder extends (_c9 = SQL, _b220 = entityKind, _a297 = Symbol.toStringTag, _c9) {
32202
33143
  constructor(params) {
32203
33144
  super(_MySqlCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
32204
33145
  __publicField(this, "sql");
32205
- __publicField(this, _a295, "MySqlCountBuilder");
33146
+ __publicField(this, _a297, "MySqlCountBuilder");
32206
33147
  __publicField(this, "session");
32207
33148
  this.params = params;
32208
33149
  this.mapWith(Number);
@@ -32246,13 +33187,13 @@ var init_count3 = __esm({
32246
33187
  });
32247
33188
 
32248
33189
  // ../drizzle-orm/dist/mysql-core/query-builders/delete.js
32249
- var _a296, _b221, MySqlDeleteBase;
33190
+ var _a298, _b221, MySqlDeleteBase;
32250
33191
  var init_delete3 = __esm({
32251
33192
  "../drizzle-orm/dist/mysql-core/query-builders/delete.js"() {
32252
33193
  "use strict";
32253
33194
  init_entity();
32254
33195
  init_query_promise();
32255
- MySqlDeleteBase = class extends (_b221 = QueryPromise, _a296 = entityKind, _b221) {
33196
+ MySqlDeleteBase = class extends (_b221 = QueryPromise, _a298 = entityKind, _b221) {
32256
33197
  constructor(table4, session, dialect4, withList) {
32257
33198
  super();
32258
33199
  __publicField(this, "config");
@@ -32322,12 +33263,12 @@ var init_delete3 = __esm({
32322
33263
  return this;
32323
33264
  }
32324
33265
  };
32325
- __publicField(MySqlDeleteBase, _a296, "MySqlDelete");
33266
+ __publicField(MySqlDeleteBase, _a298, "MySqlDelete");
32326
33267
  }
32327
33268
  });
32328
33269
 
32329
33270
  // ../drizzle-orm/dist/mysql-core/query-builders/insert.js
32330
- var _a297, MySqlInsertBuilder, _a298, _b222, MySqlInsertBase;
33271
+ var _a299, MySqlInsertBuilder, _a300, _b222, MySqlInsertBase;
32331
33272
  var init_insert3 = __esm({
32332
33273
  "../drizzle-orm/dist/mysql-core/query-builders/insert.js"() {
32333
33274
  "use strict";
@@ -32336,7 +33277,7 @@ var init_insert3 = __esm({
32336
33277
  init_sql();
32337
33278
  init_table();
32338
33279
  init_utils2();
32339
- _a297 = entityKind;
33280
+ _a299 = entityKind;
32340
33281
  MySqlInsertBuilder = class {
32341
33282
  constructor(table4, session, dialect4) {
32342
33283
  __publicField(this, "shouldIgnore", false);
@@ -32365,8 +33306,8 @@ var init_insert3 = __esm({
32365
33306
  return new MySqlInsertBase(this.table, mappedValues, this.shouldIgnore, this.session, this.dialect);
32366
33307
  }
32367
33308
  };
32368
- __publicField(MySqlInsertBuilder, _a297, "MySqlInsertBuilder");
32369
- MySqlInsertBase = class extends (_b222 = QueryPromise, _a298 = entityKind, _b222) {
33309
+ __publicField(MySqlInsertBuilder, _a299, "MySqlInsertBuilder");
33310
+ MySqlInsertBase = class extends (_b222 = QueryPromise, _a300 = entityKind, _b222) {
32370
33311
  constructor(table4, values, ignore, session, dialect4) {
32371
33312
  super();
32372
33313
  __publicField(this, "config");
@@ -32447,7 +33388,7 @@ var init_insert3 = __esm({
32447
33388
  return this;
32448
33389
  }
32449
33390
  };
32450
- __publicField(MySqlInsertBase, _a298, "MySqlInsert");
33391
+ __publicField(MySqlInsertBase, _a300, "MySqlInsert");
32451
33392
  }
32452
33393
  });
32453
33394
 
@@ -32531,7 +33472,7 @@ function mysqlTableWithSchema(name2, columns, extraConfig, schema4, baseName = n
32531
33472
  }
32532
33473
  return table4;
32533
33474
  }
32534
- var InlineForeignKeys3, _a299, _b223, _c10, _d4, _e3, MySqlTable, mysqlTable;
33475
+ var InlineForeignKeys3, _a301, _b223, _c10, _d4, _e3, MySqlTable, mysqlTable;
32535
33476
  var init_table4 = __esm({
32536
33477
  "../drizzle-orm/dist/mysql-core/table.js"() {
32537
33478
  "use strict";
@@ -32539,7 +33480,7 @@ var init_table4 = __esm({
32539
33480
  init_table();
32540
33481
  init_all3();
32541
33482
  InlineForeignKeys3 = Symbol.for("drizzle:MySqlInlineForeignKeys");
32542
- MySqlTable = class extends (_e3 = Table, _d4 = entityKind, _c10 = Table.Symbol.Columns, _b223 = InlineForeignKeys3, _a299 = Table.Symbol.ExtraConfigBuilder, _e3) {
33483
+ MySqlTable = class extends (_e3 = Table, _d4 = entityKind, _c10 = Table.Symbol.Columns, _b223 = InlineForeignKeys3, _a301 = Table.Symbol.ExtraConfigBuilder, _e3) {
32543
33484
  constructor() {
32544
33485
  super(...arguments);
32545
33486
  /** @internal */
@@ -32547,7 +33488,7 @@ var init_table4 = __esm({
32547
33488
  /** @internal */
32548
33489
  __publicField(this, _b223, []);
32549
33490
  /** @internal */
32550
- __publicField(this, _a299);
33491
+ __publicField(this, _a301);
32551
33492
  }
32552
33493
  };
32553
33494
  __publicField(MySqlTable, _d4, "MySqlTable");
@@ -32562,20 +33503,20 @@ var init_table4 = __esm({
32562
33503
  });
32563
33504
 
32564
33505
  // ../drizzle-orm/dist/mysql-core/view-base.js
32565
- var _a300, _b224, MySqlViewBase;
33506
+ var _a302, _b224, MySqlViewBase;
32566
33507
  var init_view_base3 = __esm({
32567
33508
  "../drizzle-orm/dist/mysql-core/view-base.js"() {
32568
33509
  "use strict";
32569
33510
  init_entity();
32570
33511
  init_sql();
32571
- MySqlViewBase = class extends (_b224 = View, _a300 = entityKind, _b224) {
33512
+ MySqlViewBase = class extends (_b224 = View, _a302 = entityKind, _b224) {
32572
33513
  };
32573
- __publicField(MySqlViewBase, _a300, "MySqlViewBase");
33514
+ __publicField(MySqlViewBase, _a302, "MySqlViewBase");
32574
33515
  }
32575
33516
  });
32576
33517
 
32577
33518
  // ../drizzle-orm/dist/mysql-core/dialect.js
32578
- var _a301, MySqlDialect;
33519
+ var _a303, MySqlDialect;
32579
33520
  var init_dialect3 = __esm({
32580
33521
  "../drizzle-orm/dist/mysql-core/dialect.js"() {
32581
33522
  "use strict";
@@ -32594,7 +33535,7 @@ var init_dialect3 = __esm({
32594
33535
  init_common4();
32595
33536
  init_table4();
32596
33537
  init_view_base3();
32597
- _a301 = entityKind;
33538
+ _a303 = entityKind;
32598
33539
  MySqlDialect = class {
32599
33540
  constructor(config) {
32600
33541
  /** @internal */
@@ -33376,7 +34317,7 @@ var init_dialect3 = __esm({
33376
34317
  };
33377
34318
  }
33378
34319
  };
33379
- __publicField(MySqlDialect, _a301, "MySqlDialect");
34320
+ __publicField(MySqlDialect, _a303, "MySqlDialect");
33380
34321
  }
33381
34322
  });
33382
34323
 
@@ -33398,7 +34339,7 @@ function createSetOperator3(type, isAll) {
33398
34339
  return leftSelect.addSetOperators(setOperators);
33399
34340
  };
33400
34341
  }
33401
- var _a302, MySqlSelectBuilder, _a303, _b225, MySqlSelectQueryBuilderBase, _a304, _b226, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
34342
+ var _a304, MySqlSelectBuilder, _a305, _b225, MySqlSelectQueryBuilderBase, _a306, _b226, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
33402
34343
  var init_select4 = __esm({
33403
34344
  "../drizzle-orm/dist/mysql-core/query-builders/select.js"() {
33404
34345
  "use strict";
@@ -33413,7 +34354,7 @@ var init_select4 = __esm({
33413
34354
  init_utils2();
33414
34355
  init_view_common();
33415
34356
  init_view_base3();
33416
- _a302 = entityKind;
34357
+ _a304 = entityKind;
33417
34358
  MySqlSelectBuilder = class {
33418
34359
  constructor(config) {
33419
34360
  __publicField(this, "fields");
@@ -33458,8 +34399,8 @@ var init_select4 = __esm({
33458
34399
  );
33459
34400
  }
33460
34401
  };
33461
- __publicField(MySqlSelectBuilder, _a302, "MySqlSelectBuilder");
33462
- MySqlSelectQueryBuilderBase = class extends (_b225 = TypedQueryBuilder, _a303 = entityKind, _b225) {
34402
+ __publicField(MySqlSelectBuilder, _a304, "MySqlSelectBuilder");
34403
+ MySqlSelectQueryBuilderBase = class extends (_b225 = TypedQueryBuilder, _a305 = entityKind, _b225) {
33463
34404
  constructor({ table: table4, fields, isPartialSelect, session, dialect: dialect4, withList, distinct }) {
33464
34405
  super();
33465
34406
  __publicField(this, "_");
@@ -34060,8 +35001,8 @@ var init_select4 = __esm({
34060
35001
  return this;
34061
35002
  }
34062
35003
  };
34063
- __publicField(MySqlSelectQueryBuilderBase, _a303, "MySqlSelectQueryBuilder");
34064
- MySqlSelectBase = class extends (_b226 = MySqlSelectQueryBuilderBase, _a304 = entityKind, _b226) {
35004
+ __publicField(MySqlSelectQueryBuilderBase, _a305, "MySqlSelectQueryBuilder");
35005
+ MySqlSelectBase = class extends (_b226 = MySqlSelectQueryBuilderBase, _a306 = entityKind, _b226) {
34065
35006
  constructor() {
34066
35007
  super(...arguments);
34067
35008
  __publicField(this, "execute", (placeholderValues) => {
@@ -34085,7 +35026,7 @@ var init_select4 = __esm({
34085
35026
  return query;
34086
35027
  }
34087
35028
  };
34088
- __publicField(MySqlSelectBase, _a304, "MySqlSelect");
35029
+ __publicField(MySqlSelectBase, _a306, "MySqlSelect");
34089
35030
  applyMixins(MySqlSelectBase, [QueryPromise]);
34090
35031
  getMySqlSetOperators = () => ({
34091
35032
  union: union3,
@@ -34105,7 +35046,7 @@ var init_select4 = __esm({
34105
35046
  });
34106
35047
 
34107
35048
  // ../drizzle-orm/dist/mysql-core/query-builders/query-builder.js
34108
- var _a305, QueryBuilder3;
35049
+ var _a307, QueryBuilder3;
34109
35050
  var init_query_builder4 = __esm({
34110
35051
  "../drizzle-orm/dist/mysql-core/query-builders/query-builder.js"() {
34111
35052
  "use strict";
@@ -34114,7 +35055,7 @@ var init_query_builder4 = __esm({
34114
35055
  init_selection_proxy();
34115
35056
  init_subquery();
34116
35057
  init_select4();
34117
- _a305 = entityKind;
35058
+ _a307 = entityKind;
34118
35059
  QueryBuilder3 = class {
34119
35060
  constructor(dialect4) {
34120
35061
  __publicField(this, "dialect");
@@ -34176,7 +35117,7 @@ var init_query_builder4 = __esm({
34176
35117
  return this.dialect;
34177
35118
  }
34178
35119
  };
34179
- __publicField(QueryBuilder3, _a305, "MySqlQueryBuilder");
35120
+ __publicField(QueryBuilder3, _a307, "MySqlQueryBuilder");
34180
35121
  }
34181
35122
  });
34182
35123
 
@@ -34188,14 +35129,14 @@ var init_select_types3 = __esm({
34188
35129
  });
34189
35130
 
34190
35131
  // ../drizzle-orm/dist/mysql-core/query-builders/update.js
34191
- var _a306, MySqlUpdateBuilder, _a307, _b227, MySqlUpdateBase;
35132
+ var _a308, MySqlUpdateBuilder, _a309, _b227, MySqlUpdateBase;
34192
35133
  var init_update3 = __esm({
34193
35134
  "../drizzle-orm/dist/mysql-core/query-builders/update.js"() {
34194
35135
  "use strict";
34195
35136
  init_entity();
34196
35137
  init_query_promise();
34197
35138
  init_utils2();
34198
- _a306 = entityKind;
35139
+ _a308 = entityKind;
34199
35140
  MySqlUpdateBuilder = class {
34200
35141
  constructor(table4, session, dialect4, withList) {
34201
35142
  this.table = table4;
@@ -34207,8 +35148,8 @@ var init_update3 = __esm({
34207
35148
  return new MySqlUpdateBase(this.table, mapUpdateSet(this.table, values), this.session, this.dialect, this.withList);
34208
35149
  }
34209
35150
  };
34210
- __publicField(MySqlUpdateBuilder, _a306, "MySqlUpdateBuilder");
34211
- MySqlUpdateBase = class extends (_b227 = QueryPromise, _a307 = entityKind, _b227) {
35151
+ __publicField(MySqlUpdateBuilder, _a308, "MySqlUpdateBuilder");
35152
+ MySqlUpdateBase = class extends (_b227 = QueryPromise, _a309 = entityKind, _b227) {
34212
35153
  constructor(table4, set, session, dialect4, withList) {
34213
35154
  super();
34214
35155
  __publicField(this, "config");
@@ -34281,7 +35222,7 @@ var init_update3 = __esm({
34281
35222
  return this;
34282
35223
  }
34283
35224
  };
34284
- __publicField(MySqlUpdateBase, _a307, "MySqlUpdate");
35225
+ __publicField(MySqlUpdateBase, _a309, "MySqlUpdate");
34285
35226
  }
34286
35227
  });
34287
35228
 
@@ -34299,14 +35240,14 @@ var init_query_builders3 = __esm({
34299
35240
  });
34300
35241
 
34301
35242
  // ../drizzle-orm/dist/mysql-core/query-builders/query.js
34302
- var _a308, RelationalQueryBuilder3, _a309, _b228, MySqlRelationalQuery;
35243
+ var _a310, RelationalQueryBuilder3, _a311, _b228, MySqlRelationalQuery;
34303
35244
  var init_query3 = __esm({
34304
35245
  "../drizzle-orm/dist/mysql-core/query-builders/query.js"() {
34305
35246
  "use strict";
34306
35247
  init_entity();
34307
35248
  init_query_promise();
34308
35249
  init_relations();
34309
- _a308 = entityKind;
35250
+ _a310 = entityKind;
34310
35251
  RelationalQueryBuilder3 = class {
34311
35252
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, mode) {
34312
35253
  this.fullSchema = fullSchema;
@@ -34347,8 +35288,8 @@ var init_query3 = __esm({
34347
35288
  );
34348
35289
  }
34349
35290
  };
34350
- __publicField(RelationalQueryBuilder3, _a308, "MySqlRelationalQueryBuilder");
34351
- MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a309 = entityKind, _b228) {
35291
+ __publicField(RelationalQueryBuilder3, _a310, "MySqlRelationalQueryBuilder");
35292
+ MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a311 = entityKind, _b228) {
34352
35293
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, config, queryMode, mode) {
34353
35294
  super();
34354
35295
  this.fullSchema = fullSchema;
@@ -34412,12 +35353,12 @@ var init_query3 = __esm({
34412
35353
  return this.prepare().execute();
34413
35354
  }
34414
35355
  };
34415
- __publicField(MySqlRelationalQuery, _a309, "MySqlRelationalQuery");
35356
+ __publicField(MySqlRelationalQuery, _a311, "MySqlRelationalQuery");
34416
35357
  }
34417
35358
  });
34418
35359
 
34419
35360
  // ../drizzle-orm/dist/mysql-core/db.js
34420
- var _a310, MySqlDatabase;
35361
+ var _a312, MySqlDatabase;
34421
35362
  var init_db3 = __esm({
34422
35363
  "../drizzle-orm/dist/mysql-core/db.js"() {
34423
35364
  "use strict";
@@ -34428,7 +35369,7 @@ var init_db3 = __esm({
34428
35369
  init_count3();
34429
35370
  init_query_builders3();
34430
35371
  init_query3();
34431
- _a310 = entityKind;
35372
+ _a312 = entityKind;
34432
35373
  MySqlDatabase = class {
34433
35374
  constructor(dialect4, session, schema4, mode) {
34434
35375
  __publicField(this, "query");
@@ -34641,17 +35582,17 @@ var init_db3 = __esm({
34641
35582
  return this.session.transaction(transaction, config);
34642
35583
  }
34643
35584
  };
34644
- __publicField(MySqlDatabase, _a310, "MySqlDatabase");
35585
+ __publicField(MySqlDatabase, _a312, "MySqlDatabase");
34645
35586
  }
34646
35587
  });
34647
35588
 
34648
35589
  // ../drizzle-orm/dist/mysql-core/indexes.js
34649
- var _a311, IndexBuilderOn3, _a312, IndexBuilder3, _a313, Index5;
35590
+ var _a313, IndexBuilderOn3, _a314, IndexBuilder3, _a315, Index5;
34650
35591
  var init_indexes3 = __esm({
34651
35592
  "../drizzle-orm/dist/mysql-core/indexes.js"() {
34652
35593
  "use strict";
34653
35594
  init_entity();
34654
- _a311 = entityKind;
35595
+ _a313 = entityKind;
34655
35596
  IndexBuilderOn3 = class {
34656
35597
  constructor(name2, unique) {
34657
35598
  this.name = name2;
@@ -34661,8 +35602,8 @@ var init_indexes3 = __esm({
34661
35602
  return new IndexBuilder3(this.name, columns, this.unique);
34662
35603
  }
34663
35604
  };
34664
- __publicField(IndexBuilderOn3, _a311, "MySqlIndexBuilderOn");
34665
- _a312 = entityKind;
35605
+ __publicField(IndexBuilderOn3, _a313, "MySqlIndexBuilderOn");
35606
+ _a314 = entityKind;
34666
35607
  IndexBuilder3 = class {
34667
35608
  constructor(name2, columns, unique) {
34668
35609
  /** @internal */
@@ -34690,26 +35631,26 @@ var init_indexes3 = __esm({
34690
35631
  return new Index5(this.config, table4);
34691
35632
  }
34692
35633
  };
34693
- __publicField(IndexBuilder3, _a312, "MySqlIndexBuilder");
34694
- _a313 = entityKind;
35634
+ __publicField(IndexBuilder3, _a314, "MySqlIndexBuilder");
35635
+ _a315 = entityKind;
34695
35636
  Index5 = class {
34696
35637
  constructor(config, table4) {
34697
35638
  __publicField(this, "config");
34698
35639
  this.config = { ...config, table: table4 };
34699
35640
  }
34700
35641
  };
34701
- __publicField(Index5, _a313, "MySqlIndex");
35642
+ __publicField(Index5, _a315, "MySqlIndex");
34702
35643
  }
34703
35644
  });
34704
35645
 
34705
35646
  // ../drizzle-orm/dist/mysql-core/primary-keys.js
34706
- var _a314, PrimaryKeyBuilder3, _a315, PrimaryKey3;
35647
+ var _a316, PrimaryKeyBuilder3, _a317, PrimaryKey3;
34707
35648
  var init_primary_keys3 = __esm({
34708
35649
  "../drizzle-orm/dist/mysql-core/primary-keys.js"() {
34709
35650
  "use strict";
34710
35651
  init_entity();
34711
35652
  init_table4();
34712
- _a314 = entityKind;
35653
+ _a316 = entityKind;
34713
35654
  PrimaryKeyBuilder3 = class {
34714
35655
  constructor(columns, name2) {
34715
35656
  /** @internal */
@@ -34724,8 +35665,8 @@ var init_primary_keys3 = __esm({
34724
35665
  return new PrimaryKey3(table4, this.columns, this.name);
34725
35666
  }
34726
35667
  };
34727
- __publicField(PrimaryKeyBuilder3, _a314, "MySqlPrimaryKeyBuilder");
34728
- _a315 = entityKind;
35668
+ __publicField(PrimaryKeyBuilder3, _a316, "MySqlPrimaryKeyBuilder");
35669
+ _a317 = entityKind;
34729
35670
  PrimaryKey3 = class {
34730
35671
  constructor(table4, columns, name2) {
34731
35672
  __publicField(this, "columns");
@@ -34738,7 +35679,7 @@ var init_primary_keys3 = __esm({
34738
35679
  return this.name ?? `${this.table[MySqlTable.Symbol.Name]}_${this.columns.map((column4) => column4.name).join("_")}_pk`;
34739
35680
  }
34740
35681
  };
34741
- __publicField(PrimaryKey3, _a315, "MySqlPrimaryKey");
35682
+ __publicField(PrimaryKey3, _a317, "MySqlPrimaryKey");
34742
35683
  }
34743
35684
  });
34744
35685
 
@@ -34758,7 +35699,7 @@ function mysqlViewWithSchema(name2, selection, schema4) {
34758
35699
  }
34759
35700
  return new ViewBuilder3(name2, schema4);
34760
35701
  }
34761
- var _a316, ViewBuilderCore2, _a317, _b229, ViewBuilder3, _a318, _b230, ManualViewBuilder3, _a319, _b231, _c11, MySqlView;
35702
+ var _a318, ViewBuilderCore2, _a319, _b229, ViewBuilder3, _a320, _b230, ManualViewBuilder3, _a321, _b231, _c11, MySqlView;
34762
35703
  var init_view3 = __esm({
34763
35704
  "../drizzle-orm/dist/mysql-core/view.js"() {
34764
35705
  "use strict";
@@ -34769,7 +35710,7 @@ var init_view3 = __esm({
34769
35710
  init_table4();
34770
35711
  init_view_base3();
34771
35712
  init_view_common4();
34772
- _a316 = entityKind;
35713
+ _a318 = entityKind;
34773
35714
  ViewBuilderCore2 = class {
34774
35715
  constructor(name2, schema4) {
34775
35716
  __publicField(this, "config", {});
@@ -34793,8 +35734,8 @@ var init_view3 = __esm({
34793
35734
  return this;
34794
35735
  }
34795
35736
  };
34796
- __publicField(ViewBuilderCore2, _a316, "MySqlViewBuilder");
34797
- ViewBuilder3 = class extends (_b229 = ViewBuilderCore2, _a317 = entityKind, _b229) {
35737
+ __publicField(ViewBuilderCore2, _a318, "MySqlViewBuilder");
35738
+ ViewBuilder3 = class extends (_b229 = ViewBuilderCore2, _a319 = entityKind, _b229) {
34798
35739
  as(qb) {
34799
35740
  if (typeof qb === "function") {
34800
35741
  qb = qb(new QueryBuilder3());
@@ -34820,8 +35761,8 @@ var init_view3 = __esm({
34820
35761
  );
34821
35762
  }
34822
35763
  };
34823
- __publicField(ViewBuilder3, _a317, "MySqlViewBuilder");
34824
- ManualViewBuilder3 = class extends (_b230 = ViewBuilderCore2, _a318 = entityKind, _b230) {
35764
+ __publicField(ViewBuilder3, _a319, "MySqlViewBuilder");
35765
+ ManualViewBuilder3 = class extends (_b230 = ViewBuilderCore2, _a320 = entityKind, _b230) {
34825
35766
  constructor(name2, columns, schema4) {
34826
35767
  super(name2, schema4);
34827
35768
  __publicField(this, "columns");
@@ -34866,11 +35807,11 @@ var init_view3 = __esm({
34866
35807
  );
34867
35808
  }
34868
35809
  };
34869
- __publicField(ManualViewBuilder3, _a318, "MySqlManualViewBuilder");
34870
- MySqlView = class extends (_c11 = MySqlViewBase, _b231 = entityKind, _a319 = MySqlViewConfig, _c11) {
35810
+ __publicField(ManualViewBuilder3, _a320, "MySqlManualViewBuilder");
35811
+ MySqlView = class extends (_c11 = MySqlViewBase, _b231 = entityKind, _a321 = MySqlViewConfig, _c11) {
34871
35812
  constructor({ mysqlConfig, config }) {
34872
35813
  super(config);
34873
- __publicField(this, _a319);
35814
+ __publicField(this, _a321);
34874
35815
  this[MySqlViewConfig] = mysqlConfig;
34875
35816
  }
34876
35817
  };
@@ -34879,14 +35820,14 @@ var init_view3 = __esm({
34879
35820
  });
34880
35821
 
34881
35822
  // ../drizzle-orm/dist/mysql-core/schema.js
34882
- var _a320, MySqlSchema5;
35823
+ var _a322, MySqlSchema5;
34883
35824
  var init_schema2 = __esm({
34884
35825
  "../drizzle-orm/dist/mysql-core/schema.js"() {
34885
35826
  "use strict";
34886
35827
  init_entity();
34887
35828
  init_table4();
34888
35829
  init_view3();
34889
- _a320 = entityKind;
35830
+ _a322 = entityKind;
34890
35831
  MySqlSchema5 = class {
34891
35832
  constructor(schemaName) {
34892
35833
  __publicField(this, "table", (name2, columns, extraConfig) => {
@@ -34898,12 +35839,12 @@ var init_schema2 = __esm({
34898
35839
  this.schemaName = schemaName;
34899
35840
  }
34900
35841
  };
34901
- __publicField(MySqlSchema5, _a320, "MySqlSchema");
35842
+ __publicField(MySqlSchema5, _a322, "MySqlSchema");
34902
35843
  }
34903
35844
  });
34904
35845
 
34905
35846
  // ../drizzle-orm/dist/mysql-core/session.js
34906
- var _a321, MySqlPreparedQuery, _a322, MySqlSession, _a323, _b232, MySqlTransaction;
35847
+ var _a323, MySqlPreparedQuery, _a324, MySqlSession, _a325, _b232, MySqlTransaction;
34907
35848
  var init_session3 = __esm({
34908
35849
  "../drizzle-orm/dist/mysql-core/session.js"() {
34909
35850
  "use strict";
@@ -34911,15 +35852,15 @@ var init_session3 = __esm({
34911
35852
  init_errors();
34912
35853
  init_sql();
34913
35854
  init_db3();
34914
- _a321 = entityKind;
35855
+ _a323 = entityKind;
34915
35856
  MySqlPreparedQuery = class {
34916
35857
  constructor() {
34917
35858
  /** @internal */
34918
35859
  __publicField(this, "joinsNotNullableMap");
34919
35860
  }
34920
35861
  };
34921
- __publicField(MySqlPreparedQuery, _a321, "MySqlPreparedQuery");
34922
- _a322 = entityKind;
35862
+ __publicField(MySqlPreparedQuery, _a323, "MySqlPreparedQuery");
35863
+ _a324 = entityKind;
34923
35864
  MySqlSession = class {
34924
35865
  constructor(dialect4) {
34925
35866
  this.dialect = dialect4;
@@ -34954,8 +35895,8 @@ var init_session3 = __esm({
34954
35895
  return parts.length ? sql`start transaction ${sql.raw(parts.join(" "))}` : void 0;
34955
35896
  }
34956
35897
  };
34957
- __publicField(MySqlSession, _a322, "MySqlSession");
34958
- MySqlTransaction = class extends (_b232 = MySqlDatabase, _a323 = entityKind, _b232) {
35898
+ __publicField(MySqlSession, _a324, "MySqlSession");
35899
+ MySqlTransaction = class extends (_b232 = MySqlDatabase, _a325 = entityKind, _b232) {
34959
35900
  constructor(dialect4, session, schema4, nestedIndex, mode) {
34960
35901
  super(dialect4, session, schema4, mode);
34961
35902
  this.schema = schema4;
@@ -34965,7 +35906,7 @@ var init_session3 = __esm({
34965
35906
  throw new TransactionRollbackError();
34966
35907
  }
34967
35908
  };
34968
- __publicField(MySqlTransaction, _a323, "MySqlTransaction");
35909
+ __publicField(MySqlTransaction, _a325, "MySqlTransaction");
34969
35910
  }
34970
35911
  });
34971
35912
 
@@ -35663,6 +36604,13 @@ var init_cli = __esm({
35663
36604
  breakpoints: booleanType().optional().default(true),
35664
36605
  migrations: objectType({
35665
36606
  prefix: prefix.optional().default("index")
36607
+ }).optional(),
36608
+ entities: objectType({
36609
+ roles: booleanType().or(objectType({
36610
+ provider: stringType().optional(),
36611
+ include: stringType().array().optional(),
36612
+ exclude: stringType().array().optional()
36613
+ })).optional().default(false)
35666
36614
  }).optional()
35667
36615
  }).passthrough();
35668
36616
  configCheck = objectType({
@@ -35929,6 +36877,7 @@ var init_pgImports = __esm({
35929
36877
  const enums = [];
35930
36878
  const schemas = [];
35931
36879
  const sequences = [];
36880
+ const roles = [];
35932
36881
  const i0values = Object.values(exports);
35933
36882
  i0values.forEach((t) => {
35934
36883
  if (isPgEnum(t)) {
@@ -35944,8 +36893,11 @@ var init_pgImports = __esm({
35944
36893
  if (isPgSequence(t)) {
35945
36894
  sequences.push(t);
35946
36895
  }
36896
+ if (is(t, PgRole)) {
36897
+ roles.push(t);
36898
+ }
35947
36899
  });
35948
- return { tables, enums, schemas, sequences };
36900
+ return { tables, enums, schemas, sequences, roles };
35949
36901
  };
35950
36902
  }
35951
36903
  });
@@ -36339,7 +37291,7 @@ init_mjs();
36339
37291
  init_global();
36340
37292
  init_pgSerializer();
36341
37293
  init_views();
36342
- var pgPushIntrospect = async (db, filters, schemaFilters) => {
37294
+ var pgPushIntrospect = async (db, filters, schemaFilters, entities = { roles: true }) => {
36343
37295
  const matchers = filters.map((it) => {
36344
37296
  return new Minimatch(it);
36345
37297
  });
@@ -36367,7 +37319,7 @@ var pgPushIntrospect = async (db, filters, schemaFilters) => {
36367
37319
  );
36368
37320
  const res = await (0, import_hanji3.renderWithTask)(
36369
37321
  progress,
36370
- fromDatabase(db, filter2, schemaFilters)
37322
+ fromDatabase(db, filter2, schemaFilters, entities)
36371
37323
  );
36372
37324
  const schema4 = { id: originUUID, prevId: "", ...res };
36373
37325
  const { internal, ...schemaWithoutInternals } = schema4;
@@ -36845,6 +37797,7 @@ var generateDrizzleJson = (imports, prevId, schemaFilters, casing2) => {
36845
37797
  prepared.enums,
36846
37798
  prepared.schemas,
36847
37799
  prepared.sequences,
37800
+ prepared.roles,
36848
37801
  casing2,
36849
37802
  schemaFilters
36850
37803
  );
@@ -36866,6 +37819,8 @@ var generateMigration = async (prev, cur) => {
36866
37819
  schemasResolver,
36867
37820
  enumsResolver,
36868
37821
  sequencesResolver,
37822
+ policyResolver,
37823
+ roleResolver,
36869
37824
  tablesResolver,
36870
37825
  columnsResolver,
36871
37826
  validatedPrev,
@@ -36898,6 +37853,8 @@ var pushSchema = async (imports, drizzleInstance, schemaFilters) => {
36898
37853
  schemasResolver,
36899
37854
  enumsResolver,
36900
37855
  sequencesResolver,
37856
+ policyResolver,
37857
+ roleResolver,
36901
37858
  tablesResolver,
36902
37859
  columnsResolver,
36903
37860
  validatedPrev,