drizzle-kit 0.26.2-7fcf6f9 → 0.26.2-b2b714a

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,73 @@ 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
+ /** @internal */
27500
+ __publicField(this, "_linkedTable");
27501
+ this.name = name2;
27502
+ if (config) {
27503
+ this.as = config.as;
27504
+ this.for = config.for;
27505
+ this.to = config.to;
27506
+ this.using = config.using;
27507
+ this.withCheck = config.withCheck;
27508
+ }
27509
+ }
27510
+ link(table4) {
27511
+ this._linkedTable = table4;
27512
+ return this;
27513
+ }
27514
+ };
27515
+ __publicField(PgPolicy, _a147, "PgPolicy");
27516
+ }
27517
+ });
27518
+
27519
+ // ../drizzle-orm/dist/pg-core/roles.js
27520
+ var _a148, PgRole;
27521
+ var init_roles = __esm({
27522
+ "../drizzle-orm/dist/pg-core/roles.js"() {
27523
+ "use strict";
27524
+ init_entity();
27525
+ _a148 = entityKind;
27526
+ PgRole = class {
27527
+ constructor(name2, config) {
27528
+ /** @internal */
27529
+ __publicField(this, "_existing");
27530
+ /** @internal */
27531
+ __publicField(this, "createDb");
27532
+ /** @internal */
27533
+ __publicField(this, "createRole");
27534
+ /** @internal */
27535
+ __publicField(this, "inherit");
27536
+ this.name = name2;
27537
+ if (config) {
27538
+ this.createDb = config.createDb;
27539
+ this.createRole = config.createRole;
27540
+ this.inherit = config.inherit;
27541
+ }
27542
+ }
27543
+ existing() {
27544
+ this._existing = true;
27545
+ return this;
27546
+ }
27547
+ };
27548
+ __publicField(PgRole, _a148, "PgRole");
27549
+ }
27550
+ });
27551
+
26813
27552
  // ../drizzle-orm/dist/pg-core/sequence.js
26814
27553
  function pgSequenceWithSchema(name2, options, schema4) {
26815
27554
  return new PgSequence(name2, options, schema4);
@@ -26817,12 +27556,12 @@ function pgSequenceWithSchema(name2, options, schema4) {
26817
27556
  function isPgSequence(obj) {
26818
27557
  return is(obj, PgSequence);
26819
27558
  }
26820
- var _a147, PgSequence;
27559
+ var _a149, PgSequence;
26821
27560
  var init_sequence = __esm({
26822
27561
  "../drizzle-orm/dist/pg-core/sequence.js"() {
26823
27562
  "use strict";
26824
27563
  init_entity();
26825
- _a147 = entityKind;
27564
+ _a149 = entityKind;
26826
27565
  PgSequence = class {
26827
27566
  constructor(seqName, seqOptions, schema4) {
26828
27567
  this.seqName = seqName;
@@ -26830,7 +27569,7 @@ var init_sequence = __esm({
26830
27569
  this.schema = schema4;
26831
27570
  }
26832
27571
  };
26833
- __publicField(PgSequence, _a147, "PgSequence");
27572
+ __publicField(PgSequence, _a149, "PgSequence");
26834
27573
  }
26835
27574
  });
26836
27575
 
@@ -26862,7 +27601,7 @@ function isPgView(obj) {
26862
27601
  function isPgMaterializedView(obj) {
26863
27602
  return is(obj, PgMaterializedView);
26864
27603
  }
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;
27604
+ 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
27605
  var init_view = __esm({
26867
27606
  "../drizzle-orm/dist/pg-core/view.js"() {
26868
27607
  "use strict";
@@ -26873,7 +27612,7 @@ var init_view = __esm({
26873
27612
  init_table2();
26874
27613
  init_view_base();
26875
27614
  init_view_common2();
26876
- _a148 = entityKind;
27615
+ _a150 = entityKind;
26877
27616
  DefaultViewBuilderCore = class {
26878
27617
  constructor(name2, schema4) {
26879
27618
  __publicField(this, "config", {});
@@ -26885,8 +27624,8 @@ var init_view = __esm({
26885
27624
  return this;
26886
27625
  }
26887
27626
  };
26888
- __publicField(DefaultViewBuilderCore, _a148, "PgDefaultViewBuilderCore");
26889
- ViewBuilder = class extends (_b107 = DefaultViewBuilderCore, _a149 = entityKind, _b107) {
27627
+ __publicField(DefaultViewBuilderCore, _a150, "PgDefaultViewBuilderCore");
27628
+ ViewBuilder = class extends (_b107 = DefaultViewBuilderCore, _a151 = entityKind, _b107) {
26890
27629
  as(qb) {
26891
27630
  if (typeof qb === "function") {
26892
27631
  qb = qb(new QueryBuilder());
@@ -26912,8 +27651,8 @@ var init_view = __esm({
26912
27651
  );
26913
27652
  }
26914
27653
  };
26915
- __publicField(ViewBuilder, _a149, "PgViewBuilder");
26916
- ManualViewBuilder = class extends (_b108 = DefaultViewBuilderCore, _a150 = entityKind, _b108) {
27654
+ __publicField(ViewBuilder, _a151, "PgViewBuilder");
27655
+ ManualViewBuilder = class extends (_b108 = DefaultViewBuilderCore, _a152 = entityKind, _b108) {
26917
27656
  constructor(name2, columns, schema4) {
26918
27657
  super(name2, schema4);
26919
27658
  __publicField(this, "columns");
@@ -26958,8 +27697,8 @@ var init_view = __esm({
26958
27697
  );
26959
27698
  }
26960
27699
  };
26961
- __publicField(ManualViewBuilder, _a150, "PgManualViewBuilder");
26962
- _a151 = entityKind;
27700
+ __publicField(ManualViewBuilder, _a152, "PgManualViewBuilder");
27701
+ _a153 = entityKind;
26963
27702
  MaterializedViewBuilderCore = class {
26964
27703
  constructor(name2, schema4) {
26965
27704
  __publicField(this, "config", {});
@@ -26983,8 +27722,8 @@ var init_view = __esm({
26983
27722
  return this;
26984
27723
  }
26985
27724
  };
26986
- __publicField(MaterializedViewBuilderCore, _a151, "PgMaterializedViewBuilderCore");
26987
- MaterializedViewBuilder = class extends (_b109 = MaterializedViewBuilderCore, _a152 = entityKind, _b109) {
27725
+ __publicField(MaterializedViewBuilderCore, _a153, "PgMaterializedViewBuilderCore");
27726
+ MaterializedViewBuilder = class extends (_b109 = MaterializedViewBuilderCore, _a154 = entityKind, _b109) {
26988
27727
  as(qb) {
26989
27728
  if (typeof qb === "function") {
26990
27729
  qb = qb(new QueryBuilder());
@@ -27015,8 +27754,8 @@ var init_view = __esm({
27015
27754
  );
27016
27755
  }
27017
27756
  };
27018
- __publicField(MaterializedViewBuilder, _a152, "PgMaterializedViewBuilder");
27019
- ManualMaterializedViewBuilder = class extends (_b110 = MaterializedViewBuilderCore, _a153 = entityKind, _b110) {
27757
+ __publicField(MaterializedViewBuilder, _a154, "PgMaterializedViewBuilder");
27758
+ ManualMaterializedViewBuilder = class extends (_b110 = MaterializedViewBuilderCore, _a155 = entityKind, _b110) {
27020
27759
  constructor(name2, columns, schema4) {
27021
27760
  super(name2, schema4);
27022
27761
  __publicField(this, "columns");
@@ -27071,11 +27810,11 @@ var init_view = __esm({
27071
27810
  );
27072
27811
  }
27073
27812
  };
27074
- __publicField(ManualMaterializedViewBuilder, _a153, "PgManualMaterializedViewBuilder");
27075
- PgView2 = class extends (_c4 = PgViewBase, _b111 = entityKind, _a154 = PgViewConfig, _c4) {
27813
+ __publicField(ManualMaterializedViewBuilder, _a155, "PgManualMaterializedViewBuilder");
27814
+ PgView2 = class extends (_c4 = PgViewBase, _b111 = entityKind, _a156 = PgViewConfig, _c4) {
27076
27815
  constructor({ pgConfig, config }) {
27077
27816
  super(config);
27078
- __publicField(this, _a154);
27817
+ __publicField(this, _a156);
27079
27818
  if (pgConfig) {
27080
27819
  this[PgViewConfig] = {
27081
27820
  with: pgConfig.with
@@ -27085,10 +27824,10 @@ var init_view = __esm({
27085
27824
  };
27086
27825
  __publicField(PgView2, _b111, "PgView");
27087
27826
  PgMaterializedViewConfig = Symbol.for("drizzle:PgMaterializedViewConfig");
27088
- PgMaterializedView = class extends (_c5 = PgViewBase, _b112 = entityKind, _a155 = PgMaterializedViewConfig, _c5) {
27827
+ PgMaterializedView = class extends (_c5 = PgViewBase, _b112 = entityKind, _a157 = PgMaterializedViewConfig, _c5) {
27089
27828
  constructor({ pgConfig, config }) {
27090
27829
  super(config);
27091
- __publicField(this, _a155);
27830
+ __publicField(this, _a157);
27092
27831
  this[PgMaterializedViewConfig] = {
27093
27832
  with: pgConfig?.with,
27094
27833
  using: pgConfig?.using,
@@ -27102,7 +27841,7 @@ var init_view = __esm({
27102
27841
  });
27103
27842
 
27104
27843
  // ../drizzle-orm/dist/pg-core/schema.js
27105
- var _a156, PgSchema5;
27844
+ var _a158, PgSchema5;
27106
27845
  var init_schema = __esm({
27107
27846
  "../drizzle-orm/dist/pg-core/schema.js"() {
27108
27847
  "use strict";
@@ -27112,7 +27851,7 @@ var init_schema = __esm({
27112
27851
  init_sequence();
27113
27852
  init_table2();
27114
27853
  init_view();
27115
- _a156 = entityKind;
27854
+ _a158 = entityKind;
27116
27855
  PgSchema5 = class {
27117
27856
  constructor(schemaName) {
27118
27857
  __publicField(this, "table", (name2, columns, extraConfig) => {
@@ -27139,12 +27878,12 @@ var init_schema = __esm({
27139
27878
  return true;
27140
27879
  }
27141
27880
  };
27142
- __publicField(PgSchema5, _a156, "PgSchema");
27881
+ __publicField(PgSchema5, _a158, "PgSchema");
27143
27882
  }
27144
27883
  });
27145
27884
 
27146
27885
  // ../drizzle-orm/dist/pg-core/session.js
27147
- var _a157, PgPreparedQuery, _a158, PgSession, _a159, _b113, PgTransaction;
27886
+ var _a159, PgPreparedQuery, _a160, PgSession, _a161, _b113, PgTransaction;
27148
27887
  var init_session = __esm({
27149
27888
  "../drizzle-orm/dist/pg-core/session.js"() {
27150
27889
  "use strict";
@@ -27153,7 +27892,7 @@ var init_session = __esm({
27153
27892
  init_sql2();
27154
27893
  init_tracing();
27155
27894
  init_db();
27156
- _a157 = entityKind;
27895
+ _a159 = entityKind;
27157
27896
  PgPreparedQuery = class {
27158
27897
  constructor(query) {
27159
27898
  /** @internal */
@@ -27167,8 +27906,8 @@ var init_session = __esm({
27167
27906
  return response;
27168
27907
  }
27169
27908
  };
27170
- __publicField(PgPreparedQuery, _a157, "PgPreparedQuery");
27171
- _a158 = entityKind;
27909
+ __publicField(PgPreparedQuery, _a159, "PgPreparedQuery");
27910
+ _a160 = entityKind;
27172
27911
  PgSession = class {
27173
27912
  constructor(dialect4) {
27174
27913
  this.dialect = dialect4;
@@ -27201,8 +27940,8 @@ var init_session = __esm({
27201
27940
  );
27202
27941
  }
27203
27942
  };
27204
- __publicField(PgSession, _a158, "PgSession");
27205
- PgTransaction = class extends (_b113 = PgDatabase, _a159 = entityKind, _b113) {
27943
+ __publicField(PgSession, _a160, "PgSession");
27944
+ PgTransaction = class extends (_b113 = PgDatabase, _a161 = entityKind, _b113) {
27206
27945
  constructor(dialect4, session, schema4, nestedIndex = 0) {
27207
27946
  super(dialect4, session, schema4);
27208
27947
  this.schema = schema4;
@@ -27229,7 +27968,7 @@ var init_session = __esm({
27229
27968
  return this.session.execute(sql`set transaction ${this.getTransactionConfigSQL(config)}`);
27230
27969
  }
27231
27970
  };
27232
- __publicField(PgTransaction, _a159, "PgTransaction");
27971
+ __publicField(PgTransaction, _a161, "PgTransaction");
27233
27972
  }
27234
27973
  });
27235
27974
 
@@ -27250,10 +27989,13 @@ function getTableConfig(table4) {
27250
27989
  const uniqueConstraints = [];
27251
27990
  const name2 = table4[Table.Symbol.Name];
27252
27991
  const schema4 = table4[Table.Symbol.Schema];
27992
+ const policies = [];
27993
+ const enableRLS = table4[PgTable.Symbol.EnableRLS];
27253
27994
  const extraConfigBuilder = table4[PgTable.Symbol.ExtraConfigBuilder];
27254
27995
  if (extraConfigBuilder !== void 0) {
27255
27996
  const extraConfig = extraConfigBuilder(table4[Table.Symbol.ExtraConfigColumns]);
27256
- for (const builder of Object.values(extraConfig)) {
27997
+ const extraValues = Array.isArray(extraConfig) ? extraConfig.flat(1) : Object.values(extraConfig);
27998
+ for (const builder of extraValues) {
27257
27999
  if (is(builder, IndexBuilder)) {
27258
28000
  indexes.push(builder.build(table4));
27259
28001
  } else if (is(builder, CheckBuilder)) {
@@ -27264,6 +28006,8 @@ function getTableConfig(table4) {
27264
28006
  primaryKeys.push(builder.build(table4));
27265
28007
  } else if (is(builder, ForeignKeyBuilder)) {
27266
28008
  foreignKeys.push(builder.build(table4));
28009
+ } else if (is(builder, PgPolicy)) {
28010
+ policies.push(builder);
27267
28011
  }
27268
28012
  }
27269
28013
  }
@@ -27275,7 +28019,9 @@ function getTableConfig(table4) {
27275
28019
  primaryKeys,
27276
28020
  uniqueConstraints,
27277
28021
  name: name2,
27278
- schema: schema4
28022
+ schema: schema4,
28023
+ policies,
28024
+ enableRLS
27279
28025
  };
27280
28026
  }
27281
28027
  function getViewConfig(view4) {
@@ -27300,6 +28046,7 @@ var init_utils4 = __esm({
27300
28046
  init_checks();
27301
28047
  init_foreign_keys();
27302
28048
  init_indexes();
28049
+ init_policies();
27303
28050
  init_primary_keys();
27304
28051
  init_unique_constraint();
27305
28052
  init_view_common2();
@@ -27326,8 +28073,10 @@ var init_pg_core = __esm({
27326
28073
  init_dialect();
27327
28074
  init_foreign_keys();
27328
28075
  init_indexes();
28076
+ init_policies();
27329
28077
  init_primary_keys();
27330
28078
  init_query_builders();
28079
+ init_roles();
27331
28080
  init_schema();
27332
28081
  init_sequence();
27333
28082
  init_session();
@@ -27349,14 +28098,14 @@ function maxRangeForIdentityBasedOn(columnType) {
27349
28098
  return columnType === "integer" ? "2147483647" : columnType === "bigint" ? "9223372036854775807" : "32767";
27350
28099
  }
27351
28100
  function minRangeForIdentityBasedOn(columnType) {
27352
- return columnType === "integer" ? "-2147483648" : columnType === "bitint" ? "-9223372036854775808" : "-32768";
28101
+ return columnType === "integer" ? "-2147483648" : columnType === "bigint" ? "-9223372036854775808" : "-32768";
27353
28102
  }
27354
28103
  function stringFromDatabaseIdentityProperty(field) {
27355
28104
  return typeof field === "string" ? field : typeof field === "undefined" ? void 0 : typeof field === "bigint" ? field.toString() : String(field);
27356
28105
  }
27357
- function buildArrayString(array, sqlType) {
28106
+ function buildArrayString(array2, sqlType) {
27358
28107
  sqlType = sqlType.split("[")[0];
27359
- const values = array.map((value) => {
28108
+ const values = array2.map((value) => {
27360
28109
  if (typeof value === "number" || typeof value === "bigint") {
27361
28110
  return value.toString();
27362
28111
  } else if (typeof value === "boolean") {
@@ -27378,6 +28127,40 @@ function buildArrayString(array, sqlType) {
27378
28127
  }).join(",");
27379
28128
  return `{${values}}`;
27380
28129
  }
28130
+ function prepareRoles(entities) {
28131
+ let useRoles = false;
28132
+ const includeRoles = [];
28133
+ const excludeRoles = [];
28134
+ if (entities && entities.roles) {
28135
+ if (typeof entities.roles === "object") {
28136
+ if (entities.roles.provider) {
28137
+ if (entities.roles.provider === "supabase") {
28138
+ excludeRoles.push(...[
28139
+ "anon",
28140
+ "authenticator",
28141
+ "authenticated",
28142
+ "service_role",
28143
+ "supabase_auth_admin",
28144
+ "supabase_storage_admin",
28145
+ "dashboard_user",
28146
+ "supabase_admin"
28147
+ ]);
28148
+ } else if (entities.roles.provider === "neon") {
28149
+ excludeRoles.push(...["authenticated", "anonymous"]);
28150
+ }
28151
+ }
28152
+ if (entities.roles.include) {
28153
+ includeRoles.push(...entities.roles.include);
28154
+ }
28155
+ if (entities.roles.exclude) {
28156
+ excludeRoles.push(...entities.roles.exclude);
28157
+ }
28158
+ } else {
28159
+ useRoles = entities.roles;
28160
+ }
28161
+ }
28162
+ return { useRoles, includeRoles, excludeRoles };
28163
+ }
27381
28164
  var indexName, generatePgSnapshot, trimChar, fromDatabase, defaultForColumn, getColumnsInfoQuery;
27382
28165
  var init_pgSerializer = __esm({
27383
28166
  "src/serializer/pgSerializer.ts"() {
@@ -27393,15 +28176,27 @@ var init_pgSerializer = __esm({
27393
28176
  indexName = (tableName, columns) => {
27394
28177
  return `${tableName}_${columns.join("_")}_index`;
27395
28178
  };
27396
- generatePgSnapshot = (tables, enums, schemas, sequences, views, matViews, casing2, schemaFilter) => {
28179
+ generatePgSnapshot = (tables, enums, schemas, sequences, roles, policies, views, matViews, casing2, schemaFilter) => {
27397
28180
  const dialect4 = new PgDialect({ casing: casing2 });
27398
28181
  const result = {};
27399
28182
  const resultViews = {};
27400
28183
  const sequencesToReturn = {};
28184
+ const rolesToReturn = {};
27401
28185
  const indexesInSchema = {};
27402
28186
  for (const table4 of tables) {
27403
28187
  const checksInTable = {};
27404
- const { name: tableName, columns, indexes, foreignKeys, checks, schema: schema4, primaryKeys, uniqueConstraints } = getTableConfig(table4);
28188
+ const {
28189
+ name: tableName,
28190
+ columns,
28191
+ indexes,
28192
+ foreignKeys,
28193
+ checks,
28194
+ schema: schema4,
28195
+ primaryKeys,
28196
+ uniqueConstraints,
28197
+ policies: policies2,
28198
+ enableRLS
28199
+ } = getTableConfig(table4);
27405
28200
  if (schemaFilter && !schemaFilter.includes(schema4 ?? "public")) {
27406
28201
  continue;
27407
28202
  }
@@ -27411,6 +28206,7 @@ var init_pgSerializer = __esm({
27411
28206
  const foreignKeysObject = {};
27412
28207
  const primaryKeysObject = {};
27413
28208
  const uniqueConstraintObject = {};
28209
+ const policiesObject = {};
27414
28210
  columns.forEach((column4) => {
27415
28211
  const name2 = getColumnCasing(column4, casing2);
27416
28212
  const notNull = column4.notNull;
@@ -27658,6 +28454,45 @@ ${withStyle.errorWarning(
27658
28454
  with: value.config.with ?? {}
27659
28455
  };
27660
28456
  });
28457
+ policies2.forEach((policy2) => {
28458
+ const mappedTo = [];
28459
+ if (!policy2.to) {
28460
+ mappedTo.push("public");
28461
+ } else {
28462
+ if (policy2.to && typeof policy2.to === "string") {
28463
+ mappedTo.push(policy2.to);
28464
+ } else if (policy2.to && is(policy2.to, PgRole)) {
28465
+ mappedTo.push(policy2.to.name);
28466
+ } else if (policy2.to && Array.isArray(policy2.to)) {
28467
+ policy2.to.forEach((it) => {
28468
+ if (typeof it === "string") {
28469
+ mappedTo.push(it);
28470
+ } else if (is(it, PgRole)) {
28471
+ mappedTo.push(it.name);
28472
+ }
28473
+ });
28474
+ }
28475
+ }
28476
+ if (policiesObject[policy2.name] !== void 0) {
28477
+ console.log(
28478
+ `
28479
+ ${withStyle.errorWarning(
28480
+ `We've found duplicated policy name across ${source_default.underline.blue(tableKey2)} table. Please rename one of the policies with ${source_default.underline.blue(
28481
+ policy2.name
28482
+ )} name`
28483
+ )}`
28484
+ );
28485
+ process.exit(1);
28486
+ }
28487
+ policiesObject[policy2.name] = {
28488
+ name: policy2.name,
28489
+ as: policy2.as?.toUpperCase() ?? "PERMISSIVE",
28490
+ for: policy2.for?.toUpperCase() ?? "ALL",
28491
+ to: mappedTo.sort(),
28492
+ using: is(policy2.using, SQL) ? dialect4.sqlToQuery(policy2.using).sql : void 0,
28493
+ withCheck: is(policy2.withCheck, SQL) ? dialect4.sqlToQuery(policy2.withCheck).sql : void 0
28494
+ };
28495
+ });
27661
28496
  checks.forEach((check) => {
27662
28497
  const checkName = check.name;
27663
28498
  if (typeof checksInTable[`"${schema4 ?? "public"}"."${tableName}"`] !== "undefined") {
@@ -27694,7 +28529,59 @@ ${withStyle.errorWarning(
27694
28529
  foreignKeys: foreignKeysObject,
27695
28530
  compositePrimaryKeys: primaryKeysObject,
27696
28531
  uniqueConstraints: uniqueConstraintObject,
27697
- checkConstraints: checksObject
28532
+ policies: policiesObject,
28533
+ checkConstraints: checksObject,
28534
+ isRLSEnabled: enableRLS
28535
+ };
28536
+ }
28537
+ for (const policy2 of policies) {
28538
+ if (!policy2._linkedTable) {
28539
+ console.log(
28540
+ `
28541
+ ${withStyle.errorWarning(
28542
+ `"Policy ${policy2.name} was skipped because it was not linked to any table. You should either include the policy in a table or use .link() on the policy to link it to any table you have. For more information, please check:`
28543
+ )}`
28544
+ );
28545
+ continue;
28546
+ }
28547
+ const tableConfig = getTableConfig(policy2._linkedTable);
28548
+ const tableKey2 = `${tableConfig.schema ?? "public"}.${tableConfig.name}`;
28549
+ const mappedTo = [];
28550
+ if (!policy2.to) {
28551
+ mappedTo.push("public");
28552
+ } else {
28553
+ if (policy2.to && typeof policy2.to === "string") {
28554
+ mappedTo.push(policy2.to);
28555
+ } else if (policy2.to && is(policy2.to, PgRole)) {
28556
+ mappedTo.push(policy2.to.name);
28557
+ } else if (policy2.to && Array.isArray(policy2.to)) {
28558
+ policy2.to.forEach((it) => {
28559
+ if (typeof it === "string") {
28560
+ mappedTo.push(it);
28561
+ } else if (is(it, PgRole)) {
28562
+ mappedTo.push(it.name);
28563
+ }
28564
+ });
28565
+ }
28566
+ }
28567
+ if (result[tableKey2].policies[policy2.name] !== void 0) {
28568
+ console.log(
28569
+ `
28570
+ ${withStyle.errorWarning(
28571
+ `We've found duplicated policy name across ${source_default.underline.blue(tableKey2)} table. Please rename one of the policies with ${source_default.underline.blue(
28572
+ policy2.name
28573
+ )} name`
28574
+ )}`
28575
+ );
28576
+ process.exit(1);
28577
+ }
28578
+ result[tableKey2].policies[policy2.name] = {
28579
+ name: policy2.name,
28580
+ as: policy2.as?.toUpperCase() ?? "PERMISSIVE",
28581
+ for: policy2.for?.toUpperCase() ?? "ALL",
28582
+ to: mappedTo.sort(),
28583
+ using: is(policy2.using, SQL) ? dialect4.sqlToQuery(policy2.using).sql : void 0,
28584
+ withCheck: is(policy2.withCheck, SQL) ? dialect4.sqlToQuery(policy2.withCheck).sql : void 0
27698
28585
  };
27699
28586
  }
27700
28587
  for (const sequence of sequences) {
@@ -27718,6 +28605,16 @@ ${withStyle.errorWarning(
27718
28605
  } else {
27719
28606
  }
27720
28607
  }
28608
+ for (const role of roles) {
28609
+ if (!role._existing) {
28610
+ rolesToReturn[role.name] = {
28611
+ name: role.name,
28612
+ createDb: role.createDb === void 0 ? false : role.createDb,
28613
+ createRole: role.createRole === void 0 ? false : role.createRole,
28614
+ inherit: role.inherit === void 0 ? true : role.inherit
28615
+ };
28616
+ }
28617
+ }
27721
28618
  const combinedViews = [...views, ...matViews];
27722
28619
  for (const view4 of combinedViews) {
27723
28620
  let viewName;
@@ -27874,6 +28771,7 @@ ${withStyle.errorWarning(
27874
28771
  enums: enumsToReturn,
27875
28772
  schemas: schemasObject,
27876
28773
  sequences: sequencesToReturn,
28774
+ roles: rolesToReturn,
27877
28775
  views: resultViews,
27878
28776
  _meta: {
27879
28777
  schemas: {},
@@ -27889,7 +28787,7 @@ ${withStyle.errorWarning(
27889
28787
  while (end > start && str[end - 1] === char3) --end;
27890
28788
  return start > 0 || end < str.length ? str.substring(start, end) : str.toString();
27891
28789
  };
27892
- fromDatabase = async (db, tablesFilter = () => true, schemaFilters, progressCallback) => {
28790
+ fromDatabase = async (db, tablesFilter = () => true, schemaFilters, entities, progressCallback) => {
27893
28791
  const result = {};
27894
28792
  const views = {};
27895
28793
  const internals = { tables: {} };
@@ -27902,7 +28800,8 @@ ${withStyle.errorWarning(
27902
28800
  WHEN c.relkind = 'r' THEN 'table'
27903
28801
  WHEN c.relkind = 'v' THEN 'view'
27904
28802
  WHEN c.relkind = 'm' THEN 'materialized_view'
27905
- END AS type
28803
+ END AS type,
28804
+ c.relrowsecurity AS rls_enabled
27906
28805
  FROM
27907
28806
  pg_catalog.pg_class c
27908
28807
  JOIN
@@ -27988,6 +28887,60 @@ WHERE
27988
28887
  if (progressCallback) {
27989
28888
  progressCallback("enums", Object.keys(enumsToReturn).length, "done");
27990
28889
  }
28890
+ const allRoles = await db.query(
28891
+ `SELECT rolname, rolinherit, rolcreatedb, rolcreaterole FROM pg_roles;`
28892
+ );
28893
+ const rolesToReturn = {};
28894
+ const preparedRoles = prepareRoles(entities);
28895
+ if (preparedRoles.useRoles || !(preparedRoles.includeRoles.length === 0 && preparedRoles.excludeRoles.length === 0)) {
28896
+ for (const dbRole of allRoles) {
28897
+ if (preparedRoles.useRoles) {
28898
+ rolesToReturn[dbRole.rolname] = {
28899
+ createDb: dbRole.rolcreatedb,
28900
+ createRole: dbRole.rolcreatedb,
28901
+ inherit: dbRole.rolinherit,
28902
+ name: dbRole.rolname
28903
+ };
28904
+ } else {
28905
+ if (preparedRoles.includeRoles.length === 0 && preparedRoles.excludeRoles.length === 0) continue;
28906
+ if (preparedRoles.includeRoles.includes(dbRole.rolname) && preparedRoles.excludeRoles.includes(dbRole.rolname)) continue;
28907
+ if (preparedRoles.excludeRoles.includes(dbRole.rolname)) continue;
28908
+ if (!preparedRoles.includeRoles.includes(dbRole.rolname)) continue;
28909
+ rolesToReturn[dbRole.rolname] = {
28910
+ createDb: dbRole.rolcreatedb,
28911
+ createRole: dbRole.rolcreaterole,
28912
+ inherit: dbRole.rolinherit,
28913
+ name: dbRole.rolname
28914
+ };
28915
+ }
28916
+ }
28917
+ }
28918
+ const wherePolicies = schemaFilters.map((t) => `schemaname = '${t}'`).join(" or ");
28919
+ const policiesByTable = {};
28920
+ 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}`};`);
28921
+ for (const dbPolicy of allPolicies) {
28922
+ const { tablename, schemaname, to, withCheck, using, ...rest } = dbPolicy;
28923
+ const tableForPolicy = policiesByTable[`${schemaname}.${tablename}`];
28924
+ const parsedTo = to;
28925
+ const parsedWithCheck = withCheck === null ? void 0 : withCheck;
28926
+ const parsedUsing = using === null ? void 0 : using;
28927
+ if (tableForPolicy) {
28928
+ tableForPolicy[dbPolicy.name] = { ...rest, to: parsedTo };
28929
+ } else {
28930
+ policiesByTable[`${schemaname}.${tablename}`] = {
28931
+ [dbPolicy.name]: { ...rest, to: parsedTo, withCheck: parsedWithCheck, using: parsedUsing }
28932
+ };
28933
+ }
28934
+ }
28935
+ if (progressCallback) {
28936
+ progressCallback(
28937
+ "policies",
28938
+ Object.values(policiesByTable).reduce((total, innerRecord) => {
28939
+ return total + Object.keys(innerRecord).length;
28940
+ }, 0),
28941
+ "done"
28942
+ );
28943
+ }
27991
28944
  const sequencesInColumns = [];
27992
28945
  const all = allTables.filter((it) => it.type === "table").map((row) => {
27993
28946
  return new Promise(async (res, rej) => {
@@ -28349,7 +29302,7 @@ WHERE
28349
29302
  }
28350
29303
  ],
28351
29304
  isUnique: indexIsUnique,
28352
- // should not be a part of diff detecs
29305
+ // should not be a part of diff detects
28353
29306
  concurrently: false,
28354
29307
  method: indexMethod,
28355
29308
  where: indexWhere === null ? void 0 : indexWhere,
@@ -28369,7 +29322,9 @@ WHERE
28369
29322
  foreignKeys: foreignKeysToReturn,
28370
29323
  compositePrimaryKeys: primaryKeys,
28371
29324
  uniqueConstraints: uniqueConstrains,
28372
- checkConstraints
29325
+ checkConstraints,
29326
+ policies: policiesByTable[`${tableSchema}.${tableName}`] ?? {},
29327
+ isRLSEnabled: row.rls_enabled
28373
29328
  };
28374
29329
  } catch (e) {
28375
29330
  rej(e);
@@ -28567,6 +29522,7 @@ WHERE
28567
29522
  enums: enumsToReturn,
28568
29523
  schemas: schemasObject,
28569
29524
  sequences: sequencesToReturn,
29525
+ roles: rolesToReturn,
28570
29526
  views,
28571
29527
  _meta: {
28572
29528
  schemas: {},
@@ -28761,12 +29717,12 @@ var init_alias3 = __esm({
28761
29717
  });
28762
29718
 
28763
29719
  // ../drizzle-orm/dist/sqlite-core/checks.js
28764
- var _a160, CheckBuilder2, _a161, Check2;
29720
+ var _a162, CheckBuilder2, _a163, Check2;
28765
29721
  var init_checks2 = __esm({
28766
29722
  "../drizzle-orm/dist/sqlite-core/checks.js"() {
28767
29723
  "use strict";
28768
29724
  init_entity();
28769
- _a160 = entityKind;
29725
+ _a162 = entityKind;
28770
29726
  CheckBuilder2 = class {
28771
29727
  constructor(name2, value) {
28772
29728
  __publicField(this, "brand");
@@ -28777,8 +29733,8 @@ var init_checks2 = __esm({
28777
29733
  return new Check2(table4, this);
28778
29734
  }
28779
29735
  };
28780
- __publicField(CheckBuilder2, _a160, "SQLiteCheckBuilder");
28781
- _a161 = entityKind;
29736
+ __publicField(CheckBuilder2, _a162, "SQLiteCheckBuilder");
29737
+ _a163 = entityKind;
28782
29738
  Check2 = class {
28783
29739
  constructor(table4, builder) {
28784
29740
  __publicField(this, "name");
@@ -28788,18 +29744,18 @@ var init_checks2 = __esm({
28788
29744
  this.value = builder.value;
28789
29745
  }
28790
29746
  };
28791
- __publicField(Check2, _a161, "SQLiteCheck");
29747
+ __publicField(Check2, _a163, "SQLiteCheck");
28792
29748
  }
28793
29749
  });
28794
29750
 
28795
29751
  // ../drizzle-orm/dist/sqlite-core/foreign-keys.js
28796
- var _a162, ForeignKeyBuilder2, _a163, ForeignKey2;
29752
+ var _a164, ForeignKeyBuilder2, _a165, ForeignKey2;
28797
29753
  var init_foreign_keys2 = __esm({
28798
29754
  "../drizzle-orm/dist/sqlite-core/foreign-keys.js"() {
28799
29755
  "use strict";
28800
29756
  init_entity();
28801
29757
  init_table_utils();
28802
- _a162 = entityKind;
29758
+ _a164 = entityKind;
28803
29759
  ForeignKeyBuilder2 = class {
28804
29760
  constructor(config, actions) {
28805
29761
  /** @internal */
@@ -28830,8 +29786,8 @@ var init_foreign_keys2 = __esm({
28830
29786
  return new ForeignKey2(table4, this);
28831
29787
  }
28832
29788
  };
28833
- __publicField(ForeignKeyBuilder2, _a162, "SQLiteForeignKeyBuilder");
28834
- _a163 = entityKind;
29789
+ __publicField(ForeignKeyBuilder2, _a164, "SQLiteForeignKeyBuilder");
29790
+ _a165 = entityKind;
28835
29791
  ForeignKey2 = class {
28836
29792
  constructor(table4, builder) {
28837
29793
  __publicField(this, "reference");
@@ -28855,7 +29811,7 @@ var init_foreign_keys2 = __esm({
28855
29811
  return name2 ?? `${chunks.join("_")}_fk`;
28856
29812
  }
28857
29813
  };
28858
- __publicField(ForeignKey2, _a163, "SQLiteForeignKey");
29814
+ __publicField(ForeignKey2, _a165, "SQLiteForeignKey");
28859
29815
  }
28860
29816
  });
28861
29817
 
@@ -28863,13 +29819,13 @@ var init_foreign_keys2 = __esm({
28863
29819
  function uniqueKeyName2(table4, columns) {
28864
29820
  return `${table4[TableName]}_${columns.join("_")}_unique`;
28865
29821
  }
28866
- var _a164, UniqueConstraintBuilder2, _a165, UniqueOnConstraintBuilder2, _a166, UniqueConstraint2;
29822
+ var _a166, UniqueConstraintBuilder2, _a167, UniqueOnConstraintBuilder2, _a168, UniqueConstraint2;
28867
29823
  var init_unique_constraint2 = __esm({
28868
29824
  "../drizzle-orm/dist/sqlite-core/unique-constraint.js"() {
28869
29825
  "use strict";
28870
29826
  init_entity();
28871
29827
  init_table_utils();
28872
- _a164 = entityKind;
29828
+ _a166 = entityKind;
28873
29829
  UniqueConstraintBuilder2 = class {
28874
29830
  constructor(columns, name2) {
28875
29831
  /** @internal */
@@ -28882,8 +29838,8 @@ var init_unique_constraint2 = __esm({
28882
29838
  return new UniqueConstraint2(table4, this.columns, this.name);
28883
29839
  }
28884
29840
  };
28885
- __publicField(UniqueConstraintBuilder2, _a164, "SQLiteUniqueConstraintBuilder");
28886
- _a165 = entityKind;
29841
+ __publicField(UniqueConstraintBuilder2, _a166, "SQLiteUniqueConstraintBuilder");
29842
+ _a167 = entityKind;
28887
29843
  UniqueOnConstraintBuilder2 = class {
28888
29844
  constructor(name2) {
28889
29845
  /** @internal */
@@ -28894,8 +29850,8 @@ var init_unique_constraint2 = __esm({
28894
29850
  return new UniqueConstraintBuilder2(columns, this.name);
28895
29851
  }
28896
29852
  };
28897
- __publicField(UniqueOnConstraintBuilder2, _a165, "SQLiteUniqueOnConstraintBuilder");
28898
- _a166 = entityKind;
29853
+ __publicField(UniqueOnConstraintBuilder2, _a167, "SQLiteUniqueOnConstraintBuilder");
29854
+ _a168 = entityKind;
28899
29855
  UniqueConstraint2 = class {
28900
29856
  constructor(table4, columns, name2) {
28901
29857
  __publicField(this, "columns");
@@ -28908,12 +29864,12 @@ var init_unique_constraint2 = __esm({
28908
29864
  return this.name;
28909
29865
  }
28910
29866
  };
28911
- __publicField(UniqueConstraint2, _a166, "SQLiteUniqueConstraint");
29867
+ __publicField(UniqueConstraint2, _a168, "SQLiteUniqueConstraint");
28912
29868
  }
28913
29869
  });
28914
29870
 
28915
29871
  // ../drizzle-orm/dist/sqlite-core/columns/common.js
28916
- var _a167, _b114, SQLiteColumnBuilder, _a168, _b115, SQLiteColumn;
29872
+ var _a169, _b114, SQLiteColumnBuilder, _a170, _b115, SQLiteColumn;
28917
29873
  var init_common3 = __esm({
28918
29874
  "../drizzle-orm/dist/sqlite-core/columns/common.js"() {
28919
29875
  "use strict";
@@ -28922,7 +29878,7 @@ var init_common3 = __esm({
28922
29878
  init_entity();
28923
29879
  init_foreign_keys2();
28924
29880
  init_unique_constraint2();
28925
- SQLiteColumnBuilder = class extends (_b114 = ColumnBuilder, _a167 = entityKind, _b114) {
29881
+ SQLiteColumnBuilder = class extends (_b114 = ColumnBuilder, _a169 = entityKind, _b114) {
28926
29882
  constructor() {
28927
29883
  super(...arguments);
28928
29884
  __publicField(this, "foreignKeyConfigs", []);
@@ -28963,8 +29919,8 @@ var init_common3 = __esm({
28963
29919
  });
28964
29920
  }
28965
29921
  };
28966
- __publicField(SQLiteColumnBuilder, _a167, "SQLiteColumnBuilder");
28967
- SQLiteColumn = class extends (_b115 = Column2, _a168 = entityKind, _b115) {
29922
+ __publicField(SQLiteColumnBuilder, _a169, "SQLiteColumnBuilder");
29923
+ SQLiteColumn = class extends (_b115 = Column2, _a170 = entityKind, _b115) {
28968
29924
  constructor(table4, config) {
28969
29925
  if (!config.uniqueName) {
28970
29926
  config.uniqueName = uniqueKeyName2(table4, [config.name]);
@@ -28973,7 +29929,7 @@ var init_common3 = __esm({
28973
29929
  this.table = table4;
28974
29930
  }
28975
29931
  };
28976
- __publicField(SQLiteColumn, _a168, "SQLiteColumn");
29932
+ __publicField(SQLiteColumn, _a170, "SQLiteColumn");
28977
29933
  }
28978
29934
  });
28979
29935
 
@@ -28988,14 +29944,14 @@ function blob(a, b) {
28988
29944
  }
28989
29945
  return new SQLiteBlobBufferBuilder(name2);
28990
29946
  }
28991
- var _a169, _b116, SQLiteBigIntBuilder, _a170, _b117, SQLiteBigInt, _a171, _b118, SQLiteBlobJsonBuilder, _a172, _b119, SQLiteBlobJson, _a173, _b120, SQLiteBlobBufferBuilder, _a174, _b121, SQLiteBlobBuffer;
29947
+ var _a171, _b116, SQLiteBigIntBuilder, _a172, _b117, SQLiteBigInt, _a173, _b118, SQLiteBlobJsonBuilder, _a174, _b119, SQLiteBlobJson, _a175, _b120, SQLiteBlobBufferBuilder, _a176, _b121, SQLiteBlobBuffer;
28992
29948
  var init_blob = __esm({
28993
29949
  "../drizzle-orm/dist/sqlite-core/columns/blob.js"() {
28994
29950
  "use strict";
28995
29951
  init_entity();
28996
29952
  init_utils2();
28997
29953
  init_common3();
28998
- SQLiteBigIntBuilder = class extends (_b116 = SQLiteColumnBuilder, _a169 = entityKind, _b116) {
29954
+ SQLiteBigIntBuilder = class extends (_b116 = SQLiteColumnBuilder, _a171 = entityKind, _b116) {
28999
29955
  constructor(name2) {
29000
29956
  super(name2, "bigint", "SQLiteBigInt");
29001
29957
  }
@@ -29004,8 +29960,8 @@ var init_blob = __esm({
29004
29960
  return new SQLiteBigInt(table4, this.config);
29005
29961
  }
29006
29962
  };
29007
- __publicField(SQLiteBigIntBuilder, _a169, "SQLiteBigIntBuilder");
29008
- SQLiteBigInt = class extends (_b117 = SQLiteColumn, _a170 = entityKind, _b117) {
29963
+ __publicField(SQLiteBigIntBuilder, _a171, "SQLiteBigIntBuilder");
29964
+ SQLiteBigInt = class extends (_b117 = SQLiteColumn, _a172 = entityKind, _b117) {
29009
29965
  getSQLType() {
29010
29966
  return "blob";
29011
29967
  }
@@ -29016,8 +29972,8 @@ var init_blob = __esm({
29016
29972
  return Buffer.from(value.toString());
29017
29973
  }
29018
29974
  };
29019
- __publicField(SQLiteBigInt, _a170, "SQLiteBigInt");
29020
- SQLiteBlobJsonBuilder = class extends (_b118 = SQLiteColumnBuilder, _a171 = entityKind, _b118) {
29975
+ __publicField(SQLiteBigInt, _a172, "SQLiteBigInt");
29976
+ SQLiteBlobJsonBuilder = class extends (_b118 = SQLiteColumnBuilder, _a173 = entityKind, _b118) {
29021
29977
  constructor(name2) {
29022
29978
  super(name2, "json", "SQLiteBlobJson");
29023
29979
  }
@@ -29029,8 +29985,8 @@ var init_blob = __esm({
29029
29985
  );
29030
29986
  }
29031
29987
  };
29032
- __publicField(SQLiteBlobJsonBuilder, _a171, "SQLiteBlobJsonBuilder");
29033
- SQLiteBlobJson = class extends (_b119 = SQLiteColumn, _a172 = entityKind, _b119) {
29988
+ __publicField(SQLiteBlobJsonBuilder, _a173, "SQLiteBlobJsonBuilder");
29989
+ SQLiteBlobJson = class extends (_b119 = SQLiteColumn, _a174 = entityKind, _b119) {
29034
29990
  getSQLType() {
29035
29991
  return "blob";
29036
29992
  }
@@ -29041,8 +29997,8 @@ var init_blob = __esm({
29041
29997
  return Buffer.from(JSON.stringify(value));
29042
29998
  }
29043
29999
  };
29044
- __publicField(SQLiteBlobJson, _a172, "SQLiteBlobJson");
29045
- SQLiteBlobBufferBuilder = class extends (_b120 = SQLiteColumnBuilder, _a173 = entityKind, _b120) {
30000
+ __publicField(SQLiteBlobJson, _a174, "SQLiteBlobJson");
30001
+ SQLiteBlobBufferBuilder = class extends (_b120 = SQLiteColumnBuilder, _a175 = entityKind, _b120) {
29046
30002
  constructor(name2) {
29047
30003
  super(name2, "buffer", "SQLiteBlobBuffer");
29048
30004
  }
@@ -29051,13 +30007,13 @@ var init_blob = __esm({
29051
30007
  return new SQLiteBlobBuffer(table4, this.config);
29052
30008
  }
29053
30009
  };
29054
- __publicField(SQLiteBlobBufferBuilder, _a173, "SQLiteBlobBufferBuilder");
29055
- SQLiteBlobBuffer = class extends (_b121 = SQLiteColumn, _a174 = entityKind, _b121) {
30010
+ __publicField(SQLiteBlobBufferBuilder, _a175, "SQLiteBlobBufferBuilder");
30011
+ SQLiteBlobBuffer = class extends (_b121 = SQLiteColumn, _a176 = entityKind, _b121) {
29056
30012
  getSQLType() {
29057
30013
  return "blob";
29058
30014
  }
29059
30015
  };
29060
- __publicField(SQLiteBlobBuffer, _a174, "SQLiteBlobBuffer");
30016
+ __publicField(SQLiteBlobBuffer, _a176, "SQLiteBlobBuffer");
29061
30017
  }
29062
30018
  });
29063
30019
 
@@ -29072,14 +30028,14 @@ function customType2(customTypeParams) {
29072
30028
  );
29073
30029
  };
29074
30030
  }
29075
- var _a175, _b122, SQLiteCustomColumnBuilder, _a176, _b123, SQLiteCustomColumn;
30031
+ var _a177, _b122, SQLiteCustomColumnBuilder, _a178, _b123, SQLiteCustomColumn;
29076
30032
  var init_custom2 = __esm({
29077
30033
  "../drizzle-orm/dist/sqlite-core/columns/custom.js"() {
29078
30034
  "use strict";
29079
30035
  init_entity();
29080
30036
  init_utils2();
29081
30037
  init_common3();
29082
- SQLiteCustomColumnBuilder = class extends (_b122 = SQLiteColumnBuilder, _a175 = entityKind, _b122) {
30038
+ SQLiteCustomColumnBuilder = class extends (_b122 = SQLiteColumnBuilder, _a177 = entityKind, _b122) {
29083
30039
  constructor(name2, fieldConfig, customTypeParams) {
29084
30040
  super(name2, "custom", "SQLiteCustomColumn");
29085
30041
  this.config.fieldConfig = fieldConfig;
@@ -29093,8 +30049,8 @@ var init_custom2 = __esm({
29093
30049
  );
29094
30050
  }
29095
30051
  };
29096
- __publicField(SQLiteCustomColumnBuilder, _a175, "SQLiteCustomColumnBuilder");
29097
- SQLiteCustomColumn = class extends (_b123 = SQLiteColumn, _a176 = entityKind, _b123) {
30052
+ __publicField(SQLiteCustomColumnBuilder, _a177, "SQLiteCustomColumnBuilder");
30053
+ SQLiteCustomColumn = class extends (_b123 = SQLiteColumn, _a178 = entityKind, _b123) {
29098
30054
  constructor(table4, config) {
29099
30055
  super(table4, config);
29100
30056
  __publicField(this, "sqlName");
@@ -29114,7 +30070,7 @@ var init_custom2 = __esm({
29114
30070
  return typeof this.mapTo === "function" ? this.mapTo(value) : value;
29115
30071
  }
29116
30072
  };
29117
- __publicField(SQLiteCustomColumn, _a176, "SQLiteCustomColumn");
30073
+ __publicField(SQLiteCustomColumn, _a178, "SQLiteCustomColumn");
29118
30074
  }
29119
30075
  });
29120
30076
 
@@ -29129,7 +30085,7 @@ function integer2(a, b) {
29129
30085
  }
29130
30086
  return new SQLiteIntegerBuilder(name2);
29131
30087
  }
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;
30088
+ 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
30089
  var init_integer2 = __esm({
29134
30090
  "../drizzle-orm/dist/sqlite-core/columns/integer.js"() {
29135
30091
  "use strict";
@@ -29137,7 +30093,7 @@ var init_integer2 = __esm({
29137
30093
  init_sql();
29138
30094
  init_utils2();
29139
30095
  init_common3();
29140
- SQLiteBaseIntegerBuilder = class extends (_b124 = SQLiteColumnBuilder, _a177 = entityKind, _b124) {
30096
+ SQLiteBaseIntegerBuilder = class extends (_b124 = SQLiteColumnBuilder, _a179 = entityKind, _b124) {
29141
30097
  constructor(name2, dataType, columnType) {
29142
30098
  super(name2, dataType, columnType);
29143
30099
  this.config.autoIncrement = false;
@@ -29150,8 +30106,8 @@ var init_integer2 = __esm({
29150
30106
  return super.primaryKey();
29151
30107
  }
29152
30108
  };
29153
- __publicField(SQLiteBaseIntegerBuilder, _a177, "SQLiteBaseIntegerBuilder");
29154
- SQLiteBaseInteger = class extends (_b125 = SQLiteColumn, _a178 = entityKind, _b125) {
30109
+ __publicField(SQLiteBaseIntegerBuilder, _a179, "SQLiteBaseIntegerBuilder");
30110
+ SQLiteBaseInteger = class extends (_b125 = SQLiteColumn, _a180 = entityKind, _b125) {
29155
30111
  constructor() {
29156
30112
  super(...arguments);
29157
30113
  __publicField(this, "autoIncrement", this.config.autoIncrement);
@@ -29160,8 +30116,8 @@ var init_integer2 = __esm({
29160
30116
  return "integer";
29161
30117
  }
29162
30118
  };
29163
- __publicField(SQLiteBaseInteger, _a178, "SQLiteBaseInteger");
29164
- SQLiteIntegerBuilder = class extends (_b126 = SQLiteBaseIntegerBuilder, _a179 = entityKind, _b126) {
30119
+ __publicField(SQLiteBaseInteger, _a180, "SQLiteBaseInteger");
30120
+ SQLiteIntegerBuilder = class extends (_b126 = SQLiteBaseIntegerBuilder, _a181 = entityKind, _b126) {
29165
30121
  constructor(name2) {
29166
30122
  super(name2, "number", "SQLiteInteger");
29167
30123
  }
@@ -29172,11 +30128,11 @@ var init_integer2 = __esm({
29172
30128
  );
29173
30129
  }
29174
30130
  };
29175
- __publicField(SQLiteIntegerBuilder, _a179, "SQLiteIntegerBuilder");
29176
- SQLiteInteger = class extends (_b127 = SQLiteBaseInteger, _a180 = entityKind, _b127) {
30131
+ __publicField(SQLiteIntegerBuilder, _a181, "SQLiteIntegerBuilder");
30132
+ SQLiteInteger = class extends (_b127 = SQLiteBaseInteger, _a182 = entityKind, _b127) {
29177
30133
  };
29178
- __publicField(SQLiteInteger, _a180, "SQLiteInteger");
29179
- SQLiteTimestampBuilder = class extends (_b128 = SQLiteBaseIntegerBuilder, _a181 = entityKind, _b128) {
30134
+ __publicField(SQLiteInteger, _a182, "SQLiteInteger");
30135
+ SQLiteTimestampBuilder = class extends (_b128 = SQLiteBaseIntegerBuilder, _a183 = entityKind, _b128) {
29180
30136
  constructor(name2, mode) {
29181
30137
  super(name2, "date", "SQLiteTimestamp");
29182
30138
  this.config.mode = mode;
@@ -29196,8 +30152,8 @@ var init_integer2 = __esm({
29196
30152
  );
29197
30153
  }
29198
30154
  };
29199
- __publicField(SQLiteTimestampBuilder, _a181, "SQLiteTimestampBuilder");
29200
- SQLiteTimestamp = class extends (_b129 = SQLiteBaseInteger, _a182 = entityKind, _b129) {
30155
+ __publicField(SQLiteTimestampBuilder, _a183, "SQLiteTimestampBuilder");
30156
+ SQLiteTimestamp = class extends (_b129 = SQLiteBaseInteger, _a184 = entityKind, _b129) {
29201
30157
  constructor() {
29202
30158
  super(...arguments);
29203
30159
  __publicField(this, "mode", this.config.mode);
@@ -29216,8 +30172,8 @@ var init_integer2 = __esm({
29216
30172
  return unix;
29217
30173
  }
29218
30174
  };
29219
- __publicField(SQLiteTimestamp, _a182, "SQLiteTimestamp");
29220
- SQLiteBooleanBuilder = class extends (_b130 = SQLiteBaseIntegerBuilder, _a183 = entityKind, _b130) {
30175
+ __publicField(SQLiteTimestamp, _a184, "SQLiteTimestamp");
30176
+ SQLiteBooleanBuilder = class extends (_b130 = SQLiteBaseIntegerBuilder, _a185 = entityKind, _b130) {
29221
30177
  constructor(name2, mode) {
29222
30178
  super(name2, "boolean", "SQLiteBoolean");
29223
30179
  this.config.mode = mode;
@@ -29229,8 +30185,8 @@ var init_integer2 = __esm({
29229
30185
  );
29230
30186
  }
29231
30187
  };
29232
- __publicField(SQLiteBooleanBuilder, _a183, "SQLiteBooleanBuilder");
29233
- SQLiteBoolean = class extends (_b131 = SQLiteBaseInteger, _a184 = entityKind, _b131) {
30188
+ __publicField(SQLiteBooleanBuilder, _a185, "SQLiteBooleanBuilder");
30189
+ SQLiteBoolean = class extends (_b131 = SQLiteBaseInteger, _a186 = entityKind, _b131) {
29234
30190
  constructor() {
29235
30191
  super(...arguments);
29236
30192
  __publicField(this, "mode", this.config.mode);
@@ -29242,7 +30198,7 @@ var init_integer2 = __esm({
29242
30198
  return value ? 1 : 0;
29243
30199
  }
29244
30200
  };
29245
- __publicField(SQLiteBoolean, _a184, "SQLiteBoolean");
30201
+ __publicField(SQLiteBoolean, _a186, "SQLiteBoolean");
29246
30202
  }
29247
30203
  });
29248
30204
 
@@ -29250,13 +30206,13 @@ var init_integer2 = __esm({
29250
30206
  function numeric2(name2) {
29251
30207
  return new SQLiteNumericBuilder(name2 ?? "");
29252
30208
  }
29253
- var _a185, _b132, SQLiteNumericBuilder, _a186, _b133, SQLiteNumeric;
30209
+ var _a187, _b132, SQLiteNumericBuilder, _a188, _b133, SQLiteNumeric;
29254
30210
  var init_numeric2 = __esm({
29255
30211
  "../drizzle-orm/dist/sqlite-core/columns/numeric.js"() {
29256
30212
  "use strict";
29257
30213
  init_entity();
29258
30214
  init_common3();
29259
- SQLiteNumericBuilder = class extends (_b132 = SQLiteColumnBuilder, _a185 = entityKind, _b132) {
30215
+ SQLiteNumericBuilder = class extends (_b132 = SQLiteColumnBuilder, _a187 = entityKind, _b132) {
29260
30216
  constructor(name2) {
29261
30217
  super(name2, "string", "SQLiteNumeric");
29262
30218
  }
@@ -29268,13 +30224,13 @@ var init_numeric2 = __esm({
29268
30224
  );
29269
30225
  }
29270
30226
  };
29271
- __publicField(SQLiteNumericBuilder, _a185, "SQLiteNumericBuilder");
29272
- SQLiteNumeric = class extends (_b133 = SQLiteColumn, _a186 = entityKind, _b133) {
30227
+ __publicField(SQLiteNumericBuilder, _a187, "SQLiteNumericBuilder");
30228
+ SQLiteNumeric = class extends (_b133 = SQLiteColumn, _a188 = entityKind, _b133) {
29273
30229
  getSQLType() {
29274
30230
  return "numeric";
29275
30231
  }
29276
30232
  };
29277
- __publicField(SQLiteNumeric, _a186, "SQLiteNumeric");
30233
+ __publicField(SQLiteNumeric, _a188, "SQLiteNumeric");
29278
30234
  }
29279
30235
  });
29280
30236
 
@@ -29282,13 +30238,13 @@ var init_numeric2 = __esm({
29282
30238
  function real2(name2) {
29283
30239
  return new SQLiteRealBuilder(name2 ?? "");
29284
30240
  }
29285
- var _a187, _b134, SQLiteRealBuilder, _a188, _b135, SQLiteReal;
30241
+ var _a189, _b134, SQLiteRealBuilder, _a190, _b135, SQLiteReal;
29286
30242
  var init_real2 = __esm({
29287
30243
  "../drizzle-orm/dist/sqlite-core/columns/real.js"() {
29288
30244
  "use strict";
29289
30245
  init_entity();
29290
30246
  init_common3();
29291
- SQLiteRealBuilder = class extends (_b134 = SQLiteColumnBuilder, _a187 = entityKind, _b134) {
30247
+ SQLiteRealBuilder = class extends (_b134 = SQLiteColumnBuilder, _a189 = entityKind, _b134) {
29292
30248
  constructor(name2) {
29293
30249
  super(name2, "number", "SQLiteReal");
29294
30250
  }
@@ -29297,13 +30253,13 @@ var init_real2 = __esm({
29297
30253
  return new SQLiteReal(table4, this.config);
29298
30254
  }
29299
30255
  };
29300
- __publicField(SQLiteRealBuilder, _a187, "SQLiteRealBuilder");
29301
- SQLiteReal = class extends (_b135 = SQLiteColumn, _a188 = entityKind, _b135) {
30256
+ __publicField(SQLiteRealBuilder, _a189, "SQLiteRealBuilder");
30257
+ SQLiteReal = class extends (_b135 = SQLiteColumn, _a190 = entityKind, _b135) {
29302
30258
  getSQLType() {
29303
30259
  return "real";
29304
30260
  }
29305
30261
  };
29306
- __publicField(SQLiteReal, _a188, "SQLiteReal");
30262
+ __publicField(SQLiteReal, _a190, "SQLiteReal");
29307
30263
  }
29308
30264
  });
29309
30265
 
@@ -29315,14 +30271,14 @@ function text2(a, b = {}) {
29315
30271
  }
29316
30272
  return new SQLiteTextBuilder(name2, config);
29317
30273
  }
29318
- var _a189, _b136, SQLiteTextBuilder, _a190, _b137, SQLiteText, _a191, _b138, SQLiteTextJsonBuilder, _a192, _b139, SQLiteTextJson;
30274
+ var _a191, _b136, SQLiteTextBuilder, _a192, _b137, SQLiteText, _a193, _b138, SQLiteTextJsonBuilder, _a194, _b139, SQLiteTextJson;
29319
30275
  var init_text2 = __esm({
29320
30276
  "../drizzle-orm/dist/sqlite-core/columns/text.js"() {
29321
30277
  "use strict";
29322
30278
  init_entity();
29323
30279
  init_utils2();
29324
30280
  init_common3();
29325
- SQLiteTextBuilder = class extends (_b136 = SQLiteColumnBuilder, _a189 = entityKind, _b136) {
30281
+ SQLiteTextBuilder = class extends (_b136 = SQLiteColumnBuilder, _a191 = entityKind, _b136) {
29326
30282
  constructor(name2, config) {
29327
30283
  super(name2, "string", "SQLiteText");
29328
30284
  this.config.enumValues = config.enum;
@@ -29333,8 +30289,8 @@ var init_text2 = __esm({
29333
30289
  return new SQLiteText(table4, this.config);
29334
30290
  }
29335
30291
  };
29336
- __publicField(SQLiteTextBuilder, _a189, "SQLiteTextBuilder");
29337
- SQLiteText = class extends (_b137 = SQLiteColumn, _a190 = entityKind, _b137) {
30292
+ __publicField(SQLiteTextBuilder, _a191, "SQLiteTextBuilder");
30293
+ SQLiteText = class extends (_b137 = SQLiteColumn, _a192 = entityKind, _b137) {
29338
30294
  constructor(table4, config) {
29339
30295
  super(table4, config);
29340
30296
  __publicField(this, "enumValues", this.config.enumValues);
@@ -29344,8 +30300,8 @@ var init_text2 = __esm({
29344
30300
  return `text${this.config.length ? `(${this.config.length})` : ""}`;
29345
30301
  }
29346
30302
  };
29347
- __publicField(SQLiteText, _a190, "SQLiteText");
29348
- SQLiteTextJsonBuilder = class extends (_b138 = SQLiteColumnBuilder, _a191 = entityKind, _b138) {
30303
+ __publicField(SQLiteText, _a192, "SQLiteText");
30304
+ SQLiteTextJsonBuilder = class extends (_b138 = SQLiteColumnBuilder, _a193 = entityKind, _b138) {
29349
30305
  constructor(name2) {
29350
30306
  super(name2, "json", "SQLiteTextJson");
29351
30307
  }
@@ -29357,8 +30313,8 @@ var init_text2 = __esm({
29357
30313
  );
29358
30314
  }
29359
30315
  };
29360
- __publicField(SQLiteTextJsonBuilder, _a191, "SQLiteTextJsonBuilder");
29361
- SQLiteTextJson = class extends (_b139 = SQLiteColumn, _a192 = entityKind, _b139) {
30316
+ __publicField(SQLiteTextJsonBuilder, _a193, "SQLiteTextJsonBuilder");
30317
+ SQLiteTextJson = class extends (_b139 = SQLiteColumn, _a194 = entityKind, _b139) {
29362
30318
  getSQLType() {
29363
30319
  return "text";
29364
30320
  }
@@ -29369,7 +30325,7 @@ var init_text2 = __esm({
29369
30325
  return JSON.stringify(value);
29370
30326
  }
29371
30327
  };
29372
- __publicField(SQLiteTextJson, _a192, "SQLiteTextJson");
30328
+ __publicField(SQLiteTextJson, _a194, "SQLiteTextJson");
29373
30329
  }
29374
30330
  });
29375
30331
 
@@ -29431,7 +30387,7 @@ function sqliteTableBase(name2, columns, extraConfig, schema4, baseName = name2)
29431
30387
  }
29432
30388
  return table4;
29433
30389
  }
29434
- var InlineForeignKeys2, _a193, _b140, _c6, _d3, _e2, SQLiteTable, sqliteTable;
30390
+ var InlineForeignKeys2, _a195, _b140, _c6, _d3, _e3, SQLiteTable, sqliteTable;
29435
30391
  var init_table3 = __esm({
29436
30392
  "../drizzle-orm/dist/sqlite-core/table.js"() {
29437
30393
  "use strict";
@@ -29439,7 +30395,7 @@ var init_table3 = __esm({
29439
30395
  init_table();
29440
30396
  init_all2();
29441
30397
  InlineForeignKeys2 = Symbol.for("drizzle:SQLiteInlineForeignKeys");
29442
- SQLiteTable = class extends (_e2 = Table, _d3 = entityKind, _c6 = Table.Symbol.Columns, _b140 = InlineForeignKeys2, _a193 = Table.Symbol.ExtraConfigBuilder, _e2) {
30398
+ SQLiteTable = class extends (_e3 = Table, _d3 = entityKind, _c6 = Table.Symbol.Columns, _b140 = InlineForeignKeys2, _a195 = Table.Symbol.ExtraConfigBuilder, _e3) {
29443
30399
  constructor() {
29444
30400
  super(...arguments);
29445
30401
  /** @internal */
@@ -29447,7 +30403,7 @@ var init_table3 = __esm({
29447
30403
  /** @internal */
29448
30404
  __publicField(this, _b140, []);
29449
30405
  /** @internal */
29450
- __publicField(this, _a193);
30406
+ __publicField(this, _a195);
29451
30407
  }
29452
30408
  };
29453
30409
  __publicField(SQLiteTable, _d3, "SQLiteTable");
@@ -29462,7 +30418,7 @@ var init_table3 = __esm({
29462
30418
  });
29463
30419
 
29464
30420
  // ../drizzle-orm/dist/sqlite-core/query-builders/delete.js
29465
- var _a194, _b141, SQLiteDeleteBase;
30421
+ var _a196, _b141, SQLiteDeleteBase;
29466
30422
  var init_delete2 = __esm({
29467
30423
  "../drizzle-orm/dist/sqlite-core/query-builders/delete.js"() {
29468
30424
  "use strict";
@@ -29472,7 +30428,7 @@ var init_delete2 = __esm({
29472
30428
  init_table3();
29473
30429
  init_table();
29474
30430
  init_utils2();
29475
- SQLiteDeleteBase = class extends (_b141 = QueryPromise, _a194 = entityKind, _b141) {
30431
+ SQLiteDeleteBase = class extends (_b141 = QueryPromise, _a196 = entityKind, _b141) {
29476
30432
  constructor(table4, session, dialect4, withList) {
29477
30433
  super();
29478
30434
  /** @internal */
@@ -29578,12 +30534,12 @@ var init_delete2 = __esm({
29578
30534
  return this;
29579
30535
  }
29580
30536
  };
29581
- __publicField(SQLiteDeleteBase, _a194, "SQLiteDelete");
30537
+ __publicField(SQLiteDeleteBase, _a196, "SQLiteDelete");
29582
30538
  }
29583
30539
  });
29584
30540
 
29585
30541
  // ../drizzle-orm/dist/sqlite-core/query-builders/insert.js
29586
- var _a195, SQLiteInsertBuilder, _a196, _b142, SQLiteInsertBase;
30542
+ var _a197, SQLiteInsertBuilder, _a198, _b142, SQLiteInsertBase;
29587
30543
  var init_insert2 = __esm({
29588
30544
  "../drizzle-orm/dist/sqlite-core/query-builders/insert.js"() {
29589
30545
  "use strict";
@@ -29593,7 +30549,7 @@ var init_insert2 = __esm({
29593
30549
  init_table3();
29594
30550
  init_table();
29595
30551
  init_utils2();
29596
- _a195 = entityKind;
30552
+ _a197 = entityKind;
29597
30553
  SQLiteInsertBuilder = class {
29598
30554
  constructor(table4, session, dialect4, withList) {
29599
30555
  this.table = table4;
@@ -29618,8 +30574,8 @@ var init_insert2 = __esm({
29618
30574
  return new SQLiteInsertBase(this.table, mappedValues, this.session, this.dialect, this.withList);
29619
30575
  }
29620
30576
  };
29621
- __publicField(SQLiteInsertBuilder, _a195, "SQLiteInsertBuilder");
29622
- SQLiteInsertBase = class extends (_b142 = QueryPromise, _a196 = entityKind, _b142) {
30577
+ __publicField(SQLiteInsertBuilder, _a197, "SQLiteInsertBuilder");
30578
+ SQLiteInsertBase = class extends (_b142 = QueryPromise, _a198 = entityKind, _b142) {
29623
30579
  constructor(table4, values, session, dialect4, withList) {
29624
30580
  super();
29625
30581
  /** @internal */
@@ -29746,25 +30702,25 @@ var init_insert2 = __esm({
29746
30702
  return this;
29747
30703
  }
29748
30704
  };
29749
- __publicField(SQLiteInsertBase, _a196, "SQLiteInsert");
30705
+ __publicField(SQLiteInsertBase, _a198, "SQLiteInsert");
29750
30706
  }
29751
30707
  });
29752
30708
 
29753
30709
  // ../drizzle-orm/dist/sqlite-core/view-base.js
29754
- var _a197, _b143, SQLiteViewBase;
30710
+ var _a199, _b143, SQLiteViewBase;
29755
30711
  var init_view_base2 = __esm({
29756
30712
  "../drizzle-orm/dist/sqlite-core/view-base.js"() {
29757
30713
  "use strict";
29758
30714
  init_entity();
29759
30715
  init_sql();
29760
- SQLiteViewBase = class extends (_b143 = View3, _a197 = entityKind, _b143) {
30716
+ SQLiteViewBase = class extends (_b143 = View3, _a199 = entityKind, _b143) {
29761
30717
  };
29762
- __publicField(SQLiteViewBase, _a197, "SQLiteViewBase");
30718
+ __publicField(SQLiteViewBase, _a199, "SQLiteViewBase");
29763
30719
  }
29764
30720
  });
29765
30721
 
29766
30722
  // ../drizzle-orm/dist/sqlite-core/dialect.js
29767
- var _a198, SQLiteDialect, _a199, _b144, SQLiteSyncDialect, _a200, _b145, SQLiteAsyncDialect;
30723
+ var _a200, SQLiteDialect, _a201, _b144, SQLiteSyncDialect, _a202, _b145, SQLiteAsyncDialect;
29768
30724
  var init_dialect2 = __esm({
29769
30725
  "../drizzle-orm/dist/sqlite-core/dialect.js"() {
29770
30726
  "use strict";
@@ -29783,7 +30739,7 @@ var init_dialect2 = __esm({
29783
30739
  init_utils2();
29784
30740
  init_view_common();
29785
30741
  init_view_base2();
29786
- _a198 = entityKind;
30742
+ _a200 = entityKind;
29787
30743
  SQLiteDialect = class {
29788
30744
  constructor(config) {
29789
30745
  /** @internal */
@@ -30305,8 +31261,8 @@ var init_dialect2 = __esm({
30305
31261
  };
30306
31262
  }
30307
31263
  };
30308
- __publicField(SQLiteDialect, _a198, "SQLiteDialect");
30309
- SQLiteSyncDialect = class extends (_b144 = SQLiteDialect, _a199 = entityKind, _b144) {
31264
+ __publicField(SQLiteDialect, _a200, "SQLiteDialect");
31265
+ SQLiteSyncDialect = class extends (_b144 = SQLiteDialect, _a201 = entityKind, _b144) {
30310
31266
  migrate(migrations, session, config) {
30311
31267
  const migrationsTable = config === void 0 ? "__drizzle_migrations" : typeof config === "string" ? "__drizzle_migrations" : config.migrationsTable ?? "__drizzle_migrations";
30312
31268
  const migrationTableCreate = sql`
@@ -30340,8 +31296,8 @@ var init_dialect2 = __esm({
30340
31296
  }
30341
31297
  }
30342
31298
  };
30343
- __publicField(SQLiteSyncDialect, _a199, "SQLiteSyncDialect");
30344
- SQLiteAsyncDialect = class extends (_b145 = SQLiteDialect, _a200 = entityKind, _b145) {
31299
+ __publicField(SQLiteSyncDialect, _a201, "SQLiteSyncDialect");
31300
+ SQLiteAsyncDialect = class extends (_b145 = SQLiteDialect, _a202 = entityKind, _b145) {
30345
31301
  async migrate(migrations, session, config) {
30346
31302
  const migrationsTable = config === void 0 ? "__drizzle_migrations" : typeof config === "string" ? "__drizzle_migrations" : config.migrationsTable ?? "__drizzle_migrations";
30347
31303
  const migrationTableCreate = sql`
@@ -30370,7 +31326,7 @@ var init_dialect2 = __esm({
30370
31326
  });
30371
31327
  }
30372
31328
  };
30373
- __publicField(SQLiteAsyncDialect, _a200, "SQLiteAsyncDialect");
31329
+ __publicField(SQLiteAsyncDialect, _a202, "SQLiteAsyncDialect");
30374
31330
  }
30375
31331
  });
30376
31332
 
@@ -30392,7 +31348,7 @@ function createSetOperator2(type, isAll) {
30392
31348
  return leftSelect.addSetOperators(setOperators);
30393
31349
  };
30394
31350
  }
30395
- var _a201, SQLiteSelectBuilder, _a202, _b146, SQLiteSelectQueryBuilderBase, _a203, _b147, SQLiteSelectBase, getSQLiteSetOperators, union2, unionAll2, intersect2, except2;
31351
+ var _a203, SQLiteSelectBuilder, _a204, _b146, SQLiteSelectQueryBuilderBase, _a205, _b147, SQLiteSelectBase, getSQLiteSetOperators, union2, unionAll2, intersect2, except2;
30396
31352
  var init_select3 = __esm({
30397
31353
  "../drizzle-orm/dist/sqlite-core/query-builders/select.js"() {
30398
31354
  "use strict";
@@ -30406,7 +31362,7 @@ var init_select3 = __esm({
30406
31362
  init_utils2();
30407
31363
  init_view_common();
30408
31364
  init_view_base2();
30409
- _a201 = entityKind;
31365
+ _a203 = entityKind;
30410
31366
  SQLiteSelectBuilder = class {
30411
31367
  constructor(config) {
30412
31368
  __publicField(this, "fields");
@@ -30447,8 +31403,8 @@ var init_select3 = __esm({
30447
31403
  });
30448
31404
  }
30449
31405
  };
30450
- __publicField(SQLiteSelectBuilder, _a201, "SQLiteSelectBuilder");
30451
- SQLiteSelectQueryBuilderBase = class extends (_b146 = TypedQueryBuilder, _a202 = entityKind, _b146) {
31406
+ __publicField(SQLiteSelectBuilder, _a203, "SQLiteSelectBuilder");
31407
+ SQLiteSelectQueryBuilderBase = class extends (_b146 = TypedQueryBuilder, _a204 = entityKind, _b146) {
30452
31408
  constructor({ table: table4, fields, isPartialSelect, session, dialect: dialect4, withList, distinct }) {
30453
31409
  super();
30454
31410
  __publicField(this, "_");
@@ -30953,8 +31909,8 @@ var init_select3 = __esm({
30953
31909
  return this;
30954
31910
  }
30955
31911
  };
30956
- __publicField(SQLiteSelectQueryBuilderBase, _a202, "SQLiteSelectQueryBuilder");
30957
- SQLiteSelectBase = class extends (_b147 = SQLiteSelectQueryBuilderBase, _a203 = entityKind, _b147) {
31912
+ __publicField(SQLiteSelectQueryBuilderBase, _a204, "SQLiteSelectQueryBuilder");
31913
+ SQLiteSelectBase = class extends (_b147 = SQLiteSelectQueryBuilderBase, _a205 = entityKind, _b147) {
30958
31914
  constructor() {
30959
31915
  super(...arguments);
30960
31916
  __publicField(this, "run", (placeholderValues) => {
@@ -30992,7 +31948,7 @@ var init_select3 = __esm({
30992
31948
  return this.all();
30993
31949
  }
30994
31950
  };
30995
- __publicField(SQLiteSelectBase, _a203, "SQLiteSelect");
31951
+ __publicField(SQLiteSelectBase, _a205, "SQLiteSelect");
30996
31952
  applyMixins(SQLiteSelectBase, [QueryPromise]);
30997
31953
  getSQLiteSetOperators = () => ({
30998
31954
  union: union2,
@@ -31008,7 +31964,7 @@ var init_select3 = __esm({
31008
31964
  });
31009
31965
 
31010
31966
  // ../drizzle-orm/dist/sqlite-core/query-builders/query-builder.js
31011
- var _a204, QueryBuilder2;
31967
+ var _a206, QueryBuilder2;
31012
31968
  var init_query_builder3 = __esm({
31013
31969
  "../drizzle-orm/dist/sqlite-core/query-builders/query-builder.js"() {
31014
31970
  "use strict";
@@ -31017,7 +31973,7 @@ var init_query_builder3 = __esm({
31017
31973
  init_dialect2();
31018
31974
  init_subquery();
31019
31975
  init_select3();
31020
- _a204 = entityKind;
31976
+ _a206 = entityKind;
31021
31977
  QueryBuilder2 = class {
31022
31978
  constructor(dialect4) {
31023
31979
  __publicField(this, "dialect");
@@ -31079,7 +32035,7 @@ var init_query_builder3 = __esm({
31079
32035
  return this.dialect;
31080
32036
  }
31081
32037
  };
31082
- __publicField(QueryBuilder2, _a204, "SQLiteQueryBuilder");
32038
+ __publicField(QueryBuilder2, _a206, "SQLiteQueryBuilder");
31083
32039
  }
31084
32040
  });
31085
32041
 
@@ -31091,7 +32047,7 @@ var init_select_types2 = __esm({
31091
32047
  });
31092
32048
 
31093
32049
  // ../drizzle-orm/dist/sqlite-core/query-builders/update.js
31094
- var _a205, SQLiteUpdateBuilder, _a206, _b148, SQLiteUpdateBase;
32050
+ var _a207, SQLiteUpdateBuilder, _a208, _b148, SQLiteUpdateBase;
31095
32051
  var init_update2 = __esm({
31096
32052
  "../drizzle-orm/dist/sqlite-core/query-builders/update.js"() {
31097
32053
  "use strict";
@@ -31101,7 +32057,7 @@ var init_update2 = __esm({
31101
32057
  init_table3();
31102
32058
  init_table();
31103
32059
  init_utils2();
31104
- _a205 = entityKind;
32060
+ _a207 = entityKind;
31105
32061
  SQLiteUpdateBuilder = class {
31106
32062
  constructor(table4, session, dialect4, withList) {
31107
32063
  this.table = table4;
@@ -31119,8 +32075,8 @@ var init_update2 = __esm({
31119
32075
  );
31120
32076
  }
31121
32077
  };
31122
- __publicField(SQLiteUpdateBuilder, _a205, "SQLiteUpdateBuilder");
31123
- SQLiteUpdateBase = class extends (_b148 = QueryPromise, _a206 = entityKind, _b148) {
32078
+ __publicField(SQLiteUpdateBuilder, _a207, "SQLiteUpdateBuilder");
32079
+ SQLiteUpdateBase = class extends (_b148 = QueryPromise, _a208 = entityKind, _b148) {
31124
32080
  constructor(table4, set, session, dialect4, withList) {
31125
32081
  super();
31126
32082
  /** @internal */
@@ -31229,7 +32185,7 @@ var init_update2 = __esm({
31229
32185
  return this;
31230
32186
  }
31231
32187
  };
31232
- __publicField(SQLiteUpdateBase, _a206, "SQLiteUpdate");
32188
+ __publicField(SQLiteUpdateBase, _a208, "SQLiteUpdate");
31233
32189
  }
31234
32190
  });
31235
32191
 
@@ -31247,17 +32203,17 @@ var init_query_builders2 = __esm({
31247
32203
  });
31248
32204
 
31249
32205
  // ../drizzle-orm/dist/sqlite-core/query-builders/count.js
31250
- var _a207, _b149, _c7, _SQLiteCountBuilder, SQLiteCountBuilder;
32206
+ var _a209, _b149, _c7, _SQLiteCountBuilder, SQLiteCountBuilder;
31251
32207
  var init_count2 = __esm({
31252
32208
  "../drizzle-orm/dist/sqlite-core/query-builders/count.js"() {
31253
32209
  "use strict";
31254
32210
  init_entity();
31255
32211
  init_sql();
31256
- _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b149 = entityKind, _a207 = Symbol.toStringTag, _c7) {
32212
+ _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b149 = entityKind, _a209 = Symbol.toStringTag, _c7) {
31257
32213
  constructor(params) {
31258
32214
  super(_SQLiteCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
31259
32215
  __publicField(this, "sql");
31260
- __publicField(this, _a207, "SQLiteCountBuilderAsync");
32216
+ __publicField(this, _a209, "SQLiteCountBuilderAsync");
31261
32217
  __publicField(this, "session");
31262
32218
  this.params = params;
31263
32219
  this.session = params.session;
@@ -31300,14 +32256,14 @@ var init_count2 = __esm({
31300
32256
  });
31301
32257
 
31302
32258
  // ../drizzle-orm/dist/sqlite-core/query-builders/query.js
31303
- var _a208, RelationalQueryBuilder2, _a209, _b150, SQLiteRelationalQuery, _a210, _b151, SQLiteSyncRelationalQuery;
32259
+ var _a210, RelationalQueryBuilder2, _a211, _b150, SQLiteRelationalQuery, _a212, _b151, SQLiteSyncRelationalQuery;
31304
32260
  var init_query2 = __esm({
31305
32261
  "../drizzle-orm/dist/sqlite-core/query-builders/query.js"() {
31306
32262
  "use strict";
31307
32263
  init_entity();
31308
32264
  init_query_promise();
31309
32265
  init_relations();
31310
- _a208 = entityKind;
32266
+ _a210 = entityKind;
31311
32267
  RelationalQueryBuilder2 = class {
31312
32268
  constructor(mode, fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session) {
31313
32269
  this.mode = mode;
@@ -31366,8 +32322,8 @@ var init_query2 = __esm({
31366
32322
  );
31367
32323
  }
31368
32324
  };
31369
- __publicField(RelationalQueryBuilder2, _a208, "SQLiteAsyncRelationalQueryBuilder");
31370
- SQLiteRelationalQuery = class extends (_b150 = QueryPromise, _a209 = entityKind, _b150) {
32325
+ __publicField(RelationalQueryBuilder2, _a210, "SQLiteAsyncRelationalQueryBuilder");
32326
+ SQLiteRelationalQuery = class extends (_b150 = QueryPromise, _a211 = entityKind, _b150) {
31371
32327
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, config, mode) {
31372
32328
  super();
31373
32329
  /** @internal */
@@ -31443,24 +32399,24 @@ var init_query2 = __esm({
31443
32399
  return this.executeRaw();
31444
32400
  }
31445
32401
  };
31446
- __publicField(SQLiteRelationalQuery, _a209, "SQLiteAsyncRelationalQuery");
31447
- SQLiteSyncRelationalQuery = class extends (_b151 = SQLiteRelationalQuery, _a210 = entityKind, _b151) {
32402
+ __publicField(SQLiteRelationalQuery, _a211, "SQLiteAsyncRelationalQuery");
32403
+ SQLiteSyncRelationalQuery = class extends (_b151 = SQLiteRelationalQuery, _a212 = entityKind, _b151) {
31448
32404
  sync() {
31449
32405
  return this.executeRaw();
31450
32406
  }
31451
32407
  };
31452
- __publicField(SQLiteSyncRelationalQuery, _a210, "SQLiteSyncRelationalQuery");
32408
+ __publicField(SQLiteSyncRelationalQuery, _a212, "SQLiteSyncRelationalQuery");
31453
32409
  }
31454
32410
  });
31455
32411
 
31456
32412
  // ../drizzle-orm/dist/sqlite-core/query-builders/raw.js
31457
- var _a211, _b152, SQLiteRaw;
32413
+ var _a213, _b152, SQLiteRaw;
31458
32414
  var init_raw2 = __esm({
31459
32415
  "../drizzle-orm/dist/sqlite-core/query-builders/raw.js"() {
31460
32416
  "use strict";
31461
32417
  init_entity();
31462
32418
  init_query_promise();
31463
- SQLiteRaw = class extends (_b152 = QueryPromise, _a211 = entityKind, _b152) {
32419
+ SQLiteRaw = class extends (_b152 = QueryPromise, _a213 = entityKind, _b152) {
31464
32420
  constructor(execute, getSQL, action, dialect4, mapBatchResult) {
31465
32421
  super();
31466
32422
  /** @internal */
@@ -31485,12 +32441,12 @@ var init_raw2 = __esm({
31485
32441
  return false;
31486
32442
  }
31487
32443
  };
31488
- __publicField(SQLiteRaw, _a211, "SQLiteRaw");
32444
+ __publicField(SQLiteRaw, _a213, "SQLiteRaw");
31489
32445
  }
31490
32446
  });
31491
32447
 
31492
32448
  // ../drizzle-orm/dist/sqlite-core/db.js
31493
- var _a212, BaseSQLiteDatabase;
32449
+ var _a214, BaseSQLiteDatabase;
31494
32450
  var init_db2 = __esm({
31495
32451
  "../drizzle-orm/dist/sqlite-core/db.js"() {
31496
32452
  "use strict";
@@ -31502,7 +32458,7 @@ var init_db2 = __esm({
31502
32458
  init_count2();
31503
32459
  init_query2();
31504
32460
  init_raw2();
31505
- _a212 = entityKind;
32461
+ _a214 = entityKind;
31506
32462
  BaseSQLiteDatabase = class {
31507
32463
  constructor(resultKind, dialect4, session, schema4) {
31508
32464
  __publicField(this, "query");
@@ -31784,17 +32740,17 @@ var init_db2 = __esm({
31784
32740
  return this.session.transaction(transaction, config);
31785
32741
  }
31786
32742
  };
31787
- __publicField(BaseSQLiteDatabase, _a212, "BaseSQLiteDatabase");
32743
+ __publicField(BaseSQLiteDatabase, _a214, "BaseSQLiteDatabase");
31788
32744
  }
31789
32745
  });
31790
32746
 
31791
32747
  // ../drizzle-orm/dist/sqlite-core/indexes.js
31792
- var _a213, IndexBuilderOn2, _a214, IndexBuilder2, _a215, Index4;
32748
+ var _a215, IndexBuilderOn2, _a216, IndexBuilder2, _a217, Index4;
31793
32749
  var init_indexes2 = __esm({
31794
32750
  "../drizzle-orm/dist/sqlite-core/indexes.js"() {
31795
32751
  "use strict";
31796
32752
  init_entity();
31797
- _a213 = entityKind;
32753
+ _a215 = entityKind;
31798
32754
  IndexBuilderOn2 = class {
31799
32755
  constructor(name2, unique) {
31800
32756
  this.name = name2;
@@ -31804,8 +32760,8 @@ var init_indexes2 = __esm({
31804
32760
  return new IndexBuilder2(this.name, columns, this.unique);
31805
32761
  }
31806
32762
  };
31807
- __publicField(IndexBuilderOn2, _a213, "SQLiteIndexBuilderOn");
31808
- _a214 = entityKind;
32763
+ __publicField(IndexBuilderOn2, _a215, "SQLiteIndexBuilderOn");
32764
+ _a216 = entityKind;
31809
32765
  IndexBuilder2 = class {
31810
32766
  constructor(name2, columns, unique) {
31811
32767
  /** @internal */
@@ -31829,26 +32785,26 @@ var init_indexes2 = __esm({
31829
32785
  return new Index4(this.config, table4);
31830
32786
  }
31831
32787
  };
31832
- __publicField(IndexBuilder2, _a214, "SQLiteIndexBuilder");
31833
- _a215 = entityKind;
32788
+ __publicField(IndexBuilder2, _a216, "SQLiteIndexBuilder");
32789
+ _a217 = entityKind;
31834
32790
  Index4 = class {
31835
32791
  constructor(config, table4) {
31836
32792
  __publicField(this, "config");
31837
32793
  this.config = { ...config, table: table4 };
31838
32794
  }
31839
32795
  };
31840
- __publicField(Index4, _a215, "SQLiteIndex");
32796
+ __publicField(Index4, _a217, "SQLiteIndex");
31841
32797
  }
31842
32798
  });
31843
32799
 
31844
32800
  // ../drizzle-orm/dist/sqlite-core/primary-keys.js
31845
- var _a216, PrimaryKeyBuilder2, _a217, PrimaryKey2;
32801
+ var _a218, PrimaryKeyBuilder2, _a219, PrimaryKey2;
31846
32802
  var init_primary_keys2 = __esm({
31847
32803
  "../drizzle-orm/dist/sqlite-core/primary-keys.js"() {
31848
32804
  "use strict";
31849
32805
  init_entity();
31850
32806
  init_table3();
31851
- _a216 = entityKind;
32807
+ _a218 = entityKind;
31852
32808
  PrimaryKeyBuilder2 = class {
31853
32809
  constructor(columns, name2) {
31854
32810
  /** @internal */
@@ -31863,8 +32819,8 @@ var init_primary_keys2 = __esm({
31863
32819
  return new PrimaryKey2(table4, this.columns, this.name);
31864
32820
  }
31865
32821
  };
31866
- __publicField(PrimaryKeyBuilder2, _a216, "SQLitePrimaryKeyBuilder");
31867
- _a217 = entityKind;
32822
+ __publicField(PrimaryKeyBuilder2, _a218, "SQLitePrimaryKeyBuilder");
32823
+ _a219 = entityKind;
31868
32824
  PrimaryKey2 = class {
31869
32825
  constructor(table4, columns, name2) {
31870
32826
  __publicField(this, "columns");
@@ -31877,12 +32833,12 @@ var init_primary_keys2 = __esm({
31877
32833
  return this.name ?? `${this.table[SQLiteTable.Symbol.Name]}_${this.columns.map((column4) => column4.name).join("_")}_pk`;
31878
32834
  }
31879
32835
  };
31880
- __publicField(PrimaryKey2, _a217, "SQLitePrimaryKey");
32836
+ __publicField(PrimaryKey2, _a219, "SQLitePrimaryKey");
31881
32837
  }
31882
32838
  });
31883
32839
 
31884
32840
  // ../drizzle-orm/dist/sqlite-core/session.js
31885
- var _a218, _b153, ExecuteResultSync, _a219, SQLitePreparedQuery, _a220, SQLiteSession, _a221, _b154, SQLiteTransaction;
32841
+ var _a220, _b153, ExecuteResultSync, _a221, SQLitePreparedQuery, _a222, SQLiteSession, _a223, _b154, SQLiteTransaction;
31886
32842
  var init_session2 = __esm({
31887
32843
  "../drizzle-orm/dist/sqlite-core/session.js"() {
31888
32844
  "use strict";
@@ -31890,7 +32846,7 @@ var init_session2 = __esm({
31890
32846
  init_errors();
31891
32847
  init_query_promise();
31892
32848
  init_db2();
31893
- ExecuteResultSync = class extends (_b153 = QueryPromise, _a218 = entityKind, _b153) {
32849
+ ExecuteResultSync = class extends (_b153 = QueryPromise, _a220 = entityKind, _b153) {
31894
32850
  constructor(resultCb) {
31895
32851
  super();
31896
32852
  this.resultCb = resultCb;
@@ -31902,8 +32858,8 @@ var init_session2 = __esm({
31902
32858
  return this.resultCb();
31903
32859
  }
31904
32860
  };
31905
- __publicField(ExecuteResultSync, _a218, "ExecuteResultSync");
31906
- _a219 = entityKind;
32861
+ __publicField(ExecuteResultSync, _a220, "ExecuteResultSync");
32862
+ _a221 = entityKind;
31907
32863
  SQLitePreparedQuery = class {
31908
32864
  constructor(mode, executeMethod, query) {
31909
32865
  /** @internal */
@@ -31944,8 +32900,8 @@ var init_session2 = __esm({
31944
32900
  }
31945
32901
  }
31946
32902
  };
31947
- __publicField(SQLitePreparedQuery, _a219, "PreparedQuery");
31948
- _a220 = entityKind;
32903
+ __publicField(SQLitePreparedQuery, _a221, "PreparedQuery");
32904
+ _a222 = entityKind;
31949
32905
  SQLiteSession = class {
31950
32906
  constructor(dialect4) {
31951
32907
  this.dialect = dialect4;
@@ -31991,8 +32947,8 @@ var init_session2 = __esm({
31991
32947
  throw new Error("Not implemented");
31992
32948
  }
31993
32949
  };
31994
- __publicField(SQLiteSession, _a220, "SQLiteSession");
31995
- SQLiteTransaction = class extends (_b154 = BaseSQLiteDatabase, _a221 = entityKind, _b154) {
32950
+ __publicField(SQLiteSession, _a222, "SQLiteSession");
32951
+ SQLiteTransaction = class extends (_b154 = BaseSQLiteDatabase, _a223 = entityKind, _b154) {
31996
32952
  constructor(resultType, dialect4, session, schema4, nestedIndex = 0) {
31997
32953
  super(resultType, dialect4, session, schema4);
31998
32954
  this.schema = schema4;
@@ -32002,7 +32958,7 @@ var init_session2 = __esm({
32002
32958
  throw new TransactionRollbackError();
32003
32959
  }
32004
32960
  };
32005
- __publicField(SQLiteTransaction, _a221, "SQLiteTransaction");
32961
+ __publicField(SQLiteTransaction, _a223, "SQLiteTransaction");
32006
32962
  }
32007
32963
  });
32008
32964
 
@@ -32071,7 +33027,7 @@ var init_utils6 = __esm({
32071
33027
  });
32072
33028
 
32073
33029
  // ../drizzle-orm/dist/sqlite-core/view.js
32074
- var _a222, ViewBuilderCore, _a223, _b155, ViewBuilder2, _a224, _b156, ManualViewBuilder2, _a225, _b157, SQLiteView2;
33030
+ var _a224, ViewBuilderCore, _a225, _b155, ViewBuilder2, _a226, _b156, ManualViewBuilder2, _a227, _b157, SQLiteView2;
32075
33031
  var init_view2 = __esm({
32076
33032
  "../drizzle-orm/dist/sqlite-core/view.js"() {
32077
33033
  "use strict";
@@ -32081,15 +33037,15 @@ var init_view2 = __esm({
32081
33037
  init_query_builder3();
32082
33038
  init_table3();
32083
33039
  init_view_base2();
32084
- _a222 = entityKind;
33040
+ _a224 = entityKind;
32085
33041
  ViewBuilderCore = class {
32086
33042
  constructor(name2) {
32087
33043
  __publicField(this, "config", {});
32088
33044
  this.name = name2;
32089
33045
  }
32090
33046
  };
32091
- __publicField(ViewBuilderCore, _a222, "SQLiteViewBuilderCore");
32092
- ViewBuilder2 = class extends (_b155 = ViewBuilderCore, _a223 = entityKind, _b155) {
33047
+ __publicField(ViewBuilderCore, _a224, "SQLiteViewBuilderCore");
33048
+ ViewBuilder2 = class extends (_b155 = ViewBuilderCore, _a225 = entityKind, _b155) {
32093
33049
  as(qb) {
32094
33050
  if (typeof qb === "function") {
32095
33051
  qb = qb(new QueryBuilder2());
@@ -32115,8 +33071,8 @@ var init_view2 = __esm({
32115
33071
  );
32116
33072
  }
32117
33073
  };
32118
- __publicField(ViewBuilder2, _a223, "SQLiteViewBuilder");
32119
- ManualViewBuilder2 = class extends (_b156 = ViewBuilderCore, _a224 = entityKind, _b156) {
33074
+ __publicField(ViewBuilder2, _a225, "SQLiteViewBuilder");
33075
+ ManualViewBuilder2 = class extends (_b156 = ViewBuilderCore, _a226 = entityKind, _b156) {
32120
33076
  constructor(name2, columns) {
32121
33077
  super(name2);
32122
33078
  __publicField(this, "columns");
@@ -32159,13 +33115,13 @@ var init_view2 = __esm({
32159
33115
  );
32160
33116
  }
32161
33117
  };
32162
- __publicField(ManualViewBuilder2, _a224, "SQLiteManualViewBuilder");
32163
- SQLiteView2 = class extends (_b157 = SQLiteViewBase, _a225 = entityKind, _b157) {
33118
+ __publicField(ManualViewBuilder2, _a226, "SQLiteManualViewBuilder");
33119
+ SQLiteView2 = class extends (_b157 = SQLiteViewBase, _a227 = entityKind, _b157) {
32164
33120
  constructor({ config }) {
32165
33121
  super(config);
32166
33122
  }
32167
33123
  };
32168
- __publicField(SQLiteView2, _a225, "SQLiteView");
33124
+ __publicField(SQLiteView2, _a227, "SQLiteView");
32169
33125
  }
32170
33126
  });
32171
33127
 
@@ -32864,12 +33820,12 @@ var init_alias4 = __esm({
32864
33820
  });
32865
33821
 
32866
33822
  // ../drizzle-orm/dist/mysql-core/checks.js
32867
- var _a226, CheckBuilder3, _a227, Check3;
33823
+ var _a228, CheckBuilder3, _a229, Check3;
32868
33824
  var init_checks3 = __esm({
32869
33825
  "../drizzle-orm/dist/mysql-core/checks.js"() {
32870
33826
  "use strict";
32871
33827
  init_entity();
32872
- _a226 = entityKind;
33828
+ _a228 = entityKind;
32873
33829
  CheckBuilder3 = class {
32874
33830
  constructor(name2, value) {
32875
33831
  __publicField(this, "brand");
@@ -32881,8 +33837,8 @@ var init_checks3 = __esm({
32881
33837
  return new Check3(table4, this);
32882
33838
  }
32883
33839
  };
32884
- __publicField(CheckBuilder3, _a226, "MySqlCheckBuilder");
32885
- _a227 = entityKind;
33840
+ __publicField(CheckBuilder3, _a228, "MySqlCheckBuilder");
33841
+ _a229 = entityKind;
32886
33842
  Check3 = class {
32887
33843
  constructor(table4, builder) {
32888
33844
  __publicField(this, "name");
@@ -32892,18 +33848,18 @@ var init_checks3 = __esm({
32892
33848
  this.value = builder.value;
32893
33849
  }
32894
33850
  };
32895
- __publicField(Check3, _a227, "MySqlCheck");
33851
+ __publicField(Check3, _a229, "MySqlCheck");
32896
33852
  }
32897
33853
  });
32898
33854
 
32899
33855
  // ../drizzle-orm/dist/mysql-core/foreign-keys.js
32900
- var _a228, ForeignKeyBuilder3, _a229, ForeignKey3;
33856
+ var _a230, ForeignKeyBuilder3, _a231, ForeignKey3;
32901
33857
  var init_foreign_keys3 = __esm({
32902
33858
  "../drizzle-orm/dist/mysql-core/foreign-keys.js"() {
32903
33859
  "use strict";
32904
33860
  init_entity();
32905
33861
  init_table_utils();
32906
- _a228 = entityKind;
33862
+ _a230 = entityKind;
32907
33863
  ForeignKeyBuilder3 = class {
32908
33864
  constructor(config, actions) {
32909
33865
  /** @internal */
@@ -32934,8 +33890,8 @@ var init_foreign_keys3 = __esm({
32934
33890
  return new ForeignKey3(table4, this);
32935
33891
  }
32936
33892
  };
32937
- __publicField(ForeignKeyBuilder3, _a228, "MySqlForeignKeyBuilder");
32938
- _a229 = entityKind;
33893
+ __publicField(ForeignKeyBuilder3, _a230, "MySqlForeignKeyBuilder");
33894
+ _a231 = entityKind;
32939
33895
  ForeignKey3 = class {
32940
33896
  constructor(table4, builder) {
32941
33897
  __publicField(this, "reference");
@@ -32959,7 +33915,7 @@ var init_foreign_keys3 = __esm({
32959
33915
  return name2 ?? `${chunks.join("_")}_fk`;
32960
33916
  }
32961
33917
  };
32962
- __publicField(ForeignKey3, _a229, "MySqlForeignKey");
33918
+ __publicField(ForeignKey3, _a231, "MySqlForeignKey");
32963
33919
  }
32964
33920
  });
32965
33921
 
@@ -32967,13 +33923,13 @@ var init_foreign_keys3 = __esm({
32967
33923
  function uniqueKeyName3(table4, columns) {
32968
33924
  return `${table4[TableName]}_${columns.join("_")}_unique`;
32969
33925
  }
32970
- var _a230, UniqueConstraintBuilder3, _a231, UniqueOnConstraintBuilder3, _a232, UniqueConstraint3;
33926
+ var _a232, UniqueConstraintBuilder3, _a233, UniqueOnConstraintBuilder3, _a234, UniqueConstraint3;
32971
33927
  var init_unique_constraint3 = __esm({
32972
33928
  "../drizzle-orm/dist/mysql-core/unique-constraint.js"() {
32973
33929
  "use strict";
32974
33930
  init_entity();
32975
33931
  init_table_utils();
32976
- _a230 = entityKind;
33932
+ _a232 = entityKind;
32977
33933
  UniqueConstraintBuilder3 = class {
32978
33934
  constructor(columns, name2) {
32979
33935
  /** @internal */
@@ -32986,8 +33942,8 @@ var init_unique_constraint3 = __esm({
32986
33942
  return new UniqueConstraint3(table4, this.columns, this.name);
32987
33943
  }
32988
33944
  };
32989
- __publicField(UniqueConstraintBuilder3, _a230, "MySqlUniqueConstraintBuilder");
32990
- _a231 = entityKind;
33945
+ __publicField(UniqueConstraintBuilder3, _a232, "MySqlUniqueConstraintBuilder");
33946
+ _a233 = entityKind;
32991
33947
  UniqueOnConstraintBuilder3 = class {
32992
33948
  constructor(name2) {
32993
33949
  /** @internal */
@@ -32998,8 +33954,8 @@ var init_unique_constraint3 = __esm({
32998
33954
  return new UniqueConstraintBuilder3(columns, this.name);
32999
33955
  }
33000
33956
  };
33001
- __publicField(UniqueOnConstraintBuilder3, _a231, "MySqlUniqueOnConstraintBuilder");
33002
- _a232 = entityKind;
33957
+ __publicField(UniqueOnConstraintBuilder3, _a233, "MySqlUniqueOnConstraintBuilder");
33958
+ _a234 = entityKind;
33003
33959
  UniqueConstraint3 = class {
33004
33960
  constructor(table4, columns, name2) {
33005
33961
  __publicField(this, "columns");
@@ -33013,12 +33969,12 @@ var init_unique_constraint3 = __esm({
33013
33969
  return this.name;
33014
33970
  }
33015
33971
  };
33016
- __publicField(UniqueConstraint3, _a232, "MySqlUniqueConstraint");
33972
+ __publicField(UniqueConstraint3, _a234, "MySqlUniqueConstraint");
33017
33973
  }
33018
33974
  });
33019
33975
 
33020
33976
  // ../drizzle-orm/dist/mysql-core/columns/common.js
33021
- var _a233, _b158, MySqlColumnBuilder, _a234, _b159, MySqlColumn, _a235, _b160, MySqlColumnBuilderWithAutoIncrement, _a236, _b161, MySqlColumnWithAutoIncrement;
33977
+ var _a235, _b158, MySqlColumnBuilder, _a236, _b159, MySqlColumn, _a237, _b160, MySqlColumnBuilderWithAutoIncrement, _a238, _b161, MySqlColumnWithAutoIncrement;
33022
33978
  var init_common4 = __esm({
33023
33979
  "../drizzle-orm/dist/mysql-core/columns/common.js"() {
33024
33980
  "use strict";
@@ -33027,7 +33983,7 @@ var init_common4 = __esm({
33027
33983
  init_entity();
33028
33984
  init_foreign_keys3();
33029
33985
  init_unique_constraint3();
33030
- MySqlColumnBuilder = class extends (_b158 = ColumnBuilder, _a233 = entityKind, _b158) {
33986
+ MySqlColumnBuilder = class extends (_b158 = ColumnBuilder, _a235 = entityKind, _b158) {
33031
33987
  constructor() {
33032
33988
  super(...arguments);
33033
33989
  __publicField(this, "foreignKeyConfigs", []);
@@ -33068,8 +34024,8 @@ var init_common4 = __esm({
33068
34024
  });
33069
34025
  }
33070
34026
  };
33071
- __publicField(MySqlColumnBuilder, _a233, "MySqlColumnBuilder");
33072
- MySqlColumn = class extends (_b159 = Column2, _a234 = entityKind, _b159) {
34027
+ __publicField(MySqlColumnBuilder, _a235, "MySqlColumnBuilder");
34028
+ MySqlColumn = class extends (_b159 = Column2, _a236 = entityKind, _b159) {
33073
34029
  constructor(table4, config) {
33074
34030
  if (!config.uniqueName) {
33075
34031
  config.uniqueName = uniqueKeyName3(table4, [config.name]);
@@ -33078,8 +34034,8 @@ var init_common4 = __esm({
33078
34034
  this.table = table4;
33079
34035
  }
33080
34036
  };
33081
- __publicField(MySqlColumn, _a234, "MySqlColumn");
33082
- MySqlColumnBuilderWithAutoIncrement = class extends (_b160 = MySqlColumnBuilder, _a235 = entityKind, _b160) {
34037
+ __publicField(MySqlColumn, _a236, "MySqlColumn");
34038
+ MySqlColumnBuilderWithAutoIncrement = class extends (_b160 = MySqlColumnBuilder, _a237 = entityKind, _b160) {
33083
34039
  constructor(name2, dataType, columnType) {
33084
34040
  super(name2, dataType, columnType);
33085
34041
  this.config.autoIncrement = false;
@@ -33090,14 +34046,14 @@ var init_common4 = __esm({
33090
34046
  return this;
33091
34047
  }
33092
34048
  };
33093
- __publicField(MySqlColumnBuilderWithAutoIncrement, _a235, "MySqlColumnBuilderWithAutoIncrement");
33094
- MySqlColumnWithAutoIncrement = class extends (_b161 = MySqlColumn, _a236 = entityKind, _b161) {
34049
+ __publicField(MySqlColumnBuilderWithAutoIncrement, _a237, "MySqlColumnBuilderWithAutoIncrement");
34050
+ MySqlColumnWithAutoIncrement = class extends (_b161 = MySqlColumn, _a238 = entityKind, _b161) {
33095
34051
  constructor() {
33096
34052
  super(...arguments);
33097
34053
  __publicField(this, "autoIncrement", this.config.autoIncrement);
33098
34054
  }
33099
34055
  };
33100
- __publicField(MySqlColumnWithAutoIncrement, _a236, "MySqlColumnWithAutoIncrement");
34056
+ __publicField(MySqlColumnWithAutoIncrement, _a238, "MySqlColumnWithAutoIncrement");
33101
34057
  }
33102
34058
  });
33103
34059
 
@@ -33109,14 +34065,14 @@ function bigint2(a, b) {
33109
34065
  }
33110
34066
  return new MySqlBigInt64Builder(name2, config.unsigned);
33111
34067
  }
33112
- var _a237, _b162, MySqlBigInt53Builder, _a238, _b163, MySqlBigInt53, _a239, _b164, MySqlBigInt64Builder, _a240, _b165, MySqlBigInt64;
34068
+ var _a239, _b162, MySqlBigInt53Builder, _a240, _b163, MySqlBigInt53, _a241, _b164, MySqlBigInt64Builder, _a242, _b165, MySqlBigInt64;
33113
34069
  var init_bigint2 = __esm({
33114
34070
  "../drizzle-orm/dist/mysql-core/columns/bigint.js"() {
33115
34071
  "use strict";
33116
34072
  init_entity();
33117
34073
  init_utils2();
33118
34074
  init_common4();
33119
- MySqlBigInt53Builder = class extends (_b162 = MySqlColumnBuilderWithAutoIncrement, _a237 = entityKind, _b162) {
34075
+ MySqlBigInt53Builder = class extends (_b162 = MySqlColumnBuilderWithAutoIncrement, _a239 = entityKind, _b162) {
33120
34076
  constructor(name2, unsigned = false) {
33121
34077
  super(name2, "number", "MySqlBigInt53");
33122
34078
  this.config.unsigned = unsigned;
@@ -33129,8 +34085,8 @@ var init_bigint2 = __esm({
33129
34085
  );
33130
34086
  }
33131
34087
  };
33132
- __publicField(MySqlBigInt53Builder, _a237, "MySqlBigInt53Builder");
33133
- MySqlBigInt53 = class extends (_b163 = MySqlColumnWithAutoIncrement, _a238 = entityKind, _b163) {
34088
+ __publicField(MySqlBigInt53Builder, _a239, "MySqlBigInt53Builder");
34089
+ MySqlBigInt53 = class extends (_b163 = MySqlColumnWithAutoIncrement, _a240 = entityKind, _b163) {
33134
34090
  getSQLType() {
33135
34091
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
33136
34092
  }
@@ -33141,8 +34097,8 @@ var init_bigint2 = __esm({
33141
34097
  return Number(value);
33142
34098
  }
33143
34099
  };
33144
- __publicField(MySqlBigInt53, _a238, "MySqlBigInt53");
33145
- MySqlBigInt64Builder = class extends (_b164 = MySqlColumnBuilderWithAutoIncrement, _a239 = entityKind, _b164) {
34100
+ __publicField(MySqlBigInt53, _a240, "MySqlBigInt53");
34101
+ MySqlBigInt64Builder = class extends (_b164 = MySqlColumnBuilderWithAutoIncrement, _a241 = entityKind, _b164) {
33146
34102
  constructor(name2, unsigned = false) {
33147
34103
  super(name2, "bigint", "MySqlBigInt64");
33148
34104
  this.config.unsigned = unsigned;
@@ -33155,8 +34111,8 @@ var init_bigint2 = __esm({
33155
34111
  );
33156
34112
  }
33157
34113
  };
33158
- __publicField(MySqlBigInt64Builder, _a239, "MySqlBigInt64Builder");
33159
- MySqlBigInt64 = class extends (_b165 = MySqlColumnWithAutoIncrement, _a240 = entityKind, _b165) {
34114
+ __publicField(MySqlBigInt64Builder, _a241, "MySqlBigInt64Builder");
34115
+ MySqlBigInt64 = class extends (_b165 = MySqlColumnWithAutoIncrement, _a242 = entityKind, _b165) {
33160
34116
  getSQLType() {
33161
34117
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
33162
34118
  }
@@ -33165,7 +34121,7 @@ var init_bigint2 = __esm({
33165
34121
  return BigInt(value);
33166
34122
  }
33167
34123
  };
33168
- __publicField(MySqlBigInt64, _a240, "MySqlBigInt64");
34124
+ __publicField(MySqlBigInt64, _a242, "MySqlBigInt64");
33169
34125
  }
33170
34126
  });
33171
34127
 
@@ -33174,14 +34130,14 @@ function binary(a, b = {}) {
33174
34130
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33175
34131
  return new MySqlBinaryBuilder(name2, config.length);
33176
34132
  }
33177
- var _a241, _b166, MySqlBinaryBuilder, _a242, _b167, MySqlBinary;
34133
+ var _a243, _b166, MySqlBinaryBuilder, _a244, _b167, MySqlBinary;
33178
34134
  var init_binary = __esm({
33179
34135
  "../drizzle-orm/dist/mysql-core/columns/binary.js"() {
33180
34136
  "use strict";
33181
34137
  init_entity();
33182
34138
  init_utils2();
33183
34139
  init_common4();
33184
- MySqlBinaryBuilder = class extends (_b166 = MySqlColumnBuilder, _a241 = entityKind, _b166) {
34140
+ MySqlBinaryBuilder = class extends (_b166 = MySqlColumnBuilder, _a243 = entityKind, _b166) {
33185
34141
  constructor(name2, length) {
33186
34142
  super(name2, "string", "MySqlBinary");
33187
34143
  this.config.length = length;
@@ -33191,8 +34147,8 @@ var init_binary = __esm({
33191
34147
  return new MySqlBinary(table4, this.config);
33192
34148
  }
33193
34149
  };
33194
- __publicField(MySqlBinaryBuilder, _a241, "MySqlBinaryBuilder");
33195
- MySqlBinary = class extends (_b167 = MySqlColumn, _a242 = entityKind, _b167) {
34150
+ __publicField(MySqlBinaryBuilder, _a243, "MySqlBinaryBuilder");
34151
+ MySqlBinary = class extends (_b167 = MySqlColumn, _a244 = entityKind, _b167) {
33196
34152
  constructor() {
33197
34153
  super(...arguments);
33198
34154
  __publicField(this, "length", this.config.length);
@@ -33201,7 +34157,7 @@ var init_binary = __esm({
33201
34157
  return this.length === void 0 ? `binary` : `binary(${this.length})`;
33202
34158
  }
33203
34159
  };
33204
- __publicField(MySqlBinary, _a242, "MySqlBinary");
34160
+ __publicField(MySqlBinary, _a244, "MySqlBinary");
33205
34161
  }
33206
34162
  });
33207
34163
 
@@ -33209,13 +34165,13 @@ var init_binary = __esm({
33209
34165
  function boolean2(name2) {
33210
34166
  return new MySqlBooleanBuilder(name2 ?? "");
33211
34167
  }
33212
- var _a243, _b168, MySqlBooleanBuilder, _a244, _b169, MySqlBoolean;
34168
+ var _a245, _b168, MySqlBooleanBuilder, _a246, _b169, MySqlBoolean;
33213
34169
  var init_boolean2 = __esm({
33214
34170
  "../drizzle-orm/dist/mysql-core/columns/boolean.js"() {
33215
34171
  "use strict";
33216
34172
  init_entity();
33217
34173
  init_common4();
33218
- MySqlBooleanBuilder = class extends (_b168 = MySqlColumnBuilder, _a243 = entityKind, _b168) {
34174
+ MySqlBooleanBuilder = class extends (_b168 = MySqlColumnBuilder, _a245 = entityKind, _b168) {
33219
34175
  constructor(name2) {
33220
34176
  super(name2, "boolean", "MySqlBoolean");
33221
34177
  }
@@ -33227,8 +34183,8 @@ var init_boolean2 = __esm({
33227
34183
  );
33228
34184
  }
33229
34185
  };
33230
- __publicField(MySqlBooleanBuilder, _a243, "MySqlBooleanBuilder");
33231
- MySqlBoolean = class extends (_b169 = MySqlColumn, _a244 = entityKind, _b169) {
34186
+ __publicField(MySqlBooleanBuilder, _a245, "MySqlBooleanBuilder");
34187
+ MySqlBoolean = class extends (_b169 = MySqlColumn, _a246 = entityKind, _b169) {
33232
34188
  getSQLType() {
33233
34189
  return "boolean";
33234
34190
  }
@@ -33239,7 +34195,7 @@ var init_boolean2 = __esm({
33239
34195
  return value === 1;
33240
34196
  }
33241
34197
  };
33242
- __publicField(MySqlBoolean, _a244, "MySqlBoolean");
34198
+ __publicField(MySqlBoolean, _a246, "MySqlBoolean");
33243
34199
  }
33244
34200
  });
33245
34201
 
@@ -33248,14 +34204,14 @@ function char2(a, b = {}) {
33248
34204
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33249
34205
  return new MySqlCharBuilder(name2, config);
33250
34206
  }
33251
- var _a245, _b170, MySqlCharBuilder, _a246, _b171, MySqlChar;
34207
+ var _a247, _b170, MySqlCharBuilder, _a248, _b171, MySqlChar;
33252
34208
  var init_char2 = __esm({
33253
34209
  "../drizzle-orm/dist/mysql-core/columns/char.js"() {
33254
34210
  "use strict";
33255
34211
  init_entity();
33256
34212
  init_utils2();
33257
34213
  init_common4();
33258
- MySqlCharBuilder = class extends (_b170 = MySqlColumnBuilder, _a245 = entityKind, _b170) {
34214
+ MySqlCharBuilder = class extends (_b170 = MySqlColumnBuilder, _a247 = entityKind, _b170) {
33259
34215
  constructor(name2, config) {
33260
34216
  super(name2, "string", "MySqlChar");
33261
34217
  this.config.length = config.length;
@@ -33269,8 +34225,8 @@ var init_char2 = __esm({
33269
34225
  );
33270
34226
  }
33271
34227
  };
33272
- __publicField(MySqlCharBuilder, _a245, "MySqlCharBuilder");
33273
- MySqlChar = class extends (_b171 = MySqlColumn, _a246 = entityKind, _b171) {
34228
+ __publicField(MySqlCharBuilder, _a247, "MySqlCharBuilder");
34229
+ MySqlChar = class extends (_b171 = MySqlColumn, _a248 = entityKind, _b171) {
33274
34230
  constructor() {
33275
34231
  super(...arguments);
33276
34232
  __publicField(this, "length", this.config.length);
@@ -33280,7 +34236,7 @@ var init_char2 = __esm({
33280
34236
  return this.length === void 0 ? `char` : `char(${this.length})`;
33281
34237
  }
33282
34238
  };
33283
- __publicField(MySqlChar, _a246, "MySqlChar");
34239
+ __publicField(MySqlChar, _a248, "MySqlChar");
33284
34240
  }
33285
34241
  });
33286
34242
 
@@ -33291,14 +34247,14 @@ function customType3(customTypeParams) {
33291
34247
  return new MySqlCustomColumnBuilder(name2, config, customTypeParams);
33292
34248
  };
33293
34249
  }
33294
- var _a247, _b172, MySqlCustomColumnBuilder, _a248, _b173, MySqlCustomColumn;
34250
+ var _a249, _b172, MySqlCustomColumnBuilder, _a250, _b173, MySqlCustomColumn;
33295
34251
  var init_custom3 = __esm({
33296
34252
  "../drizzle-orm/dist/mysql-core/columns/custom.js"() {
33297
34253
  "use strict";
33298
34254
  init_entity();
33299
34255
  init_utils2();
33300
34256
  init_common4();
33301
- MySqlCustomColumnBuilder = class extends (_b172 = MySqlColumnBuilder, _a247 = entityKind, _b172) {
34257
+ MySqlCustomColumnBuilder = class extends (_b172 = MySqlColumnBuilder, _a249 = entityKind, _b172) {
33302
34258
  constructor(name2, fieldConfig, customTypeParams) {
33303
34259
  super(name2, "custom", "MySqlCustomColumn");
33304
34260
  this.config.fieldConfig = fieldConfig;
@@ -33312,8 +34268,8 @@ var init_custom3 = __esm({
33312
34268
  );
33313
34269
  }
33314
34270
  };
33315
- __publicField(MySqlCustomColumnBuilder, _a247, "MySqlCustomColumnBuilder");
33316
- MySqlCustomColumn = class extends (_b173 = MySqlColumn, _a248 = entityKind, _b173) {
34271
+ __publicField(MySqlCustomColumnBuilder, _a249, "MySqlCustomColumnBuilder");
34272
+ MySqlCustomColumn = class extends (_b173 = MySqlColumn, _a250 = entityKind, _b173) {
33317
34273
  constructor(table4, config) {
33318
34274
  super(table4, config);
33319
34275
  __publicField(this, "sqlName");
@@ -33333,7 +34289,7 @@ var init_custom3 = __esm({
33333
34289
  return typeof this.mapTo === "function" ? this.mapTo(value) : value;
33334
34290
  }
33335
34291
  };
33336
- __publicField(MySqlCustomColumn, _a248, "MySqlCustomColumn");
34292
+ __publicField(MySqlCustomColumn, _a250, "MySqlCustomColumn");
33337
34293
  }
33338
34294
  });
33339
34295
 
@@ -33345,14 +34301,14 @@ function date2(a, b) {
33345
34301
  }
33346
34302
  return new MySqlDateBuilder(name2);
33347
34303
  }
33348
- var _a249, _b174, MySqlDateBuilder, _a250, _b175, MySqlDate, _a251, _b176, MySqlDateStringBuilder, _a252, _b177, MySqlDateString;
34304
+ var _a251, _b174, MySqlDateBuilder, _a252, _b175, MySqlDate, _a253, _b176, MySqlDateStringBuilder, _a254, _b177, MySqlDateString;
33349
34305
  var init_date2 = __esm({
33350
34306
  "../drizzle-orm/dist/mysql-core/columns/date.js"() {
33351
34307
  "use strict";
33352
34308
  init_entity();
33353
34309
  init_utils2();
33354
34310
  init_common4();
33355
- MySqlDateBuilder = class extends (_b174 = MySqlColumnBuilder, _a249 = entityKind, _b174) {
34311
+ MySqlDateBuilder = class extends (_b174 = MySqlColumnBuilder, _a251 = entityKind, _b174) {
33356
34312
  constructor(name2) {
33357
34313
  super(name2, "date", "MySqlDate");
33358
34314
  }
@@ -33361,8 +34317,8 @@ var init_date2 = __esm({
33361
34317
  return new MySqlDate(table4, this.config);
33362
34318
  }
33363
34319
  };
33364
- __publicField(MySqlDateBuilder, _a249, "MySqlDateBuilder");
33365
- MySqlDate = class extends (_b175 = MySqlColumn, _a250 = entityKind, _b175) {
34320
+ __publicField(MySqlDateBuilder, _a251, "MySqlDateBuilder");
34321
+ MySqlDate = class extends (_b175 = MySqlColumn, _a252 = entityKind, _b175) {
33366
34322
  constructor(table4, config) {
33367
34323
  super(table4, config);
33368
34324
  }
@@ -33373,8 +34329,8 @@ var init_date2 = __esm({
33373
34329
  return new Date(value);
33374
34330
  }
33375
34331
  };
33376
- __publicField(MySqlDate, _a250, "MySqlDate");
33377
- MySqlDateStringBuilder = class extends (_b176 = MySqlColumnBuilder, _a251 = entityKind, _b176) {
34332
+ __publicField(MySqlDate, _a252, "MySqlDate");
34333
+ MySqlDateStringBuilder = class extends (_b176 = MySqlColumnBuilder, _a253 = entityKind, _b176) {
33378
34334
  constructor(name2) {
33379
34335
  super(name2, "string", "MySqlDateString");
33380
34336
  }
@@ -33386,8 +34342,8 @@ var init_date2 = __esm({
33386
34342
  );
33387
34343
  }
33388
34344
  };
33389
- __publicField(MySqlDateStringBuilder, _a251, "MySqlDateStringBuilder");
33390
- MySqlDateString = class extends (_b177 = MySqlColumn, _a252 = entityKind, _b177) {
34345
+ __publicField(MySqlDateStringBuilder, _a253, "MySqlDateStringBuilder");
34346
+ MySqlDateString = class extends (_b177 = MySqlColumn, _a254 = entityKind, _b177) {
33391
34347
  constructor(table4, config) {
33392
34348
  super(table4, config);
33393
34349
  }
@@ -33395,7 +34351,7 @@ var init_date2 = __esm({
33395
34351
  return `date`;
33396
34352
  }
33397
34353
  };
33398
- __publicField(MySqlDateString, _a252, "MySqlDateString");
34354
+ __publicField(MySqlDateString, _a254, "MySqlDateString");
33399
34355
  }
33400
34356
  });
33401
34357
 
@@ -33407,14 +34363,14 @@ function datetime(a, b) {
33407
34363
  }
33408
34364
  return new MySqlDateTimeBuilder(name2, config);
33409
34365
  }
33410
- var _a253, _b178, MySqlDateTimeBuilder, _a254, _b179, MySqlDateTime, _a255, _b180, MySqlDateTimeStringBuilder, _a256, _b181, MySqlDateTimeString;
34366
+ var _a255, _b178, MySqlDateTimeBuilder, _a256, _b179, MySqlDateTime, _a257, _b180, MySqlDateTimeStringBuilder, _a258, _b181, MySqlDateTimeString;
33411
34367
  var init_datetime = __esm({
33412
34368
  "../drizzle-orm/dist/mysql-core/columns/datetime.js"() {
33413
34369
  "use strict";
33414
34370
  init_entity();
33415
34371
  init_utils2();
33416
34372
  init_common4();
33417
- MySqlDateTimeBuilder = class extends (_b178 = MySqlColumnBuilder, _a253 = entityKind, _b178) {
34373
+ MySqlDateTimeBuilder = class extends (_b178 = MySqlColumnBuilder, _a255 = entityKind, _b178) {
33418
34374
  constructor(name2, config) {
33419
34375
  super(name2, "date", "MySqlDateTime");
33420
34376
  this.config.fsp = config?.fsp;
@@ -33427,8 +34383,8 @@ var init_datetime = __esm({
33427
34383
  );
33428
34384
  }
33429
34385
  };
33430
- __publicField(MySqlDateTimeBuilder, _a253, "MySqlDateTimeBuilder");
33431
- MySqlDateTime = class extends (_b179 = MySqlColumn, _a254 = entityKind, _b179) {
34386
+ __publicField(MySqlDateTimeBuilder, _a255, "MySqlDateTimeBuilder");
34387
+ MySqlDateTime = class extends (_b179 = MySqlColumn, _a256 = entityKind, _b179) {
33432
34388
  constructor(table4, config) {
33433
34389
  super(table4, config);
33434
34390
  __publicField(this, "fsp");
@@ -33445,8 +34401,8 @@ var init_datetime = __esm({
33445
34401
  return /* @__PURE__ */ new Date(value.replace(" ", "T") + "Z");
33446
34402
  }
33447
34403
  };
33448
- __publicField(MySqlDateTime, _a254, "MySqlDateTime");
33449
- MySqlDateTimeStringBuilder = class extends (_b180 = MySqlColumnBuilder, _a255 = entityKind, _b180) {
34404
+ __publicField(MySqlDateTime, _a256, "MySqlDateTime");
34405
+ MySqlDateTimeStringBuilder = class extends (_b180 = MySqlColumnBuilder, _a257 = entityKind, _b180) {
33450
34406
  constructor(name2, config) {
33451
34407
  super(name2, "string", "MySqlDateTimeString");
33452
34408
  this.config.fsp = config?.fsp;
@@ -33459,8 +34415,8 @@ var init_datetime = __esm({
33459
34415
  );
33460
34416
  }
33461
34417
  };
33462
- __publicField(MySqlDateTimeStringBuilder, _a255, "MySqlDateTimeStringBuilder");
33463
- MySqlDateTimeString = class extends (_b181 = MySqlColumn, _a256 = entityKind, _b181) {
34418
+ __publicField(MySqlDateTimeStringBuilder, _a257, "MySqlDateTimeStringBuilder");
34419
+ MySqlDateTimeString = class extends (_b181 = MySqlColumn, _a258 = entityKind, _b181) {
33464
34420
  constructor(table4, config) {
33465
34421
  super(table4, config);
33466
34422
  __publicField(this, "fsp");
@@ -33471,7 +34427,7 @@ var init_datetime = __esm({
33471
34427
  return `datetime${precision}`;
33472
34428
  }
33473
34429
  };
33474
- __publicField(MySqlDateTimeString, _a256, "MySqlDateTimeString");
34430
+ __publicField(MySqlDateTimeString, _a258, "MySqlDateTimeString");
33475
34431
  }
33476
34432
  });
33477
34433
 
@@ -33480,14 +34436,14 @@ function decimal(a, b = {}) {
33480
34436
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33481
34437
  return new MySqlDecimalBuilder(name2, config.precision, config.scale);
33482
34438
  }
33483
- var _a257, _b182, MySqlDecimalBuilder, _a258, _b183, MySqlDecimal;
34439
+ var _a259, _b182, MySqlDecimalBuilder, _a260, _b183, MySqlDecimal;
33484
34440
  var init_decimal = __esm({
33485
34441
  "../drizzle-orm/dist/mysql-core/columns/decimal.js"() {
33486
34442
  "use strict";
33487
34443
  init_entity();
33488
34444
  init_utils2();
33489
34445
  init_common4();
33490
- MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a257 = entityKind, _b182) {
34446
+ MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b182) {
33491
34447
  constructor(name2, precision, scale) {
33492
34448
  super(name2, "string", "MySqlDecimal");
33493
34449
  this.config.precision = precision;
@@ -33501,8 +34457,8 @@ var init_decimal = __esm({
33501
34457
  );
33502
34458
  }
33503
34459
  };
33504
- __publicField(MySqlDecimalBuilder, _a257, "MySqlDecimalBuilder");
33505
- MySqlDecimal = class extends (_b183 = MySqlColumnWithAutoIncrement, _a258 = entityKind, _b183) {
34460
+ __publicField(MySqlDecimalBuilder, _a259, "MySqlDecimalBuilder");
34461
+ MySqlDecimal = class extends (_b183 = MySqlColumnWithAutoIncrement, _a260 = entityKind, _b183) {
33506
34462
  constructor() {
33507
34463
  super(...arguments);
33508
34464
  __publicField(this, "precision", this.config.precision);
@@ -33518,7 +34474,7 @@ var init_decimal = __esm({
33518
34474
  }
33519
34475
  }
33520
34476
  };
33521
- __publicField(MySqlDecimal, _a258, "MySqlDecimal");
34477
+ __publicField(MySqlDecimal, _a260, "MySqlDecimal");
33522
34478
  }
33523
34479
  });
33524
34480
 
@@ -33527,14 +34483,14 @@ function double(a, b) {
33527
34483
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33528
34484
  return new MySqlDoubleBuilder(name2, config);
33529
34485
  }
33530
- var _a259, _b184, MySqlDoubleBuilder, _a260, _b185, MySqlDouble;
34486
+ var _a261, _b184, MySqlDoubleBuilder, _a262, _b185, MySqlDouble;
33531
34487
  var init_double = __esm({
33532
34488
  "../drizzle-orm/dist/mysql-core/columns/double.js"() {
33533
34489
  "use strict";
33534
34490
  init_entity();
33535
34491
  init_utils2();
33536
34492
  init_common4();
33537
- MySqlDoubleBuilder = class extends (_b184 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b184) {
34493
+ MySqlDoubleBuilder = class extends (_b184 = MySqlColumnBuilderWithAutoIncrement, _a261 = entityKind, _b184) {
33538
34494
  constructor(name2, config) {
33539
34495
  super(name2, "number", "MySqlDouble");
33540
34496
  this.config.precision = config?.precision;
@@ -33545,8 +34501,8 @@ var init_double = __esm({
33545
34501
  return new MySqlDouble(table4, this.config);
33546
34502
  }
33547
34503
  };
33548
- __publicField(MySqlDoubleBuilder, _a259, "MySqlDoubleBuilder");
33549
- MySqlDouble = class extends (_b185 = MySqlColumnWithAutoIncrement, _a260 = entityKind, _b185) {
34504
+ __publicField(MySqlDoubleBuilder, _a261, "MySqlDoubleBuilder");
34505
+ MySqlDouble = class extends (_b185 = MySqlColumnWithAutoIncrement, _a262 = entityKind, _b185) {
33550
34506
  constructor() {
33551
34507
  super(...arguments);
33552
34508
  __publicField(this, "precision", this.config.precision);
@@ -33562,7 +34518,7 @@ var init_double = __esm({
33562
34518
  }
33563
34519
  }
33564
34520
  };
33565
- __publicField(MySqlDouble, _a260, "MySqlDouble");
34521
+ __publicField(MySqlDouble, _a262, "MySqlDouble");
33566
34522
  }
33567
34523
  });
33568
34524
 
@@ -33574,14 +34530,14 @@ function mysqlEnum(a, b) {
33574
34530
  }
33575
34531
  return new MySqlEnumColumnBuilder(name2, values);
33576
34532
  }
33577
- var _a261, _b186, MySqlEnumColumnBuilder, _a262, _b187, MySqlEnumColumn;
34533
+ var _a263, _b186, MySqlEnumColumnBuilder, _a264, _b187, MySqlEnumColumn;
33578
34534
  var init_enum2 = __esm({
33579
34535
  "../drizzle-orm/dist/mysql-core/columns/enum.js"() {
33580
34536
  "use strict";
33581
34537
  init_entity();
33582
34538
  init_utils2();
33583
34539
  init_common4();
33584
- MySqlEnumColumnBuilder = class extends (_b186 = MySqlColumnBuilder, _a261 = entityKind, _b186) {
34540
+ MySqlEnumColumnBuilder = class extends (_b186 = MySqlColumnBuilder, _a263 = entityKind, _b186) {
33585
34541
  constructor(name2, values) {
33586
34542
  super(name2, "string", "MySqlEnumColumn");
33587
34543
  this.config.enumValues = values;
@@ -33594,8 +34550,8 @@ var init_enum2 = __esm({
33594
34550
  );
33595
34551
  }
33596
34552
  };
33597
- __publicField(MySqlEnumColumnBuilder, _a261, "MySqlEnumColumnBuilder");
33598
- MySqlEnumColumn = class extends (_b187 = MySqlColumn, _a262 = entityKind, _b187) {
34553
+ __publicField(MySqlEnumColumnBuilder, _a263, "MySqlEnumColumnBuilder");
34554
+ MySqlEnumColumn = class extends (_b187 = MySqlColumn, _a264 = entityKind, _b187) {
33599
34555
  constructor() {
33600
34556
  super(...arguments);
33601
34557
  __publicField(this, "enumValues", this.config.enumValues);
@@ -33604,7 +34560,7 @@ var init_enum2 = __esm({
33604
34560
  return `enum(${this.enumValues.map((value) => `'${value}'`).join(",")})`;
33605
34561
  }
33606
34562
  };
33607
- __publicField(MySqlEnumColumn, _a262, "MySqlEnumColumn");
34563
+ __publicField(MySqlEnumColumn, _a264, "MySqlEnumColumn");
33608
34564
  }
33609
34565
  });
33610
34566
 
@@ -33612,13 +34568,13 @@ var init_enum2 = __esm({
33612
34568
  function float(name2) {
33613
34569
  return new MySqlFloatBuilder(name2 ?? "");
33614
34570
  }
33615
- var _a263, _b188, MySqlFloatBuilder, _a264, _b189, MySqlFloat;
34571
+ var _a265, _b188, MySqlFloatBuilder, _a266, _b189, MySqlFloat;
33616
34572
  var init_float = __esm({
33617
34573
  "../drizzle-orm/dist/mysql-core/columns/float.js"() {
33618
34574
  "use strict";
33619
34575
  init_entity();
33620
34576
  init_common4();
33621
- MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a263 = entityKind, _b188) {
34577
+ MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b188) {
33622
34578
  constructor(name2) {
33623
34579
  super(name2, "number", "MySqlFloat");
33624
34580
  }
@@ -33627,13 +34583,13 @@ var init_float = __esm({
33627
34583
  return new MySqlFloat(table4, this.config);
33628
34584
  }
33629
34585
  };
33630
- __publicField(MySqlFloatBuilder, _a263, "MySqlFloatBuilder");
33631
- MySqlFloat = class extends (_b189 = MySqlColumnWithAutoIncrement, _a264 = entityKind, _b189) {
34586
+ __publicField(MySqlFloatBuilder, _a265, "MySqlFloatBuilder");
34587
+ MySqlFloat = class extends (_b189 = MySqlColumnWithAutoIncrement, _a266 = entityKind, _b189) {
33632
34588
  getSQLType() {
33633
34589
  return "float";
33634
34590
  }
33635
34591
  };
33636
- __publicField(MySqlFloat, _a264, "MySqlFloat");
34592
+ __publicField(MySqlFloat, _a266, "MySqlFloat");
33637
34593
  }
33638
34594
  });
33639
34595
 
@@ -33642,14 +34598,14 @@ function int(a, b) {
33642
34598
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33643
34599
  return new MySqlIntBuilder(name2, config);
33644
34600
  }
33645
- var _a265, _b190, MySqlIntBuilder, _a266, _b191, MySqlInt;
34601
+ var _a267, _b190, MySqlIntBuilder, _a268, _b191, MySqlInt;
33646
34602
  var init_int = __esm({
33647
34603
  "../drizzle-orm/dist/mysql-core/columns/int.js"() {
33648
34604
  "use strict";
33649
34605
  init_entity();
33650
34606
  init_utils2();
33651
34607
  init_common4();
33652
- MySqlIntBuilder = class extends (_b190 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b190) {
34608
+ MySqlIntBuilder = class extends (_b190 = MySqlColumnBuilderWithAutoIncrement, _a267 = entityKind, _b190) {
33653
34609
  constructor(name2, config) {
33654
34610
  super(name2, "number", "MySqlInt");
33655
34611
  this.config.unsigned = config ? config.unsigned : false;
@@ -33659,8 +34615,8 @@ var init_int = __esm({
33659
34615
  return new MySqlInt(table4, this.config);
33660
34616
  }
33661
34617
  };
33662
- __publicField(MySqlIntBuilder, _a265, "MySqlIntBuilder");
33663
- MySqlInt = class extends (_b191 = MySqlColumnWithAutoIncrement, _a266 = entityKind, _b191) {
34618
+ __publicField(MySqlIntBuilder, _a267, "MySqlIntBuilder");
34619
+ MySqlInt = class extends (_b191 = MySqlColumnWithAutoIncrement, _a268 = entityKind, _b191) {
33664
34620
  getSQLType() {
33665
34621
  return `int${this.config.unsigned ? " unsigned" : ""}`;
33666
34622
  }
@@ -33671,7 +34627,7 @@ var init_int = __esm({
33671
34627
  return value;
33672
34628
  }
33673
34629
  };
33674
- __publicField(MySqlInt, _a266, "MySqlInt");
34630
+ __publicField(MySqlInt, _a268, "MySqlInt");
33675
34631
  }
33676
34632
  });
33677
34633
 
@@ -33679,13 +34635,13 @@ var init_int = __esm({
33679
34635
  function json2(name2) {
33680
34636
  return new MySqlJsonBuilder(name2 ?? "");
33681
34637
  }
33682
- var _a267, _b192, MySqlJsonBuilder, _a268, _b193, MySqlJson;
34638
+ var _a269, _b192, MySqlJsonBuilder, _a270, _b193, MySqlJson;
33683
34639
  var init_json2 = __esm({
33684
34640
  "../drizzle-orm/dist/mysql-core/columns/json.js"() {
33685
34641
  "use strict";
33686
34642
  init_entity();
33687
34643
  init_common4();
33688
- MySqlJsonBuilder = class extends (_b192 = MySqlColumnBuilder, _a267 = entityKind, _b192) {
34644
+ MySqlJsonBuilder = class extends (_b192 = MySqlColumnBuilder, _a269 = entityKind, _b192) {
33689
34645
  constructor(name2) {
33690
34646
  super(name2, "json", "MySqlJson");
33691
34647
  }
@@ -33694,8 +34650,8 @@ var init_json2 = __esm({
33694
34650
  return new MySqlJson(table4, this.config);
33695
34651
  }
33696
34652
  };
33697
- __publicField(MySqlJsonBuilder, _a267, "MySqlJsonBuilder");
33698
- MySqlJson = class extends (_b193 = MySqlColumn, _a268 = entityKind, _b193) {
34653
+ __publicField(MySqlJsonBuilder, _a269, "MySqlJsonBuilder");
34654
+ MySqlJson = class extends (_b193 = MySqlColumn, _a270 = entityKind, _b193) {
33699
34655
  getSQLType() {
33700
34656
  return "json";
33701
34657
  }
@@ -33703,7 +34659,7 @@ var init_json2 = __esm({
33703
34659
  return JSON.stringify(value);
33704
34660
  }
33705
34661
  };
33706
- __publicField(MySqlJson, _a268, "MySqlJson");
34662
+ __publicField(MySqlJson, _a270, "MySqlJson");
33707
34663
  }
33708
34664
  });
33709
34665
 
@@ -33712,14 +34668,14 @@ function mediumint(a, b) {
33712
34668
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33713
34669
  return new MySqlMediumIntBuilder(name2, config);
33714
34670
  }
33715
- var _a269, _b194, MySqlMediumIntBuilder, _a270, _b195, MySqlMediumInt;
34671
+ var _a271, _b194, MySqlMediumIntBuilder, _a272, _b195, MySqlMediumInt;
33716
34672
  var init_mediumint = __esm({
33717
34673
  "../drizzle-orm/dist/mysql-core/columns/mediumint.js"() {
33718
34674
  "use strict";
33719
34675
  init_entity();
33720
34676
  init_utils2();
33721
34677
  init_common4();
33722
- MySqlMediumIntBuilder = class extends (_b194 = MySqlColumnBuilderWithAutoIncrement, _a269 = entityKind, _b194) {
34678
+ MySqlMediumIntBuilder = class extends (_b194 = MySqlColumnBuilderWithAutoIncrement, _a271 = entityKind, _b194) {
33723
34679
  constructor(name2, config) {
33724
34680
  super(name2, "number", "MySqlMediumInt");
33725
34681
  this.config.unsigned = config ? config.unsigned : false;
@@ -33732,8 +34688,8 @@ var init_mediumint = __esm({
33732
34688
  );
33733
34689
  }
33734
34690
  };
33735
- __publicField(MySqlMediumIntBuilder, _a269, "MySqlMediumIntBuilder");
33736
- MySqlMediumInt = class extends (_b195 = MySqlColumnWithAutoIncrement, _a270 = entityKind, _b195) {
34691
+ __publicField(MySqlMediumIntBuilder, _a271, "MySqlMediumIntBuilder");
34692
+ MySqlMediumInt = class extends (_b195 = MySqlColumnWithAutoIncrement, _a272 = entityKind, _b195) {
33737
34693
  getSQLType() {
33738
34694
  return `mediumint${this.config.unsigned ? " unsigned" : ""}`;
33739
34695
  }
@@ -33744,7 +34700,7 @@ var init_mediumint = __esm({
33744
34700
  return value;
33745
34701
  }
33746
34702
  };
33747
- __publicField(MySqlMediumInt, _a270, "MySqlMediumInt");
34703
+ __publicField(MySqlMediumInt, _a272, "MySqlMediumInt");
33748
34704
  }
33749
34705
  });
33750
34706
 
@@ -33753,14 +34709,14 @@ function real3(a, b = {}) {
33753
34709
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33754
34710
  return new MySqlRealBuilder(name2, config);
33755
34711
  }
33756
- var _a271, _b196, MySqlRealBuilder, _a272, _b197, MySqlReal;
34712
+ var _a273, _b196, MySqlRealBuilder, _a274, _b197, MySqlReal;
33757
34713
  var init_real3 = __esm({
33758
34714
  "../drizzle-orm/dist/mysql-core/columns/real.js"() {
33759
34715
  "use strict";
33760
34716
  init_entity();
33761
34717
  init_utils2();
33762
34718
  init_common4();
33763
- MySqlRealBuilder = class extends (_b196 = MySqlColumnBuilderWithAutoIncrement, _a271 = entityKind, _b196) {
34719
+ MySqlRealBuilder = class extends (_b196 = MySqlColumnBuilderWithAutoIncrement, _a273 = entityKind, _b196) {
33764
34720
  constructor(name2, config) {
33765
34721
  super(name2, "number", "MySqlReal");
33766
34722
  this.config.precision = config?.precision;
@@ -33771,8 +34727,8 @@ var init_real3 = __esm({
33771
34727
  return new MySqlReal(table4, this.config);
33772
34728
  }
33773
34729
  };
33774
- __publicField(MySqlRealBuilder, _a271, "MySqlRealBuilder");
33775
- MySqlReal = class extends (_b197 = MySqlColumnWithAutoIncrement, _a272 = entityKind, _b197) {
34730
+ __publicField(MySqlRealBuilder, _a273, "MySqlRealBuilder");
34731
+ MySqlReal = class extends (_b197 = MySqlColumnWithAutoIncrement, _a274 = entityKind, _b197) {
33776
34732
  constructor() {
33777
34733
  super(...arguments);
33778
34734
  __publicField(this, "precision", this.config.precision);
@@ -33788,7 +34744,7 @@ var init_real3 = __esm({
33788
34744
  }
33789
34745
  }
33790
34746
  };
33791
- __publicField(MySqlReal, _a272, "MySqlReal");
34747
+ __publicField(MySqlReal, _a274, "MySqlReal");
33792
34748
  }
33793
34749
  });
33794
34750
 
@@ -33796,13 +34752,13 @@ var init_real3 = __esm({
33796
34752
  function serial2(name2) {
33797
34753
  return new MySqlSerialBuilder(name2 ?? "");
33798
34754
  }
33799
- var _a273, _b198, MySqlSerialBuilder, _a274, _b199, MySqlSerial;
34755
+ var _a275, _b198, MySqlSerialBuilder, _a276, _b199, MySqlSerial;
33800
34756
  var init_serial2 = __esm({
33801
34757
  "../drizzle-orm/dist/mysql-core/columns/serial.js"() {
33802
34758
  "use strict";
33803
34759
  init_entity();
33804
34760
  init_common4();
33805
- MySqlSerialBuilder = class extends (_b198 = MySqlColumnBuilderWithAutoIncrement, _a273 = entityKind, _b198) {
34761
+ MySqlSerialBuilder = class extends (_b198 = MySqlColumnBuilderWithAutoIncrement, _a275 = entityKind, _b198) {
33806
34762
  constructor(name2) {
33807
34763
  super(name2, "number", "MySqlSerial");
33808
34764
  this.config.hasDefault = true;
@@ -33813,8 +34769,8 @@ var init_serial2 = __esm({
33813
34769
  return new MySqlSerial(table4, this.config);
33814
34770
  }
33815
34771
  };
33816
- __publicField(MySqlSerialBuilder, _a273, "MySqlSerialBuilder");
33817
- MySqlSerial = class extends (_b199 = MySqlColumnWithAutoIncrement, _a274 = entityKind, _b199) {
34772
+ __publicField(MySqlSerialBuilder, _a275, "MySqlSerialBuilder");
34773
+ MySqlSerial = class extends (_b199 = MySqlColumnWithAutoIncrement, _a276 = entityKind, _b199) {
33818
34774
  getSQLType() {
33819
34775
  return "serial";
33820
34776
  }
@@ -33825,7 +34781,7 @@ var init_serial2 = __esm({
33825
34781
  return value;
33826
34782
  }
33827
34783
  };
33828
- __publicField(MySqlSerial, _a274, "MySqlSerial");
34784
+ __publicField(MySqlSerial, _a276, "MySqlSerial");
33829
34785
  }
33830
34786
  });
33831
34787
 
@@ -33834,14 +34790,14 @@ function smallint2(a, b) {
33834
34790
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33835
34791
  return new MySqlSmallIntBuilder(name2, config);
33836
34792
  }
33837
- var _a275, _b200, MySqlSmallIntBuilder, _a276, _b201, MySqlSmallInt;
34793
+ var _a277, _b200, MySqlSmallIntBuilder, _a278, _b201, MySqlSmallInt;
33838
34794
  var init_smallint2 = __esm({
33839
34795
  "../drizzle-orm/dist/mysql-core/columns/smallint.js"() {
33840
34796
  "use strict";
33841
34797
  init_entity();
33842
34798
  init_utils2();
33843
34799
  init_common4();
33844
- MySqlSmallIntBuilder = class extends (_b200 = MySqlColumnBuilderWithAutoIncrement, _a275 = entityKind, _b200) {
34800
+ MySqlSmallIntBuilder = class extends (_b200 = MySqlColumnBuilderWithAutoIncrement, _a277 = entityKind, _b200) {
33845
34801
  constructor(name2, config) {
33846
34802
  super(name2, "number", "MySqlSmallInt");
33847
34803
  this.config.unsigned = config ? config.unsigned : false;
@@ -33854,8 +34810,8 @@ var init_smallint2 = __esm({
33854
34810
  );
33855
34811
  }
33856
34812
  };
33857
- __publicField(MySqlSmallIntBuilder, _a275, "MySqlSmallIntBuilder");
33858
- MySqlSmallInt = class extends (_b201 = MySqlColumnWithAutoIncrement, _a276 = entityKind, _b201) {
34813
+ __publicField(MySqlSmallIntBuilder, _a277, "MySqlSmallIntBuilder");
34814
+ MySqlSmallInt = class extends (_b201 = MySqlColumnWithAutoIncrement, _a278 = entityKind, _b201) {
33859
34815
  getSQLType() {
33860
34816
  return `smallint${this.config.unsigned ? " unsigned" : ""}`;
33861
34817
  }
@@ -33866,7 +34822,7 @@ var init_smallint2 = __esm({
33866
34822
  return value;
33867
34823
  }
33868
34824
  };
33869
- __publicField(MySqlSmallInt, _a276, "MySqlSmallInt");
34825
+ __publicField(MySqlSmallInt, _a278, "MySqlSmallInt");
33870
34826
  }
33871
34827
  });
33872
34828
 
@@ -33875,14 +34831,14 @@ function text3(a, b = {}) {
33875
34831
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33876
34832
  return new MySqlTextBuilder(name2, "text", config);
33877
34833
  }
33878
- var _a277, _b202, MySqlTextBuilder, _a278, _b203, MySqlText;
34834
+ var _a279, _b202, MySqlTextBuilder, _a280, _b203, MySqlText;
33879
34835
  var init_text3 = __esm({
33880
34836
  "../drizzle-orm/dist/mysql-core/columns/text.js"() {
33881
34837
  "use strict";
33882
34838
  init_entity();
33883
34839
  init_utils2();
33884
34840
  init_common4();
33885
- MySqlTextBuilder = class extends (_b202 = MySqlColumnBuilder, _a277 = entityKind, _b202) {
34841
+ MySqlTextBuilder = class extends (_b202 = MySqlColumnBuilder, _a279 = entityKind, _b202) {
33886
34842
  constructor(name2, textType, config) {
33887
34843
  super(name2, "string", "MySqlText");
33888
34844
  this.config.textType = textType;
@@ -33893,8 +34849,8 @@ var init_text3 = __esm({
33893
34849
  return new MySqlText(table4, this.config);
33894
34850
  }
33895
34851
  };
33896
- __publicField(MySqlTextBuilder, _a277, "MySqlTextBuilder");
33897
- MySqlText = class extends (_b203 = MySqlColumn, _a278 = entityKind, _b203) {
34852
+ __publicField(MySqlTextBuilder, _a279, "MySqlTextBuilder");
34853
+ MySqlText = class extends (_b203 = MySqlColumn, _a280 = entityKind, _b203) {
33898
34854
  constructor() {
33899
34855
  super(...arguments);
33900
34856
  __publicField(this, "textType", this.config.textType);
@@ -33904,7 +34860,7 @@ var init_text3 = __esm({
33904
34860
  return this.textType;
33905
34861
  }
33906
34862
  };
33907
- __publicField(MySqlText, _a278, "MySqlText");
34863
+ __publicField(MySqlText, _a280, "MySqlText");
33908
34864
  }
33909
34865
  });
33910
34866
 
@@ -33913,14 +34869,14 @@ function time2(a, b) {
33913
34869
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33914
34870
  return new MySqlTimeBuilder(name2, config);
33915
34871
  }
33916
- var _a279, _b204, MySqlTimeBuilder, _a280, _b205, MySqlTime;
34872
+ var _a281, _b204, MySqlTimeBuilder, _a282, _b205, MySqlTime;
33917
34873
  var init_time2 = __esm({
33918
34874
  "../drizzle-orm/dist/mysql-core/columns/time.js"() {
33919
34875
  "use strict";
33920
34876
  init_entity();
33921
34877
  init_utils2();
33922
34878
  init_common4();
33923
- MySqlTimeBuilder = class extends (_b204 = MySqlColumnBuilder, _a279 = entityKind, _b204) {
34879
+ MySqlTimeBuilder = class extends (_b204 = MySqlColumnBuilder, _a281 = entityKind, _b204) {
33924
34880
  constructor(name2, config) {
33925
34881
  super(name2, "string", "MySqlTime");
33926
34882
  this.config.fsp = config?.fsp;
@@ -33930,8 +34886,8 @@ var init_time2 = __esm({
33930
34886
  return new MySqlTime(table4, this.config);
33931
34887
  }
33932
34888
  };
33933
- __publicField(MySqlTimeBuilder, _a279, "MySqlTimeBuilder");
33934
- MySqlTime = class extends (_b205 = MySqlColumn, _a280 = entityKind, _b205) {
34889
+ __publicField(MySqlTimeBuilder, _a281, "MySqlTimeBuilder");
34890
+ MySqlTime = class extends (_b205 = MySqlColumn, _a282 = entityKind, _b205) {
33935
34891
  constructor() {
33936
34892
  super(...arguments);
33937
34893
  __publicField(this, "fsp", this.config.fsp);
@@ -33941,19 +34897,19 @@ var init_time2 = __esm({
33941
34897
  return `time${precision}`;
33942
34898
  }
33943
34899
  };
33944
- __publicField(MySqlTime, _a280, "MySqlTime");
34900
+ __publicField(MySqlTime, _a282, "MySqlTime");
33945
34901
  }
33946
34902
  });
33947
34903
 
33948
34904
  // ../drizzle-orm/dist/mysql-core/columns/date.common.js
33949
- var _a281, _b206, MySqlDateColumnBaseBuilder, _a282, _b207, MySqlDateBaseColumn;
34905
+ var _a283, _b206, MySqlDateColumnBaseBuilder, _a284, _b207, MySqlDateBaseColumn;
33950
34906
  var init_date_common2 = __esm({
33951
34907
  "../drizzle-orm/dist/mysql-core/columns/date.common.js"() {
33952
34908
  "use strict";
33953
34909
  init_entity();
33954
34910
  init_sql();
33955
34911
  init_common4();
33956
- MySqlDateColumnBaseBuilder = class extends (_b206 = MySqlColumnBuilder, _a281 = entityKind, _b206) {
34912
+ MySqlDateColumnBaseBuilder = class extends (_b206 = MySqlColumnBuilder, _a283 = entityKind, _b206) {
33957
34913
  defaultNow() {
33958
34914
  return this.default(sql`(now())`);
33959
34915
  }
@@ -33964,14 +34920,14 @@ var init_date_common2 = __esm({
33964
34920
  return this;
33965
34921
  }
33966
34922
  };
33967
- __publicField(MySqlDateColumnBaseBuilder, _a281, "MySqlDateColumnBuilder");
33968
- MySqlDateBaseColumn = class extends (_b207 = MySqlColumn, _a282 = entityKind, _b207) {
34923
+ __publicField(MySqlDateColumnBaseBuilder, _a283, "MySqlDateColumnBuilder");
34924
+ MySqlDateBaseColumn = class extends (_b207 = MySqlColumn, _a284 = entityKind, _b207) {
33969
34925
  constructor() {
33970
34926
  super(...arguments);
33971
34927
  __publicField(this, "hasOnUpdateNow", this.config.hasOnUpdateNow);
33972
34928
  }
33973
34929
  };
33974
- __publicField(MySqlDateBaseColumn, _a282, "MySqlDateColumn");
34930
+ __publicField(MySqlDateBaseColumn, _a284, "MySqlDateColumn");
33975
34931
  }
33976
34932
  });
33977
34933
 
@@ -33983,14 +34939,14 @@ function timestamp2(a, b = {}) {
33983
34939
  }
33984
34940
  return new MySqlTimestampBuilder(name2, config);
33985
34941
  }
33986
- var _a283, _b208, MySqlTimestampBuilder, _a284, _b209, MySqlTimestamp, _a285, _b210, MySqlTimestampStringBuilder, _a286, _b211, MySqlTimestampString;
34942
+ var _a285, _b208, MySqlTimestampBuilder, _a286, _b209, MySqlTimestamp, _a287, _b210, MySqlTimestampStringBuilder, _a288, _b211, MySqlTimestampString;
33987
34943
  var init_timestamp2 = __esm({
33988
34944
  "../drizzle-orm/dist/mysql-core/columns/timestamp.js"() {
33989
34945
  "use strict";
33990
34946
  init_entity();
33991
34947
  init_utils2();
33992
34948
  init_date_common2();
33993
- MySqlTimestampBuilder = class extends (_b208 = MySqlDateColumnBaseBuilder, _a283 = entityKind, _b208) {
34949
+ MySqlTimestampBuilder = class extends (_b208 = MySqlDateColumnBaseBuilder, _a285 = entityKind, _b208) {
33994
34950
  constructor(name2, config) {
33995
34951
  super(name2, "date", "MySqlTimestamp");
33996
34952
  this.config.fsp = config?.fsp;
@@ -34003,8 +34959,8 @@ var init_timestamp2 = __esm({
34003
34959
  );
34004
34960
  }
34005
34961
  };
34006
- __publicField(MySqlTimestampBuilder, _a283, "MySqlTimestampBuilder");
34007
- MySqlTimestamp = class extends (_b209 = MySqlDateBaseColumn, _a284 = entityKind, _b209) {
34962
+ __publicField(MySqlTimestampBuilder, _a285, "MySqlTimestampBuilder");
34963
+ MySqlTimestamp = class extends (_b209 = MySqlDateBaseColumn, _a286 = entityKind, _b209) {
34008
34964
  constructor() {
34009
34965
  super(...arguments);
34010
34966
  __publicField(this, "fsp", this.config.fsp);
@@ -34020,8 +34976,8 @@ var init_timestamp2 = __esm({
34020
34976
  return value.toISOString().slice(0, -1).replace("T", " ");
34021
34977
  }
34022
34978
  };
34023
- __publicField(MySqlTimestamp, _a284, "MySqlTimestamp");
34024
- MySqlTimestampStringBuilder = class extends (_b210 = MySqlDateColumnBaseBuilder, _a285 = entityKind, _b210) {
34979
+ __publicField(MySqlTimestamp, _a286, "MySqlTimestamp");
34980
+ MySqlTimestampStringBuilder = class extends (_b210 = MySqlDateColumnBaseBuilder, _a287 = entityKind, _b210) {
34025
34981
  constructor(name2, config) {
34026
34982
  super(name2, "string", "MySqlTimestampString");
34027
34983
  this.config.fsp = config?.fsp;
@@ -34034,8 +34990,8 @@ var init_timestamp2 = __esm({
34034
34990
  );
34035
34991
  }
34036
34992
  };
34037
- __publicField(MySqlTimestampStringBuilder, _a285, "MySqlTimestampStringBuilder");
34038
- MySqlTimestampString = class extends (_b211 = MySqlDateBaseColumn, _a286 = entityKind, _b211) {
34993
+ __publicField(MySqlTimestampStringBuilder, _a287, "MySqlTimestampStringBuilder");
34994
+ MySqlTimestampString = class extends (_b211 = MySqlDateBaseColumn, _a288 = entityKind, _b211) {
34039
34995
  constructor() {
34040
34996
  super(...arguments);
34041
34997
  __publicField(this, "fsp", this.config.fsp);
@@ -34045,7 +35001,7 @@ var init_timestamp2 = __esm({
34045
35001
  return `timestamp${precision}`;
34046
35002
  }
34047
35003
  };
34048
- __publicField(MySqlTimestampString, _a286, "MySqlTimestampString");
35004
+ __publicField(MySqlTimestampString, _a288, "MySqlTimestampString");
34049
35005
  }
34050
35006
  });
34051
35007
 
@@ -34054,14 +35010,14 @@ function tinyint(a, b) {
34054
35010
  const { name: name2, config } = getColumnNameAndConfig(a, b);
34055
35011
  return new MySqlTinyIntBuilder(name2, config);
34056
35012
  }
34057
- var _a287, _b212, MySqlTinyIntBuilder, _a288, _b213, MySqlTinyInt;
35013
+ var _a289, _b212, MySqlTinyIntBuilder, _a290, _b213, MySqlTinyInt;
34058
35014
  var init_tinyint = __esm({
34059
35015
  "../drizzle-orm/dist/mysql-core/columns/tinyint.js"() {
34060
35016
  "use strict";
34061
35017
  init_entity();
34062
35018
  init_utils2();
34063
35019
  init_common4();
34064
- MySqlTinyIntBuilder = class extends (_b212 = MySqlColumnBuilderWithAutoIncrement, _a287 = entityKind, _b212) {
35020
+ MySqlTinyIntBuilder = class extends (_b212 = MySqlColumnBuilderWithAutoIncrement, _a289 = entityKind, _b212) {
34065
35021
  constructor(name2, config) {
34066
35022
  super(name2, "number", "MySqlTinyInt");
34067
35023
  this.config.unsigned = config ? config.unsigned : false;
@@ -34074,8 +35030,8 @@ var init_tinyint = __esm({
34074
35030
  );
34075
35031
  }
34076
35032
  };
34077
- __publicField(MySqlTinyIntBuilder, _a287, "MySqlTinyIntBuilder");
34078
- MySqlTinyInt = class extends (_b213 = MySqlColumnWithAutoIncrement, _a288 = entityKind, _b213) {
35033
+ __publicField(MySqlTinyIntBuilder, _a289, "MySqlTinyIntBuilder");
35034
+ MySqlTinyInt = class extends (_b213 = MySqlColumnWithAutoIncrement, _a290 = entityKind, _b213) {
34079
35035
  getSQLType() {
34080
35036
  return `tinyint${this.config.unsigned ? " unsigned" : ""}`;
34081
35037
  }
@@ -34086,7 +35042,7 @@ var init_tinyint = __esm({
34086
35042
  return value;
34087
35043
  }
34088
35044
  };
34089
- __publicField(MySqlTinyInt, _a288, "MySqlTinyInt");
35045
+ __publicField(MySqlTinyInt, _a290, "MySqlTinyInt");
34090
35046
  }
34091
35047
  });
34092
35048
 
@@ -34095,14 +35051,14 @@ function varbinary(a, b) {
34095
35051
  const { name: name2, config } = getColumnNameAndConfig(a, b);
34096
35052
  return new MySqlVarBinaryBuilder(name2, config);
34097
35053
  }
34098
- var _a289, _b214, MySqlVarBinaryBuilder, _a290, _b215, MySqlVarBinary;
35054
+ var _a291, _b214, MySqlVarBinaryBuilder, _a292, _b215, MySqlVarBinary;
34099
35055
  var init_varbinary = __esm({
34100
35056
  "../drizzle-orm/dist/mysql-core/columns/varbinary.js"() {
34101
35057
  "use strict";
34102
35058
  init_entity();
34103
35059
  init_utils2();
34104
35060
  init_common4();
34105
- MySqlVarBinaryBuilder = class extends (_b214 = MySqlColumnBuilder, _a289 = entityKind, _b214) {
35061
+ MySqlVarBinaryBuilder = class extends (_b214 = MySqlColumnBuilder, _a291 = entityKind, _b214) {
34106
35062
  /** @internal */
34107
35063
  constructor(name2, config) {
34108
35064
  super(name2, "string", "MySqlVarBinary");
@@ -34116,8 +35072,8 @@ var init_varbinary = __esm({
34116
35072
  );
34117
35073
  }
34118
35074
  };
34119
- __publicField(MySqlVarBinaryBuilder, _a289, "MySqlVarBinaryBuilder");
34120
- MySqlVarBinary = class extends (_b215 = MySqlColumn, _a290 = entityKind, _b215) {
35075
+ __publicField(MySqlVarBinaryBuilder, _a291, "MySqlVarBinaryBuilder");
35076
+ MySqlVarBinary = class extends (_b215 = MySqlColumn, _a292 = entityKind, _b215) {
34121
35077
  constructor() {
34122
35078
  super(...arguments);
34123
35079
  __publicField(this, "length", this.config.length);
@@ -34126,7 +35082,7 @@ var init_varbinary = __esm({
34126
35082
  return this.length === void 0 ? `varbinary` : `varbinary(${this.length})`;
34127
35083
  }
34128
35084
  };
34129
- __publicField(MySqlVarBinary, _a290, "MySqlVarBinary");
35085
+ __publicField(MySqlVarBinary, _a292, "MySqlVarBinary");
34130
35086
  }
34131
35087
  });
34132
35088
 
@@ -34135,14 +35091,14 @@ function varchar2(a, b) {
34135
35091
  const { name: name2, config } = getColumnNameAndConfig(a, b);
34136
35092
  return new MySqlVarCharBuilder(name2, config);
34137
35093
  }
34138
- var _a291, _b216, MySqlVarCharBuilder, _a292, _b217, MySqlVarChar;
35094
+ var _a293, _b216, MySqlVarCharBuilder, _a294, _b217, MySqlVarChar;
34139
35095
  var init_varchar2 = __esm({
34140
35096
  "../drizzle-orm/dist/mysql-core/columns/varchar.js"() {
34141
35097
  "use strict";
34142
35098
  init_entity();
34143
35099
  init_utils2();
34144
35100
  init_common4();
34145
- MySqlVarCharBuilder = class extends (_b216 = MySqlColumnBuilder, _a291 = entityKind, _b216) {
35101
+ MySqlVarCharBuilder = class extends (_b216 = MySqlColumnBuilder, _a293 = entityKind, _b216) {
34146
35102
  /** @internal */
34147
35103
  constructor(name2, config) {
34148
35104
  super(name2, "string", "MySqlVarChar");
@@ -34157,8 +35113,8 @@ var init_varchar2 = __esm({
34157
35113
  );
34158
35114
  }
34159
35115
  };
34160
- __publicField(MySqlVarCharBuilder, _a291, "MySqlVarCharBuilder");
34161
- MySqlVarChar = class extends (_b217 = MySqlColumn, _a292 = entityKind, _b217) {
35116
+ __publicField(MySqlVarCharBuilder, _a293, "MySqlVarCharBuilder");
35117
+ MySqlVarChar = class extends (_b217 = MySqlColumn, _a294 = entityKind, _b217) {
34162
35118
  constructor() {
34163
35119
  super(...arguments);
34164
35120
  __publicField(this, "length", this.config.length);
@@ -34168,7 +35124,7 @@ var init_varchar2 = __esm({
34168
35124
  return this.length === void 0 ? `varchar` : `varchar(${this.length})`;
34169
35125
  }
34170
35126
  };
34171
- __publicField(MySqlVarChar, _a292, "MySqlVarChar");
35127
+ __publicField(MySqlVarChar, _a294, "MySqlVarChar");
34172
35128
  }
34173
35129
  });
34174
35130
 
@@ -34176,13 +35132,13 @@ var init_varchar2 = __esm({
34176
35132
  function year(name2) {
34177
35133
  return new MySqlYearBuilder(name2 ?? "");
34178
35134
  }
34179
- var _a293, _b218, MySqlYearBuilder, _a294, _b219, MySqlYear;
35135
+ var _a295, _b218, MySqlYearBuilder, _a296, _b219, MySqlYear;
34180
35136
  var init_year = __esm({
34181
35137
  "../drizzle-orm/dist/mysql-core/columns/year.js"() {
34182
35138
  "use strict";
34183
35139
  init_entity();
34184
35140
  init_common4();
34185
- MySqlYearBuilder = class extends (_b218 = MySqlColumnBuilder, _a293 = entityKind, _b218) {
35141
+ MySqlYearBuilder = class extends (_b218 = MySqlColumnBuilder, _a295 = entityKind, _b218) {
34186
35142
  constructor(name2) {
34187
35143
  super(name2, "number", "MySqlYear");
34188
35144
  }
@@ -34191,13 +35147,13 @@ var init_year = __esm({
34191
35147
  return new MySqlYear(table4, this.config);
34192
35148
  }
34193
35149
  };
34194
- __publicField(MySqlYearBuilder, _a293, "MySqlYearBuilder");
34195
- MySqlYear = class extends (_b219 = MySqlColumn, _a294 = entityKind, _b219) {
35150
+ __publicField(MySqlYearBuilder, _a295, "MySqlYearBuilder");
35151
+ MySqlYear = class extends (_b219 = MySqlColumn, _a296 = entityKind, _b219) {
34196
35152
  getSQLType() {
34197
35153
  return `year`;
34198
35154
  }
34199
35155
  };
34200
- __publicField(MySqlYear, _a294, "MySqlYear");
35156
+ __publicField(MySqlYear, _a296, "MySqlYear");
34201
35157
  }
34202
35158
  });
34203
35159
 
@@ -34234,17 +35190,17 @@ var init_columns3 = __esm({
34234
35190
  });
34235
35191
 
34236
35192
  // ../drizzle-orm/dist/mysql-core/query-builders/count.js
34237
- var _a295, _b220, _c8, _MySqlCountBuilder, MySqlCountBuilder;
35193
+ var _a297, _b220, _c8, _MySqlCountBuilder, MySqlCountBuilder;
34238
35194
  var init_count3 = __esm({
34239
35195
  "../drizzle-orm/dist/mysql-core/query-builders/count.js"() {
34240
35196
  "use strict";
34241
35197
  init_entity();
34242
35198
  init_sql();
34243
- _MySqlCountBuilder = class _MySqlCountBuilder extends (_c8 = SQL, _b220 = entityKind, _a295 = Symbol.toStringTag, _c8) {
35199
+ _MySqlCountBuilder = class _MySqlCountBuilder extends (_c8 = SQL, _b220 = entityKind, _a297 = Symbol.toStringTag, _c8) {
34244
35200
  constructor(params) {
34245
35201
  super(_MySqlCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
34246
35202
  __publicField(this, "sql");
34247
- __publicField(this, _a295, "MySqlCountBuilder");
35203
+ __publicField(this, _a297, "MySqlCountBuilder");
34248
35204
  __publicField(this, "session");
34249
35205
  this.params = params;
34250
35206
  this.mapWith(Number);
@@ -34288,7 +35244,7 @@ var init_count3 = __esm({
34288
35244
  });
34289
35245
 
34290
35246
  // ../drizzle-orm/dist/mysql-core/query-builders/delete.js
34291
- var _a296, _b221, MySqlDeleteBase;
35247
+ var _a298, _b221, MySqlDeleteBase;
34292
35248
  var init_delete3 = __esm({
34293
35249
  "../drizzle-orm/dist/mysql-core/query-builders/delete.js"() {
34294
35250
  "use strict";
@@ -34296,7 +35252,7 @@ var init_delete3 = __esm({
34296
35252
  init_query_promise();
34297
35253
  init_selection_proxy();
34298
35254
  init_table();
34299
- MySqlDeleteBase = class extends (_b221 = QueryPromise, _a296 = entityKind, _b221) {
35255
+ MySqlDeleteBase = class extends (_b221 = QueryPromise, _a298 = entityKind, _b221) {
34300
35256
  constructor(table4, session, dialect4, withList) {
34301
35257
  super();
34302
35258
  __publicField(this, "config");
@@ -34386,12 +35342,12 @@ var init_delete3 = __esm({
34386
35342
  return this;
34387
35343
  }
34388
35344
  };
34389
- __publicField(MySqlDeleteBase, _a296, "MySqlDelete");
35345
+ __publicField(MySqlDeleteBase, _a298, "MySqlDelete");
34390
35346
  }
34391
35347
  });
34392
35348
 
34393
35349
  // ../drizzle-orm/dist/mysql-core/query-builders/insert.js
34394
- var _a297, MySqlInsertBuilder, _a298, _b222, MySqlInsertBase;
35350
+ var _a299, MySqlInsertBuilder, _a300, _b222, MySqlInsertBase;
34395
35351
  var init_insert3 = __esm({
34396
35352
  "../drizzle-orm/dist/mysql-core/query-builders/insert.js"() {
34397
35353
  "use strict";
@@ -34400,7 +35356,7 @@ var init_insert3 = __esm({
34400
35356
  init_sql();
34401
35357
  init_table();
34402
35358
  init_utils2();
34403
- _a297 = entityKind;
35359
+ _a299 = entityKind;
34404
35360
  MySqlInsertBuilder = class {
34405
35361
  constructor(table4, session, dialect4) {
34406
35362
  __publicField(this, "shouldIgnore", false);
@@ -34429,8 +35385,8 @@ var init_insert3 = __esm({
34429
35385
  return new MySqlInsertBase(this.table, mappedValues, this.shouldIgnore, this.session, this.dialect);
34430
35386
  }
34431
35387
  };
34432
- __publicField(MySqlInsertBuilder, _a297, "MySqlInsertBuilder");
34433
- MySqlInsertBase = class extends (_b222 = QueryPromise, _a298 = entityKind, _b222) {
35388
+ __publicField(MySqlInsertBuilder, _a299, "MySqlInsertBuilder");
35389
+ MySqlInsertBase = class extends (_b222 = QueryPromise, _a300 = entityKind, _b222) {
34434
35390
  constructor(table4, values, ignore, session, dialect4) {
34435
35391
  super();
34436
35392
  __publicField(this, "config");
@@ -34511,7 +35467,7 @@ var init_insert3 = __esm({
34511
35467
  return this;
34512
35468
  }
34513
35469
  };
34514
- __publicField(MySqlInsertBase, _a298, "MySqlInsert");
35470
+ __publicField(MySqlInsertBase, _a300, "MySqlInsert");
34515
35471
  }
34516
35472
  });
34517
35473
 
@@ -34595,7 +35551,7 @@ function mysqlTableWithSchema(name2, columns, extraConfig, schema4, baseName = n
34595
35551
  }
34596
35552
  return table4;
34597
35553
  }
34598
- var InlineForeignKeys3, _a299, _b223, _c9, _d4, _e3, MySqlTable, mysqlTable;
35554
+ var InlineForeignKeys3, _a301, _b223, _c9, _d4, _e4, MySqlTable, mysqlTable;
34599
35555
  var init_table4 = __esm({
34600
35556
  "../drizzle-orm/dist/mysql-core/table.js"() {
34601
35557
  "use strict";
@@ -34603,7 +35559,7 @@ var init_table4 = __esm({
34603
35559
  init_table();
34604
35560
  init_all3();
34605
35561
  InlineForeignKeys3 = Symbol.for("drizzle:MySqlInlineForeignKeys");
34606
- MySqlTable = class extends (_e3 = Table, _d4 = entityKind, _c9 = Table.Symbol.Columns, _b223 = InlineForeignKeys3, _a299 = Table.Symbol.ExtraConfigBuilder, _e3) {
35562
+ MySqlTable = class extends (_e4 = Table, _d4 = entityKind, _c9 = Table.Symbol.Columns, _b223 = InlineForeignKeys3, _a301 = Table.Symbol.ExtraConfigBuilder, _e4) {
34607
35563
  constructor() {
34608
35564
  super(...arguments);
34609
35565
  /** @internal */
@@ -34611,7 +35567,7 @@ var init_table4 = __esm({
34611
35567
  /** @internal */
34612
35568
  __publicField(this, _b223, []);
34613
35569
  /** @internal */
34614
- __publicField(this, _a299);
35570
+ __publicField(this, _a301);
34615
35571
  }
34616
35572
  };
34617
35573
  __publicField(MySqlTable, _d4, "MySqlTable");
@@ -34626,20 +35582,20 @@ var init_table4 = __esm({
34626
35582
  });
34627
35583
 
34628
35584
  // ../drizzle-orm/dist/mysql-core/view-base.js
34629
- var _a300, _b224, MySqlViewBase;
35585
+ var _a302, _b224, MySqlViewBase;
34630
35586
  var init_view_base3 = __esm({
34631
35587
  "../drizzle-orm/dist/mysql-core/view-base.js"() {
34632
35588
  "use strict";
34633
35589
  init_entity();
34634
35590
  init_sql();
34635
- MySqlViewBase = class extends (_b224 = View3, _a300 = entityKind, _b224) {
35591
+ MySqlViewBase = class extends (_b224 = View3, _a302 = entityKind, _b224) {
34636
35592
  };
34637
- __publicField(MySqlViewBase, _a300, "MySqlViewBase");
35593
+ __publicField(MySqlViewBase, _a302, "MySqlViewBase");
34638
35594
  }
34639
35595
  });
34640
35596
 
34641
35597
  // ../drizzle-orm/dist/mysql-core/dialect.js
34642
- var _a301, MySqlDialect;
35598
+ var _a303, MySqlDialect;
34643
35599
  var init_dialect3 = __esm({
34644
35600
  "../drizzle-orm/dist/mysql-core/dialect.js"() {
34645
35601
  "use strict";
@@ -34658,7 +35614,7 @@ var init_dialect3 = __esm({
34658
35614
  init_common4();
34659
35615
  init_table4();
34660
35616
  init_view_base3();
34661
- _a301 = entityKind;
35617
+ _a303 = entityKind;
34662
35618
  MySqlDialect = class {
34663
35619
  constructor(config) {
34664
35620
  /** @internal */
@@ -35444,7 +36400,7 @@ var init_dialect3 = __esm({
35444
36400
  };
35445
36401
  }
35446
36402
  };
35447
- __publicField(MySqlDialect, _a301, "MySqlDialect");
36403
+ __publicField(MySqlDialect, _a303, "MySqlDialect");
35448
36404
  }
35449
36405
  });
35450
36406
 
@@ -35466,7 +36422,7 @@ function createSetOperator3(type, isAll) {
35466
36422
  return leftSelect.addSetOperators(setOperators);
35467
36423
  };
35468
36424
  }
35469
- var _a302, MySqlSelectBuilder, _a303, _b225, MySqlSelectQueryBuilderBase, _a304, _b226, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
36425
+ var _a304, MySqlSelectBuilder, _a305, _b225, MySqlSelectQueryBuilderBase, _a306, _b226, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
35470
36426
  var init_select4 = __esm({
35471
36427
  "../drizzle-orm/dist/mysql-core/query-builders/select.js"() {
35472
36428
  "use strict";
@@ -35481,7 +36437,7 @@ var init_select4 = __esm({
35481
36437
  init_utils2();
35482
36438
  init_view_common();
35483
36439
  init_view_base3();
35484
- _a302 = entityKind;
36440
+ _a304 = entityKind;
35485
36441
  MySqlSelectBuilder = class {
35486
36442
  constructor(config) {
35487
36443
  __publicField(this, "fields");
@@ -35526,8 +36482,8 @@ var init_select4 = __esm({
35526
36482
  );
35527
36483
  }
35528
36484
  };
35529
- __publicField(MySqlSelectBuilder, _a302, "MySqlSelectBuilder");
35530
- MySqlSelectQueryBuilderBase = class extends (_b225 = TypedQueryBuilder, _a303 = entityKind, _b225) {
36485
+ __publicField(MySqlSelectBuilder, _a304, "MySqlSelectBuilder");
36486
+ MySqlSelectQueryBuilderBase = class extends (_b225 = TypedQueryBuilder, _a305 = entityKind, _b225) {
35531
36487
  constructor({ table: table4, fields, isPartialSelect, session, dialect: dialect4, withList, distinct }) {
35532
36488
  super();
35533
36489
  __publicField(this, "_");
@@ -36128,8 +37084,8 @@ var init_select4 = __esm({
36128
37084
  return this;
36129
37085
  }
36130
37086
  };
36131
- __publicField(MySqlSelectQueryBuilderBase, _a303, "MySqlSelectQueryBuilder");
36132
- MySqlSelectBase = class extends (_b226 = MySqlSelectQueryBuilderBase, _a304 = entityKind, _b226) {
37087
+ __publicField(MySqlSelectQueryBuilderBase, _a305, "MySqlSelectQueryBuilder");
37088
+ MySqlSelectBase = class extends (_b226 = MySqlSelectQueryBuilderBase, _a306 = entityKind, _b226) {
36133
37089
  constructor() {
36134
37090
  super(...arguments);
36135
37091
  __publicField(this, "execute", (placeholderValues) => {
@@ -36153,7 +37109,7 @@ var init_select4 = __esm({
36153
37109
  return query;
36154
37110
  }
36155
37111
  };
36156
- __publicField(MySqlSelectBase, _a304, "MySqlSelect");
37112
+ __publicField(MySqlSelectBase, _a306, "MySqlSelect");
36157
37113
  applyMixins(MySqlSelectBase, [QueryPromise]);
36158
37114
  getMySqlSetOperators = () => ({
36159
37115
  union: union3,
@@ -36173,7 +37129,7 @@ var init_select4 = __esm({
36173
37129
  });
36174
37130
 
36175
37131
  // ../drizzle-orm/dist/mysql-core/query-builders/query-builder.js
36176
- var _a305, QueryBuilder3;
37132
+ var _a307, QueryBuilder3;
36177
37133
  var init_query_builder4 = __esm({
36178
37134
  "../drizzle-orm/dist/mysql-core/query-builders/query-builder.js"() {
36179
37135
  "use strict";
@@ -36182,7 +37138,7 @@ var init_query_builder4 = __esm({
36182
37138
  init_selection_proxy();
36183
37139
  init_subquery();
36184
37140
  init_select4();
36185
- _a305 = entityKind;
37141
+ _a307 = entityKind;
36186
37142
  QueryBuilder3 = class {
36187
37143
  constructor(dialect4) {
36188
37144
  __publicField(this, "dialect");
@@ -36244,7 +37200,7 @@ var init_query_builder4 = __esm({
36244
37200
  return this.dialect;
36245
37201
  }
36246
37202
  };
36247
- __publicField(QueryBuilder3, _a305, "MySqlQueryBuilder");
37203
+ __publicField(QueryBuilder3, _a307, "MySqlQueryBuilder");
36248
37204
  }
36249
37205
  });
36250
37206
 
@@ -36256,7 +37212,7 @@ var init_select_types3 = __esm({
36256
37212
  });
36257
37213
 
36258
37214
  // ../drizzle-orm/dist/mysql-core/query-builders/update.js
36259
- var _a306, MySqlUpdateBuilder, _a307, _b227, MySqlUpdateBase;
37215
+ var _a308, MySqlUpdateBuilder, _a309, _b227, MySqlUpdateBase;
36260
37216
  var init_update3 = __esm({
36261
37217
  "../drizzle-orm/dist/mysql-core/query-builders/update.js"() {
36262
37218
  "use strict";
@@ -36265,7 +37221,7 @@ var init_update3 = __esm({
36265
37221
  init_selection_proxy();
36266
37222
  init_table();
36267
37223
  init_utils2();
36268
- _a306 = entityKind;
37224
+ _a308 = entityKind;
36269
37225
  MySqlUpdateBuilder = class {
36270
37226
  constructor(table4, session, dialect4, withList) {
36271
37227
  this.table = table4;
@@ -36277,8 +37233,8 @@ var init_update3 = __esm({
36277
37233
  return new MySqlUpdateBase(this.table, mapUpdateSet(this.table, values), this.session, this.dialect, this.withList);
36278
37234
  }
36279
37235
  };
36280
- __publicField(MySqlUpdateBuilder, _a306, "MySqlUpdateBuilder");
36281
- MySqlUpdateBase = class extends (_b227 = QueryPromise, _a307 = entityKind, _b227) {
37236
+ __publicField(MySqlUpdateBuilder, _a308, "MySqlUpdateBuilder");
37237
+ MySqlUpdateBase = class extends (_b227 = QueryPromise, _a309 = entityKind, _b227) {
36282
37238
  constructor(table4, set, session, dialect4, withList) {
36283
37239
  super();
36284
37240
  __publicField(this, "config");
@@ -36371,7 +37327,7 @@ var init_update3 = __esm({
36371
37327
  return this;
36372
37328
  }
36373
37329
  };
36374
- __publicField(MySqlUpdateBase, _a307, "MySqlUpdate");
37330
+ __publicField(MySqlUpdateBase, _a309, "MySqlUpdate");
36375
37331
  }
36376
37332
  });
36377
37333
 
@@ -36389,14 +37345,14 @@ var init_query_builders3 = __esm({
36389
37345
  });
36390
37346
 
36391
37347
  // ../drizzle-orm/dist/mysql-core/query-builders/query.js
36392
- var _a308, RelationalQueryBuilder3, _a309, _b228, MySqlRelationalQuery;
37348
+ var _a310, RelationalQueryBuilder3, _a311, _b228, MySqlRelationalQuery;
36393
37349
  var init_query3 = __esm({
36394
37350
  "../drizzle-orm/dist/mysql-core/query-builders/query.js"() {
36395
37351
  "use strict";
36396
37352
  init_entity();
36397
37353
  init_query_promise();
36398
37354
  init_relations();
36399
- _a308 = entityKind;
37355
+ _a310 = entityKind;
36400
37356
  RelationalQueryBuilder3 = class {
36401
37357
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, mode) {
36402
37358
  this.fullSchema = fullSchema;
@@ -36437,8 +37393,8 @@ var init_query3 = __esm({
36437
37393
  );
36438
37394
  }
36439
37395
  };
36440
- __publicField(RelationalQueryBuilder3, _a308, "MySqlRelationalQueryBuilder");
36441
- MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a309 = entityKind, _b228) {
37396
+ __publicField(RelationalQueryBuilder3, _a310, "MySqlRelationalQueryBuilder");
37397
+ MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a311 = entityKind, _b228) {
36442
37398
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, config, queryMode, mode) {
36443
37399
  super();
36444
37400
  this.fullSchema = fullSchema;
@@ -36502,12 +37458,12 @@ var init_query3 = __esm({
36502
37458
  return this.prepare().execute();
36503
37459
  }
36504
37460
  };
36505
- __publicField(MySqlRelationalQuery, _a309, "MySqlRelationalQuery");
37461
+ __publicField(MySqlRelationalQuery, _a311, "MySqlRelationalQuery");
36506
37462
  }
36507
37463
  });
36508
37464
 
36509
37465
  // ../drizzle-orm/dist/mysql-core/db.js
36510
- var _a310, MySqlDatabase;
37466
+ var _a312, MySqlDatabase;
36511
37467
  var init_db3 = __esm({
36512
37468
  "../drizzle-orm/dist/mysql-core/db.js"() {
36513
37469
  "use strict";
@@ -36518,7 +37474,7 @@ var init_db3 = __esm({
36518
37474
  init_count3();
36519
37475
  init_query_builders3();
36520
37476
  init_query3();
36521
- _a310 = entityKind;
37477
+ _a312 = entityKind;
36522
37478
  MySqlDatabase = class {
36523
37479
  constructor(dialect4, session, schema4, mode) {
36524
37480
  __publicField(this, "query");
@@ -36731,17 +37687,17 @@ var init_db3 = __esm({
36731
37687
  return this.session.transaction(transaction, config);
36732
37688
  }
36733
37689
  };
36734
- __publicField(MySqlDatabase, _a310, "MySqlDatabase");
37690
+ __publicField(MySqlDatabase, _a312, "MySqlDatabase");
36735
37691
  }
36736
37692
  });
36737
37693
 
36738
37694
  // ../drizzle-orm/dist/mysql-core/indexes.js
36739
- var _a311, IndexBuilderOn3, _a312, IndexBuilder3, _a313, Index5;
37695
+ var _a313, IndexBuilderOn3, _a314, IndexBuilder3, _a315, Index5;
36740
37696
  var init_indexes3 = __esm({
36741
37697
  "../drizzle-orm/dist/mysql-core/indexes.js"() {
36742
37698
  "use strict";
36743
37699
  init_entity();
36744
- _a311 = entityKind;
37700
+ _a313 = entityKind;
36745
37701
  IndexBuilderOn3 = class {
36746
37702
  constructor(name2, unique) {
36747
37703
  this.name = name2;
@@ -36751,8 +37707,8 @@ var init_indexes3 = __esm({
36751
37707
  return new IndexBuilder3(this.name, columns, this.unique);
36752
37708
  }
36753
37709
  };
36754
- __publicField(IndexBuilderOn3, _a311, "MySqlIndexBuilderOn");
36755
- _a312 = entityKind;
37710
+ __publicField(IndexBuilderOn3, _a313, "MySqlIndexBuilderOn");
37711
+ _a314 = entityKind;
36756
37712
  IndexBuilder3 = class {
36757
37713
  constructor(name2, columns, unique) {
36758
37714
  /** @internal */
@@ -36780,26 +37736,26 @@ var init_indexes3 = __esm({
36780
37736
  return new Index5(this.config, table4);
36781
37737
  }
36782
37738
  };
36783
- __publicField(IndexBuilder3, _a312, "MySqlIndexBuilder");
36784
- _a313 = entityKind;
37739
+ __publicField(IndexBuilder3, _a314, "MySqlIndexBuilder");
37740
+ _a315 = entityKind;
36785
37741
  Index5 = class {
36786
37742
  constructor(config, table4) {
36787
37743
  __publicField(this, "config");
36788
37744
  this.config = { ...config, table: table4 };
36789
37745
  }
36790
37746
  };
36791
- __publicField(Index5, _a313, "MySqlIndex");
37747
+ __publicField(Index5, _a315, "MySqlIndex");
36792
37748
  }
36793
37749
  });
36794
37750
 
36795
37751
  // ../drizzle-orm/dist/mysql-core/primary-keys.js
36796
- var _a314, PrimaryKeyBuilder3, _a315, PrimaryKey3;
37752
+ var _a316, PrimaryKeyBuilder3, _a317, PrimaryKey3;
36797
37753
  var init_primary_keys3 = __esm({
36798
37754
  "../drizzle-orm/dist/mysql-core/primary-keys.js"() {
36799
37755
  "use strict";
36800
37756
  init_entity();
36801
37757
  init_table4();
36802
- _a314 = entityKind;
37758
+ _a316 = entityKind;
36803
37759
  PrimaryKeyBuilder3 = class {
36804
37760
  constructor(columns, name2) {
36805
37761
  /** @internal */
@@ -36814,8 +37770,8 @@ var init_primary_keys3 = __esm({
36814
37770
  return new PrimaryKey3(table4, this.columns, this.name);
36815
37771
  }
36816
37772
  };
36817
- __publicField(PrimaryKeyBuilder3, _a314, "MySqlPrimaryKeyBuilder");
36818
- _a315 = entityKind;
37773
+ __publicField(PrimaryKeyBuilder3, _a316, "MySqlPrimaryKeyBuilder");
37774
+ _a317 = entityKind;
36819
37775
  PrimaryKey3 = class {
36820
37776
  constructor(table4, columns, name2) {
36821
37777
  __publicField(this, "columns");
@@ -36828,7 +37784,7 @@ var init_primary_keys3 = __esm({
36828
37784
  return this.name ?? `${this.table[MySqlTable.Symbol.Name]}_${this.columns.map((column4) => column4.name).join("_")}_pk`;
36829
37785
  }
36830
37786
  };
36831
- __publicField(PrimaryKey3, _a315, "MySqlPrimaryKey");
37787
+ __publicField(PrimaryKey3, _a317, "MySqlPrimaryKey");
36832
37788
  }
36833
37789
  });
36834
37790
 
@@ -36848,7 +37804,7 @@ function mysqlViewWithSchema(name2, selection, schema4) {
36848
37804
  }
36849
37805
  return new ViewBuilder3(name2, schema4);
36850
37806
  }
36851
- var _a316, ViewBuilderCore2, _a317, _b229, ViewBuilder3, _a318, _b230, ManualViewBuilder3, _a319, _b231, _c10, MySqlView2;
37807
+ var _a318, ViewBuilderCore2, _a319, _b229, ViewBuilder3, _a320, _b230, ManualViewBuilder3, _a321, _b231, _c10, MySqlView2;
36852
37808
  var init_view3 = __esm({
36853
37809
  "../drizzle-orm/dist/mysql-core/view.js"() {
36854
37810
  "use strict";
@@ -36859,7 +37815,7 @@ var init_view3 = __esm({
36859
37815
  init_table4();
36860
37816
  init_view_base3();
36861
37817
  init_view_common3();
36862
- _a316 = entityKind;
37818
+ _a318 = entityKind;
36863
37819
  ViewBuilderCore2 = class {
36864
37820
  constructor(name2, schema4) {
36865
37821
  __publicField(this, "config", {});
@@ -36879,8 +37835,8 @@ var init_view3 = __esm({
36879
37835
  return this;
36880
37836
  }
36881
37837
  };
36882
- __publicField(ViewBuilderCore2, _a316, "MySqlViewBuilder");
36883
- ViewBuilder3 = class extends (_b229 = ViewBuilderCore2, _a317 = entityKind, _b229) {
37838
+ __publicField(ViewBuilderCore2, _a318, "MySqlViewBuilder");
37839
+ ViewBuilder3 = class extends (_b229 = ViewBuilderCore2, _a319 = entityKind, _b229) {
36884
37840
  as(qb) {
36885
37841
  if (typeof qb === "function") {
36886
37842
  qb = qb(new QueryBuilder3());
@@ -36906,8 +37862,8 @@ var init_view3 = __esm({
36906
37862
  );
36907
37863
  }
36908
37864
  };
36909
- __publicField(ViewBuilder3, _a317, "MySqlViewBuilder");
36910
- ManualViewBuilder3 = class extends (_b230 = ViewBuilderCore2, _a318 = entityKind, _b230) {
37865
+ __publicField(ViewBuilder3, _a319, "MySqlViewBuilder");
37866
+ ManualViewBuilder3 = class extends (_b230 = ViewBuilderCore2, _a320 = entityKind, _b230) {
36911
37867
  constructor(name2, columns, schema4) {
36912
37868
  super(name2, schema4);
36913
37869
  __publicField(this, "columns");
@@ -36952,11 +37908,11 @@ var init_view3 = __esm({
36952
37908
  );
36953
37909
  }
36954
37910
  };
36955
- __publicField(ManualViewBuilder3, _a318, "MySqlManualViewBuilder");
36956
- MySqlView2 = class extends (_c10 = MySqlViewBase, _b231 = entityKind, _a319 = MySqlViewConfig, _c10) {
37911
+ __publicField(ManualViewBuilder3, _a320, "MySqlManualViewBuilder");
37912
+ MySqlView2 = class extends (_c10 = MySqlViewBase, _b231 = entityKind, _a321 = MySqlViewConfig, _c10) {
36957
37913
  constructor({ mysqlConfig, config }) {
36958
37914
  super(config);
36959
- __publicField(this, _a319);
37915
+ __publicField(this, _a321);
36960
37916
  this[MySqlViewConfig] = mysqlConfig;
36961
37917
  }
36962
37918
  };
@@ -36965,14 +37921,14 @@ var init_view3 = __esm({
36965
37921
  });
36966
37922
 
36967
37923
  // ../drizzle-orm/dist/mysql-core/schema.js
36968
- var _a320, MySqlSchema5;
37924
+ var _a322, MySqlSchema5;
36969
37925
  var init_schema2 = __esm({
36970
37926
  "../drizzle-orm/dist/mysql-core/schema.js"() {
36971
37927
  "use strict";
36972
37928
  init_entity();
36973
37929
  init_table4();
36974
37930
  init_view3();
36975
- _a320 = entityKind;
37931
+ _a322 = entityKind;
36976
37932
  MySqlSchema5 = class {
36977
37933
  constructor(schemaName) {
36978
37934
  __publicField(this, "table", (name2, columns, extraConfig) => {
@@ -36984,12 +37940,12 @@ var init_schema2 = __esm({
36984
37940
  this.schemaName = schemaName;
36985
37941
  }
36986
37942
  };
36987
- __publicField(MySqlSchema5, _a320, "MySqlSchema");
37943
+ __publicField(MySqlSchema5, _a322, "MySqlSchema");
36988
37944
  }
36989
37945
  });
36990
37946
 
36991
37947
  // ../drizzle-orm/dist/mysql-core/session.js
36992
- var _a321, MySqlPreparedQuery, _a322, MySqlSession, _a323, _b232, MySqlTransaction;
37948
+ var _a323, MySqlPreparedQuery, _a324, MySqlSession, _a325, _b232, MySqlTransaction;
36993
37949
  var init_session3 = __esm({
36994
37950
  "../drizzle-orm/dist/mysql-core/session.js"() {
36995
37951
  "use strict";
@@ -36997,15 +37953,15 @@ var init_session3 = __esm({
36997
37953
  init_errors();
36998
37954
  init_sql();
36999
37955
  init_db3();
37000
- _a321 = entityKind;
37956
+ _a323 = entityKind;
37001
37957
  MySqlPreparedQuery = class {
37002
37958
  constructor() {
37003
37959
  /** @internal */
37004
37960
  __publicField(this, "joinsNotNullableMap");
37005
37961
  }
37006
37962
  };
37007
- __publicField(MySqlPreparedQuery, _a321, "MySqlPreparedQuery");
37008
- _a322 = entityKind;
37963
+ __publicField(MySqlPreparedQuery, _a323, "MySqlPreparedQuery");
37964
+ _a324 = entityKind;
37009
37965
  MySqlSession = class {
37010
37966
  constructor(dialect4) {
37011
37967
  this.dialect = dialect4;
@@ -37040,8 +37996,8 @@ var init_session3 = __esm({
37040
37996
  return parts.length ? sql`start transaction ${sql.raw(parts.join(" "))}` : void 0;
37041
37997
  }
37042
37998
  };
37043
- __publicField(MySqlSession, _a322, "MySqlSession");
37044
- MySqlTransaction = class extends (_b232 = MySqlDatabase, _a323 = entityKind, _b232) {
37999
+ __publicField(MySqlSession, _a324, "MySqlSession");
38000
+ MySqlTransaction = class extends (_b232 = MySqlDatabase, _a325 = entityKind, _b232) {
37045
38001
  constructor(dialect4, session, schema4, nestedIndex, mode) {
37046
38002
  super(dialect4, session, schema4, mode);
37047
38003
  this.schema = schema4;
@@ -37051,7 +38007,7 @@ var init_session3 = __esm({
37051
38007
  throw new TransactionRollbackError();
37052
38008
  }
37053
38009
  };
37054
- __publicField(MySqlTransaction, _a323, "MySqlTransaction");
38010
+ __publicField(MySqlTransaction, _a325, "MySqlTransaction");
37055
38011
  }
37056
38012
  });
37057
38013
 
@@ -37939,6 +38895,13 @@ var init_cli = __esm({
37939
38895
  breakpoints: booleanType().optional().default(true),
37940
38896
  migrations: objectType({
37941
38897
  prefix: prefix.optional().default("index")
38898
+ }).optional(),
38899
+ entities: objectType({
38900
+ roles: booleanType().or(objectType({
38901
+ provider: stringType().optional(),
38902
+ include: stringType().array().optional(),
38903
+ exclude: stringType().array().optional()
38904
+ })).optional().default(false)
37942
38905
  }).optional()
37943
38906
  }).passthrough();
37944
38907
  configCheck = objectType({
@@ -38205,6 +39168,8 @@ var init_pgImports = __esm({
38205
39168
  const enums = [];
38206
39169
  const schemas = [];
38207
39170
  const sequences = [];
39171
+ const roles = [];
39172
+ const policies = [];
38208
39173
  const views = [];
38209
39174
  const matViews = [];
38210
39175
  const i0values = Object.values(exports);
@@ -38228,8 +39193,14 @@ var init_pgImports = __esm({
38228
39193
  if (isPgSequence(t)) {
38229
39194
  sequences.push(t);
38230
39195
  }
39196
+ if (is(t, PgRole)) {
39197
+ roles.push(t);
39198
+ }
39199
+ if (is(t, PgPolicy)) {
39200
+ policies.push(t);
39201
+ }
38231
39202
  });
38232
- return { tables, enums, schemas, sequences, views, matViews };
39203
+ return { tables, enums, schemas, sequences, views, matViews, roles, policies };
38233
39204
  };
38234
39205
  }
38235
39206
  });
@@ -38635,7 +39606,7 @@ init_mjs();
38635
39606
  init_global();
38636
39607
  init_pgSerializer();
38637
39608
  init_views();
38638
- var pgPushIntrospect = async (db, filters, schemaFilters) => {
39609
+ var pgPushIntrospect = async (db, filters, schemaFilters, entities = { roles: true }) => {
38639
39610
  const matchers = filters.map((it) => {
38640
39611
  return new Minimatch(it);
38641
39612
  });
@@ -38663,7 +39634,7 @@ var pgPushIntrospect = async (db, filters, schemaFilters) => {
38663
39634
  );
38664
39635
  const res = await (0, import_hanji3.renderWithTask)(
38665
39636
  progress,
38666
- fromDatabase(db, filter2, schemaFilters)
39637
+ fromDatabase(db, filter2, schemaFilters, entities)
38667
39638
  );
38668
39639
  const schema4 = { id: originUUID, prevId: "", ...res };
38669
39640
  const { internal, ...schemaWithoutInternals } = schema4;
@@ -38833,17 +39804,11 @@ var pgSuggestions = async (db, statements) => {
38833
39804
  }
38834
39805
  const stmnt = fromJson([statement], "postgresql");
38835
39806
  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
- }
39807
+ statementsToExecute.push(...stmnt);
38843
39808
  }
38844
39809
  }
38845
39810
  return {
38846
- statementsToExecute,
39811
+ statementsToExecute: [...new Set(statementsToExecute)],
38847
39812
  shouldAskForApprove,
38848
39813
  infoToPrint,
38849
39814
  matViewsToRemove: [...new Set(matViewsToRemove)],
@@ -39089,6 +40054,8 @@ var generateDrizzleJson = (imports, prevId, schemaFilters, casing2) => {
39089
40054
  prepared.enums,
39090
40055
  prepared.schemas,
39091
40056
  prepared.sequences,
40057
+ prepared.roles,
40058
+ prepared.policies,
39092
40059
  prepared.views,
39093
40060
  prepared.matViews,
39094
40061
  casing2,
@@ -39112,6 +40079,8 @@ var generateMigration = async (prev, cur) => {
39112
40079
  schemasResolver,
39113
40080
  enumsResolver,
39114
40081
  sequencesResolver,
40082
+ policyResolver,
40083
+ roleResolver,
39115
40084
  tablesResolver,
39116
40085
  columnsResolver,
39117
40086
  viewsResolver,
@@ -39145,6 +40114,8 @@ var pushSchema = async (imports, drizzleInstance, schemaFilters) => {
39145
40114
  schemasResolver,
39146
40115
  enumsResolver,
39147
40116
  sequencesResolver,
40117
+ policyResolver,
40118
+ roleResolver,
39148
40119
  tablesResolver,
39149
40120
  columnsResolver,
39150
40121
  viewsResolver,