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

Sign up to get free protection for your applications and to get access to all the features.
package/api.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, 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;
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, 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;
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,22 +12305,20 @@ var init_sqlgenerator = __esm({
12061
12305
  }
12062
12306
  convert(st) {
12063
12307
  const { name: name2, values, schema: schema4 } = st;
12064
- const enumNameWithSchema = schema4 ? `"${schema4}"."${name2}"` : `"${name2}"`;
12308
+ const tableNameWithSchema = schema4 ? `"${schema4}"."${name2}"` : `"${name2}"`;
12065
12309
  let valuesStatement = "(";
12066
12310
  valuesStatement += values.map((it) => `'${it}'`).join(", ");
12067
12311
  valuesStatement += ")";
12068
- let statement = `CREATE TYPE ${enumNameWithSchema} AS ENUM${valuesStatement};`;
12069
- return statement;
12070
- }
12071
- };
12072
- DropTypeEnumConvertor = class extends Convertor {
12073
- can(statement) {
12074
- return statement.type === "drop_type_enum";
12075
- }
12076
- convert(st) {
12077
- const { name: name2, schema: schema4 } = st;
12078
- const enumNameWithSchema = schema4 ? `"${schema4}"."${name2}"` : `"${name2}"`;
12079
- let statement = `DROP TYPE ${enumNameWithSchema} CASCADE;`;
12312
+ let statement = "DO $$ BEGIN";
12313
+ statement += "\n";
12314
+ statement += ` CREATE TYPE ${tableNameWithSchema} AS ENUM${valuesStatement};`;
12315
+ statement += "\n";
12316
+ statement += "EXCEPTION";
12317
+ statement += "\n";
12318
+ statement += " WHEN duplicate_object THEN null;";
12319
+ statement += "\n";
12320
+ statement += "END $$;";
12321
+ statement += "\n";
12080
12322
  return statement;
12081
12323
  }
12082
12324
  };
@@ -12085,56 +12327,9 @@ var init_sqlgenerator = __esm({
12085
12327
  return statement.type === "alter_type_add_value";
12086
12328
  }
12087
12329
  convert(st) {
12088
- const { name: name2, schema: schema4, value, before } = st;
12089
- const enumNameWithSchema = schema4 ? `"${schema4}"."${name2}"` : `"${name2}"`;
12090
- return `ALTER TYPE ${enumNameWithSchema} ADD VALUE '${value}'${before.length ? ` BEFORE '${before}'` : ""};`;
12091
- }
12092
- };
12093
- AlterTypeSetSchemaConvertor = class extends Convertor {
12094
- can(statement) {
12095
- return statement.type === "move_type_enum";
12096
- }
12097
- convert(st) {
12098
- const { name: name2, schemaFrom, schemaTo } = st;
12099
- const enumNameWithSchema = schemaFrom ? `"${schemaFrom}"."${name2}"` : `"${name2}"`;
12100
- return `ALTER TYPE ${enumNameWithSchema} SET SCHEMA "${schemaTo}";`;
12101
- }
12102
- };
12103
- AlterRenameTypeConvertor = class extends Convertor {
12104
- can(statement) {
12105
- return statement.type === "rename_type_enum";
12106
- }
12107
- convert(st) {
12108
- const { nameTo, nameFrom, schema: schema4 } = st;
12109
- const enumNameWithSchema = schema4 ? `"${schema4}"."${nameFrom}"` : `"${nameFrom}"`;
12110
- return `ALTER TYPE ${enumNameWithSchema} RENAME TO "${nameTo}";`;
12111
- }
12112
- };
12113
- AlterTypeDropValueConvertor = class extends Convertor {
12114
- can(statement) {
12115
- return statement.type === "alter_type_drop_value";
12116
- }
12117
- convert(st) {
12118
- const { columnsWithEnum, name: name2, newValues, schema: schema4 } = st;
12119
- const statements = [];
12120
- for (const withEnum of columnsWithEnum) {
12121
- statements.push(
12122
- `ALTER TABLE "${withEnum.schema}"."${withEnum.table}" ALTER COLUMN "${withEnum.column}" SET DATA TYPE text;`
12123
- );
12124
- }
12125
- statements.push(new DropTypeEnumConvertor().convert({ name: name2, schema: schema4, type: "drop_type_enum" }));
12126
- statements.push(new CreateTypeEnumConvertor().convert({
12127
- name: name2,
12128
- schema: schema4,
12129
- values: newValues,
12130
- type: "create_type_enum"
12131
- }));
12132
- for (const withEnum of columnsWithEnum) {
12133
- statements.push(
12134
- `ALTER TABLE "${withEnum.schema}"."${withEnum.table}" ALTER COLUMN "${withEnum.column}" SET DATA TYPE "${schema4}"."${name2}" USING "${withEnum.column}"::"${schema4}"."${name2}";`
12135
- );
12136
- }
12137
- return statements;
12330
+ const { name: name2, schema: schema4, value } = st;
12331
+ const schemaPrefix = schema4 && schema4 !== "public" ? `"${schema4}".` : "";
12332
+ return `ALTER TYPE ${schemaPrefix}"${name2}" ADD VALUE '${value}';`;
12138
12333
  }
12139
12334
  };
12140
12335
  PgDropTableConvertor = class extends Convertor {
@@ -12142,9 +12337,21 @@ var init_sqlgenerator = __esm({
12142
12337
  return statement.type === "drop_table" && dialect4 === "postgresql";
12143
12338
  }
12144
12339
  convert(statement) {
12145
- const { tableName, schema: schema4 } = statement;
12340
+ const { tableName, schema: schema4, policies } = statement;
12146
12341
  const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
12147
- return `DROP TABLE ${tableNameWithSchema};`;
12342
+ const dropPolicyConvertor = new PgDropPolicyConvertor();
12343
+ const droppedPolicies = policies?.map((p) => {
12344
+ return dropPolicyConvertor.convert({
12345
+ type: "drop_policy",
12346
+ tableName,
12347
+ data: PgSquasher.unsquashPolicy(p),
12348
+ schema: schema4
12349
+ });
12350
+ }) ?? [];
12351
+ return [
12352
+ ...droppedPolicies,
12353
+ `DROP TABLE ${tableNameWithSchema};`
12354
+ ];
12148
12355
  }
12149
12356
  };
12150
12357
  MySQLDropTableConvertor = class extends Convertor {
@@ -13278,11 +13485,6 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
13278
13485
  convertors.push(new SQLiteRecreateTableConvertor());
13279
13486
  convertors.push(new LibSQLRecreateTableConvertor());
13280
13487
  convertors.push(new CreateTypeEnumConvertor());
13281
- convertors.push(new DropTypeEnumConvertor());
13282
- convertors.push(new AlterTypeAddValueConvertor());
13283
- convertors.push(new AlterTypeSetSchemaConvertor());
13284
- convertors.push(new AlterRenameTypeConvertor());
13285
- convertors.push(new AlterTypeDropValueConvertor());
13286
13488
  convertors.push(new CreatePgSequenceConvertor());
13287
13489
  convertors.push(new DropPgSequenceConvertor());
13288
13490
  convertors.push(new RenamePgSequenceConvertor());
@@ -13314,12 +13516,23 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
13314
13516
  convertors.push(new PgDropIndexConvertor());
13315
13517
  convertors.push(new SqliteDropIndexConvertor());
13316
13518
  convertors.push(new MySqlDropIndexConvertor());
13519
+ convertors.push(new AlterTypeAddValueConvertor());
13317
13520
  convertors.push(new PgAlterTableAlterColumnSetPrimaryKeyConvertor());
13318
13521
  convertors.push(new PgAlterTableAlterColumnDropPrimaryKeyConvertor());
13319
13522
  convertors.push(new PgAlterTableAlterColumnSetNotNullConvertor());
13320
13523
  convertors.push(new PgAlterTableAlterColumnDropNotNullConvertor());
13321
13524
  convertors.push(new PgAlterTableAlterColumnSetDefaultConvertor());
13322
13525
  convertors.push(new PgAlterTableAlterColumnDropDefaultConvertor());
13526
+ convertors.push(new PgAlterPolicyConvertor());
13527
+ convertors.push(new PgCreatePolicyConvertor());
13528
+ convertors.push(new PgDropPolicyConvertor());
13529
+ convertors.push(new PgRenamePolicyConvertor());
13530
+ convertors.push(new PgEnableRlsConvertor());
13531
+ convertors.push(new PgDisableRlsConvertor());
13532
+ convertors.push(new PgDropRoleConvertor());
13533
+ convertors.push(new PgAlterRoleConvertor());
13534
+ convertors.push(new PgCreateRoleConvertor());
13535
+ convertors.push(new PgRenameRoleConvertor());
13323
13536
  convertors.push(new PgAlterTableAlterColumnSetExpressionConvertor());
13324
13537
  convertors.push(new PgAlterTableAlterColumnDropGeneratedConvertor());
13325
13538
  convertors.push(new PgAlterTableAlterColumnAlterrGeneratedConvertor());
@@ -13614,7 +13827,7 @@ var init_sqlitePushUtils = __esm({
13614
13827
  });
13615
13828
 
13616
13829
  // src/jsonStatements.ts
13617
- var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumValues, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareLibSQLCreateReferencesJson, prepareDropReferencesJson, prepareLibSQLDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql;
13830
+ var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson, prepareCreateRoleJson, prepareAlterRoleJson, prepareDropRoleJson, prepareRenameRoleJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, prepareRenamePolicyJsons, prepareCreatePolicyJsons, prepareDropPolicyJsons, prepareAlterPolicyJson, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareLibSQLCreateReferencesJson, prepareDropReferencesJson, prepareLibSQLDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql;
13618
13831
  var init_jsonStatements = __esm({
13619
13832
  "src/jsonStatements.ts"() {
13620
13833
  "use strict";
@@ -13625,7 +13838,7 @@ var init_jsonStatements = __esm({
13625
13838
  init_pgSchema();
13626
13839
  init_sqliteSchema();
13627
13840
  preparePgCreateTableJson = (table4, json22) => {
13628
- const { name: name2, schema: schema4, columns, compositePrimaryKeys, uniqueConstraints } = table4;
13841
+ const { name: name2, schema: schema4, columns, compositePrimaryKeys, uniqueConstraints, policies } = table4;
13629
13842
  const tableKey2 = `${schema4 || "public"}.${name2}`;
13630
13843
  const compositePkName = Object.values(compositePrimaryKeys).length > 0 ? json22.tables[tableKey2].compositePrimaryKeys[`${PgSquasher.unsquashPK(Object.values(compositePrimaryKeys)[0]).name}`].name : "";
13631
13844
  return {
@@ -13635,7 +13848,8 @@ var init_jsonStatements = __esm({
13635
13848
  columns: Object.values(columns),
13636
13849
  compositePKs: Object.values(compositePrimaryKeys),
13637
13850
  compositePkName,
13638
- uniqueConstraints: Object.values(uniqueConstraints)
13851
+ uniqueConstraints: Object.values(uniqueConstraints),
13852
+ policies: Object.values(policies)
13639
13853
  };
13640
13854
  };
13641
13855
  prepareMySqlCreateTableJson = (table4, json22, internals) => {
@@ -13673,7 +13887,8 @@ var init_jsonStatements = __esm({
13673
13887
  return {
13674
13888
  type: "drop_table",
13675
13889
  tableName: table4.name,
13676
- schema: table4.schema
13890
+ schema: table4.schema,
13891
+ policies: table4.policies ? Object.values(table4.policies) : []
13677
13892
  };
13678
13893
  };
13679
13894
  prepareRenameTableJson = (tableFrom, tableTo) => {
@@ -13704,27 +13919,6 @@ var init_jsonStatements = __esm({
13704
13919
  };
13705
13920
  });
13706
13921
  };
13707
- prepareDropEnumValues = (name2, schema4, removedValues, json22) => {
13708
- if (!removedValues.length) return [];
13709
- const affectedColumns = [];
13710
- for (const tableKey2 in json22.tables) {
13711
- const table4 = json22.tables[tableKey2];
13712
- for (const columnKey in table4.columns) {
13713
- const column4 = table4.columns[columnKey];
13714
- if (column4.type === name2 && column4.typeSchema === schema4) {
13715
- affectedColumns.push({ schema: table4.schema || "public", table: table4.name, column: column4.name });
13716
- }
13717
- }
13718
- }
13719
- return [{
13720
- type: "alter_type_drop_value",
13721
- name: name2,
13722
- schema: schema4,
13723
- deletedValues: removedValues,
13724
- newValues: json22.enums[`${schema4}.${name2}`].values,
13725
- columnsWithEnum: affectedColumns
13726
- }];
13727
- };
13728
13922
  prepareDropEnumJson = (name2, schema4) => {
13729
13923
  return {
13730
13924
  type: "drop_type_enum",
@@ -13791,6 +13985,41 @@ var init_jsonStatements = __esm({
13791
13985
  schema: schema4
13792
13986
  };
13793
13987
  };
13988
+ prepareCreateRoleJson = (role) => {
13989
+ return {
13990
+ type: "create_role",
13991
+ name: role.name,
13992
+ values: {
13993
+ createDb: role.createDb,
13994
+ createRole: role.createRole,
13995
+ inherit: role.inherit
13996
+ }
13997
+ };
13998
+ };
13999
+ prepareAlterRoleJson = (role) => {
14000
+ return {
14001
+ type: "alter_role",
14002
+ name: role.name,
14003
+ values: {
14004
+ createDb: role.createDb,
14005
+ createRole: role.createRole,
14006
+ inherit: role.inherit
14007
+ }
14008
+ };
14009
+ };
14010
+ prepareDropRoleJson = (name2) => {
14011
+ return {
14012
+ type: "drop_role",
14013
+ name: name2
14014
+ };
14015
+ };
14016
+ prepareRenameRoleJson = (nameFrom, nameTo) => {
14017
+ return {
14018
+ type: "rename_role",
14019
+ nameFrom,
14020
+ nameTo
14021
+ };
14022
+ };
13794
14023
  prepareCreateSchemasJson = (values) => {
13795
14024
  return values.map((it) => {
13796
14025
  return {
@@ -14687,6 +14916,46 @@ var init_jsonStatements = __esm({
14687
14916
  }
14688
14917
  return [...dropPkStatements, ...setPkStatements, ...statements];
14689
14918
  };
14919
+ prepareRenamePolicyJsons = (tableName, schema4, renames) => {
14920
+ return renames.map((it) => {
14921
+ return {
14922
+ type: "rename_policy",
14923
+ tableName,
14924
+ oldName: it.from.name,
14925
+ newName: it.to.name,
14926
+ schema: schema4
14927
+ };
14928
+ });
14929
+ };
14930
+ prepareCreatePolicyJsons = (tableName, schema4, policies) => {
14931
+ return policies.map((it) => {
14932
+ return {
14933
+ type: "create_policy",
14934
+ tableName,
14935
+ data: it,
14936
+ schema: schema4
14937
+ };
14938
+ });
14939
+ };
14940
+ prepareDropPolicyJsons = (tableName, schema4, policies) => {
14941
+ return policies.map((it) => {
14942
+ return {
14943
+ type: "drop_policy",
14944
+ tableName,
14945
+ data: it,
14946
+ schema: schema4
14947
+ };
14948
+ });
14949
+ };
14950
+ prepareAlterPolicyJson = (tableName, schema4, oldPolicy, newPolicy) => {
14951
+ return {
14952
+ type: "alter_policy",
14953
+ tableName,
14954
+ oldData: oldPolicy,
14955
+ newData: newPolicy,
14956
+ schema: schema4
14957
+ };
14958
+ };
14690
14959
  preparePgCreateIndexesJson = (tableName, schema4, indexes, fullSchema, action) => {
14691
14960
  if (action === "push") {
14692
14961
  return Object.values(indexes).map((indexData) => {
@@ -15392,7 +15661,8 @@ var init_snapshotsDiffer = __esm({
15392
15661
  indexes: recordType(stringType(), stringType()),
15393
15662
  foreignKeys: recordType(stringType(), stringType()),
15394
15663
  compositePrimaryKeys: recordType(stringType(), stringType()).default({}),
15395
- uniqueConstraints: recordType(stringType(), stringType()).default({})
15664
+ uniqueConstraints: recordType(stringType(), stringType()).default({}),
15665
+ policies: recordType(stringType(), stringType()).default({})
15396
15666
  }).strict();
15397
15667
  alteredTableScheme = objectType({
15398
15668
  name: stringType(),
@@ -15433,12 +15703,22 @@ var init_snapshotsDiffer = __esm({
15433
15703
  __new: stringType(),
15434
15704
  __old: stringType()
15435
15705
  })
15706
+ ),
15707
+ addedPolicies: recordType(stringType(), stringType()),
15708
+ deletedPolicies: recordType(stringType(), stringType()),
15709
+ alteredPolicies: recordType(
15710
+ stringType(),
15711
+ objectType({
15712
+ __new: stringType(),
15713
+ __old: stringType()
15714
+ })
15436
15715
  )
15437
15716
  }).strict();
15438
15717
  diffResultScheme = objectType({
15439
15718
  alteredTablesWithColumns: alteredTableScheme.array(),
15440
15719
  alteredEnums: changedEnumSchema.array(),
15441
- alteredSequences: sequenceSquashed.array()
15720
+ alteredSequences: sequenceSquashed.array(),
15721
+ alteredRoles: roleSchema.array()
15442
15722
  }).strict();
15443
15723
  diffResultSchemeMysql = objectType({
15444
15724
  alteredTablesWithColumns: alteredTableScheme.array(),
@@ -15493,7 +15773,7 @@ var init_snapshotsDiffer = __esm({
15493
15773
  }
15494
15774
  return column4;
15495
15775
  };
15496
- applyPgSnapshotsDiff = async (json1, json22, schemasResolver2, enumsResolver2, sequencesResolver2, tablesResolver2, columnsResolver2, prevFull, curFull, action) => {
15776
+ applyPgSnapshotsDiff = async (json1, json22, schemasResolver2, enumsResolver2, sequencesResolver2, policyResolver2, roleResolver2, tablesResolver2, columnsResolver2, prevFull, curFull, action) => {
15497
15777
  const schemasDiff = diffSchemasOrTables(json1.schemas, json22.schemas);
15498
15778
  const {
15499
15779
  created: createdSchemas,
@@ -15643,6 +15923,47 @@ var init_snapshotsDiffer = __esm({
15643
15923
  return [tableKey2, tableValue];
15644
15924
  }
15645
15925
  );
15926
+ const rolesDiff = diffSchemasOrTables(
15927
+ schemasPatchedSnap1.roles,
15928
+ json22.roles
15929
+ );
15930
+ const {
15931
+ created: createdRoles,
15932
+ deleted: deletedRoles,
15933
+ renamed: renamedRoles
15934
+ } = await roleResolver2({
15935
+ created: rolesDiff.added,
15936
+ deleted: rolesDiff.deleted
15937
+ });
15938
+ schemasPatchedSnap1.roles = mapEntries(
15939
+ schemasPatchedSnap1.roles,
15940
+ (_2, it) => {
15941
+ const { name: name2 } = nameChangeFor(it, renamedRoles);
15942
+ it.name = name2;
15943
+ return [name2, it];
15944
+ }
15945
+ );
15946
+ const rolesChangeMap = renamedRoles.reduce(
15947
+ (acc, it) => {
15948
+ acc[it.from.name] = {
15949
+ nameFrom: it.from.name,
15950
+ nameTo: it.to.name
15951
+ };
15952
+ return acc;
15953
+ },
15954
+ {}
15955
+ );
15956
+ schemasPatchedSnap1.roles = mapEntries(
15957
+ schemasPatchedSnap1.roles,
15958
+ (roleKey, roleValue) => {
15959
+ const key = roleKey;
15960
+ const change = rolesChangeMap[key];
15961
+ if (change) {
15962
+ roleValue.name = change.nameTo;
15963
+ }
15964
+ return [roleKey, roleValue];
15965
+ }
15966
+ );
15646
15967
  const tablesDiff = diffSchemasOrTables(
15647
15968
  schemasPatchedSnap1.tables,
15648
15969
  json22.tables
@@ -15721,6 +16042,65 @@ var init_snapshotsDiffer = __esm({
15721
16042
  return [tableKey2, tableValue];
15722
16043
  }
15723
16044
  );
16045
+ const policyRes = diffPolicies(tablesPatchedSnap1.tables, json22.tables);
16046
+ const policyRenames = [];
16047
+ const policyCreates = [];
16048
+ const policyDeletes = [];
16049
+ for (let entry of Object.values(policyRes)) {
16050
+ const { renamed, created, deleted } = await policyResolver2({
16051
+ tableName: entry.name,
16052
+ schema: entry.schema,
16053
+ deleted: entry.policies.deleted.map(PgSquasher.unsquashPolicy),
16054
+ created: entry.policies.added.map(PgSquasher.unsquashPolicy)
16055
+ });
16056
+ if (created.length > 0) {
16057
+ policyCreates.push({
16058
+ table: entry.name,
16059
+ schema: entry.schema,
16060
+ columns: created
16061
+ });
16062
+ }
16063
+ if (deleted.length > 0) {
16064
+ policyDeletes.push({
16065
+ table: entry.name,
16066
+ schema: entry.schema,
16067
+ columns: deleted
16068
+ });
16069
+ }
16070
+ if (renamed.length > 0) {
16071
+ policyRenames.push({
16072
+ table: entry.name,
16073
+ schema: entry.schema,
16074
+ renames: renamed
16075
+ });
16076
+ }
16077
+ }
16078
+ const policyRenamesDict = columnRenames.reduce(
16079
+ (acc, it) => {
16080
+ acc[`${it.schema || "public"}.${it.table}`] = it.renames;
16081
+ return acc;
16082
+ },
16083
+ {}
16084
+ );
16085
+ const policyPatchedSnap1 = copy(tablesPatchedSnap1);
16086
+ policyPatchedSnap1.tables = mapEntries(
16087
+ policyPatchedSnap1.tables,
16088
+ (tableKey2, tableValue) => {
16089
+ const patchedPolicies = mapKeys(
16090
+ tableValue.policies,
16091
+ (policyKey, policy2) => {
16092
+ const rens = policyRenamesDict[`${tableValue.schema || "public"}.${tableValue.name}`] || [];
16093
+ const newName = columnChangeFor(policyKey, rens);
16094
+ const unsquashedPolicy = PgSquasher.unsquashPolicy(policy2);
16095
+ unsquashedPolicy.name = newName;
16096
+ policy2 = PgSquasher.squashPolicy(unsquashedPolicy);
16097
+ return newName;
16098
+ }
16099
+ );
16100
+ tableValue.policies = patchedPolicies;
16101
+ return [tableKey2, tableValue];
16102
+ }
16103
+ );
15724
16104
  const diffResult = applyJsonDiff(columnsPatchedSnap1, json22);
15725
16105
  const typedResult = diffResultScheme.parse(diffResult);
15726
16106
  const jsonStatements = [];
@@ -15765,13 +16145,15 @@ var init_snapshotsDiffer = __esm({
15765
16145
  const jsonDeletedUniqueConstraints = [];
15766
16146
  const jsonAlteredUniqueConstraints = [];
15767
16147
  const jsonSetTableSchemas = [];
15768
- for (let it of movedTables) {
15769
- jsonSetTableSchemas.push({
15770
- type: "alter_table_set_schema",
15771
- tableName: it.name,
15772
- schemaFrom: it.schemaFrom || "public",
15773
- schemaTo: it.schemaTo || "public"
15774
- });
16148
+ if (movedTables) {
16149
+ for (let it of movedTables) {
16150
+ jsonSetTableSchemas.push({
16151
+ type: "alter_table_set_schema",
16152
+ tableName: it.name,
16153
+ schemaFrom: it.schemaFrom || "public",
16154
+ schemaTo: it.schemaTo || "public"
16155
+ });
16156
+ }
15775
16157
  }
15776
16158
  for (let it of alteredTables) {
15777
16159
  let addedColumns = [];
@@ -15876,7 +16258,99 @@ var init_snapshotsDiffer = __esm({
15876
16258
  it.deletedIndexes || {}
15877
16259
  );
15878
16260
  }).flat();
16261
+ const jsonCreatePoliciesStatements = [];
16262
+ const jsonDropPoliciesStatements = [];
16263
+ const jsonAlterPoliciesStatements = [];
16264
+ const jsonRenamePoliciesStatements = [];
16265
+ const jsonEnableRLSStatements = [];
16266
+ const jsonDisableRLSStatements = [];
16267
+ for (let it of policyRenames) {
16268
+ jsonRenamePoliciesStatements.push(
16269
+ ...prepareRenamePolicyJsons(it.table, it.schema, it.renames)
16270
+ );
16271
+ }
16272
+ for (const it of policyCreates) {
16273
+ jsonCreatePoliciesStatements.push(
16274
+ ...prepareCreatePolicyJsons(
16275
+ it.table,
16276
+ it.schema,
16277
+ it.columns
16278
+ )
16279
+ );
16280
+ }
16281
+ for (const it of policyDeletes) {
16282
+ jsonDropPoliciesStatements.push(
16283
+ ...prepareDropPolicyJsons(
16284
+ it.table,
16285
+ it.schema,
16286
+ it.columns
16287
+ )
16288
+ );
16289
+ }
15879
16290
  alteredTables.forEach((it) => {
16291
+ Object.keys(it.alteredPolicies).forEach((policyName) => {
16292
+ const newPolicy = PgSquasher.unsquashPolicy(it.alteredPolicies[policyName].__new);
16293
+ const oldPolicy = PgSquasher.unsquashPolicy(it.alteredPolicies[policyName].__old);
16294
+ if (newPolicy.as !== oldPolicy.as) {
16295
+ jsonDropPoliciesStatements.push(
16296
+ ...prepareDropPolicyJsons(
16297
+ it.name,
16298
+ it.schema,
16299
+ [oldPolicy]
16300
+ )
16301
+ );
16302
+ jsonCreatePoliciesStatements.push(
16303
+ ...prepareCreatePolicyJsons(
16304
+ it.name,
16305
+ it.schema,
16306
+ [newPolicy]
16307
+ )
16308
+ );
16309
+ return;
16310
+ }
16311
+ if (newPolicy.for !== oldPolicy.for) {
16312
+ jsonDropPoliciesStatements.push(
16313
+ ...prepareDropPolicyJsons(
16314
+ it.name,
16315
+ it.schema,
16316
+ [oldPolicy]
16317
+ )
16318
+ );
16319
+ jsonCreatePoliciesStatements.push(
16320
+ ...prepareCreatePolicyJsons(
16321
+ it.name,
16322
+ it.schema,
16323
+ [newPolicy]
16324
+ )
16325
+ );
16326
+ return;
16327
+ }
16328
+ jsonAlterPoliciesStatements.push(
16329
+ prepareAlterPolicyJson(
16330
+ it.name,
16331
+ it.schema,
16332
+ it.alteredPolicies[policyName].__old,
16333
+ it.alteredPolicies[policyName].__new
16334
+ )
16335
+ );
16336
+ });
16337
+ for (const table4 of Object.values(json22.tables)) {
16338
+ const policiesInCurrentState = Object.keys(table4.policies);
16339
+ const tableInPreviousState = columnsPatchedSnap1.tables[`${table4.schema === "" ? "public" : table4.schema}.${table4.name}`];
16340
+ const policiesInPreviousState = tableInPreviousState ? Object.keys(tableInPreviousState.policies) : [];
16341
+ if (policiesInPreviousState.length === 0 && policiesInCurrentState.length > 0) {
16342
+ jsonEnableRLSStatements.push({ type: "enable_rls", tableName: table4.name, schema: table4.schema });
16343
+ }
16344
+ if (policiesInPreviousState.length > 0 && policiesInCurrentState.length === 0) {
16345
+ jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
16346
+ }
16347
+ }
16348
+ for (const table4 of Object.values(columnsPatchedSnap1.tables)) {
16349
+ const tableInCurrentState = json22.tables[`${table4.schema === "" ? "public" : table4.schema}.${table4.name}`];
16350
+ if (tableInCurrentState === void 0) {
16351
+ jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
16352
+ }
16353
+ }
15880
16354
  const droppedIndexes = Object.keys(it.alteredIndexes).reduce(
15881
16355
  (current, item) => {
15882
16356
  current[item] = it.alteredIndexes[item].__old;
@@ -15946,9 +16420,6 @@ var init_snapshotsDiffer = __esm({
15946
16420
  const jsonAlterEnumsWithAddedValues = typedResult.alteredEnums.map((it) => {
15947
16421
  return prepareAddValuesToEnumJson(it.name, it.schema, it.addedValues);
15948
16422
  }).flat() ?? [];
15949
- const jsonAlterEnumsWithDroppedValues = typedResult.alteredEnums.map((it) => {
15950
- return prepareDropEnumValues(it.name, it.schema, it.deletedValues, curFull);
15951
- }).flat() ?? [];
15952
16423
  const createSequences = createdSequences.map((it) => {
15953
16424
  return prepareCreateSequenceJson(it);
15954
16425
  }) ?? [];
@@ -15964,6 +16435,18 @@ var init_snapshotsDiffer = __esm({
15964
16435
  const jsonAlterSequences = typedResult.alteredSequences.map((it) => {
15965
16436
  return prepareAlterSequenceJson(it);
15966
16437
  }).flat() ?? [];
16438
+ const createRoles = createdRoles.map((it) => {
16439
+ return prepareCreateRoleJson(it);
16440
+ }) ?? [];
16441
+ const dropRoles = deletedRoles.map((it) => {
16442
+ return prepareDropRoleJson(it.name);
16443
+ });
16444
+ const renameRoles = renamedRoles.map((it) => {
16445
+ return prepareRenameRoleJson(it.from.name, it.to.name);
16446
+ });
16447
+ const jsonAlterRoles = typedResult.alteredRoles.map((it) => {
16448
+ return prepareAlterRoleJson(it);
16449
+ }).flat() ?? [];
15967
16450
  const createSchemas = prepareCreateSchemasJson(
15968
16451
  createdSchemas.map((it) => it.name)
15969
16452
  );
@@ -15976,6 +16459,11 @@ var init_snapshotsDiffer = __esm({
15976
16459
  const createTables = createdTables.map((it) => {
15977
16460
  return preparePgCreateTableJson(it, curFull);
15978
16461
  });
16462
+ jsonCreatePoliciesStatements.push(...[].concat(
16463
+ ...createdTables.map(
16464
+ (it) => prepareCreatePolicyJsons(it.name, it.schema, Object.values(it.policies).map(PgSquasher.unsquashPolicy))
16465
+ )
16466
+ ));
15979
16467
  jsonStatements.push(...createSchemas);
15980
16468
  jsonStatements.push(...renameSchemas);
15981
16469
  jsonStatements.push(...createEnums);
@@ -15986,7 +16474,13 @@ var init_snapshotsDiffer = __esm({
15986
16474
  jsonStatements.push(...moveSequences);
15987
16475
  jsonStatements.push(...renameSequences);
15988
16476
  jsonStatements.push(...jsonAlterSequences);
16477
+ jsonStatements.push(...renameRoles);
16478
+ jsonStatements.push(...dropRoles);
16479
+ jsonStatements.push(...createRoles);
16480
+ jsonStatements.push(...jsonAlterRoles);
15989
16481
  jsonStatements.push(...createTables);
16482
+ jsonStatements.push(...jsonEnableRLSStatements);
16483
+ jsonStatements.push(...jsonDisableRLSStatements);
15990
16484
  jsonStatements.push(...jsonDropTables);
15991
16485
  jsonStatements.push(...jsonSetTableSchemas);
15992
16486
  jsonStatements.push(...jsonRenameTables);
@@ -16006,7 +16500,10 @@ var init_snapshotsDiffer = __esm({
16006
16500
  jsonStatements.push(...jsonAlteredCompositePKs);
16007
16501
  jsonStatements.push(...jsonAddedUniqueConstraints);
16008
16502
  jsonStatements.push(...jsonAlteredUniqueConstraints);
16009
- jsonStatements.push(...jsonAlterEnumsWithDroppedValues);
16503
+ jsonStatements.push(...jsonRenamePoliciesStatements);
16504
+ jsonStatements.push(...jsonDropPoliciesStatements);
16505
+ jsonStatements.push(...jsonCreatePoliciesStatements);
16506
+ jsonStatements.push(...jsonAlterPoliciesStatements);
16010
16507
  jsonStatements.push(...dropEnums);
16011
16508
  jsonStatements.push(...dropSequences);
16012
16509
  jsonStatements.push(...dropSchemas);
@@ -17078,7 +17575,7 @@ var init_outputs = __esm({
17078
17575
  });
17079
17576
 
17080
17577
  // src/cli/commands/migrate.ts
17081
- var import_hanji2, schemasResolver, tablesResolver, sequencesResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT;
17578
+ var import_hanji2, schemasResolver, tablesResolver, sequencesResolver, roleResolver, policyResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedConflict, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT;
17082
17579
  var init_migrate = __esm({
17083
17580
  "src/cli/commands/migrate.ts"() {
17084
17581
  "use strict";
@@ -17141,6 +17638,32 @@ var init_migrate = __esm({
17141
17638
  throw e;
17142
17639
  }
17143
17640
  };
17641
+ roleResolver = async (input) => {
17642
+ const result = await promptNamedConflict(
17643
+ input.created,
17644
+ input.deleted,
17645
+ "role"
17646
+ );
17647
+ return {
17648
+ created: result.created,
17649
+ deleted: result.deleted,
17650
+ renamed: result.renamed
17651
+ };
17652
+ };
17653
+ policyResolver = async (input) => {
17654
+ const result = await promptColumnsConflicts(
17655
+ input.tableName,
17656
+ input.created,
17657
+ input.deleted
17658
+ );
17659
+ return {
17660
+ tableName: input.tableName,
17661
+ schema: input.schema,
17662
+ created: result.created,
17663
+ deleted: result.deleted,
17664
+ renamed: result.renamed
17665
+ };
17666
+ };
17144
17667
  enumsResolver = async (input) => {
17145
17668
  try {
17146
17669
  const { created, deleted, moved, renamed } = await promptNamedWithSchemasConflict(
@@ -17223,6 +17746,56 @@ var init_migrate = __esm({
17223
17746
  result.deleted.push(...leftMissing);
17224
17747
  return result;
17225
17748
  };
17749
+ promptNamedConflict = async (newItems, missingItems, entity) => {
17750
+ if (missingItems.length === 0 || newItems.length === 0) {
17751
+ return {
17752
+ created: newItems,
17753
+ renamed: [],
17754
+ deleted: missingItems
17755
+ };
17756
+ }
17757
+ const result = { created: [], renamed: [], deleted: [] };
17758
+ let index4 = 0;
17759
+ let leftMissing = [...missingItems];
17760
+ do {
17761
+ const created = newItems[index4];
17762
+ const renames = leftMissing.map((it) => {
17763
+ return { from: it, to: created };
17764
+ });
17765
+ const promptData = [created, ...renames];
17766
+ const { status, data } = await (0, import_hanji2.render)(
17767
+ new ResolveSelectNamed(created, promptData, entity)
17768
+ );
17769
+ if (status === "aborted") {
17770
+ console.error("ERROR");
17771
+ process.exit(1);
17772
+ }
17773
+ if (isRenamePromptItem(data)) {
17774
+ console.log(
17775
+ `${source_default.yellow("~")} ${data.from.name} \u203A ${data.to.name} ${source_default.gray(
17776
+ `${entity} will be renamed/moved`
17777
+ )}`
17778
+ );
17779
+ if (data.from.name !== data.to.name) {
17780
+ result.renamed.push(data);
17781
+ }
17782
+ delete leftMissing[leftMissing.indexOf(data.from)];
17783
+ leftMissing = leftMissing.filter(Boolean);
17784
+ } else {
17785
+ console.log(
17786
+ `${source_default.green("+")} ${data.name} ${source_default.gray(
17787
+ `${entity} will be created`
17788
+ )}`
17789
+ );
17790
+ result.created.push(created);
17791
+ }
17792
+ index4 += 1;
17793
+ } while (index4 < newItems.length);
17794
+ console.log(source_default.gray(`--- all ${entity} conflicts resolved ---
17795
+ `));
17796
+ result.deleted.push(...leftMissing);
17797
+ return result;
17798
+ };
17226
17799
  promptNamedWithSchemasConflict = async (newItems, missingItems, entity) => {
17227
17800
  if (missingItems.length === 0 || newItems.length === 0) {
17228
17801
  return {
@@ -18779,8 +19352,8 @@ function parsePgArray(arrayString) {
18779
19352
  const [result] = parsePgNestedArray(arrayString, 1);
18780
19353
  return result;
18781
19354
  }
18782
- function makePgArray(array) {
18783
- return `{${array.map((item) => {
19355
+ function makePgArray(array2) {
19356
+ return `{${array2.map((item) => {
18784
19357
  if (Array.isArray(item)) {
18785
19358
  return makePgArray(item);
18786
19359
  }
@@ -19488,8 +20061,8 @@ var init_sql = __esm({
19488
20061
  sql2.param = param2;
19489
20062
  })(sql || (sql = {}));
19490
20063
  ((SQL2) => {
19491
- var _a324;
19492
- _a324 = entityKind;
20064
+ var _a326;
20065
+ _a326 = entityKind;
19493
20066
  const _Aliased = class _Aliased {
19494
20067
  constructor(sql2, fieldAlias) {
19495
20068
  /** @internal */
@@ -19505,7 +20078,7 @@ var init_sql = __esm({
19505
20078
  return new _Aliased(this.sql, this.fieldAlias);
19506
20079
  }
19507
20080
  };
19508
- __publicField(_Aliased, _a324, "SQL.Aliased");
20081
+ __publicField(_Aliased, _a326, "SQL.Aliased");
19509
20082
  let Aliased = _Aliased;
19510
20083
  SQL2.Aliased = Aliased;
19511
20084
  })(SQL || (SQL = {}));
@@ -19788,8 +20361,8 @@ function arrayContains(column4, values) {
19788
20361
  if (values.length === 0) {
19789
20362
  throw new Error("arrayContains requires at least one value");
19790
20363
  }
19791
- const array = sql`${bindIfParam(values, column4)}`;
19792
- return sql`${column4} @> ${array}`;
20364
+ const array2 = sql`${bindIfParam(values, column4)}`;
20365
+ return sql`${column4} @> ${array2}`;
19793
20366
  }
19794
20367
  return sql`${column4} @> ${bindIfParam(values, column4)}`;
19795
20368
  }
@@ -19798,8 +20371,8 @@ function arrayContained(column4, values) {
19798
20371
  if (values.length === 0) {
19799
20372
  throw new Error("arrayContained requires at least one value");
19800
20373
  }
19801
- const array = sql`${bindIfParam(values, column4)}`;
19802
- return sql`${column4} <@ ${array}`;
20374
+ const array2 = sql`${bindIfParam(values, column4)}`;
20375
+ return sql`${column4} <@ ${array2}`;
19803
20376
  }
19804
20377
  return sql`${column4} <@ ${bindIfParam(values, column4)}`;
19805
20378
  }
@@ -19808,8 +20381,8 @@ function arrayOverlaps(column4, values) {
19808
20381
  if (values.length === 0) {
19809
20382
  throw new Error("arrayOverlaps requires at least one value");
19810
20383
  }
19811
- const array = sql`${bindIfParam(values, column4)}`;
19812
- return sql`${column4} && ${array}`;
20384
+ const array2 = sql`${bindIfParam(values, column4)}`;
20385
+ return sql`${column4} && ${array2}`;
19813
20386
  }
19814
20387
  return sql`${column4} && ${bindIfParam(values, column4)}`;
19815
20388
  }
@@ -25475,6 +26048,67 @@ var init_indexes = __esm({
25475
26048
  }
25476
26049
  });
25477
26050
 
26051
+ // ../drizzle-orm/dist/pg-core/policies.js
26052
+ var _a147, PgPolicy;
26053
+ var init_policies = __esm({
26054
+ "../drizzle-orm/dist/pg-core/policies.js"() {
26055
+ "use strict";
26056
+ init_entity();
26057
+ _a147 = entityKind;
26058
+ PgPolicy = class {
26059
+ constructor(name2, config) {
26060
+ __publicField(this, "as");
26061
+ __publicField(this, "for");
26062
+ __publicField(this, "to");
26063
+ __publicField(this, "using");
26064
+ __publicField(this, "withCheck");
26065
+ this.name = name2;
26066
+ if (config) {
26067
+ this.as = config.as;
26068
+ this.for = config.for;
26069
+ this.to = config.to;
26070
+ this.using = config.using;
26071
+ this.withCheck = config.withCheck;
26072
+ }
26073
+ }
26074
+ };
26075
+ __publicField(PgPolicy, _a147, "PgPolicy");
26076
+ }
26077
+ });
26078
+
26079
+ // ../drizzle-orm/dist/pg-core/roles.js
26080
+ var _a148, PgRole;
26081
+ var init_roles = __esm({
26082
+ "../drizzle-orm/dist/pg-core/roles.js"() {
26083
+ "use strict";
26084
+ init_entity();
26085
+ _a148 = entityKind;
26086
+ PgRole = class {
26087
+ constructor(name2, config) {
26088
+ /** @internal */
26089
+ __publicField(this, "_existing");
26090
+ /** @internal */
26091
+ __publicField(this, "createDb");
26092
+ /** @internal */
26093
+ __publicField(this, "createRole");
26094
+ /** @internal */
26095
+ __publicField(this, "inherit");
26096
+ this.name = name2;
26097
+ if (config) {
26098
+ this.createDb = config.createDb;
26099
+ this.createRole = config.createRole;
26100
+ this.inherit = config.inherit;
26101
+ }
26102
+ }
26103
+ existing() {
26104
+ this._existing = true;
26105
+ return this;
26106
+ }
26107
+ };
26108
+ __publicField(PgRole, _a148, "PgRole");
26109
+ }
26110
+ });
26111
+
25478
26112
  // ../drizzle-orm/dist/pg-core/sequence.js
25479
26113
  function pgSequenceWithSchema(name2, options, schema4) {
25480
26114
  return new PgSequence(name2, options, schema4);
@@ -25482,12 +26116,12 @@ function pgSequenceWithSchema(name2, options, schema4) {
25482
26116
  function isPgSequence(obj) {
25483
26117
  return is(obj, PgSequence);
25484
26118
  }
25485
- var _a147, PgSequence;
26119
+ var _a149, PgSequence;
25486
26120
  var init_sequence = __esm({
25487
26121
  "../drizzle-orm/dist/pg-core/sequence.js"() {
25488
26122
  "use strict";
25489
26123
  init_entity();
25490
- _a147 = entityKind;
26124
+ _a149 = entityKind;
25491
26125
  PgSequence = class {
25492
26126
  constructor(seqName, seqOptions, schema4) {
25493
26127
  this.seqName = seqName;
@@ -25495,7 +26129,7 @@ var init_sequence = __esm({
25495
26129
  this.schema = schema4;
25496
26130
  }
25497
26131
  };
25498
- __publicField(PgSequence, _a147, "PgSequence");
26132
+ __publicField(PgSequence, _a149, "PgSequence");
25499
26133
  }
25500
26134
  });
25501
26135
 
@@ -25521,7 +26155,7 @@ function pgMaterializedViewWithSchema(name2, selection, schema4) {
25521
26155
  }
25522
26156
  return new MaterializedViewBuilder(name2, schema4);
25523
26157
  }
25524
- 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;
26158
+ 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;
25525
26159
  var init_view = __esm({
25526
26160
  "../drizzle-orm/dist/pg-core/view.js"() {
25527
26161
  "use strict";
@@ -25532,7 +26166,7 @@ var init_view = __esm({
25532
26166
  init_table2();
25533
26167
  init_view_base();
25534
26168
  init_view_common2();
25535
- _a148 = entityKind;
26169
+ _a150 = entityKind;
25536
26170
  DefaultViewBuilderCore = class {
25537
26171
  constructor(name2, schema4) {
25538
26172
  __publicField(this, "config", {});
@@ -25544,8 +26178,8 @@ var init_view = __esm({
25544
26178
  return this;
25545
26179
  }
25546
26180
  };
25547
- __publicField(DefaultViewBuilderCore, _a148, "PgDefaultViewBuilderCore");
25548
- ViewBuilder = class extends (_b107 = DefaultViewBuilderCore, _a149 = entityKind, _b107) {
26181
+ __publicField(DefaultViewBuilderCore, _a150, "PgDefaultViewBuilderCore");
26182
+ ViewBuilder = class extends (_b107 = DefaultViewBuilderCore, _a151 = entityKind, _b107) {
25549
26183
  as(qb) {
25550
26184
  if (typeof qb === "function") {
25551
26185
  qb = qb(new QueryBuilder());
@@ -25571,8 +26205,8 @@ var init_view = __esm({
25571
26205
  );
25572
26206
  }
25573
26207
  };
25574
- __publicField(ViewBuilder, _a149, "PgViewBuilder");
25575
- ManualViewBuilder = class extends (_b108 = DefaultViewBuilderCore, _a150 = entityKind, _b108) {
26208
+ __publicField(ViewBuilder, _a151, "PgViewBuilder");
26209
+ ManualViewBuilder = class extends (_b108 = DefaultViewBuilderCore, _a152 = entityKind, _b108) {
25576
26210
  constructor(name2, columns, schema4) {
25577
26211
  super(name2, schema4);
25578
26212
  __publicField(this, "columns");
@@ -25617,8 +26251,8 @@ var init_view = __esm({
25617
26251
  );
25618
26252
  }
25619
26253
  };
25620
- __publicField(ManualViewBuilder, _a150, "PgManualViewBuilder");
25621
- _a151 = entityKind;
26254
+ __publicField(ManualViewBuilder, _a152, "PgManualViewBuilder");
26255
+ _a153 = entityKind;
25622
26256
  MaterializedViewBuilderCore = class {
25623
26257
  constructor(name2, schema4) {
25624
26258
  __publicField(this, "config", {});
@@ -25642,8 +26276,8 @@ var init_view = __esm({
25642
26276
  return this;
25643
26277
  }
25644
26278
  };
25645
- __publicField(MaterializedViewBuilderCore, _a151, "PgMaterializedViewBuilderCore");
25646
- MaterializedViewBuilder = class extends (_b109 = MaterializedViewBuilderCore, _a152 = entityKind, _b109) {
26279
+ __publicField(MaterializedViewBuilderCore, _a153, "PgMaterializedViewBuilderCore");
26280
+ MaterializedViewBuilder = class extends (_b109 = MaterializedViewBuilderCore, _a154 = entityKind, _b109) {
25647
26281
  as(qb) {
25648
26282
  if (typeof qb === "function") {
25649
26283
  qb = qb(new QueryBuilder());
@@ -25674,8 +26308,8 @@ var init_view = __esm({
25674
26308
  );
25675
26309
  }
25676
26310
  };
25677
- __publicField(MaterializedViewBuilder, _a152, "PgMaterializedViewBuilder");
25678
- ManualMaterializedViewBuilder = class extends (_b110 = MaterializedViewBuilderCore, _a153 = entityKind, _b110) {
26311
+ __publicField(MaterializedViewBuilder, _a154, "PgMaterializedViewBuilder");
26312
+ ManualMaterializedViewBuilder = class extends (_b110 = MaterializedViewBuilderCore, _a155 = entityKind, _b110) {
25679
26313
  constructor(name2, columns, schema4) {
25680
26314
  super(name2, schema4);
25681
26315
  __publicField(this, "columns");
@@ -25720,11 +26354,11 @@ var init_view = __esm({
25720
26354
  );
25721
26355
  }
25722
26356
  };
25723
- __publicField(ManualMaterializedViewBuilder, _a153, "PgManualMaterializedViewBuilder");
25724
- PgView = class extends (_c4 = PgViewBase, _b111 = entityKind, _a154 = PgViewConfig, _c4) {
26357
+ __publicField(ManualMaterializedViewBuilder, _a155, "PgManualMaterializedViewBuilder");
26358
+ PgView = class extends (_c4 = PgViewBase, _b111 = entityKind, _a156 = PgViewConfig, _c4) {
25725
26359
  constructor({ pgConfig, config }) {
25726
26360
  super(config);
25727
- __publicField(this, _a154);
26361
+ __publicField(this, _a156);
25728
26362
  if (pgConfig) {
25729
26363
  this[PgViewConfig] = {
25730
26364
  with: pgConfig.with
@@ -25734,10 +26368,10 @@ var init_view = __esm({
25734
26368
  };
25735
26369
  __publicField(PgView, _b111, "PgView");
25736
26370
  PgMaterializedViewConfig = Symbol.for("drizzle:PgMaterializedViewConfig");
25737
- PgMaterializedView = class extends (_c5 = PgViewBase, _b112 = entityKind, _a155 = PgMaterializedViewConfig, _c5) {
26371
+ PgMaterializedView = class extends (_c5 = PgViewBase, _b112 = entityKind, _a157 = PgMaterializedViewConfig, _c5) {
25738
26372
  constructor({ pgConfig, config }) {
25739
26373
  super(config);
25740
- __publicField(this, _a155);
26374
+ __publicField(this, _a157);
25741
26375
  this[PgMaterializedViewConfig] = {
25742
26376
  with: pgConfig?.with,
25743
26377
  using: pgConfig?.using,
@@ -25751,7 +26385,7 @@ var init_view = __esm({
25751
26385
  });
25752
26386
 
25753
26387
  // ../drizzle-orm/dist/pg-core/schema.js
25754
- var _a156, PgSchema5;
26388
+ var _a158, PgSchema5;
25755
26389
  var init_schema = __esm({
25756
26390
  "../drizzle-orm/dist/pg-core/schema.js"() {
25757
26391
  "use strict";
@@ -25761,7 +26395,7 @@ var init_schema = __esm({
25761
26395
  init_sequence();
25762
26396
  init_table2();
25763
26397
  init_view();
25764
- _a156 = entityKind;
26398
+ _a158 = entityKind;
25765
26399
  PgSchema5 = class {
25766
26400
  constructor(schemaName) {
25767
26401
  __publicField(this, "table", (name2, columns, extraConfig) => {
@@ -25788,12 +26422,12 @@ var init_schema = __esm({
25788
26422
  return true;
25789
26423
  }
25790
26424
  };
25791
- __publicField(PgSchema5, _a156, "PgSchema");
26425
+ __publicField(PgSchema5, _a158, "PgSchema");
25792
26426
  }
25793
26427
  });
25794
26428
 
25795
26429
  // ../drizzle-orm/dist/pg-core/session.js
25796
- var _a157, PgPreparedQuery, _a158, PgSession, _a159, _b113, PgTransaction;
26430
+ var _a159, PgPreparedQuery, _a160, PgSession, _a161, _b113, PgTransaction;
25797
26431
  var init_session = __esm({
25798
26432
  "../drizzle-orm/dist/pg-core/session.js"() {
25799
26433
  "use strict";
@@ -25802,7 +26436,7 @@ var init_session = __esm({
25802
26436
  init_sql2();
25803
26437
  init_tracing();
25804
26438
  init_db();
25805
- _a157 = entityKind;
26439
+ _a159 = entityKind;
25806
26440
  PgPreparedQuery = class {
25807
26441
  constructor(query) {
25808
26442
  /** @internal */
@@ -25816,8 +26450,8 @@ var init_session = __esm({
25816
26450
  return response;
25817
26451
  }
25818
26452
  };
25819
- __publicField(PgPreparedQuery, _a157, "PgPreparedQuery");
25820
- _a158 = entityKind;
26453
+ __publicField(PgPreparedQuery, _a159, "PgPreparedQuery");
26454
+ _a160 = entityKind;
25821
26455
  PgSession = class {
25822
26456
  constructor(dialect4) {
25823
26457
  this.dialect = dialect4;
@@ -25850,8 +26484,8 @@ var init_session = __esm({
25850
26484
  );
25851
26485
  }
25852
26486
  };
25853
- __publicField(PgSession, _a158, "PgSession");
25854
- PgTransaction = class extends (_b113 = PgDatabase, _a159 = entityKind, _b113) {
26487
+ __publicField(PgSession, _a160, "PgSession");
26488
+ PgTransaction = class extends (_b113 = PgDatabase, _a161 = entityKind, _b113) {
25855
26489
  constructor(dialect4, session, schema4, nestedIndex = 0) {
25856
26490
  super(dialect4, session, schema4);
25857
26491
  this.schema = schema4;
@@ -25878,7 +26512,7 @@ var init_session = __esm({
25878
26512
  return this.session.execute(sql`set transaction ${this.getTransactionConfigSQL(config)}`);
25879
26513
  }
25880
26514
  };
25881
- __publicField(PgTransaction, _a159, "PgTransaction");
26515
+ __publicField(PgTransaction, _a161, "PgTransaction");
25882
26516
  }
25883
26517
  });
25884
26518
 
@@ -25899,10 +26533,12 @@ function getTableConfig(table4) {
25899
26533
  const uniqueConstraints = [];
25900
26534
  const name2 = table4[Table.Symbol.Name];
25901
26535
  const schema4 = table4[Table.Symbol.Schema];
26536
+ const policies = [];
25902
26537
  const extraConfigBuilder = table4[PgTable.Symbol.ExtraConfigBuilder];
25903
26538
  if (extraConfigBuilder !== void 0) {
25904
26539
  const extraConfig = extraConfigBuilder(table4[Table.Symbol.ExtraConfigColumns]);
25905
- for (const builder of Object.values(extraConfig)) {
26540
+ const extraValues = Array.isArray(extraConfig) ? extraConfig : Object.values(extraConfig);
26541
+ for (const builder of extraValues) {
25906
26542
  if (is(builder, IndexBuilder)) {
25907
26543
  indexes.push(builder.build(table4));
25908
26544
  } else if (is(builder, CheckBuilder)) {
@@ -25913,6 +26549,8 @@ function getTableConfig(table4) {
25913
26549
  primaryKeys.push(builder.build(table4));
25914
26550
  } else if (is(builder, ForeignKeyBuilder)) {
25915
26551
  foreignKeys.push(builder.build(table4));
26552
+ } else if (is(builder, PgPolicy)) {
26553
+ policies.push(builder);
25916
26554
  }
25917
26555
  }
25918
26556
  }
@@ -25924,7 +26562,8 @@ function getTableConfig(table4) {
25924
26562
  primaryKeys,
25925
26563
  uniqueConstraints,
25926
26564
  name: name2,
25927
- schema: schema4
26565
+ schema: schema4,
26566
+ policies
25928
26567
  };
25929
26568
  }
25930
26569
  var init_utils4 = __esm({
@@ -25936,6 +26575,7 @@ var init_utils4 = __esm({
25936
26575
  init_checks();
25937
26576
  init_foreign_keys();
25938
26577
  init_indexes();
26578
+ init_policies();
25939
26579
  init_primary_keys();
25940
26580
  init_unique_constraint();
25941
26581
  }
@@ -25960,8 +26600,10 @@ var init_pg_core = __esm({
25960
26600
  init_dialect();
25961
26601
  init_foreign_keys();
25962
26602
  init_indexes();
26603
+ init_policies();
25963
26604
  init_primary_keys();
25964
26605
  init_query_builders();
26606
+ init_roles();
25965
26607
  init_schema();
25966
26608
  init_sequence();
25967
26609
  init_session();
@@ -25988,9 +26630,9 @@ function minRangeForIdentityBasedOn(columnType) {
25988
26630
  function stringFromDatabaseIdentityProperty(field) {
25989
26631
  return typeof field === "string" ? field : typeof field === "undefined" ? void 0 : typeof field === "bigint" ? field.toString() : String(field);
25990
26632
  }
25991
- function buildArrayString(array, sqlType) {
26633
+ function buildArrayString(array2, sqlType) {
25992
26634
  sqlType = sqlType.split("[")[0];
25993
- const values = array.map((value) => {
26635
+ const values = array2.map((value) => {
25994
26636
  if (typeof value === "number" || typeof value === "bigint") {
25995
26637
  return value.toString();
25996
26638
  } else if (typeof value === "boolean") {
@@ -26012,6 +26654,40 @@ function buildArrayString(array, sqlType) {
26012
26654
  }).join(",");
26013
26655
  return `{${values}}`;
26014
26656
  }
26657
+ function prepareRoles(entities) {
26658
+ let useRoles = false;
26659
+ const includeRoles = [];
26660
+ const excludeRoles = [];
26661
+ if (entities && entities.roles) {
26662
+ if (typeof entities.roles === "object") {
26663
+ if (entities.roles.provider) {
26664
+ if (entities.roles.provider === "supabase") {
26665
+ excludeRoles.push(...[
26666
+ "anon",
26667
+ "authenticator",
26668
+ "authenticated",
26669
+ "service_role",
26670
+ "supabase_auth_admin",
26671
+ "supabase_storage_admin",
26672
+ "dashboard_user",
26673
+ "supabase_admin"
26674
+ ]);
26675
+ } else if (entities.roles.provider === "neon") {
26676
+ excludeRoles.push(...["authenticated", "anonymous"]);
26677
+ }
26678
+ }
26679
+ if (entities.roles.include) {
26680
+ includeRoles.push(...entities.roles.include);
26681
+ }
26682
+ if (entities.roles.exclude) {
26683
+ excludeRoles.push(...entities.roles.exclude);
26684
+ }
26685
+ } else {
26686
+ useRoles = entities.roles;
26687
+ }
26688
+ }
26689
+ return { useRoles, includeRoles, excludeRoles };
26690
+ }
26015
26691
  var indexName, generatePgSnapshot, trimChar, fromDatabase, defaultForColumn;
26016
26692
  var init_pgSerializer = __esm({
26017
26693
  "src/serializer/pgSerializer.ts"() {
@@ -26027,10 +26703,11 @@ var init_pgSerializer = __esm({
26027
26703
  indexName = (tableName, columns) => {
26028
26704
  return `${tableName}_${columns.join("_")}_index`;
26029
26705
  };
26030
- generatePgSnapshot = (tables, enums, schemas, sequences, casing2, schemaFilter) => {
26706
+ generatePgSnapshot = (tables, enums, schemas, sequences, roles, casing2, schemaFilter) => {
26031
26707
  const dialect4 = new PgDialect({ casing: casing2 });
26032
26708
  const result = {};
26033
26709
  const sequencesToReturn = {};
26710
+ const rolesToReturn = {};
26034
26711
  const indexesInSchema = {};
26035
26712
  for (const table4 of tables) {
26036
26713
  const {
@@ -26041,7 +26718,8 @@ var init_pgSerializer = __esm({
26041
26718
  checks,
26042
26719
  schema: schema4,
26043
26720
  primaryKeys,
26044
- uniqueConstraints
26721
+ uniqueConstraints,
26722
+ policies
26045
26723
  } = getTableConfig(table4);
26046
26724
  if (schemaFilter && !schemaFilter.includes(schema4 ?? "public")) {
26047
26725
  continue;
@@ -26051,6 +26729,7 @@ var init_pgSerializer = __esm({
26051
26729
  const foreignKeysObject = {};
26052
26730
  const primaryKeysObject = {};
26053
26731
  const uniqueConstraintObject = {};
26732
+ const policiesObject = {};
26054
26733
  columns.forEach((column4) => {
26055
26734
  const name2 = getColumnCasing(column4, casing2);
26056
26735
  const notNull = column4.notNull;
@@ -26313,6 +26992,34 @@ ${withStyle.errorWarning(
26313
26992
  with: value.config.with ?? {}
26314
26993
  };
26315
26994
  });
26995
+ policies.forEach((policy2) => {
26996
+ const mappedTo = [];
26997
+ if (!policy2.to) {
26998
+ mappedTo.push("public");
26999
+ } else {
27000
+ if (policy2.to && typeof policy2.to === "string") {
27001
+ mappedTo.push(policy2.to);
27002
+ } else if (policy2.to && is(policy2.to, PgRole)) {
27003
+ mappedTo.push(policy2.to.name);
27004
+ } else if (policy2.to && Array.isArray(policy2.to)) {
27005
+ policy2.to.forEach((it) => {
27006
+ if (typeof it === "string") {
27007
+ mappedTo.push(it);
27008
+ } else if (is(it, PgRole)) {
27009
+ mappedTo.push(it.name);
27010
+ }
27011
+ });
27012
+ }
27013
+ }
27014
+ policiesObject[policy2.name] = {
27015
+ name: policy2.name,
27016
+ as: policy2.as?.toUpperCase() ?? "PERMISSIVE",
27017
+ for: policy2.for?.toUpperCase() ?? "ALL",
27018
+ to: mappedTo.sort(),
27019
+ using: is(policy2.using, SQL) ? dialect4.sqlToQuery(policy2.using).sql : void 0,
27020
+ withCheck: is(policy2.withCheck, SQL) ? dialect4.sqlToQuery(policy2.withCheck).sql : void 0
27021
+ };
27022
+ });
26316
27023
  const tableKey2 = `${schema4 ?? "public"}.${tableName}`;
26317
27024
  result[tableKey2] = {
26318
27025
  name: tableName,
@@ -26321,7 +27028,8 @@ ${withStyle.errorWarning(
26321
27028
  indexes: indexesObject,
26322
27029
  foreignKeys: foreignKeysObject,
26323
27030
  compositePrimaryKeys: primaryKeysObject,
26324
- uniqueConstraints: uniqueConstraintObject
27031
+ uniqueConstraints: uniqueConstraintObject,
27032
+ policies: policiesObject
26325
27033
  };
26326
27034
  }
26327
27035
  for (const sequence of sequences) {
@@ -26345,6 +27053,16 @@ ${withStyle.errorWarning(
26345
27053
  } else {
26346
27054
  }
26347
27055
  }
27056
+ for (const role of roles) {
27057
+ if (!role._existing) {
27058
+ rolesToReturn[role.name] = {
27059
+ name: role.name,
27060
+ createDb: role.createDb === void 0 ? false : role.createDb,
27061
+ createRole: role.createRole === void 0 ? false : role.createRole,
27062
+ inherit: role.inherit === void 0 ? true : role.inherit
27063
+ };
27064
+ }
27065
+ }
26348
27066
  const enumsToReturn = enums.reduce((map, obj) => {
26349
27067
  const enumSchema3 = obj.schema || "public";
26350
27068
  const key = `${enumSchema3}.${obj.enumName}`;
@@ -26371,6 +27089,7 @@ ${withStyle.errorWarning(
26371
27089
  enums: enumsToReturn,
26372
27090
  schemas: schemasObject,
26373
27091
  sequences: sequencesToReturn,
27092
+ roles: rolesToReturn,
26374
27093
  _meta: {
26375
27094
  schemas: {},
26376
27095
  tables: {},
@@ -26385,7 +27104,7 @@ ${withStyle.errorWarning(
26385
27104
  while (end > start && str[end - 1] === char3) --end;
26386
27105
  return start > 0 || end < str.length ? str.substring(start, end) : str.toString();
26387
27106
  };
26388
- fromDatabase = async (db, tablesFilter = () => true, schemaFilters, progressCallback) => {
27107
+ fromDatabase = async (db, tablesFilter = () => true, schemaFilters, entities, progressCallback) => {
26389
27108
  const result = {};
26390
27109
  const internals = { tables: {} };
26391
27110
  const where = schemaFilters.map((t) => `table_schema = '${t}'`).join(" or ");
@@ -26467,6 +27186,60 @@ ${withStyle.errorWarning(
26467
27186
  if (progressCallback) {
26468
27187
  progressCallback("enums", Object.keys(enumsToReturn).length, "done");
26469
27188
  }
27189
+ const allRoles = await db.query(
27190
+ `SELECT rolname, rolinherit, rolcreatedb, rolcreaterole FROM pg_roles;`
27191
+ );
27192
+ const rolesToReturn = {};
27193
+ const preparedRoles = prepareRoles(entities);
27194
+ if (preparedRoles.useRoles || !(preparedRoles.includeRoles.length === 0 && preparedRoles.excludeRoles.length === 0)) {
27195
+ for (const dbRole of allRoles) {
27196
+ if (preparedRoles.useRoles) {
27197
+ rolesToReturn[dbRole.rolname] = {
27198
+ createDb: dbRole.rolcreatedb,
27199
+ createRole: dbRole.rolcreatedb,
27200
+ inherit: dbRole.rolinherit,
27201
+ name: dbRole.rolname
27202
+ };
27203
+ } else {
27204
+ if (preparedRoles.includeRoles.length === 0 && preparedRoles.excludeRoles.length === 0) continue;
27205
+ if (preparedRoles.includeRoles.includes(dbRole.rolname) && preparedRoles.excludeRoles.includes(dbRole.rolname)) continue;
27206
+ if (preparedRoles.excludeRoles.includes(dbRole.rolname)) continue;
27207
+ if (!preparedRoles.includeRoles.includes(dbRole.rolname)) continue;
27208
+ rolesToReturn[dbRole.rolname] = {
27209
+ createDb: dbRole.rolcreatedb,
27210
+ createRole: dbRole.rolcreaterole,
27211
+ inherit: dbRole.rolinherit,
27212
+ name: dbRole.rolname
27213
+ };
27214
+ }
27215
+ }
27216
+ }
27217
+ const wherePolicies = schemaFilters.map((t) => `schemaname = '${t}'`).join(" or ");
27218
+ const policiesByTable = {};
27219
+ 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}`};`);
27220
+ for (const dbPolicy of allPolicies) {
27221
+ const { tablename, schemaname, to, withCheck, using, ...rest } = dbPolicy;
27222
+ const tableForPolicy = policiesByTable[`${schemaname}.${tablename}`];
27223
+ const parsedTo = to === "{}" ? [] : to.substring(1, to.length - 1).split(/\s*,\s*/g).sort();
27224
+ const parsedWithCheck = withCheck === null ? void 0 : withCheck;
27225
+ const parsedUsing = using === null ? void 0 : using;
27226
+ if (tableForPolicy) {
27227
+ tableForPolicy[dbPolicy.name] = { ...rest, to: parsedTo };
27228
+ } else {
27229
+ policiesByTable[`${schemaname}.${tablename}`] = {
27230
+ [dbPolicy.name]: { ...rest, to: parsedTo, withCheck: parsedWithCheck, using: parsedUsing }
27231
+ };
27232
+ }
27233
+ }
27234
+ if (progressCallback) {
27235
+ progressCallback(
27236
+ "policies",
27237
+ Object.values(policiesByTable).reduce((total, innerRecord) => {
27238
+ return total + Object.keys(innerRecord).length;
27239
+ }, 0),
27240
+ "done"
27241
+ );
27242
+ }
26470
27243
  const sequencesInColumns = [];
26471
27244
  const all = allTables.map((row) => {
26472
27245
  return new Promise(async (res, rej) => {
@@ -26860,7 +27633,8 @@ ${withStyle.errorWarning(
26860
27633
  indexes: indexToReturn,
26861
27634
  foreignKeys: foreignKeysToReturn,
26862
27635
  compositePrimaryKeys: primaryKeys,
26863
- uniqueConstraints: uniqueConstrains
27636
+ uniqueConstraints: uniqueConstrains,
27637
+ policies: policiesByTable[`${tableSchema}.${tableName}`] ?? {}
26864
27638
  };
26865
27639
  } catch (e) {
26866
27640
  rej(e);
@@ -26887,6 +27661,7 @@ ${withStyle.errorWarning(
26887
27661
  enums: enumsToReturn,
26888
27662
  schemas: schemasObject,
26889
27663
  sequences: sequencesToReturn,
27664
+ roles: rolesToReturn,
26890
27665
  _meta: {
26891
27666
  schemas: {},
26892
27667
  tables: {},
@@ -27009,12 +27784,12 @@ var init_alias3 = __esm({
27009
27784
  });
27010
27785
 
27011
27786
  // ../drizzle-orm/dist/sqlite-core/checks.js
27012
- var _a160, CheckBuilder2, _a161, Check2;
27787
+ var _a162, CheckBuilder2, _a163, Check2;
27013
27788
  var init_checks2 = __esm({
27014
27789
  "../drizzle-orm/dist/sqlite-core/checks.js"() {
27015
27790
  "use strict";
27016
27791
  init_entity();
27017
- _a160 = entityKind;
27792
+ _a162 = entityKind;
27018
27793
  CheckBuilder2 = class {
27019
27794
  constructor(name2, value) {
27020
27795
  __publicField(this, "brand");
@@ -27025,8 +27800,8 @@ var init_checks2 = __esm({
27025
27800
  return new Check2(table4, this);
27026
27801
  }
27027
27802
  };
27028
- __publicField(CheckBuilder2, _a160, "SQLiteCheckBuilder");
27029
- _a161 = entityKind;
27803
+ __publicField(CheckBuilder2, _a162, "SQLiteCheckBuilder");
27804
+ _a163 = entityKind;
27030
27805
  Check2 = class {
27031
27806
  constructor(table4, builder) {
27032
27807
  __publicField(this, "name");
@@ -27036,18 +27811,18 @@ var init_checks2 = __esm({
27036
27811
  this.value = builder.value;
27037
27812
  }
27038
27813
  };
27039
- __publicField(Check2, _a161, "SQLiteCheck");
27814
+ __publicField(Check2, _a163, "SQLiteCheck");
27040
27815
  }
27041
27816
  });
27042
27817
 
27043
27818
  // ../drizzle-orm/dist/sqlite-core/foreign-keys.js
27044
- var _a162, ForeignKeyBuilder2, _a163, ForeignKey2;
27819
+ var _a164, ForeignKeyBuilder2, _a165, ForeignKey2;
27045
27820
  var init_foreign_keys2 = __esm({
27046
27821
  "../drizzle-orm/dist/sqlite-core/foreign-keys.js"() {
27047
27822
  "use strict";
27048
27823
  init_entity();
27049
27824
  init_table_utils();
27050
- _a162 = entityKind;
27825
+ _a164 = entityKind;
27051
27826
  ForeignKeyBuilder2 = class {
27052
27827
  constructor(config, actions) {
27053
27828
  /** @internal */
@@ -27078,8 +27853,8 @@ var init_foreign_keys2 = __esm({
27078
27853
  return new ForeignKey2(table4, this);
27079
27854
  }
27080
27855
  };
27081
- __publicField(ForeignKeyBuilder2, _a162, "SQLiteForeignKeyBuilder");
27082
- _a163 = entityKind;
27856
+ __publicField(ForeignKeyBuilder2, _a164, "SQLiteForeignKeyBuilder");
27857
+ _a165 = entityKind;
27083
27858
  ForeignKey2 = class {
27084
27859
  constructor(table4, builder) {
27085
27860
  __publicField(this, "reference");
@@ -27103,7 +27878,7 @@ var init_foreign_keys2 = __esm({
27103
27878
  return name2 ?? `${chunks.join("_")}_fk`;
27104
27879
  }
27105
27880
  };
27106
- __publicField(ForeignKey2, _a163, "SQLiteForeignKey");
27881
+ __publicField(ForeignKey2, _a165, "SQLiteForeignKey");
27107
27882
  }
27108
27883
  });
27109
27884
 
@@ -27111,13 +27886,13 @@ var init_foreign_keys2 = __esm({
27111
27886
  function uniqueKeyName2(table4, columns) {
27112
27887
  return `${table4[TableName]}_${columns.join("_")}_unique`;
27113
27888
  }
27114
- var _a164, UniqueConstraintBuilder2, _a165, UniqueOnConstraintBuilder2, _a166, UniqueConstraint2;
27889
+ var _a166, UniqueConstraintBuilder2, _a167, UniqueOnConstraintBuilder2, _a168, UniqueConstraint2;
27115
27890
  var init_unique_constraint2 = __esm({
27116
27891
  "../drizzle-orm/dist/sqlite-core/unique-constraint.js"() {
27117
27892
  "use strict";
27118
27893
  init_entity();
27119
27894
  init_table_utils();
27120
- _a164 = entityKind;
27895
+ _a166 = entityKind;
27121
27896
  UniqueConstraintBuilder2 = class {
27122
27897
  constructor(columns, name2) {
27123
27898
  /** @internal */
@@ -27130,8 +27905,8 @@ var init_unique_constraint2 = __esm({
27130
27905
  return new UniqueConstraint2(table4, this.columns, this.name);
27131
27906
  }
27132
27907
  };
27133
- __publicField(UniqueConstraintBuilder2, _a164, "SQLiteUniqueConstraintBuilder");
27134
- _a165 = entityKind;
27908
+ __publicField(UniqueConstraintBuilder2, _a166, "SQLiteUniqueConstraintBuilder");
27909
+ _a167 = entityKind;
27135
27910
  UniqueOnConstraintBuilder2 = class {
27136
27911
  constructor(name2) {
27137
27912
  /** @internal */
@@ -27142,8 +27917,8 @@ var init_unique_constraint2 = __esm({
27142
27917
  return new UniqueConstraintBuilder2(columns, this.name);
27143
27918
  }
27144
27919
  };
27145
- __publicField(UniqueOnConstraintBuilder2, _a165, "SQLiteUniqueOnConstraintBuilder");
27146
- _a166 = entityKind;
27920
+ __publicField(UniqueOnConstraintBuilder2, _a167, "SQLiteUniqueOnConstraintBuilder");
27921
+ _a168 = entityKind;
27147
27922
  UniqueConstraint2 = class {
27148
27923
  constructor(table4, columns, name2) {
27149
27924
  __publicField(this, "columns");
@@ -27156,12 +27931,12 @@ var init_unique_constraint2 = __esm({
27156
27931
  return this.name;
27157
27932
  }
27158
27933
  };
27159
- __publicField(UniqueConstraint2, _a166, "SQLiteUniqueConstraint");
27934
+ __publicField(UniqueConstraint2, _a168, "SQLiteUniqueConstraint");
27160
27935
  }
27161
27936
  });
27162
27937
 
27163
27938
  // ../drizzle-orm/dist/sqlite-core/columns/common.js
27164
- var _a167, _b114, SQLiteColumnBuilder, _a168, _b115, SQLiteColumn;
27939
+ var _a169, _b114, SQLiteColumnBuilder, _a170, _b115, SQLiteColumn;
27165
27940
  var init_common3 = __esm({
27166
27941
  "../drizzle-orm/dist/sqlite-core/columns/common.js"() {
27167
27942
  "use strict";
@@ -27170,7 +27945,7 @@ var init_common3 = __esm({
27170
27945
  init_entity();
27171
27946
  init_foreign_keys2();
27172
27947
  init_unique_constraint2();
27173
- SQLiteColumnBuilder = class extends (_b114 = ColumnBuilder, _a167 = entityKind, _b114) {
27948
+ SQLiteColumnBuilder = class extends (_b114 = ColumnBuilder, _a169 = entityKind, _b114) {
27174
27949
  constructor() {
27175
27950
  super(...arguments);
27176
27951
  __publicField(this, "foreignKeyConfigs", []);
@@ -27211,8 +27986,8 @@ var init_common3 = __esm({
27211
27986
  });
27212
27987
  }
27213
27988
  };
27214
- __publicField(SQLiteColumnBuilder, _a167, "SQLiteColumnBuilder");
27215
- SQLiteColumn = class extends (_b115 = Column2, _a168 = entityKind, _b115) {
27989
+ __publicField(SQLiteColumnBuilder, _a169, "SQLiteColumnBuilder");
27990
+ SQLiteColumn = class extends (_b115 = Column2, _a170 = entityKind, _b115) {
27216
27991
  constructor(table4, config) {
27217
27992
  if (!config.uniqueName) {
27218
27993
  config.uniqueName = uniqueKeyName2(table4, [config.name]);
@@ -27221,7 +27996,7 @@ var init_common3 = __esm({
27221
27996
  this.table = table4;
27222
27997
  }
27223
27998
  };
27224
- __publicField(SQLiteColumn, _a168, "SQLiteColumn");
27999
+ __publicField(SQLiteColumn, _a170, "SQLiteColumn");
27225
28000
  }
27226
28001
  });
27227
28002
 
@@ -27236,14 +28011,14 @@ function blob(a, b) {
27236
28011
  }
27237
28012
  return new SQLiteBlobBufferBuilder(name2);
27238
28013
  }
27239
- var _a169, _b116, SQLiteBigIntBuilder, _a170, _b117, SQLiteBigInt, _a171, _b118, SQLiteBlobJsonBuilder, _a172, _b119, SQLiteBlobJson, _a173, _b120, SQLiteBlobBufferBuilder, _a174, _b121, SQLiteBlobBuffer;
28014
+ var _a171, _b116, SQLiteBigIntBuilder, _a172, _b117, SQLiteBigInt, _a173, _b118, SQLiteBlobJsonBuilder, _a174, _b119, SQLiteBlobJson, _a175, _b120, SQLiteBlobBufferBuilder, _a176, _b121, SQLiteBlobBuffer;
27240
28015
  var init_blob = __esm({
27241
28016
  "../drizzle-orm/dist/sqlite-core/columns/blob.js"() {
27242
28017
  "use strict";
27243
28018
  init_entity();
27244
28019
  init_utils2();
27245
28020
  init_common3();
27246
- SQLiteBigIntBuilder = class extends (_b116 = SQLiteColumnBuilder, _a169 = entityKind, _b116) {
28021
+ SQLiteBigIntBuilder = class extends (_b116 = SQLiteColumnBuilder, _a171 = entityKind, _b116) {
27247
28022
  constructor(name2) {
27248
28023
  super(name2, "bigint", "SQLiteBigInt");
27249
28024
  }
@@ -27252,8 +28027,8 @@ var init_blob = __esm({
27252
28027
  return new SQLiteBigInt(table4, this.config);
27253
28028
  }
27254
28029
  };
27255
- __publicField(SQLiteBigIntBuilder, _a169, "SQLiteBigIntBuilder");
27256
- SQLiteBigInt = class extends (_b117 = SQLiteColumn, _a170 = entityKind, _b117) {
28030
+ __publicField(SQLiteBigIntBuilder, _a171, "SQLiteBigIntBuilder");
28031
+ SQLiteBigInt = class extends (_b117 = SQLiteColumn, _a172 = entityKind, _b117) {
27257
28032
  getSQLType() {
27258
28033
  return "blob";
27259
28034
  }
@@ -27264,8 +28039,8 @@ var init_blob = __esm({
27264
28039
  return Buffer.from(value.toString());
27265
28040
  }
27266
28041
  };
27267
- __publicField(SQLiteBigInt, _a170, "SQLiteBigInt");
27268
- SQLiteBlobJsonBuilder = class extends (_b118 = SQLiteColumnBuilder, _a171 = entityKind, _b118) {
28042
+ __publicField(SQLiteBigInt, _a172, "SQLiteBigInt");
28043
+ SQLiteBlobJsonBuilder = class extends (_b118 = SQLiteColumnBuilder, _a173 = entityKind, _b118) {
27269
28044
  constructor(name2) {
27270
28045
  super(name2, "json", "SQLiteBlobJson");
27271
28046
  }
@@ -27277,8 +28052,8 @@ var init_blob = __esm({
27277
28052
  );
27278
28053
  }
27279
28054
  };
27280
- __publicField(SQLiteBlobJsonBuilder, _a171, "SQLiteBlobJsonBuilder");
27281
- SQLiteBlobJson = class extends (_b119 = SQLiteColumn, _a172 = entityKind, _b119) {
28055
+ __publicField(SQLiteBlobJsonBuilder, _a173, "SQLiteBlobJsonBuilder");
28056
+ SQLiteBlobJson = class extends (_b119 = SQLiteColumn, _a174 = entityKind, _b119) {
27282
28057
  getSQLType() {
27283
28058
  return "blob";
27284
28059
  }
@@ -27289,8 +28064,8 @@ var init_blob = __esm({
27289
28064
  return Buffer.from(JSON.stringify(value));
27290
28065
  }
27291
28066
  };
27292
- __publicField(SQLiteBlobJson, _a172, "SQLiteBlobJson");
27293
- SQLiteBlobBufferBuilder = class extends (_b120 = SQLiteColumnBuilder, _a173 = entityKind, _b120) {
28067
+ __publicField(SQLiteBlobJson, _a174, "SQLiteBlobJson");
28068
+ SQLiteBlobBufferBuilder = class extends (_b120 = SQLiteColumnBuilder, _a175 = entityKind, _b120) {
27294
28069
  constructor(name2) {
27295
28070
  super(name2, "buffer", "SQLiteBlobBuffer");
27296
28071
  }
@@ -27299,13 +28074,13 @@ var init_blob = __esm({
27299
28074
  return new SQLiteBlobBuffer(table4, this.config);
27300
28075
  }
27301
28076
  };
27302
- __publicField(SQLiteBlobBufferBuilder, _a173, "SQLiteBlobBufferBuilder");
27303
- SQLiteBlobBuffer = class extends (_b121 = SQLiteColumn, _a174 = entityKind, _b121) {
28077
+ __publicField(SQLiteBlobBufferBuilder, _a175, "SQLiteBlobBufferBuilder");
28078
+ SQLiteBlobBuffer = class extends (_b121 = SQLiteColumn, _a176 = entityKind, _b121) {
27304
28079
  getSQLType() {
27305
28080
  return "blob";
27306
28081
  }
27307
28082
  };
27308
- __publicField(SQLiteBlobBuffer, _a174, "SQLiteBlobBuffer");
28083
+ __publicField(SQLiteBlobBuffer, _a176, "SQLiteBlobBuffer");
27309
28084
  }
27310
28085
  });
27311
28086
 
@@ -27320,14 +28095,14 @@ function customType2(customTypeParams) {
27320
28095
  );
27321
28096
  };
27322
28097
  }
27323
- var _a175, _b122, SQLiteCustomColumnBuilder, _a176, _b123, SQLiteCustomColumn;
28098
+ var _a177, _b122, SQLiteCustomColumnBuilder, _a178, _b123, SQLiteCustomColumn;
27324
28099
  var init_custom2 = __esm({
27325
28100
  "../drizzle-orm/dist/sqlite-core/columns/custom.js"() {
27326
28101
  "use strict";
27327
28102
  init_entity();
27328
28103
  init_utils2();
27329
28104
  init_common3();
27330
- SQLiteCustomColumnBuilder = class extends (_b122 = SQLiteColumnBuilder, _a175 = entityKind, _b122) {
28105
+ SQLiteCustomColumnBuilder = class extends (_b122 = SQLiteColumnBuilder, _a177 = entityKind, _b122) {
27331
28106
  constructor(name2, fieldConfig, customTypeParams) {
27332
28107
  super(name2, "custom", "SQLiteCustomColumn");
27333
28108
  this.config.fieldConfig = fieldConfig;
@@ -27341,8 +28116,8 @@ var init_custom2 = __esm({
27341
28116
  );
27342
28117
  }
27343
28118
  };
27344
- __publicField(SQLiteCustomColumnBuilder, _a175, "SQLiteCustomColumnBuilder");
27345
- SQLiteCustomColumn = class extends (_b123 = SQLiteColumn, _a176 = entityKind, _b123) {
28119
+ __publicField(SQLiteCustomColumnBuilder, _a177, "SQLiteCustomColumnBuilder");
28120
+ SQLiteCustomColumn = class extends (_b123 = SQLiteColumn, _a178 = entityKind, _b123) {
27346
28121
  constructor(table4, config) {
27347
28122
  super(table4, config);
27348
28123
  __publicField(this, "sqlName");
@@ -27362,7 +28137,7 @@ var init_custom2 = __esm({
27362
28137
  return typeof this.mapTo === "function" ? this.mapTo(value) : value;
27363
28138
  }
27364
28139
  };
27365
- __publicField(SQLiteCustomColumn, _a176, "SQLiteCustomColumn");
28140
+ __publicField(SQLiteCustomColumn, _a178, "SQLiteCustomColumn");
27366
28141
  }
27367
28142
  });
27368
28143
 
@@ -27377,7 +28152,7 @@ function integer2(a, b) {
27377
28152
  }
27378
28153
  return new SQLiteIntegerBuilder(name2);
27379
28154
  }
27380
- 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;
28155
+ 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;
27381
28156
  var init_integer2 = __esm({
27382
28157
  "../drizzle-orm/dist/sqlite-core/columns/integer.js"() {
27383
28158
  "use strict";
@@ -27385,7 +28160,7 @@ var init_integer2 = __esm({
27385
28160
  init_sql();
27386
28161
  init_utils2();
27387
28162
  init_common3();
27388
- SQLiteBaseIntegerBuilder = class extends (_b124 = SQLiteColumnBuilder, _a177 = entityKind, _b124) {
28163
+ SQLiteBaseIntegerBuilder = class extends (_b124 = SQLiteColumnBuilder, _a179 = entityKind, _b124) {
27389
28164
  constructor(name2, dataType, columnType) {
27390
28165
  super(name2, dataType, columnType);
27391
28166
  this.config.autoIncrement = false;
@@ -27398,8 +28173,8 @@ var init_integer2 = __esm({
27398
28173
  return super.primaryKey();
27399
28174
  }
27400
28175
  };
27401
- __publicField(SQLiteBaseIntegerBuilder, _a177, "SQLiteBaseIntegerBuilder");
27402
- SQLiteBaseInteger = class extends (_b125 = SQLiteColumn, _a178 = entityKind, _b125) {
28176
+ __publicField(SQLiteBaseIntegerBuilder, _a179, "SQLiteBaseIntegerBuilder");
28177
+ SQLiteBaseInteger = class extends (_b125 = SQLiteColumn, _a180 = entityKind, _b125) {
27403
28178
  constructor() {
27404
28179
  super(...arguments);
27405
28180
  __publicField(this, "autoIncrement", this.config.autoIncrement);
@@ -27408,8 +28183,8 @@ var init_integer2 = __esm({
27408
28183
  return "integer";
27409
28184
  }
27410
28185
  };
27411
- __publicField(SQLiteBaseInteger, _a178, "SQLiteBaseInteger");
27412
- SQLiteIntegerBuilder = class extends (_b126 = SQLiteBaseIntegerBuilder, _a179 = entityKind, _b126) {
28186
+ __publicField(SQLiteBaseInteger, _a180, "SQLiteBaseInteger");
28187
+ SQLiteIntegerBuilder = class extends (_b126 = SQLiteBaseIntegerBuilder, _a181 = entityKind, _b126) {
27413
28188
  constructor(name2) {
27414
28189
  super(name2, "number", "SQLiteInteger");
27415
28190
  }
@@ -27420,11 +28195,11 @@ var init_integer2 = __esm({
27420
28195
  );
27421
28196
  }
27422
28197
  };
27423
- __publicField(SQLiteIntegerBuilder, _a179, "SQLiteIntegerBuilder");
27424
- SQLiteInteger = class extends (_b127 = SQLiteBaseInteger, _a180 = entityKind, _b127) {
28198
+ __publicField(SQLiteIntegerBuilder, _a181, "SQLiteIntegerBuilder");
28199
+ SQLiteInteger = class extends (_b127 = SQLiteBaseInteger, _a182 = entityKind, _b127) {
27425
28200
  };
27426
- __publicField(SQLiteInteger, _a180, "SQLiteInteger");
27427
- SQLiteTimestampBuilder = class extends (_b128 = SQLiteBaseIntegerBuilder, _a181 = entityKind, _b128) {
28201
+ __publicField(SQLiteInteger, _a182, "SQLiteInteger");
28202
+ SQLiteTimestampBuilder = class extends (_b128 = SQLiteBaseIntegerBuilder, _a183 = entityKind, _b128) {
27428
28203
  constructor(name2, mode) {
27429
28204
  super(name2, "date", "SQLiteTimestamp");
27430
28205
  this.config.mode = mode;
@@ -27444,8 +28219,8 @@ var init_integer2 = __esm({
27444
28219
  );
27445
28220
  }
27446
28221
  };
27447
- __publicField(SQLiteTimestampBuilder, _a181, "SQLiteTimestampBuilder");
27448
- SQLiteTimestamp = class extends (_b129 = SQLiteBaseInteger, _a182 = entityKind, _b129) {
28222
+ __publicField(SQLiteTimestampBuilder, _a183, "SQLiteTimestampBuilder");
28223
+ SQLiteTimestamp = class extends (_b129 = SQLiteBaseInteger, _a184 = entityKind, _b129) {
27449
28224
  constructor() {
27450
28225
  super(...arguments);
27451
28226
  __publicField(this, "mode", this.config.mode);
@@ -27464,8 +28239,8 @@ var init_integer2 = __esm({
27464
28239
  return unix;
27465
28240
  }
27466
28241
  };
27467
- __publicField(SQLiteTimestamp, _a182, "SQLiteTimestamp");
27468
- SQLiteBooleanBuilder = class extends (_b130 = SQLiteBaseIntegerBuilder, _a183 = entityKind, _b130) {
28242
+ __publicField(SQLiteTimestamp, _a184, "SQLiteTimestamp");
28243
+ SQLiteBooleanBuilder = class extends (_b130 = SQLiteBaseIntegerBuilder, _a185 = entityKind, _b130) {
27469
28244
  constructor(name2, mode) {
27470
28245
  super(name2, "boolean", "SQLiteBoolean");
27471
28246
  this.config.mode = mode;
@@ -27477,8 +28252,8 @@ var init_integer2 = __esm({
27477
28252
  );
27478
28253
  }
27479
28254
  };
27480
- __publicField(SQLiteBooleanBuilder, _a183, "SQLiteBooleanBuilder");
27481
- SQLiteBoolean = class extends (_b131 = SQLiteBaseInteger, _a184 = entityKind, _b131) {
28255
+ __publicField(SQLiteBooleanBuilder, _a185, "SQLiteBooleanBuilder");
28256
+ SQLiteBoolean = class extends (_b131 = SQLiteBaseInteger, _a186 = entityKind, _b131) {
27482
28257
  constructor() {
27483
28258
  super(...arguments);
27484
28259
  __publicField(this, "mode", this.config.mode);
@@ -27490,7 +28265,7 @@ var init_integer2 = __esm({
27490
28265
  return value ? 1 : 0;
27491
28266
  }
27492
28267
  };
27493
- __publicField(SQLiteBoolean, _a184, "SQLiteBoolean");
28268
+ __publicField(SQLiteBoolean, _a186, "SQLiteBoolean");
27494
28269
  }
27495
28270
  });
27496
28271
 
@@ -27498,13 +28273,13 @@ var init_integer2 = __esm({
27498
28273
  function numeric2(name2) {
27499
28274
  return new SQLiteNumericBuilder(name2 ?? "");
27500
28275
  }
27501
- var _a185, _b132, SQLiteNumericBuilder, _a186, _b133, SQLiteNumeric;
28276
+ var _a187, _b132, SQLiteNumericBuilder, _a188, _b133, SQLiteNumeric;
27502
28277
  var init_numeric2 = __esm({
27503
28278
  "../drizzle-orm/dist/sqlite-core/columns/numeric.js"() {
27504
28279
  "use strict";
27505
28280
  init_entity();
27506
28281
  init_common3();
27507
- SQLiteNumericBuilder = class extends (_b132 = SQLiteColumnBuilder, _a185 = entityKind, _b132) {
28282
+ SQLiteNumericBuilder = class extends (_b132 = SQLiteColumnBuilder, _a187 = entityKind, _b132) {
27508
28283
  constructor(name2) {
27509
28284
  super(name2, "string", "SQLiteNumeric");
27510
28285
  }
@@ -27516,13 +28291,13 @@ var init_numeric2 = __esm({
27516
28291
  );
27517
28292
  }
27518
28293
  };
27519
- __publicField(SQLiteNumericBuilder, _a185, "SQLiteNumericBuilder");
27520
- SQLiteNumeric = class extends (_b133 = SQLiteColumn, _a186 = entityKind, _b133) {
28294
+ __publicField(SQLiteNumericBuilder, _a187, "SQLiteNumericBuilder");
28295
+ SQLiteNumeric = class extends (_b133 = SQLiteColumn, _a188 = entityKind, _b133) {
27521
28296
  getSQLType() {
27522
28297
  return "numeric";
27523
28298
  }
27524
28299
  };
27525
- __publicField(SQLiteNumeric, _a186, "SQLiteNumeric");
28300
+ __publicField(SQLiteNumeric, _a188, "SQLiteNumeric");
27526
28301
  }
27527
28302
  });
27528
28303
 
@@ -27530,13 +28305,13 @@ var init_numeric2 = __esm({
27530
28305
  function real2(name2) {
27531
28306
  return new SQLiteRealBuilder(name2 ?? "");
27532
28307
  }
27533
- var _a187, _b134, SQLiteRealBuilder, _a188, _b135, SQLiteReal;
28308
+ var _a189, _b134, SQLiteRealBuilder, _a190, _b135, SQLiteReal;
27534
28309
  var init_real2 = __esm({
27535
28310
  "../drizzle-orm/dist/sqlite-core/columns/real.js"() {
27536
28311
  "use strict";
27537
28312
  init_entity();
27538
28313
  init_common3();
27539
- SQLiteRealBuilder = class extends (_b134 = SQLiteColumnBuilder, _a187 = entityKind, _b134) {
28314
+ SQLiteRealBuilder = class extends (_b134 = SQLiteColumnBuilder, _a189 = entityKind, _b134) {
27540
28315
  constructor(name2) {
27541
28316
  super(name2, "number", "SQLiteReal");
27542
28317
  }
@@ -27545,13 +28320,13 @@ var init_real2 = __esm({
27545
28320
  return new SQLiteReal(table4, this.config);
27546
28321
  }
27547
28322
  };
27548
- __publicField(SQLiteRealBuilder, _a187, "SQLiteRealBuilder");
27549
- SQLiteReal = class extends (_b135 = SQLiteColumn, _a188 = entityKind, _b135) {
28323
+ __publicField(SQLiteRealBuilder, _a189, "SQLiteRealBuilder");
28324
+ SQLiteReal = class extends (_b135 = SQLiteColumn, _a190 = entityKind, _b135) {
27550
28325
  getSQLType() {
27551
28326
  return "real";
27552
28327
  }
27553
28328
  };
27554
- __publicField(SQLiteReal, _a188, "SQLiteReal");
28329
+ __publicField(SQLiteReal, _a190, "SQLiteReal");
27555
28330
  }
27556
28331
  });
27557
28332
 
@@ -27563,14 +28338,14 @@ function text2(a, b = {}) {
27563
28338
  }
27564
28339
  return new SQLiteTextBuilder(name2, config);
27565
28340
  }
27566
- var _a189, _b136, SQLiteTextBuilder, _a190, _b137, SQLiteText, _a191, _b138, SQLiteTextJsonBuilder, _a192, _b139, SQLiteTextJson;
28341
+ var _a191, _b136, SQLiteTextBuilder, _a192, _b137, SQLiteText, _a193, _b138, SQLiteTextJsonBuilder, _a194, _b139, SQLiteTextJson;
27567
28342
  var init_text2 = __esm({
27568
28343
  "../drizzle-orm/dist/sqlite-core/columns/text.js"() {
27569
28344
  "use strict";
27570
28345
  init_entity();
27571
28346
  init_utils2();
27572
28347
  init_common3();
27573
- SQLiteTextBuilder = class extends (_b136 = SQLiteColumnBuilder, _a189 = entityKind, _b136) {
28348
+ SQLiteTextBuilder = class extends (_b136 = SQLiteColumnBuilder, _a191 = entityKind, _b136) {
27574
28349
  constructor(name2, config) {
27575
28350
  super(name2, "string", "SQLiteText");
27576
28351
  this.config.enumValues = config.enum;
@@ -27581,8 +28356,8 @@ var init_text2 = __esm({
27581
28356
  return new SQLiteText(table4, this.config);
27582
28357
  }
27583
28358
  };
27584
- __publicField(SQLiteTextBuilder, _a189, "SQLiteTextBuilder");
27585
- SQLiteText = class extends (_b137 = SQLiteColumn, _a190 = entityKind, _b137) {
28359
+ __publicField(SQLiteTextBuilder, _a191, "SQLiteTextBuilder");
28360
+ SQLiteText = class extends (_b137 = SQLiteColumn, _a192 = entityKind, _b137) {
27586
28361
  constructor(table4, config) {
27587
28362
  super(table4, config);
27588
28363
  __publicField(this, "enumValues", this.config.enumValues);
@@ -27592,8 +28367,8 @@ var init_text2 = __esm({
27592
28367
  return `text${this.config.length ? `(${this.config.length})` : ""}`;
27593
28368
  }
27594
28369
  };
27595
- __publicField(SQLiteText, _a190, "SQLiteText");
27596
- SQLiteTextJsonBuilder = class extends (_b138 = SQLiteColumnBuilder, _a191 = entityKind, _b138) {
28370
+ __publicField(SQLiteText, _a192, "SQLiteText");
28371
+ SQLiteTextJsonBuilder = class extends (_b138 = SQLiteColumnBuilder, _a193 = entityKind, _b138) {
27597
28372
  constructor(name2) {
27598
28373
  super(name2, "json", "SQLiteTextJson");
27599
28374
  }
@@ -27605,8 +28380,8 @@ var init_text2 = __esm({
27605
28380
  );
27606
28381
  }
27607
28382
  };
27608
- __publicField(SQLiteTextJsonBuilder, _a191, "SQLiteTextJsonBuilder");
27609
- SQLiteTextJson = class extends (_b139 = SQLiteColumn, _a192 = entityKind, _b139) {
28383
+ __publicField(SQLiteTextJsonBuilder, _a193, "SQLiteTextJsonBuilder");
28384
+ SQLiteTextJson = class extends (_b139 = SQLiteColumn, _a194 = entityKind, _b139) {
27610
28385
  getSQLType() {
27611
28386
  return "text";
27612
28387
  }
@@ -27617,7 +28392,7 @@ var init_text2 = __esm({
27617
28392
  return JSON.stringify(value);
27618
28393
  }
27619
28394
  };
27620
- __publicField(SQLiteTextJson, _a192, "SQLiteTextJson");
28395
+ __publicField(SQLiteTextJson, _a194, "SQLiteTextJson");
27621
28396
  }
27622
28397
  });
27623
28398
 
@@ -27679,7 +28454,7 @@ function sqliteTableBase(name2, columns, extraConfig, schema4, baseName = name2)
27679
28454
  }
27680
28455
  return table4;
27681
28456
  }
27682
- var InlineForeignKeys2, _a193, _b140, _c6, _d3, _e2, SQLiteTable, sqliteTable;
28457
+ var InlineForeignKeys2, _a195, _b140, _c6, _d3, _e2, SQLiteTable, sqliteTable;
27683
28458
  var init_table3 = __esm({
27684
28459
  "../drizzle-orm/dist/sqlite-core/table.js"() {
27685
28460
  "use strict";
@@ -27687,7 +28462,7 @@ var init_table3 = __esm({
27687
28462
  init_table();
27688
28463
  init_all2();
27689
28464
  InlineForeignKeys2 = Symbol.for("drizzle:SQLiteInlineForeignKeys");
27690
- SQLiteTable = class extends (_e2 = Table, _d3 = entityKind, _c6 = Table.Symbol.Columns, _b140 = InlineForeignKeys2, _a193 = Table.Symbol.ExtraConfigBuilder, _e2) {
28465
+ SQLiteTable = class extends (_e2 = Table, _d3 = entityKind, _c6 = Table.Symbol.Columns, _b140 = InlineForeignKeys2, _a195 = Table.Symbol.ExtraConfigBuilder, _e2) {
27691
28466
  constructor() {
27692
28467
  super(...arguments);
27693
28468
  /** @internal */
@@ -27695,7 +28470,7 @@ var init_table3 = __esm({
27695
28470
  /** @internal */
27696
28471
  __publicField(this, _b140, []);
27697
28472
  /** @internal */
27698
- __publicField(this, _a193);
28473
+ __publicField(this, _a195);
27699
28474
  }
27700
28475
  };
27701
28476
  __publicField(SQLiteTable, _d3, "SQLiteTable");
@@ -27710,7 +28485,7 @@ var init_table3 = __esm({
27710
28485
  });
27711
28486
 
27712
28487
  // ../drizzle-orm/dist/sqlite-core/query-builders/delete.js
27713
- var _a194, _b141, SQLiteDeleteBase;
28488
+ var _a196, _b141, SQLiteDeleteBase;
27714
28489
  var init_delete2 = __esm({
27715
28490
  "../drizzle-orm/dist/sqlite-core/query-builders/delete.js"() {
27716
28491
  "use strict";
@@ -27718,7 +28493,7 @@ var init_delete2 = __esm({
27718
28493
  init_query_promise();
27719
28494
  init_table3();
27720
28495
  init_utils2();
27721
- SQLiteDeleteBase = class extends (_b141 = QueryPromise, _a194 = entityKind, _b141) {
28496
+ SQLiteDeleteBase = class extends (_b141 = QueryPromise, _a196 = entityKind, _b141) {
27722
28497
  constructor(table4, session, dialect4, withList) {
27723
28498
  super();
27724
28499
  /** @internal */
@@ -27804,12 +28579,12 @@ var init_delete2 = __esm({
27804
28579
  return this;
27805
28580
  }
27806
28581
  };
27807
- __publicField(SQLiteDeleteBase, _a194, "SQLiteDelete");
28582
+ __publicField(SQLiteDeleteBase, _a196, "SQLiteDelete");
27808
28583
  }
27809
28584
  });
27810
28585
 
27811
28586
  // ../drizzle-orm/dist/sqlite-core/query-builders/insert.js
27812
- var _a195, SQLiteInsertBuilder, _a196, _b142, SQLiteInsertBase;
28587
+ var _a197, SQLiteInsertBuilder, _a198, _b142, SQLiteInsertBase;
27813
28588
  var init_insert2 = __esm({
27814
28589
  "../drizzle-orm/dist/sqlite-core/query-builders/insert.js"() {
27815
28590
  "use strict";
@@ -27819,7 +28594,7 @@ var init_insert2 = __esm({
27819
28594
  init_table3();
27820
28595
  init_table();
27821
28596
  init_utils2();
27822
- _a195 = entityKind;
28597
+ _a197 = entityKind;
27823
28598
  SQLiteInsertBuilder = class {
27824
28599
  constructor(table4, session, dialect4, withList) {
27825
28600
  this.table = table4;
@@ -27844,8 +28619,8 @@ var init_insert2 = __esm({
27844
28619
  return new SQLiteInsertBase(this.table, mappedValues, this.session, this.dialect, this.withList);
27845
28620
  }
27846
28621
  };
27847
- __publicField(SQLiteInsertBuilder, _a195, "SQLiteInsertBuilder");
27848
- SQLiteInsertBase = class extends (_b142 = QueryPromise, _a196 = entityKind, _b142) {
28622
+ __publicField(SQLiteInsertBuilder, _a197, "SQLiteInsertBuilder");
28623
+ SQLiteInsertBase = class extends (_b142 = QueryPromise, _a198 = entityKind, _b142) {
27849
28624
  constructor(table4, values, session, dialect4, withList) {
27850
28625
  super();
27851
28626
  /** @internal */
@@ -27972,25 +28747,25 @@ var init_insert2 = __esm({
27972
28747
  return this;
27973
28748
  }
27974
28749
  };
27975
- __publicField(SQLiteInsertBase, _a196, "SQLiteInsert");
28750
+ __publicField(SQLiteInsertBase, _a198, "SQLiteInsert");
27976
28751
  }
27977
28752
  });
27978
28753
 
27979
28754
  // ../drizzle-orm/dist/sqlite-core/view-base.js
27980
- var _a197, _b143, SQLiteViewBase;
28755
+ var _a199, _b143, SQLiteViewBase;
27981
28756
  var init_view_base2 = __esm({
27982
28757
  "../drizzle-orm/dist/sqlite-core/view-base.js"() {
27983
28758
  "use strict";
27984
28759
  init_entity();
27985
28760
  init_sql();
27986
- SQLiteViewBase = class extends (_b143 = View, _a197 = entityKind, _b143) {
28761
+ SQLiteViewBase = class extends (_b143 = View, _a199 = entityKind, _b143) {
27987
28762
  };
27988
- __publicField(SQLiteViewBase, _a197, "SQLiteViewBase");
28763
+ __publicField(SQLiteViewBase, _a199, "SQLiteViewBase");
27989
28764
  }
27990
28765
  });
27991
28766
 
27992
28767
  // ../drizzle-orm/dist/sqlite-core/dialect.js
27993
- var _a198, SQLiteDialect, _a199, _b144, SQLiteSyncDialect, _a200, _b145, SQLiteAsyncDialect;
28768
+ var _a200, SQLiteDialect, _a201, _b144, SQLiteSyncDialect, _a202, _b145, SQLiteAsyncDialect;
27994
28769
  var init_dialect2 = __esm({
27995
28770
  "../drizzle-orm/dist/sqlite-core/dialect.js"() {
27996
28771
  "use strict";
@@ -28009,7 +28784,7 @@ var init_dialect2 = __esm({
28009
28784
  init_utils2();
28010
28785
  init_view_common();
28011
28786
  init_view_base2();
28012
- _a198 = entityKind;
28787
+ _a200 = entityKind;
28013
28788
  SQLiteDialect = class {
28014
28789
  constructor(config) {
28015
28790
  /** @internal */
@@ -28521,8 +29296,8 @@ var init_dialect2 = __esm({
28521
29296
  };
28522
29297
  }
28523
29298
  };
28524
- __publicField(SQLiteDialect, _a198, "SQLiteDialect");
28525
- SQLiteSyncDialect = class extends (_b144 = SQLiteDialect, _a199 = entityKind, _b144) {
29299
+ __publicField(SQLiteDialect, _a200, "SQLiteDialect");
29300
+ SQLiteSyncDialect = class extends (_b144 = SQLiteDialect, _a201 = entityKind, _b144) {
28526
29301
  migrate(migrations, session, config) {
28527
29302
  const migrationsTable = config === void 0 ? "__drizzle_migrations" : typeof config === "string" ? "__drizzle_migrations" : config.migrationsTable ?? "__drizzle_migrations";
28528
29303
  const migrationTableCreate = sql`
@@ -28556,8 +29331,8 @@ var init_dialect2 = __esm({
28556
29331
  }
28557
29332
  }
28558
29333
  };
28559
- __publicField(SQLiteSyncDialect, _a199, "SQLiteSyncDialect");
28560
- SQLiteAsyncDialect = class extends (_b145 = SQLiteDialect, _a200 = entityKind, _b145) {
29334
+ __publicField(SQLiteSyncDialect, _a201, "SQLiteSyncDialect");
29335
+ SQLiteAsyncDialect = class extends (_b145 = SQLiteDialect, _a202 = entityKind, _b145) {
28561
29336
  async migrate(migrations, session, config) {
28562
29337
  const migrationsTable = config === void 0 ? "__drizzle_migrations" : typeof config === "string" ? "__drizzle_migrations" : config.migrationsTable ?? "__drizzle_migrations";
28563
29338
  const migrationTableCreate = sql`
@@ -28586,7 +29361,7 @@ var init_dialect2 = __esm({
28586
29361
  });
28587
29362
  }
28588
29363
  };
28589
- __publicField(SQLiteAsyncDialect, _a200, "SQLiteAsyncDialect");
29364
+ __publicField(SQLiteAsyncDialect, _a202, "SQLiteAsyncDialect");
28590
29365
  }
28591
29366
  });
28592
29367
 
@@ -28608,7 +29383,7 @@ function createSetOperator2(type, isAll) {
28608
29383
  return leftSelect.addSetOperators(setOperators);
28609
29384
  };
28610
29385
  }
28611
- var _a201, SQLiteSelectBuilder, _a202, _b146, SQLiteSelectQueryBuilderBase, _a203, _b147, SQLiteSelectBase, getSQLiteSetOperators, union2, unionAll2, intersect2, except2;
29386
+ var _a203, SQLiteSelectBuilder, _a204, _b146, SQLiteSelectQueryBuilderBase, _a205, _b147, SQLiteSelectBase, getSQLiteSetOperators, union2, unionAll2, intersect2, except2;
28612
29387
  var init_select3 = __esm({
28613
29388
  "../drizzle-orm/dist/sqlite-core/query-builders/select.js"() {
28614
29389
  "use strict";
@@ -28622,7 +29397,7 @@ var init_select3 = __esm({
28622
29397
  init_utils2();
28623
29398
  init_view_common();
28624
29399
  init_view_base2();
28625
- _a201 = entityKind;
29400
+ _a203 = entityKind;
28626
29401
  SQLiteSelectBuilder = class {
28627
29402
  constructor(config) {
28628
29403
  __publicField(this, "fields");
@@ -28663,8 +29438,8 @@ var init_select3 = __esm({
28663
29438
  });
28664
29439
  }
28665
29440
  };
28666
- __publicField(SQLiteSelectBuilder, _a201, "SQLiteSelectBuilder");
28667
- SQLiteSelectQueryBuilderBase = class extends (_b146 = TypedQueryBuilder, _a202 = entityKind, _b146) {
29441
+ __publicField(SQLiteSelectBuilder, _a203, "SQLiteSelectBuilder");
29442
+ SQLiteSelectQueryBuilderBase = class extends (_b146 = TypedQueryBuilder, _a204 = entityKind, _b146) {
28668
29443
  constructor({ table: table4, fields, isPartialSelect, session, dialect: dialect4, withList, distinct }) {
28669
29444
  super();
28670
29445
  __publicField(this, "_");
@@ -29169,8 +29944,8 @@ var init_select3 = __esm({
29169
29944
  return this;
29170
29945
  }
29171
29946
  };
29172
- __publicField(SQLiteSelectQueryBuilderBase, _a202, "SQLiteSelectQueryBuilder");
29173
- SQLiteSelectBase = class extends (_b147 = SQLiteSelectQueryBuilderBase, _a203 = entityKind, _b147) {
29947
+ __publicField(SQLiteSelectQueryBuilderBase, _a204, "SQLiteSelectQueryBuilder");
29948
+ SQLiteSelectBase = class extends (_b147 = SQLiteSelectQueryBuilderBase, _a205 = entityKind, _b147) {
29174
29949
  constructor() {
29175
29950
  super(...arguments);
29176
29951
  __publicField(this, "run", (placeholderValues) => {
@@ -29208,7 +29983,7 @@ var init_select3 = __esm({
29208
29983
  return this.all();
29209
29984
  }
29210
29985
  };
29211
- __publicField(SQLiteSelectBase, _a203, "SQLiteSelect");
29986
+ __publicField(SQLiteSelectBase, _a205, "SQLiteSelect");
29212
29987
  applyMixins(SQLiteSelectBase, [QueryPromise]);
29213
29988
  getSQLiteSetOperators = () => ({
29214
29989
  union: union2,
@@ -29224,7 +29999,7 @@ var init_select3 = __esm({
29224
29999
  });
29225
30000
 
29226
30001
  // ../drizzle-orm/dist/sqlite-core/query-builders/query-builder.js
29227
- var _a204, QueryBuilder2;
30002
+ var _a206, QueryBuilder2;
29228
30003
  var init_query_builder3 = __esm({
29229
30004
  "../drizzle-orm/dist/sqlite-core/query-builders/query-builder.js"() {
29230
30005
  "use strict";
@@ -29233,7 +30008,7 @@ var init_query_builder3 = __esm({
29233
30008
  init_dialect2();
29234
30009
  init_subquery();
29235
30010
  init_select3();
29236
- _a204 = entityKind;
30011
+ _a206 = entityKind;
29237
30012
  QueryBuilder2 = class {
29238
30013
  constructor(dialect4) {
29239
30014
  __publicField(this, "dialect");
@@ -29295,7 +30070,7 @@ var init_query_builder3 = __esm({
29295
30070
  return this.dialect;
29296
30071
  }
29297
30072
  };
29298
- __publicField(QueryBuilder2, _a204, "SQLiteQueryBuilder");
30073
+ __publicField(QueryBuilder2, _a206, "SQLiteQueryBuilder");
29299
30074
  }
29300
30075
  });
29301
30076
 
@@ -29307,7 +30082,7 @@ var init_select_types2 = __esm({
29307
30082
  });
29308
30083
 
29309
30084
  // ../drizzle-orm/dist/sqlite-core/query-builders/update.js
29310
- var _a205, SQLiteUpdateBuilder, _a206, _b148, SQLiteUpdateBase;
30085
+ var _a207, SQLiteUpdateBuilder, _a208, _b148, SQLiteUpdateBase;
29311
30086
  var init_update2 = __esm({
29312
30087
  "../drizzle-orm/dist/sqlite-core/query-builders/update.js"() {
29313
30088
  "use strict";
@@ -29315,7 +30090,7 @@ var init_update2 = __esm({
29315
30090
  init_query_promise();
29316
30091
  init_table3();
29317
30092
  init_utils2();
29318
- _a205 = entityKind;
30093
+ _a207 = entityKind;
29319
30094
  SQLiteUpdateBuilder = class {
29320
30095
  constructor(table4, session, dialect4, withList) {
29321
30096
  this.table = table4;
@@ -29333,8 +30108,8 @@ var init_update2 = __esm({
29333
30108
  );
29334
30109
  }
29335
30110
  };
29336
- __publicField(SQLiteUpdateBuilder, _a205, "SQLiteUpdateBuilder");
29337
- SQLiteUpdateBase = class extends (_b148 = QueryPromise, _a206 = entityKind, _b148) {
30111
+ __publicField(SQLiteUpdateBuilder, _a207, "SQLiteUpdateBuilder");
30112
+ SQLiteUpdateBase = class extends (_b148 = QueryPromise, _a208 = entityKind, _b148) {
29338
30113
  constructor(table4, set, session, dialect4, withList) {
29339
30114
  super();
29340
30115
  /** @internal */
@@ -29423,7 +30198,7 @@ var init_update2 = __esm({
29423
30198
  return this;
29424
30199
  }
29425
30200
  };
29426
- __publicField(SQLiteUpdateBase, _a206, "SQLiteUpdate");
30201
+ __publicField(SQLiteUpdateBase, _a208, "SQLiteUpdate");
29427
30202
  }
29428
30203
  });
29429
30204
 
@@ -29441,17 +30216,17 @@ var init_query_builders2 = __esm({
29441
30216
  });
29442
30217
 
29443
30218
  // ../drizzle-orm/dist/sqlite-core/query-builders/count.js
29444
- var _a207, _b149, _c7, _SQLiteCountBuilder, SQLiteCountBuilder;
30219
+ var _a209, _b149, _c7, _SQLiteCountBuilder, SQLiteCountBuilder;
29445
30220
  var init_count2 = __esm({
29446
30221
  "../drizzle-orm/dist/sqlite-core/query-builders/count.js"() {
29447
30222
  "use strict";
29448
30223
  init_entity();
29449
30224
  init_sql();
29450
- _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b149 = entityKind, _a207 = Symbol.toStringTag, _c7) {
30225
+ _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b149 = entityKind, _a209 = Symbol.toStringTag, _c7) {
29451
30226
  constructor(params) {
29452
30227
  super(_SQLiteCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
29453
30228
  __publicField(this, "sql");
29454
- __publicField(this, _a207, "SQLiteCountBuilderAsync");
30229
+ __publicField(this, _a209, "SQLiteCountBuilderAsync");
29455
30230
  __publicField(this, "session");
29456
30231
  this.params = params;
29457
30232
  this.session = params.session;
@@ -29494,14 +30269,14 @@ var init_count2 = __esm({
29494
30269
  });
29495
30270
 
29496
30271
  // ../drizzle-orm/dist/sqlite-core/query-builders/query.js
29497
- var _a208, RelationalQueryBuilder2, _a209, _b150, SQLiteRelationalQuery, _a210, _b151, SQLiteSyncRelationalQuery;
30272
+ var _a210, RelationalQueryBuilder2, _a211, _b150, SQLiteRelationalQuery, _a212, _b151, SQLiteSyncRelationalQuery;
29498
30273
  var init_query2 = __esm({
29499
30274
  "../drizzle-orm/dist/sqlite-core/query-builders/query.js"() {
29500
30275
  "use strict";
29501
30276
  init_entity();
29502
30277
  init_query_promise();
29503
30278
  init_relations();
29504
- _a208 = entityKind;
30279
+ _a210 = entityKind;
29505
30280
  RelationalQueryBuilder2 = class {
29506
30281
  constructor(mode, fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session) {
29507
30282
  this.mode = mode;
@@ -29560,8 +30335,8 @@ var init_query2 = __esm({
29560
30335
  );
29561
30336
  }
29562
30337
  };
29563
- __publicField(RelationalQueryBuilder2, _a208, "SQLiteAsyncRelationalQueryBuilder");
29564
- SQLiteRelationalQuery = class extends (_b150 = QueryPromise, _a209 = entityKind, _b150) {
30338
+ __publicField(RelationalQueryBuilder2, _a210, "SQLiteAsyncRelationalQueryBuilder");
30339
+ SQLiteRelationalQuery = class extends (_b150 = QueryPromise, _a211 = entityKind, _b150) {
29565
30340
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, config, mode) {
29566
30341
  super();
29567
30342
  /** @internal */
@@ -29637,24 +30412,24 @@ var init_query2 = __esm({
29637
30412
  return this.executeRaw();
29638
30413
  }
29639
30414
  };
29640
- __publicField(SQLiteRelationalQuery, _a209, "SQLiteAsyncRelationalQuery");
29641
- SQLiteSyncRelationalQuery = class extends (_b151 = SQLiteRelationalQuery, _a210 = entityKind, _b151) {
30415
+ __publicField(SQLiteRelationalQuery, _a211, "SQLiteAsyncRelationalQuery");
30416
+ SQLiteSyncRelationalQuery = class extends (_b151 = SQLiteRelationalQuery, _a212 = entityKind, _b151) {
29642
30417
  sync() {
29643
30418
  return this.executeRaw();
29644
30419
  }
29645
30420
  };
29646
- __publicField(SQLiteSyncRelationalQuery, _a210, "SQLiteSyncRelationalQuery");
30421
+ __publicField(SQLiteSyncRelationalQuery, _a212, "SQLiteSyncRelationalQuery");
29647
30422
  }
29648
30423
  });
29649
30424
 
29650
30425
  // ../drizzle-orm/dist/sqlite-core/query-builders/raw.js
29651
- var _a211, _b152, SQLiteRaw;
30426
+ var _a213, _b152, SQLiteRaw;
29652
30427
  var init_raw2 = __esm({
29653
30428
  "../drizzle-orm/dist/sqlite-core/query-builders/raw.js"() {
29654
30429
  "use strict";
29655
30430
  init_entity();
29656
30431
  init_query_promise();
29657
- SQLiteRaw = class extends (_b152 = QueryPromise, _a211 = entityKind, _b152) {
30432
+ SQLiteRaw = class extends (_b152 = QueryPromise, _a213 = entityKind, _b152) {
29658
30433
  constructor(execute, getSQL, action, dialect4, mapBatchResult) {
29659
30434
  super();
29660
30435
  /** @internal */
@@ -29679,12 +30454,12 @@ var init_raw2 = __esm({
29679
30454
  return false;
29680
30455
  }
29681
30456
  };
29682
- __publicField(SQLiteRaw, _a211, "SQLiteRaw");
30457
+ __publicField(SQLiteRaw, _a213, "SQLiteRaw");
29683
30458
  }
29684
30459
  });
29685
30460
 
29686
30461
  // ../drizzle-orm/dist/sqlite-core/db.js
29687
- var _a212, BaseSQLiteDatabase;
30462
+ var _a214, BaseSQLiteDatabase;
29688
30463
  var init_db2 = __esm({
29689
30464
  "../drizzle-orm/dist/sqlite-core/db.js"() {
29690
30465
  "use strict";
@@ -29696,7 +30471,7 @@ var init_db2 = __esm({
29696
30471
  init_count2();
29697
30472
  init_query2();
29698
30473
  init_raw2();
29699
- _a212 = entityKind;
30474
+ _a214 = entityKind;
29700
30475
  BaseSQLiteDatabase = class {
29701
30476
  constructor(resultKind, dialect4, session, schema4) {
29702
30477
  __publicField(this, "query");
@@ -29978,17 +30753,17 @@ var init_db2 = __esm({
29978
30753
  return this.session.transaction(transaction, config);
29979
30754
  }
29980
30755
  };
29981
- __publicField(BaseSQLiteDatabase, _a212, "BaseSQLiteDatabase");
30756
+ __publicField(BaseSQLiteDatabase, _a214, "BaseSQLiteDatabase");
29982
30757
  }
29983
30758
  });
29984
30759
 
29985
30760
  // ../drizzle-orm/dist/sqlite-core/indexes.js
29986
- var _a213, IndexBuilderOn2, _a214, IndexBuilder2, _a215, Index4;
30761
+ var _a215, IndexBuilderOn2, _a216, IndexBuilder2, _a217, Index4;
29987
30762
  var init_indexes2 = __esm({
29988
30763
  "../drizzle-orm/dist/sqlite-core/indexes.js"() {
29989
30764
  "use strict";
29990
30765
  init_entity();
29991
- _a213 = entityKind;
30766
+ _a215 = entityKind;
29992
30767
  IndexBuilderOn2 = class {
29993
30768
  constructor(name2, unique) {
29994
30769
  this.name = name2;
@@ -29998,8 +30773,8 @@ var init_indexes2 = __esm({
29998
30773
  return new IndexBuilder2(this.name, columns, this.unique);
29999
30774
  }
30000
30775
  };
30001
- __publicField(IndexBuilderOn2, _a213, "SQLiteIndexBuilderOn");
30002
- _a214 = entityKind;
30776
+ __publicField(IndexBuilderOn2, _a215, "SQLiteIndexBuilderOn");
30777
+ _a216 = entityKind;
30003
30778
  IndexBuilder2 = class {
30004
30779
  constructor(name2, columns, unique) {
30005
30780
  /** @internal */
@@ -30023,26 +30798,26 @@ var init_indexes2 = __esm({
30023
30798
  return new Index4(this.config, table4);
30024
30799
  }
30025
30800
  };
30026
- __publicField(IndexBuilder2, _a214, "SQLiteIndexBuilder");
30027
- _a215 = entityKind;
30801
+ __publicField(IndexBuilder2, _a216, "SQLiteIndexBuilder");
30802
+ _a217 = entityKind;
30028
30803
  Index4 = class {
30029
30804
  constructor(config, table4) {
30030
30805
  __publicField(this, "config");
30031
30806
  this.config = { ...config, table: table4 };
30032
30807
  }
30033
30808
  };
30034
- __publicField(Index4, _a215, "SQLiteIndex");
30809
+ __publicField(Index4, _a217, "SQLiteIndex");
30035
30810
  }
30036
30811
  });
30037
30812
 
30038
30813
  // ../drizzle-orm/dist/sqlite-core/primary-keys.js
30039
- var _a216, PrimaryKeyBuilder2, _a217, PrimaryKey2;
30814
+ var _a218, PrimaryKeyBuilder2, _a219, PrimaryKey2;
30040
30815
  var init_primary_keys2 = __esm({
30041
30816
  "../drizzle-orm/dist/sqlite-core/primary-keys.js"() {
30042
30817
  "use strict";
30043
30818
  init_entity();
30044
30819
  init_table3();
30045
- _a216 = entityKind;
30820
+ _a218 = entityKind;
30046
30821
  PrimaryKeyBuilder2 = class {
30047
30822
  constructor(columns, name2) {
30048
30823
  /** @internal */
@@ -30057,8 +30832,8 @@ var init_primary_keys2 = __esm({
30057
30832
  return new PrimaryKey2(table4, this.columns, this.name);
30058
30833
  }
30059
30834
  };
30060
- __publicField(PrimaryKeyBuilder2, _a216, "SQLitePrimaryKeyBuilder");
30061
- _a217 = entityKind;
30835
+ __publicField(PrimaryKeyBuilder2, _a218, "SQLitePrimaryKeyBuilder");
30836
+ _a219 = entityKind;
30062
30837
  PrimaryKey2 = class {
30063
30838
  constructor(table4, columns, name2) {
30064
30839
  __publicField(this, "columns");
@@ -30071,12 +30846,12 @@ var init_primary_keys2 = __esm({
30071
30846
  return this.name ?? `${this.table[SQLiteTable.Symbol.Name]}_${this.columns.map((column4) => column4.name).join("_")}_pk`;
30072
30847
  }
30073
30848
  };
30074
- __publicField(PrimaryKey2, _a217, "SQLitePrimaryKey");
30849
+ __publicField(PrimaryKey2, _a219, "SQLitePrimaryKey");
30075
30850
  }
30076
30851
  });
30077
30852
 
30078
30853
  // ../drizzle-orm/dist/sqlite-core/session.js
30079
- var _a218, _b153, ExecuteResultSync, _a219, SQLitePreparedQuery, _a220, SQLiteSession, _a221, _b154, SQLiteTransaction;
30854
+ var _a220, _b153, ExecuteResultSync, _a221, SQLitePreparedQuery, _a222, SQLiteSession, _a223, _b154, SQLiteTransaction;
30080
30855
  var init_session2 = __esm({
30081
30856
  "../drizzle-orm/dist/sqlite-core/session.js"() {
30082
30857
  "use strict";
@@ -30084,7 +30859,7 @@ var init_session2 = __esm({
30084
30859
  init_errors();
30085
30860
  init_query_promise();
30086
30861
  init_db2();
30087
- ExecuteResultSync = class extends (_b153 = QueryPromise, _a218 = entityKind, _b153) {
30862
+ ExecuteResultSync = class extends (_b153 = QueryPromise, _a220 = entityKind, _b153) {
30088
30863
  constructor(resultCb) {
30089
30864
  super();
30090
30865
  this.resultCb = resultCb;
@@ -30096,8 +30871,8 @@ var init_session2 = __esm({
30096
30871
  return this.resultCb();
30097
30872
  }
30098
30873
  };
30099
- __publicField(ExecuteResultSync, _a218, "ExecuteResultSync");
30100
- _a219 = entityKind;
30874
+ __publicField(ExecuteResultSync, _a220, "ExecuteResultSync");
30875
+ _a221 = entityKind;
30101
30876
  SQLitePreparedQuery = class {
30102
30877
  constructor(mode, executeMethod, query) {
30103
30878
  /** @internal */
@@ -30138,8 +30913,8 @@ var init_session2 = __esm({
30138
30913
  }
30139
30914
  }
30140
30915
  };
30141
- __publicField(SQLitePreparedQuery, _a219, "PreparedQuery");
30142
- _a220 = entityKind;
30916
+ __publicField(SQLitePreparedQuery, _a221, "PreparedQuery");
30917
+ _a222 = entityKind;
30143
30918
  SQLiteSession = class {
30144
30919
  constructor(dialect4) {
30145
30920
  this.dialect = dialect4;
@@ -30185,8 +30960,8 @@ var init_session2 = __esm({
30185
30960
  throw new Error("Not implemented");
30186
30961
  }
30187
30962
  };
30188
- __publicField(SQLiteSession, _a220, "SQLiteSession");
30189
- SQLiteTransaction = class extends (_b154 = BaseSQLiteDatabase, _a221 = entityKind, _b154) {
30963
+ __publicField(SQLiteSession, _a222, "SQLiteSession");
30964
+ SQLiteTransaction = class extends (_b154 = BaseSQLiteDatabase, _a223 = entityKind, _b154) {
30190
30965
  constructor(resultType, dialect4, session, schema4, nestedIndex = 0) {
30191
30966
  super(resultType, dialect4, session, schema4);
30192
30967
  this.schema = schema4;
@@ -30196,7 +30971,7 @@ var init_session2 = __esm({
30196
30971
  throw new TransactionRollbackError();
30197
30972
  }
30198
30973
  };
30199
- __publicField(SQLiteTransaction, _a221, "SQLiteTransaction");
30974
+ __publicField(SQLiteTransaction, _a223, "SQLiteTransaction");
30200
30975
  }
30201
30976
  });
30202
30977
 
@@ -30267,7 +31042,7 @@ var init_utils6 = __esm({
30267
31042
  });
30268
31043
 
30269
31044
  // ../drizzle-orm/dist/sqlite-core/view.js
30270
- var _a222, ViewBuilderCore, _a223, _b155, ViewBuilder2, _a224, _b156, ManualViewBuilder2, _a225, _b157, _c8, SQLiteView;
31045
+ var _a224, ViewBuilderCore, _a225, _b155, ViewBuilder2, _a226, _b156, ManualViewBuilder2, _a227, _b157, _c8, SQLiteView;
30271
31046
  var init_view2 = __esm({
30272
31047
  "../drizzle-orm/dist/sqlite-core/view.js"() {
30273
31048
  "use strict";
@@ -30278,15 +31053,15 @@ var init_view2 = __esm({
30278
31053
  init_table3();
30279
31054
  init_view_base2();
30280
31055
  init_view_common3();
30281
- _a222 = entityKind;
31056
+ _a224 = entityKind;
30282
31057
  ViewBuilderCore = class {
30283
31058
  constructor(name2) {
30284
31059
  __publicField(this, "config", {});
30285
31060
  this.name = name2;
30286
31061
  }
30287
31062
  };
30288
- __publicField(ViewBuilderCore, _a222, "SQLiteViewBuilderCore");
30289
- ViewBuilder2 = class extends (_b155 = ViewBuilderCore, _a223 = entityKind, _b155) {
31063
+ __publicField(ViewBuilderCore, _a224, "SQLiteViewBuilderCore");
31064
+ ViewBuilder2 = class extends (_b155 = ViewBuilderCore, _a225 = entityKind, _b155) {
30290
31065
  as(qb) {
30291
31066
  if (typeof qb === "function") {
30292
31067
  qb = qb(new QueryBuilder2());
@@ -30312,8 +31087,8 @@ var init_view2 = __esm({
30312
31087
  );
30313
31088
  }
30314
31089
  };
30315
- __publicField(ViewBuilder2, _a223, "SQLiteViewBuilder");
30316
- ManualViewBuilder2 = class extends (_b156 = ViewBuilderCore, _a224 = entityKind, _b156) {
31090
+ __publicField(ViewBuilder2, _a225, "SQLiteViewBuilder");
31091
+ ManualViewBuilder2 = class extends (_b156 = ViewBuilderCore, _a226 = entityKind, _b156) {
30317
31092
  constructor(name2, columns) {
30318
31093
  super(name2);
30319
31094
  __publicField(this, "columns");
@@ -30358,12 +31133,12 @@ var init_view2 = __esm({
30358
31133
  );
30359
31134
  }
30360
31135
  };
30361
- __publicField(ManualViewBuilder2, _a224, "SQLiteManualViewBuilder");
30362
- SQLiteView = class extends (_c8 = SQLiteViewBase, _b157 = entityKind, _a225 = SQLiteViewConfig, _c8) {
31136
+ __publicField(ManualViewBuilder2, _a226, "SQLiteManualViewBuilder");
31137
+ SQLiteView = class extends (_c8 = SQLiteViewBase, _b157 = entityKind, _a227 = SQLiteViewConfig, _c8) {
30363
31138
  constructor({ sqliteConfig, config }) {
30364
31139
  super(config);
30365
31140
  /** @internal */
30366
- __publicField(this, _a225);
31141
+ __publicField(this, _a227);
30367
31142
  this[SQLiteViewConfig] = sqliteConfig;
30368
31143
  }
30369
31144
  };
@@ -30900,12 +31675,12 @@ var init_alias4 = __esm({
30900
31675
  });
30901
31676
 
30902
31677
  // ../drizzle-orm/dist/mysql-core/checks.js
30903
- var _a226, CheckBuilder3, _a227, Check3;
31678
+ var _a228, CheckBuilder3, _a229, Check3;
30904
31679
  var init_checks3 = __esm({
30905
31680
  "../drizzle-orm/dist/mysql-core/checks.js"() {
30906
31681
  "use strict";
30907
31682
  init_entity();
30908
- _a226 = entityKind;
31683
+ _a228 = entityKind;
30909
31684
  CheckBuilder3 = class {
30910
31685
  constructor(name2, value) {
30911
31686
  __publicField(this, "brand");
@@ -30917,8 +31692,8 @@ var init_checks3 = __esm({
30917
31692
  return new Check3(table4, this);
30918
31693
  }
30919
31694
  };
30920
- __publicField(CheckBuilder3, _a226, "MySqlCheckBuilder");
30921
- _a227 = entityKind;
31695
+ __publicField(CheckBuilder3, _a228, "MySqlCheckBuilder");
31696
+ _a229 = entityKind;
30922
31697
  Check3 = class {
30923
31698
  constructor(table4, builder) {
30924
31699
  __publicField(this, "name");
@@ -30928,18 +31703,18 @@ var init_checks3 = __esm({
30928
31703
  this.value = builder.value;
30929
31704
  }
30930
31705
  };
30931
- __publicField(Check3, _a227, "MySqlCheck");
31706
+ __publicField(Check3, _a229, "MySqlCheck");
30932
31707
  }
30933
31708
  });
30934
31709
 
30935
31710
  // ../drizzle-orm/dist/mysql-core/foreign-keys.js
30936
- var _a228, ForeignKeyBuilder3, _a229, ForeignKey3;
31711
+ var _a230, ForeignKeyBuilder3, _a231, ForeignKey3;
30937
31712
  var init_foreign_keys3 = __esm({
30938
31713
  "../drizzle-orm/dist/mysql-core/foreign-keys.js"() {
30939
31714
  "use strict";
30940
31715
  init_entity();
30941
31716
  init_table_utils();
30942
- _a228 = entityKind;
31717
+ _a230 = entityKind;
30943
31718
  ForeignKeyBuilder3 = class {
30944
31719
  constructor(config, actions) {
30945
31720
  /** @internal */
@@ -30970,8 +31745,8 @@ var init_foreign_keys3 = __esm({
30970
31745
  return new ForeignKey3(table4, this);
30971
31746
  }
30972
31747
  };
30973
- __publicField(ForeignKeyBuilder3, _a228, "MySqlForeignKeyBuilder");
30974
- _a229 = entityKind;
31748
+ __publicField(ForeignKeyBuilder3, _a230, "MySqlForeignKeyBuilder");
31749
+ _a231 = entityKind;
30975
31750
  ForeignKey3 = class {
30976
31751
  constructor(table4, builder) {
30977
31752
  __publicField(this, "reference");
@@ -30995,7 +31770,7 @@ var init_foreign_keys3 = __esm({
30995
31770
  return name2 ?? `${chunks.join("_")}_fk`;
30996
31771
  }
30997
31772
  };
30998
- __publicField(ForeignKey3, _a229, "MySqlForeignKey");
31773
+ __publicField(ForeignKey3, _a231, "MySqlForeignKey");
30999
31774
  }
31000
31775
  });
31001
31776
 
@@ -31003,13 +31778,13 @@ var init_foreign_keys3 = __esm({
31003
31778
  function uniqueKeyName3(table4, columns) {
31004
31779
  return `${table4[TableName]}_${columns.join("_")}_unique`;
31005
31780
  }
31006
- var _a230, UniqueConstraintBuilder3, _a231, UniqueOnConstraintBuilder3, _a232, UniqueConstraint3;
31781
+ var _a232, UniqueConstraintBuilder3, _a233, UniqueOnConstraintBuilder3, _a234, UniqueConstraint3;
31007
31782
  var init_unique_constraint3 = __esm({
31008
31783
  "../drizzle-orm/dist/mysql-core/unique-constraint.js"() {
31009
31784
  "use strict";
31010
31785
  init_entity();
31011
31786
  init_table_utils();
31012
- _a230 = entityKind;
31787
+ _a232 = entityKind;
31013
31788
  UniqueConstraintBuilder3 = class {
31014
31789
  constructor(columns, name2) {
31015
31790
  /** @internal */
@@ -31022,8 +31797,8 @@ var init_unique_constraint3 = __esm({
31022
31797
  return new UniqueConstraint3(table4, this.columns, this.name);
31023
31798
  }
31024
31799
  };
31025
- __publicField(UniqueConstraintBuilder3, _a230, "MySqlUniqueConstraintBuilder");
31026
- _a231 = entityKind;
31800
+ __publicField(UniqueConstraintBuilder3, _a232, "MySqlUniqueConstraintBuilder");
31801
+ _a233 = entityKind;
31027
31802
  UniqueOnConstraintBuilder3 = class {
31028
31803
  constructor(name2) {
31029
31804
  /** @internal */
@@ -31034,8 +31809,8 @@ var init_unique_constraint3 = __esm({
31034
31809
  return new UniqueConstraintBuilder3(columns, this.name);
31035
31810
  }
31036
31811
  };
31037
- __publicField(UniqueOnConstraintBuilder3, _a231, "MySqlUniqueOnConstraintBuilder");
31038
- _a232 = entityKind;
31812
+ __publicField(UniqueOnConstraintBuilder3, _a233, "MySqlUniqueOnConstraintBuilder");
31813
+ _a234 = entityKind;
31039
31814
  UniqueConstraint3 = class {
31040
31815
  constructor(table4, columns, name2) {
31041
31816
  __publicField(this, "columns");
@@ -31049,12 +31824,12 @@ var init_unique_constraint3 = __esm({
31049
31824
  return this.name;
31050
31825
  }
31051
31826
  };
31052
- __publicField(UniqueConstraint3, _a232, "MySqlUniqueConstraint");
31827
+ __publicField(UniqueConstraint3, _a234, "MySqlUniqueConstraint");
31053
31828
  }
31054
31829
  });
31055
31830
 
31056
31831
  // ../drizzle-orm/dist/mysql-core/columns/common.js
31057
- var _a233, _b158, MySqlColumnBuilder, _a234, _b159, MySqlColumn, _a235, _b160, MySqlColumnBuilderWithAutoIncrement, _a236, _b161, MySqlColumnWithAutoIncrement;
31832
+ var _a235, _b158, MySqlColumnBuilder, _a236, _b159, MySqlColumn, _a237, _b160, MySqlColumnBuilderWithAutoIncrement, _a238, _b161, MySqlColumnWithAutoIncrement;
31058
31833
  var init_common4 = __esm({
31059
31834
  "../drizzle-orm/dist/mysql-core/columns/common.js"() {
31060
31835
  "use strict";
@@ -31063,7 +31838,7 @@ var init_common4 = __esm({
31063
31838
  init_entity();
31064
31839
  init_foreign_keys3();
31065
31840
  init_unique_constraint3();
31066
- MySqlColumnBuilder = class extends (_b158 = ColumnBuilder, _a233 = entityKind, _b158) {
31841
+ MySqlColumnBuilder = class extends (_b158 = ColumnBuilder, _a235 = entityKind, _b158) {
31067
31842
  constructor() {
31068
31843
  super(...arguments);
31069
31844
  __publicField(this, "foreignKeyConfigs", []);
@@ -31104,8 +31879,8 @@ var init_common4 = __esm({
31104
31879
  });
31105
31880
  }
31106
31881
  };
31107
- __publicField(MySqlColumnBuilder, _a233, "MySqlColumnBuilder");
31108
- MySqlColumn = class extends (_b159 = Column2, _a234 = entityKind, _b159) {
31882
+ __publicField(MySqlColumnBuilder, _a235, "MySqlColumnBuilder");
31883
+ MySqlColumn = class extends (_b159 = Column2, _a236 = entityKind, _b159) {
31109
31884
  constructor(table4, config) {
31110
31885
  if (!config.uniqueName) {
31111
31886
  config.uniqueName = uniqueKeyName3(table4, [config.name]);
@@ -31114,8 +31889,8 @@ var init_common4 = __esm({
31114
31889
  this.table = table4;
31115
31890
  }
31116
31891
  };
31117
- __publicField(MySqlColumn, _a234, "MySqlColumn");
31118
- MySqlColumnBuilderWithAutoIncrement = class extends (_b160 = MySqlColumnBuilder, _a235 = entityKind, _b160) {
31892
+ __publicField(MySqlColumn, _a236, "MySqlColumn");
31893
+ MySqlColumnBuilderWithAutoIncrement = class extends (_b160 = MySqlColumnBuilder, _a237 = entityKind, _b160) {
31119
31894
  constructor(name2, dataType, columnType) {
31120
31895
  super(name2, dataType, columnType);
31121
31896
  this.config.autoIncrement = false;
@@ -31126,14 +31901,14 @@ var init_common4 = __esm({
31126
31901
  return this;
31127
31902
  }
31128
31903
  };
31129
- __publicField(MySqlColumnBuilderWithAutoIncrement, _a235, "MySqlColumnBuilderWithAutoIncrement");
31130
- MySqlColumnWithAutoIncrement = class extends (_b161 = MySqlColumn, _a236 = entityKind, _b161) {
31904
+ __publicField(MySqlColumnBuilderWithAutoIncrement, _a237, "MySqlColumnBuilderWithAutoIncrement");
31905
+ MySqlColumnWithAutoIncrement = class extends (_b161 = MySqlColumn, _a238 = entityKind, _b161) {
31131
31906
  constructor() {
31132
31907
  super(...arguments);
31133
31908
  __publicField(this, "autoIncrement", this.config.autoIncrement);
31134
31909
  }
31135
31910
  };
31136
- __publicField(MySqlColumnWithAutoIncrement, _a236, "MySqlColumnWithAutoIncrement");
31911
+ __publicField(MySqlColumnWithAutoIncrement, _a238, "MySqlColumnWithAutoIncrement");
31137
31912
  }
31138
31913
  });
31139
31914
 
@@ -31145,14 +31920,14 @@ function bigint2(a, b) {
31145
31920
  }
31146
31921
  return new MySqlBigInt64Builder(name2, config.unsigned);
31147
31922
  }
31148
- var _a237, _b162, MySqlBigInt53Builder, _a238, _b163, MySqlBigInt53, _a239, _b164, MySqlBigInt64Builder, _a240, _b165, MySqlBigInt64;
31923
+ var _a239, _b162, MySqlBigInt53Builder, _a240, _b163, MySqlBigInt53, _a241, _b164, MySqlBigInt64Builder, _a242, _b165, MySqlBigInt64;
31149
31924
  var init_bigint2 = __esm({
31150
31925
  "../drizzle-orm/dist/mysql-core/columns/bigint.js"() {
31151
31926
  "use strict";
31152
31927
  init_entity();
31153
31928
  init_utils2();
31154
31929
  init_common4();
31155
- MySqlBigInt53Builder = class extends (_b162 = MySqlColumnBuilderWithAutoIncrement, _a237 = entityKind, _b162) {
31930
+ MySqlBigInt53Builder = class extends (_b162 = MySqlColumnBuilderWithAutoIncrement, _a239 = entityKind, _b162) {
31156
31931
  constructor(name2, unsigned = false) {
31157
31932
  super(name2, "number", "MySqlBigInt53");
31158
31933
  this.config.unsigned = unsigned;
@@ -31165,8 +31940,8 @@ var init_bigint2 = __esm({
31165
31940
  );
31166
31941
  }
31167
31942
  };
31168
- __publicField(MySqlBigInt53Builder, _a237, "MySqlBigInt53Builder");
31169
- MySqlBigInt53 = class extends (_b163 = MySqlColumnWithAutoIncrement, _a238 = entityKind, _b163) {
31943
+ __publicField(MySqlBigInt53Builder, _a239, "MySqlBigInt53Builder");
31944
+ MySqlBigInt53 = class extends (_b163 = MySqlColumnWithAutoIncrement, _a240 = entityKind, _b163) {
31170
31945
  getSQLType() {
31171
31946
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
31172
31947
  }
@@ -31177,8 +31952,8 @@ var init_bigint2 = __esm({
31177
31952
  return Number(value);
31178
31953
  }
31179
31954
  };
31180
- __publicField(MySqlBigInt53, _a238, "MySqlBigInt53");
31181
- MySqlBigInt64Builder = class extends (_b164 = MySqlColumnBuilderWithAutoIncrement, _a239 = entityKind, _b164) {
31955
+ __publicField(MySqlBigInt53, _a240, "MySqlBigInt53");
31956
+ MySqlBigInt64Builder = class extends (_b164 = MySqlColumnBuilderWithAutoIncrement, _a241 = entityKind, _b164) {
31182
31957
  constructor(name2, unsigned = false) {
31183
31958
  super(name2, "bigint", "MySqlBigInt64");
31184
31959
  this.config.unsigned = unsigned;
@@ -31191,8 +31966,8 @@ var init_bigint2 = __esm({
31191
31966
  );
31192
31967
  }
31193
31968
  };
31194
- __publicField(MySqlBigInt64Builder, _a239, "MySqlBigInt64Builder");
31195
- MySqlBigInt64 = class extends (_b165 = MySqlColumnWithAutoIncrement, _a240 = entityKind, _b165) {
31969
+ __publicField(MySqlBigInt64Builder, _a241, "MySqlBigInt64Builder");
31970
+ MySqlBigInt64 = class extends (_b165 = MySqlColumnWithAutoIncrement, _a242 = entityKind, _b165) {
31196
31971
  getSQLType() {
31197
31972
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
31198
31973
  }
@@ -31201,7 +31976,7 @@ var init_bigint2 = __esm({
31201
31976
  return BigInt(value);
31202
31977
  }
31203
31978
  };
31204
- __publicField(MySqlBigInt64, _a240, "MySqlBigInt64");
31979
+ __publicField(MySqlBigInt64, _a242, "MySqlBigInt64");
31205
31980
  }
31206
31981
  });
31207
31982
 
@@ -31210,14 +31985,14 @@ function binary(a, b = {}) {
31210
31985
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31211
31986
  return new MySqlBinaryBuilder(name2, config.length);
31212
31987
  }
31213
- var _a241, _b166, MySqlBinaryBuilder, _a242, _b167, MySqlBinary;
31988
+ var _a243, _b166, MySqlBinaryBuilder, _a244, _b167, MySqlBinary;
31214
31989
  var init_binary = __esm({
31215
31990
  "../drizzle-orm/dist/mysql-core/columns/binary.js"() {
31216
31991
  "use strict";
31217
31992
  init_entity();
31218
31993
  init_utils2();
31219
31994
  init_common4();
31220
- MySqlBinaryBuilder = class extends (_b166 = MySqlColumnBuilder, _a241 = entityKind, _b166) {
31995
+ MySqlBinaryBuilder = class extends (_b166 = MySqlColumnBuilder, _a243 = entityKind, _b166) {
31221
31996
  constructor(name2, length) {
31222
31997
  super(name2, "string", "MySqlBinary");
31223
31998
  this.config.length = length;
@@ -31227,8 +32002,8 @@ var init_binary = __esm({
31227
32002
  return new MySqlBinary(table4, this.config);
31228
32003
  }
31229
32004
  };
31230
- __publicField(MySqlBinaryBuilder, _a241, "MySqlBinaryBuilder");
31231
- MySqlBinary = class extends (_b167 = MySqlColumn, _a242 = entityKind, _b167) {
32005
+ __publicField(MySqlBinaryBuilder, _a243, "MySqlBinaryBuilder");
32006
+ MySqlBinary = class extends (_b167 = MySqlColumn, _a244 = entityKind, _b167) {
31232
32007
  constructor() {
31233
32008
  super(...arguments);
31234
32009
  __publicField(this, "length", this.config.length);
@@ -31237,7 +32012,7 @@ var init_binary = __esm({
31237
32012
  return this.length === void 0 ? `binary` : `binary(${this.length})`;
31238
32013
  }
31239
32014
  };
31240
- __publicField(MySqlBinary, _a242, "MySqlBinary");
32015
+ __publicField(MySqlBinary, _a244, "MySqlBinary");
31241
32016
  }
31242
32017
  });
31243
32018
 
@@ -31245,13 +32020,13 @@ var init_binary = __esm({
31245
32020
  function boolean2(name2) {
31246
32021
  return new MySqlBooleanBuilder(name2 ?? "");
31247
32022
  }
31248
- var _a243, _b168, MySqlBooleanBuilder, _a244, _b169, MySqlBoolean;
32023
+ var _a245, _b168, MySqlBooleanBuilder, _a246, _b169, MySqlBoolean;
31249
32024
  var init_boolean2 = __esm({
31250
32025
  "../drizzle-orm/dist/mysql-core/columns/boolean.js"() {
31251
32026
  "use strict";
31252
32027
  init_entity();
31253
32028
  init_common4();
31254
- MySqlBooleanBuilder = class extends (_b168 = MySqlColumnBuilder, _a243 = entityKind, _b168) {
32029
+ MySqlBooleanBuilder = class extends (_b168 = MySqlColumnBuilder, _a245 = entityKind, _b168) {
31255
32030
  constructor(name2) {
31256
32031
  super(name2, "boolean", "MySqlBoolean");
31257
32032
  }
@@ -31263,8 +32038,8 @@ var init_boolean2 = __esm({
31263
32038
  );
31264
32039
  }
31265
32040
  };
31266
- __publicField(MySqlBooleanBuilder, _a243, "MySqlBooleanBuilder");
31267
- MySqlBoolean = class extends (_b169 = MySqlColumn, _a244 = entityKind, _b169) {
32041
+ __publicField(MySqlBooleanBuilder, _a245, "MySqlBooleanBuilder");
32042
+ MySqlBoolean = class extends (_b169 = MySqlColumn, _a246 = entityKind, _b169) {
31268
32043
  getSQLType() {
31269
32044
  return "boolean";
31270
32045
  }
@@ -31275,7 +32050,7 @@ var init_boolean2 = __esm({
31275
32050
  return value === 1;
31276
32051
  }
31277
32052
  };
31278
- __publicField(MySqlBoolean, _a244, "MySqlBoolean");
32053
+ __publicField(MySqlBoolean, _a246, "MySqlBoolean");
31279
32054
  }
31280
32055
  });
31281
32056
 
@@ -31284,14 +32059,14 @@ function char2(a, b = {}) {
31284
32059
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31285
32060
  return new MySqlCharBuilder(name2, config);
31286
32061
  }
31287
- var _a245, _b170, MySqlCharBuilder, _a246, _b171, MySqlChar;
32062
+ var _a247, _b170, MySqlCharBuilder, _a248, _b171, MySqlChar;
31288
32063
  var init_char2 = __esm({
31289
32064
  "../drizzle-orm/dist/mysql-core/columns/char.js"() {
31290
32065
  "use strict";
31291
32066
  init_entity();
31292
32067
  init_utils2();
31293
32068
  init_common4();
31294
- MySqlCharBuilder = class extends (_b170 = MySqlColumnBuilder, _a245 = entityKind, _b170) {
32069
+ MySqlCharBuilder = class extends (_b170 = MySqlColumnBuilder, _a247 = entityKind, _b170) {
31295
32070
  constructor(name2, config) {
31296
32071
  super(name2, "string", "MySqlChar");
31297
32072
  this.config.length = config.length;
@@ -31305,8 +32080,8 @@ var init_char2 = __esm({
31305
32080
  );
31306
32081
  }
31307
32082
  };
31308
- __publicField(MySqlCharBuilder, _a245, "MySqlCharBuilder");
31309
- MySqlChar = class extends (_b171 = MySqlColumn, _a246 = entityKind, _b171) {
32083
+ __publicField(MySqlCharBuilder, _a247, "MySqlCharBuilder");
32084
+ MySqlChar = class extends (_b171 = MySqlColumn, _a248 = entityKind, _b171) {
31310
32085
  constructor() {
31311
32086
  super(...arguments);
31312
32087
  __publicField(this, "length", this.config.length);
@@ -31316,7 +32091,7 @@ var init_char2 = __esm({
31316
32091
  return this.length === void 0 ? `char` : `char(${this.length})`;
31317
32092
  }
31318
32093
  };
31319
- __publicField(MySqlChar, _a246, "MySqlChar");
32094
+ __publicField(MySqlChar, _a248, "MySqlChar");
31320
32095
  }
31321
32096
  });
31322
32097
 
@@ -31327,14 +32102,14 @@ function customType3(customTypeParams) {
31327
32102
  return new MySqlCustomColumnBuilder(name2, config, customTypeParams);
31328
32103
  };
31329
32104
  }
31330
- var _a247, _b172, MySqlCustomColumnBuilder, _a248, _b173, MySqlCustomColumn;
32105
+ var _a249, _b172, MySqlCustomColumnBuilder, _a250, _b173, MySqlCustomColumn;
31331
32106
  var init_custom3 = __esm({
31332
32107
  "../drizzle-orm/dist/mysql-core/columns/custom.js"() {
31333
32108
  "use strict";
31334
32109
  init_entity();
31335
32110
  init_utils2();
31336
32111
  init_common4();
31337
- MySqlCustomColumnBuilder = class extends (_b172 = MySqlColumnBuilder, _a247 = entityKind, _b172) {
32112
+ MySqlCustomColumnBuilder = class extends (_b172 = MySqlColumnBuilder, _a249 = entityKind, _b172) {
31338
32113
  constructor(name2, fieldConfig, customTypeParams) {
31339
32114
  super(name2, "custom", "MySqlCustomColumn");
31340
32115
  this.config.fieldConfig = fieldConfig;
@@ -31348,8 +32123,8 @@ var init_custom3 = __esm({
31348
32123
  );
31349
32124
  }
31350
32125
  };
31351
- __publicField(MySqlCustomColumnBuilder, _a247, "MySqlCustomColumnBuilder");
31352
- MySqlCustomColumn = class extends (_b173 = MySqlColumn, _a248 = entityKind, _b173) {
32126
+ __publicField(MySqlCustomColumnBuilder, _a249, "MySqlCustomColumnBuilder");
32127
+ MySqlCustomColumn = class extends (_b173 = MySqlColumn, _a250 = entityKind, _b173) {
31353
32128
  constructor(table4, config) {
31354
32129
  super(table4, config);
31355
32130
  __publicField(this, "sqlName");
@@ -31369,7 +32144,7 @@ var init_custom3 = __esm({
31369
32144
  return typeof this.mapTo === "function" ? this.mapTo(value) : value;
31370
32145
  }
31371
32146
  };
31372
- __publicField(MySqlCustomColumn, _a248, "MySqlCustomColumn");
32147
+ __publicField(MySqlCustomColumn, _a250, "MySqlCustomColumn");
31373
32148
  }
31374
32149
  });
31375
32150
 
@@ -31381,14 +32156,14 @@ function date2(a, b) {
31381
32156
  }
31382
32157
  return new MySqlDateBuilder(name2);
31383
32158
  }
31384
- var _a249, _b174, MySqlDateBuilder, _a250, _b175, MySqlDate, _a251, _b176, MySqlDateStringBuilder, _a252, _b177, MySqlDateString;
32159
+ var _a251, _b174, MySqlDateBuilder, _a252, _b175, MySqlDate, _a253, _b176, MySqlDateStringBuilder, _a254, _b177, MySqlDateString;
31385
32160
  var init_date2 = __esm({
31386
32161
  "../drizzle-orm/dist/mysql-core/columns/date.js"() {
31387
32162
  "use strict";
31388
32163
  init_entity();
31389
32164
  init_utils2();
31390
32165
  init_common4();
31391
- MySqlDateBuilder = class extends (_b174 = MySqlColumnBuilder, _a249 = entityKind, _b174) {
32166
+ MySqlDateBuilder = class extends (_b174 = MySqlColumnBuilder, _a251 = entityKind, _b174) {
31392
32167
  constructor(name2) {
31393
32168
  super(name2, "date", "MySqlDate");
31394
32169
  }
@@ -31397,8 +32172,8 @@ var init_date2 = __esm({
31397
32172
  return new MySqlDate(table4, this.config);
31398
32173
  }
31399
32174
  };
31400
- __publicField(MySqlDateBuilder, _a249, "MySqlDateBuilder");
31401
- MySqlDate = class extends (_b175 = MySqlColumn, _a250 = entityKind, _b175) {
32175
+ __publicField(MySqlDateBuilder, _a251, "MySqlDateBuilder");
32176
+ MySqlDate = class extends (_b175 = MySqlColumn, _a252 = entityKind, _b175) {
31402
32177
  constructor(table4, config) {
31403
32178
  super(table4, config);
31404
32179
  }
@@ -31409,8 +32184,8 @@ var init_date2 = __esm({
31409
32184
  return new Date(value);
31410
32185
  }
31411
32186
  };
31412
- __publicField(MySqlDate, _a250, "MySqlDate");
31413
- MySqlDateStringBuilder = class extends (_b176 = MySqlColumnBuilder, _a251 = entityKind, _b176) {
32187
+ __publicField(MySqlDate, _a252, "MySqlDate");
32188
+ MySqlDateStringBuilder = class extends (_b176 = MySqlColumnBuilder, _a253 = entityKind, _b176) {
31414
32189
  constructor(name2) {
31415
32190
  super(name2, "string", "MySqlDateString");
31416
32191
  }
@@ -31422,8 +32197,8 @@ var init_date2 = __esm({
31422
32197
  );
31423
32198
  }
31424
32199
  };
31425
- __publicField(MySqlDateStringBuilder, _a251, "MySqlDateStringBuilder");
31426
- MySqlDateString = class extends (_b177 = MySqlColumn, _a252 = entityKind, _b177) {
32200
+ __publicField(MySqlDateStringBuilder, _a253, "MySqlDateStringBuilder");
32201
+ MySqlDateString = class extends (_b177 = MySqlColumn, _a254 = entityKind, _b177) {
31427
32202
  constructor(table4, config) {
31428
32203
  super(table4, config);
31429
32204
  }
@@ -31431,7 +32206,7 @@ var init_date2 = __esm({
31431
32206
  return `date`;
31432
32207
  }
31433
32208
  };
31434
- __publicField(MySqlDateString, _a252, "MySqlDateString");
32209
+ __publicField(MySqlDateString, _a254, "MySqlDateString");
31435
32210
  }
31436
32211
  });
31437
32212
 
@@ -31443,14 +32218,14 @@ function datetime(a, b) {
31443
32218
  }
31444
32219
  return new MySqlDateTimeBuilder(name2, config);
31445
32220
  }
31446
- var _a253, _b178, MySqlDateTimeBuilder, _a254, _b179, MySqlDateTime, _a255, _b180, MySqlDateTimeStringBuilder, _a256, _b181, MySqlDateTimeString;
32221
+ var _a255, _b178, MySqlDateTimeBuilder, _a256, _b179, MySqlDateTime, _a257, _b180, MySqlDateTimeStringBuilder, _a258, _b181, MySqlDateTimeString;
31447
32222
  var init_datetime = __esm({
31448
32223
  "../drizzle-orm/dist/mysql-core/columns/datetime.js"() {
31449
32224
  "use strict";
31450
32225
  init_entity();
31451
32226
  init_utils2();
31452
32227
  init_common4();
31453
- MySqlDateTimeBuilder = class extends (_b178 = MySqlColumnBuilder, _a253 = entityKind, _b178) {
32228
+ MySqlDateTimeBuilder = class extends (_b178 = MySqlColumnBuilder, _a255 = entityKind, _b178) {
31454
32229
  constructor(name2, config) {
31455
32230
  super(name2, "date", "MySqlDateTime");
31456
32231
  this.config.fsp = config?.fsp;
@@ -31463,8 +32238,8 @@ var init_datetime = __esm({
31463
32238
  );
31464
32239
  }
31465
32240
  };
31466
- __publicField(MySqlDateTimeBuilder, _a253, "MySqlDateTimeBuilder");
31467
- MySqlDateTime = class extends (_b179 = MySqlColumn, _a254 = entityKind, _b179) {
32241
+ __publicField(MySqlDateTimeBuilder, _a255, "MySqlDateTimeBuilder");
32242
+ MySqlDateTime = class extends (_b179 = MySqlColumn, _a256 = entityKind, _b179) {
31468
32243
  constructor(table4, config) {
31469
32244
  super(table4, config);
31470
32245
  __publicField(this, "fsp");
@@ -31481,8 +32256,8 @@ var init_datetime = __esm({
31481
32256
  return /* @__PURE__ */ new Date(value.replace(" ", "T") + "Z");
31482
32257
  }
31483
32258
  };
31484
- __publicField(MySqlDateTime, _a254, "MySqlDateTime");
31485
- MySqlDateTimeStringBuilder = class extends (_b180 = MySqlColumnBuilder, _a255 = entityKind, _b180) {
32259
+ __publicField(MySqlDateTime, _a256, "MySqlDateTime");
32260
+ MySqlDateTimeStringBuilder = class extends (_b180 = MySqlColumnBuilder, _a257 = entityKind, _b180) {
31486
32261
  constructor(name2, config) {
31487
32262
  super(name2, "string", "MySqlDateTimeString");
31488
32263
  this.config.fsp = config?.fsp;
@@ -31495,8 +32270,8 @@ var init_datetime = __esm({
31495
32270
  );
31496
32271
  }
31497
32272
  };
31498
- __publicField(MySqlDateTimeStringBuilder, _a255, "MySqlDateTimeStringBuilder");
31499
- MySqlDateTimeString = class extends (_b181 = MySqlColumn, _a256 = entityKind, _b181) {
32273
+ __publicField(MySqlDateTimeStringBuilder, _a257, "MySqlDateTimeStringBuilder");
32274
+ MySqlDateTimeString = class extends (_b181 = MySqlColumn, _a258 = entityKind, _b181) {
31500
32275
  constructor(table4, config) {
31501
32276
  super(table4, config);
31502
32277
  __publicField(this, "fsp");
@@ -31507,7 +32282,7 @@ var init_datetime = __esm({
31507
32282
  return `datetime${precision}`;
31508
32283
  }
31509
32284
  };
31510
- __publicField(MySqlDateTimeString, _a256, "MySqlDateTimeString");
32285
+ __publicField(MySqlDateTimeString, _a258, "MySqlDateTimeString");
31511
32286
  }
31512
32287
  });
31513
32288
 
@@ -31516,14 +32291,14 @@ function decimal(a, b = {}) {
31516
32291
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31517
32292
  return new MySqlDecimalBuilder(name2, config.precision, config.scale);
31518
32293
  }
31519
- var _a257, _b182, MySqlDecimalBuilder, _a258, _b183, MySqlDecimal;
32294
+ var _a259, _b182, MySqlDecimalBuilder, _a260, _b183, MySqlDecimal;
31520
32295
  var init_decimal = __esm({
31521
32296
  "../drizzle-orm/dist/mysql-core/columns/decimal.js"() {
31522
32297
  "use strict";
31523
32298
  init_entity();
31524
32299
  init_utils2();
31525
32300
  init_common4();
31526
- MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a257 = entityKind, _b182) {
32301
+ MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b182) {
31527
32302
  constructor(name2, precision, scale) {
31528
32303
  super(name2, "string", "MySqlDecimal");
31529
32304
  this.config.precision = precision;
@@ -31537,8 +32312,8 @@ var init_decimal = __esm({
31537
32312
  );
31538
32313
  }
31539
32314
  };
31540
- __publicField(MySqlDecimalBuilder, _a257, "MySqlDecimalBuilder");
31541
- MySqlDecimal = class extends (_b183 = MySqlColumnWithAutoIncrement, _a258 = entityKind, _b183) {
32315
+ __publicField(MySqlDecimalBuilder, _a259, "MySqlDecimalBuilder");
32316
+ MySqlDecimal = class extends (_b183 = MySqlColumnWithAutoIncrement, _a260 = entityKind, _b183) {
31542
32317
  constructor() {
31543
32318
  super(...arguments);
31544
32319
  __publicField(this, "precision", this.config.precision);
@@ -31554,7 +32329,7 @@ var init_decimal = __esm({
31554
32329
  }
31555
32330
  }
31556
32331
  };
31557
- __publicField(MySqlDecimal, _a258, "MySqlDecimal");
32332
+ __publicField(MySqlDecimal, _a260, "MySqlDecimal");
31558
32333
  }
31559
32334
  });
31560
32335
 
@@ -31563,14 +32338,14 @@ function double(a, b) {
31563
32338
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31564
32339
  return new MySqlDoubleBuilder(name2, config);
31565
32340
  }
31566
- var _a259, _b184, MySqlDoubleBuilder, _a260, _b185, MySqlDouble;
32341
+ var _a261, _b184, MySqlDoubleBuilder, _a262, _b185, MySqlDouble;
31567
32342
  var init_double = __esm({
31568
32343
  "../drizzle-orm/dist/mysql-core/columns/double.js"() {
31569
32344
  "use strict";
31570
32345
  init_entity();
31571
32346
  init_utils2();
31572
32347
  init_common4();
31573
- MySqlDoubleBuilder = class extends (_b184 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b184) {
32348
+ MySqlDoubleBuilder = class extends (_b184 = MySqlColumnBuilderWithAutoIncrement, _a261 = entityKind, _b184) {
31574
32349
  constructor(name2, config) {
31575
32350
  super(name2, "number", "MySqlDouble");
31576
32351
  this.config.precision = config?.precision;
@@ -31581,8 +32356,8 @@ var init_double = __esm({
31581
32356
  return new MySqlDouble(table4, this.config);
31582
32357
  }
31583
32358
  };
31584
- __publicField(MySqlDoubleBuilder, _a259, "MySqlDoubleBuilder");
31585
- MySqlDouble = class extends (_b185 = MySqlColumnWithAutoIncrement, _a260 = entityKind, _b185) {
32359
+ __publicField(MySqlDoubleBuilder, _a261, "MySqlDoubleBuilder");
32360
+ MySqlDouble = class extends (_b185 = MySqlColumnWithAutoIncrement, _a262 = entityKind, _b185) {
31586
32361
  constructor() {
31587
32362
  super(...arguments);
31588
32363
  __publicField(this, "precision", this.config.precision);
@@ -31598,7 +32373,7 @@ var init_double = __esm({
31598
32373
  }
31599
32374
  }
31600
32375
  };
31601
- __publicField(MySqlDouble, _a260, "MySqlDouble");
32376
+ __publicField(MySqlDouble, _a262, "MySqlDouble");
31602
32377
  }
31603
32378
  });
31604
32379
 
@@ -31610,14 +32385,14 @@ function mysqlEnum(a, b) {
31610
32385
  }
31611
32386
  return new MySqlEnumColumnBuilder(name2, values);
31612
32387
  }
31613
- var _a261, _b186, MySqlEnumColumnBuilder, _a262, _b187, MySqlEnumColumn;
32388
+ var _a263, _b186, MySqlEnumColumnBuilder, _a264, _b187, MySqlEnumColumn;
31614
32389
  var init_enum2 = __esm({
31615
32390
  "../drizzle-orm/dist/mysql-core/columns/enum.js"() {
31616
32391
  "use strict";
31617
32392
  init_entity();
31618
32393
  init_utils2();
31619
32394
  init_common4();
31620
- MySqlEnumColumnBuilder = class extends (_b186 = MySqlColumnBuilder, _a261 = entityKind, _b186) {
32395
+ MySqlEnumColumnBuilder = class extends (_b186 = MySqlColumnBuilder, _a263 = entityKind, _b186) {
31621
32396
  constructor(name2, values) {
31622
32397
  super(name2, "string", "MySqlEnumColumn");
31623
32398
  this.config.enumValues = values;
@@ -31630,8 +32405,8 @@ var init_enum2 = __esm({
31630
32405
  );
31631
32406
  }
31632
32407
  };
31633
- __publicField(MySqlEnumColumnBuilder, _a261, "MySqlEnumColumnBuilder");
31634
- MySqlEnumColumn = class extends (_b187 = MySqlColumn, _a262 = entityKind, _b187) {
32408
+ __publicField(MySqlEnumColumnBuilder, _a263, "MySqlEnumColumnBuilder");
32409
+ MySqlEnumColumn = class extends (_b187 = MySqlColumn, _a264 = entityKind, _b187) {
31635
32410
  constructor() {
31636
32411
  super(...arguments);
31637
32412
  __publicField(this, "enumValues", this.config.enumValues);
@@ -31640,7 +32415,7 @@ var init_enum2 = __esm({
31640
32415
  return `enum(${this.enumValues.map((value) => `'${value}'`).join(",")})`;
31641
32416
  }
31642
32417
  };
31643
- __publicField(MySqlEnumColumn, _a262, "MySqlEnumColumn");
32418
+ __publicField(MySqlEnumColumn, _a264, "MySqlEnumColumn");
31644
32419
  }
31645
32420
  });
31646
32421
 
@@ -31648,13 +32423,13 @@ var init_enum2 = __esm({
31648
32423
  function float(name2) {
31649
32424
  return new MySqlFloatBuilder(name2 ?? "");
31650
32425
  }
31651
- var _a263, _b188, MySqlFloatBuilder, _a264, _b189, MySqlFloat;
32426
+ var _a265, _b188, MySqlFloatBuilder, _a266, _b189, MySqlFloat;
31652
32427
  var init_float = __esm({
31653
32428
  "../drizzle-orm/dist/mysql-core/columns/float.js"() {
31654
32429
  "use strict";
31655
32430
  init_entity();
31656
32431
  init_common4();
31657
- MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a263 = entityKind, _b188) {
32432
+ MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b188) {
31658
32433
  constructor(name2) {
31659
32434
  super(name2, "number", "MySqlFloat");
31660
32435
  }
@@ -31663,13 +32438,13 @@ var init_float = __esm({
31663
32438
  return new MySqlFloat(table4, this.config);
31664
32439
  }
31665
32440
  };
31666
- __publicField(MySqlFloatBuilder, _a263, "MySqlFloatBuilder");
31667
- MySqlFloat = class extends (_b189 = MySqlColumnWithAutoIncrement, _a264 = entityKind, _b189) {
32441
+ __publicField(MySqlFloatBuilder, _a265, "MySqlFloatBuilder");
32442
+ MySqlFloat = class extends (_b189 = MySqlColumnWithAutoIncrement, _a266 = entityKind, _b189) {
31668
32443
  getSQLType() {
31669
32444
  return "float";
31670
32445
  }
31671
32446
  };
31672
- __publicField(MySqlFloat, _a264, "MySqlFloat");
32447
+ __publicField(MySqlFloat, _a266, "MySqlFloat");
31673
32448
  }
31674
32449
  });
31675
32450
 
@@ -31678,14 +32453,14 @@ function int(a, b) {
31678
32453
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31679
32454
  return new MySqlIntBuilder(name2, config);
31680
32455
  }
31681
- var _a265, _b190, MySqlIntBuilder, _a266, _b191, MySqlInt;
32456
+ var _a267, _b190, MySqlIntBuilder, _a268, _b191, MySqlInt;
31682
32457
  var init_int = __esm({
31683
32458
  "../drizzle-orm/dist/mysql-core/columns/int.js"() {
31684
32459
  "use strict";
31685
32460
  init_entity();
31686
32461
  init_utils2();
31687
32462
  init_common4();
31688
- MySqlIntBuilder = class extends (_b190 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b190) {
32463
+ MySqlIntBuilder = class extends (_b190 = MySqlColumnBuilderWithAutoIncrement, _a267 = entityKind, _b190) {
31689
32464
  constructor(name2, config) {
31690
32465
  super(name2, "number", "MySqlInt");
31691
32466
  this.config.unsigned = config ? config.unsigned : false;
@@ -31695,8 +32470,8 @@ var init_int = __esm({
31695
32470
  return new MySqlInt(table4, this.config);
31696
32471
  }
31697
32472
  };
31698
- __publicField(MySqlIntBuilder, _a265, "MySqlIntBuilder");
31699
- MySqlInt = class extends (_b191 = MySqlColumnWithAutoIncrement, _a266 = entityKind, _b191) {
32473
+ __publicField(MySqlIntBuilder, _a267, "MySqlIntBuilder");
32474
+ MySqlInt = class extends (_b191 = MySqlColumnWithAutoIncrement, _a268 = entityKind, _b191) {
31700
32475
  getSQLType() {
31701
32476
  return `int${this.config.unsigned ? " unsigned" : ""}`;
31702
32477
  }
@@ -31707,7 +32482,7 @@ var init_int = __esm({
31707
32482
  return value;
31708
32483
  }
31709
32484
  };
31710
- __publicField(MySqlInt, _a266, "MySqlInt");
32485
+ __publicField(MySqlInt, _a268, "MySqlInt");
31711
32486
  }
31712
32487
  });
31713
32488
 
@@ -31715,13 +32490,13 @@ var init_int = __esm({
31715
32490
  function json2(name2) {
31716
32491
  return new MySqlJsonBuilder(name2 ?? "");
31717
32492
  }
31718
- var _a267, _b192, MySqlJsonBuilder, _a268, _b193, MySqlJson;
32493
+ var _a269, _b192, MySqlJsonBuilder, _a270, _b193, MySqlJson;
31719
32494
  var init_json2 = __esm({
31720
32495
  "../drizzle-orm/dist/mysql-core/columns/json.js"() {
31721
32496
  "use strict";
31722
32497
  init_entity();
31723
32498
  init_common4();
31724
- MySqlJsonBuilder = class extends (_b192 = MySqlColumnBuilder, _a267 = entityKind, _b192) {
32499
+ MySqlJsonBuilder = class extends (_b192 = MySqlColumnBuilder, _a269 = entityKind, _b192) {
31725
32500
  constructor(name2) {
31726
32501
  super(name2, "json", "MySqlJson");
31727
32502
  }
@@ -31730,8 +32505,8 @@ var init_json2 = __esm({
31730
32505
  return new MySqlJson(table4, this.config);
31731
32506
  }
31732
32507
  };
31733
- __publicField(MySqlJsonBuilder, _a267, "MySqlJsonBuilder");
31734
- MySqlJson = class extends (_b193 = MySqlColumn, _a268 = entityKind, _b193) {
32508
+ __publicField(MySqlJsonBuilder, _a269, "MySqlJsonBuilder");
32509
+ MySqlJson = class extends (_b193 = MySqlColumn, _a270 = entityKind, _b193) {
31735
32510
  getSQLType() {
31736
32511
  return "json";
31737
32512
  }
@@ -31739,7 +32514,7 @@ var init_json2 = __esm({
31739
32514
  return JSON.stringify(value);
31740
32515
  }
31741
32516
  };
31742
- __publicField(MySqlJson, _a268, "MySqlJson");
32517
+ __publicField(MySqlJson, _a270, "MySqlJson");
31743
32518
  }
31744
32519
  });
31745
32520
 
@@ -31748,14 +32523,14 @@ function mediumint(a, b) {
31748
32523
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31749
32524
  return new MySqlMediumIntBuilder(name2, config);
31750
32525
  }
31751
- var _a269, _b194, MySqlMediumIntBuilder, _a270, _b195, MySqlMediumInt;
32526
+ var _a271, _b194, MySqlMediumIntBuilder, _a272, _b195, MySqlMediumInt;
31752
32527
  var init_mediumint = __esm({
31753
32528
  "../drizzle-orm/dist/mysql-core/columns/mediumint.js"() {
31754
32529
  "use strict";
31755
32530
  init_entity();
31756
32531
  init_utils2();
31757
32532
  init_common4();
31758
- MySqlMediumIntBuilder = class extends (_b194 = MySqlColumnBuilderWithAutoIncrement, _a269 = entityKind, _b194) {
32533
+ MySqlMediumIntBuilder = class extends (_b194 = MySqlColumnBuilderWithAutoIncrement, _a271 = entityKind, _b194) {
31759
32534
  constructor(name2, config) {
31760
32535
  super(name2, "number", "MySqlMediumInt");
31761
32536
  this.config.unsigned = config ? config.unsigned : false;
@@ -31768,8 +32543,8 @@ var init_mediumint = __esm({
31768
32543
  );
31769
32544
  }
31770
32545
  };
31771
- __publicField(MySqlMediumIntBuilder, _a269, "MySqlMediumIntBuilder");
31772
- MySqlMediumInt = class extends (_b195 = MySqlColumnWithAutoIncrement, _a270 = entityKind, _b195) {
32546
+ __publicField(MySqlMediumIntBuilder, _a271, "MySqlMediumIntBuilder");
32547
+ MySqlMediumInt = class extends (_b195 = MySqlColumnWithAutoIncrement, _a272 = entityKind, _b195) {
31773
32548
  getSQLType() {
31774
32549
  return `mediumint${this.config.unsigned ? " unsigned" : ""}`;
31775
32550
  }
@@ -31780,7 +32555,7 @@ var init_mediumint = __esm({
31780
32555
  return value;
31781
32556
  }
31782
32557
  };
31783
- __publicField(MySqlMediumInt, _a270, "MySqlMediumInt");
32558
+ __publicField(MySqlMediumInt, _a272, "MySqlMediumInt");
31784
32559
  }
31785
32560
  });
31786
32561
 
@@ -31789,14 +32564,14 @@ function real3(a, b = {}) {
31789
32564
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31790
32565
  return new MySqlRealBuilder(name2, config);
31791
32566
  }
31792
- var _a271, _b196, MySqlRealBuilder, _a272, _b197, MySqlReal;
32567
+ var _a273, _b196, MySqlRealBuilder, _a274, _b197, MySqlReal;
31793
32568
  var init_real3 = __esm({
31794
32569
  "../drizzle-orm/dist/mysql-core/columns/real.js"() {
31795
32570
  "use strict";
31796
32571
  init_entity();
31797
32572
  init_utils2();
31798
32573
  init_common4();
31799
- MySqlRealBuilder = class extends (_b196 = MySqlColumnBuilderWithAutoIncrement, _a271 = entityKind, _b196) {
32574
+ MySqlRealBuilder = class extends (_b196 = MySqlColumnBuilderWithAutoIncrement, _a273 = entityKind, _b196) {
31800
32575
  constructor(name2, config) {
31801
32576
  super(name2, "number", "MySqlReal");
31802
32577
  this.config.precision = config?.precision;
@@ -31807,8 +32582,8 @@ var init_real3 = __esm({
31807
32582
  return new MySqlReal(table4, this.config);
31808
32583
  }
31809
32584
  };
31810
- __publicField(MySqlRealBuilder, _a271, "MySqlRealBuilder");
31811
- MySqlReal = class extends (_b197 = MySqlColumnWithAutoIncrement, _a272 = entityKind, _b197) {
32585
+ __publicField(MySqlRealBuilder, _a273, "MySqlRealBuilder");
32586
+ MySqlReal = class extends (_b197 = MySqlColumnWithAutoIncrement, _a274 = entityKind, _b197) {
31812
32587
  constructor() {
31813
32588
  super(...arguments);
31814
32589
  __publicField(this, "precision", this.config.precision);
@@ -31824,7 +32599,7 @@ var init_real3 = __esm({
31824
32599
  }
31825
32600
  }
31826
32601
  };
31827
- __publicField(MySqlReal, _a272, "MySqlReal");
32602
+ __publicField(MySqlReal, _a274, "MySqlReal");
31828
32603
  }
31829
32604
  });
31830
32605
 
@@ -31832,13 +32607,13 @@ var init_real3 = __esm({
31832
32607
  function serial2(name2) {
31833
32608
  return new MySqlSerialBuilder(name2 ?? "");
31834
32609
  }
31835
- var _a273, _b198, MySqlSerialBuilder, _a274, _b199, MySqlSerial;
32610
+ var _a275, _b198, MySqlSerialBuilder, _a276, _b199, MySqlSerial;
31836
32611
  var init_serial2 = __esm({
31837
32612
  "../drizzle-orm/dist/mysql-core/columns/serial.js"() {
31838
32613
  "use strict";
31839
32614
  init_entity();
31840
32615
  init_common4();
31841
- MySqlSerialBuilder = class extends (_b198 = MySqlColumnBuilderWithAutoIncrement, _a273 = entityKind, _b198) {
32616
+ MySqlSerialBuilder = class extends (_b198 = MySqlColumnBuilderWithAutoIncrement, _a275 = entityKind, _b198) {
31842
32617
  constructor(name2) {
31843
32618
  super(name2, "number", "MySqlSerial");
31844
32619
  this.config.hasDefault = true;
@@ -31849,8 +32624,8 @@ var init_serial2 = __esm({
31849
32624
  return new MySqlSerial(table4, this.config);
31850
32625
  }
31851
32626
  };
31852
- __publicField(MySqlSerialBuilder, _a273, "MySqlSerialBuilder");
31853
- MySqlSerial = class extends (_b199 = MySqlColumnWithAutoIncrement, _a274 = entityKind, _b199) {
32627
+ __publicField(MySqlSerialBuilder, _a275, "MySqlSerialBuilder");
32628
+ MySqlSerial = class extends (_b199 = MySqlColumnWithAutoIncrement, _a276 = entityKind, _b199) {
31854
32629
  getSQLType() {
31855
32630
  return "serial";
31856
32631
  }
@@ -31861,7 +32636,7 @@ var init_serial2 = __esm({
31861
32636
  return value;
31862
32637
  }
31863
32638
  };
31864
- __publicField(MySqlSerial, _a274, "MySqlSerial");
32639
+ __publicField(MySqlSerial, _a276, "MySqlSerial");
31865
32640
  }
31866
32641
  });
31867
32642
 
@@ -31870,14 +32645,14 @@ function smallint2(a, b) {
31870
32645
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31871
32646
  return new MySqlSmallIntBuilder(name2, config);
31872
32647
  }
31873
- var _a275, _b200, MySqlSmallIntBuilder, _a276, _b201, MySqlSmallInt;
32648
+ var _a277, _b200, MySqlSmallIntBuilder, _a278, _b201, MySqlSmallInt;
31874
32649
  var init_smallint2 = __esm({
31875
32650
  "../drizzle-orm/dist/mysql-core/columns/smallint.js"() {
31876
32651
  "use strict";
31877
32652
  init_entity();
31878
32653
  init_utils2();
31879
32654
  init_common4();
31880
- MySqlSmallIntBuilder = class extends (_b200 = MySqlColumnBuilderWithAutoIncrement, _a275 = entityKind, _b200) {
32655
+ MySqlSmallIntBuilder = class extends (_b200 = MySqlColumnBuilderWithAutoIncrement, _a277 = entityKind, _b200) {
31881
32656
  constructor(name2, config) {
31882
32657
  super(name2, "number", "MySqlSmallInt");
31883
32658
  this.config.unsigned = config ? config.unsigned : false;
@@ -31890,8 +32665,8 @@ var init_smallint2 = __esm({
31890
32665
  );
31891
32666
  }
31892
32667
  };
31893
- __publicField(MySqlSmallIntBuilder, _a275, "MySqlSmallIntBuilder");
31894
- MySqlSmallInt = class extends (_b201 = MySqlColumnWithAutoIncrement, _a276 = entityKind, _b201) {
32668
+ __publicField(MySqlSmallIntBuilder, _a277, "MySqlSmallIntBuilder");
32669
+ MySqlSmallInt = class extends (_b201 = MySqlColumnWithAutoIncrement, _a278 = entityKind, _b201) {
31895
32670
  getSQLType() {
31896
32671
  return `smallint${this.config.unsigned ? " unsigned" : ""}`;
31897
32672
  }
@@ -31902,7 +32677,7 @@ var init_smallint2 = __esm({
31902
32677
  return value;
31903
32678
  }
31904
32679
  };
31905
- __publicField(MySqlSmallInt, _a276, "MySqlSmallInt");
32680
+ __publicField(MySqlSmallInt, _a278, "MySqlSmallInt");
31906
32681
  }
31907
32682
  });
31908
32683
 
@@ -31911,14 +32686,14 @@ function text3(a, b = {}) {
31911
32686
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31912
32687
  return new MySqlTextBuilder(name2, "text", config);
31913
32688
  }
31914
- var _a277, _b202, MySqlTextBuilder, _a278, _b203, MySqlText;
32689
+ var _a279, _b202, MySqlTextBuilder, _a280, _b203, MySqlText;
31915
32690
  var init_text3 = __esm({
31916
32691
  "../drizzle-orm/dist/mysql-core/columns/text.js"() {
31917
32692
  "use strict";
31918
32693
  init_entity();
31919
32694
  init_utils2();
31920
32695
  init_common4();
31921
- MySqlTextBuilder = class extends (_b202 = MySqlColumnBuilder, _a277 = entityKind, _b202) {
32696
+ MySqlTextBuilder = class extends (_b202 = MySqlColumnBuilder, _a279 = entityKind, _b202) {
31922
32697
  constructor(name2, textType, config) {
31923
32698
  super(name2, "string", "MySqlText");
31924
32699
  this.config.textType = textType;
@@ -31929,8 +32704,8 @@ var init_text3 = __esm({
31929
32704
  return new MySqlText(table4, this.config);
31930
32705
  }
31931
32706
  };
31932
- __publicField(MySqlTextBuilder, _a277, "MySqlTextBuilder");
31933
- MySqlText = class extends (_b203 = MySqlColumn, _a278 = entityKind, _b203) {
32707
+ __publicField(MySqlTextBuilder, _a279, "MySqlTextBuilder");
32708
+ MySqlText = class extends (_b203 = MySqlColumn, _a280 = entityKind, _b203) {
31934
32709
  constructor() {
31935
32710
  super(...arguments);
31936
32711
  __publicField(this, "textType", this.config.textType);
@@ -31940,7 +32715,7 @@ var init_text3 = __esm({
31940
32715
  return this.textType;
31941
32716
  }
31942
32717
  };
31943
- __publicField(MySqlText, _a278, "MySqlText");
32718
+ __publicField(MySqlText, _a280, "MySqlText");
31944
32719
  }
31945
32720
  });
31946
32721
 
@@ -31949,14 +32724,14 @@ function time2(a, b) {
31949
32724
  const { name: name2, config } = getColumnNameAndConfig(a, b);
31950
32725
  return new MySqlTimeBuilder(name2, config);
31951
32726
  }
31952
- var _a279, _b204, MySqlTimeBuilder, _a280, _b205, MySqlTime;
32727
+ var _a281, _b204, MySqlTimeBuilder, _a282, _b205, MySqlTime;
31953
32728
  var init_time2 = __esm({
31954
32729
  "../drizzle-orm/dist/mysql-core/columns/time.js"() {
31955
32730
  "use strict";
31956
32731
  init_entity();
31957
32732
  init_utils2();
31958
32733
  init_common4();
31959
- MySqlTimeBuilder = class extends (_b204 = MySqlColumnBuilder, _a279 = entityKind, _b204) {
32734
+ MySqlTimeBuilder = class extends (_b204 = MySqlColumnBuilder, _a281 = entityKind, _b204) {
31960
32735
  constructor(name2, config) {
31961
32736
  super(name2, "string", "MySqlTime");
31962
32737
  this.config.fsp = config?.fsp;
@@ -31966,8 +32741,8 @@ var init_time2 = __esm({
31966
32741
  return new MySqlTime(table4, this.config);
31967
32742
  }
31968
32743
  };
31969
- __publicField(MySqlTimeBuilder, _a279, "MySqlTimeBuilder");
31970
- MySqlTime = class extends (_b205 = MySqlColumn, _a280 = entityKind, _b205) {
32744
+ __publicField(MySqlTimeBuilder, _a281, "MySqlTimeBuilder");
32745
+ MySqlTime = class extends (_b205 = MySqlColumn, _a282 = entityKind, _b205) {
31971
32746
  constructor() {
31972
32747
  super(...arguments);
31973
32748
  __publicField(this, "fsp", this.config.fsp);
@@ -31977,19 +32752,19 @@ var init_time2 = __esm({
31977
32752
  return `time${precision}`;
31978
32753
  }
31979
32754
  };
31980
- __publicField(MySqlTime, _a280, "MySqlTime");
32755
+ __publicField(MySqlTime, _a282, "MySqlTime");
31981
32756
  }
31982
32757
  });
31983
32758
 
31984
32759
  // ../drizzle-orm/dist/mysql-core/columns/date.common.js
31985
- var _a281, _b206, MySqlDateColumnBaseBuilder, _a282, _b207, MySqlDateBaseColumn;
32760
+ var _a283, _b206, MySqlDateColumnBaseBuilder, _a284, _b207, MySqlDateBaseColumn;
31986
32761
  var init_date_common2 = __esm({
31987
32762
  "../drizzle-orm/dist/mysql-core/columns/date.common.js"() {
31988
32763
  "use strict";
31989
32764
  init_entity();
31990
32765
  init_sql();
31991
32766
  init_common4();
31992
- MySqlDateColumnBaseBuilder = class extends (_b206 = MySqlColumnBuilder, _a281 = entityKind, _b206) {
32767
+ MySqlDateColumnBaseBuilder = class extends (_b206 = MySqlColumnBuilder, _a283 = entityKind, _b206) {
31993
32768
  defaultNow() {
31994
32769
  return this.default(sql`(now())`);
31995
32770
  }
@@ -32000,14 +32775,14 @@ var init_date_common2 = __esm({
32000
32775
  return this;
32001
32776
  }
32002
32777
  };
32003
- __publicField(MySqlDateColumnBaseBuilder, _a281, "MySqlDateColumnBuilder");
32004
- MySqlDateBaseColumn = class extends (_b207 = MySqlColumn, _a282 = entityKind, _b207) {
32778
+ __publicField(MySqlDateColumnBaseBuilder, _a283, "MySqlDateColumnBuilder");
32779
+ MySqlDateBaseColumn = class extends (_b207 = MySqlColumn, _a284 = entityKind, _b207) {
32005
32780
  constructor() {
32006
32781
  super(...arguments);
32007
32782
  __publicField(this, "hasOnUpdateNow", this.config.hasOnUpdateNow);
32008
32783
  }
32009
32784
  };
32010
- __publicField(MySqlDateBaseColumn, _a282, "MySqlDateColumn");
32785
+ __publicField(MySqlDateBaseColumn, _a284, "MySqlDateColumn");
32011
32786
  }
32012
32787
  });
32013
32788
 
@@ -32019,14 +32794,14 @@ function timestamp2(a, b = {}) {
32019
32794
  }
32020
32795
  return new MySqlTimestampBuilder(name2, config);
32021
32796
  }
32022
- var _a283, _b208, MySqlTimestampBuilder, _a284, _b209, MySqlTimestamp, _a285, _b210, MySqlTimestampStringBuilder, _a286, _b211, MySqlTimestampString;
32797
+ var _a285, _b208, MySqlTimestampBuilder, _a286, _b209, MySqlTimestamp, _a287, _b210, MySqlTimestampStringBuilder, _a288, _b211, MySqlTimestampString;
32023
32798
  var init_timestamp2 = __esm({
32024
32799
  "../drizzle-orm/dist/mysql-core/columns/timestamp.js"() {
32025
32800
  "use strict";
32026
32801
  init_entity();
32027
32802
  init_utils2();
32028
32803
  init_date_common2();
32029
- MySqlTimestampBuilder = class extends (_b208 = MySqlDateColumnBaseBuilder, _a283 = entityKind, _b208) {
32804
+ MySqlTimestampBuilder = class extends (_b208 = MySqlDateColumnBaseBuilder, _a285 = entityKind, _b208) {
32030
32805
  constructor(name2, config) {
32031
32806
  super(name2, "date", "MySqlTimestamp");
32032
32807
  this.config.fsp = config?.fsp;
@@ -32039,8 +32814,8 @@ var init_timestamp2 = __esm({
32039
32814
  );
32040
32815
  }
32041
32816
  };
32042
- __publicField(MySqlTimestampBuilder, _a283, "MySqlTimestampBuilder");
32043
- MySqlTimestamp = class extends (_b209 = MySqlDateBaseColumn, _a284 = entityKind, _b209) {
32817
+ __publicField(MySqlTimestampBuilder, _a285, "MySqlTimestampBuilder");
32818
+ MySqlTimestamp = class extends (_b209 = MySqlDateBaseColumn, _a286 = entityKind, _b209) {
32044
32819
  constructor() {
32045
32820
  super(...arguments);
32046
32821
  __publicField(this, "fsp", this.config.fsp);
@@ -32056,8 +32831,8 @@ var init_timestamp2 = __esm({
32056
32831
  return value.toISOString().slice(0, -1).replace("T", " ");
32057
32832
  }
32058
32833
  };
32059
- __publicField(MySqlTimestamp, _a284, "MySqlTimestamp");
32060
- MySqlTimestampStringBuilder = class extends (_b210 = MySqlDateColumnBaseBuilder, _a285 = entityKind, _b210) {
32834
+ __publicField(MySqlTimestamp, _a286, "MySqlTimestamp");
32835
+ MySqlTimestampStringBuilder = class extends (_b210 = MySqlDateColumnBaseBuilder, _a287 = entityKind, _b210) {
32061
32836
  constructor(name2, config) {
32062
32837
  super(name2, "string", "MySqlTimestampString");
32063
32838
  this.config.fsp = config?.fsp;
@@ -32070,8 +32845,8 @@ var init_timestamp2 = __esm({
32070
32845
  );
32071
32846
  }
32072
32847
  };
32073
- __publicField(MySqlTimestampStringBuilder, _a285, "MySqlTimestampStringBuilder");
32074
- MySqlTimestampString = class extends (_b211 = MySqlDateBaseColumn, _a286 = entityKind, _b211) {
32848
+ __publicField(MySqlTimestampStringBuilder, _a287, "MySqlTimestampStringBuilder");
32849
+ MySqlTimestampString = class extends (_b211 = MySqlDateBaseColumn, _a288 = entityKind, _b211) {
32075
32850
  constructor() {
32076
32851
  super(...arguments);
32077
32852
  __publicField(this, "fsp", this.config.fsp);
@@ -32081,7 +32856,7 @@ var init_timestamp2 = __esm({
32081
32856
  return `timestamp${precision}`;
32082
32857
  }
32083
32858
  };
32084
- __publicField(MySqlTimestampString, _a286, "MySqlTimestampString");
32859
+ __publicField(MySqlTimestampString, _a288, "MySqlTimestampString");
32085
32860
  }
32086
32861
  });
32087
32862
 
@@ -32090,14 +32865,14 @@ function tinyint(a, b) {
32090
32865
  const { name: name2, config } = getColumnNameAndConfig(a, b);
32091
32866
  return new MySqlTinyIntBuilder(name2, config);
32092
32867
  }
32093
- var _a287, _b212, MySqlTinyIntBuilder, _a288, _b213, MySqlTinyInt;
32868
+ var _a289, _b212, MySqlTinyIntBuilder, _a290, _b213, MySqlTinyInt;
32094
32869
  var init_tinyint = __esm({
32095
32870
  "../drizzle-orm/dist/mysql-core/columns/tinyint.js"() {
32096
32871
  "use strict";
32097
32872
  init_entity();
32098
32873
  init_utils2();
32099
32874
  init_common4();
32100
- MySqlTinyIntBuilder = class extends (_b212 = MySqlColumnBuilderWithAutoIncrement, _a287 = entityKind, _b212) {
32875
+ MySqlTinyIntBuilder = class extends (_b212 = MySqlColumnBuilderWithAutoIncrement, _a289 = entityKind, _b212) {
32101
32876
  constructor(name2, config) {
32102
32877
  super(name2, "number", "MySqlTinyInt");
32103
32878
  this.config.unsigned = config ? config.unsigned : false;
@@ -32110,8 +32885,8 @@ var init_tinyint = __esm({
32110
32885
  );
32111
32886
  }
32112
32887
  };
32113
- __publicField(MySqlTinyIntBuilder, _a287, "MySqlTinyIntBuilder");
32114
- MySqlTinyInt = class extends (_b213 = MySqlColumnWithAutoIncrement, _a288 = entityKind, _b213) {
32888
+ __publicField(MySqlTinyIntBuilder, _a289, "MySqlTinyIntBuilder");
32889
+ MySqlTinyInt = class extends (_b213 = MySqlColumnWithAutoIncrement, _a290 = entityKind, _b213) {
32115
32890
  getSQLType() {
32116
32891
  return `tinyint${this.config.unsigned ? " unsigned" : ""}`;
32117
32892
  }
@@ -32122,7 +32897,7 @@ var init_tinyint = __esm({
32122
32897
  return value;
32123
32898
  }
32124
32899
  };
32125
- __publicField(MySqlTinyInt, _a288, "MySqlTinyInt");
32900
+ __publicField(MySqlTinyInt, _a290, "MySqlTinyInt");
32126
32901
  }
32127
32902
  });
32128
32903
 
@@ -32131,14 +32906,14 @@ function varbinary(a, b) {
32131
32906
  const { name: name2, config } = getColumnNameAndConfig(a, b);
32132
32907
  return new MySqlVarBinaryBuilder(name2, config);
32133
32908
  }
32134
- var _a289, _b214, MySqlVarBinaryBuilder, _a290, _b215, MySqlVarBinary;
32909
+ var _a291, _b214, MySqlVarBinaryBuilder, _a292, _b215, MySqlVarBinary;
32135
32910
  var init_varbinary = __esm({
32136
32911
  "../drizzle-orm/dist/mysql-core/columns/varbinary.js"() {
32137
32912
  "use strict";
32138
32913
  init_entity();
32139
32914
  init_utils2();
32140
32915
  init_common4();
32141
- MySqlVarBinaryBuilder = class extends (_b214 = MySqlColumnBuilder, _a289 = entityKind, _b214) {
32916
+ MySqlVarBinaryBuilder = class extends (_b214 = MySqlColumnBuilder, _a291 = entityKind, _b214) {
32142
32917
  /** @internal */
32143
32918
  constructor(name2, config) {
32144
32919
  super(name2, "string", "MySqlVarBinary");
@@ -32152,8 +32927,8 @@ var init_varbinary = __esm({
32152
32927
  );
32153
32928
  }
32154
32929
  };
32155
- __publicField(MySqlVarBinaryBuilder, _a289, "MySqlVarBinaryBuilder");
32156
- MySqlVarBinary = class extends (_b215 = MySqlColumn, _a290 = entityKind, _b215) {
32930
+ __publicField(MySqlVarBinaryBuilder, _a291, "MySqlVarBinaryBuilder");
32931
+ MySqlVarBinary = class extends (_b215 = MySqlColumn, _a292 = entityKind, _b215) {
32157
32932
  constructor() {
32158
32933
  super(...arguments);
32159
32934
  __publicField(this, "length", this.config.length);
@@ -32162,7 +32937,7 @@ var init_varbinary = __esm({
32162
32937
  return this.length === void 0 ? `varbinary` : `varbinary(${this.length})`;
32163
32938
  }
32164
32939
  };
32165
- __publicField(MySqlVarBinary, _a290, "MySqlVarBinary");
32940
+ __publicField(MySqlVarBinary, _a292, "MySqlVarBinary");
32166
32941
  }
32167
32942
  });
32168
32943
 
@@ -32171,14 +32946,14 @@ function varchar2(a, b) {
32171
32946
  const { name: name2, config } = getColumnNameAndConfig(a, b);
32172
32947
  return new MySqlVarCharBuilder(name2, config);
32173
32948
  }
32174
- var _a291, _b216, MySqlVarCharBuilder, _a292, _b217, MySqlVarChar;
32949
+ var _a293, _b216, MySqlVarCharBuilder, _a294, _b217, MySqlVarChar;
32175
32950
  var init_varchar2 = __esm({
32176
32951
  "../drizzle-orm/dist/mysql-core/columns/varchar.js"() {
32177
32952
  "use strict";
32178
32953
  init_entity();
32179
32954
  init_utils2();
32180
32955
  init_common4();
32181
- MySqlVarCharBuilder = class extends (_b216 = MySqlColumnBuilder, _a291 = entityKind, _b216) {
32956
+ MySqlVarCharBuilder = class extends (_b216 = MySqlColumnBuilder, _a293 = entityKind, _b216) {
32182
32957
  /** @internal */
32183
32958
  constructor(name2, config) {
32184
32959
  super(name2, "string", "MySqlVarChar");
@@ -32193,8 +32968,8 @@ var init_varchar2 = __esm({
32193
32968
  );
32194
32969
  }
32195
32970
  };
32196
- __publicField(MySqlVarCharBuilder, _a291, "MySqlVarCharBuilder");
32197
- MySqlVarChar = class extends (_b217 = MySqlColumn, _a292 = entityKind, _b217) {
32971
+ __publicField(MySqlVarCharBuilder, _a293, "MySqlVarCharBuilder");
32972
+ MySqlVarChar = class extends (_b217 = MySqlColumn, _a294 = entityKind, _b217) {
32198
32973
  constructor() {
32199
32974
  super(...arguments);
32200
32975
  __publicField(this, "length", this.config.length);
@@ -32204,7 +32979,7 @@ var init_varchar2 = __esm({
32204
32979
  return this.length === void 0 ? `varchar` : `varchar(${this.length})`;
32205
32980
  }
32206
32981
  };
32207
- __publicField(MySqlVarChar, _a292, "MySqlVarChar");
32982
+ __publicField(MySqlVarChar, _a294, "MySqlVarChar");
32208
32983
  }
32209
32984
  });
32210
32985
 
@@ -32212,13 +32987,13 @@ var init_varchar2 = __esm({
32212
32987
  function year(name2) {
32213
32988
  return new MySqlYearBuilder(name2 ?? "");
32214
32989
  }
32215
- var _a293, _b218, MySqlYearBuilder, _a294, _b219, MySqlYear;
32990
+ var _a295, _b218, MySqlYearBuilder, _a296, _b219, MySqlYear;
32216
32991
  var init_year = __esm({
32217
32992
  "../drizzle-orm/dist/mysql-core/columns/year.js"() {
32218
32993
  "use strict";
32219
32994
  init_entity();
32220
32995
  init_common4();
32221
- MySqlYearBuilder = class extends (_b218 = MySqlColumnBuilder, _a293 = entityKind, _b218) {
32996
+ MySqlYearBuilder = class extends (_b218 = MySqlColumnBuilder, _a295 = entityKind, _b218) {
32222
32997
  constructor(name2) {
32223
32998
  super(name2, "number", "MySqlYear");
32224
32999
  }
@@ -32227,13 +33002,13 @@ var init_year = __esm({
32227
33002
  return new MySqlYear(table4, this.config);
32228
33003
  }
32229
33004
  };
32230
- __publicField(MySqlYearBuilder, _a293, "MySqlYearBuilder");
32231
- MySqlYear = class extends (_b219 = MySqlColumn, _a294 = entityKind, _b219) {
33005
+ __publicField(MySqlYearBuilder, _a295, "MySqlYearBuilder");
33006
+ MySqlYear = class extends (_b219 = MySqlColumn, _a296 = entityKind, _b219) {
32232
33007
  getSQLType() {
32233
33008
  return `year`;
32234
33009
  }
32235
33010
  };
32236
- __publicField(MySqlYear, _a294, "MySqlYear");
33011
+ __publicField(MySqlYear, _a296, "MySqlYear");
32237
33012
  }
32238
33013
  });
32239
33014
 
@@ -32270,17 +33045,17 @@ var init_columns3 = __esm({
32270
33045
  });
32271
33046
 
32272
33047
  // ../drizzle-orm/dist/mysql-core/query-builders/count.js
32273
- var _a295, _b220, _c9, _MySqlCountBuilder, MySqlCountBuilder;
33048
+ var _a297, _b220, _c9, _MySqlCountBuilder, MySqlCountBuilder;
32274
33049
  var init_count3 = __esm({
32275
33050
  "../drizzle-orm/dist/mysql-core/query-builders/count.js"() {
32276
33051
  "use strict";
32277
33052
  init_entity();
32278
33053
  init_sql();
32279
- _MySqlCountBuilder = class _MySqlCountBuilder extends (_c9 = SQL, _b220 = entityKind, _a295 = Symbol.toStringTag, _c9) {
33054
+ _MySqlCountBuilder = class _MySqlCountBuilder extends (_c9 = SQL, _b220 = entityKind, _a297 = Symbol.toStringTag, _c9) {
32280
33055
  constructor(params) {
32281
33056
  super(_MySqlCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
32282
33057
  __publicField(this, "sql");
32283
- __publicField(this, _a295, "MySqlCountBuilder");
33058
+ __publicField(this, _a297, "MySqlCountBuilder");
32284
33059
  __publicField(this, "session");
32285
33060
  this.params = params;
32286
33061
  this.mapWith(Number);
@@ -32324,13 +33099,13 @@ var init_count3 = __esm({
32324
33099
  });
32325
33100
 
32326
33101
  // ../drizzle-orm/dist/mysql-core/query-builders/delete.js
32327
- var _a296, _b221, MySqlDeleteBase;
33102
+ var _a298, _b221, MySqlDeleteBase;
32328
33103
  var init_delete3 = __esm({
32329
33104
  "../drizzle-orm/dist/mysql-core/query-builders/delete.js"() {
32330
33105
  "use strict";
32331
33106
  init_entity();
32332
33107
  init_query_promise();
32333
- MySqlDeleteBase = class extends (_b221 = QueryPromise, _a296 = entityKind, _b221) {
33108
+ MySqlDeleteBase = class extends (_b221 = QueryPromise, _a298 = entityKind, _b221) {
32334
33109
  constructor(table4, session, dialect4, withList) {
32335
33110
  super();
32336
33111
  __publicField(this, "config");
@@ -32400,12 +33175,12 @@ var init_delete3 = __esm({
32400
33175
  return this;
32401
33176
  }
32402
33177
  };
32403
- __publicField(MySqlDeleteBase, _a296, "MySqlDelete");
33178
+ __publicField(MySqlDeleteBase, _a298, "MySqlDelete");
32404
33179
  }
32405
33180
  });
32406
33181
 
32407
33182
  // ../drizzle-orm/dist/mysql-core/query-builders/insert.js
32408
- var _a297, MySqlInsertBuilder, _a298, _b222, MySqlInsertBase;
33183
+ var _a299, MySqlInsertBuilder, _a300, _b222, MySqlInsertBase;
32409
33184
  var init_insert3 = __esm({
32410
33185
  "../drizzle-orm/dist/mysql-core/query-builders/insert.js"() {
32411
33186
  "use strict";
@@ -32414,7 +33189,7 @@ var init_insert3 = __esm({
32414
33189
  init_sql();
32415
33190
  init_table();
32416
33191
  init_utils2();
32417
- _a297 = entityKind;
33192
+ _a299 = entityKind;
32418
33193
  MySqlInsertBuilder = class {
32419
33194
  constructor(table4, session, dialect4) {
32420
33195
  __publicField(this, "shouldIgnore", false);
@@ -32443,8 +33218,8 @@ var init_insert3 = __esm({
32443
33218
  return new MySqlInsertBase(this.table, mappedValues, this.shouldIgnore, this.session, this.dialect);
32444
33219
  }
32445
33220
  };
32446
- __publicField(MySqlInsertBuilder, _a297, "MySqlInsertBuilder");
32447
- MySqlInsertBase = class extends (_b222 = QueryPromise, _a298 = entityKind, _b222) {
33221
+ __publicField(MySqlInsertBuilder, _a299, "MySqlInsertBuilder");
33222
+ MySqlInsertBase = class extends (_b222 = QueryPromise, _a300 = entityKind, _b222) {
32448
33223
  constructor(table4, values, ignore, session, dialect4) {
32449
33224
  super();
32450
33225
  __publicField(this, "config");
@@ -32525,7 +33300,7 @@ var init_insert3 = __esm({
32525
33300
  return this;
32526
33301
  }
32527
33302
  };
32528
- __publicField(MySqlInsertBase, _a298, "MySqlInsert");
33303
+ __publicField(MySqlInsertBase, _a300, "MySqlInsert");
32529
33304
  }
32530
33305
  });
32531
33306
 
@@ -32609,7 +33384,7 @@ function mysqlTableWithSchema(name2, columns, extraConfig, schema4, baseName = n
32609
33384
  }
32610
33385
  return table4;
32611
33386
  }
32612
- var InlineForeignKeys3, _a299, _b223, _c10, _d4, _e3, MySqlTable, mysqlTable;
33387
+ var InlineForeignKeys3, _a301, _b223, _c10, _d4, _e3, MySqlTable, mysqlTable;
32613
33388
  var init_table4 = __esm({
32614
33389
  "../drizzle-orm/dist/mysql-core/table.js"() {
32615
33390
  "use strict";
@@ -32617,7 +33392,7 @@ var init_table4 = __esm({
32617
33392
  init_table();
32618
33393
  init_all3();
32619
33394
  InlineForeignKeys3 = Symbol.for("drizzle:MySqlInlineForeignKeys");
32620
- MySqlTable = class extends (_e3 = Table, _d4 = entityKind, _c10 = Table.Symbol.Columns, _b223 = InlineForeignKeys3, _a299 = Table.Symbol.ExtraConfigBuilder, _e3) {
33395
+ MySqlTable = class extends (_e3 = Table, _d4 = entityKind, _c10 = Table.Symbol.Columns, _b223 = InlineForeignKeys3, _a301 = Table.Symbol.ExtraConfigBuilder, _e3) {
32621
33396
  constructor() {
32622
33397
  super(...arguments);
32623
33398
  /** @internal */
@@ -32625,7 +33400,7 @@ var init_table4 = __esm({
32625
33400
  /** @internal */
32626
33401
  __publicField(this, _b223, []);
32627
33402
  /** @internal */
32628
- __publicField(this, _a299);
33403
+ __publicField(this, _a301);
32629
33404
  }
32630
33405
  };
32631
33406
  __publicField(MySqlTable, _d4, "MySqlTable");
@@ -32640,20 +33415,20 @@ var init_table4 = __esm({
32640
33415
  });
32641
33416
 
32642
33417
  // ../drizzle-orm/dist/mysql-core/view-base.js
32643
- var _a300, _b224, MySqlViewBase;
33418
+ var _a302, _b224, MySqlViewBase;
32644
33419
  var init_view_base3 = __esm({
32645
33420
  "../drizzle-orm/dist/mysql-core/view-base.js"() {
32646
33421
  "use strict";
32647
33422
  init_entity();
32648
33423
  init_sql();
32649
- MySqlViewBase = class extends (_b224 = View, _a300 = entityKind, _b224) {
33424
+ MySqlViewBase = class extends (_b224 = View, _a302 = entityKind, _b224) {
32650
33425
  };
32651
- __publicField(MySqlViewBase, _a300, "MySqlViewBase");
33426
+ __publicField(MySqlViewBase, _a302, "MySqlViewBase");
32652
33427
  }
32653
33428
  });
32654
33429
 
32655
33430
  // ../drizzle-orm/dist/mysql-core/dialect.js
32656
- var _a301, MySqlDialect;
33431
+ var _a303, MySqlDialect;
32657
33432
  var init_dialect3 = __esm({
32658
33433
  "../drizzle-orm/dist/mysql-core/dialect.js"() {
32659
33434
  "use strict";
@@ -32672,7 +33447,7 @@ var init_dialect3 = __esm({
32672
33447
  init_common4();
32673
33448
  init_table4();
32674
33449
  init_view_base3();
32675
- _a301 = entityKind;
33450
+ _a303 = entityKind;
32676
33451
  MySqlDialect = class {
32677
33452
  constructor(config) {
32678
33453
  /** @internal */
@@ -33454,7 +34229,7 @@ var init_dialect3 = __esm({
33454
34229
  };
33455
34230
  }
33456
34231
  };
33457
- __publicField(MySqlDialect, _a301, "MySqlDialect");
34232
+ __publicField(MySqlDialect, _a303, "MySqlDialect");
33458
34233
  }
33459
34234
  });
33460
34235
 
@@ -33476,7 +34251,7 @@ function createSetOperator3(type, isAll) {
33476
34251
  return leftSelect.addSetOperators(setOperators);
33477
34252
  };
33478
34253
  }
33479
- var _a302, MySqlSelectBuilder, _a303, _b225, MySqlSelectQueryBuilderBase, _a304, _b226, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
34254
+ var _a304, MySqlSelectBuilder, _a305, _b225, MySqlSelectQueryBuilderBase, _a306, _b226, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
33480
34255
  var init_select4 = __esm({
33481
34256
  "../drizzle-orm/dist/mysql-core/query-builders/select.js"() {
33482
34257
  "use strict";
@@ -33491,7 +34266,7 @@ var init_select4 = __esm({
33491
34266
  init_utils2();
33492
34267
  init_view_common();
33493
34268
  init_view_base3();
33494
- _a302 = entityKind;
34269
+ _a304 = entityKind;
33495
34270
  MySqlSelectBuilder = class {
33496
34271
  constructor(config) {
33497
34272
  __publicField(this, "fields");
@@ -33536,8 +34311,8 @@ var init_select4 = __esm({
33536
34311
  );
33537
34312
  }
33538
34313
  };
33539
- __publicField(MySqlSelectBuilder, _a302, "MySqlSelectBuilder");
33540
- MySqlSelectQueryBuilderBase = class extends (_b225 = TypedQueryBuilder, _a303 = entityKind, _b225) {
34314
+ __publicField(MySqlSelectBuilder, _a304, "MySqlSelectBuilder");
34315
+ MySqlSelectQueryBuilderBase = class extends (_b225 = TypedQueryBuilder, _a305 = entityKind, _b225) {
33541
34316
  constructor({ table: table4, fields, isPartialSelect, session, dialect: dialect4, withList, distinct }) {
33542
34317
  super();
33543
34318
  __publicField(this, "_");
@@ -34138,8 +34913,8 @@ var init_select4 = __esm({
34138
34913
  return this;
34139
34914
  }
34140
34915
  };
34141
- __publicField(MySqlSelectQueryBuilderBase, _a303, "MySqlSelectQueryBuilder");
34142
- MySqlSelectBase = class extends (_b226 = MySqlSelectQueryBuilderBase, _a304 = entityKind, _b226) {
34916
+ __publicField(MySqlSelectQueryBuilderBase, _a305, "MySqlSelectQueryBuilder");
34917
+ MySqlSelectBase = class extends (_b226 = MySqlSelectQueryBuilderBase, _a306 = entityKind, _b226) {
34143
34918
  constructor() {
34144
34919
  super(...arguments);
34145
34920
  __publicField(this, "execute", (placeholderValues) => {
@@ -34163,7 +34938,7 @@ var init_select4 = __esm({
34163
34938
  return query;
34164
34939
  }
34165
34940
  };
34166
- __publicField(MySqlSelectBase, _a304, "MySqlSelect");
34941
+ __publicField(MySqlSelectBase, _a306, "MySqlSelect");
34167
34942
  applyMixins(MySqlSelectBase, [QueryPromise]);
34168
34943
  getMySqlSetOperators = () => ({
34169
34944
  union: union3,
@@ -34183,7 +34958,7 @@ var init_select4 = __esm({
34183
34958
  });
34184
34959
 
34185
34960
  // ../drizzle-orm/dist/mysql-core/query-builders/query-builder.js
34186
- var _a305, QueryBuilder3;
34961
+ var _a307, QueryBuilder3;
34187
34962
  var init_query_builder4 = __esm({
34188
34963
  "../drizzle-orm/dist/mysql-core/query-builders/query-builder.js"() {
34189
34964
  "use strict";
@@ -34192,7 +34967,7 @@ var init_query_builder4 = __esm({
34192
34967
  init_selection_proxy();
34193
34968
  init_subquery();
34194
34969
  init_select4();
34195
- _a305 = entityKind;
34970
+ _a307 = entityKind;
34196
34971
  QueryBuilder3 = class {
34197
34972
  constructor(dialect4) {
34198
34973
  __publicField(this, "dialect");
@@ -34254,7 +35029,7 @@ var init_query_builder4 = __esm({
34254
35029
  return this.dialect;
34255
35030
  }
34256
35031
  };
34257
- __publicField(QueryBuilder3, _a305, "MySqlQueryBuilder");
35032
+ __publicField(QueryBuilder3, _a307, "MySqlQueryBuilder");
34258
35033
  }
34259
35034
  });
34260
35035
 
@@ -34266,14 +35041,14 @@ var init_select_types3 = __esm({
34266
35041
  });
34267
35042
 
34268
35043
  // ../drizzle-orm/dist/mysql-core/query-builders/update.js
34269
- var _a306, MySqlUpdateBuilder, _a307, _b227, MySqlUpdateBase;
35044
+ var _a308, MySqlUpdateBuilder, _a309, _b227, MySqlUpdateBase;
34270
35045
  var init_update3 = __esm({
34271
35046
  "../drizzle-orm/dist/mysql-core/query-builders/update.js"() {
34272
35047
  "use strict";
34273
35048
  init_entity();
34274
35049
  init_query_promise();
34275
35050
  init_utils2();
34276
- _a306 = entityKind;
35051
+ _a308 = entityKind;
34277
35052
  MySqlUpdateBuilder = class {
34278
35053
  constructor(table4, session, dialect4, withList) {
34279
35054
  this.table = table4;
@@ -34285,8 +35060,8 @@ var init_update3 = __esm({
34285
35060
  return new MySqlUpdateBase(this.table, mapUpdateSet(this.table, values), this.session, this.dialect, this.withList);
34286
35061
  }
34287
35062
  };
34288
- __publicField(MySqlUpdateBuilder, _a306, "MySqlUpdateBuilder");
34289
- MySqlUpdateBase = class extends (_b227 = QueryPromise, _a307 = entityKind, _b227) {
35063
+ __publicField(MySqlUpdateBuilder, _a308, "MySqlUpdateBuilder");
35064
+ MySqlUpdateBase = class extends (_b227 = QueryPromise, _a309 = entityKind, _b227) {
34290
35065
  constructor(table4, set, session, dialect4, withList) {
34291
35066
  super();
34292
35067
  __publicField(this, "config");
@@ -34359,7 +35134,7 @@ var init_update3 = __esm({
34359
35134
  return this;
34360
35135
  }
34361
35136
  };
34362
- __publicField(MySqlUpdateBase, _a307, "MySqlUpdate");
35137
+ __publicField(MySqlUpdateBase, _a309, "MySqlUpdate");
34363
35138
  }
34364
35139
  });
34365
35140
 
@@ -34377,14 +35152,14 @@ var init_query_builders3 = __esm({
34377
35152
  });
34378
35153
 
34379
35154
  // ../drizzle-orm/dist/mysql-core/query-builders/query.js
34380
- var _a308, RelationalQueryBuilder3, _a309, _b228, MySqlRelationalQuery;
35155
+ var _a310, RelationalQueryBuilder3, _a311, _b228, MySqlRelationalQuery;
34381
35156
  var init_query3 = __esm({
34382
35157
  "../drizzle-orm/dist/mysql-core/query-builders/query.js"() {
34383
35158
  "use strict";
34384
35159
  init_entity();
34385
35160
  init_query_promise();
34386
35161
  init_relations();
34387
- _a308 = entityKind;
35162
+ _a310 = entityKind;
34388
35163
  RelationalQueryBuilder3 = class {
34389
35164
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, mode) {
34390
35165
  this.fullSchema = fullSchema;
@@ -34425,8 +35200,8 @@ var init_query3 = __esm({
34425
35200
  );
34426
35201
  }
34427
35202
  };
34428
- __publicField(RelationalQueryBuilder3, _a308, "MySqlRelationalQueryBuilder");
34429
- MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a309 = entityKind, _b228) {
35203
+ __publicField(RelationalQueryBuilder3, _a310, "MySqlRelationalQueryBuilder");
35204
+ MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a311 = entityKind, _b228) {
34430
35205
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, config, queryMode, mode) {
34431
35206
  super();
34432
35207
  this.fullSchema = fullSchema;
@@ -34490,12 +35265,12 @@ var init_query3 = __esm({
34490
35265
  return this.prepare().execute();
34491
35266
  }
34492
35267
  };
34493
- __publicField(MySqlRelationalQuery, _a309, "MySqlRelationalQuery");
35268
+ __publicField(MySqlRelationalQuery, _a311, "MySqlRelationalQuery");
34494
35269
  }
34495
35270
  });
34496
35271
 
34497
35272
  // ../drizzle-orm/dist/mysql-core/db.js
34498
- var _a310, MySqlDatabase;
35273
+ var _a312, MySqlDatabase;
34499
35274
  var init_db3 = __esm({
34500
35275
  "../drizzle-orm/dist/mysql-core/db.js"() {
34501
35276
  "use strict";
@@ -34506,7 +35281,7 @@ var init_db3 = __esm({
34506
35281
  init_count3();
34507
35282
  init_query_builders3();
34508
35283
  init_query3();
34509
- _a310 = entityKind;
35284
+ _a312 = entityKind;
34510
35285
  MySqlDatabase = class {
34511
35286
  constructor(dialect4, session, schema4, mode) {
34512
35287
  __publicField(this, "query");
@@ -34719,17 +35494,17 @@ var init_db3 = __esm({
34719
35494
  return this.session.transaction(transaction, config);
34720
35495
  }
34721
35496
  };
34722
- __publicField(MySqlDatabase, _a310, "MySqlDatabase");
35497
+ __publicField(MySqlDatabase, _a312, "MySqlDatabase");
34723
35498
  }
34724
35499
  });
34725
35500
 
34726
35501
  // ../drizzle-orm/dist/mysql-core/indexes.js
34727
- var _a311, IndexBuilderOn3, _a312, IndexBuilder3, _a313, Index5;
35502
+ var _a313, IndexBuilderOn3, _a314, IndexBuilder3, _a315, Index5;
34728
35503
  var init_indexes3 = __esm({
34729
35504
  "../drizzle-orm/dist/mysql-core/indexes.js"() {
34730
35505
  "use strict";
34731
35506
  init_entity();
34732
- _a311 = entityKind;
35507
+ _a313 = entityKind;
34733
35508
  IndexBuilderOn3 = class {
34734
35509
  constructor(name2, unique) {
34735
35510
  this.name = name2;
@@ -34739,8 +35514,8 @@ var init_indexes3 = __esm({
34739
35514
  return new IndexBuilder3(this.name, columns, this.unique);
34740
35515
  }
34741
35516
  };
34742
- __publicField(IndexBuilderOn3, _a311, "MySqlIndexBuilderOn");
34743
- _a312 = entityKind;
35517
+ __publicField(IndexBuilderOn3, _a313, "MySqlIndexBuilderOn");
35518
+ _a314 = entityKind;
34744
35519
  IndexBuilder3 = class {
34745
35520
  constructor(name2, columns, unique) {
34746
35521
  /** @internal */
@@ -34768,26 +35543,26 @@ var init_indexes3 = __esm({
34768
35543
  return new Index5(this.config, table4);
34769
35544
  }
34770
35545
  };
34771
- __publicField(IndexBuilder3, _a312, "MySqlIndexBuilder");
34772
- _a313 = entityKind;
35546
+ __publicField(IndexBuilder3, _a314, "MySqlIndexBuilder");
35547
+ _a315 = entityKind;
34773
35548
  Index5 = class {
34774
35549
  constructor(config, table4) {
34775
35550
  __publicField(this, "config");
34776
35551
  this.config = { ...config, table: table4 };
34777
35552
  }
34778
35553
  };
34779
- __publicField(Index5, _a313, "MySqlIndex");
35554
+ __publicField(Index5, _a315, "MySqlIndex");
34780
35555
  }
34781
35556
  });
34782
35557
 
34783
35558
  // ../drizzle-orm/dist/mysql-core/primary-keys.js
34784
- var _a314, PrimaryKeyBuilder3, _a315, PrimaryKey3;
35559
+ var _a316, PrimaryKeyBuilder3, _a317, PrimaryKey3;
34785
35560
  var init_primary_keys3 = __esm({
34786
35561
  "../drizzle-orm/dist/mysql-core/primary-keys.js"() {
34787
35562
  "use strict";
34788
35563
  init_entity();
34789
35564
  init_table4();
34790
- _a314 = entityKind;
35565
+ _a316 = entityKind;
34791
35566
  PrimaryKeyBuilder3 = class {
34792
35567
  constructor(columns, name2) {
34793
35568
  /** @internal */
@@ -34802,8 +35577,8 @@ var init_primary_keys3 = __esm({
34802
35577
  return new PrimaryKey3(table4, this.columns, this.name);
34803
35578
  }
34804
35579
  };
34805
- __publicField(PrimaryKeyBuilder3, _a314, "MySqlPrimaryKeyBuilder");
34806
- _a315 = entityKind;
35580
+ __publicField(PrimaryKeyBuilder3, _a316, "MySqlPrimaryKeyBuilder");
35581
+ _a317 = entityKind;
34807
35582
  PrimaryKey3 = class {
34808
35583
  constructor(table4, columns, name2) {
34809
35584
  __publicField(this, "columns");
@@ -34816,7 +35591,7 @@ var init_primary_keys3 = __esm({
34816
35591
  return this.name ?? `${this.table[MySqlTable.Symbol.Name]}_${this.columns.map((column4) => column4.name).join("_")}_pk`;
34817
35592
  }
34818
35593
  };
34819
- __publicField(PrimaryKey3, _a315, "MySqlPrimaryKey");
35594
+ __publicField(PrimaryKey3, _a317, "MySqlPrimaryKey");
34820
35595
  }
34821
35596
  });
34822
35597
 
@@ -34836,7 +35611,7 @@ function mysqlViewWithSchema(name2, selection, schema4) {
34836
35611
  }
34837
35612
  return new ViewBuilder3(name2, schema4);
34838
35613
  }
34839
- var _a316, ViewBuilderCore2, _a317, _b229, ViewBuilder3, _a318, _b230, ManualViewBuilder3, _a319, _b231, _c11, MySqlView;
35614
+ var _a318, ViewBuilderCore2, _a319, _b229, ViewBuilder3, _a320, _b230, ManualViewBuilder3, _a321, _b231, _c11, MySqlView;
34840
35615
  var init_view3 = __esm({
34841
35616
  "../drizzle-orm/dist/mysql-core/view.js"() {
34842
35617
  "use strict";
@@ -34847,7 +35622,7 @@ var init_view3 = __esm({
34847
35622
  init_table4();
34848
35623
  init_view_base3();
34849
35624
  init_view_common4();
34850
- _a316 = entityKind;
35625
+ _a318 = entityKind;
34851
35626
  ViewBuilderCore2 = class {
34852
35627
  constructor(name2, schema4) {
34853
35628
  __publicField(this, "config", {});
@@ -34871,8 +35646,8 @@ var init_view3 = __esm({
34871
35646
  return this;
34872
35647
  }
34873
35648
  };
34874
- __publicField(ViewBuilderCore2, _a316, "MySqlViewBuilder");
34875
- ViewBuilder3 = class extends (_b229 = ViewBuilderCore2, _a317 = entityKind, _b229) {
35649
+ __publicField(ViewBuilderCore2, _a318, "MySqlViewBuilder");
35650
+ ViewBuilder3 = class extends (_b229 = ViewBuilderCore2, _a319 = entityKind, _b229) {
34876
35651
  as(qb) {
34877
35652
  if (typeof qb === "function") {
34878
35653
  qb = qb(new QueryBuilder3());
@@ -34898,8 +35673,8 @@ var init_view3 = __esm({
34898
35673
  );
34899
35674
  }
34900
35675
  };
34901
- __publicField(ViewBuilder3, _a317, "MySqlViewBuilder");
34902
- ManualViewBuilder3 = class extends (_b230 = ViewBuilderCore2, _a318 = entityKind, _b230) {
35676
+ __publicField(ViewBuilder3, _a319, "MySqlViewBuilder");
35677
+ ManualViewBuilder3 = class extends (_b230 = ViewBuilderCore2, _a320 = entityKind, _b230) {
34903
35678
  constructor(name2, columns, schema4) {
34904
35679
  super(name2, schema4);
34905
35680
  __publicField(this, "columns");
@@ -34944,11 +35719,11 @@ var init_view3 = __esm({
34944
35719
  );
34945
35720
  }
34946
35721
  };
34947
- __publicField(ManualViewBuilder3, _a318, "MySqlManualViewBuilder");
34948
- MySqlView = class extends (_c11 = MySqlViewBase, _b231 = entityKind, _a319 = MySqlViewConfig, _c11) {
35722
+ __publicField(ManualViewBuilder3, _a320, "MySqlManualViewBuilder");
35723
+ MySqlView = class extends (_c11 = MySqlViewBase, _b231 = entityKind, _a321 = MySqlViewConfig, _c11) {
34949
35724
  constructor({ mysqlConfig, config }) {
34950
35725
  super(config);
34951
- __publicField(this, _a319);
35726
+ __publicField(this, _a321);
34952
35727
  this[MySqlViewConfig] = mysqlConfig;
34953
35728
  }
34954
35729
  };
@@ -34957,14 +35732,14 @@ var init_view3 = __esm({
34957
35732
  });
34958
35733
 
34959
35734
  // ../drizzle-orm/dist/mysql-core/schema.js
34960
- var _a320, MySqlSchema5;
35735
+ var _a322, MySqlSchema5;
34961
35736
  var init_schema2 = __esm({
34962
35737
  "../drizzle-orm/dist/mysql-core/schema.js"() {
34963
35738
  "use strict";
34964
35739
  init_entity();
34965
35740
  init_table4();
34966
35741
  init_view3();
34967
- _a320 = entityKind;
35742
+ _a322 = entityKind;
34968
35743
  MySqlSchema5 = class {
34969
35744
  constructor(schemaName) {
34970
35745
  __publicField(this, "table", (name2, columns, extraConfig) => {
@@ -34976,12 +35751,12 @@ var init_schema2 = __esm({
34976
35751
  this.schemaName = schemaName;
34977
35752
  }
34978
35753
  };
34979
- __publicField(MySqlSchema5, _a320, "MySqlSchema");
35754
+ __publicField(MySqlSchema5, _a322, "MySqlSchema");
34980
35755
  }
34981
35756
  });
34982
35757
 
34983
35758
  // ../drizzle-orm/dist/mysql-core/session.js
34984
- var _a321, MySqlPreparedQuery, _a322, MySqlSession, _a323, _b232, MySqlTransaction;
35759
+ var _a323, MySqlPreparedQuery, _a324, MySqlSession, _a325, _b232, MySqlTransaction;
34985
35760
  var init_session3 = __esm({
34986
35761
  "../drizzle-orm/dist/mysql-core/session.js"() {
34987
35762
  "use strict";
@@ -34989,15 +35764,15 @@ var init_session3 = __esm({
34989
35764
  init_errors();
34990
35765
  init_sql();
34991
35766
  init_db3();
34992
- _a321 = entityKind;
35767
+ _a323 = entityKind;
34993
35768
  MySqlPreparedQuery = class {
34994
35769
  constructor() {
34995
35770
  /** @internal */
34996
35771
  __publicField(this, "joinsNotNullableMap");
34997
35772
  }
34998
35773
  };
34999
- __publicField(MySqlPreparedQuery, _a321, "MySqlPreparedQuery");
35000
- _a322 = entityKind;
35774
+ __publicField(MySqlPreparedQuery, _a323, "MySqlPreparedQuery");
35775
+ _a324 = entityKind;
35001
35776
  MySqlSession = class {
35002
35777
  constructor(dialect4) {
35003
35778
  this.dialect = dialect4;
@@ -35032,8 +35807,8 @@ var init_session3 = __esm({
35032
35807
  return parts.length ? sql`start transaction ${sql.raw(parts.join(" "))}` : void 0;
35033
35808
  }
35034
35809
  };
35035
- __publicField(MySqlSession, _a322, "MySqlSession");
35036
- MySqlTransaction = class extends (_b232 = MySqlDatabase, _a323 = entityKind, _b232) {
35810
+ __publicField(MySqlSession, _a324, "MySqlSession");
35811
+ MySqlTransaction = class extends (_b232 = MySqlDatabase, _a325 = entityKind, _b232) {
35037
35812
  constructor(dialect4, session, schema4, nestedIndex, mode) {
35038
35813
  super(dialect4, session, schema4, mode);
35039
35814
  this.schema = schema4;
@@ -35043,7 +35818,7 @@ var init_session3 = __esm({
35043
35818
  throw new TransactionRollbackError();
35044
35819
  }
35045
35820
  };
35046
- __publicField(MySqlTransaction, _a323, "MySqlTransaction");
35821
+ __publicField(MySqlTransaction, _a325, "MySqlTransaction");
35047
35822
  }
35048
35823
  });
35049
35824
 
@@ -35741,6 +36516,13 @@ var init_cli = __esm({
35741
36516
  breakpoints: booleanType().optional().default(true),
35742
36517
  migrations: objectType({
35743
36518
  prefix: prefix.optional().default("index")
36519
+ }).optional(),
36520
+ entities: objectType({
36521
+ roles: booleanType().or(objectType({
36522
+ provider: stringType().optional(),
36523
+ include: stringType().array().optional(),
36524
+ exclude: stringType().array().optional()
36525
+ })).optional().default(false)
35744
36526
  }).optional()
35745
36527
  }).passthrough();
35746
36528
  configCheck = objectType({
@@ -36007,6 +36789,7 @@ var init_pgImports = __esm({
36007
36789
  const enums = [];
36008
36790
  const schemas = [];
36009
36791
  const sequences = [];
36792
+ const roles = [];
36010
36793
  const i0values = Object.values(exports);
36011
36794
  i0values.forEach((t) => {
36012
36795
  if (isPgEnum(t)) {
@@ -36022,8 +36805,11 @@ var init_pgImports = __esm({
36022
36805
  if (isPgSequence(t)) {
36023
36806
  sequences.push(t);
36024
36807
  }
36808
+ if (is(t, PgRole)) {
36809
+ roles.push(t);
36810
+ }
36025
36811
  });
36026
- return { tables, enums, schemas, sequences };
36812
+ return { tables, enums, schemas, sequences, roles };
36027
36813
  };
36028
36814
  }
36029
36815
  });
@@ -36417,7 +37203,7 @@ init_mjs();
36417
37203
  init_global();
36418
37204
  init_pgSerializer();
36419
37205
  init_views();
36420
- var pgPushIntrospect = async (db, filters, schemaFilters) => {
37206
+ var pgPushIntrospect = async (db, filters, schemaFilters, entities = { roles: true }) => {
36421
37207
  const matchers = filters.map((it) => {
36422
37208
  return new Minimatch(it);
36423
37209
  });
@@ -36445,7 +37231,7 @@ var pgPushIntrospect = async (db, filters, schemaFilters) => {
36445
37231
  );
36446
37232
  const res = await (0, import_hanji3.renderWithTask)(
36447
37233
  progress,
36448
- fromDatabase(db, filter2, schemaFilters)
37234
+ fromDatabase(db, filter2, schemaFilters, entities)
36449
37235
  );
36450
37236
  const schema4 = { id: originUUID, prevId: "", ...res };
36451
37237
  const { internal, ...schemaWithoutInternals } = schema4;
@@ -36923,6 +37709,7 @@ var generateDrizzleJson = (imports, prevId, schemaFilters, casing2) => {
36923
37709
  prepared.enums,
36924
37710
  prepared.schemas,
36925
37711
  prepared.sequences,
37712
+ prepared.roles,
36926
37713
  casing2,
36927
37714
  schemaFilters
36928
37715
  );
@@ -36944,6 +37731,8 @@ var generateMigration = async (prev, cur) => {
36944
37731
  schemasResolver,
36945
37732
  enumsResolver,
36946
37733
  sequencesResolver,
37734
+ policyResolver,
37735
+ roleResolver,
36947
37736
  tablesResolver,
36948
37737
  columnsResolver,
36949
37738
  validatedPrev,
@@ -36976,6 +37765,8 @@ var pushSchema = async (imports, drizzleInstance, schemaFilters) => {
36976
37765
  schemasResolver,
36977
37766
  enumsResolver,
36978
37767
  sequencesResolver,
37768
+ policyResolver,
37769
+ roleResolver,
36979
37770
  tablesResolver,
36980
37771
  columnsResolver,
36981
37772
  validatedPrev,