drizzle-kit 0.26.2-57deedd → 0.26.2-6a162f5

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, _c11, _d5;
5882
- const defaultError = (_c11 = (_b233 = (_a324 = this._def).errorMap) === null || _b233 === void 0 ? void 0 : _b233.call(_a324, issue, ctx).message) !== null && _c11 !== void 0 ? _c11 : ctx.defaultError;
5881
+ var _a326, _b233, _c11, _d5;
5882
+ const defaultError = (_c11 = (_b233 = (_a326 = this._def).errorMap) === null || _b233 === void 0 ? void 0 : _b233.call(_a326, issue, ctx).message) !== null && _c11 !== void 0 ? _c11 : 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
@@ -7727,7 +7727,7 @@ var init_vector = __esm({
7727
7727
  });
7728
7728
 
7729
7729
  // src/serializer/pgSchema.ts
7730
- var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn, index2, indexV4, indexV5, indexV6, fk2, sequenceSchema, sequenceSquashed, columnV7, column2, checkConstraint2, columnSquashed, tableV32, compositePK2, uniqueConstraint2, viewWithOption, matViewWithOption, mergedViewWithOption, view2, 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;
7730
+ var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn, index2, indexV4, indexV5, indexV6, fk2, sequenceSchema, roleSchema, sequenceSquashed, columnV7, column2, checkConstraint2, columnSquashed, tableV32, compositePK2, uniqueConstraint2, policy, viewWithOption, matViewWithOption, mergedViewWithOption, view2, 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;
7731
7731
  var init_pgSchema = __esm({
7732
7732
  "src/serializer/pgSchema.ts"() {
7733
7733
  "use strict";
@@ -7859,6 +7859,12 @@ var init_pgSchema = __esm({
7859
7859
  cycle: booleanType().optional(),
7860
7860
  schema: stringType()
7861
7861
  }).strict();
7862
+ roleSchema = objectType({
7863
+ name: stringType(),
7864
+ createDb: booleanType().optional(),
7865
+ createRole: booleanType().optional(),
7866
+ inherit: booleanType().optional()
7867
+ }).strict();
7862
7868
  sequenceSquashed = objectType({
7863
7869
  name: stringType(),
7864
7870
  schema: stringType(),
@@ -7926,6 +7932,14 @@ var init_pgSchema = __esm({
7926
7932
  columns: stringType().array(),
7927
7933
  nullsNotDistinct: booleanType()
7928
7934
  }).strict();
7935
+ policy = objectType({
7936
+ name: stringType(),
7937
+ as: enumType(["PERMISSIVE", "RESTRICTIVE"]).optional(),
7938
+ for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
7939
+ to: stringType().array().optional(),
7940
+ using: stringType().optional(),
7941
+ withCheck: stringType().optional()
7942
+ }).strict();
7929
7943
  viewWithOption = objectType({
7930
7944
  checkOption: enumType(["local", "cascaded"]).optional(),
7931
7945
  securityBarrier: booleanType().optional(),
@@ -8006,7 +8020,9 @@ var init_pgSchema = __esm({
8006
8020
  foreignKeys: recordType(stringType(), fk2),
8007
8021
  compositePrimaryKeys: recordType(stringType(), compositePK2),
8008
8022
  uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
8009
- checkConstraints: recordType(stringType(), checkConstraint2).default({})
8023
+ policies: recordType(stringType(), policy).default({}),
8024
+ checkConstraints: recordType(stringType(), checkConstraint2).default({}),
8025
+ isRLSEnabled: booleanType().default(false)
8010
8026
  }).strict();
8011
8027
  schemaHash2 = objectType({
8012
8028
  id: stringType(),
@@ -8101,6 +8117,7 @@ var init_pgSchema = __esm({
8101
8117
  schemas: recordType(stringType(), stringType()),
8102
8118
  views: recordType(stringType(), view2).default({}),
8103
8119
  sequences: recordType(stringType(), sequenceSchema).default({}),
8120
+ roles: recordType(stringType(), roleSchema).default({}),
8104
8121
  _meta: objectType({
8105
8122
  schemas: recordType(stringType(), stringType()),
8106
8123
  tables: recordType(stringType(), stringType()),
@@ -8116,7 +8133,9 @@ var init_pgSchema = __esm({
8116
8133
  foreignKeys: recordType(stringType(), stringType()),
8117
8134
  compositePrimaryKeys: recordType(stringType(), stringType()),
8118
8135
  uniqueConstraints: recordType(stringType(), stringType()),
8119
- checkConstraints: recordType(stringType(), stringType())
8136
+ policies: recordType(stringType(), stringType()),
8137
+ checkConstraints: recordType(stringType(), stringType()),
8138
+ isRLSEnabled: booleanType().default(false)
8120
8139
  }).strict();
8121
8140
  tableSquashedV42 = objectType({
8122
8141
  name: stringType(),
@@ -8146,7 +8165,8 @@ var init_pgSchema = __esm({
8146
8165
  enums: recordType(stringType(), enumSchema),
8147
8166
  schemas: recordType(stringType(), stringType()),
8148
8167
  views: recordType(stringType(), view2),
8149
- sequences: recordType(stringType(), sequenceSquashed)
8168
+ sequences: recordType(stringType(), sequenceSquashed),
8169
+ roles: recordType(stringType(), roleSchema).default({})
8150
8170
  }).strict();
8151
8171
  pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
8152
8172
  pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
@@ -8229,6 +8249,23 @@ var init_pgSchema = __esm({
8229
8249
  squashFK: (fk4) => {
8230
8250
  return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${fk4.onUpdate ?? ""};${fk4.onDelete ?? ""};${fk4.schemaTo || "public"}`;
8231
8251
  },
8252
+ squashPolicy: (policy2) => {
8253
+ return `${policy2.name}--${policy2.as}--${policy2.for}--${policy2.to?.join(",")}--${policy2.using}--${policy2.withCheck}`;
8254
+ },
8255
+ unsquashPolicy: (policy2) => {
8256
+ const splitted = policy2.split("--");
8257
+ return {
8258
+ name: splitted[0],
8259
+ as: splitted[1],
8260
+ for: splitted[2],
8261
+ to: splitted[3].split(","),
8262
+ using: splitted[4] !== "undefined" ? splitted[4] : void 0,
8263
+ withCheck: splitted[5] !== "undefined" ? splitted[5] : void 0
8264
+ };
8265
+ },
8266
+ squashPolicyPush: (policy2) => {
8267
+ return `${policy2.name}--${policy2.as}--${policy2.for}--${policy2.to?.join(",")}`;
8268
+ },
8232
8269
  squashPK: (pk) => {
8233
8270
  return `${pk.columns.join(",")};${pk.name}`;
8234
8271
  },
@@ -8341,6 +8378,9 @@ var init_pgSchema = __esm({
8341
8378
  return PgSquasher.squashUnique(unq);
8342
8379
  }
8343
8380
  );
8381
+ const squashedPolicies = mapValues(it[1].policies, (policy2) => {
8382
+ return action === "push" ? PgSquasher.squashPolicyPush(policy2) : PgSquasher.squashPolicy(policy2);
8383
+ });
8344
8384
  const squashedChecksContraints = mapValues(
8345
8385
  it[1].checkConstraints,
8346
8386
  (check) => {
@@ -8357,7 +8397,9 @@ var init_pgSchema = __esm({
8357
8397
  foreignKeys: squashedFKs,
8358
8398
  compositePrimaryKeys: squashedPKs,
8359
8399
  uniqueConstraints: squashedUniqueConstraints,
8360
- checkConstraints: squashedChecksContraints
8400
+ policies: squashedPolicies,
8401
+ checkConstraints: squashedChecksContraints,
8402
+ isRLSEnabled: it[1].isRLSEnabled ?? false
8361
8403
  }
8362
8404
  ];
8363
8405
  })
@@ -8381,7 +8423,8 @@ var init_pgSchema = __esm({
8381
8423
  enums: json3.enums,
8382
8424
  schemas: json3.schemas,
8383
8425
  views: json3.views,
8384
- sequences: mappedSequences
8426
+ sequences: mappedSequences,
8427
+ roles: json3.roles
8385
8428
  };
8386
8429
  };
8387
8430
  dryPg = pgSchema.parse({
@@ -8765,7 +8808,7 @@ var init_utils = __esm({
8765
8808
  });
8766
8809
 
8767
8810
  // src/cli/views.ts
8768
- var import_hanji, warning, error, isRenamePromptItem, ResolveColumnSelect, tableKey, ResolveSelect, ResolveSchemasSelect, Spinner, ProgressView;
8811
+ var import_hanji, warning, error, isRenamePromptItem, ResolveColumnSelect, tableKey, ResolveSelectNamed, ResolveSelect, ResolveSchemasSelect, Spinner, ProgressView;
8769
8812
  var init_views = __esm({
8770
8813
  "src/cli/views.ts"() {
8771
8814
  "use strict";
@@ -8830,6 +8873,53 @@ Is ${source_default.bold.blue(
8830
8873
  tableKey = (it) => {
8831
8874
  return it.schema === "public" || !it.schema ? it.name : `${it.schema}.${it.name}`;
8832
8875
  };
8876
+ ResolveSelectNamed = class extends import_hanji.Prompt {
8877
+ constructor(base, data, entityType) {
8878
+ super();
8879
+ this.base = base;
8880
+ this.entityType = entityType;
8881
+ this.on("attach", (terminal) => terminal.toggleCursor("hide"));
8882
+ this.state = new import_hanji.SelectState(data);
8883
+ this.state.bind(this);
8884
+ this.base = base;
8885
+ }
8886
+ render(status) {
8887
+ if (status === "submitted" || status === "aborted") {
8888
+ return "";
8889
+ }
8890
+ const key = this.base.name;
8891
+ let text4 = `
8892
+ Is ${source_default.bold.blue(key)} ${this.entityType} created or renamed from another ${this.entityType}?
8893
+ `;
8894
+ const isSelectedRenamed = isRenamePromptItem(
8895
+ this.state.items[this.state.selectedIdx]
8896
+ );
8897
+ const selectedPrefix = isSelectedRenamed ? source_default.yellow("\u276F ") : source_default.green("\u276F ");
8898
+ const labelLength = this.state.items.filter((it) => isRenamePromptItem(it)).map((_2) => {
8899
+ const it = _2;
8900
+ const keyFrom = it.from.name;
8901
+ return key.length + 3 + keyFrom.length;
8902
+ }).reduce((a, b) => {
8903
+ if (a > b) {
8904
+ return a;
8905
+ }
8906
+ return b;
8907
+ }, 0);
8908
+ const entityType = this.entityType;
8909
+ this.state.items.forEach((it, idx) => {
8910
+ const isSelected = idx === this.state.selectedIdx;
8911
+ const isRenamed = isRenamePromptItem(it);
8912
+ const title = isRenamed ? `${it.from.name} \u203A ${it.to.name}`.padEnd(labelLength, " ") : it.name.padEnd(labelLength, " ");
8913
+ const label = isRenamed ? `${source_default.yellow("~")} ${title} ${source_default.gray(`rename ${entityType}`)}` : `${source_default.green("+")} ${title} ${source_default.gray(`create ${entityType}`)}`;
8914
+ text4 += isSelected ? `${selectedPrefix}${label}` : ` ${label}`;
8915
+ text4 += idx != this.state.items.length - 1 ? "\n" : "";
8916
+ });
8917
+ return text4;
8918
+ }
8919
+ result() {
8920
+ return this.state.items[this.state.selectedIdx];
8921
+ }
8922
+ };
8833
8923
  ResolveSelect = class extends import_hanji.Prompt {
8834
8924
  constructor(base, data, entityType) {
8835
8925
  super();
@@ -9046,57 +9136,57 @@ var require_heap = __commonJS({
9046
9136
  }
9047
9137
  return [].splice.apply(a, [lo, lo - lo].concat(x)), x;
9048
9138
  };
9049
- heappush = function(array, item, cmp) {
9139
+ heappush = function(array2, item, cmp) {
9050
9140
  if (cmp == null) {
9051
9141
  cmp = defaultCmp;
9052
9142
  }
9053
- array.push(item);
9054
- return _siftdown(array, 0, array.length - 1, cmp);
9143
+ array2.push(item);
9144
+ return _siftdown(array2, 0, array2.length - 1, cmp);
9055
9145
  };
9056
- heappop = function(array, cmp) {
9146
+ heappop = function(array2, cmp) {
9057
9147
  var lastelt, returnitem;
9058
9148
  if (cmp == null) {
9059
9149
  cmp = defaultCmp;
9060
9150
  }
9061
- lastelt = array.pop();
9062
- if (array.length) {
9063
- returnitem = array[0];
9064
- array[0] = lastelt;
9065
- _siftup(array, 0, cmp);
9151
+ lastelt = array2.pop();
9152
+ if (array2.length) {
9153
+ returnitem = array2[0];
9154
+ array2[0] = lastelt;
9155
+ _siftup(array2, 0, cmp);
9066
9156
  } else {
9067
9157
  returnitem = lastelt;
9068
9158
  }
9069
9159
  return returnitem;
9070
9160
  };
9071
- heapreplace = function(array, item, cmp) {
9161
+ heapreplace = function(array2, item, cmp) {
9072
9162
  var returnitem;
9073
9163
  if (cmp == null) {
9074
9164
  cmp = defaultCmp;
9075
9165
  }
9076
- returnitem = array[0];
9077
- array[0] = item;
9078
- _siftup(array, 0, cmp);
9166
+ returnitem = array2[0];
9167
+ array2[0] = item;
9168
+ _siftup(array2, 0, cmp);
9079
9169
  return returnitem;
9080
9170
  };
9081
- heappushpop = function(array, item, cmp) {
9171
+ heappushpop = function(array2, item, cmp) {
9082
9172
  var _ref;
9083
9173
  if (cmp == null) {
9084
9174
  cmp = defaultCmp;
9085
9175
  }
9086
- if (array.length && cmp(array[0], item) < 0) {
9087
- _ref = [array[0], item], item = _ref[0], array[0] = _ref[1];
9088
- _siftup(array, 0, cmp);
9176
+ if (array2.length && cmp(array2[0], item) < 0) {
9177
+ _ref = [array2[0], item], item = _ref[0], array2[0] = _ref[1];
9178
+ _siftup(array2, 0, cmp);
9089
9179
  }
9090
9180
  return item;
9091
9181
  };
9092
- heapify = function(array, cmp) {
9182
+ heapify = function(array2, cmp) {
9093
9183
  var i, _i2, _j2, _len, _ref, _ref1, _results, _results1;
9094
9184
  if (cmp == null) {
9095
9185
  cmp = defaultCmp;
9096
9186
  }
9097
9187
  _ref1 = function() {
9098
9188
  _results1 = [];
9099
- for (var _j3 = 0, _ref2 = floor(array.length / 2); 0 <= _ref2 ? _j3 < _ref2 : _j3 > _ref2; 0 <= _ref2 ? _j3++ : _j3--) {
9189
+ for (var _j3 = 0, _ref2 = floor(array2.length / 2); 0 <= _ref2 ? _j3 < _ref2 : _j3 > _ref2; 0 <= _ref2 ? _j3++ : _j3--) {
9100
9190
  _results1.push(_j3);
9101
9191
  }
9102
9192
  return _results1;
@@ -9104,51 +9194,51 @@ var require_heap = __commonJS({
9104
9194
  _results = [];
9105
9195
  for (_i2 = 0, _len = _ref1.length; _i2 < _len; _i2++) {
9106
9196
  i = _ref1[_i2];
9107
- _results.push(_siftup(array, i, cmp));
9197
+ _results.push(_siftup(array2, i, cmp));
9108
9198
  }
9109
9199
  return _results;
9110
9200
  };
9111
- updateItem = function(array, item, cmp) {
9201
+ updateItem = function(array2, item, cmp) {
9112
9202
  var pos;
9113
9203
  if (cmp == null) {
9114
9204
  cmp = defaultCmp;
9115
9205
  }
9116
- pos = array.indexOf(item);
9206
+ pos = array2.indexOf(item);
9117
9207
  if (pos === -1) {
9118
9208
  return;
9119
9209
  }
9120
- _siftdown(array, 0, pos, cmp);
9121
- return _siftup(array, pos, cmp);
9210
+ _siftdown(array2, 0, pos, cmp);
9211
+ return _siftup(array2, pos, cmp);
9122
9212
  };
9123
- nlargest = function(array, n, cmp) {
9213
+ nlargest = function(array2, n, cmp) {
9124
9214
  var elem, result, _i2, _len, _ref;
9125
9215
  if (cmp == null) {
9126
9216
  cmp = defaultCmp;
9127
9217
  }
9128
- result = array.slice(0, n);
9218
+ result = array2.slice(0, n);
9129
9219
  if (!result.length) {
9130
9220
  return result;
9131
9221
  }
9132
9222
  heapify(result, cmp);
9133
- _ref = array.slice(n);
9223
+ _ref = array2.slice(n);
9134
9224
  for (_i2 = 0, _len = _ref.length; _i2 < _len; _i2++) {
9135
9225
  elem = _ref[_i2];
9136
9226
  heappushpop(result, elem, cmp);
9137
9227
  }
9138
9228
  return result.sort(cmp).reverse();
9139
9229
  };
9140
- nsmallest = function(array, n, cmp) {
9230
+ nsmallest = function(array2, n, cmp) {
9141
9231
  var elem, i, los, result, _i2, _j2, _len, _ref, _ref1, _results;
9142
9232
  if (cmp == null) {
9143
9233
  cmp = defaultCmp;
9144
9234
  }
9145
- if (n * 10 <= array.length) {
9146
- result = array.slice(0, n).sort(cmp);
9235
+ if (n * 10 <= array2.length) {
9236
+ result = array2.slice(0, n).sort(cmp);
9147
9237
  if (!result.length) {
9148
9238
  return result;
9149
9239
  }
9150
9240
  los = result[result.length - 1];
9151
- _ref = array.slice(n);
9241
+ _ref = array2.slice(n);
9152
9242
  for (_i2 = 0, _len = _ref.length; _i2 < _len; _i2++) {
9153
9243
  elem = _ref[_i2];
9154
9244
  if (cmp(elem, los) < 0) {
@@ -9159,51 +9249,51 @@ var require_heap = __commonJS({
9159
9249
  }
9160
9250
  return result;
9161
9251
  }
9162
- heapify(array, cmp);
9252
+ heapify(array2, cmp);
9163
9253
  _results = [];
9164
- for (i = _j2 = 0, _ref1 = min2(n, array.length); 0 <= _ref1 ? _j2 < _ref1 : _j2 > _ref1; i = 0 <= _ref1 ? ++_j2 : --_j2) {
9165
- _results.push(heappop(array, cmp));
9254
+ for (i = _j2 = 0, _ref1 = min2(n, array2.length); 0 <= _ref1 ? _j2 < _ref1 : _j2 > _ref1; i = 0 <= _ref1 ? ++_j2 : --_j2) {
9255
+ _results.push(heappop(array2, cmp));
9166
9256
  }
9167
9257
  return _results;
9168
9258
  };
9169
- _siftdown = function(array, startpos, pos, cmp) {
9259
+ _siftdown = function(array2, startpos, pos, cmp) {
9170
9260
  var newitem, parent, parentpos;
9171
9261
  if (cmp == null) {
9172
9262
  cmp = defaultCmp;
9173
9263
  }
9174
- newitem = array[pos];
9264
+ newitem = array2[pos];
9175
9265
  while (pos > startpos) {
9176
9266
  parentpos = pos - 1 >> 1;
9177
- parent = array[parentpos];
9267
+ parent = array2[parentpos];
9178
9268
  if (cmp(newitem, parent) < 0) {
9179
- array[pos] = parent;
9269
+ array2[pos] = parent;
9180
9270
  pos = parentpos;
9181
9271
  continue;
9182
9272
  }
9183
9273
  break;
9184
9274
  }
9185
- return array[pos] = newitem;
9275
+ return array2[pos] = newitem;
9186
9276
  };
9187
- _siftup = function(array, pos, cmp) {
9277
+ _siftup = function(array2, pos, cmp) {
9188
9278
  var childpos, endpos, newitem, rightpos, startpos;
9189
9279
  if (cmp == null) {
9190
9280
  cmp = defaultCmp;
9191
9281
  }
9192
- endpos = array.length;
9282
+ endpos = array2.length;
9193
9283
  startpos = pos;
9194
- newitem = array[pos];
9284
+ newitem = array2[pos];
9195
9285
  childpos = 2 * pos + 1;
9196
9286
  while (childpos < endpos) {
9197
9287
  rightpos = childpos + 1;
9198
- if (rightpos < endpos && !(cmp(array[childpos], array[rightpos]) < 0)) {
9288
+ if (rightpos < endpos && !(cmp(array2[childpos], array2[rightpos]) < 0)) {
9199
9289
  childpos = rightpos;
9200
9290
  }
9201
- array[pos] = array[childpos];
9291
+ array2[pos] = array2[childpos];
9202
9292
  pos = childpos;
9203
9293
  childpos = 2 * pos + 1;
9204
9294
  }
9205
- array[pos] = newitem;
9206
- return _siftdown(array, startpos, pos, cmp);
9295
+ array2[pos] = newitem;
9296
+ return _siftdown(array2, startpos, pos, cmp);
9207
9297
  };
9208
9298
  Heap = function() {
9209
9299
  Heap2.push = heappush;
@@ -11130,12 +11220,12 @@ var require_lib = __commonJS({
11130
11220
  }
11131
11221
  return bestMatch;
11132
11222
  }
11133
- scalarize(array, originals, fuzzyOriginals) {
11223
+ scalarize(array2, originals, fuzzyOriginals) {
11134
11224
  const fuzzyMatches = [];
11135
11225
  if (fuzzyOriginals) {
11136
11226
  const keyScores = {};
11137
- for (let index4 = 0; index4 < array.length; index4++) {
11138
- const item = array[index4];
11227
+ for (let index4 = 0; index4 < array2.length; index4++) {
11228
+ const item = array2[index4];
11139
11229
  if (this.isScalar(item)) {
11140
11230
  continue;
11141
11231
  }
@@ -11149,8 +11239,8 @@ var require_lib = __commonJS({
11149
11239
  }
11150
11240
  }
11151
11241
  const result = [];
11152
- for (let index4 = 0; index4 < array.length; index4++) {
11153
- const item = array[index4];
11242
+ for (let index4 = 0; index4 < array2.length; index4++) {
11243
+ const item = array2[index4];
11154
11244
  if (this.isScalar(item)) {
11155
11245
  result.push(item);
11156
11246
  } else {
@@ -11372,6 +11462,37 @@ function diffColumns(left, right) {
11372
11462
  );
11373
11463
  return alteredTables;
11374
11464
  }
11465
+ function diffPolicies(left, right) {
11466
+ left = JSON.parse(JSON.stringify(left));
11467
+ right = JSON.parse(JSON.stringify(right));
11468
+ const result = (0, import_json_diff.diff)(left, right) ?? {};
11469
+ const alteredTables = Object.fromEntries(
11470
+ Object.entries(result).filter((it) => {
11471
+ return !(it[0].includes("__added") || it[0].includes("__deleted"));
11472
+ }).map((tableEntry) => {
11473
+ const deletedPolicies = Object.entries(tableEntry[1].policies ?? {}).filter((it) => {
11474
+ return it[0].endsWith("__deleted");
11475
+ }).map((it) => {
11476
+ return it[1];
11477
+ });
11478
+ const addedPolicies = Object.entries(tableEntry[1].policies ?? {}).filter((it) => {
11479
+ return it[0].endsWith("__added");
11480
+ }).map((it) => {
11481
+ return it[1];
11482
+ });
11483
+ tableEntry[1].policies = {
11484
+ added: addedPolicies,
11485
+ deleted: deletedPolicies
11486
+ };
11487
+ const table4 = left[tableEntry[0]];
11488
+ return [
11489
+ tableEntry[0],
11490
+ { name: table4.name, schema: table4.schema, ...tableEntry[1] }
11491
+ ];
11492
+ })
11493
+ );
11494
+ return alteredTables;
11495
+ }
11375
11496
  function applyJsonDiff(json1, json22) {
11376
11497
  json1 = JSON.parse(JSON.stringify(json1));
11377
11498
  json22 = JSON.parse(JSON.stringify(json22));
@@ -11381,6 +11502,7 @@ function applyJsonDiff(json1, json22) {
11381
11502
  difference.tables = difference.tables || {};
11382
11503
  difference.enums = difference.enums || {};
11383
11504
  difference.sequences = difference.sequences || {};
11505
+ difference.roles = difference.roles || {};
11384
11506
  difference.views = difference.views || {};
11385
11507
  const schemaKeys = Object.keys(difference.schemas);
11386
11508
  for (let key of schemaKeys) {
@@ -11437,6 +11559,10 @@ function applyJsonDiff(json1, json22) {
11437
11559
  const alteredSequences = sequencesEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted")) && "values" in it[1]).map((it) => {
11438
11560
  return json22.sequences[it[0]];
11439
11561
  });
11562
+ const rolesEntries = Object.entries(difference.roles);
11563
+ const alteredRoles = rolesEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted"))).map((it) => {
11564
+ return json22.roles[it[0]];
11565
+ });
11440
11566
  const viewsEntries = Object.entries(difference.views);
11441
11567
  const alteredViews = viewsEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted"))).map(
11442
11568
  ([nameWithSchema, view4]) => {
@@ -11510,6 +11636,7 @@ function applyJsonDiff(json1, json22) {
11510
11636
  alteredTablesWithColumns,
11511
11637
  alteredEnums,
11512
11638
  alteredSequences,
11639
+ alteredRoles,
11513
11640
  alteredViews
11514
11641
  };
11515
11642
  }
@@ -11570,6 +11697,21 @@ var init_jsonDiffer = __esm({
11570
11697
  return !it[0].endsWith("__deleted") && !it[0].endsWith("__added");
11571
11698
  })
11572
11699
  );
11700
+ const deletedPolicies = Object.fromEntries(
11701
+ Object.entries(table4.policies__deleted || {}).concat(
11702
+ Object.entries(table4.policies || {}).filter((it) => it[0].includes("__deleted"))
11703
+ ).map((entry) => [entry[0].replace("__deleted", ""), entry[1]])
11704
+ );
11705
+ const addedPolicies = Object.fromEntries(
11706
+ Object.entries(table4.policies__added || {}).concat(
11707
+ Object.entries(table4.policies || {}).filter((it) => it[0].includes("__added"))
11708
+ ).map((entry) => [entry[0].replace("__added", ""), entry[1]])
11709
+ );
11710
+ const alteredPolicies = Object.fromEntries(
11711
+ Object.entries(table4.policies || {}).filter((it) => {
11712
+ return !it[0].endsWith("__deleted") && !it[0].endsWith("__added");
11713
+ })
11714
+ );
11573
11715
  const deletedForeignKeys = Object.fromEntries(
11574
11716
  Object.entries(table4.foreignKeys__deleted || {}).concat(
11575
11717
  Object.entries(table4.foreignKeys || {}).filter((it) => it[0].includes("__deleted"))
@@ -11647,6 +11789,9 @@ var init_jsonDiffer = __esm({
11647
11789
  addedUniqueConstraints,
11648
11790
  deletedUniqueConstraints,
11649
11791
  alteredUniqueConstraints,
11792
+ deletedPolicies,
11793
+ addedPolicies,
11794
+ alteredPolicies,
11650
11795
  addedCheckConstraints,
11651
11796
  deletedCheckConstraints,
11652
11797
  alteredCheckConstraints
@@ -11949,7 +12094,7 @@ function fromJson(statements, dialect4, action, json22) {
11949
12094
  }).filter((it) => it !== "");
11950
12095
  return result;
11951
12096
  }
11952
- var pgNativeTypes, isPgNativeType, Convertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, PgCreateViewConvertor, MySqlCreateViewConvertor, SqliteCreateViewConvertor, PgDropViewConvertor, MySqlDropViewConvertor, SqliteDropViewConvertor, MySqlAlterViewConvertor, PgRenameViewConvertor, MySqlRenameViewConvertor, PgAlterViewSchemaConvertor, PgAlterViewAddWithOptionConvertor, PgAlterViewDropWithOptionConvertor, PgAlterViewAlterTablespaceConvertor, PgAlterViewAlterUsingConvertor, PgAlterTableAlterColumnSetGenerated, PgAlterTableAlterColumnDropGenerated, PgAlterTableAlterColumnAlterGenerated, PgAlterTableAddUniqueConstraintConvertor, PgAlterTableDropUniqueConstraintConvertor, PgAlterTableAddCheckConstraintConvertor, PgAlterTableDeleteCheckConstraintConvertor, MySQLAlterTableAddUniqueConstraintConvertor, MySQLAlterTableDropUniqueConstraintConvertor, MySqlAlterTableAddCheckConstraintConvertor, MySqlAlterTableDeleteCheckConstraintConvertor, 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;
12097
+ var pgNativeTypes, isPgNativeType, Convertor, PgCreateRoleConvertor, PgDropRoleConvertor, PgRenameRoleConvertor, PgAlterRoleConvertor, PgCreatePolicyConvertor, PgDropPolicyConvertor, PgRenamePolicyConvertor, PgAlterPolicyConvertor, PgEnableRlsConvertor, PgDisableRlsConvertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, PgCreateViewConvertor, MySqlCreateViewConvertor, SqliteCreateViewConvertor, PgDropViewConvertor, MySqlDropViewConvertor, SqliteDropViewConvertor, MySqlAlterViewConvertor, PgRenameViewConvertor, MySqlRenameViewConvertor, PgAlterViewSchemaConvertor, PgAlterViewAddWithOptionConvertor, PgAlterViewDropWithOptionConvertor, PgAlterViewAlterTablespaceConvertor, PgAlterViewAlterUsingConvertor, PgAlterTableAlterColumnSetGenerated, PgAlterTableAlterColumnDropGenerated, PgAlterTableAlterColumnAlterGenerated, PgAlterTableAddUniqueConstraintConvertor, PgAlterTableDropUniqueConstraintConvertor, PgAlterTableAddCheckConstraintConvertor, PgAlterTableDeleteCheckConstraintConvertor, MySQLAlterTableAddUniqueConstraintConvertor, MySQLAlterTableDropUniqueConstraintConvertor, MySqlAlterTableAddCheckConstraintConvertor, MySqlAlterTableDeleteCheckConstraintConvertor, 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;
11953
12098
  var init_sqlgenerator = __esm({
11954
12099
  "src/sqlgenerator.ts"() {
11955
12100
  "use strict";
@@ -12005,12 +12150,109 @@ var init_sqlgenerator = __esm({
12005
12150
  };
12006
12151
  Convertor = class {
12007
12152
  };
12153
+ PgCreateRoleConvertor = class extends Convertor {
12154
+ can(statement, dialect4) {
12155
+ return statement.type === "create_role" && dialect4 === "postgresql";
12156
+ }
12157
+ convert(statement) {
12158
+ 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"}` : ""};`;
12159
+ }
12160
+ };
12161
+ PgDropRoleConvertor = class extends Convertor {
12162
+ can(statement, dialect4) {
12163
+ return statement.type === "drop_role" && dialect4 === "postgresql";
12164
+ }
12165
+ convert(statement) {
12166
+ return `DROP ROLE "${statement.name}";`;
12167
+ }
12168
+ };
12169
+ PgRenameRoleConvertor = class extends Convertor {
12170
+ can(statement, dialect4) {
12171
+ return statement.type === "rename_role" && dialect4 === "postgresql";
12172
+ }
12173
+ convert(statement) {
12174
+ return `ALTER ROLE "${statement.nameFrom}" RENAME TO "${statement.nameTo}";`;
12175
+ }
12176
+ };
12177
+ PgAlterRoleConvertor = class extends Convertor {
12178
+ can(statement, dialect4) {
12179
+ return statement.type === "alter_role" && dialect4 === "postgresql";
12180
+ }
12181
+ convert(statement) {
12182
+ return `ALTER ROLE "${statement.name}"${` WITH${statement.values.createDb ? " CREATEDB" : " NOCREATEDB"}${statement.values.createRole ? " CREATEROLE" : " NOCREATEROLE"}${statement.values.inherit ? " INHERIT" : " NOINHERIT"}`};`;
12183
+ }
12184
+ };
12185
+ PgCreatePolicyConvertor = class extends Convertor {
12186
+ can(statement, dialect4) {
12187
+ return statement.type === "create_policy" && dialect4 === "postgresql";
12188
+ }
12189
+ convert(statement) {
12190
+ const policy2 = statement.data;
12191
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12192
+ const usingPart = policy2.using ? ` USING (${policy2.using})` : "";
12193
+ const withCheckPart = policy2.withCheck ? ` WITH CHECK (${policy2.withCheck})` : "";
12194
+ const policyToPart = policy2.to?.map(
12195
+ (v) => ["current_user", "current_role", "session_user", "public"].includes(v) ? v : `"${v}"`
12196
+ ).join(", ");
12197
+ return `CREATE POLICY "${policy2.name}" ON ${tableNameWithSchema} AS ${policy2.as?.toUpperCase()} FOR ${policy2.for?.toUpperCase()} TO ${policyToPart}${usingPart}${withCheckPart};`;
12198
+ }
12199
+ };
12200
+ PgDropPolicyConvertor = class extends Convertor {
12201
+ can(statement, dialect4) {
12202
+ return statement.type === "drop_policy" && dialect4 === "postgresql";
12203
+ }
12204
+ convert(statement) {
12205
+ const policy2 = statement.data;
12206
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12207
+ return `DROP POLICY "${policy2.name}" ON ${tableNameWithSchema} CASCADE;`;
12208
+ }
12209
+ };
12210
+ PgRenamePolicyConvertor = class extends Convertor {
12211
+ can(statement, dialect4) {
12212
+ return statement.type === "rename_policy" && dialect4 === "postgresql";
12213
+ }
12214
+ convert(statement) {
12215
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12216
+ return `ALTER POLICY "${statement.oldName}" ON ${tableNameWithSchema} RENAME TO "${statement.newName}";`;
12217
+ }
12218
+ };
12219
+ PgAlterPolicyConvertor = class extends Convertor {
12220
+ can(statement, dialect4) {
12221
+ return statement.type === "alter_policy" && dialect4 === "postgresql";
12222
+ }
12223
+ convert(statement) {
12224
+ const newPolicy = PgSquasher.unsquashPolicy(statement.newData);
12225
+ const oldPolicy = PgSquasher.unsquashPolicy(statement.oldData);
12226
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12227
+ const usingPart = newPolicy.using ? ` USING (${newPolicy.using})` : oldPolicy.using ? ` USING (${oldPolicy.using})` : "";
12228
+ const withCheckPart = newPolicy.withCheck ? ` WITH CHECK (${newPolicy.withCheck})` : oldPolicy.withCheck ? ` WITH CHECK (${oldPolicy.withCheck})` : "";
12229
+ return `ALTER POLICY "${oldPolicy.name}" ON ${tableNameWithSchema} TO ${newPolicy.to}${usingPart}${withCheckPart};`;
12230
+ }
12231
+ };
12232
+ PgEnableRlsConvertor = class extends Convertor {
12233
+ can(statement, dialect4) {
12234
+ return statement.type === "enable_rls" && dialect4 === "postgresql";
12235
+ }
12236
+ convert(statement) {
12237
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12238
+ return `ALTER TABLE ${tableNameWithSchema} ENABLE ROW LEVEL SECURITY;`;
12239
+ }
12240
+ };
12241
+ PgDisableRlsConvertor = class extends Convertor {
12242
+ can(statement, dialect4) {
12243
+ return statement.type === "disable_rls" && dialect4 === "postgresql";
12244
+ }
12245
+ convert(statement) {
12246
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12247
+ return `ALTER TABLE ${tableNameWithSchema} DISABLE ROW LEVEL SECURITY;`;
12248
+ }
12249
+ };
12008
12250
  PgCreateTableConvertor = class extends Convertor {
12009
12251
  can(statement, dialect4) {
12010
12252
  return statement.type === "create_table" && dialect4 === "postgresql";
12011
12253
  }
12012
12254
  convert(st) {
12013
- const { tableName, schema: schema4, columns, compositePKs, uniqueConstraints, checkConstraints } = st;
12255
+ const { tableName, schema: schema4, columns, compositePKs, uniqueConstraints, checkConstraints, policies, isRLSEnabled } = st;
12014
12256
  let statement = "";
12015
12257
  const name2 = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
12016
12258
  statement += `CREATE TABLE IF NOT EXISTS ${name2} (
@@ -12054,7 +12296,12 @@ var init_sqlgenerator = __esm({
12054
12296
  );`;
12055
12297
  statement += `
12056
12298
  `;
12057
- return statement;
12299
+ const enableRls = new PgEnableRlsConvertor().convert({
12300
+ type: "enable_rls",
12301
+ tableName,
12302
+ schema: schema4
12303
+ });
12304
+ return [statement, ...policies && policies.length > 0 || isRLSEnabled ? [enableRls] : []];
12058
12305
  }
12059
12306
  };
12060
12307
  MySqlCreateTableConvertor = class extends Convertor {
@@ -12653,9 +12900,21 @@ WITH ${withCheckOption} CHECK OPTION` : "";
12653
12900
  return statement.type === "drop_table" && dialect4 === "postgresql";
12654
12901
  }
12655
12902
  convert(statement) {
12656
- const { tableName, schema: schema4 } = statement;
12903
+ const { tableName, schema: schema4, policies } = statement;
12657
12904
  const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
12658
- return `DROP TABLE ${tableNameWithSchema};`;
12905
+ const dropPolicyConvertor = new PgDropPolicyConvertor();
12906
+ const droppedPolicies = policies?.map((p) => {
12907
+ return dropPolicyConvertor.convert({
12908
+ type: "drop_policy",
12909
+ tableName,
12910
+ data: PgSquasher.unsquashPolicy(p),
12911
+ schema: schema4
12912
+ });
12913
+ }) ?? [];
12914
+ return [
12915
+ ...droppedPolicies,
12916
+ `DROP TABLE ${tableNameWithSchema} CASCADE;`
12917
+ ];
12659
12918
  }
12660
12919
  };
12661
12920
  MySQLDropTableConvertor = class extends Convertor {
@@ -13857,6 +14116,16 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
13857
14116
  convertors.push(new PgAlterTableAlterColumnDropNotNullConvertor());
13858
14117
  convertors.push(new PgAlterTableAlterColumnSetDefaultConvertor());
13859
14118
  convertors.push(new PgAlterTableAlterColumnDropDefaultConvertor());
14119
+ convertors.push(new PgAlterPolicyConvertor());
14120
+ convertors.push(new PgCreatePolicyConvertor());
14121
+ convertors.push(new PgDropPolicyConvertor());
14122
+ convertors.push(new PgRenamePolicyConvertor());
14123
+ convertors.push(new PgEnableRlsConvertor());
14124
+ convertors.push(new PgDisableRlsConvertor());
14125
+ convertors.push(new PgDropRoleConvertor());
14126
+ convertors.push(new PgAlterRoleConvertor());
14127
+ convertors.push(new PgCreateRoleConvertor());
14128
+ convertors.push(new PgRenameRoleConvertor());
13860
14129
  convertors.push(new PgAlterTableAlterColumnSetExpressionConvertor());
13861
14130
  convertors.push(new PgAlterTableAlterColumnDropGeneratedConvertor());
13862
14131
  convertors.push(new PgAlterTableAlterColumnAlterrGeneratedConvertor());
@@ -14156,7 +14425,7 @@ var init_sqlitePushUtils = __esm({
14156
14425
  });
14157
14426
 
14158
14427
  // src/jsonStatements.ts
14159
- 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, prepareAddCheckConstraint, prepareDeleteCheckConstraint, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql, preparePgCreateViewJson, prepareMySqlCreateViewJson, prepareSqliteCreateViewJson, prepareDropViewJson, prepareRenameViewJson, preparePgAlterViewAlterSchemaJson, preparePgAlterViewAddWithOptionJson, preparePgAlterViewDropWithOptionJson, preparePgAlterViewAlterTablespaceJson, preparePgAlterViewAlterUsingJson, prepareMySqlAlterView;
14428
+ var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumValues, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson, prepareCreateRoleJson, prepareAlterRoleJson, prepareDropRoleJson, prepareRenameRoleJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, prepareRenamePolicyJsons, prepareCreatePolicyJsons, prepareDropPolicyJsons, prepareAlterPolicyJson, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareLibSQLCreateReferencesJson, prepareDropReferencesJson, prepareLibSQLDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCheckConstraint, prepareDeleteCheckConstraint, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql, preparePgCreateViewJson, prepareMySqlCreateViewJson, prepareSqliteCreateViewJson, prepareDropViewJson, prepareRenameViewJson, preparePgAlterViewAlterSchemaJson, preparePgAlterViewAddWithOptionJson, preparePgAlterViewDropWithOptionJson, preparePgAlterViewAlterTablespaceJson, preparePgAlterViewAlterUsingJson, prepareMySqlAlterView;
14160
14429
  var init_jsonStatements = __esm({
14161
14430
  "src/jsonStatements.ts"() {
14162
14431
  "use strict";
@@ -14167,7 +14436,7 @@ var init_jsonStatements = __esm({
14167
14436
  init_pgSchema();
14168
14437
  init_sqliteSchema();
14169
14438
  preparePgCreateTableJson = (table4, json22) => {
14170
- const { name: name2, schema: schema4, columns, compositePrimaryKeys, uniqueConstraints, checkConstraints } = table4;
14439
+ const { name: name2, schema: schema4, columns, compositePrimaryKeys, uniqueConstraints, checkConstraints, policies, isRLSEnabled } = table4;
14171
14440
  const tableKey2 = `${schema4 || "public"}.${name2}`;
14172
14441
  const compositePkName = Object.values(compositePrimaryKeys).length > 0 ? json22.tables[tableKey2].compositePrimaryKeys[`${PgSquasher.unsquashPK(Object.values(compositePrimaryKeys)[0]).name}`].name : "";
14173
14442
  return {
@@ -14178,7 +14447,9 @@ var init_jsonStatements = __esm({
14178
14447
  compositePKs: Object.values(compositePrimaryKeys),
14179
14448
  compositePkName,
14180
14449
  uniqueConstraints: Object.values(uniqueConstraints),
14181
- checkConstraints: Object.values(checkConstraints)
14450
+ policies: Object.values(policies),
14451
+ checkConstraints: Object.values(checkConstraints),
14452
+ isRLSEnabled: isRLSEnabled ?? false
14182
14453
  };
14183
14454
  };
14184
14455
  prepareMySqlCreateTableJson = (table4, json22, internals) => {
@@ -14218,7 +14489,8 @@ var init_jsonStatements = __esm({
14218
14489
  return {
14219
14490
  type: "drop_table",
14220
14491
  tableName: table4.name,
14221
- schema: table4.schema
14492
+ schema: table4.schema,
14493
+ policies: table4.policies ? Object.values(table4.policies) : []
14222
14494
  };
14223
14495
  };
14224
14496
  prepareRenameTableJson = (tableFrom, tableTo) => {
@@ -14336,6 +14608,41 @@ var init_jsonStatements = __esm({
14336
14608
  schema: schema4
14337
14609
  };
14338
14610
  };
14611
+ prepareCreateRoleJson = (role) => {
14612
+ return {
14613
+ type: "create_role",
14614
+ name: role.name,
14615
+ values: {
14616
+ createDb: role.createDb,
14617
+ createRole: role.createRole,
14618
+ inherit: role.inherit
14619
+ }
14620
+ };
14621
+ };
14622
+ prepareAlterRoleJson = (role) => {
14623
+ return {
14624
+ type: "alter_role",
14625
+ name: role.name,
14626
+ values: {
14627
+ createDb: role.createDb,
14628
+ createRole: role.createRole,
14629
+ inherit: role.inherit
14630
+ }
14631
+ };
14632
+ };
14633
+ prepareDropRoleJson = (name2) => {
14634
+ return {
14635
+ type: "drop_role",
14636
+ name: name2
14637
+ };
14638
+ };
14639
+ prepareRenameRoleJson = (nameFrom, nameTo) => {
14640
+ return {
14641
+ type: "rename_role",
14642
+ nameFrom,
14643
+ nameTo
14644
+ };
14645
+ };
14339
14646
  prepareCreateSchemasJson = (values) => {
14340
14647
  return values.map((it) => {
14341
14648
  return {
@@ -15232,6 +15539,46 @@ var init_jsonStatements = __esm({
15232
15539
  }
15233
15540
  return [...dropPkStatements, ...setPkStatements, ...statements];
15234
15541
  };
15542
+ prepareRenamePolicyJsons = (tableName, schema4, renames) => {
15543
+ return renames.map((it) => {
15544
+ return {
15545
+ type: "rename_policy",
15546
+ tableName,
15547
+ oldName: it.from.name,
15548
+ newName: it.to.name,
15549
+ schema: schema4
15550
+ };
15551
+ });
15552
+ };
15553
+ prepareCreatePolicyJsons = (tableName, schema4, policies) => {
15554
+ return policies.map((it) => {
15555
+ return {
15556
+ type: "create_policy",
15557
+ tableName,
15558
+ data: it,
15559
+ schema: schema4
15560
+ };
15561
+ });
15562
+ };
15563
+ prepareDropPolicyJsons = (tableName, schema4, policies) => {
15564
+ return policies.map((it) => {
15565
+ return {
15566
+ type: "drop_policy",
15567
+ tableName,
15568
+ data: it,
15569
+ schema: schema4
15570
+ };
15571
+ });
15572
+ };
15573
+ prepareAlterPolicyJson = (tableName, schema4, oldPolicy, newPolicy) => {
15574
+ return {
15575
+ type: "alter_policy",
15576
+ tableName,
15577
+ oldData: oldPolicy,
15578
+ newData: newPolicy,
15579
+ schema: schema4
15580
+ };
15581
+ };
15235
15582
  preparePgCreateIndexesJson = (tableName, schema4, indexes, fullSchema, action) => {
15236
15583
  if (action === "push") {
15237
15584
  return Object.values(indexes).map((indexData) => {
@@ -16058,7 +16405,9 @@ var init_snapshotsDiffer = __esm({
16058
16405
  foreignKeys: recordType(stringType(), stringType()),
16059
16406
  compositePrimaryKeys: recordType(stringType(), stringType()).default({}),
16060
16407
  uniqueConstraints: recordType(stringType(), stringType()).default({}),
16061
- checkConstraints: recordType(stringType(), stringType()).default({})
16408
+ policies: recordType(stringType(), stringType()).default({}),
16409
+ checkConstraints: recordType(stringType(), stringType()).default({}),
16410
+ isRLSEnabled: booleanType().default(false)
16062
16411
  }).strict();
16063
16412
  alteredTableScheme = objectType({
16064
16413
  name: stringType(),
@@ -16100,6 +16449,15 @@ var init_snapshotsDiffer = __esm({
16100
16449
  __old: stringType()
16101
16450
  })
16102
16451
  ),
16452
+ addedPolicies: recordType(stringType(), stringType()),
16453
+ deletedPolicies: recordType(stringType(), stringType()),
16454
+ alteredPolicies: recordType(
16455
+ stringType(),
16456
+ objectType({
16457
+ __new: stringType(),
16458
+ __old: stringType()
16459
+ })
16460
+ ),
16103
16461
  addedCheckConstraints: recordType(
16104
16462
  stringType(),
16105
16463
  stringType()
@@ -16161,6 +16519,7 @@ var init_snapshotsDiffer = __esm({
16161
16519
  alteredTablesWithColumns: alteredTableScheme.array(),
16162
16520
  alteredEnums: changedEnumSchema.array(),
16163
16521
  alteredSequences: sequenceSquashed.array(),
16522
+ alteredRoles: roleSchema.array(),
16164
16523
  alteredViews: alteredPgViewSchema.array()
16165
16524
  }).strict();
16166
16525
  diffResultSchemeMysql = objectType({
@@ -16218,7 +16577,7 @@ var init_snapshotsDiffer = __esm({
16218
16577
  }
16219
16578
  return column4;
16220
16579
  };
16221
- applyPgSnapshotsDiff = async (json1, json22, schemasResolver2, enumsResolver2, sequencesResolver2, tablesResolver2, columnsResolver2, viewsResolver2, prevFull, curFull, action) => {
16580
+ applyPgSnapshotsDiff = async (json1, json22, schemasResolver2, enumsResolver2, sequencesResolver2, policyResolver2, roleResolver2, tablesResolver2, columnsResolver2, viewsResolver2, prevFull, curFull, action) => {
16222
16581
  const schemasDiff = diffSchemasOrTables(json1.schemas, json22.schemas);
16223
16582
  const {
16224
16583
  created: createdSchemas,
@@ -16368,6 +16727,47 @@ var init_snapshotsDiffer = __esm({
16368
16727
  return [tableKey2, tableValue];
16369
16728
  }
16370
16729
  );
16730
+ const rolesDiff = diffSchemasOrTables(
16731
+ schemasPatchedSnap1.roles,
16732
+ json22.roles
16733
+ );
16734
+ const {
16735
+ created: createdRoles,
16736
+ deleted: deletedRoles,
16737
+ renamed: renamedRoles
16738
+ } = await roleResolver2({
16739
+ created: rolesDiff.added,
16740
+ deleted: rolesDiff.deleted
16741
+ });
16742
+ schemasPatchedSnap1.roles = mapEntries(
16743
+ schemasPatchedSnap1.roles,
16744
+ (_2, it) => {
16745
+ const { name: name2 } = nameChangeFor(it, renamedRoles);
16746
+ it.name = name2;
16747
+ return [name2, it];
16748
+ }
16749
+ );
16750
+ const rolesChangeMap = renamedRoles.reduce(
16751
+ (acc, it) => {
16752
+ acc[it.from.name] = {
16753
+ nameFrom: it.from.name,
16754
+ nameTo: it.to.name
16755
+ };
16756
+ return acc;
16757
+ },
16758
+ {}
16759
+ );
16760
+ schemasPatchedSnap1.roles = mapEntries(
16761
+ schemasPatchedSnap1.roles,
16762
+ (roleKey, roleValue) => {
16763
+ const key = roleKey;
16764
+ const change = rolesChangeMap[key];
16765
+ if (change) {
16766
+ roleValue.name = change.nameTo;
16767
+ }
16768
+ return [roleKey, roleValue];
16769
+ }
16770
+ );
16371
16771
  const tablesDiff = diffSchemasOrTables(
16372
16772
  schemasPatchedSnap1.tables,
16373
16773
  json22.tables
@@ -16446,7 +16846,66 @@ var init_snapshotsDiffer = __esm({
16446
16846
  return [tableKey2, tableValue];
16447
16847
  }
16448
16848
  );
16449
- const viewsDiff = diffSchemasOrTables(json1.views, json22.views);
16849
+ const policyRes = diffPolicies(tablesPatchedSnap1.tables, json22.tables);
16850
+ const policyRenames = [];
16851
+ const policyCreates = [];
16852
+ const policyDeletes = [];
16853
+ for (let entry of Object.values(policyRes)) {
16854
+ const { renamed, created, deleted } = await policyResolver2({
16855
+ tableName: entry.name,
16856
+ schema: entry.schema,
16857
+ deleted: entry.policies.deleted.map(PgSquasher.unsquashPolicy),
16858
+ created: entry.policies.added.map(PgSquasher.unsquashPolicy)
16859
+ });
16860
+ if (created.length > 0) {
16861
+ policyCreates.push({
16862
+ table: entry.name,
16863
+ schema: entry.schema,
16864
+ columns: created
16865
+ });
16866
+ }
16867
+ if (deleted.length > 0) {
16868
+ policyDeletes.push({
16869
+ table: entry.name,
16870
+ schema: entry.schema,
16871
+ columns: deleted
16872
+ });
16873
+ }
16874
+ if (renamed.length > 0) {
16875
+ policyRenames.push({
16876
+ table: entry.name,
16877
+ schema: entry.schema,
16878
+ renames: renamed
16879
+ });
16880
+ }
16881
+ }
16882
+ const policyRenamesDict = columnRenames.reduce(
16883
+ (acc, it) => {
16884
+ acc[`${it.schema || "public"}.${it.table}`] = it.renames;
16885
+ return acc;
16886
+ },
16887
+ {}
16888
+ );
16889
+ const policyPatchedSnap1 = copy(tablesPatchedSnap1);
16890
+ policyPatchedSnap1.tables = mapEntries(
16891
+ policyPatchedSnap1.tables,
16892
+ (tableKey2, tableValue) => {
16893
+ const patchedPolicies = mapKeys(
16894
+ tableValue.policies,
16895
+ (policyKey, policy2) => {
16896
+ const rens = policyRenamesDict[`${tableValue.schema || "public"}.${tableValue.name}`] || [];
16897
+ const newName = columnChangeFor(policyKey, rens);
16898
+ const unsquashedPolicy = PgSquasher.unsquashPolicy(policy2);
16899
+ unsquashedPolicy.name = newName;
16900
+ policy2 = PgSquasher.squashPolicy(unsquashedPolicy);
16901
+ return newName;
16902
+ }
16903
+ );
16904
+ tableValue.policies = patchedPolicies;
16905
+ return [tableKey2, tableValue];
16906
+ }
16907
+ );
16908
+ const viewsDiff = diffSchemasOrTables(policyPatchedSnap1.views, json22.views);
16450
16909
  const {
16451
16910
  created: createdViews,
16452
16911
  deleted: deletedViews,
@@ -16464,7 +16923,7 @@ var init_snapshotsDiffer = __esm({
16464
16923
  movedViews.forEach((it) => {
16465
16924
  movedViewDic[`${it.schemaFrom}.${it.name}`] = { to: it.schemaTo, from: it.schemaFrom };
16466
16925
  });
16467
- const viewsPatchedSnap1 = copy(columnsPatchedSnap1);
16926
+ const viewsPatchedSnap1 = copy(policyPatchedSnap1);
16468
16927
  viewsPatchedSnap1.views = mapEntries(
16469
16928
  viewsPatchedSnap1.views,
16470
16929
  (viewKey, viewValue) => {
@@ -16522,13 +16981,15 @@ var init_snapshotsDiffer = __esm({
16522
16981
  const jsonDeletedUniqueConstraints = [];
16523
16982
  const jsonAlteredUniqueConstraints = [];
16524
16983
  const jsonSetTableSchemas = [];
16525
- for (let it of movedTables) {
16526
- jsonSetTableSchemas.push({
16527
- type: "alter_table_set_schema",
16528
- tableName: it.name,
16529
- schemaFrom: it.schemaFrom || "public",
16530
- schemaTo: it.schemaTo || "public"
16531
- });
16984
+ if (movedTables) {
16985
+ for (let it of movedTables) {
16986
+ jsonSetTableSchemas.push({
16987
+ type: "alter_table_set_schema",
16988
+ tableName: it.name,
16989
+ schemaFrom: it.schemaFrom || "public",
16990
+ schemaTo: it.schemaTo || "public"
16991
+ });
16992
+ }
16532
16993
  }
16533
16994
  const jsonDeletedCheckConstraints = [];
16534
16995
  const jsonCreatedCheckConstraints = [];
@@ -16655,7 +17116,106 @@ var init_snapshotsDiffer = __esm({
16655
17116
  it.deletedIndexes || {}
16656
17117
  );
16657
17118
  }).flat();
17119
+ const jsonCreatePoliciesStatements = [];
17120
+ const jsonDropPoliciesStatements = [];
17121
+ const jsonAlterPoliciesStatements = [];
17122
+ const jsonRenamePoliciesStatements = [];
17123
+ const jsonEnableRLSStatements = [];
17124
+ const jsonDisableRLSStatements = [];
17125
+ for (let it of policyRenames) {
17126
+ jsonRenamePoliciesStatements.push(
17127
+ ...prepareRenamePolicyJsons(it.table, it.schema, it.renames)
17128
+ );
17129
+ }
17130
+ for (const it of policyCreates) {
17131
+ jsonCreatePoliciesStatements.push(
17132
+ ...prepareCreatePolicyJsons(
17133
+ it.table,
17134
+ it.schema,
17135
+ it.columns
17136
+ )
17137
+ );
17138
+ }
17139
+ for (const it of policyDeletes) {
17140
+ jsonDropPoliciesStatements.push(
17141
+ ...prepareDropPolicyJsons(
17142
+ it.table,
17143
+ it.schema,
17144
+ it.columns
17145
+ )
17146
+ );
17147
+ }
16658
17148
  alteredTables.forEach((it) => {
17149
+ Object.keys(it.alteredPolicies).forEach((policyName) => {
17150
+ const newPolicy = PgSquasher.unsquashPolicy(it.alteredPolicies[policyName].__new);
17151
+ const oldPolicy = PgSquasher.unsquashPolicy(it.alteredPolicies[policyName].__old);
17152
+ if (newPolicy.as !== oldPolicy.as) {
17153
+ jsonDropPoliciesStatements.push(
17154
+ ...prepareDropPolicyJsons(
17155
+ it.name,
17156
+ it.schema,
17157
+ [oldPolicy]
17158
+ )
17159
+ );
17160
+ jsonCreatePoliciesStatements.push(
17161
+ ...prepareCreatePolicyJsons(
17162
+ it.name,
17163
+ it.schema,
17164
+ [newPolicy]
17165
+ )
17166
+ );
17167
+ return;
17168
+ }
17169
+ if (newPolicy.for !== oldPolicy.for) {
17170
+ jsonDropPoliciesStatements.push(
17171
+ ...prepareDropPolicyJsons(
17172
+ it.name,
17173
+ it.schema,
17174
+ [oldPolicy]
17175
+ )
17176
+ );
17177
+ jsonCreatePoliciesStatements.push(
17178
+ ...prepareCreatePolicyJsons(
17179
+ it.name,
17180
+ it.schema,
17181
+ [newPolicy]
17182
+ )
17183
+ );
17184
+ return;
17185
+ }
17186
+ jsonAlterPoliciesStatements.push(
17187
+ prepareAlterPolicyJson(
17188
+ it.name,
17189
+ it.schema,
17190
+ it.alteredPolicies[policyName].__old,
17191
+ it.alteredPolicies[policyName].__new
17192
+ )
17193
+ );
17194
+ });
17195
+ for (const table4 of Object.values(json22.tables)) {
17196
+ const policiesInCurrentState = Object.keys(table4.policies);
17197
+ const tableInPreviousState = columnsPatchedSnap1.tables[`${table4.schema === "" ? "public" : table4.schema}.${table4.name}`];
17198
+ const policiesInPreviousState = tableInPreviousState ? Object.keys(tableInPreviousState.policies) : [];
17199
+ if (policiesInPreviousState.length === 0 && policiesInCurrentState.length > 0 && !table4.isRLSEnabled) {
17200
+ jsonEnableRLSStatements.push({ type: "enable_rls", tableName: table4.name, schema: table4.schema });
17201
+ }
17202
+ if (policiesInPreviousState.length > 0 && policiesInCurrentState.length === 0 && !table4.isRLSEnabled) {
17203
+ jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
17204
+ }
17205
+ if (table4.isRLSEnabled !== tableInPreviousState.isRLSEnabled) {
17206
+ if (table4.isRLSEnabled) {
17207
+ jsonEnableRLSStatements.push({ type: "enable_rls", tableName: table4.name, schema: table4.schema });
17208
+ } else if (!table4.isRLSEnabled && policiesInCurrentState.length === 0) {
17209
+ jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
17210
+ }
17211
+ }
17212
+ }
17213
+ for (const table4 of Object.values(columnsPatchedSnap1.tables)) {
17214
+ const tableInCurrentState = json22.tables[`${table4.schema === "" ? "public" : table4.schema}.${table4.name}`];
17215
+ if (tableInCurrentState === void 0 && !table4.isRLSEnabled) {
17216
+ jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
17217
+ }
17218
+ }
16659
17219
  const droppedIndexes = Object.keys(it.alteredIndexes).reduce(
16660
17220
  (current, item) => {
16661
17221
  current[item] = it.alteredIndexes[item].__old;
@@ -16743,6 +17303,18 @@ var init_snapshotsDiffer = __esm({
16743
17303
  const jsonAlterSequences = typedResult.alteredSequences.map((it) => {
16744
17304
  return prepareAlterSequenceJson(it);
16745
17305
  }).flat() ?? [];
17306
+ const createRoles = createdRoles.map((it) => {
17307
+ return prepareCreateRoleJson(it);
17308
+ }) ?? [];
17309
+ const dropRoles = deletedRoles.map((it) => {
17310
+ return prepareDropRoleJson(it.name);
17311
+ });
17312
+ const renameRoles = renamedRoles.map((it) => {
17313
+ return prepareRenameRoleJson(it.from.name, it.to.name);
17314
+ });
17315
+ const jsonAlterRoles = typedResult.alteredRoles.map((it) => {
17316
+ return prepareAlterRoleJson(it);
17317
+ }).flat() ?? [];
16746
17318
  const createSchemas = prepareCreateSchemasJson(
16747
17319
  createdSchemas.map((it) => it.name)
16748
17320
  );
@@ -16755,6 +17327,11 @@ var init_snapshotsDiffer = __esm({
16755
17327
  const createTables = createdTables.map((it) => {
16756
17328
  return preparePgCreateTableJson(it, curFull);
16757
17329
  });
17330
+ jsonCreatePoliciesStatements.push(...[].concat(
17331
+ ...createdTables.map(
17332
+ (it) => prepareCreatePolicyJsons(it.name, it.schema, Object.values(it.policies).map(PgSquasher.unsquashPolicy))
17333
+ )
17334
+ ));
16758
17335
  const createViews = [];
16759
17336
  const dropViews = [];
16760
17337
  const renameViews = [];
@@ -16896,7 +17473,13 @@ var init_snapshotsDiffer = __esm({
16896
17473
  jsonStatements.push(...moveSequences);
16897
17474
  jsonStatements.push(...renameSequences);
16898
17475
  jsonStatements.push(...jsonAlterSequences);
17476
+ jsonStatements.push(...renameRoles);
17477
+ jsonStatements.push(...dropRoles);
17478
+ jsonStatements.push(...createRoles);
17479
+ jsonStatements.push(...jsonAlterRoles);
16899
17480
  jsonStatements.push(...createTables);
17481
+ jsonStatements.push(...jsonEnableRLSStatements);
17482
+ jsonStatements.push(...jsonDisableRLSStatements);
16900
17483
  jsonStatements.push(...dropViews);
16901
17484
  jsonStatements.push(...renameViews);
16902
17485
  jsonStatements.push(...alterViews);
@@ -16922,6 +17505,10 @@ var init_snapshotsDiffer = __esm({
16922
17505
  jsonStatements.push(...jsonCreatedCheckConstraints);
16923
17506
  jsonStatements.push(...jsonAlteredUniqueConstraints);
16924
17507
  jsonStatements.push(...jsonAlterEnumsWithDroppedValues);
17508
+ jsonStatements.push(...jsonRenamePoliciesStatements);
17509
+ jsonStatements.push(...jsonDropPoliciesStatements);
17510
+ jsonStatements.push(...jsonCreatePoliciesStatements);
17511
+ jsonStatements.push(...jsonAlterPoliciesStatements);
16925
17512
  jsonStatements.push(...createViews);
16926
17513
  jsonStatements.push(...dropEnums);
16927
17514
  jsonStatements.push(...dropSequences);
@@ -18314,7 +18901,7 @@ var init_outputs = __esm({
18314
18901
  });
18315
18902
 
18316
18903
  // src/cli/commands/migrate.ts
18317
- var import_hanji2, schemasResolver, tablesResolver, viewsResolver, mySqlViewsResolver, sqliteViewsResolver, sequencesResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT;
18904
+ var import_hanji2, schemasResolver, tablesResolver, viewsResolver, mySqlViewsResolver, sqliteViewsResolver, sequencesResolver, roleResolver, policyResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedConflict, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT;
18318
18905
  var init_migrate = __esm({
18319
18906
  "src/cli/commands/migrate.ts"() {
18320
18907
  "use strict";
@@ -18431,6 +19018,32 @@ var init_migrate = __esm({
18431
19018
  throw e;
18432
19019
  }
18433
19020
  };
19021
+ roleResolver = async (input) => {
19022
+ const result = await promptNamedConflict(
19023
+ input.created,
19024
+ input.deleted,
19025
+ "role"
19026
+ );
19027
+ return {
19028
+ created: result.created,
19029
+ deleted: result.deleted,
19030
+ renamed: result.renamed
19031
+ };
19032
+ };
19033
+ policyResolver = async (input) => {
19034
+ const result = await promptColumnsConflicts(
19035
+ input.tableName,
19036
+ input.created,
19037
+ input.deleted
19038
+ );
19039
+ return {
19040
+ tableName: input.tableName,
19041
+ schema: input.schema,
19042
+ created: result.created,
19043
+ deleted: result.deleted,
19044
+ renamed: result.renamed
19045
+ };
19046
+ };
18434
19047
  enumsResolver = async (input) => {
18435
19048
  try {
18436
19049
  const { created, deleted, moved, renamed } = await promptNamedWithSchemasConflict(
@@ -18513,6 +19126,56 @@ var init_migrate = __esm({
18513
19126
  result.deleted.push(...leftMissing);
18514
19127
  return result;
18515
19128
  };
19129
+ promptNamedConflict = async (newItems, missingItems, entity) => {
19130
+ if (missingItems.length === 0 || newItems.length === 0) {
19131
+ return {
19132
+ created: newItems,
19133
+ renamed: [],
19134
+ deleted: missingItems
19135
+ };
19136
+ }
19137
+ const result = { created: [], renamed: [], deleted: [] };
19138
+ let index4 = 0;
19139
+ let leftMissing = [...missingItems];
19140
+ do {
19141
+ const created = newItems[index4];
19142
+ const renames = leftMissing.map((it) => {
19143
+ return { from: it, to: created };
19144
+ });
19145
+ const promptData = [created, ...renames];
19146
+ const { status, data } = await (0, import_hanji2.render)(
19147
+ new ResolveSelectNamed(created, promptData, entity)
19148
+ );
19149
+ if (status === "aborted") {
19150
+ console.error("ERROR");
19151
+ process.exit(1);
19152
+ }
19153
+ if (isRenamePromptItem(data)) {
19154
+ console.log(
19155
+ `${source_default.yellow("~")} ${data.from.name} \u203A ${data.to.name} ${source_default.gray(
19156
+ `${entity} will be renamed/moved`
19157
+ )}`
19158
+ );
19159
+ if (data.from.name !== data.to.name) {
19160
+ result.renamed.push(data);
19161
+ }
19162
+ delete leftMissing[leftMissing.indexOf(data.from)];
19163
+ leftMissing = leftMissing.filter(Boolean);
19164
+ } else {
19165
+ console.log(
19166
+ `${source_default.green("+")} ${data.name} ${source_default.gray(
19167
+ `${entity} will be created`
19168
+ )}`
19169
+ );
19170
+ result.created.push(created);
19171
+ }
19172
+ index4 += 1;
19173
+ } while (index4 < newItems.length);
19174
+ console.log(source_default.gray(`--- all ${entity} conflicts resolved ---
19175
+ `));
19176
+ result.deleted.push(...leftMissing);
19177
+ return result;
19178
+ };
18516
19179
  promptNamedWithSchemasConflict = async (newItems, missingItems, entity) => {
18517
19180
  if (missingItems.length === 0 || newItems.length === 0) {
18518
19181
  return {
@@ -20069,8 +20732,8 @@ function parsePgArray(arrayString) {
20069
20732
  const [result] = parsePgNestedArray(arrayString, 1);
20070
20733
  return result;
20071
20734
  }
20072
- function makePgArray(array) {
20073
- return `{${array.map((item) => {
20735
+ function makePgArray(array2) {
20736
+ return `{${array2.map((item) => {
20074
20737
  if (Array.isArray(item)) {
20075
20738
  return makePgArray(item);
20076
20739
  }
@@ -20377,7 +21040,7 @@ var version;
20377
21040
  var init_version = __esm({
20378
21041
  "../drizzle-orm/dist/version.js"() {
20379
21042
  "use strict";
20380
- version = "0.35.2";
21043
+ version = "0.35.3";
20381
21044
  }
20382
21045
  });
20383
21046
 
@@ -20778,8 +21441,8 @@ var init_sql = __esm({
20778
21441
  sql2.param = param2;
20779
21442
  })(sql || (sql = {}));
20780
21443
  ((SQL2) => {
20781
- var _a324;
20782
- _a324 = entityKind;
21444
+ var _a326;
21445
+ _a326 = entityKind;
20783
21446
  const _Aliased = class _Aliased {
20784
21447
  constructor(sql2, fieldAlias) {
20785
21448
  /** @internal */
@@ -20795,7 +21458,7 @@ var init_sql = __esm({
20795
21458
  return new _Aliased(this.sql, this.fieldAlias);
20796
21459
  }
20797
21460
  };
20798
- __publicField(_Aliased, _a324, "SQL.Aliased");
21461
+ __publicField(_Aliased, _a326, "SQL.Aliased");
20799
21462
  let Aliased = _Aliased;
20800
21463
  SQL2.Aliased = Aliased;
20801
21464
  })(SQL || (SQL = {}));
@@ -21078,8 +21741,8 @@ function arrayContains(column4, values) {
21078
21741
  if (values.length === 0) {
21079
21742
  throw new Error("arrayContains requires at least one value");
21080
21743
  }
21081
- const array = sql`${bindIfParam(values, column4)}`;
21082
- return sql`${column4} @> ${array}`;
21744
+ const array2 = sql`${bindIfParam(values, column4)}`;
21745
+ return sql`${column4} @> ${array2}`;
21083
21746
  }
21084
21747
  return sql`${column4} @> ${bindIfParam(values, column4)}`;
21085
21748
  }
@@ -21088,8 +21751,8 @@ function arrayContained(column4, values) {
21088
21751
  if (values.length === 0) {
21089
21752
  throw new Error("arrayContained requires at least one value");
21090
21753
  }
21091
- const array = sql`${bindIfParam(values, column4)}`;
21092
- return sql`${column4} <@ ${array}`;
21754
+ const array2 = sql`${bindIfParam(values, column4)}`;
21755
+ return sql`${column4} <@ ${array2}`;
21093
21756
  }
21094
21757
  return sql`${column4} <@ ${bindIfParam(values, column4)}`;
21095
21758
  }
@@ -21098,8 +21761,8 @@ function arrayOverlaps(column4, values) {
21098
21761
  if (values.length === 0) {
21099
21762
  throw new Error("arrayOverlaps requires at least one value");
21100
21763
  }
21101
- const array = sql`${bindIfParam(values, column4)}`;
21102
- return sql`${column4} && ${array}`;
21764
+ const array2 = sql`${bindIfParam(values, column4)}`;
21765
+ return sql`${column4} && ${array2}`;
21103
21766
  }
21104
21767
  return sql`${column4} && ${bindIfParam(values, column4)}`;
21105
21768
  }
@@ -23060,9 +23723,14 @@ function pgTableWithSchema(name2, columns, extraConfig, schema4, baseName = name
23060
23723
  if (extraConfig) {
23061
23724
  table4[PgTable.Symbol.ExtraConfigBuilder] = extraConfig;
23062
23725
  }
23063
- return table4;
23726
+ return Object.assign(table4, {
23727
+ enableRLS: () => {
23728
+ table4[PgTable.Symbol.EnableRLS] = true;
23729
+ return table4;
23730
+ }
23731
+ });
23064
23732
  }
23065
- var InlineForeignKeys, _a116, _b94, _c2, _d2, PgTable, pgTable;
23733
+ var InlineForeignKeys, EnableRLS, _a116, _b94, _c2, _d2, _e2, PgTable, pgTable;
23066
23734
  var init_table2 = __esm({
23067
23735
  "../drizzle-orm/dist/pg-core/table.js"() {
23068
23736
  "use strict";
@@ -23070,19 +23738,23 @@ var init_table2 = __esm({
23070
23738
  init_table();
23071
23739
  init_all();
23072
23740
  InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys");
23073
- PgTable = class extends (_d2 = Table, _c2 = entityKind, _b94 = InlineForeignKeys, _a116 = Table.Symbol.ExtraConfigBuilder, _d2) {
23741
+ EnableRLS = Symbol.for("drizzle:EnableRLS");
23742
+ PgTable = class extends (_e2 = Table, _d2 = entityKind, _c2 = InlineForeignKeys, _b94 = EnableRLS, _a116 = Table.Symbol.ExtraConfigBuilder, _e2) {
23074
23743
  constructor() {
23075
23744
  super(...arguments);
23076
23745
  /**@internal */
23077
- __publicField(this, _b94, []);
23746
+ __publicField(this, _c2, []);
23747
+ /** @internal */
23748
+ __publicField(this, _b94, false);
23078
23749
  /** @internal */
23079
23750
  __publicField(this, _a116);
23080
23751
  }
23081
23752
  };
23082
- __publicField(PgTable, _c2, "PgTable");
23753
+ __publicField(PgTable, _d2, "PgTable");
23083
23754
  /** @internal */
23084
23755
  __publicField(PgTable, "Symbol", Object.assign({}, Table.Symbol, {
23085
- InlineForeignKeys
23756
+ InlineForeignKeys,
23757
+ EnableRLS
23086
23758
  }));
23087
23759
  pgTable = (name2, columns, extraConfig) => {
23088
23760
  return pgTableWithSchema(name2, columns, extraConfig, void 0);
@@ -26810,6 +27482,67 @@ var init_indexes = __esm({
26810
27482
  }
26811
27483
  });
26812
27484
 
27485
+ // ../drizzle-orm/dist/pg-core/policies.js
27486
+ var _a147, PgPolicy;
27487
+ var init_policies = __esm({
27488
+ "../drizzle-orm/dist/pg-core/policies.js"() {
27489
+ "use strict";
27490
+ init_entity();
27491
+ _a147 = entityKind;
27492
+ PgPolicy = class {
27493
+ constructor(name2, config) {
27494
+ __publicField(this, "as");
27495
+ __publicField(this, "for");
27496
+ __publicField(this, "to");
27497
+ __publicField(this, "using");
27498
+ __publicField(this, "withCheck");
27499
+ this.name = name2;
27500
+ if (config) {
27501
+ this.as = config.as;
27502
+ this.for = config.for;
27503
+ this.to = config.to;
27504
+ this.using = config.using;
27505
+ this.withCheck = config.withCheck;
27506
+ }
27507
+ }
27508
+ };
27509
+ __publicField(PgPolicy, _a147, "PgPolicy");
27510
+ }
27511
+ });
27512
+
27513
+ // ../drizzle-orm/dist/pg-core/roles.js
27514
+ var _a148, PgRole;
27515
+ var init_roles = __esm({
27516
+ "../drizzle-orm/dist/pg-core/roles.js"() {
27517
+ "use strict";
27518
+ init_entity();
27519
+ _a148 = entityKind;
27520
+ PgRole = class {
27521
+ constructor(name2, config) {
27522
+ /** @internal */
27523
+ __publicField(this, "_existing");
27524
+ /** @internal */
27525
+ __publicField(this, "createDb");
27526
+ /** @internal */
27527
+ __publicField(this, "createRole");
27528
+ /** @internal */
27529
+ __publicField(this, "inherit");
27530
+ this.name = name2;
27531
+ if (config) {
27532
+ this.createDb = config.createDb;
27533
+ this.createRole = config.createRole;
27534
+ this.inherit = config.inherit;
27535
+ }
27536
+ }
27537
+ existing() {
27538
+ this._existing = true;
27539
+ return this;
27540
+ }
27541
+ };
27542
+ __publicField(PgRole, _a148, "PgRole");
27543
+ }
27544
+ });
27545
+
26813
27546
  // ../drizzle-orm/dist/pg-core/sequence.js
26814
27547
  function pgSequenceWithSchema(name2, options, schema4) {
26815
27548
  return new PgSequence(name2, options, schema4);
@@ -26817,12 +27550,12 @@ function pgSequenceWithSchema(name2, options, schema4) {
26817
27550
  function isPgSequence(obj) {
26818
27551
  return is(obj, PgSequence);
26819
27552
  }
26820
- var _a147, PgSequence;
27553
+ var _a149, PgSequence;
26821
27554
  var init_sequence = __esm({
26822
27555
  "../drizzle-orm/dist/pg-core/sequence.js"() {
26823
27556
  "use strict";
26824
27557
  init_entity();
26825
- _a147 = entityKind;
27558
+ _a149 = entityKind;
26826
27559
  PgSequence = class {
26827
27560
  constructor(seqName, seqOptions, schema4) {
26828
27561
  this.seqName = seqName;
@@ -26830,7 +27563,7 @@ var init_sequence = __esm({
26830
27563
  this.schema = schema4;
26831
27564
  }
26832
27565
  };
26833
- __publicField(PgSequence, _a147, "PgSequence");
27566
+ __publicField(PgSequence, _a149, "PgSequence");
26834
27567
  }
26835
27568
  });
26836
27569
 
@@ -26862,7 +27595,7 @@ function isPgView(obj) {
26862
27595
  function isPgMaterializedView(obj) {
26863
27596
  return is(obj, PgMaterializedView);
26864
27597
  }
26865
- var _a148, DefaultViewBuilderCore, _a149, _b107, ViewBuilder, _a150, _b108, ManualViewBuilder, _a151, MaterializedViewBuilderCore, _a152, _b109, MaterializedViewBuilder, _a153, _b110, ManualMaterializedViewBuilder, _a154, _b111, _c4, PgView2, PgMaterializedViewConfig, _a155, _b112, _c5, PgMaterializedView;
27598
+ var _a150, DefaultViewBuilderCore, _a151, _b107, ViewBuilder, _a152, _b108, ManualViewBuilder, _a153, MaterializedViewBuilderCore, _a154, _b109, MaterializedViewBuilder, _a155, _b110, ManualMaterializedViewBuilder, _a156, _b111, _c4, PgView2, PgMaterializedViewConfig, _a157, _b112, _c5, PgMaterializedView;
26866
27599
  var init_view = __esm({
26867
27600
  "../drizzle-orm/dist/pg-core/view.js"() {
26868
27601
  "use strict";
@@ -26873,7 +27606,7 @@ var init_view = __esm({
26873
27606
  init_table2();
26874
27607
  init_view_base();
26875
27608
  init_view_common2();
26876
- _a148 = entityKind;
27609
+ _a150 = entityKind;
26877
27610
  DefaultViewBuilderCore = class {
26878
27611
  constructor(name2, schema4) {
26879
27612
  __publicField(this, "config", {});
@@ -26885,8 +27618,8 @@ var init_view = __esm({
26885
27618
  return this;
26886
27619
  }
26887
27620
  };
26888
- __publicField(DefaultViewBuilderCore, _a148, "PgDefaultViewBuilderCore");
26889
- ViewBuilder = class extends (_b107 = DefaultViewBuilderCore, _a149 = entityKind, _b107) {
27621
+ __publicField(DefaultViewBuilderCore, _a150, "PgDefaultViewBuilderCore");
27622
+ ViewBuilder = class extends (_b107 = DefaultViewBuilderCore, _a151 = entityKind, _b107) {
26890
27623
  as(qb) {
26891
27624
  if (typeof qb === "function") {
26892
27625
  qb = qb(new QueryBuilder());
@@ -26912,8 +27645,8 @@ var init_view = __esm({
26912
27645
  );
26913
27646
  }
26914
27647
  };
26915
- __publicField(ViewBuilder, _a149, "PgViewBuilder");
26916
- ManualViewBuilder = class extends (_b108 = DefaultViewBuilderCore, _a150 = entityKind, _b108) {
27648
+ __publicField(ViewBuilder, _a151, "PgViewBuilder");
27649
+ ManualViewBuilder = class extends (_b108 = DefaultViewBuilderCore, _a152 = entityKind, _b108) {
26917
27650
  constructor(name2, columns, schema4) {
26918
27651
  super(name2, schema4);
26919
27652
  __publicField(this, "columns");
@@ -26958,8 +27691,8 @@ var init_view = __esm({
26958
27691
  );
26959
27692
  }
26960
27693
  };
26961
- __publicField(ManualViewBuilder, _a150, "PgManualViewBuilder");
26962
- _a151 = entityKind;
27694
+ __publicField(ManualViewBuilder, _a152, "PgManualViewBuilder");
27695
+ _a153 = entityKind;
26963
27696
  MaterializedViewBuilderCore = class {
26964
27697
  constructor(name2, schema4) {
26965
27698
  __publicField(this, "config", {});
@@ -26983,8 +27716,8 @@ var init_view = __esm({
26983
27716
  return this;
26984
27717
  }
26985
27718
  };
26986
- __publicField(MaterializedViewBuilderCore, _a151, "PgMaterializedViewBuilderCore");
26987
- MaterializedViewBuilder = class extends (_b109 = MaterializedViewBuilderCore, _a152 = entityKind, _b109) {
27719
+ __publicField(MaterializedViewBuilderCore, _a153, "PgMaterializedViewBuilderCore");
27720
+ MaterializedViewBuilder = class extends (_b109 = MaterializedViewBuilderCore, _a154 = entityKind, _b109) {
26988
27721
  as(qb) {
26989
27722
  if (typeof qb === "function") {
26990
27723
  qb = qb(new QueryBuilder());
@@ -27015,8 +27748,8 @@ var init_view = __esm({
27015
27748
  );
27016
27749
  }
27017
27750
  };
27018
- __publicField(MaterializedViewBuilder, _a152, "PgMaterializedViewBuilder");
27019
- ManualMaterializedViewBuilder = class extends (_b110 = MaterializedViewBuilderCore, _a153 = entityKind, _b110) {
27751
+ __publicField(MaterializedViewBuilder, _a154, "PgMaterializedViewBuilder");
27752
+ ManualMaterializedViewBuilder = class extends (_b110 = MaterializedViewBuilderCore, _a155 = entityKind, _b110) {
27020
27753
  constructor(name2, columns, schema4) {
27021
27754
  super(name2, schema4);
27022
27755
  __publicField(this, "columns");
@@ -27071,11 +27804,11 @@ var init_view = __esm({
27071
27804
  );
27072
27805
  }
27073
27806
  };
27074
- __publicField(ManualMaterializedViewBuilder, _a153, "PgManualMaterializedViewBuilder");
27075
- PgView2 = class extends (_c4 = PgViewBase, _b111 = entityKind, _a154 = PgViewConfig, _c4) {
27807
+ __publicField(ManualMaterializedViewBuilder, _a155, "PgManualMaterializedViewBuilder");
27808
+ PgView2 = class extends (_c4 = PgViewBase, _b111 = entityKind, _a156 = PgViewConfig, _c4) {
27076
27809
  constructor({ pgConfig, config }) {
27077
27810
  super(config);
27078
- __publicField(this, _a154);
27811
+ __publicField(this, _a156);
27079
27812
  if (pgConfig) {
27080
27813
  this[PgViewConfig] = {
27081
27814
  with: pgConfig.with
@@ -27085,10 +27818,10 @@ var init_view = __esm({
27085
27818
  };
27086
27819
  __publicField(PgView2, _b111, "PgView");
27087
27820
  PgMaterializedViewConfig = Symbol.for("drizzle:PgMaterializedViewConfig");
27088
- PgMaterializedView = class extends (_c5 = PgViewBase, _b112 = entityKind, _a155 = PgMaterializedViewConfig, _c5) {
27821
+ PgMaterializedView = class extends (_c5 = PgViewBase, _b112 = entityKind, _a157 = PgMaterializedViewConfig, _c5) {
27089
27822
  constructor({ pgConfig, config }) {
27090
27823
  super(config);
27091
- __publicField(this, _a155);
27824
+ __publicField(this, _a157);
27092
27825
  this[PgMaterializedViewConfig] = {
27093
27826
  with: pgConfig?.with,
27094
27827
  using: pgConfig?.using,
@@ -27102,7 +27835,7 @@ var init_view = __esm({
27102
27835
  });
27103
27836
 
27104
27837
  // ../drizzle-orm/dist/pg-core/schema.js
27105
- var _a156, PgSchema5;
27838
+ var _a158, PgSchema5;
27106
27839
  var init_schema = __esm({
27107
27840
  "../drizzle-orm/dist/pg-core/schema.js"() {
27108
27841
  "use strict";
@@ -27112,7 +27845,7 @@ var init_schema = __esm({
27112
27845
  init_sequence();
27113
27846
  init_table2();
27114
27847
  init_view();
27115
- _a156 = entityKind;
27848
+ _a158 = entityKind;
27116
27849
  PgSchema5 = class {
27117
27850
  constructor(schemaName) {
27118
27851
  __publicField(this, "table", (name2, columns, extraConfig) => {
@@ -27139,12 +27872,12 @@ var init_schema = __esm({
27139
27872
  return true;
27140
27873
  }
27141
27874
  };
27142
- __publicField(PgSchema5, _a156, "PgSchema");
27875
+ __publicField(PgSchema5, _a158, "PgSchema");
27143
27876
  }
27144
27877
  });
27145
27878
 
27146
27879
  // ../drizzle-orm/dist/pg-core/session.js
27147
- var _a157, PgPreparedQuery, _a158, PgSession, _a159, _b113, PgTransaction;
27880
+ var _a159, PgPreparedQuery, _a160, PgSession, _a161, _b113, PgTransaction;
27148
27881
  var init_session = __esm({
27149
27882
  "../drizzle-orm/dist/pg-core/session.js"() {
27150
27883
  "use strict";
@@ -27153,7 +27886,7 @@ var init_session = __esm({
27153
27886
  init_sql2();
27154
27887
  init_tracing();
27155
27888
  init_db();
27156
- _a157 = entityKind;
27889
+ _a159 = entityKind;
27157
27890
  PgPreparedQuery = class {
27158
27891
  constructor(query) {
27159
27892
  /** @internal */
@@ -27167,8 +27900,8 @@ var init_session = __esm({
27167
27900
  return response;
27168
27901
  }
27169
27902
  };
27170
- __publicField(PgPreparedQuery, _a157, "PgPreparedQuery");
27171
- _a158 = entityKind;
27903
+ __publicField(PgPreparedQuery, _a159, "PgPreparedQuery");
27904
+ _a160 = entityKind;
27172
27905
  PgSession = class {
27173
27906
  constructor(dialect4) {
27174
27907
  this.dialect = dialect4;
@@ -27201,8 +27934,8 @@ var init_session = __esm({
27201
27934
  );
27202
27935
  }
27203
27936
  };
27204
- __publicField(PgSession, _a158, "PgSession");
27205
- PgTransaction = class extends (_b113 = PgDatabase, _a159 = entityKind, _b113) {
27937
+ __publicField(PgSession, _a160, "PgSession");
27938
+ PgTransaction = class extends (_b113 = PgDatabase, _a161 = entityKind, _b113) {
27206
27939
  constructor(dialect4, session, schema4, nestedIndex = 0) {
27207
27940
  super(dialect4, session, schema4);
27208
27941
  this.schema = schema4;
@@ -27229,7 +27962,7 @@ var init_session = __esm({
27229
27962
  return this.session.execute(sql`set transaction ${this.getTransactionConfigSQL(config)}`);
27230
27963
  }
27231
27964
  };
27232
- __publicField(PgTransaction, _a159, "PgTransaction");
27965
+ __publicField(PgTransaction, _a161, "PgTransaction");
27233
27966
  }
27234
27967
  });
27235
27968
 
@@ -27250,10 +27983,13 @@ function getTableConfig(table4) {
27250
27983
  const uniqueConstraints = [];
27251
27984
  const name2 = table4[Table.Symbol.Name];
27252
27985
  const schema4 = table4[Table.Symbol.Schema];
27986
+ const policies = [];
27987
+ const enableRLS = table4[PgTable.Symbol.EnableRLS];
27253
27988
  const extraConfigBuilder = table4[PgTable.Symbol.ExtraConfigBuilder];
27254
27989
  if (extraConfigBuilder !== void 0) {
27255
27990
  const extraConfig = extraConfigBuilder(table4[Table.Symbol.ExtraConfigColumns]);
27256
- for (const builder of Object.values(extraConfig)) {
27991
+ const extraValues = Array.isArray(extraConfig) ? extraConfig.flat(1) : Object.values(extraConfig);
27992
+ for (const builder of extraValues) {
27257
27993
  if (is(builder, IndexBuilder)) {
27258
27994
  indexes.push(builder.build(table4));
27259
27995
  } else if (is(builder, CheckBuilder)) {
@@ -27264,6 +28000,8 @@ function getTableConfig(table4) {
27264
28000
  primaryKeys.push(builder.build(table4));
27265
28001
  } else if (is(builder, ForeignKeyBuilder)) {
27266
28002
  foreignKeys.push(builder.build(table4));
28003
+ } else if (is(builder, PgPolicy)) {
28004
+ policies.push(builder);
27267
28005
  }
27268
28006
  }
27269
28007
  }
@@ -27275,7 +28013,9 @@ function getTableConfig(table4) {
27275
28013
  primaryKeys,
27276
28014
  uniqueConstraints,
27277
28015
  name: name2,
27278
- schema: schema4
28016
+ schema: schema4,
28017
+ policies,
28018
+ enableRLS
27279
28019
  };
27280
28020
  }
27281
28021
  function getViewConfig(view4) {
@@ -27300,6 +28040,7 @@ var init_utils4 = __esm({
27300
28040
  init_checks();
27301
28041
  init_foreign_keys();
27302
28042
  init_indexes();
28043
+ init_policies();
27303
28044
  init_primary_keys();
27304
28045
  init_unique_constraint();
27305
28046
  init_view_common2();
@@ -27326,8 +28067,10 @@ var init_pg_core = __esm({
27326
28067
  init_dialect();
27327
28068
  init_foreign_keys();
27328
28069
  init_indexes();
28070
+ init_policies();
27329
28071
  init_primary_keys();
27330
28072
  init_query_builders();
28073
+ init_roles();
27331
28074
  init_schema();
27332
28075
  init_sequence();
27333
28076
  init_session();
@@ -27349,14 +28092,14 @@ function maxRangeForIdentityBasedOn(columnType) {
27349
28092
  return columnType === "integer" ? "2147483647" : columnType === "bigint" ? "9223372036854775807" : "32767";
27350
28093
  }
27351
28094
  function minRangeForIdentityBasedOn(columnType) {
27352
- return columnType === "integer" ? "-2147483648" : columnType === "bitint" ? "-9223372036854775808" : "-32768";
28095
+ return columnType === "integer" ? "-2147483648" : columnType === "bigint" ? "-9223372036854775808" : "-32768";
27353
28096
  }
27354
28097
  function stringFromDatabaseIdentityProperty(field) {
27355
28098
  return typeof field === "string" ? field : typeof field === "undefined" ? void 0 : typeof field === "bigint" ? field.toString() : String(field);
27356
28099
  }
27357
- function buildArrayString(array, sqlType) {
28100
+ function buildArrayString(array2, sqlType) {
27358
28101
  sqlType = sqlType.split("[")[0];
27359
- const values = array.map((value) => {
28102
+ const values = array2.map((value) => {
27360
28103
  if (typeof value === "number" || typeof value === "bigint") {
27361
28104
  return value.toString();
27362
28105
  } else if (typeof value === "boolean") {
@@ -27378,6 +28121,40 @@ function buildArrayString(array, sqlType) {
27378
28121
  }).join(",");
27379
28122
  return `{${values}}`;
27380
28123
  }
28124
+ function prepareRoles(entities) {
28125
+ let useRoles = false;
28126
+ const includeRoles = [];
28127
+ const excludeRoles = [];
28128
+ if (entities && entities.roles) {
28129
+ if (typeof entities.roles === "object") {
28130
+ if (entities.roles.provider) {
28131
+ if (entities.roles.provider === "supabase") {
28132
+ excludeRoles.push(...[
28133
+ "anon",
28134
+ "authenticator",
28135
+ "authenticated",
28136
+ "service_role",
28137
+ "supabase_auth_admin",
28138
+ "supabase_storage_admin",
28139
+ "dashboard_user",
28140
+ "supabase_admin"
28141
+ ]);
28142
+ } else if (entities.roles.provider === "neon") {
28143
+ excludeRoles.push(...["authenticated", "anonymous"]);
28144
+ }
28145
+ }
28146
+ if (entities.roles.include) {
28147
+ includeRoles.push(...entities.roles.include);
28148
+ }
28149
+ if (entities.roles.exclude) {
28150
+ excludeRoles.push(...entities.roles.exclude);
28151
+ }
28152
+ } else {
28153
+ useRoles = entities.roles;
28154
+ }
28155
+ }
28156
+ return { useRoles, includeRoles, excludeRoles };
28157
+ }
27381
28158
  var indexName, generatePgSnapshot, trimChar, fromDatabase, defaultForColumn, getColumnsInfoQuery;
27382
28159
  var init_pgSerializer = __esm({
27383
28160
  "src/serializer/pgSerializer.ts"() {
@@ -27393,15 +28170,27 @@ var init_pgSerializer = __esm({
27393
28170
  indexName = (tableName, columns) => {
27394
28171
  return `${tableName}_${columns.join("_")}_index`;
27395
28172
  };
27396
- generatePgSnapshot = (tables, enums, schemas, sequences, views, matViews, casing2, schemaFilter) => {
28173
+ generatePgSnapshot = (tables, enums, schemas, sequences, roles, views, matViews, casing2, schemaFilter) => {
27397
28174
  const dialect4 = new PgDialect({ casing: casing2 });
27398
28175
  const result = {};
27399
28176
  const resultViews = {};
27400
28177
  const sequencesToReturn = {};
28178
+ const rolesToReturn = {};
27401
28179
  const indexesInSchema = {};
27402
28180
  for (const table4 of tables) {
27403
28181
  const checksInTable = {};
27404
- const { name: tableName, columns, indexes, foreignKeys, checks, schema: schema4, primaryKeys, uniqueConstraints } = getTableConfig(table4);
28182
+ const {
28183
+ name: tableName,
28184
+ columns,
28185
+ indexes,
28186
+ foreignKeys,
28187
+ checks,
28188
+ schema: schema4,
28189
+ primaryKeys,
28190
+ uniqueConstraints,
28191
+ policies,
28192
+ enableRLS
28193
+ } = getTableConfig(table4);
27405
28194
  if (schemaFilter && !schemaFilter.includes(schema4 ?? "public")) {
27406
28195
  continue;
27407
28196
  }
@@ -27411,6 +28200,7 @@ var init_pgSerializer = __esm({
27411
28200
  const foreignKeysObject = {};
27412
28201
  const primaryKeysObject = {};
27413
28202
  const uniqueConstraintObject = {};
28203
+ const policiesObject = {};
27414
28204
  columns.forEach((column4) => {
27415
28205
  const name2 = getColumnCasing(column4, casing2);
27416
28206
  const notNull = column4.notNull;
@@ -27658,6 +28448,34 @@ ${withStyle.errorWarning(
27658
28448
  with: value.config.with ?? {}
27659
28449
  };
27660
28450
  });
28451
+ policies.forEach((policy2) => {
28452
+ const mappedTo = [];
28453
+ if (!policy2.to) {
28454
+ mappedTo.push("public");
28455
+ } else {
28456
+ if (policy2.to && typeof policy2.to === "string") {
28457
+ mappedTo.push(policy2.to);
28458
+ } else if (policy2.to && is(policy2.to, PgRole)) {
28459
+ mappedTo.push(policy2.to.name);
28460
+ } else if (policy2.to && Array.isArray(policy2.to)) {
28461
+ policy2.to.forEach((it) => {
28462
+ if (typeof it === "string") {
28463
+ mappedTo.push(it);
28464
+ } else if (is(it, PgRole)) {
28465
+ mappedTo.push(it.name);
28466
+ }
28467
+ });
28468
+ }
28469
+ }
28470
+ policiesObject[policy2.name] = {
28471
+ name: policy2.name,
28472
+ as: policy2.as?.toUpperCase() ?? "PERMISSIVE",
28473
+ for: policy2.for?.toUpperCase() ?? "ALL",
28474
+ to: mappedTo.sort(),
28475
+ using: is(policy2.using, SQL) ? dialect4.sqlToQuery(policy2.using).sql : void 0,
28476
+ withCheck: is(policy2.withCheck, SQL) ? dialect4.sqlToQuery(policy2.withCheck).sql : void 0
28477
+ };
28478
+ });
27661
28479
  checks.forEach((check) => {
27662
28480
  const checkName = check.name;
27663
28481
  if (typeof checksInTable[`"${schema4 ?? "public"}"."${tableName}"`] !== "undefined") {
@@ -27694,7 +28512,9 @@ ${withStyle.errorWarning(
27694
28512
  foreignKeys: foreignKeysObject,
27695
28513
  compositePrimaryKeys: primaryKeysObject,
27696
28514
  uniqueConstraints: uniqueConstraintObject,
27697
- checkConstraints: checksObject
28515
+ policies: policiesObject,
28516
+ checkConstraints: checksObject,
28517
+ isRLSEnabled: enableRLS
27698
28518
  };
27699
28519
  }
27700
28520
  for (const sequence of sequences) {
@@ -27718,6 +28538,16 @@ ${withStyle.errorWarning(
27718
28538
  } else {
27719
28539
  }
27720
28540
  }
28541
+ for (const role of roles) {
28542
+ if (!role._existing) {
28543
+ rolesToReturn[role.name] = {
28544
+ name: role.name,
28545
+ createDb: role.createDb === void 0 ? false : role.createDb,
28546
+ createRole: role.createRole === void 0 ? false : role.createRole,
28547
+ inherit: role.inherit === void 0 ? true : role.inherit
28548
+ };
28549
+ }
28550
+ }
27721
28551
  const combinedViews = [...views, ...matViews];
27722
28552
  for (const view4 of combinedViews) {
27723
28553
  let viewName;
@@ -27874,6 +28704,7 @@ ${withStyle.errorWarning(
27874
28704
  enums: enumsToReturn,
27875
28705
  schemas: schemasObject,
27876
28706
  sequences: sequencesToReturn,
28707
+ roles: rolesToReturn,
27877
28708
  views: resultViews,
27878
28709
  _meta: {
27879
28710
  schemas: {},
@@ -27889,7 +28720,7 @@ ${withStyle.errorWarning(
27889
28720
  while (end > start && str[end - 1] === char3) --end;
27890
28721
  return start > 0 || end < str.length ? str.substring(start, end) : str.toString();
27891
28722
  };
27892
- fromDatabase = async (db, tablesFilter = () => true, schemaFilters, progressCallback) => {
28723
+ fromDatabase = async (db, tablesFilter = () => true, schemaFilters, entities, progressCallback) => {
27893
28724
  const result = {};
27894
28725
  const views = {};
27895
28726
  const internals = { tables: {} };
@@ -27902,7 +28733,8 @@ ${withStyle.errorWarning(
27902
28733
  WHEN c.relkind = 'r' THEN 'table'
27903
28734
  WHEN c.relkind = 'v' THEN 'view'
27904
28735
  WHEN c.relkind = 'm' THEN 'materialized_view'
27905
- END AS type
28736
+ END AS type,
28737
+ c.relrowsecurity AS rls_enabled
27906
28738
  FROM
27907
28739
  pg_catalog.pg_class c
27908
28740
  JOIN
@@ -27988,6 +28820,60 @@ WHERE
27988
28820
  if (progressCallback) {
27989
28821
  progressCallback("enums", Object.keys(enumsToReturn).length, "done");
27990
28822
  }
28823
+ const allRoles = await db.query(
28824
+ `SELECT rolname, rolinherit, rolcreatedb, rolcreaterole FROM pg_roles;`
28825
+ );
28826
+ const rolesToReturn = {};
28827
+ const preparedRoles = prepareRoles(entities);
28828
+ if (preparedRoles.useRoles || !(preparedRoles.includeRoles.length === 0 && preparedRoles.excludeRoles.length === 0)) {
28829
+ for (const dbRole of allRoles) {
28830
+ if (preparedRoles.useRoles) {
28831
+ rolesToReturn[dbRole.rolname] = {
28832
+ createDb: dbRole.rolcreatedb,
28833
+ createRole: dbRole.rolcreatedb,
28834
+ inherit: dbRole.rolinherit,
28835
+ name: dbRole.rolname
28836
+ };
28837
+ } else {
28838
+ if (preparedRoles.includeRoles.length === 0 && preparedRoles.excludeRoles.length === 0) continue;
28839
+ if (preparedRoles.includeRoles.includes(dbRole.rolname) && preparedRoles.excludeRoles.includes(dbRole.rolname)) continue;
28840
+ if (preparedRoles.excludeRoles.includes(dbRole.rolname)) continue;
28841
+ if (!preparedRoles.includeRoles.includes(dbRole.rolname)) continue;
28842
+ rolesToReturn[dbRole.rolname] = {
28843
+ createDb: dbRole.rolcreatedb,
28844
+ createRole: dbRole.rolcreaterole,
28845
+ inherit: dbRole.rolinherit,
28846
+ name: dbRole.rolname
28847
+ };
28848
+ }
28849
+ }
28850
+ }
28851
+ const wherePolicies = schemaFilters.map((t) => `schemaname = '${t}'`).join(" or ");
28852
+ const policiesByTable = {};
28853
+ 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}`};`);
28854
+ for (const dbPolicy of allPolicies) {
28855
+ const { tablename, schemaname, to, withCheck, using, ...rest } = dbPolicy;
28856
+ const tableForPolicy = policiesByTable[`${schemaname}.${tablename}`];
28857
+ const parsedTo = to;
28858
+ const parsedWithCheck = withCheck === null ? void 0 : withCheck;
28859
+ const parsedUsing = using === null ? void 0 : using;
28860
+ if (tableForPolicy) {
28861
+ tableForPolicy[dbPolicy.name] = { ...rest, to: parsedTo };
28862
+ } else {
28863
+ policiesByTable[`${schemaname}.${tablename}`] = {
28864
+ [dbPolicy.name]: { ...rest, to: parsedTo, withCheck: parsedWithCheck, using: parsedUsing }
28865
+ };
28866
+ }
28867
+ }
28868
+ if (progressCallback) {
28869
+ progressCallback(
28870
+ "policies",
28871
+ Object.values(policiesByTable).reduce((total, innerRecord) => {
28872
+ return total + Object.keys(innerRecord).length;
28873
+ }, 0),
28874
+ "done"
28875
+ );
28876
+ }
27991
28877
  const sequencesInColumns = [];
27992
28878
  const all = allTables.filter((it) => it.type === "table").map((row) => {
27993
28879
  return new Promise(async (res, rej) => {
@@ -28349,7 +29235,7 @@ WHERE
28349
29235
  }
28350
29236
  ],
28351
29237
  isUnique: indexIsUnique,
28352
- // should not be a part of diff detecs
29238
+ // should not be a part of diff detects
28353
29239
  concurrently: false,
28354
29240
  method: indexMethod,
28355
29241
  where: indexWhere === null ? void 0 : indexWhere,
@@ -28369,7 +29255,9 @@ WHERE
28369
29255
  foreignKeys: foreignKeysToReturn,
28370
29256
  compositePrimaryKeys: primaryKeys,
28371
29257
  uniqueConstraints: uniqueConstrains,
28372
- checkConstraints
29258
+ checkConstraints,
29259
+ policies: policiesByTable[`${tableSchema}.${tableName}`] ?? {},
29260
+ isRLSEnabled: row.rls_enabled
28373
29261
  };
28374
29262
  } catch (e) {
28375
29263
  rej(e);
@@ -28567,6 +29455,7 @@ WHERE
28567
29455
  enums: enumsToReturn,
28568
29456
  schemas: schemasObject,
28569
29457
  sequences: sequencesToReturn,
29458
+ roles: rolesToReturn,
28570
29459
  views,
28571
29460
  _meta: {
28572
29461
  schemas: {},
@@ -28761,12 +29650,12 @@ var init_alias3 = __esm({
28761
29650
  });
28762
29651
 
28763
29652
  // ../drizzle-orm/dist/sqlite-core/checks.js
28764
- var _a160, CheckBuilder2, _a161, Check2;
29653
+ var _a162, CheckBuilder2, _a163, Check2;
28765
29654
  var init_checks2 = __esm({
28766
29655
  "../drizzle-orm/dist/sqlite-core/checks.js"() {
28767
29656
  "use strict";
28768
29657
  init_entity();
28769
- _a160 = entityKind;
29658
+ _a162 = entityKind;
28770
29659
  CheckBuilder2 = class {
28771
29660
  constructor(name2, value) {
28772
29661
  __publicField(this, "brand");
@@ -28777,8 +29666,8 @@ var init_checks2 = __esm({
28777
29666
  return new Check2(table4, this);
28778
29667
  }
28779
29668
  };
28780
- __publicField(CheckBuilder2, _a160, "SQLiteCheckBuilder");
28781
- _a161 = entityKind;
29669
+ __publicField(CheckBuilder2, _a162, "SQLiteCheckBuilder");
29670
+ _a163 = entityKind;
28782
29671
  Check2 = class {
28783
29672
  constructor(table4, builder) {
28784
29673
  __publicField(this, "name");
@@ -28788,18 +29677,18 @@ var init_checks2 = __esm({
28788
29677
  this.value = builder.value;
28789
29678
  }
28790
29679
  };
28791
- __publicField(Check2, _a161, "SQLiteCheck");
29680
+ __publicField(Check2, _a163, "SQLiteCheck");
28792
29681
  }
28793
29682
  });
28794
29683
 
28795
29684
  // ../drizzle-orm/dist/sqlite-core/foreign-keys.js
28796
- var _a162, ForeignKeyBuilder2, _a163, ForeignKey2;
29685
+ var _a164, ForeignKeyBuilder2, _a165, ForeignKey2;
28797
29686
  var init_foreign_keys2 = __esm({
28798
29687
  "../drizzle-orm/dist/sqlite-core/foreign-keys.js"() {
28799
29688
  "use strict";
28800
29689
  init_entity();
28801
29690
  init_table_utils();
28802
- _a162 = entityKind;
29691
+ _a164 = entityKind;
28803
29692
  ForeignKeyBuilder2 = class {
28804
29693
  constructor(config, actions) {
28805
29694
  /** @internal */
@@ -28830,8 +29719,8 @@ var init_foreign_keys2 = __esm({
28830
29719
  return new ForeignKey2(table4, this);
28831
29720
  }
28832
29721
  };
28833
- __publicField(ForeignKeyBuilder2, _a162, "SQLiteForeignKeyBuilder");
28834
- _a163 = entityKind;
29722
+ __publicField(ForeignKeyBuilder2, _a164, "SQLiteForeignKeyBuilder");
29723
+ _a165 = entityKind;
28835
29724
  ForeignKey2 = class {
28836
29725
  constructor(table4, builder) {
28837
29726
  __publicField(this, "reference");
@@ -28855,7 +29744,7 @@ var init_foreign_keys2 = __esm({
28855
29744
  return name2 ?? `${chunks.join("_")}_fk`;
28856
29745
  }
28857
29746
  };
28858
- __publicField(ForeignKey2, _a163, "SQLiteForeignKey");
29747
+ __publicField(ForeignKey2, _a165, "SQLiteForeignKey");
28859
29748
  }
28860
29749
  });
28861
29750
 
@@ -28863,13 +29752,13 @@ var init_foreign_keys2 = __esm({
28863
29752
  function uniqueKeyName2(table4, columns) {
28864
29753
  return `${table4[TableName]}_${columns.join("_")}_unique`;
28865
29754
  }
28866
- var _a164, UniqueConstraintBuilder2, _a165, UniqueOnConstraintBuilder2, _a166, UniqueConstraint2;
29755
+ var _a166, UniqueConstraintBuilder2, _a167, UniqueOnConstraintBuilder2, _a168, UniqueConstraint2;
28867
29756
  var init_unique_constraint2 = __esm({
28868
29757
  "../drizzle-orm/dist/sqlite-core/unique-constraint.js"() {
28869
29758
  "use strict";
28870
29759
  init_entity();
28871
29760
  init_table_utils();
28872
- _a164 = entityKind;
29761
+ _a166 = entityKind;
28873
29762
  UniqueConstraintBuilder2 = class {
28874
29763
  constructor(columns, name2) {
28875
29764
  /** @internal */
@@ -28882,8 +29771,8 @@ var init_unique_constraint2 = __esm({
28882
29771
  return new UniqueConstraint2(table4, this.columns, this.name);
28883
29772
  }
28884
29773
  };
28885
- __publicField(UniqueConstraintBuilder2, _a164, "SQLiteUniqueConstraintBuilder");
28886
- _a165 = entityKind;
29774
+ __publicField(UniqueConstraintBuilder2, _a166, "SQLiteUniqueConstraintBuilder");
29775
+ _a167 = entityKind;
28887
29776
  UniqueOnConstraintBuilder2 = class {
28888
29777
  constructor(name2) {
28889
29778
  /** @internal */
@@ -28894,8 +29783,8 @@ var init_unique_constraint2 = __esm({
28894
29783
  return new UniqueConstraintBuilder2(columns, this.name);
28895
29784
  }
28896
29785
  };
28897
- __publicField(UniqueOnConstraintBuilder2, _a165, "SQLiteUniqueOnConstraintBuilder");
28898
- _a166 = entityKind;
29786
+ __publicField(UniqueOnConstraintBuilder2, _a167, "SQLiteUniqueOnConstraintBuilder");
29787
+ _a168 = entityKind;
28899
29788
  UniqueConstraint2 = class {
28900
29789
  constructor(table4, columns, name2) {
28901
29790
  __publicField(this, "columns");
@@ -28908,12 +29797,12 @@ var init_unique_constraint2 = __esm({
28908
29797
  return this.name;
28909
29798
  }
28910
29799
  };
28911
- __publicField(UniqueConstraint2, _a166, "SQLiteUniqueConstraint");
29800
+ __publicField(UniqueConstraint2, _a168, "SQLiteUniqueConstraint");
28912
29801
  }
28913
29802
  });
28914
29803
 
28915
29804
  // ../drizzle-orm/dist/sqlite-core/columns/common.js
28916
- var _a167, _b114, SQLiteColumnBuilder, _a168, _b115, SQLiteColumn;
29805
+ var _a169, _b114, SQLiteColumnBuilder, _a170, _b115, SQLiteColumn;
28917
29806
  var init_common3 = __esm({
28918
29807
  "../drizzle-orm/dist/sqlite-core/columns/common.js"() {
28919
29808
  "use strict";
@@ -28922,7 +29811,7 @@ var init_common3 = __esm({
28922
29811
  init_entity();
28923
29812
  init_foreign_keys2();
28924
29813
  init_unique_constraint2();
28925
- SQLiteColumnBuilder = class extends (_b114 = ColumnBuilder, _a167 = entityKind, _b114) {
29814
+ SQLiteColumnBuilder = class extends (_b114 = ColumnBuilder, _a169 = entityKind, _b114) {
28926
29815
  constructor() {
28927
29816
  super(...arguments);
28928
29817
  __publicField(this, "foreignKeyConfigs", []);
@@ -28963,8 +29852,8 @@ var init_common3 = __esm({
28963
29852
  });
28964
29853
  }
28965
29854
  };
28966
- __publicField(SQLiteColumnBuilder, _a167, "SQLiteColumnBuilder");
28967
- SQLiteColumn = class extends (_b115 = Column2, _a168 = entityKind, _b115) {
29855
+ __publicField(SQLiteColumnBuilder, _a169, "SQLiteColumnBuilder");
29856
+ SQLiteColumn = class extends (_b115 = Column2, _a170 = entityKind, _b115) {
28968
29857
  constructor(table4, config) {
28969
29858
  if (!config.uniqueName) {
28970
29859
  config.uniqueName = uniqueKeyName2(table4, [config.name]);
@@ -28973,7 +29862,7 @@ var init_common3 = __esm({
28973
29862
  this.table = table4;
28974
29863
  }
28975
29864
  };
28976
- __publicField(SQLiteColumn, _a168, "SQLiteColumn");
29865
+ __publicField(SQLiteColumn, _a170, "SQLiteColumn");
28977
29866
  }
28978
29867
  });
28979
29868
 
@@ -28988,14 +29877,14 @@ function blob(a, b) {
28988
29877
  }
28989
29878
  return new SQLiteBlobBufferBuilder(name2);
28990
29879
  }
28991
- var _a169, _b116, SQLiteBigIntBuilder, _a170, _b117, SQLiteBigInt, _a171, _b118, SQLiteBlobJsonBuilder, _a172, _b119, SQLiteBlobJson, _a173, _b120, SQLiteBlobBufferBuilder, _a174, _b121, SQLiteBlobBuffer;
29880
+ var _a171, _b116, SQLiteBigIntBuilder, _a172, _b117, SQLiteBigInt, _a173, _b118, SQLiteBlobJsonBuilder, _a174, _b119, SQLiteBlobJson, _a175, _b120, SQLiteBlobBufferBuilder, _a176, _b121, SQLiteBlobBuffer;
28992
29881
  var init_blob = __esm({
28993
29882
  "../drizzle-orm/dist/sqlite-core/columns/blob.js"() {
28994
29883
  "use strict";
28995
29884
  init_entity();
28996
29885
  init_utils2();
28997
29886
  init_common3();
28998
- SQLiteBigIntBuilder = class extends (_b116 = SQLiteColumnBuilder, _a169 = entityKind, _b116) {
29887
+ SQLiteBigIntBuilder = class extends (_b116 = SQLiteColumnBuilder, _a171 = entityKind, _b116) {
28999
29888
  constructor(name2) {
29000
29889
  super(name2, "bigint", "SQLiteBigInt");
29001
29890
  }
@@ -29004,8 +29893,8 @@ var init_blob = __esm({
29004
29893
  return new SQLiteBigInt(table4, this.config);
29005
29894
  }
29006
29895
  };
29007
- __publicField(SQLiteBigIntBuilder, _a169, "SQLiteBigIntBuilder");
29008
- SQLiteBigInt = class extends (_b117 = SQLiteColumn, _a170 = entityKind, _b117) {
29896
+ __publicField(SQLiteBigIntBuilder, _a171, "SQLiteBigIntBuilder");
29897
+ SQLiteBigInt = class extends (_b117 = SQLiteColumn, _a172 = entityKind, _b117) {
29009
29898
  getSQLType() {
29010
29899
  return "blob";
29011
29900
  }
@@ -29016,8 +29905,8 @@ var init_blob = __esm({
29016
29905
  return Buffer.from(value.toString());
29017
29906
  }
29018
29907
  };
29019
- __publicField(SQLiteBigInt, _a170, "SQLiteBigInt");
29020
- SQLiteBlobJsonBuilder = class extends (_b118 = SQLiteColumnBuilder, _a171 = entityKind, _b118) {
29908
+ __publicField(SQLiteBigInt, _a172, "SQLiteBigInt");
29909
+ SQLiteBlobJsonBuilder = class extends (_b118 = SQLiteColumnBuilder, _a173 = entityKind, _b118) {
29021
29910
  constructor(name2) {
29022
29911
  super(name2, "json", "SQLiteBlobJson");
29023
29912
  }
@@ -29029,8 +29918,8 @@ var init_blob = __esm({
29029
29918
  );
29030
29919
  }
29031
29920
  };
29032
- __publicField(SQLiteBlobJsonBuilder, _a171, "SQLiteBlobJsonBuilder");
29033
- SQLiteBlobJson = class extends (_b119 = SQLiteColumn, _a172 = entityKind, _b119) {
29921
+ __publicField(SQLiteBlobJsonBuilder, _a173, "SQLiteBlobJsonBuilder");
29922
+ SQLiteBlobJson = class extends (_b119 = SQLiteColumn, _a174 = entityKind, _b119) {
29034
29923
  getSQLType() {
29035
29924
  return "blob";
29036
29925
  }
@@ -29041,8 +29930,8 @@ var init_blob = __esm({
29041
29930
  return Buffer.from(JSON.stringify(value));
29042
29931
  }
29043
29932
  };
29044
- __publicField(SQLiteBlobJson, _a172, "SQLiteBlobJson");
29045
- SQLiteBlobBufferBuilder = class extends (_b120 = SQLiteColumnBuilder, _a173 = entityKind, _b120) {
29933
+ __publicField(SQLiteBlobJson, _a174, "SQLiteBlobJson");
29934
+ SQLiteBlobBufferBuilder = class extends (_b120 = SQLiteColumnBuilder, _a175 = entityKind, _b120) {
29046
29935
  constructor(name2) {
29047
29936
  super(name2, "buffer", "SQLiteBlobBuffer");
29048
29937
  }
@@ -29051,13 +29940,13 @@ var init_blob = __esm({
29051
29940
  return new SQLiteBlobBuffer(table4, this.config);
29052
29941
  }
29053
29942
  };
29054
- __publicField(SQLiteBlobBufferBuilder, _a173, "SQLiteBlobBufferBuilder");
29055
- SQLiteBlobBuffer = class extends (_b121 = SQLiteColumn, _a174 = entityKind, _b121) {
29943
+ __publicField(SQLiteBlobBufferBuilder, _a175, "SQLiteBlobBufferBuilder");
29944
+ SQLiteBlobBuffer = class extends (_b121 = SQLiteColumn, _a176 = entityKind, _b121) {
29056
29945
  getSQLType() {
29057
29946
  return "blob";
29058
29947
  }
29059
29948
  };
29060
- __publicField(SQLiteBlobBuffer, _a174, "SQLiteBlobBuffer");
29949
+ __publicField(SQLiteBlobBuffer, _a176, "SQLiteBlobBuffer");
29061
29950
  }
29062
29951
  });
29063
29952
 
@@ -29072,14 +29961,14 @@ function customType2(customTypeParams) {
29072
29961
  );
29073
29962
  };
29074
29963
  }
29075
- var _a175, _b122, SQLiteCustomColumnBuilder, _a176, _b123, SQLiteCustomColumn;
29964
+ var _a177, _b122, SQLiteCustomColumnBuilder, _a178, _b123, SQLiteCustomColumn;
29076
29965
  var init_custom2 = __esm({
29077
29966
  "../drizzle-orm/dist/sqlite-core/columns/custom.js"() {
29078
29967
  "use strict";
29079
29968
  init_entity();
29080
29969
  init_utils2();
29081
29970
  init_common3();
29082
- SQLiteCustomColumnBuilder = class extends (_b122 = SQLiteColumnBuilder, _a175 = entityKind, _b122) {
29971
+ SQLiteCustomColumnBuilder = class extends (_b122 = SQLiteColumnBuilder, _a177 = entityKind, _b122) {
29083
29972
  constructor(name2, fieldConfig, customTypeParams) {
29084
29973
  super(name2, "custom", "SQLiteCustomColumn");
29085
29974
  this.config.fieldConfig = fieldConfig;
@@ -29093,8 +29982,8 @@ var init_custom2 = __esm({
29093
29982
  );
29094
29983
  }
29095
29984
  };
29096
- __publicField(SQLiteCustomColumnBuilder, _a175, "SQLiteCustomColumnBuilder");
29097
- SQLiteCustomColumn = class extends (_b123 = SQLiteColumn, _a176 = entityKind, _b123) {
29985
+ __publicField(SQLiteCustomColumnBuilder, _a177, "SQLiteCustomColumnBuilder");
29986
+ SQLiteCustomColumn = class extends (_b123 = SQLiteColumn, _a178 = entityKind, _b123) {
29098
29987
  constructor(table4, config) {
29099
29988
  super(table4, config);
29100
29989
  __publicField(this, "sqlName");
@@ -29114,7 +30003,7 @@ var init_custom2 = __esm({
29114
30003
  return typeof this.mapTo === "function" ? this.mapTo(value) : value;
29115
30004
  }
29116
30005
  };
29117
- __publicField(SQLiteCustomColumn, _a176, "SQLiteCustomColumn");
30006
+ __publicField(SQLiteCustomColumn, _a178, "SQLiteCustomColumn");
29118
30007
  }
29119
30008
  });
29120
30009
 
@@ -29129,7 +30018,7 @@ function integer2(a, b) {
29129
30018
  }
29130
30019
  return new SQLiteIntegerBuilder(name2);
29131
30020
  }
29132
- 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;
30021
+ 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;
29133
30022
  var init_integer2 = __esm({
29134
30023
  "../drizzle-orm/dist/sqlite-core/columns/integer.js"() {
29135
30024
  "use strict";
@@ -29137,7 +30026,7 @@ var init_integer2 = __esm({
29137
30026
  init_sql();
29138
30027
  init_utils2();
29139
30028
  init_common3();
29140
- SQLiteBaseIntegerBuilder = class extends (_b124 = SQLiteColumnBuilder, _a177 = entityKind, _b124) {
30029
+ SQLiteBaseIntegerBuilder = class extends (_b124 = SQLiteColumnBuilder, _a179 = entityKind, _b124) {
29141
30030
  constructor(name2, dataType, columnType) {
29142
30031
  super(name2, dataType, columnType);
29143
30032
  this.config.autoIncrement = false;
@@ -29150,8 +30039,8 @@ var init_integer2 = __esm({
29150
30039
  return super.primaryKey();
29151
30040
  }
29152
30041
  };
29153
- __publicField(SQLiteBaseIntegerBuilder, _a177, "SQLiteBaseIntegerBuilder");
29154
- SQLiteBaseInteger = class extends (_b125 = SQLiteColumn, _a178 = entityKind, _b125) {
30042
+ __publicField(SQLiteBaseIntegerBuilder, _a179, "SQLiteBaseIntegerBuilder");
30043
+ SQLiteBaseInteger = class extends (_b125 = SQLiteColumn, _a180 = entityKind, _b125) {
29155
30044
  constructor() {
29156
30045
  super(...arguments);
29157
30046
  __publicField(this, "autoIncrement", this.config.autoIncrement);
@@ -29160,8 +30049,8 @@ var init_integer2 = __esm({
29160
30049
  return "integer";
29161
30050
  }
29162
30051
  };
29163
- __publicField(SQLiteBaseInteger, _a178, "SQLiteBaseInteger");
29164
- SQLiteIntegerBuilder = class extends (_b126 = SQLiteBaseIntegerBuilder, _a179 = entityKind, _b126) {
30052
+ __publicField(SQLiteBaseInteger, _a180, "SQLiteBaseInteger");
30053
+ SQLiteIntegerBuilder = class extends (_b126 = SQLiteBaseIntegerBuilder, _a181 = entityKind, _b126) {
29165
30054
  constructor(name2) {
29166
30055
  super(name2, "number", "SQLiteInteger");
29167
30056
  }
@@ -29172,11 +30061,11 @@ var init_integer2 = __esm({
29172
30061
  );
29173
30062
  }
29174
30063
  };
29175
- __publicField(SQLiteIntegerBuilder, _a179, "SQLiteIntegerBuilder");
29176
- SQLiteInteger = class extends (_b127 = SQLiteBaseInteger, _a180 = entityKind, _b127) {
30064
+ __publicField(SQLiteIntegerBuilder, _a181, "SQLiteIntegerBuilder");
30065
+ SQLiteInteger = class extends (_b127 = SQLiteBaseInteger, _a182 = entityKind, _b127) {
29177
30066
  };
29178
- __publicField(SQLiteInteger, _a180, "SQLiteInteger");
29179
- SQLiteTimestampBuilder = class extends (_b128 = SQLiteBaseIntegerBuilder, _a181 = entityKind, _b128) {
30067
+ __publicField(SQLiteInteger, _a182, "SQLiteInteger");
30068
+ SQLiteTimestampBuilder = class extends (_b128 = SQLiteBaseIntegerBuilder, _a183 = entityKind, _b128) {
29180
30069
  constructor(name2, mode) {
29181
30070
  super(name2, "date", "SQLiteTimestamp");
29182
30071
  this.config.mode = mode;
@@ -29196,8 +30085,8 @@ var init_integer2 = __esm({
29196
30085
  );
29197
30086
  }
29198
30087
  };
29199
- __publicField(SQLiteTimestampBuilder, _a181, "SQLiteTimestampBuilder");
29200
- SQLiteTimestamp = class extends (_b129 = SQLiteBaseInteger, _a182 = entityKind, _b129) {
30088
+ __publicField(SQLiteTimestampBuilder, _a183, "SQLiteTimestampBuilder");
30089
+ SQLiteTimestamp = class extends (_b129 = SQLiteBaseInteger, _a184 = entityKind, _b129) {
29201
30090
  constructor() {
29202
30091
  super(...arguments);
29203
30092
  __publicField(this, "mode", this.config.mode);
@@ -29216,8 +30105,8 @@ var init_integer2 = __esm({
29216
30105
  return unix;
29217
30106
  }
29218
30107
  };
29219
- __publicField(SQLiteTimestamp, _a182, "SQLiteTimestamp");
29220
- SQLiteBooleanBuilder = class extends (_b130 = SQLiteBaseIntegerBuilder, _a183 = entityKind, _b130) {
30108
+ __publicField(SQLiteTimestamp, _a184, "SQLiteTimestamp");
30109
+ SQLiteBooleanBuilder = class extends (_b130 = SQLiteBaseIntegerBuilder, _a185 = entityKind, _b130) {
29221
30110
  constructor(name2, mode) {
29222
30111
  super(name2, "boolean", "SQLiteBoolean");
29223
30112
  this.config.mode = mode;
@@ -29229,8 +30118,8 @@ var init_integer2 = __esm({
29229
30118
  );
29230
30119
  }
29231
30120
  };
29232
- __publicField(SQLiteBooleanBuilder, _a183, "SQLiteBooleanBuilder");
29233
- SQLiteBoolean = class extends (_b131 = SQLiteBaseInteger, _a184 = entityKind, _b131) {
30121
+ __publicField(SQLiteBooleanBuilder, _a185, "SQLiteBooleanBuilder");
30122
+ SQLiteBoolean = class extends (_b131 = SQLiteBaseInteger, _a186 = entityKind, _b131) {
29234
30123
  constructor() {
29235
30124
  super(...arguments);
29236
30125
  __publicField(this, "mode", this.config.mode);
@@ -29242,7 +30131,7 @@ var init_integer2 = __esm({
29242
30131
  return value ? 1 : 0;
29243
30132
  }
29244
30133
  };
29245
- __publicField(SQLiteBoolean, _a184, "SQLiteBoolean");
30134
+ __publicField(SQLiteBoolean, _a186, "SQLiteBoolean");
29246
30135
  }
29247
30136
  });
29248
30137
 
@@ -29250,13 +30139,13 @@ var init_integer2 = __esm({
29250
30139
  function numeric2(name2) {
29251
30140
  return new SQLiteNumericBuilder(name2 ?? "");
29252
30141
  }
29253
- var _a185, _b132, SQLiteNumericBuilder, _a186, _b133, SQLiteNumeric;
30142
+ var _a187, _b132, SQLiteNumericBuilder, _a188, _b133, SQLiteNumeric;
29254
30143
  var init_numeric2 = __esm({
29255
30144
  "../drizzle-orm/dist/sqlite-core/columns/numeric.js"() {
29256
30145
  "use strict";
29257
30146
  init_entity();
29258
30147
  init_common3();
29259
- SQLiteNumericBuilder = class extends (_b132 = SQLiteColumnBuilder, _a185 = entityKind, _b132) {
30148
+ SQLiteNumericBuilder = class extends (_b132 = SQLiteColumnBuilder, _a187 = entityKind, _b132) {
29260
30149
  constructor(name2) {
29261
30150
  super(name2, "string", "SQLiteNumeric");
29262
30151
  }
@@ -29268,13 +30157,13 @@ var init_numeric2 = __esm({
29268
30157
  );
29269
30158
  }
29270
30159
  };
29271
- __publicField(SQLiteNumericBuilder, _a185, "SQLiteNumericBuilder");
29272
- SQLiteNumeric = class extends (_b133 = SQLiteColumn, _a186 = entityKind, _b133) {
30160
+ __publicField(SQLiteNumericBuilder, _a187, "SQLiteNumericBuilder");
30161
+ SQLiteNumeric = class extends (_b133 = SQLiteColumn, _a188 = entityKind, _b133) {
29273
30162
  getSQLType() {
29274
30163
  return "numeric";
29275
30164
  }
29276
30165
  };
29277
- __publicField(SQLiteNumeric, _a186, "SQLiteNumeric");
30166
+ __publicField(SQLiteNumeric, _a188, "SQLiteNumeric");
29278
30167
  }
29279
30168
  });
29280
30169
 
@@ -29282,13 +30171,13 @@ var init_numeric2 = __esm({
29282
30171
  function real2(name2) {
29283
30172
  return new SQLiteRealBuilder(name2 ?? "");
29284
30173
  }
29285
- var _a187, _b134, SQLiteRealBuilder, _a188, _b135, SQLiteReal;
30174
+ var _a189, _b134, SQLiteRealBuilder, _a190, _b135, SQLiteReal;
29286
30175
  var init_real2 = __esm({
29287
30176
  "../drizzle-orm/dist/sqlite-core/columns/real.js"() {
29288
30177
  "use strict";
29289
30178
  init_entity();
29290
30179
  init_common3();
29291
- SQLiteRealBuilder = class extends (_b134 = SQLiteColumnBuilder, _a187 = entityKind, _b134) {
30180
+ SQLiteRealBuilder = class extends (_b134 = SQLiteColumnBuilder, _a189 = entityKind, _b134) {
29292
30181
  constructor(name2) {
29293
30182
  super(name2, "number", "SQLiteReal");
29294
30183
  }
@@ -29297,13 +30186,13 @@ var init_real2 = __esm({
29297
30186
  return new SQLiteReal(table4, this.config);
29298
30187
  }
29299
30188
  };
29300
- __publicField(SQLiteRealBuilder, _a187, "SQLiteRealBuilder");
29301
- SQLiteReal = class extends (_b135 = SQLiteColumn, _a188 = entityKind, _b135) {
30189
+ __publicField(SQLiteRealBuilder, _a189, "SQLiteRealBuilder");
30190
+ SQLiteReal = class extends (_b135 = SQLiteColumn, _a190 = entityKind, _b135) {
29302
30191
  getSQLType() {
29303
30192
  return "real";
29304
30193
  }
29305
30194
  };
29306
- __publicField(SQLiteReal, _a188, "SQLiteReal");
30195
+ __publicField(SQLiteReal, _a190, "SQLiteReal");
29307
30196
  }
29308
30197
  });
29309
30198
 
@@ -29315,14 +30204,14 @@ function text2(a, b = {}) {
29315
30204
  }
29316
30205
  return new SQLiteTextBuilder(name2, config);
29317
30206
  }
29318
- var _a189, _b136, SQLiteTextBuilder, _a190, _b137, SQLiteText, _a191, _b138, SQLiteTextJsonBuilder, _a192, _b139, SQLiteTextJson;
30207
+ var _a191, _b136, SQLiteTextBuilder, _a192, _b137, SQLiteText, _a193, _b138, SQLiteTextJsonBuilder, _a194, _b139, SQLiteTextJson;
29319
30208
  var init_text2 = __esm({
29320
30209
  "../drizzle-orm/dist/sqlite-core/columns/text.js"() {
29321
30210
  "use strict";
29322
30211
  init_entity();
29323
30212
  init_utils2();
29324
30213
  init_common3();
29325
- SQLiteTextBuilder = class extends (_b136 = SQLiteColumnBuilder, _a189 = entityKind, _b136) {
30214
+ SQLiteTextBuilder = class extends (_b136 = SQLiteColumnBuilder, _a191 = entityKind, _b136) {
29326
30215
  constructor(name2, config) {
29327
30216
  super(name2, "string", "SQLiteText");
29328
30217
  this.config.enumValues = config.enum;
@@ -29333,8 +30222,8 @@ var init_text2 = __esm({
29333
30222
  return new SQLiteText(table4, this.config);
29334
30223
  }
29335
30224
  };
29336
- __publicField(SQLiteTextBuilder, _a189, "SQLiteTextBuilder");
29337
- SQLiteText = class extends (_b137 = SQLiteColumn, _a190 = entityKind, _b137) {
30225
+ __publicField(SQLiteTextBuilder, _a191, "SQLiteTextBuilder");
30226
+ SQLiteText = class extends (_b137 = SQLiteColumn, _a192 = entityKind, _b137) {
29338
30227
  constructor(table4, config) {
29339
30228
  super(table4, config);
29340
30229
  __publicField(this, "enumValues", this.config.enumValues);
@@ -29344,8 +30233,8 @@ var init_text2 = __esm({
29344
30233
  return `text${this.config.length ? `(${this.config.length})` : ""}`;
29345
30234
  }
29346
30235
  };
29347
- __publicField(SQLiteText, _a190, "SQLiteText");
29348
- SQLiteTextJsonBuilder = class extends (_b138 = SQLiteColumnBuilder, _a191 = entityKind, _b138) {
30236
+ __publicField(SQLiteText, _a192, "SQLiteText");
30237
+ SQLiteTextJsonBuilder = class extends (_b138 = SQLiteColumnBuilder, _a193 = entityKind, _b138) {
29349
30238
  constructor(name2) {
29350
30239
  super(name2, "json", "SQLiteTextJson");
29351
30240
  }
@@ -29357,8 +30246,8 @@ var init_text2 = __esm({
29357
30246
  );
29358
30247
  }
29359
30248
  };
29360
- __publicField(SQLiteTextJsonBuilder, _a191, "SQLiteTextJsonBuilder");
29361
- SQLiteTextJson = class extends (_b139 = SQLiteColumn, _a192 = entityKind, _b139) {
30249
+ __publicField(SQLiteTextJsonBuilder, _a193, "SQLiteTextJsonBuilder");
30250
+ SQLiteTextJson = class extends (_b139 = SQLiteColumn, _a194 = entityKind, _b139) {
29362
30251
  getSQLType() {
29363
30252
  return "text";
29364
30253
  }
@@ -29369,7 +30258,7 @@ var init_text2 = __esm({
29369
30258
  return JSON.stringify(value);
29370
30259
  }
29371
30260
  };
29372
- __publicField(SQLiteTextJson, _a192, "SQLiteTextJson");
30261
+ __publicField(SQLiteTextJson, _a194, "SQLiteTextJson");
29373
30262
  }
29374
30263
  });
29375
30264
 
@@ -29431,7 +30320,7 @@ function sqliteTableBase(name2, columns, extraConfig, schema4, baseName = name2)
29431
30320
  }
29432
30321
  return table4;
29433
30322
  }
29434
- var InlineForeignKeys2, _a193, _b140, _c6, _d3, _e2, SQLiteTable, sqliteTable;
30323
+ var InlineForeignKeys2, _a195, _b140, _c6, _d3, _e3, SQLiteTable, sqliteTable;
29435
30324
  var init_table3 = __esm({
29436
30325
  "../drizzle-orm/dist/sqlite-core/table.js"() {
29437
30326
  "use strict";
@@ -29439,7 +30328,7 @@ var init_table3 = __esm({
29439
30328
  init_table();
29440
30329
  init_all2();
29441
30330
  InlineForeignKeys2 = Symbol.for("drizzle:SQLiteInlineForeignKeys");
29442
- SQLiteTable = class extends (_e2 = Table, _d3 = entityKind, _c6 = Table.Symbol.Columns, _b140 = InlineForeignKeys2, _a193 = Table.Symbol.ExtraConfigBuilder, _e2) {
30331
+ SQLiteTable = class extends (_e3 = Table, _d3 = entityKind, _c6 = Table.Symbol.Columns, _b140 = InlineForeignKeys2, _a195 = Table.Symbol.ExtraConfigBuilder, _e3) {
29443
30332
  constructor() {
29444
30333
  super(...arguments);
29445
30334
  /** @internal */
@@ -29447,7 +30336,7 @@ var init_table3 = __esm({
29447
30336
  /** @internal */
29448
30337
  __publicField(this, _b140, []);
29449
30338
  /** @internal */
29450
- __publicField(this, _a193);
30339
+ __publicField(this, _a195);
29451
30340
  }
29452
30341
  };
29453
30342
  __publicField(SQLiteTable, _d3, "SQLiteTable");
@@ -29462,7 +30351,7 @@ var init_table3 = __esm({
29462
30351
  });
29463
30352
 
29464
30353
  // ../drizzle-orm/dist/sqlite-core/query-builders/delete.js
29465
- var _a194, _b141, SQLiteDeleteBase;
30354
+ var _a196, _b141, SQLiteDeleteBase;
29466
30355
  var init_delete2 = __esm({
29467
30356
  "../drizzle-orm/dist/sqlite-core/query-builders/delete.js"() {
29468
30357
  "use strict";
@@ -29472,7 +30361,7 @@ var init_delete2 = __esm({
29472
30361
  init_table3();
29473
30362
  init_table();
29474
30363
  init_utils2();
29475
- SQLiteDeleteBase = class extends (_b141 = QueryPromise, _a194 = entityKind, _b141) {
30364
+ SQLiteDeleteBase = class extends (_b141 = QueryPromise, _a196 = entityKind, _b141) {
29476
30365
  constructor(table4, session, dialect4, withList) {
29477
30366
  super();
29478
30367
  /** @internal */
@@ -29578,12 +30467,12 @@ var init_delete2 = __esm({
29578
30467
  return this;
29579
30468
  }
29580
30469
  };
29581
- __publicField(SQLiteDeleteBase, _a194, "SQLiteDelete");
30470
+ __publicField(SQLiteDeleteBase, _a196, "SQLiteDelete");
29582
30471
  }
29583
30472
  });
29584
30473
 
29585
30474
  // ../drizzle-orm/dist/sqlite-core/query-builders/insert.js
29586
- var _a195, SQLiteInsertBuilder, _a196, _b142, SQLiteInsertBase;
30475
+ var _a197, SQLiteInsertBuilder, _a198, _b142, SQLiteInsertBase;
29587
30476
  var init_insert2 = __esm({
29588
30477
  "../drizzle-orm/dist/sqlite-core/query-builders/insert.js"() {
29589
30478
  "use strict";
@@ -29593,7 +30482,7 @@ var init_insert2 = __esm({
29593
30482
  init_table3();
29594
30483
  init_table();
29595
30484
  init_utils2();
29596
- _a195 = entityKind;
30485
+ _a197 = entityKind;
29597
30486
  SQLiteInsertBuilder = class {
29598
30487
  constructor(table4, session, dialect4, withList) {
29599
30488
  this.table = table4;
@@ -29618,8 +30507,8 @@ var init_insert2 = __esm({
29618
30507
  return new SQLiteInsertBase(this.table, mappedValues, this.session, this.dialect, this.withList);
29619
30508
  }
29620
30509
  };
29621
- __publicField(SQLiteInsertBuilder, _a195, "SQLiteInsertBuilder");
29622
- SQLiteInsertBase = class extends (_b142 = QueryPromise, _a196 = entityKind, _b142) {
30510
+ __publicField(SQLiteInsertBuilder, _a197, "SQLiteInsertBuilder");
30511
+ SQLiteInsertBase = class extends (_b142 = QueryPromise, _a198 = entityKind, _b142) {
29623
30512
  constructor(table4, values, session, dialect4, withList) {
29624
30513
  super();
29625
30514
  /** @internal */
@@ -29746,25 +30635,25 @@ var init_insert2 = __esm({
29746
30635
  return this;
29747
30636
  }
29748
30637
  };
29749
- __publicField(SQLiteInsertBase, _a196, "SQLiteInsert");
30638
+ __publicField(SQLiteInsertBase, _a198, "SQLiteInsert");
29750
30639
  }
29751
30640
  });
29752
30641
 
29753
30642
  // ../drizzle-orm/dist/sqlite-core/view-base.js
29754
- var _a197, _b143, SQLiteViewBase;
30643
+ var _a199, _b143, SQLiteViewBase;
29755
30644
  var init_view_base2 = __esm({
29756
30645
  "../drizzle-orm/dist/sqlite-core/view-base.js"() {
29757
30646
  "use strict";
29758
30647
  init_entity();
29759
30648
  init_sql();
29760
- SQLiteViewBase = class extends (_b143 = View3, _a197 = entityKind, _b143) {
30649
+ SQLiteViewBase = class extends (_b143 = View3, _a199 = entityKind, _b143) {
29761
30650
  };
29762
- __publicField(SQLiteViewBase, _a197, "SQLiteViewBase");
30651
+ __publicField(SQLiteViewBase, _a199, "SQLiteViewBase");
29763
30652
  }
29764
30653
  });
29765
30654
 
29766
30655
  // ../drizzle-orm/dist/sqlite-core/dialect.js
29767
- var _a198, SQLiteDialect, _a199, _b144, SQLiteSyncDialect, _a200, _b145, SQLiteAsyncDialect;
30656
+ var _a200, SQLiteDialect, _a201, _b144, SQLiteSyncDialect, _a202, _b145, SQLiteAsyncDialect;
29768
30657
  var init_dialect2 = __esm({
29769
30658
  "../drizzle-orm/dist/sqlite-core/dialect.js"() {
29770
30659
  "use strict";
@@ -29783,7 +30672,7 @@ var init_dialect2 = __esm({
29783
30672
  init_utils2();
29784
30673
  init_view_common();
29785
30674
  init_view_base2();
29786
- _a198 = entityKind;
30675
+ _a200 = entityKind;
29787
30676
  SQLiteDialect = class {
29788
30677
  constructor(config) {
29789
30678
  /** @internal */
@@ -30305,8 +31194,8 @@ var init_dialect2 = __esm({
30305
31194
  };
30306
31195
  }
30307
31196
  };
30308
- __publicField(SQLiteDialect, _a198, "SQLiteDialect");
30309
- SQLiteSyncDialect = class extends (_b144 = SQLiteDialect, _a199 = entityKind, _b144) {
31197
+ __publicField(SQLiteDialect, _a200, "SQLiteDialect");
31198
+ SQLiteSyncDialect = class extends (_b144 = SQLiteDialect, _a201 = entityKind, _b144) {
30310
31199
  migrate(migrations, session, config) {
30311
31200
  const migrationsTable = config === void 0 ? "__drizzle_migrations" : typeof config === "string" ? "__drizzle_migrations" : config.migrationsTable ?? "__drizzle_migrations";
30312
31201
  const migrationTableCreate = sql`
@@ -30340,8 +31229,8 @@ var init_dialect2 = __esm({
30340
31229
  }
30341
31230
  }
30342
31231
  };
30343
- __publicField(SQLiteSyncDialect, _a199, "SQLiteSyncDialect");
30344
- SQLiteAsyncDialect = class extends (_b145 = SQLiteDialect, _a200 = entityKind, _b145) {
31232
+ __publicField(SQLiteSyncDialect, _a201, "SQLiteSyncDialect");
31233
+ SQLiteAsyncDialect = class extends (_b145 = SQLiteDialect, _a202 = entityKind, _b145) {
30345
31234
  async migrate(migrations, session, config) {
30346
31235
  const migrationsTable = config === void 0 ? "__drizzle_migrations" : typeof config === "string" ? "__drizzle_migrations" : config.migrationsTable ?? "__drizzle_migrations";
30347
31236
  const migrationTableCreate = sql`
@@ -30370,7 +31259,7 @@ var init_dialect2 = __esm({
30370
31259
  });
30371
31260
  }
30372
31261
  };
30373
- __publicField(SQLiteAsyncDialect, _a200, "SQLiteAsyncDialect");
31262
+ __publicField(SQLiteAsyncDialect, _a202, "SQLiteAsyncDialect");
30374
31263
  }
30375
31264
  });
30376
31265
 
@@ -30392,7 +31281,7 @@ function createSetOperator2(type, isAll) {
30392
31281
  return leftSelect.addSetOperators(setOperators);
30393
31282
  };
30394
31283
  }
30395
- var _a201, SQLiteSelectBuilder, _a202, _b146, SQLiteSelectQueryBuilderBase, _a203, _b147, SQLiteSelectBase, getSQLiteSetOperators, union2, unionAll2, intersect2, except2;
31284
+ var _a203, SQLiteSelectBuilder, _a204, _b146, SQLiteSelectQueryBuilderBase, _a205, _b147, SQLiteSelectBase, getSQLiteSetOperators, union2, unionAll2, intersect2, except2;
30396
31285
  var init_select3 = __esm({
30397
31286
  "../drizzle-orm/dist/sqlite-core/query-builders/select.js"() {
30398
31287
  "use strict";
@@ -30406,7 +31295,7 @@ var init_select3 = __esm({
30406
31295
  init_utils2();
30407
31296
  init_view_common();
30408
31297
  init_view_base2();
30409
- _a201 = entityKind;
31298
+ _a203 = entityKind;
30410
31299
  SQLiteSelectBuilder = class {
30411
31300
  constructor(config) {
30412
31301
  __publicField(this, "fields");
@@ -30447,8 +31336,8 @@ var init_select3 = __esm({
30447
31336
  });
30448
31337
  }
30449
31338
  };
30450
- __publicField(SQLiteSelectBuilder, _a201, "SQLiteSelectBuilder");
30451
- SQLiteSelectQueryBuilderBase = class extends (_b146 = TypedQueryBuilder, _a202 = entityKind, _b146) {
31339
+ __publicField(SQLiteSelectBuilder, _a203, "SQLiteSelectBuilder");
31340
+ SQLiteSelectQueryBuilderBase = class extends (_b146 = TypedQueryBuilder, _a204 = entityKind, _b146) {
30452
31341
  constructor({ table: table4, fields, isPartialSelect, session, dialect: dialect4, withList, distinct }) {
30453
31342
  super();
30454
31343
  __publicField(this, "_");
@@ -30953,8 +31842,8 @@ var init_select3 = __esm({
30953
31842
  return this;
30954
31843
  }
30955
31844
  };
30956
- __publicField(SQLiteSelectQueryBuilderBase, _a202, "SQLiteSelectQueryBuilder");
30957
- SQLiteSelectBase = class extends (_b147 = SQLiteSelectQueryBuilderBase, _a203 = entityKind, _b147) {
31845
+ __publicField(SQLiteSelectQueryBuilderBase, _a204, "SQLiteSelectQueryBuilder");
31846
+ SQLiteSelectBase = class extends (_b147 = SQLiteSelectQueryBuilderBase, _a205 = entityKind, _b147) {
30958
31847
  constructor() {
30959
31848
  super(...arguments);
30960
31849
  __publicField(this, "run", (placeholderValues) => {
@@ -30992,7 +31881,7 @@ var init_select3 = __esm({
30992
31881
  return this.all();
30993
31882
  }
30994
31883
  };
30995
- __publicField(SQLiteSelectBase, _a203, "SQLiteSelect");
31884
+ __publicField(SQLiteSelectBase, _a205, "SQLiteSelect");
30996
31885
  applyMixins(SQLiteSelectBase, [QueryPromise]);
30997
31886
  getSQLiteSetOperators = () => ({
30998
31887
  union: union2,
@@ -31008,7 +31897,7 @@ var init_select3 = __esm({
31008
31897
  });
31009
31898
 
31010
31899
  // ../drizzle-orm/dist/sqlite-core/query-builders/query-builder.js
31011
- var _a204, QueryBuilder2;
31900
+ var _a206, QueryBuilder2;
31012
31901
  var init_query_builder3 = __esm({
31013
31902
  "../drizzle-orm/dist/sqlite-core/query-builders/query-builder.js"() {
31014
31903
  "use strict";
@@ -31017,7 +31906,7 @@ var init_query_builder3 = __esm({
31017
31906
  init_dialect2();
31018
31907
  init_subquery();
31019
31908
  init_select3();
31020
- _a204 = entityKind;
31909
+ _a206 = entityKind;
31021
31910
  QueryBuilder2 = class {
31022
31911
  constructor(dialect4) {
31023
31912
  __publicField(this, "dialect");
@@ -31079,7 +31968,7 @@ var init_query_builder3 = __esm({
31079
31968
  return this.dialect;
31080
31969
  }
31081
31970
  };
31082
- __publicField(QueryBuilder2, _a204, "SQLiteQueryBuilder");
31971
+ __publicField(QueryBuilder2, _a206, "SQLiteQueryBuilder");
31083
31972
  }
31084
31973
  });
31085
31974
 
@@ -31091,7 +31980,7 @@ var init_select_types2 = __esm({
31091
31980
  });
31092
31981
 
31093
31982
  // ../drizzle-orm/dist/sqlite-core/query-builders/update.js
31094
- var _a205, SQLiteUpdateBuilder, _a206, _b148, SQLiteUpdateBase;
31983
+ var _a207, SQLiteUpdateBuilder, _a208, _b148, SQLiteUpdateBase;
31095
31984
  var init_update2 = __esm({
31096
31985
  "../drizzle-orm/dist/sqlite-core/query-builders/update.js"() {
31097
31986
  "use strict";
@@ -31101,7 +31990,7 @@ var init_update2 = __esm({
31101
31990
  init_table3();
31102
31991
  init_table();
31103
31992
  init_utils2();
31104
- _a205 = entityKind;
31993
+ _a207 = entityKind;
31105
31994
  SQLiteUpdateBuilder = class {
31106
31995
  constructor(table4, session, dialect4, withList) {
31107
31996
  this.table = table4;
@@ -31119,8 +32008,8 @@ var init_update2 = __esm({
31119
32008
  );
31120
32009
  }
31121
32010
  };
31122
- __publicField(SQLiteUpdateBuilder, _a205, "SQLiteUpdateBuilder");
31123
- SQLiteUpdateBase = class extends (_b148 = QueryPromise, _a206 = entityKind, _b148) {
32011
+ __publicField(SQLiteUpdateBuilder, _a207, "SQLiteUpdateBuilder");
32012
+ SQLiteUpdateBase = class extends (_b148 = QueryPromise, _a208 = entityKind, _b148) {
31124
32013
  constructor(table4, set, session, dialect4, withList) {
31125
32014
  super();
31126
32015
  /** @internal */
@@ -31229,7 +32118,7 @@ var init_update2 = __esm({
31229
32118
  return this;
31230
32119
  }
31231
32120
  };
31232
- __publicField(SQLiteUpdateBase, _a206, "SQLiteUpdate");
32121
+ __publicField(SQLiteUpdateBase, _a208, "SQLiteUpdate");
31233
32122
  }
31234
32123
  });
31235
32124
 
@@ -31247,17 +32136,17 @@ var init_query_builders2 = __esm({
31247
32136
  });
31248
32137
 
31249
32138
  // ../drizzle-orm/dist/sqlite-core/query-builders/count.js
31250
- var _a207, _b149, _c7, _SQLiteCountBuilder, SQLiteCountBuilder;
32139
+ var _a209, _b149, _c7, _SQLiteCountBuilder, SQLiteCountBuilder;
31251
32140
  var init_count2 = __esm({
31252
32141
  "../drizzle-orm/dist/sqlite-core/query-builders/count.js"() {
31253
32142
  "use strict";
31254
32143
  init_entity();
31255
32144
  init_sql();
31256
- _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b149 = entityKind, _a207 = Symbol.toStringTag, _c7) {
32145
+ _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b149 = entityKind, _a209 = Symbol.toStringTag, _c7) {
31257
32146
  constructor(params) {
31258
32147
  super(_SQLiteCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
31259
32148
  __publicField(this, "sql");
31260
- __publicField(this, _a207, "SQLiteCountBuilderAsync");
32149
+ __publicField(this, _a209, "SQLiteCountBuilderAsync");
31261
32150
  __publicField(this, "session");
31262
32151
  this.params = params;
31263
32152
  this.session = params.session;
@@ -31300,14 +32189,14 @@ var init_count2 = __esm({
31300
32189
  });
31301
32190
 
31302
32191
  // ../drizzle-orm/dist/sqlite-core/query-builders/query.js
31303
- var _a208, RelationalQueryBuilder2, _a209, _b150, SQLiteRelationalQuery, _a210, _b151, SQLiteSyncRelationalQuery;
32192
+ var _a210, RelationalQueryBuilder2, _a211, _b150, SQLiteRelationalQuery, _a212, _b151, SQLiteSyncRelationalQuery;
31304
32193
  var init_query2 = __esm({
31305
32194
  "../drizzle-orm/dist/sqlite-core/query-builders/query.js"() {
31306
32195
  "use strict";
31307
32196
  init_entity();
31308
32197
  init_query_promise();
31309
32198
  init_relations();
31310
- _a208 = entityKind;
32199
+ _a210 = entityKind;
31311
32200
  RelationalQueryBuilder2 = class {
31312
32201
  constructor(mode, fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session) {
31313
32202
  this.mode = mode;
@@ -31366,8 +32255,8 @@ var init_query2 = __esm({
31366
32255
  );
31367
32256
  }
31368
32257
  };
31369
- __publicField(RelationalQueryBuilder2, _a208, "SQLiteAsyncRelationalQueryBuilder");
31370
- SQLiteRelationalQuery = class extends (_b150 = QueryPromise, _a209 = entityKind, _b150) {
32258
+ __publicField(RelationalQueryBuilder2, _a210, "SQLiteAsyncRelationalQueryBuilder");
32259
+ SQLiteRelationalQuery = class extends (_b150 = QueryPromise, _a211 = entityKind, _b150) {
31371
32260
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, config, mode) {
31372
32261
  super();
31373
32262
  /** @internal */
@@ -31443,24 +32332,24 @@ var init_query2 = __esm({
31443
32332
  return this.executeRaw();
31444
32333
  }
31445
32334
  };
31446
- __publicField(SQLiteRelationalQuery, _a209, "SQLiteAsyncRelationalQuery");
31447
- SQLiteSyncRelationalQuery = class extends (_b151 = SQLiteRelationalQuery, _a210 = entityKind, _b151) {
32335
+ __publicField(SQLiteRelationalQuery, _a211, "SQLiteAsyncRelationalQuery");
32336
+ SQLiteSyncRelationalQuery = class extends (_b151 = SQLiteRelationalQuery, _a212 = entityKind, _b151) {
31448
32337
  sync() {
31449
32338
  return this.executeRaw();
31450
32339
  }
31451
32340
  };
31452
- __publicField(SQLiteSyncRelationalQuery, _a210, "SQLiteSyncRelationalQuery");
32341
+ __publicField(SQLiteSyncRelationalQuery, _a212, "SQLiteSyncRelationalQuery");
31453
32342
  }
31454
32343
  });
31455
32344
 
31456
32345
  // ../drizzle-orm/dist/sqlite-core/query-builders/raw.js
31457
- var _a211, _b152, SQLiteRaw;
32346
+ var _a213, _b152, SQLiteRaw;
31458
32347
  var init_raw2 = __esm({
31459
32348
  "../drizzle-orm/dist/sqlite-core/query-builders/raw.js"() {
31460
32349
  "use strict";
31461
32350
  init_entity();
31462
32351
  init_query_promise();
31463
- SQLiteRaw = class extends (_b152 = QueryPromise, _a211 = entityKind, _b152) {
32352
+ SQLiteRaw = class extends (_b152 = QueryPromise, _a213 = entityKind, _b152) {
31464
32353
  constructor(execute, getSQL, action, dialect4, mapBatchResult) {
31465
32354
  super();
31466
32355
  /** @internal */
@@ -31485,12 +32374,12 @@ var init_raw2 = __esm({
31485
32374
  return false;
31486
32375
  }
31487
32376
  };
31488
- __publicField(SQLiteRaw, _a211, "SQLiteRaw");
32377
+ __publicField(SQLiteRaw, _a213, "SQLiteRaw");
31489
32378
  }
31490
32379
  });
31491
32380
 
31492
32381
  // ../drizzle-orm/dist/sqlite-core/db.js
31493
- var _a212, BaseSQLiteDatabase;
32382
+ var _a214, BaseSQLiteDatabase;
31494
32383
  var init_db2 = __esm({
31495
32384
  "../drizzle-orm/dist/sqlite-core/db.js"() {
31496
32385
  "use strict";
@@ -31502,7 +32391,7 @@ var init_db2 = __esm({
31502
32391
  init_count2();
31503
32392
  init_query2();
31504
32393
  init_raw2();
31505
- _a212 = entityKind;
32394
+ _a214 = entityKind;
31506
32395
  BaseSQLiteDatabase = class {
31507
32396
  constructor(resultKind, dialect4, session, schema4) {
31508
32397
  __publicField(this, "query");
@@ -31784,17 +32673,17 @@ var init_db2 = __esm({
31784
32673
  return this.session.transaction(transaction, config);
31785
32674
  }
31786
32675
  };
31787
- __publicField(BaseSQLiteDatabase, _a212, "BaseSQLiteDatabase");
32676
+ __publicField(BaseSQLiteDatabase, _a214, "BaseSQLiteDatabase");
31788
32677
  }
31789
32678
  });
31790
32679
 
31791
32680
  // ../drizzle-orm/dist/sqlite-core/indexes.js
31792
- var _a213, IndexBuilderOn2, _a214, IndexBuilder2, _a215, Index4;
32681
+ var _a215, IndexBuilderOn2, _a216, IndexBuilder2, _a217, Index4;
31793
32682
  var init_indexes2 = __esm({
31794
32683
  "../drizzle-orm/dist/sqlite-core/indexes.js"() {
31795
32684
  "use strict";
31796
32685
  init_entity();
31797
- _a213 = entityKind;
32686
+ _a215 = entityKind;
31798
32687
  IndexBuilderOn2 = class {
31799
32688
  constructor(name2, unique) {
31800
32689
  this.name = name2;
@@ -31804,8 +32693,8 @@ var init_indexes2 = __esm({
31804
32693
  return new IndexBuilder2(this.name, columns, this.unique);
31805
32694
  }
31806
32695
  };
31807
- __publicField(IndexBuilderOn2, _a213, "SQLiteIndexBuilderOn");
31808
- _a214 = entityKind;
32696
+ __publicField(IndexBuilderOn2, _a215, "SQLiteIndexBuilderOn");
32697
+ _a216 = entityKind;
31809
32698
  IndexBuilder2 = class {
31810
32699
  constructor(name2, columns, unique) {
31811
32700
  /** @internal */
@@ -31829,26 +32718,26 @@ var init_indexes2 = __esm({
31829
32718
  return new Index4(this.config, table4);
31830
32719
  }
31831
32720
  };
31832
- __publicField(IndexBuilder2, _a214, "SQLiteIndexBuilder");
31833
- _a215 = entityKind;
32721
+ __publicField(IndexBuilder2, _a216, "SQLiteIndexBuilder");
32722
+ _a217 = entityKind;
31834
32723
  Index4 = class {
31835
32724
  constructor(config, table4) {
31836
32725
  __publicField(this, "config");
31837
32726
  this.config = { ...config, table: table4 };
31838
32727
  }
31839
32728
  };
31840
- __publicField(Index4, _a215, "SQLiteIndex");
32729
+ __publicField(Index4, _a217, "SQLiteIndex");
31841
32730
  }
31842
32731
  });
31843
32732
 
31844
32733
  // ../drizzle-orm/dist/sqlite-core/primary-keys.js
31845
- var _a216, PrimaryKeyBuilder2, _a217, PrimaryKey2;
32734
+ var _a218, PrimaryKeyBuilder2, _a219, PrimaryKey2;
31846
32735
  var init_primary_keys2 = __esm({
31847
32736
  "../drizzle-orm/dist/sqlite-core/primary-keys.js"() {
31848
32737
  "use strict";
31849
32738
  init_entity();
31850
32739
  init_table3();
31851
- _a216 = entityKind;
32740
+ _a218 = entityKind;
31852
32741
  PrimaryKeyBuilder2 = class {
31853
32742
  constructor(columns, name2) {
31854
32743
  /** @internal */
@@ -31863,8 +32752,8 @@ var init_primary_keys2 = __esm({
31863
32752
  return new PrimaryKey2(table4, this.columns, this.name);
31864
32753
  }
31865
32754
  };
31866
- __publicField(PrimaryKeyBuilder2, _a216, "SQLitePrimaryKeyBuilder");
31867
- _a217 = entityKind;
32755
+ __publicField(PrimaryKeyBuilder2, _a218, "SQLitePrimaryKeyBuilder");
32756
+ _a219 = entityKind;
31868
32757
  PrimaryKey2 = class {
31869
32758
  constructor(table4, columns, name2) {
31870
32759
  __publicField(this, "columns");
@@ -31877,12 +32766,12 @@ var init_primary_keys2 = __esm({
31877
32766
  return this.name ?? `${this.table[SQLiteTable.Symbol.Name]}_${this.columns.map((column4) => column4.name).join("_")}_pk`;
31878
32767
  }
31879
32768
  };
31880
- __publicField(PrimaryKey2, _a217, "SQLitePrimaryKey");
32769
+ __publicField(PrimaryKey2, _a219, "SQLitePrimaryKey");
31881
32770
  }
31882
32771
  });
31883
32772
 
31884
32773
  // ../drizzle-orm/dist/sqlite-core/session.js
31885
- var _a218, _b153, ExecuteResultSync, _a219, SQLitePreparedQuery, _a220, SQLiteSession, _a221, _b154, SQLiteTransaction;
32774
+ var _a220, _b153, ExecuteResultSync, _a221, SQLitePreparedQuery, _a222, SQLiteSession, _a223, _b154, SQLiteTransaction;
31886
32775
  var init_session2 = __esm({
31887
32776
  "../drizzle-orm/dist/sqlite-core/session.js"() {
31888
32777
  "use strict";
@@ -31890,7 +32779,7 @@ var init_session2 = __esm({
31890
32779
  init_errors();
31891
32780
  init_query_promise();
31892
32781
  init_db2();
31893
- ExecuteResultSync = class extends (_b153 = QueryPromise, _a218 = entityKind, _b153) {
32782
+ ExecuteResultSync = class extends (_b153 = QueryPromise, _a220 = entityKind, _b153) {
31894
32783
  constructor(resultCb) {
31895
32784
  super();
31896
32785
  this.resultCb = resultCb;
@@ -31902,8 +32791,8 @@ var init_session2 = __esm({
31902
32791
  return this.resultCb();
31903
32792
  }
31904
32793
  };
31905
- __publicField(ExecuteResultSync, _a218, "ExecuteResultSync");
31906
- _a219 = entityKind;
32794
+ __publicField(ExecuteResultSync, _a220, "ExecuteResultSync");
32795
+ _a221 = entityKind;
31907
32796
  SQLitePreparedQuery = class {
31908
32797
  constructor(mode, executeMethod, query) {
31909
32798
  /** @internal */
@@ -31944,8 +32833,8 @@ var init_session2 = __esm({
31944
32833
  }
31945
32834
  }
31946
32835
  };
31947
- __publicField(SQLitePreparedQuery, _a219, "PreparedQuery");
31948
- _a220 = entityKind;
32836
+ __publicField(SQLitePreparedQuery, _a221, "PreparedQuery");
32837
+ _a222 = entityKind;
31949
32838
  SQLiteSession = class {
31950
32839
  constructor(dialect4) {
31951
32840
  this.dialect = dialect4;
@@ -31991,8 +32880,8 @@ var init_session2 = __esm({
31991
32880
  throw new Error("Not implemented");
31992
32881
  }
31993
32882
  };
31994
- __publicField(SQLiteSession, _a220, "SQLiteSession");
31995
- SQLiteTransaction = class extends (_b154 = BaseSQLiteDatabase, _a221 = entityKind, _b154) {
32883
+ __publicField(SQLiteSession, _a222, "SQLiteSession");
32884
+ SQLiteTransaction = class extends (_b154 = BaseSQLiteDatabase, _a223 = entityKind, _b154) {
31996
32885
  constructor(resultType, dialect4, session, schema4, nestedIndex = 0) {
31997
32886
  super(resultType, dialect4, session, schema4);
31998
32887
  this.schema = schema4;
@@ -32002,7 +32891,7 @@ var init_session2 = __esm({
32002
32891
  throw new TransactionRollbackError();
32003
32892
  }
32004
32893
  };
32005
- __publicField(SQLiteTransaction, _a221, "SQLiteTransaction");
32894
+ __publicField(SQLiteTransaction, _a223, "SQLiteTransaction");
32006
32895
  }
32007
32896
  });
32008
32897
 
@@ -32071,7 +32960,7 @@ var init_utils6 = __esm({
32071
32960
  });
32072
32961
 
32073
32962
  // ../drizzle-orm/dist/sqlite-core/view.js
32074
- var _a222, ViewBuilderCore, _a223, _b155, ViewBuilder2, _a224, _b156, ManualViewBuilder2, _a225, _b157, SQLiteView2;
32963
+ var _a224, ViewBuilderCore, _a225, _b155, ViewBuilder2, _a226, _b156, ManualViewBuilder2, _a227, _b157, SQLiteView2;
32075
32964
  var init_view2 = __esm({
32076
32965
  "../drizzle-orm/dist/sqlite-core/view.js"() {
32077
32966
  "use strict";
@@ -32081,15 +32970,15 @@ var init_view2 = __esm({
32081
32970
  init_query_builder3();
32082
32971
  init_table3();
32083
32972
  init_view_base2();
32084
- _a222 = entityKind;
32973
+ _a224 = entityKind;
32085
32974
  ViewBuilderCore = class {
32086
32975
  constructor(name2) {
32087
32976
  __publicField(this, "config", {});
32088
32977
  this.name = name2;
32089
32978
  }
32090
32979
  };
32091
- __publicField(ViewBuilderCore, _a222, "SQLiteViewBuilderCore");
32092
- ViewBuilder2 = class extends (_b155 = ViewBuilderCore, _a223 = entityKind, _b155) {
32980
+ __publicField(ViewBuilderCore, _a224, "SQLiteViewBuilderCore");
32981
+ ViewBuilder2 = class extends (_b155 = ViewBuilderCore, _a225 = entityKind, _b155) {
32093
32982
  as(qb) {
32094
32983
  if (typeof qb === "function") {
32095
32984
  qb = qb(new QueryBuilder2());
@@ -32115,8 +33004,8 @@ var init_view2 = __esm({
32115
33004
  );
32116
33005
  }
32117
33006
  };
32118
- __publicField(ViewBuilder2, _a223, "SQLiteViewBuilder");
32119
- ManualViewBuilder2 = class extends (_b156 = ViewBuilderCore, _a224 = entityKind, _b156) {
33007
+ __publicField(ViewBuilder2, _a225, "SQLiteViewBuilder");
33008
+ ManualViewBuilder2 = class extends (_b156 = ViewBuilderCore, _a226 = entityKind, _b156) {
32120
33009
  constructor(name2, columns) {
32121
33010
  super(name2);
32122
33011
  __publicField(this, "columns");
@@ -32159,13 +33048,13 @@ var init_view2 = __esm({
32159
33048
  );
32160
33049
  }
32161
33050
  };
32162
- __publicField(ManualViewBuilder2, _a224, "SQLiteManualViewBuilder");
32163
- SQLiteView2 = class extends (_b157 = SQLiteViewBase, _a225 = entityKind, _b157) {
33051
+ __publicField(ManualViewBuilder2, _a226, "SQLiteManualViewBuilder");
33052
+ SQLiteView2 = class extends (_b157 = SQLiteViewBase, _a227 = entityKind, _b157) {
32164
33053
  constructor({ config }) {
32165
33054
  super(config);
32166
33055
  }
32167
33056
  };
32168
- __publicField(SQLiteView2, _a225, "SQLiteView");
33057
+ __publicField(SQLiteView2, _a227, "SQLiteView");
32169
33058
  }
32170
33059
  });
32171
33060
 
@@ -32864,12 +33753,12 @@ var init_alias4 = __esm({
32864
33753
  });
32865
33754
 
32866
33755
  // ../drizzle-orm/dist/mysql-core/checks.js
32867
- var _a226, CheckBuilder3, _a227, Check3;
33756
+ var _a228, CheckBuilder3, _a229, Check3;
32868
33757
  var init_checks3 = __esm({
32869
33758
  "../drizzle-orm/dist/mysql-core/checks.js"() {
32870
33759
  "use strict";
32871
33760
  init_entity();
32872
- _a226 = entityKind;
33761
+ _a228 = entityKind;
32873
33762
  CheckBuilder3 = class {
32874
33763
  constructor(name2, value) {
32875
33764
  __publicField(this, "brand");
@@ -32881,8 +33770,8 @@ var init_checks3 = __esm({
32881
33770
  return new Check3(table4, this);
32882
33771
  }
32883
33772
  };
32884
- __publicField(CheckBuilder3, _a226, "MySqlCheckBuilder");
32885
- _a227 = entityKind;
33773
+ __publicField(CheckBuilder3, _a228, "MySqlCheckBuilder");
33774
+ _a229 = entityKind;
32886
33775
  Check3 = class {
32887
33776
  constructor(table4, builder) {
32888
33777
  __publicField(this, "name");
@@ -32892,18 +33781,18 @@ var init_checks3 = __esm({
32892
33781
  this.value = builder.value;
32893
33782
  }
32894
33783
  };
32895
- __publicField(Check3, _a227, "MySqlCheck");
33784
+ __publicField(Check3, _a229, "MySqlCheck");
32896
33785
  }
32897
33786
  });
32898
33787
 
32899
33788
  // ../drizzle-orm/dist/mysql-core/foreign-keys.js
32900
- var _a228, ForeignKeyBuilder3, _a229, ForeignKey3;
33789
+ var _a230, ForeignKeyBuilder3, _a231, ForeignKey3;
32901
33790
  var init_foreign_keys3 = __esm({
32902
33791
  "../drizzle-orm/dist/mysql-core/foreign-keys.js"() {
32903
33792
  "use strict";
32904
33793
  init_entity();
32905
33794
  init_table_utils();
32906
- _a228 = entityKind;
33795
+ _a230 = entityKind;
32907
33796
  ForeignKeyBuilder3 = class {
32908
33797
  constructor(config, actions) {
32909
33798
  /** @internal */
@@ -32934,8 +33823,8 @@ var init_foreign_keys3 = __esm({
32934
33823
  return new ForeignKey3(table4, this);
32935
33824
  }
32936
33825
  };
32937
- __publicField(ForeignKeyBuilder3, _a228, "MySqlForeignKeyBuilder");
32938
- _a229 = entityKind;
33826
+ __publicField(ForeignKeyBuilder3, _a230, "MySqlForeignKeyBuilder");
33827
+ _a231 = entityKind;
32939
33828
  ForeignKey3 = class {
32940
33829
  constructor(table4, builder) {
32941
33830
  __publicField(this, "reference");
@@ -32959,7 +33848,7 @@ var init_foreign_keys3 = __esm({
32959
33848
  return name2 ?? `${chunks.join("_")}_fk`;
32960
33849
  }
32961
33850
  };
32962
- __publicField(ForeignKey3, _a229, "MySqlForeignKey");
33851
+ __publicField(ForeignKey3, _a231, "MySqlForeignKey");
32963
33852
  }
32964
33853
  });
32965
33854
 
@@ -32967,13 +33856,13 @@ var init_foreign_keys3 = __esm({
32967
33856
  function uniqueKeyName3(table4, columns) {
32968
33857
  return `${table4[TableName]}_${columns.join("_")}_unique`;
32969
33858
  }
32970
- var _a230, UniqueConstraintBuilder3, _a231, UniqueOnConstraintBuilder3, _a232, UniqueConstraint3;
33859
+ var _a232, UniqueConstraintBuilder3, _a233, UniqueOnConstraintBuilder3, _a234, UniqueConstraint3;
32971
33860
  var init_unique_constraint3 = __esm({
32972
33861
  "../drizzle-orm/dist/mysql-core/unique-constraint.js"() {
32973
33862
  "use strict";
32974
33863
  init_entity();
32975
33864
  init_table_utils();
32976
- _a230 = entityKind;
33865
+ _a232 = entityKind;
32977
33866
  UniqueConstraintBuilder3 = class {
32978
33867
  constructor(columns, name2) {
32979
33868
  /** @internal */
@@ -32986,8 +33875,8 @@ var init_unique_constraint3 = __esm({
32986
33875
  return new UniqueConstraint3(table4, this.columns, this.name);
32987
33876
  }
32988
33877
  };
32989
- __publicField(UniqueConstraintBuilder3, _a230, "MySqlUniqueConstraintBuilder");
32990
- _a231 = entityKind;
33878
+ __publicField(UniqueConstraintBuilder3, _a232, "MySqlUniqueConstraintBuilder");
33879
+ _a233 = entityKind;
32991
33880
  UniqueOnConstraintBuilder3 = class {
32992
33881
  constructor(name2) {
32993
33882
  /** @internal */
@@ -32998,8 +33887,8 @@ var init_unique_constraint3 = __esm({
32998
33887
  return new UniqueConstraintBuilder3(columns, this.name);
32999
33888
  }
33000
33889
  };
33001
- __publicField(UniqueOnConstraintBuilder3, _a231, "MySqlUniqueOnConstraintBuilder");
33002
- _a232 = entityKind;
33890
+ __publicField(UniqueOnConstraintBuilder3, _a233, "MySqlUniqueOnConstraintBuilder");
33891
+ _a234 = entityKind;
33003
33892
  UniqueConstraint3 = class {
33004
33893
  constructor(table4, columns, name2) {
33005
33894
  __publicField(this, "columns");
@@ -33013,12 +33902,12 @@ var init_unique_constraint3 = __esm({
33013
33902
  return this.name;
33014
33903
  }
33015
33904
  };
33016
- __publicField(UniqueConstraint3, _a232, "MySqlUniqueConstraint");
33905
+ __publicField(UniqueConstraint3, _a234, "MySqlUniqueConstraint");
33017
33906
  }
33018
33907
  });
33019
33908
 
33020
33909
  // ../drizzle-orm/dist/mysql-core/columns/common.js
33021
- var _a233, _b158, MySqlColumnBuilder, _a234, _b159, MySqlColumn, _a235, _b160, MySqlColumnBuilderWithAutoIncrement, _a236, _b161, MySqlColumnWithAutoIncrement;
33910
+ var _a235, _b158, MySqlColumnBuilder, _a236, _b159, MySqlColumn, _a237, _b160, MySqlColumnBuilderWithAutoIncrement, _a238, _b161, MySqlColumnWithAutoIncrement;
33022
33911
  var init_common4 = __esm({
33023
33912
  "../drizzle-orm/dist/mysql-core/columns/common.js"() {
33024
33913
  "use strict";
@@ -33027,7 +33916,7 @@ var init_common4 = __esm({
33027
33916
  init_entity();
33028
33917
  init_foreign_keys3();
33029
33918
  init_unique_constraint3();
33030
- MySqlColumnBuilder = class extends (_b158 = ColumnBuilder, _a233 = entityKind, _b158) {
33919
+ MySqlColumnBuilder = class extends (_b158 = ColumnBuilder, _a235 = entityKind, _b158) {
33031
33920
  constructor() {
33032
33921
  super(...arguments);
33033
33922
  __publicField(this, "foreignKeyConfigs", []);
@@ -33068,8 +33957,8 @@ var init_common4 = __esm({
33068
33957
  });
33069
33958
  }
33070
33959
  };
33071
- __publicField(MySqlColumnBuilder, _a233, "MySqlColumnBuilder");
33072
- MySqlColumn = class extends (_b159 = Column2, _a234 = entityKind, _b159) {
33960
+ __publicField(MySqlColumnBuilder, _a235, "MySqlColumnBuilder");
33961
+ MySqlColumn = class extends (_b159 = Column2, _a236 = entityKind, _b159) {
33073
33962
  constructor(table4, config) {
33074
33963
  if (!config.uniqueName) {
33075
33964
  config.uniqueName = uniqueKeyName3(table4, [config.name]);
@@ -33078,8 +33967,8 @@ var init_common4 = __esm({
33078
33967
  this.table = table4;
33079
33968
  }
33080
33969
  };
33081
- __publicField(MySqlColumn, _a234, "MySqlColumn");
33082
- MySqlColumnBuilderWithAutoIncrement = class extends (_b160 = MySqlColumnBuilder, _a235 = entityKind, _b160) {
33970
+ __publicField(MySqlColumn, _a236, "MySqlColumn");
33971
+ MySqlColumnBuilderWithAutoIncrement = class extends (_b160 = MySqlColumnBuilder, _a237 = entityKind, _b160) {
33083
33972
  constructor(name2, dataType, columnType) {
33084
33973
  super(name2, dataType, columnType);
33085
33974
  this.config.autoIncrement = false;
@@ -33090,14 +33979,14 @@ var init_common4 = __esm({
33090
33979
  return this;
33091
33980
  }
33092
33981
  };
33093
- __publicField(MySqlColumnBuilderWithAutoIncrement, _a235, "MySqlColumnBuilderWithAutoIncrement");
33094
- MySqlColumnWithAutoIncrement = class extends (_b161 = MySqlColumn, _a236 = entityKind, _b161) {
33982
+ __publicField(MySqlColumnBuilderWithAutoIncrement, _a237, "MySqlColumnBuilderWithAutoIncrement");
33983
+ MySqlColumnWithAutoIncrement = class extends (_b161 = MySqlColumn, _a238 = entityKind, _b161) {
33095
33984
  constructor() {
33096
33985
  super(...arguments);
33097
33986
  __publicField(this, "autoIncrement", this.config.autoIncrement);
33098
33987
  }
33099
33988
  };
33100
- __publicField(MySqlColumnWithAutoIncrement, _a236, "MySqlColumnWithAutoIncrement");
33989
+ __publicField(MySqlColumnWithAutoIncrement, _a238, "MySqlColumnWithAutoIncrement");
33101
33990
  }
33102
33991
  });
33103
33992
 
@@ -33109,14 +33998,14 @@ function bigint2(a, b) {
33109
33998
  }
33110
33999
  return new MySqlBigInt64Builder(name2, config.unsigned);
33111
34000
  }
33112
- var _a237, _b162, MySqlBigInt53Builder, _a238, _b163, MySqlBigInt53, _a239, _b164, MySqlBigInt64Builder, _a240, _b165, MySqlBigInt64;
34001
+ var _a239, _b162, MySqlBigInt53Builder, _a240, _b163, MySqlBigInt53, _a241, _b164, MySqlBigInt64Builder, _a242, _b165, MySqlBigInt64;
33113
34002
  var init_bigint2 = __esm({
33114
34003
  "../drizzle-orm/dist/mysql-core/columns/bigint.js"() {
33115
34004
  "use strict";
33116
34005
  init_entity();
33117
34006
  init_utils2();
33118
34007
  init_common4();
33119
- MySqlBigInt53Builder = class extends (_b162 = MySqlColumnBuilderWithAutoIncrement, _a237 = entityKind, _b162) {
34008
+ MySqlBigInt53Builder = class extends (_b162 = MySqlColumnBuilderWithAutoIncrement, _a239 = entityKind, _b162) {
33120
34009
  constructor(name2, unsigned = false) {
33121
34010
  super(name2, "number", "MySqlBigInt53");
33122
34011
  this.config.unsigned = unsigned;
@@ -33129,8 +34018,8 @@ var init_bigint2 = __esm({
33129
34018
  );
33130
34019
  }
33131
34020
  };
33132
- __publicField(MySqlBigInt53Builder, _a237, "MySqlBigInt53Builder");
33133
- MySqlBigInt53 = class extends (_b163 = MySqlColumnWithAutoIncrement, _a238 = entityKind, _b163) {
34021
+ __publicField(MySqlBigInt53Builder, _a239, "MySqlBigInt53Builder");
34022
+ MySqlBigInt53 = class extends (_b163 = MySqlColumnWithAutoIncrement, _a240 = entityKind, _b163) {
33134
34023
  getSQLType() {
33135
34024
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
33136
34025
  }
@@ -33141,8 +34030,8 @@ var init_bigint2 = __esm({
33141
34030
  return Number(value);
33142
34031
  }
33143
34032
  };
33144
- __publicField(MySqlBigInt53, _a238, "MySqlBigInt53");
33145
- MySqlBigInt64Builder = class extends (_b164 = MySqlColumnBuilderWithAutoIncrement, _a239 = entityKind, _b164) {
34033
+ __publicField(MySqlBigInt53, _a240, "MySqlBigInt53");
34034
+ MySqlBigInt64Builder = class extends (_b164 = MySqlColumnBuilderWithAutoIncrement, _a241 = entityKind, _b164) {
33146
34035
  constructor(name2, unsigned = false) {
33147
34036
  super(name2, "bigint", "MySqlBigInt64");
33148
34037
  this.config.unsigned = unsigned;
@@ -33155,8 +34044,8 @@ var init_bigint2 = __esm({
33155
34044
  );
33156
34045
  }
33157
34046
  };
33158
- __publicField(MySqlBigInt64Builder, _a239, "MySqlBigInt64Builder");
33159
- MySqlBigInt64 = class extends (_b165 = MySqlColumnWithAutoIncrement, _a240 = entityKind, _b165) {
34047
+ __publicField(MySqlBigInt64Builder, _a241, "MySqlBigInt64Builder");
34048
+ MySqlBigInt64 = class extends (_b165 = MySqlColumnWithAutoIncrement, _a242 = entityKind, _b165) {
33160
34049
  getSQLType() {
33161
34050
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
33162
34051
  }
@@ -33165,7 +34054,7 @@ var init_bigint2 = __esm({
33165
34054
  return BigInt(value);
33166
34055
  }
33167
34056
  };
33168
- __publicField(MySqlBigInt64, _a240, "MySqlBigInt64");
34057
+ __publicField(MySqlBigInt64, _a242, "MySqlBigInt64");
33169
34058
  }
33170
34059
  });
33171
34060
 
@@ -33174,14 +34063,14 @@ function binary(a, b = {}) {
33174
34063
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33175
34064
  return new MySqlBinaryBuilder(name2, config.length);
33176
34065
  }
33177
- var _a241, _b166, MySqlBinaryBuilder, _a242, _b167, MySqlBinary;
34066
+ var _a243, _b166, MySqlBinaryBuilder, _a244, _b167, MySqlBinary;
33178
34067
  var init_binary = __esm({
33179
34068
  "../drizzle-orm/dist/mysql-core/columns/binary.js"() {
33180
34069
  "use strict";
33181
34070
  init_entity();
33182
34071
  init_utils2();
33183
34072
  init_common4();
33184
- MySqlBinaryBuilder = class extends (_b166 = MySqlColumnBuilder, _a241 = entityKind, _b166) {
34073
+ MySqlBinaryBuilder = class extends (_b166 = MySqlColumnBuilder, _a243 = entityKind, _b166) {
33185
34074
  constructor(name2, length) {
33186
34075
  super(name2, "string", "MySqlBinary");
33187
34076
  this.config.length = length;
@@ -33191,8 +34080,8 @@ var init_binary = __esm({
33191
34080
  return new MySqlBinary(table4, this.config);
33192
34081
  }
33193
34082
  };
33194
- __publicField(MySqlBinaryBuilder, _a241, "MySqlBinaryBuilder");
33195
- MySqlBinary = class extends (_b167 = MySqlColumn, _a242 = entityKind, _b167) {
34083
+ __publicField(MySqlBinaryBuilder, _a243, "MySqlBinaryBuilder");
34084
+ MySqlBinary = class extends (_b167 = MySqlColumn, _a244 = entityKind, _b167) {
33196
34085
  constructor() {
33197
34086
  super(...arguments);
33198
34087
  __publicField(this, "length", this.config.length);
@@ -33201,7 +34090,7 @@ var init_binary = __esm({
33201
34090
  return this.length === void 0 ? `binary` : `binary(${this.length})`;
33202
34091
  }
33203
34092
  };
33204
- __publicField(MySqlBinary, _a242, "MySqlBinary");
34093
+ __publicField(MySqlBinary, _a244, "MySqlBinary");
33205
34094
  }
33206
34095
  });
33207
34096
 
@@ -33209,13 +34098,13 @@ var init_binary = __esm({
33209
34098
  function boolean2(name2) {
33210
34099
  return new MySqlBooleanBuilder(name2 ?? "");
33211
34100
  }
33212
- var _a243, _b168, MySqlBooleanBuilder, _a244, _b169, MySqlBoolean;
34101
+ var _a245, _b168, MySqlBooleanBuilder, _a246, _b169, MySqlBoolean;
33213
34102
  var init_boolean2 = __esm({
33214
34103
  "../drizzle-orm/dist/mysql-core/columns/boolean.js"() {
33215
34104
  "use strict";
33216
34105
  init_entity();
33217
34106
  init_common4();
33218
- MySqlBooleanBuilder = class extends (_b168 = MySqlColumnBuilder, _a243 = entityKind, _b168) {
34107
+ MySqlBooleanBuilder = class extends (_b168 = MySqlColumnBuilder, _a245 = entityKind, _b168) {
33219
34108
  constructor(name2) {
33220
34109
  super(name2, "boolean", "MySqlBoolean");
33221
34110
  }
@@ -33227,8 +34116,8 @@ var init_boolean2 = __esm({
33227
34116
  );
33228
34117
  }
33229
34118
  };
33230
- __publicField(MySqlBooleanBuilder, _a243, "MySqlBooleanBuilder");
33231
- MySqlBoolean = class extends (_b169 = MySqlColumn, _a244 = entityKind, _b169) {
34119
+ __publicField(MySqlBooleanBuilder, _a245, "MySqlBooleanBuilder");
34120
+ MySqlBoolean = class extends (_b169 = MySqlColumn, _a246 = entityKind, _b169) {
33232
34121
  getSQLType() {
33233
34122
  return "boolean";
33234
34123
  }
@@ -33239,7 +34128,7 @@ var init_boolean2 = __esm({
33239
34128
  return value === 1;
33240
34129
  }
33241
34130
  };
33242
- __publicField(MySqlBoolean, _a244, "MySqlBoolean");
34131
+ __publicField(MySqlBoolean, _a246, "MySqlBoolean");
33243
34132
  }
33244
34133
  });
33245
34134
 
@@ -33248,14 +34137,14 @@ function char2(a, b = {}) {
33248
34137
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33249
34138
  return new MySqlCharBuilder(name2, config);
33250
34139
  }
33251
- var _a245, _b170, MySqlCharBuilder, _a246, _b171, MySqlChar;
34140
+ var _a247, _b170, MySqlCharBuilder, _a248, _b171, MySqlChar;
33252
34141
  var init_char2 = __esm({
33253
34142
  "../drizzle-orm/dist/mysql-core/columns/char.js"() {
33254
34143
  "use strict";
33255
34144
  init_entity();
33256
34145
  init_utils2();
33257
34146
  init_common4();
33258
- MySqlCharBuilder = class extends (_b170 = MySqlColumnBuilder, _a245 = entityKind, _b170) {
34147
+ MySqlCharBuilder = class extends (_b170 = MySqlColumnBuilder, _a247 = entityKind, _b170) {
33259
34148
  constructor(name2, config) {
33260
34149
  super(name2, "string", "MySqlChar");
33261
34150
  this.config.length = config.length;
@@ -33269,8 +34158,8 @@ var init_char2 = __esm({
33269
34158
  );
33270
34159
  }
33271
34160
  };
33272
- __publicField(MySqlCharBuilder, _a245, "MySqlCharBuilder");
33273
- MySqlChar = class extends (_b171 = MySqlColumn, _a246 = entityKind, _b171) {
34161
+ __publicField(MySqlCharBuilder, _a247, "MySqlCharBuilder");
34162
+ MySqlChar = class extends (_b171 = MySqlColumn, _a248 = entityKind, _b171) {
33274
34163
  constructor() {
33275
34164
  super(...arguments);
33276
34165
  __publicField(this, "length", this.config.length);
@@ -33280,7 +34169,7 @@ var init_char2 = __esm({
33280
34169
  return this.length === void 0 ? `char` : `char(${this.length})`;
33281
34170
  }
33282
34171
  };
33283
- __publicField(MySqlChar, _a246, "MySqlChar");
34172
+ __publicField(MySqlChar, _a248, "MySqlChar");
33284
34173
  }
33285
34174
  });
33286
34175
 
@@ -33291,14 +34180,14 @@ function customType3(customTypeParams) {
33291
34180
  return new MySqlCustomColumnBuilder(name2, config, customTypeParams);
33292
34181
  };
33293
34182
  }
33294
- var _a247, _b172, MySqlCustomColumnBuilder, _a248, _b173, MySqlCustomColumn;
34183
+ var _a249, _b172, MySqlCustomColumnBuilder, _a250, _b173, MySqlCustomColumn;
33295
34184
  var init_custom3 = __esm({
33296
34185
  "../drizzle-orm/dist/mysql-core/columns/custom.js"() {
33297
34186
  "use strict";
33298
34187
  init_entity();
33299
34188
  init_utils2();
33300
34189
  init_common4();
33301
- MySqlCustomColumnBuilder = class extends (_b172 = MySqlColumnBuilder, _a247 = entityKind, _b172) {
34190
+ MySqlCustomColumnBuilder = class extends (_b172 = MySqlColumnBuilder, _a249 = entityKind, _b172) {
33302
34191
  constructor(name2, fieldConfig, customTypeParams) {
33303
34192
  super(name2, "custom", "MySqlCustomColumn");
33304
34193
  this.config.fieldConfig = fieldConfig;
@@ -33312,8 +34201,8 @@ var init_custom3 = __esm({
33312
34201
  );
33313
34202
  }
33314
34203
  };
33315
- __publicField(MySqlCustomColumnBuilder, _a247, "MySqlCustomColumnBuilder");
33316
- MySqlCustomColumn = class extends (_b173 = MySqlColumn, _a248 = entityKind, _b173) {
34204
+ __publicField(MySqlCustomColumnBuilder, _a249, "MySqlCustomColumnBuilder");
34205
+ MySqlCustomColumn = class extends (_b173 = MySqlColumn, _a250 = entityKind, _b173) {
33317
34206
  constructor(table4, config) {
33318
34207
  super(table4, config);
33319
34208
  __publicField(this, "sqlName");
@@ -33333,7 +34222,7 @@ var init_custom3 = __esm({
33333
34222
  return typeof this.mapTo === "function" ? this.mapTo(value) : value;
33334
34223
  }
33335
34224
  };
33336
- __publicField(MySqlCustomColumn, _a248, "MySqlCustomColumn");
34225
+ __publicField(MySqlCustomColumn, _a250, "MySqlCustomColumn");
33337
34226
  }
33338
34227
  });
33339
34228
 
@@ -33345,14 +34234,14 @@ function date2(a, b) {
33345
34234
  }
33346
34235
  return new MySqlDateBuilder(name2);
33347
34236
  }
33348
- var _a249, _b174, MySqlDateBuilder, _a250, _b175, MySqlDate, _a251, _b176, MySqlDateStringBuilder, _a252, _b177, MySqlDateString;
34237
+ var _a251, _b174, MySqlDateBuilder, _a252, _b175, MySqlDate, _a253, _b176, MySqlDateStringBuilder, _a254, _b177, MySqlDateString;
33349
34238
  var init_date2 = __esm({
33350
34239
  "../drizzle-orm/dist/mysql-core/columns/date.js"() {
33351
34240
  "use strict";
33352
34241
  init_entity();
33353
34242
  init_utils2();
33354
34243
  init_common4();
33355
- MySqlDateBuilder = class extends (_b174 = MySqlColumnBuilder, _a249 = entityKind, _b174) {
34244
+ MySqlDateBuilder = class extends (_b174 = MySqlColumnBuilder, _a251 = entityKind, _b174) {
33356
34245
  constructor(name2) {
33357
34246
  super(name2, "date", "MySqlDate");
33358
34247
  }
@@ -33361,8 +34250,8 @@ var init_date2 = __esm({
33361
34250
  return new MySqlDate(table4, this.config);
33362
34251
  }
33363
34252
  };
33364
- __publicField(MySqlDateBuilder, _a249, "MySqlDateBuilder");
33365
- MySqlDate = class extends (_b175 = MySqlColumn, _a250 = entityKind, _b175) {
34253
+ __publicField(MySqlDateBuilder, _a251, "MySqlDateBuilder");
34254
+ MySqlDate = class extends (_b175 = MySqlColumn, _a252 = entityKind, _b175) {
33366
34255
  constructor(table4, config) {
33367
34256
  super(table4, config);
33368
34257
  }
@@ -33373,8 +34262,8 @@ var init_date2 = __esm({
33373
34262
  return new Date(value);
33374
34263
  }
33375
34264
  };
33376
- __publicField(MySqlDate, _a250, "MySqlDate");
33377
- MySqlDateStringBuilder = class extends (_b176 = MySqlColumnBuilder, _a251 = entityKind, _b176) {
34265
+ __publicField(MySqlDate, _a252, "MySqlDate");
34266
+ MySqlDateStringBuilder = class extends (_b176 = MySqlColumnBuilder, _a253 = entityKind, _b176) {
33378
34267
  constructor(name2) {
33379
34268
  super(name2, "string", "MySqlDateString");
33380
34269
  }
@@ -33386,8 +34275,8 @@ var init_date2 = __esm({
33386
34275
  );
33387
34276
  }
33388
34277
  };
33389
- __publicField(MySqlDateStringBuilder, _a251, "MySqlDateStringBuilder");
33390
- MySqlDateString = class extends (_b177 = MySqlColumn, _a252 = entityKind, _b177) {
34278
+ __publicField(MySqlDateStringBuilder, _a253, "MySqlDateStringBuilder");
34279
+ MySqlDateString = class extends (_b177 = MySqlColumn, _a254 = entityKind, _b177) {
33391
34280
  constructor(table4, config) {
33392
34281
  super(table4, config);
33393
34282
  }
@@ -33395,7 +34284,7 @@ var init_date2 = __esm({
33395
34284
  return `date`;
33396
34285
  }
33397
34286
  };
33398
- __publicField(MySqlDateString, _a252, "MySqlDateString");
34287
+ __publicField(MySqlDateString, _a254, "MySqlDateString");
33399
34288
  }
33400
34289
  });
33401
34290
 
@@ -33407,14 +34296,14 @@ function datetime(a, b) {
33407
34296
  }
33408
34297
  return new MySqlDateTimeBuilder(name2, config);
33409
34298
  }
33410
- var _a253, _b178, MySqlDateTimeBuilder, _a254, _b179, MySqlDateTime, _a255, _b180, MySqlDateTimeStringBuilder, _a256, _b181, MySqlDateTimeString;
34299
+ var _a255, _b178, MySqlDateTimeBuilder, _a256, _b179, MySqlDateTime, _a257, _b180, MySqlDateTimeStringBuilder, _a258, _b181, MySqlDateTimeString;
33411
34300
  var init_datetime = __esm({
33412
34301
  "../drizzle-orm/dist/mysql-core/columns/datetime.js"() {
33413
34302
  "use strict";
33414
34303
  init_entity();
33415
34304
  init_utils2();
33416
34305
  init_common4();
33417
- MySqlDateTimeBuilder = class extends (_b178 = MySqlColumnBuilder, _a253 = entityKind, _b178) {
34306
+ MySqlDateTimeBuilder = class extends (_b178 = MySqlColumnBuilder, _a255 = entityKind, _b178) {
33418
34307
  constructor(name2, config) {
33419
34308
  super(name2, "date", "MySqlDateTime");
33420
34309
  this.config.fsp = config?.fsp;
@@ -33427,8 +34316,8 @@ var init_datetime = __esm({
33427
34316
  );
33428
34317
  }
33429
34318
  };
33430
- __publicField(MySqlDateTimeBuilder, _a253, "MySqlDateTimeBuilder");
33431
- MySqlDateTime = class extends (_b179 = MySqlColumn, _a254 = entityKind, _b179) {
34319
+ __publicField(MySqlDateTimeBuilder, _a255, "MySqlDateTimeBuilder");
34320
+ MySqlDateTime = class extends (_b179 = MySqlColumn, _a256 = entityKind, _b179) {
33432
34321
  constructor(table4, config) {
33433
34322
  super(table4, config);
33434
34323
  __publicField(this, "fsp");
@@ -33445,8 +34334,8 @@ var init_datetime = __esm({
33445
34334
  return /* @__PURE__ */ new Date(value.replace(" ", "T") + "Z");
33446
34335
  }
33447
34336
  };
33448
- __publicField(MySqlDateTime, _a254, "MySqlDateTime");
33449
- MySqlDateTimeStringBuilder = class extends (_b180 = MySqlColumnBuilder, _a255 = entityKind, _b180) {
34337
+ __publicField(MySqlDateTime, _a256, "MySqlDateTime");
34338
+ MySqlDateTimeStringBuilder = class extends (_b180 = MySqlColumnBuilder, _a257 = entityKind, _b180) {
33450
34339
  constructor(name2, config) {
33451
34340
  super(name2, "string", "MySqlDateTimeString");
33452
34341
  this.config.fsp = config?.fsp;
@@ -33459,8 +34348,8 @@ var init_datetime = __esm({
33459
34348
  );
33460
34349
  }
33461
34350
  };
33462
- __publicField(MySqlDateTimeStringBuilder, _a255, "MySqlDateTimeStringBuilder");
33463
- MySqlDateTimeString = class extends (_b181 = MySqlColumn, _a256 = entityKind, _b181) {
34351
+ __publicField(MySqlDateTimeStringBuilder, _a257, "MySqlDateTimeStringBuilder");
34352
+ MySqlDateTimeString = class extends (_b181 = MySqlColumn, _a258 = entityKind, _b181) {
33464
34353
  constructor(table4, config) {
33465
34354
  super(table4, config);
33466
34355
  __publicField(this, "fsp");
@@ -33471,7 +34360,7 @@ var init_datetime = __esm({
33471
34360
  return `datetime${precision}`;
33472
34361
  }
33473
34362
  };
33474
- __publicField(MySqlDateTimeString, _a256, "MySqlDateTimeString");
34363
+ __publicField(MySqlDateTimeString, _a258, "MySqlDateTimeString");
33475
34364
  }
33476
34365
  });
33477
34366
 
@@ -33480,14 +34369,14 @@ function decimal(a, b = {}) {
33480
34369
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33481
34370
  return new MySqlDecimalBuilder(name2, config.precision, config.scale);
33482
34371
  }
33483
- var _a257, _b182, MySqlDecimalBuilder, _a258, _b183, MySqlDecimal;
34372
+ var _a259, _b182, MySqlDecimalBuilder, _a260, _b183, MySqlDecimal;
33484
34373
  var init_decimal = __esm({
33485
34374
  "../drizzle-orm/dist/mysql-core/columns/decimal.js"() {
33486
34375
  "use strict";
33487
34376
  init_entity();
33488
34377
  init_utils2();
33489
34378
  init_common4();
33490
- MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a257 = entityKind, _b182) {
34379
+ MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b182) {
33491
34380
  constructor(name2, precision, scale) {
33492
34381
  super(name2, "string", "MySqlDecimal");
33493
34382
  this.config.precision = precision;
@@ -33501,8 +34390,8 @@ var init_decimal = __esm({
33501
34390
  );
33502
34391
  }
33503
34392
  };
33504
- __publicField(MySqlDecimalBuilder, _a257, "MySqlDecimalBuilder");
33505
- MySqlDecimal = class extends (_b183 = MySqlColumnWithAutoIncrement, _a258 = entityKind, _b183) {
34393
+ __publicField(MySqlDecimalBuilder, _a259, "MySqlDecimalBuilder");
34394
+ MySqlDecimal = class extends (_b183 = MySqlColumnWithAutoIncrement, _a260 = entityKind, _b183) {
33506
34395
  constructor() {
33507
34396
  super(...arguments);
33508
34397
  __publicField(this, "precision", this.config.precision);
@@ -33518,7 +34407,7 @@ var init_decimal = __esm({
33518
34407
  }
33519
34408
  }
33520
34409
  };
33521
- __publicField(MySqlDecimal, _a258, "MySqlDecimal");
34410
+ __publicField(MySqlDecimal, _a260, "MySqlDecimal");
33522
34411
  }
33523
34412
  });
33524
34413
 
@@ -33527,14 +34416,14 @@ function double(a, b) {
33527
34416
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33528
34417
  return new MySqlDoubleBuilder(name2, config);
33529
34418
  }
33530
- var _a259, _b184, MySqlDoubleBuilder, _a260, _b185, MySqlDouble;
34419
+ var _a261, _b184, MySqlDoubleBuilder, _a262, _b185, MySqlDouble;
33531
34420
  var init_double = __esm({
33532
34421
  "../drizzle-orm/dist/mysql-core/columns/double.js"() {
33533
34422
  "use strict";
33534
34423
  init_entity();
33535
34424
  init_utils2();
33536
34425
  init_common4();
33537
- MySqlDoubleBuilder = class extends (_b184 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b184) {
34426
+ MySqlDoubleBuilder = class extends (_b184 = MySqlColumnBuilderWithAutoIncrement, _a261 = entityKind, _b184) {
33538
34427
  constructor(name2, config) {
33539
34428
  super(name2, "number", "MySqlDouble");
33540
34429
  this.config.precision = config?.precision;
@@ -33545,8 +34434,8 @@ var init_double = __esm({
33545
34434
  return new MySqlDouble(table4, this.config);
33546
34435
  }
33547
34436
  };
33548
- __publicField(MySqlDoubleBuilder, _a259, "MySqlDoubleBuilder");
33549
- MySqlDouble = class extends (_b185 = MySqlColumnWithAutoIncrement, _a260 = entityKind, _b185) {
34437
+ __publicField(MySqlDoubleBuilder, _a261, "MySqlDoubleBuilder");
34438
+ MySqlDouble = class extends (_b185 = MySqlColumnWithAutoIncrement, _a262 = entityKind, _b185) {
33550
34439
  constructor() {
33551
34440
  super(...arguments);
33552
34441
  __publicField(this, "precision", this.config.precision);
@@ -33562,7 +34451,7 @@ var init_double = __esm({
33562
34451
  }
33563
34452
  }
33564
34453
  };
33565
- __publicField(MySqlDouble, _a260, "MySqlDouble");
34454
+ __publicField(MySqlDouble, _a262, "MySqlDouble");
33566
34455
  }
33567
34456
  });
33568
34457
 
@@ -33574,14 +34463,14 @@ function mysqlEnum(a, b) {
33574
34463
  }
33575
34464
  return new MySqlEnumColumnBuilder(name2, values);
33576
34465
  }
33577
- var _a261, _b186, MySqlEnumColumnBuilder, _a262, _b187, MySqlEnumColumn;
34466
+ var _a263, _b186, MySqlEnumColumnBuilder, _a264, _b187, MySqlEnumColumn;
33578
34467
  var init_enum2 = __esm({
33579
34468
  "../drizzle-orm/dist/mysql-core/columns/enum.js"() {
33580
34469
  "use strict";
33581
34470
  init_entity();
33582
34471
  init_utils2();
33583
34472
  init_common4();
33584
- MySqlEnumColumnBuilder = class extends (_b186 = MySqlColumnBuilder, _a261 = entityKind, _b186) {
34473
+ MySqlEnumColumnBuilder = class extends (_b186 = MySqlColumnBuilder, _a263 = entityKind, _b186) {
33585
34474
  constructor(name2, values) {
33586
34475
  super(name2, "string", "MySqlEnumColumn");
33587
34476
  this.config.enumValues = values;
@@ -33594,8 +34483,8 @@ var init_enum2 = __esm({
33594
34483
  );
33595
34484
  }
33596
34485
  };
33597
- __publicField(MySqlEnumColumnBuilder, _a261, "MySqlEnumColumnBuilder");
33598
- MySqlEnumColumn = class extends (_b187 = MySqlColumn, _a262 = entityKind, _b187) {
34486
+ __publicField(MySqlEnumColumnBuilder, _a263, "MySqlEnumColumnBuilder");
34487
+ MySqlEnumColumn = class extends (_b187 = MySqlColumn, _a264 = entityKind, _b187) {
33599
34488
  constructor() {
33600
34489
  super(...arguments);
33601
34490
  __publicField(this, "enumValues", this.config.enumValues);
@@ -33604,7 +34493,7 @@ var init_enum2 = __esm({
33604
34493
  return `enum(${this.enumValues.map((value) => `'${value}'`).join(",")})`;
33605
34494
  }
33606
34495
  };
33607
- __publicField(MySqlEnumColumn, _a262, "MySqlEnumColumn");
34496
+ __publicField(MySqlEnumColumn, _a264, "MySqlEnumColumn");
33608
34497
  }
33609
34498
  });
33610
34499
 
@@ -33612,13 +34501,13 @@ var init_enum2 = __esm({
33612
34501
  function float(name2) {
33613
34502
  return new MySqlFloatBuilder(name2 ?? "");
33614
34503
  }
33615
- var _a263, _b188, MySqlFloatBuilder, _a264, _b189, MySqlFloat;
34504
+ var _a265, _b188, MySqlFloatBuilder, _a266, _b189, MySqlFloat;
33616
34505
  var init_float = __esm({
33617
34506
  "../drizzle-orm/dist/mysql-core/columns/float.js"() {
33618
34507
  "use strict";
33619
34508
  init_entity();
33620
34509
  init_common4();
33621
- MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a263 = entityKind, _b188) {
34510
+ MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b188) {
33622
34511
  constructor(name2) {
33623
34512
  super(name2, "number", "MySqlFloat");
33624
34513
  }
@@ -33627,13 +34516,13 @@ var init_float = __esm({
33627
34516
  return new MySqlFloat(table4, this.config);
33628
34517
  }
33629
34518
  };
33630
- __publicField(MySqlFloatBuilder, _a263, "MySqlFloatBuilder");
33631
- MySqlFloat = class extends (_b189 = MySqlColumnWithAutoIncrement, _a264 = entityKind, _b189) {
34519
+ __publicField(MySqlFloatBuilder, _a265, "MySqlFloatBuilder");
34520
+ MySqlFloat = class extends (_b189 = MySqlColumnWithAutoIncrement, _a266 = entityKind, _b189) {
33632
34521
  getSQLType() {
33633
34522
  return "float";
33634
34523
  }
33635
34524
  };
33636
- __publicField(MySqlFloat, _a264, "MySqlFloat");
34525
+ __publicField(MySqlFloat, _a266, "MySqlFloat");
33637
34526
  }
33638
34527
  });
33639
34528
 
@@ -33642,14 +34531,14 @@ function int(a, b) {
33642
34531
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33643
34532
  return new MySqlIntBuilder(name2, config);
33644
34533
  }
33645
- var _a265, _b190, MySqlIntBuilder, _a266, _b191, MySqlInt;
34534
+ var _a267, _b190, MySqlIntBuilder, _a268, _b191, MySqlInt;
33646
34535
  var init_int = __esm({
33647
34536
  "../drizzle-orm/dist/mysql-core/columns/int.js"() {
33648
34537
  "use strict";
33649
34538
  init_entity();
33650
34539
  init_utils2();
33651
34540
  init_common4();
33652
- MySqlIntBuilder = class extends (_b190 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b190) {
34541
+ MySqlIntBuilder = class extends (_b190 = MySqlColumnBuilderWithAutoIncrement, _a267 = entityKind, _b190) {
33653
34542
  constructor(name2, config) {
33654
34543
  super(name2, "number", "MySqlInt");
33655
34544
  this.config.unsigned = config ? config.unsigned : false;
@@ -33659,8 +34548,8 @@ var init_int = __esm({
33659
34548
  return new MySqlInt(table4, this.config);
33660
34549
  }
33661
34550
  };
33662
- __publicField(MySqlIntBuilder, _a265, "MySqlIntBuilder");
33663
- MySqlInt = class extends (_b191 = MySqlColumnWithAutoIncrement, _a266 = entityKind, _b191) {
34551
+ __publicField(MySqlIntBuilder, _a267, "MySqlIntBuilder");
34552
+ MySqlInt = class extends (_b191 = MySqlColumnWithAutoIncrement, _a268 = entityKind, _b191) {
33664
34553
  getSQLType() {
33665
34554
  return `int${this.config.unsigned ? " unsigned" : ""}`;
33666
34555
  }
@@ -33671,7 +34560,7 @@ var init_int = __esm({
33671
34560
  return value;
33672
34561
  }
33673
34562
  };
33674
- __publicField(MySqlInt, _a266, "MySqlInt");
34563
+ __publicField(MySqlInt, _a268, "MySqlInt");
33675
34564
  }
33676
34565
  });
33677
34566
 
@@ -33679,13 +34568,13 @@ var init_int = __esm({
33679
34568
  function json2(name2) {
33680
34569
  return new MySqlJsonBuilder(name2 ?? "");
33681
34570
  }
33682
- var _a267, _b192, MySqlJsonBuilder, _a268, _b193, MySqlJson;
34571
+ var _a269, _b192, MySqlJsonBuilder, _a270, _b193, MySqlJson;
33683
34572
  var init_json2 = __esm({
33684
34573
  "../drizzle-orm/dist/mysql-core/columns/json.js"() {
33685
34574
  "use strict";
33686
34575
  init_entity();
33687
34576
  init_common4();
33688
- MySqlJsonBuilder = class extends (_b192 = MySqlColumnBuilder, _a267 = entityKind, _b192) {
34577
+ MySqlJsonBuilder = class extends (_b192 = MySqlColumnBuilder, _a269 = entityKind, _b192) {
33689
34578
  constructor(name2) {
33690
34579
  super(name2, "json", "MySqlJson");
33691
34580
  }
@@ -33694,8 +34583,8 @@ var init_json2 = __esm({
33694
34583
  return new MySqlJson(table4, this.config);
33695
34584
  }
33696
34585
  };
33697
- __publicField(MySqlJsonBuilder, _a267, "MySqlJsonBuilder");
33698
- MySqlJson = class extends (_b193 = MySqlColumn, _a268 = entityKind, _b193) {
34586
+ __publicField(MySqlJsonBuilder, _a269, "MySqlJsonBuilder");
34587
+ MySqlJson = class extends (_b193 = MySqlColumn, _a270 = entityKind, _b193) {
33699
34588
  getSQLType() {
33700
34589
  return "json";
33701
34590
  }
@@ -33703,7 +34592,7 @@ var init_json2 = __esm({
33703
34592
  return JSON.stringify(value);
33704
34593
  }
33705
34594
  };
33706
- __publicField(MySqlJson, _a268, "MySqlJson");
34595
+ __publicField(MySqlJson, _a270, "MySqlJson");
33707
34596
  }
33708
34597
  });
33709
34598
 
@@ -33712,14 +34601,14 @@ function mediumint(a, b) {
33712
34601
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33713
34602
  return new MySqlMediumIntBuilder(name2, config);
33714
34603
  }
33715
- var _a269, _b194, MySqlMediumIntBuilder, _a270, _b195, MySqlMediumInt;
34604
+ var _a271, _b194, MySqlMediumIntBuilder, _a272, _b195, MySqlMediumInt;
33716
34605
  var init_mediumint = __esm({
33717
34606
  "../drizzle-orm/dist/mysql-core/columns/mediumint.js"() {
33718
34607
  "use strict";
33719
34608
  init_entity();
33720
34609
  init_utils2();
33721
34610
  init_common4();
33722
- MySqlMediumIntBuilder = class extends (_b194 = MySqlColumnBuilderWithAutoIncrement, _a269 = entityKind, _b194) {
34611
+ MySqlMediumIntBuilder = class extends (_b194 = MySqlColumnBuilderWithAutoIncrement, _a271 = entityKind, _b194) {
33723
34612
  constructor(name2, config) {
33724
34613
  super(name2, "number", "MySqlMediumInt");
33725
34614
  this.config.unsigned = config ? config.unsigned : false;
@@ -33732,8 +34621,8 @@ var init_mediumint = __esm({
33732
34621
  );
33733
34622
  }
33734
34623
  };
33735
- __publicField(MySqlMediumIntBuilder, _a269, "MySqlMediumIntBuilder");
33736
- MySqlMediumInt = class extends (_b195 = MySqlColumnWithAutoIncrement, _a270 = entityKind, _b195) {
34624
+ __publicField(MySqlMediumIntBuilder, _a271, "MySqlMediumIntBuilder");
34625
+ MySqlMediumInt = class extends (_b195 = MySqlColumnWithAutoIncrement, _a272 = entityKind, _b195) {
33737
34626
  getSQLType() {
33738
34627
  return `mediumint${this.config.unsigned ? " unsigned" : ""}`;
33739
34628
  }
@@ -33744,7 +34633,7 @@ var init_mediumint = __esm({
33744
34633
  return value;
33745
34634
  }
33746
34635
  };
33747
- __publicField(MySqlMediumInt, _a270, "MySqlMediumInt");
34636
+ __publicField(MySqlMediumInt, _a272, "MySqlMediumInt");
33748
34637
  }
33749
34638
  });
33750
34639
 
@@ -33753,14 +34642,14 @@ function real3(a, b = {}) {
33753
34642
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33754
34643
  return new MySqlRealBuilder(name2, config);
33755
34644
  }
33756
- var _a271, _b196, MySqlRealBuilder, _a272, _b197, MySqlReal;
34645
+ var _a273, _b196, MySqlRealBuilder, _a274, _b197, MySqlReal;
33757
34646
  var init_real3 = __esm({
33758
34647
  "../drizzle-orm/dist/mysql-core/columns/real.js"() {
33759
34648
  "use strict";
33760
34649
  init_entity();
33761
34650
  init_utils2();
33762
34651
  init_common4();
33763
- MySqlRealBuilder = class extends (_b196 = MySqlColumnBuilderWithAutoIncrement, _a271 = entityKind, _b196) {
34652
+ MySqlRealBuilder = class extends (_b196 = MySqlColumnBuilderWithAutoIncrement, _a273 = entityKind, _b196) {
33764
34653
  constructor(name2, config) {
33765
34654
  super(name2, "number", "MySqlReal");
33766
34655
  this.config.precision = config?.precision;
@@ -33771,8 +34660,8 @@ var init_real3 = __esm({
33771
34660
  return new MySqlReal(table4, this.config);
33772
34661
  }
33773
34662
  };
33774
- __publicField(MySqlRealBuilder, _a271, "MySqlRealBuilder");
33775
- MySqlReal = class extends (_b197 = MySqlColumnWithAutoIncrement, _a272 = entityKind, _b197) {
34663
+ __publicField(MySqlRealBuilder, _a273, "MySqlRealBuilder");
34664
+ MySqlReal = class extends (_b197 = MySqlColumnWithAutoIncrement, _a274 = entityKind, _b197) {
33776
34665
  constructor() {
33777
34666
  super(...arguments);
33778
34667
  __publicField(this, "precision", this.config.precision);
@@ -33788,7 +34677,7 @@ var init_real3 = __esm({
33788
34677
  }
33789
34678
  }
33790
34679
  };
33791
- __publicField(MySqlReal, _a272, "MySqlReal");
34680
+ __publicField(MySqlReal, _a274, "MySqlReal");
33792
34681
  }
33793
34682
  });
33794
34683
 
@@ -33796,13 +34685,13 @@ var init_real3 = __esm({
33796
34685
  function serial2(name2) {
33797
34686
  return new MySqlSerialBuilder(name2 ?? "");
33798
34687
  }
33799
- var _a273, _b198, MySqlSerialBuilder, _a274, _b199, MySqlSerial;
34688
+ var _a275, _b198, MySqlSerialBuilder, _a276, _b199, MySqlSerial;
33800
34689
  var init_serial2 = __esm({
33801
34690
  "../drizzle-orm/dist/mysql-core/columns/serial.js"() {
33802
34691
  "use strict";
33803
34692
  init_entity();
33804
34693
  init_common4();
33805
- MySqlSerialBuilder = class extends (_b198 = MySqlColumnBuilderWithAutoIncrement, _a273 = entityKind, _b198) {
34694
+ MySqlSerialBuilder = class extends (_b198 = MySqlColumnBuilderWithAutoIncrement, _a275 = entityKind, _b198) {
33806
34695
  constructor(name2) {
33807
34696
  super(name2, "number", "MySqlSerial");
33808
34697
  this.config.hasDefault = true;
@@ -33813,8 +34702,8 @@ var init_serial2 = __esm({
33813
34702
  return new MySqlSerial(table4, this.config);
33814
34703
  }
33815
34704
  };
33816
- __publicField(MySqlSerialBuilder, _a273, "MySqlSerialBuilder");
33817
- MySqlSerial = class extends (_b199 = MySqlColumnWithAutoIncrement, _a274 = entityKind, _b199) {
34705
+ __publicField(MySqlSerialBuilder, _a275, "MySqlSerialBuilder");
34706
+ MySqlSerial = class extends (_b199 = MySqlColumnWithAutoIncrement, _a276 = entityKind, _b199) {
33818
34707
  getSQLType() {
33819
34708
  return "serial";
33820
34709
  }
@@ -33825,7 +34714,7 @@ var init_serial2 = __esm({
33825
34714
  return value;
33826
34715
  }
33827
34716
  };
33828
- __publicField(MySqlSerial, _a274, "MySqlSerial");
34717
+ __publicField(MySqlSerial, _a276, "MySqlSerial");
33829
34718
  }
33830
34719
  });
33831
34720
 
@@ -33834,14 +34723,14 @@ function smallint2(a, b) {
33834
34723
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33835
34724
  return new MySqlSmallIntBuilder(name2, config);
33836
34725
  }
33837
- var _a275, _b200, MySqlSmallIntBuilder, _a276, _b201, MySqlSmallInt;
34726
+ var _a277, _b200, MySqlSmallIntBuilder, _a278, _b201, MySqlSmallInt;
33838
34727
  var init_smallint2 = __esm({
33839
34728
  "../drizzle-orm/dist/mysql-core/columns/smallint.js"() {
33840
34729
  "use strict";
33841
34730
  init_entity();
33842
34731
  init_utils2();
33843
34732
  init_common4();
33844
- MySqlSmallIntBuilder = class extends (_b200 = MySqlColumnBuilderWithAutoIncrement, _a275 = entityKind, _b200) {
34733
+ MySqlSmallIntBuilder = class extends (_b200 = MySqlColumnBuilderWithAutoIncrement, _a277 = entityKind, _b200) {
33845
34734
  constructor(name2, config) {
33846
34735
  super(name2, "number", "MySqlSmallInt");
33847
34736
  this.config.unsigned = config ? config.unsigned : false;
@@ -33854,8 +34743,8 @@ var init_smallint2 = __esm({
33854
34743
  );
33855
34744
  }
33856
34745
  };
33857
- __publicField(MySqlSmallIntBuilder, _a275, "MySqlSmallIntBuilder");
33858
- MySqlSmallInt = class extends (_b201 = MySqlColumnWithAutoIncrement, _a276 = entityKind, _b201) {
34746
+ __publicField(MySqlSmallIntBuilder, _a277, "MySqlSmallIntBuilder");
34747
+ MySqlSmallInt = class extends (_b201 = MySqlColumnWithAutoIncrement, _a278 = entityKind, _b201) {
33859
34748
  getSQLType() {
33860
34749
  return `smallint${this.config.unsigned ? " unsigned" : ""}`;
33861
34750
  }
@@ -33866,7 +34755,7 @@ var init_smallint2 = __esm({
33866
34755
  return value;
33867
34756
  }
33868
34757
  };
33869
- __publicField(MySqlSmallInt, _a276, "MySqlSmallInt");
34758
+ __publicField(MySqlSmallInt, _a278, "MySqlSmallInt");
33870
34759
  }
33871
34760
  });
33872
34761
 
@@ -33875,14 +34764,14 @@ function text3(a, b = {}) {
33875
34764
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33876
34765
  return new MySqlTextBuilder(name2, "text", config);
33877
34766
  }
33878
- var _a277, _b202, MySqlTextBuilder, _a278, _b203, MySqlText;
34767
+ var _a279, _b202, MySqlTextBuilder, _a280, _b203, MySqlText;
33879
34768
  var init_text3 = __esm({
33880
34769
  "../drizzle-orm/dist/mysql-core/columns/text.js"() {
33881
34770
  "use strict";
33882
34771
  init_entity();
33883
34772
  init_utils2();
33884
34773
  init_common4();
33885
- MySqlTextBuilder = class extends (_b202 = MySqlColumnBuilder, _a277 = entityKind, _b202) {
34774
+ MySqlTextBuilder = class extends (_b202 = MySqlColumnBuilder, _a279 = entityKind, _b202) {
33886
34775
  constructor(name2, textType, config) {
33887
34776
  super(name2, "string", "MySqlText");
33888
34777
  this.config.textType = textType;
@@ -33893,8 +34782,8 @@ var init_text3 = __esm({
33893
34782
  return new MySqlText(table4, this.config);
33894
34783
  }
33895
34784
  };
33896
- __publicField(MySqlTextBuilder, _a277, "MySqlTextBuilder");
33897
- MySqlText = class extends (_b203 = MySqlColumn, _a278 = entityKind, _b203) {
34785
+ __publicField(MySqlTextBuilder, _a279, "MySqlTextBuilder");
34786
+ MySqlText = class extends (_b203 = MySqlColumn, _a280 = entityKind, _b203) {
33898
34787
  constructor() {
33899
34788
  super(...arguments);
33900
34789
  __publicField(this, "textType", this.config.textType);
@@ -33904,7 +34793,7 @@ var init_text3 = __esm({
33904
34793
  return this.textType;
33905
34794
  }
33906
34795
  };
33907
- __publicField(MySqlText, _a278, "MySqlText");
34796
+ __publicField(MySqlText, _a280, "MySqlText");
33908
34797
  }
33909
34798
  });
33910
34799
 
@@ -33913,14 +34802,14 @@ function time2(a, b) {
33913
34802
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33914
34803
  return new MySqlTimeBuilder(name2, config);
33915
34804
  }
33916
- var _a279, _b204, MySqlTimeBuilder, _a280, _b205, MySqlTime;
34805
+ var _a281, _b204, MySqlTimeBuilder, _a282, _b205, MySqlTime;
33917
34806
  var init_time2 = __esm({
33918
34807
  "../drizzle-orm/dist/mysql-core/columns/time.js"() {
33919
34808
  "use strict";
33920
34809
  init_entity();
33921
34810
  init_utils2();
33922
34811
  init_common4();
33923
- MySqlTimeBuilder = class extends (_b204 = MySqlColumnBuilder, _a279 = entityKind, _b204) {
34812
+ MySqlTimeBuilder = class extends (_b204 = MySqlColumnBuilder, _a281 = entityKind, _b204) {
33924
34813
  constructor(name2, config) {
33925
34814
  super(name2, "string", "MySqlTime");
33926
34815
  this.config.fsp = config?.fsp;
@@ -33930,8 +34819,8 @@ var init_time2 = __esm({
33930
34819
  return new MySqlTime(table4, this.config);
33931
34820
  }
33932
34821
  };
33933
- __publicField(MySqlTimeBuilder, _a279, "MySqlTimeBuilder");
33934
- MySqlTime = class extends (_b205 = MySqlColumn, _a280 = entityKind, _b205) {
34822
+ __publicField(MySqlTimeBuilder, _a281, "MySqlTimeBuilder");
34823
+ MySqlTime = class extends (_b205 = MySqlColumn, _a282 = entityKind, _b205) {
33935
34824
  constructor() {
33936
34825
  super(...arguments);
33937
34826
  __publicField(this, "fsp", this.config.fsp);
@@ -33941,19 +34830,19 @@ var init_time2 = __esm({
33941
34830
  return `time${precision}`;
33942
34831
  }
33943
34832
  };
33944
- __publicField(MySqlTime, _a280, "MySqlTime");
34833
+ __publicField(MySqlTime, _a282, "MySqlTime");
33945
34834
  }
33946
34835
  });
33947
34836
 
33948
34837
  // ../drizzle-orm/dist/mysql-core/columns/date.common.js
33949
- var _a281, _b206, MySqlDateColumnBaseBuilder, _a282, _b207, MySqlDateBaseColumn;
34838
+ var _a283, _b206, MySqlDateColumnBaseBuilder, _a284, _b207, MySqlDateBaseColumn;
33950
34839
  var init_date_common2 = __esm({
33951
34840
  "../drizzle-orm/dist/mysql-core/columns/date.common.js"() {
33952
34841
  "use strict";
33953
34842
  init_entity();
33954
34843
  init_sql();
33955
34844
  init_common4();
33956
- MySqlDateColumnBaseBuilder = class extends (_b206 = MySqlColumnBuilder, _a281 = entityKind, _b206) {
34845
+ MySqlDateColumnBaseBuilder = class extends (_b206 = MySqlColumnBuilder, _a283 = entityKind, _b206) {
33957
34846
  defaultNow() {
33958
34847
  return this.default(sql`(now())`);
33959
34848
  }
@@ -33964,14 +34853,14 @@ var init_date_common2 = __esm({
33964
34853
  return this;
33965
34854
  }
33966
34855
  };
33967
- __publicField(MySqlDateColumnBaseBuilder, _a281, "MySqlDateColumnBuilder");
33968
- MySqlDateBaseColumn = class extends (_b207 = MySqlColumn, _a282 = entityKind, _b207) {
34856
+ __publicField(MySqlDateColumnBaseBuilder, _a283, "MySqlDateColumnBuilder");
34857
+ MySqlDateBaseColumn = class extends (_b207 = MySqlColumn, _a284 = entityKind, _b207) {
33969
34858
  constructor() {
33970
34859
  super(...arguments);
33971
34860
  __publicField(this, "hasOnUpdateNow", this.config.hasOnUpdateNow);
33972
34861
  }
33973
34862
  };
33974
- __publicField(MySqlDateBaseColumn, _a282, "MySqlDateColumn");
34863
+ __publicField(MySqlDateBaseColumn, _a284, "MySqlDateColumn");
33975
34864
  }
33976
34865
  });
33977
34866
 
@@ -33983,14 +34872,14 @@ function timestamp2(a, b = {}) {
33983
34872
  }
33984
34873
  return new MySqlTimestampBuilder(name2, config);
33985
34874
  }
33986
- var _a283, _b208, MySqlTimestampBuilder, _a284, _b209, MySqlTimestamp, _a285, _b210, MySqlTimestampStringBuilder, _a286, _b211, MySqlTimestampString;
34875
+ var _a285, _b208, MySqlTimestampBuilder, _a286, _b209, MySqlTimestamp, _a287, _b210, MySqlTimestampStringBuilder, _a288, _b211, MySqlTimestampString;
33987
34876
  var init_timestamp2 = __esm({
33988
34877
  "../drizzle-orm/dist/mysql-core/columns/timestamp.js"() {
33989
34878
  "use strict";
33990
34879
  init_entity();
33991
34880
  init_utils2();
33992
34881
  init_date_common2();
33993
- MySqlTimestampBuilder = class extends (_b208 = MySqlDateColumnBaseBuilder, _a283 = entityKind, _b208) {
34882
+ MySqlTimestampBuilder = class extends (_b208 = MySqlDateColumnBaseBuilder, _a285 = entityKind, _b208) {
33994
34883
  constructor(name2, config) {
33995
34884
  super(name2, "date", "MySqlTimestamp");
33996
34885
  this.config.fsp = config?.fsp;
@@ -34003,8 +34892,8 @@ var init_timestamp2 = __esm({
34003
34892
  );
34004
34893
  }
34005
34894
  };
34006
- __publicField(MySqlTimestampBuilder, _a283, "MySqlTimestampBuilder");
34007
- MySqlTimestamp = class extends (_b209 = MySqlDateBaseColumn, _a284 = entityKind, _b209) {
34895
+ __publicField(MySqlTimestampBuilder, _a285, "MySqlTimestampBuilder");
34896
+ MySqlTimestamp = class extends (_b209 = MySqlDateBaseColumn, _a286 = entityKind, _b209) {
34008
34897
  constructor() {
34009
34898
  super(...arguments);
34010
34899
  __publicField(this, "fsp", this.config.fsp);
@@ -34020,8 +34909,8 @@ var init_timestamp2 = __esm({
34020
34909
  return value.toISOString().slice(0, -1).replace("T", " ");
34021
34910
  }
34022
34911
  };
34023
- __publicField(MySqlTimestamp, _a284, "MySqlTimestamp");
34024
- MySqlTimestampStringBuilder = class extends (_b210 = MySqlDateColumnBaseBuilder, _a285 = entityKind, _b210) {
34912
+ __publicField(MySqlTimestamp, _a286, "MySqlTimestamp");
34913
+ MySqlTimestampStringBuilder = class extends (_b210 = MySqlDateColumnBaseBuilder, _a287 = entityKind, _b210) {
34025
34914
  constructor(name2, config) {
34026
34915
  super(name2, "string", "MySqlTimestampString");
34027
34916
  this.config.fsp = config?.fsp;
@@ -34034,8 +34923,8 @@ var init_timestamp2 = __esm({
34034
34923
  );
34035
34924
  }
34036
34925
  };
34037
- __publicField(MySqlTimestampStringBuilder, _a285, "MySqlTimestampStringBuilder");
34038
- MySqlTimestampString = class extends (_b211 = MySqlDateBaseColumn, _a286 = entityKind, _b211) {
34926
+ __publicField(MySqlTimestampStringBuilder, _a287, "MySqlTimestampStringBuilder");
34927
+ MySqlTimestampString = class extends (_b211 = MySqlDateBaseColumn, _a288 = entityKind, _b211) {
34039
34928
  constructor() {
34040
34929
  super(...arguments);
34041
34930
  __publicField(this, "fsp", this.config.fsp);
@@ -34045,7 +34934,7 @@ var init_timestamp2 = __esm({
34045
34934
  return `timestamp${precision}`;
34046
34935
  }
34047
34936
  };
34048
- __publicField(MySqlTimestampString, _a286, "MySqlTimestampString");
34937
+ __publicField(MySqlTimestampString, _a288, "MySqlTimestampString");
34049
34938
  }
34050
34939
  });
34051
34940
 
@@ -34054,14 +34943,14 @@ function tinyint(a, b) {
34054
34943
  const { name: name2, config } = getColumnNameAndConfig(a, b);
34055
34944
  return new MySqlTinyIntBuilder(name2, config);
34056
34945
  }
34057
- var _a287, _b212, MySqlTinyIntBuilder, _a288, _b213, MySqlTinyInt;
34946
+ var _a289, _b212, MySqlTinyIntBuilder, _a290, _b213, MySqlTinyInt;
34058
34947
  var init_tinyint = __esm({
34059
34948
  "../drizzle-orm/dist/mysql-core/columns/tinyint.js"() {
34060
34949
  "use strict";
34061
34950
  init_entity();
34062
34951
  init_utils2();
34063
34952
  init_common4();
34064
- MySqlTinyIntBuilder = class extends (_b212 = MySqlColumnBuilderWithAutoIncrement, _a287 = entityKind, _b212) {
34953
+ MySqlTinyIntBuilder = class extends (_b212 = MySqlColumnBuilderWithAutoIncrement, _a289 = entityKind, _b212) {
34065
34954
  constructor(name2, config) {
34066
34955
  super(name2, "number", "MySqlTinyInt");
34067
34956
  this.config.unsigned = config ? config.unsigned : false;
@@ -34074,8 +34963,8 @@ var init_tinyint = __esm({
34074
34963
  );
34075
34964
  }
34076
34965
  };
34077
- __publicField(MySqlTinyIntBuilder, _a287, "MySqlTinyIntBuilder");
34078
- MySqlTinyInt = class extends (_b213 = MySqlColumnWithAutoIncrement, _a288 = entityKind, _b213) {
34966
+ __publicField(MySqlTinyIntBuilder, _a289, "MySqlTinyIntBuilder");
34967
+ MySqlTinyInt = class extends (_b213 = MySqlColumnWithAutoIncrement, _a290 = entityKind, _b213) {
34079
34968
  getSQLType() {
34080
34969
  return `tinyint${this.config.unsigned ? " unsigned" : ""}`;
34081
34970
  }
@@ -34086,7 +34975,7 @@ var init_tinyint = __esm({
34086
34975
  return value;
34087
34976
  }
34088
34977
  };
34089
- __publicField(MySqlTinyInt, _a288, "MySqlTinyInt");
34978
+ __publicField(MySqlTinyInt, _a290, "MySqlTinyInt");
34090
34979
  }
34091
34980
  });
34092
34981
 
@@ -34095,14 +34984,14 @@ function varbinary(a, b) {
34095
34984
  const { name: name2, config } = getColumnNameAndConfig(a, b);
34096
34985
  return new MySqlVarBinaryBuilder(name2, config);
34097
34986
  }
34098
- var _a289, _b214, MySqlVarBinaryBuilder, _a290, _b215, MySqlVarBinary;
34987
+ var _a291, _b214, MySqlVarBinaryBuilder, _a292, _b215, MySqlVarBinary;
34099
34988
  var init_varbinary = __esm({
34100
34989
  "../drizzle-orm/dist/mysql-core/columns/varbinary.js"() {
34101
34990
  "use strict";
34102
34991
  init_entity();
34103
34992
  init_utils2();
34104
34993
  init_common4();
34105
- MySqlVarBinaryBuilder = class extends (_b214 = MySqlColumnBuilder, _a289 = entityKind, _b214) {
34994
+ MySqlVarBinaryBuilder = class extends (_b214 = MySqlColumnBuilder, _a291 = entityKind, _b214) {
34106
34995
  /** @internal */
34107
34996
  constructor(name2, config) {
34108
34997
  super(name2, "string", "MySqlVarBinary");
@@ -34116,8 +35005,8 @@ var init_varbinary = __esm({
34116
35005
  );
34117
35006
  }
34118
35007
  };
34119
- __publicField(MySqlVarBinaryBuilder, _a289, "MySqlVarBinaryBuilder");
34120
- MySqlVarBinary = class extends (_b215 = MySqlColumn, _a290 = entityKind, _b215) {
35008
+ __publicField(MySqlVarBinaryBuilder, _a291, "MySqlVarBinaryBuilder");
35009
+ MySqlVarBinary = class extends (_b215 = MySqlColumn, _a292 = entityKind, _b215) {
34121
35010
  constructor() {
34122
35011
  super(...arguments);
34123
35012
  __publicField(this, "length", this.config.length);
@@ -34126,7 +35015,7 @@ var init_varbinary = __esm({
34126
35015
  return this.length === void 0 ? `varbinary` : `varbinary(${this.length})`;
34127
35016
  }
34128
35017
  };
34129
- __publicField(MySqlVarBinary, _a290, "MySqlVarBinary");
35018
+ __publicField(MySqlVarBinary, _a292, "MySqlVarBinary");
34130
35019
  }
34131
35020
  });
34132
35021
 
@@ -34135,14 +35024,14 @@ function varchar2(a, b) {
34135
35024
  const { name: name2, config } = getColumnNameAndConfig(a, b);
34136
35025
  return new MySqlVarCharBuilder(name2, config);
34137
35026
  }
34138
- var _a291, _b216, MySqlVarCharBuilder, _a292, _b217, MySqlVarChar;
35027
+ var _a293, _b216, MySqlVarCharBuilder, _a294, _b217, MySqlVarChar;
34139
35028
  var init_varchar2 = __esm({
34140
35029
  "../drizzle-orm/dist/mysql-core/columns/varchar.js"() {
34141
35030
  "use strict";
34142
35031
  init_entity();
34143
35032
  init_utils2();
34144
35033
  init_common4();
34145
- MySqlVarCharBuilder = class extends (_b216 = MySqlColumnBuilder, _a291 = entityKind, _b216) {
35034
+ MySqlVarCharBuilder = class extends (_b216 = MySqlColumnBuilder, _a293 = entityKind, _b216) {
34146
35035
  /** @internal */
34147
35036
  constructor(name2, config) {
34148
35037
  super(name2, "string", "MySqlVarChar");
@@ -34157,8 +35046,8 @@ var init_varchar2 = __esm({
34157
35046
  );
34158
35047
  }
34159
35048
  };
34160
- __publicField(MySqlVarCharBuilder, _a291, "MySqlVarCharBuilder");
34161
- MySqlVarChar = class extends (_b217 = MySqlColumn, _a292 = entityKind, _b217) {
35049
+ __publicField(MySqlVarCharBuilder, _a293, "MySqlVarCharBuilder");
35050
+ MySqlVarChar = class extends (_b217 = MySqlColumn, _a294 = entityKind, _b217) {
34162
35051
  constructor() {
34163
35052
  super(...arguments);
34164
35053
  __publicField(this, "length", this.config.length);
@@ -34168,7 +35057,7 @@ var init_varchar2 = __esm({
34168
35057
  return this.length === void 0 ? `varchar` : `varchar(${this.length})`;
34169
35058
  }
34170
35059
  };
34171
- __publicField(MySqlVarChar, _a292, "MySqlVarChar");
35060
+ __publicField(MySqlVarChar, _a294, "MySqlVarChar");
34172
35061
  }
34173
35062
  });
34174
35063
 
@@ -34176,13 +35065,13 @@ var init_varchar2 = __esm({
34176
35065
  function year(name2) {
34177
35066
  return new MySqlYearBuilder(name2 ?? "");
34178
35067
  }
34179
- var _a293, _b218, MySqlYearBuilder, _a294, _b219, MySqlYear;
35068
+ var _a295, _b218, MySqlYearBuilder, _a296, _b219, MySqlYear;
34180
35069
  var init_year = __esm({
34181
35070
  "../drizzle-orm/dist/mysql-core/columns/year.js"() {
34182
35071
  "use strict";
34183
35072
  init_entity();
34184
35073
  init_common4();
34185
- MySqlYearBuilder = class extends (_b218 = MySqlColumnBuilder, _a293 = entityKind, _b218) {
35074
+ MySqlYearBuilder = class extends (_b218 = MySqlColumnBuilder, _a295 = entityKind, _b218) {
34186
35075
  constructor(name2) {
34187
35076
  super(name2, "number", "MySqlYear");
34188
35077
  }
@@ -34191,13 +35080,13 @@ var init_year = __esm({
34191
35080
  return new MySqlYear(table4, this.config);
34192
35081
  }
34193
35082
  };
34194
- __publicField(MySqlYearBuilder, _a293, "MySqlYearBuilder");
34195
- MySqlYear = class extends (_b219 = MySqlColumn, _a294 = entityKind, _b219) {
35083
+ __publicField(MySqlYearBuilder, _a295, "MySqlYearBuilder");
35084
+ MySqlYear = class extends (_b219 = MySqlColumn, _a296 = entityKind, _b219) {
34196
35085
  getSQLType() {
34197
35086
  return `year`;
34198
35087
  }
34199
35088
  };
34200
- __publicField(MySqlYear, _a294, "MySqlYear");
35089
+ __publicField(MySqlYear, _a296, "MySqlYear");
34201
35090
  }
34202
35091
  });
34203
35092
 
@@ -34234,17 +35123,17 @@ var init_columns3 = __esm({
34234
35123
  });
34235
35124
 
34236
35125
  // ../drizzle-orm/dist/mysql-core/query-builders/count.js
34237
- var _a295, _b220, _c8, _MySqlCountBuilder, MySqlCountBuilder;
35126
+ var _a297, _b220, _c8, _MySqlCountBuilder, MySqlCountBuilder;
34238
35127
  var init_count3 = __esm({
34239
35128
  "../drizzle-orm/dist/mysql-core/query-builders/count.js"() {
34240
35129
  "use strict";
34241
35130
  init_entity();
34242
35131
  init_sql();
34243
- _MySqlCountBuilder = class _MySqlCountBuilder extends (_c8 = SQL, _b220 = entityKind, _a295 = Symbol.toStringTag, _c8) {
35132
+ _MySqlCountBuilder = class _MySqlCountBuilder extends (_c8 = SQL, _b220 = entityKind, _a297 = Symbol.toStringTag, _c8) {
34244
35133
  constructor(params) {
34245
35134
  super(_MySqlCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
34246
35135
  __publicField(this, "sql");
34247
- __publicField(this, _a295, "MySqlCountBuilder");
35136
+ __publicField(this, _a297, "MySqlCountBuilder");
34248
35137
  __publicField(this, "session");
34249
35138
  this.params = params;
34250
35139
  this.mapWith(Number);
@@ -34288,7 +35177,7 @@ var init_count3 = __esm({
34288
35177
  });
34289
35178
 
34290
35179
  // ../drizzle-orm/dist/mysql-core/query-builders/delete.js
34291
- var _a296, _b221, MySqlDeleteBase;
35180
+ var _a298, _b221, MySqlDeleteBase;
34292
35181
  var init_delete3 = __esm({
34293
35182
  "../drizzle-orm/dist/mysql-core/query-builders/delete.js"() {
34294
35183
  "use strict";
@@ -34296,7 +35185,7 @@ var init_delete3 = __esm({
34296
35185
  init_query_promise();
34297
35186
  init_selection_proxy();
34298
35187
  init_table();
34299
- MySqlDeleteBase = class extends (_b221 = QueryPromise, _a296 = entityKind, _b221) {
35188
+ MySqlDeleteBase = class extends (_b221 = QueryPromise, _a298 = entityKind, _b221) {
34300
35189
  constructor(table4, session, dialect4, withList) {
34301
35190
  super();
34302
35191
  __publicField(this, "config");
@@ -34386,12 +35275,12 @@ var init_delete3 = __esm({
34386
35275
  return this;
34387
35276
  }
34388
35277
  };
34389
- __publicField(MySqlDeleteBase, _a296, "MySqlDelete");
35278
+ __publicField(MySqlDeleteBase, _a298, "MySqlDelete");
34390
35279
  }
34391
35280
  });
34392
35281
 
34393
35282
  // ../drizzle-orm/dist/mysql-core/query-builders/insert.js
34394
- var _a297, MySqlInsertBuilder, _a298, _b222, MySqlInsertBase;
35283
+ var _a299, MySqlInsertBuilder, _a300, _b222, MySqlInsertBase;
34395
35284
  var init_insert3 = __esm({
34396
35285
  "../drizzle-orm/dist/mysql-core/query-builders/insert.js"() {
34397
35286
  "use strict";
@@ -34400,7 +35289,7 @@ var init_insert3 = __esm({
34400
35289
  init_sql();
34401
35290
  init_table();
34402
35291
  init_utils2();
34403
- _a297 = entityKind;
35292
+ _a299 = entityKind;
34404
35293
  MySqlInsertBuilder = class {
34405
35294
  constructor(table4, session, dialect4) {
34406
35295
  __publicField(this, "shouldIgnore", false);
@@ -34429,8 +35318,8 @@ var init_insert3 = __esm({
34429
35318
  return new MySqlInsertBase(this.table, mappedValues, this.shouldIgnore, this.session, this.dialect);
34430
35319
  }
34431
35320
  };
34432
- __publicField(MySqlInsertBuilder, _a297, "MySqlInsertBuilder");
34433
- MySqlInsertBase = class extends (_b222 = QueryPromise, _a298 = entityKind, _b222) {
35321
+ __publicField(MySqlInsertBuilder, _a299, "MySqlInsertBuilder");
35322
+ MySqlInsertBase = class extends (_b222 = QueryPromise, _a300 = entityKind, _b222) {
34434
35323
  constructor(table4, values, ignore, session, dialect4) {
34435
35324
  super();
34436
35325
  __publicField(this, "config");
@@ -34511,7 +35400,7 @@ var init_insert3 = __esm({
34511
35400
  return this;
34512
35401
  }
34513
35402
  };
34514
- __publicField(MySqlInsertBase, _a298, "MySqlInsert");
35403
+ __publicField(MySqlInsertBase, _a300, "MySqlInsert");
34515
35404
  }
34516
35405
  });
34517
35406
 
@@ -34595,7 +35484,7 @@ function mysqlTableWithSchema(name2, columns, extraConfig, schema4, baseName = n
34595
35484
  }
34596
35485
  return table4;
34597
35486
  }
34598
- var InlineForeignKeys3, _a299, _b223, _c9, _d4, _e3, MySqlTable, mysqlTable;
35487
+ var InlineForeignKeys3, _a301, _b223, _c9, _d4, _e4, MySqlTable, mysqlTable;
34599
35488
  var init_table4 = __esm({
34600
35489
  "../drizzle-orm/dist/mysql-core/table.js"() {
34601
35490
  "use strict";
@@ -34603,7 +35492,7 @@ var init_table4 = __esm({
34603
35492
  init_table();
34604
35493
  init_all3();
34605
35494
  InlineForeignKeys3 = Symbol.for("drizzle:MySqlInlineForeignKeys");
34606
- MySqlTable = class extends (_e3 = Table, _d4 = entityKind, _c9 = Table.Symbol.Columns, _b223 = InlineForeignKeys3, _a299 = Table.Symbol.ExtraConfigBuilder, _e3) {
35495
+ MySqlTable = class extends (_e4 = Table, _d4 = entityKind, _c9 = Table.Symbol.Columns, _b223 = InlineForeignKeys3, _a301 = Table.Symbol.ExtraConfigBuilder, _e4) {
34607
35496
  constructor() {
34608
35497
  super(...arguments);
34609
35498
  /** @internal */
@@ -34611,7 +35500,7 @@ var init_table4 = __esm({
34611
35500
  /** @internal */
34612
35501
  __publicField(this, _b223, []);
34613
35502
  /** @internal */
34614
- __publicField(this, _a299);
35503
+ __publicField(this, _a301);
34615
35504
  }
34616
35505
  };
34617
35506
  __publicField(MySqlTable, _d4, "MySqlTable");
@@ -34626,20 +35515,20 @@ var init_table4 = __esm({
34626
35515
  });
34627
35516
 
34628
35517
  // ../drizzle-orm/dist/mysql-core/view-base.js
34629
- var _a300, _b224, MySqlViewBase;
35518
+ var _a302, _b224, MySqlViewBase;
34630
35519
  var init_view_base3 = __esm({
34631
35520
  "../drizzle-orm/dist/mysql-core/view-base.js"() {
34632
35521
  "use strict";
34633
35522
  init_entity();
34634
35523
  init_sql();
34635
- MySqlViewBase = class extends (_b224 = View3, _a300 = entityKind, _b224) {
35524
+ MySqlViewBase = class extends (_b224 = View3, _a302 = entityKind, _b224) {
34636
35525
  };
34637
- __publicField(MySqlViewBase, _a300, "MySqlViewBase");
35526
+ __publicField(MySqlViewBase, _a302, "MySqlViewBase");
34638
35527
  }
34639
35528
  });
34640
35529
 
34641
35530
  // ../drizzle-orm/dist/mysql-core/dialect.js
34642
- var _a301, MySqlDialect;
35531
+ var _a303, MySqlDialect;
34643
35532
  var init_dialect3 = __esm({
34644
35533
  "../drizzle-orm/dist/mysql-core/dialect.js"() {
34645
35534
  "use strict";
@@ -34658,7 +35547,7 @@ var init_dialect3 = __esm({
34658
35547
  init_common4();
34659
35548
  init_table4();
34660
35549
  init_view_base3();
34661
- _a301 = entityKind;
35550
+ _a303 = entityKind;
34662
35551
  MySqlDialect = class {
34663
35552
  constructor(config) {
34664
35553
  /** @internal */
@@ -35444,7 +36333,7 @@ var init_dialect3 = __esm({
35444
36333
  };
35445
36334
  }
35446
36335
  };
35447
- __publicField(MySqlDialect, _a301, "MySqlDialect");
36336
+ __publicField(MySqlDialect, _a303, "MySqlDialect");
35448
36337
  }
35449
36338
  });
35450
36339
 
@@ -35466,7 +36355,7 @@ function createSetOperator3(type, isAll) {
35466
36355
  return leftSelect.addSetOperators(setOperators);
35467
36356
  };
35468
36357
  }
35469
- var _a302, MySqlSelectBuilder, _a303, _b225, MySqlSelectQueryBuilderBase, _a304, _b226, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
36358
+ var _a304, MySqlSelectBuilder, _a305, _b225, MySqlSelectQueryBuilderBase, _a306, _b226, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
35470
36359
  var init_select4 = __esm({
35471
36360
  "../drizzle-orm/dist/mysql-core/query-builders/select.js"() {
35472
36361
  "use strict";
@@ -35481,7 +36370,7 @@ var init_select4 = __esm({
35481
36370
  init_utils2();
35482
36371
  init_view_common();
35483
36372
  init_view_base3();
35484
- _a302 = entityKind;
36373
+ _a304 = entityKind;
35485
36374
  MySqlSelectBuilder = class {
35486
36375
  constructor(config) {
35487
36376
  __publicField(this, "fields");
@@ -35526,8 +36415,8 @@ var init_select4 = __esm({
35526
36415
  );
35527
36416
  }
35528
36417
  };
35529
- __publicField(MySqlSelectBuilder, _a302, "MySqlSelectBuilder");
35530
- MySqlSelectQueryBuilderBase = class extends (_b225 = TypedQueryBuilder, _a303 = entityKind, _b225) {
36418
+ __publicField(MySqlSelectBuilder, _a304, "MySqlSelectBuilder");
36419
+ MySqlSelectQueryBuilderBase = class extends (_b225 = TypedQueryBuilder, _a305 = entityKind, _b225) {
35531
36420
  constructor({ table: table4, fields, isPartialSelect, session, dialect: dialect4, withList, distinct }) {
35532
36421
  super();
35533
36422
  __publicField(this, "_");
@@ -36128,8 +37017,8 @@ var init_select4 = __esm({
36128
37017
  return this;
36129
37018
  }
36130
37019
  };
36131
- __publicField(MySqlSelectQueryBuilderBase, _a303, "MySqlSelectQueryBuilder");
36132
- MySqlSelectBase = class extends (_b226 = MySqlSelectQueryBuilderBase, _a304 = entityKind, _b226) {
37020
+ __publicField(MySqlSelectQueryBuilderBase, _a305, "MySqlSelectQueryBuilder");
37021
+ MySqlSelectBase = class extends (_b226 = MySqlSelectQueryBuilderBase, _a306 = entityKind, _b226) {
36133
37022
  constructor() {
36134
37023
  super(...arguments);
36135
37024
  __publicField(this, "execute", (placeholderValues) => {
@@ -36153,7 +37042,7 @@ var init_select4 = __esm({
36153
37042
  return query;
36154
37043
  }
36155
37044
  };
36156
- __publicField(MySqlSelectBase, _a304, "MySqlSelect");
37045
+ __publicField(MySqlSelectBase, _a306, "MySqlSelect");
36157
37046
  applyMixins(MySqlSelectBase, [QueryPromise]);
36158
37047
  getMySqlSetOperators = () => ({
36159
37048
  union: union3,
@@ -36173,7 +37062,7 @@ var init_select4 = __esm({
36173
37062
  });
36174
37063
 
36175
37064
  // ../drizzle-orm/dist/mysql-core/query-builders/query-builder.js
36176
- var _a305, QueryBuilder3;
37065
+ var _a307, QueryBuilder3;
36177
37066
  var init_query_builder4 = __esm({
36178
37067
  "../drizzle-orm/dist/mysql-core/query-builders/query-builder.js"() {
36179
37068
  "use strict";
@@ -36182,7 +37071,7 @@ var init_query_builder4 = __esm({
36182
37071
  init_selection_proxy();
36183
37072
  init_subquery();
36184
37073
  init_select4();
36185
- _a305 = entityKind;
37074
+ _a307 = entityKind;
36186
37075
  QueryBuilder3 = class {
36187
37076
  constructor(dialect4) {
36188
37077
  __publicField(this, "dialect");
@@ -36244,7 +37133,7 @@ var init_query_builder4 = __esm({
36244
37133
  return this.dialect;
36245
37134
  }
36246
37135
  };
36247
- __publicField(QueryBuilder3, _a305, "MySqlQueryBuilder");
37136
+ __publicField(QueryBuilder3, _a307, "MySqlQueryBuilder");
36248
37137
  }
36249
37138
  });
36250
37139
 
@@ -36256,7 +37145,7 @@ var init_select_types3 = __esm({
36256
37145
  });
36257
37146
 
36258
37147
  // ../drizzle-orm/dist/mysql-core/query-builders/update.js
36259
- var _a306, MySqlUpdateBuilder, _a307, _b227, MySqlUpdateBase;
37148
+ var _a308, MySqlUpdateBuilder, _a309, _b227, MySqlUpdateBase;
36260
37149
  var init_update3 = __esm({
36261
37150
  "../drizzle-orm/dist/mysql-core/query-builders/update.js"() {
36262
37151
  "use strict";
@@ -36265,7 +37154,7 @@ var init_update3 = __esm({
36265
37154
  init_selection_proxy();
36266
37155
  init_table();
36267
37156
  init_utils2();
36268
- _a306 = entityKind;
37157
+ _a308 = entityKind;
36269
37158
  MySqlUpdateBuilder = class {
36270
37159
  constructor(table4, session, dialect4, withList) {
36271
37160
  this.table = table4;
@@ -36277,8 +37166,8 @@ var init_update3 = __esm({
36277
37166
  return new MySqlUpdateBase(this.table, mapUpdateSet(this.table, values), this.session, this.dialect, this.withList);
36278
37167
  }
36279
37168
  };
36280
- __publicField(MySqlUpdateBuilder, _a306, "MySqlUpdateBuilder");
36281
- MySqlUpdateBase = class extends (_b227 = QueryPromise, _a307 = entityKind, _b227) {
37169
+ __publicField(MySqlUpdateBuilder, _a308, "MySqlUpdateBuilder");
37170
+ MySqlUpdateBase = class extends (_b227 = QueryPromise, _a309 = entityKind, _b227) {
36282
37171
  constructor(table4, set, session, dialect4, withList) {
36283
37172
  super();
36284
37173
  __publicField(this, "config");
@@ -36371,7 +37260,7 @@ var init_update3 = __esm({
36371
37260
  return this;
36372
37261
  }
36373
37262
  };
36374
- __publicField(MySqlUpdateBase, _a307, "MySqlUpdate");
37263
+ __publicField(MySqlUpdateBase, _a309, "MySqlUpdate");
36375
37264
  }
36376
37265
  });
36377
37266
 
@@ -36389,14 +37278,14 @@ var init_query_builders3 = __esm({
36389
37278
  });
36390
37279
 
36391
37280
  // ../drizzle-orm/dist/mysql-core/query-builders/query.js
36392
- var _a308, RelationalQueryBuilder3, _a309, _b228, MySqlRelationalQuery;
37281
+ var _a310, RelationalQueryBuilder3, _a311, _b228, MySqlRelationalQuery;
36393
37282
  var init_query3 = __esm({
36394
37283
  "../drizzle-orm/dist/mysql-core/query-builders/query.js"() {
36395
37284
  "use strict";
36396
37285
  init_entity();
36397
37286
  init_query_promise();
36398
37287
  init_relations();
36399
- _a308 = entityKind;
37288
+ _a310 = entityKind;
36400
37289
  RelationalQueryBuilder3 = class {
36401
37290
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, mode) {
36402
37291
  this.fullSchema = fullSchema;
@@ -36437,8 +37326,8 @@ var init_query3 = __esm({
36437
37326
  );
36438
37327
  }
36439
37328
  };
36440
- __publicField(RelationalQueryBuilder3, _a308, "MySqlRelationalQueryBuilder");
36441
- MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a309 = entityKind, _b228) {
37329
+ __publicField(RelationalQueryBuilder3, _a310, "MySqlRelationalQueryBuilder");
37330
+ MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a311 = entityKind, _b228) {
36442
37331
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, config, queryMode, mode) {
36443
37332
  super();
36444
37333
  this.fullSchema = fullSchema;
@@ -36502,12 +37391,12 @@ var init_query3 = __esm({
36502
37391
  return this.prepare().execute();
36503
37392
  }
36504
37393
  };
36505
- __publicField(MySqlRelationalQuery, _a309, "MySqlRelationalQuery");
37394
+ __publicField(MySqlRelationalQuery, _a311, "MySqlRelationalQuery");
36506
37395
  }
36507
37396
  });
36508
37397
 
36509
37398
  // ../drizzle-orm/dist/mysql-core/db.js
36510
- var _a310, MySqlDatabase;
37399
+ var _a312, MySqlDatabase;
36511
37400
  var init_db3 = __esm({
36512
37401
  "../drizzle-orm/dist/mysql-core/db.js"() {
36513
37402
  "use strict";
@@ -36518,7 +37407,7 @@ var init_db3 = __esm({
36518
37407
  init_count3();
36519
37408
  init_query_builders3();
36520
37409
  init_query3();
36521
- _a310 = entityKind;
37410
+ _a312 = entityKind;
36522
37411
  MySqlDatabase = class {
36523
37412
  constructor(dialect4, session, schema4, mode) {
36524
37413
  __publicField(this, "query");
@@ -36731,17 +37620,17 @@ var init_db3 = __esm({
36731
37620
  return this.session.transaction(transaction, config);
36732
37621
  }
36733
37622
  };
36734
- __publicField(MySqlDatabase, _a310, "MySqlDatabase");
37623
+ __publicField(MySqlDatabase, _a312, "MySqlDatabase");
36735
37624
  }
36736
37625
  });
36737
37626
 
36738
37627
  // ../drizzle-orm/dist/mysql-core/indexes.js
36739
- var _a311, IndexBuilderOn3, _a312, IndexBuilder3, _a313, Index5;
37628
+ var _a313, IndexBuilderOn3, _a314, IndexBuilder3, _a315, Index5;
36740
37629
  var init_indexes3 = __esm({
36741
37630
  "../drizzle-orm/dist/mysql-core/indexes.js"() {
36742
37631
  "use strict";
36743
37632
  init_entity();
36744
- _a311 = entityKind;
37633
+ _a313 = entityKind;
36745
37634
  IndexBuilderOn3 = class {
36746
37635
  constructor(name2, unique) {
36747
37636
  this.name = name2;
@@ -36751,8 +37640,8 @@ var init_indexes3 = __esm({
36751
37640
  return new IndexBuilder3(this.name, columns, this.unique);
36752
37641
  }
36753
37642
  };
36754
- __publicField(IndexBuilderOn3, _a311, "MySqlIndexBuilderOn");
36755
- _a312 = entityKind;
37643
+ __publicField(IndexBuilderOn3, _a313, "MySqlIndexBuilderOn");
37644
+ _a314 = entityKind;
36756
37645
  IndexBuilder3 = class {
36757
37646
  constructor(name2, columns, unique) {
36758
37647
  /** @internal */
@@ -36780,26 +37669,26 @@ var init_indexes3 = __esm({
36780
37669
  return new Index5(this.config, table4);
36781
37670
  }
36782
37671
  };
36783
- __publicField(IndexBuilder3, _a312, "MySqlIndexBuilder");
36784
- _a313 = entityKind;
37672
+ __publicField(IndexBuilder3, _a314, "MySqlIndexBuilder");
37673
+ _a315 = entityKind;
36785
37674
  Index5 = class {
36786
37675
  constructor(config, table4) {
36787
37676
  __publicField(this, "config");
36788
37677
  this.config = { ...config, table: table4 };
36789
37678
  }
36790
37679
  };
36791
- __publicField(Index5, _a313, "MySqlIndex");
37680
+ __publicField(Index5, _a315, "MySqlIndex");
36792
37681
  }
36793
37682
  });
36794
37683
 
36795
37684
  // ../drizzle-orm/dist/mysql-core/primary-keys.js
36796
- var _a314, PrimaryKeyBuilder3, _a315, PrimaryKey3;
37685
+ var _a316, PrimaryKeyBuilder3, _a317, PrimaryKey3;
36797
37686
  var init_primary_keys3 = __esm({
36798
37687
  "../drizzle-orm/dist/mysql-core/primary-keys.js"() {
36799
37688
  "use strict";
36800
37689
  init_entity();
36801
37690
  init_table4();
36802
- _a314 = entityKind;
37691
+ _a316 = entityKind;
36803
37692
  PrimaryKeyBuilder3 = class {
36804
37693
  constructor(columns, name2) {
36805
37694
  /** @internal */
@@ -36814,8 +37703,8 @@ var init_primary_keys3 = __esm({
36814
37703
  return new PrimaryKey3(table4, this.columns, this.name);
36815
37704
  }
36816
37705
  };
36817
- __publicField(PrimaryKeyBuilder3, _a314, "MySqlPrimaryKeyBuilder");
36818
- _a315 = entityKind;
37706
+ __publicField(PrimaryKeyBuilder3, _a316, "MySqlPrimaryKeyBuilder");
37707
+ _a317 = entityKind;
36819
37708
  PrimaryKey3 = class {
36820
37709
  constructor(table4, columns, name2) {
36821
37710
  __publicField(this, "columns");
@@ -36828,7 +37717,7 @@ var init_primary_keys3 = __esm({
36828
37717
  return this.name ?? `${this.table[MySqlTable.Symbol.Name]}_${this.columns.map((column4) => column4.name).join("_")}_pk`;
36829
37718
  }
36830
37719
  };
36831
- __publicField(PrimaryKey3, _a315, "MySqlPrimaryKey");
37720
+ __publicField(PrimaryKey3, _a317, "MySqlPrimaryKey");
36832
37721
  }
36833
37722
  });
36834
37723
 
@@ -36848,7 +37737,7 @@ function mysqlViewWithSchema(name2, selection, schema4) {
36848
37737
  }
36849
37738
  return new ViewBuilder3(name2, schema4);
36850
37739
  }
36851
- var _a316, ViewBuilderCore2, _a317, _b229, ViewBuilder3, _a318, _b230, ManualViewBuilder3, _a319, _b231, _c10, MySqlView2;
37740
+ var _a318, ViewBuilderCore2, _a319, _b229, ViewBuilder3, _a320, _b230, ManualViewBuilder3, _a321, _b231, _c10, MySqlView2;
36852
37741
  var init_view3 = __esm({
36853
37742
  "../drizzle-orm/dist/mysql-core/view.js"() {
36854
37743
  "use strict";
@@ -36859,7 +37748,7 @@ var init_view3 = __esm({
36859
37748
  init_table4();
36860
37749
  init_view_base3();
36861
37750
  init_view_common3();
36862
- _a316 = entityKind;
37751
+ _a318 = entityKind;
36863
37752
  ViewBuilderCore2 = class {
36864
37753
  constructor(name2, schema4) {
36865
37754
  __publicField(this, "config", {});
@@ -36879,8 +37768,8 @@ var init_view3 = __esm({
36879
37768
  return this;
36880
37769
  }
36881
37770
  };
36882
- __publicField(ViewBuilderCore2, _a316, "MySqlViewBuilder");
36883
- ViewBuilder3 = class extends (_b229 = ViewBuilderCore2, _a317 = entityKind, _b229) {
37771
+ __publicField(ViewBuilderCore2, _a318, "MySqlViewBuilder");
37772
+ ViewBuilder3 = class extends (_b229 = ViewBuilderCore2, _a319 = entityKind, _b229) {
36884
37773
  as(qb) {
36885
37774
  if (typeof qb === "function") {
36886
37775
  qb = qb(new QueryBuilder3());
@@ -36906,8 +37795,8 @@ var init_view3 = __esm({
36906
37795
  );
36907
37796
  }
36908
37797
  };
36909
- __publicField(ViewBuilder3, _a317, "MySqlViewBuilder");
36910
- ManualViewBuilder3 = class extends (_b230 = ViewBuilderCore2, _a318 = entityKind, _b230) {
37798
+ __publicField(ViewBuilder3, _a319, "MySqlViewBuilder");
37799
+ ManualViewBuilder3 = class extends (_b230 = ViewBuilderCore2, _a320 = entityKind, _b230) {
36911
37800
  constructor(name2, columns, schema4) {
36912
37801
  super(name2, schema4);
36913
37802
  __publicField(this, "columns");
@@ -36952,11 +37841,11 @@ var init_view3 = __esm({
36952
37841
  );
36953
37842
  }
36954
37843
  };
36955
- __publicField(ManualViewBuilder3, _a318, "MySqlManualViewBuilder");
36956
- MySqlView2 = class extends (_c10 = MySqlViewBase, _b231 = entityKind, _a319 = MySqlViewConfig, _c10) {
37844
+ __publicField(ManualViewBuilder3, _a320, "MySqlManualViewBuilder");
37845
+ MySqlView2 = class extends (_c10 = MySqlViewBase, _b231 = entityKind, _a321 = MySqlViewConfig, _c10) {
36957
37846
  constructor({ mysqlConfig, config }) {
36958
37847
  super(config);
36959
- __publicField(this, _a319);
37848
+ __publicField(this, _a321);
36960
37849
  this[MySqlViewConfig] = mysqlConfig;
36961
37850
  }
36962
37851
  };
@@ -36965,14 +37854,14 @@ var init_view3 = __esm({
36965
37854
  });
36966
37855
 
36967
37856
  // ../drizzle-orm/dist/mysql-core/schema.js
36968
- var _a320, MySqlSchema5;
37857
+ var _a322, MySqlSchema5;
36969
37858
  var init_schema2 = __esm({
36970
37859
  "../drizzle-orm/dist/mysql-core/schema.js"() {
36971
37860
  "use strict";
36972
37861
  init_entity();
36973
37862
  init_table4();
36974
37863
  init_view3();
36975
- _a320 = entityKind;
37864
+ _a322 = entityKind;
36976
37865
  MySqlSchema5 = class {
36977
37866
  constructor(schemaName) {
36978
37867
  __publicField(this, "table", (name2, columns, extraConfig) => {
@@ -36984,12 +37873,12 @@ var init_schema2 = __esm({
36984
37873
  this.schemaName = schemaName;
36985
37874
  }
36986
37875
  };
36987
- __publicField(MySqlSchema5, _a320, "MySqlSchema");
37876
+ __publicField(MySqlSchema5, _a322, "MySqlSchema");
36988
37877
  }
36989
37878
  });
36990
37879
 
36991
37880
  // ../drizzle-orm/dist/mysql-core/session.js
36992
- var _a321, MySqlPreparedQuery, _a322, MySqlSession, _a323, _b232, MySqlTransaction;
37881
+ var _a323, MySqlPreparedQuery, _a324, MySqlSession, _a325, _b232, MySqlTransaction;
36993
37882
  var init_session3 = __esm({
36994
37883
  "../drizzle-orm/dist/mysql-core/session.js"() {
36995
37884
  "use strict";
@@ -36997,15 +37886,15 @@ var init_session3 = __esm({
36997
37886
  init_errors();
36998
37887
  init_sql();
36999
37888
  init_db3();
37000
- _a321 = entityKind;
37889
+ _a323 = entityKind;
37001
37890
  MySqlPreparedQuery = class {
37002
37891
  constructor() {
37003
37892
  /** @internal */
37004
37893
  __publicField(this, "joinsNotNullableMap");
37005
37894
  }
37006
37895
  };
37007
- __publicField(MySqlPreparedQuery, _a321, "MySqlPreparedQuery");
37008
- _a322 = entityKind;
37896
+ __publicField(MySqlPreparedQuery, _a323, "MySqlPreparedQuery");
37897
+ _a324 = entityKind;
37009
37898
  MySqlSession = class {
37010
37899
  constructor(dialect4) {
37011
37900
  this.dialect = dialect4;
@@ -37040,8 +37929,8 @@ var init_session3 = __esm({
37040
37929
  return parts.length ? sql`start transaction ${sql.raw(parts.join(" "))}` : void 0;
37041
37930
  }
37042
37931
  };
37043
- __publicField(MySqlSession, _a322, "MySqlSession");
37044
- MySqlTransaction = class extends (_b232 = MySqlDatabase, _a323 = entityKind, _b232) {
37932
+ __publicField(MySqlSession, _a324, "MySqlSession");
37933
+ MySqlTransaction = class extends (_b232 = MySqlDatabase, _a325 = entityKind, _b232) {
37045
37934
  constructor(dialect4, session, schema4, nestedIndex, mode) {
37046
37935
  super(dialect4, session, schema4, mode);
37047
37936
  this.schema = schema4;
@@ -37051,7 +37940,7 @@ var init_session3 = __esm({
37051
37940
  throw new TransactionRollbackError();
37052
37941
  }
37053
37942
  };
37054
- __publicField(MySqlTransaction, _a323, "MySqlTransaction");
37943
+ __publicField(MySqlTransaction, _a325, "MySqlTransaction");
37055
37944
  }
37056
37945
  });
37057
37946
 
@@ -37939,6 +38828,13 @@ var init_cli = __esm({
37939
38828
  breakpoints: booleanType().optional().default(true),
37940
38829
  migrations: objectType({
37941
38830
  prefix: prefix.optional().default("index")
38831
+ }).optional(),
38832
+ entities: objectType({
38833
+ roles: booleanType().or(objectType({
38834
+ provider: stringType().optional(),
38835
+ include: stringType().array().optional(),
38836
+ exclude: stringType().array().optional()
38837
+ })).optional().default(false)
37942
38838
  }).optional()
37943
38839
  }).passthrough();
37944
38840
  configCheck = objectType({
@@ -38205,6 +39101,7 @@ var init_pgImports = __esm({
38205
39101
  const enums = [];
38206
39102
  const schemas = [];
38207
39103
  const sequences = [];
39104
+ const roles = [];
38208
39105
  const views = [];
38209
39106
  const matViews = [];
38210
39107
  const i0values = Object.values(exports);
@@ -38228,8 +39125,11 @@ var init_pgImports = __esm({
38228
39125
  if (isPgSequence(t)) {
38229
39126
  sequences.push(t);
38230
39127
  }
39128
+ if (is(t, PgRole)) {
39129
+ roles.push(t);
39130
+ }
38231
39131
  });
38232
- return { tables, enums, schemas, sequences, views, matViews };
39132
+ return { tables, enums, schemas, sequences, views, matViews, roles };
38233
39133
  };
38234
39134
  }
38235
39135
  });
@@ -38635,7 +39535,7 @@ init_mjs();
38635
39535
  init_global();
38636
39536
  init_pgSerializer();
38637
39537
  init_views();
38638
- var pgPushIntrospect = async (db, filters, schemaFilters) => {
39538
+ var pgPushIntrospect = async (db, filters, schemaFilters, entities = { roles: true }) => {
38639
39539
  const matchers = filters.map((it) => {
38640
39540
  return new Minimatch(it);
38641
39541
  });
@@ -38663,7 +39563,7 @@ var pgPushIntrospect = async (db, filters, schemaFilters) => {
38663
39563
  );
38664
39564
  const res = await (0, import_hanji3.renderWithTask)(
38665
39565
  progress,
38666
- fromDatabase(db, filter2, schemaFilters)
39566
+ fromDatabase(db, filter2, schemaFilters, entities)
38667
39567
  );
38668
39568
  const schema4 = { id: originUUID, prevId: "", ...res };
38669
39569
  const { internal, ...schemaWithoutInternals } = schema4;
@@ -38833,17 +39733,11 @@ var pgSuggestions = async (db, statements) => {
38833
39733
  }
38834
39734
  const stmnt = fromJson([statement], "postgresql");
38835
39735
  if (typeof stmnt !== "undefined") {
38836
- if (statement.type === "drop_table") {
38837
- statementsToExecute.push(
38838
- `DROP TABLE ${concatSchemaAndTableName(statement.schema, statement.tableName)} CASCADE;`
38839
- );
38840
- } else {
38841
- statementsToExecute.push(...stmnt);
38842
- }
39736
+ statementsToExecute.push(...stmnt);
38843
39737
  }
38844
39738
  }
38845
39739
  return {
38846
- statementsToExecute,
39740
+ statementsToExecute: [...new Set(statementsToExecute)],
38847
39741
  shouldAskForApprove,
38848
39742
  infoToPrint,
38849
39743
  matViewsToRemove: [...new Set(matViewsToRemove)],
@@ -39089,6 +39983,7 @@ var generateDrizzleJson = (imports, prevId, schemaFilters, casing2) => {
39089
39983
  prepared.enums,
39090
39984
  prepared.schemas,
39091
39985
  prepared.sequences,
39986
+ prepared.roles,
39092
39987
  prepared.views,
39093
39988
  prepared.matViews,
39094
39989
  casing2,
@@ -39112,6 +40007,8 @@ var generateMigration = async (prev, cur) => {
39112
40007
  schemasResolver,
39113
40008
  enumsResolver,
39114
40009
  sequencesResolver,
40010
+ policyResolver,
40011
+ roleResolver,
39115
40012
  tablesResolver,
39116
40013
  columnsResolver,
39117
40014
  viewsResolver,
@@ -39145,6 +40042,8 @@ var pushSchema = async (imports, drizzleInstance, schemaFilters) => {
39145
40042
  schemasResolver,
39146
40043
  enumsResolver,
39147
40044
  sequencesResolver,
40045
+ policyResolver,
40046
+ roleResolver,
39148
40047
  tablesResolver,
39149
40048
  columnsResolver,
39150
40049
  viewsResolver,