drizzle-kit 0.26.2-a43c673 → 0.26.2-b2b714a

Sign up to get free protection for your applications and to get access to all the features.
package/api.js CHANGED
@@ -2475,9 +2475,9 @@ var require_inflight = __commonJS({
2475
2475
  }
2476
2476
  function slice(args) {
2477
2477
  var length = args.length;
2478
- var array = [];
2479
- for (var i = 0; i < length; i++) array[i] = args[i];
2480
- return array;
2478
+ var array2 = [];
2479
+ for (var i = 0; i < length; i++) array2[i] = args[i];
2480
+ return array2;
2481
2481
  }
2482
2482
  }
2483
2483
  });
@@ -3647,13 +3647,13 @@ function processCreateParams(params) {
3647
3647
  if (errorMap2)
3648
3648
  return { errorMap: errorMap2, description };
3649
3649
  const customMap = (iss, ctx) => {
3650
- var _a324, _b233;
3650
+ var _a326, _b233;
3651
3651
  const { message } = params;
3652
3652
  if (iss.code === "invalid_enum_value") {
3653
3653
  return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
3654
3654
  }
3655
3655
  if (typeof ctx.data === "undefined") {
3656
- return { message: (_a324 = message !== null && message !== void 0 ? message : required_error) !== null && _a324 !== void 0 ? _a324 : ctx.defaultError };
3656
+ return { message: (_a326 = message !== null && message !== void 0 ? message : required_error) !== null && _a326 !== void 0 ? _a326 : ctx.defaultError };
3657
3657
  }
3658
3658
  if (iss.code !== "invalid_type")
3659
3659
  return { message: ctx.defaultError };
@@ -3820,8 +3820,8 @@ var init_lib = __esm({
3820
3820
  return void 0;
3821
3821
  };
3822
3822
  util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
3823
- function joinValues(array, separator = " | ") {
3824
- return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
3823
+ function joinValues(array2, separator = " | ") {
3824
+ return array2.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
3825
3825
  }
3826
3826
  util2.joinValues = joinValues;
3827
3827
  util2.jsonStringifyReplacer = (_2, value) => {
@@ -4319,11 +4319,11 @@ var init_lib = __esm({
4319
4319
  throw result.error;
4320
4320
  }
4321
4321
  safeParse(data, params) {
4322
- var _a324;
4322
+ var _a326;
4323
4323
  const ctx = {
4324
4324
  common: {
4325
4325
  issues: [],
4326
- async: (_a324 = params === null || params === void 0 ? void 0 : params.async) !== null && _a324 !== void 0 ? _a324 : false,
4326
+ async: (_a326 = params === null || params === void 0 ? void 0 : params.async) !== null && _a326 !== void 0 ? _a326 : false,
4327
4327
  contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
4328
4328
  },
4329
4329
  path: (params === null || params === void 0 ? void 0 : params.path) || [],
@@ -4645,7 +4645,7 @@ var init_lib = __esm({
4645
4645
  } else if (check.kind === "url") {
4646
4646
  try {
4647
4647
  new URL(input.data);
4648
- } catch (_a324) {
4648
+ } catch (_a326) {
4649
4649
  ctx = this._getOrReturnCtx(input, ctx);
4650
4650
  addIssueToContext(ctx, {
4651
4651
  validation: "url",
@@ -4815,7 +4815,7 @@ var init_lib = __esm({
4815
4815
  return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
4816
4816
  }
4817
4817
  datetime(options) {
4818
- var _a324, _b233;
4818
+ var _a326, _b233;
4819
4819
  if (typeof options === "string") {
4820
4820
  return this._addCheck({
4821
4821
  kind: "datetime",
@@ -4828,7 +4828,7 @@ var init_lib = __esm({
4828
4828
  return this._addCheck({
4829
4829
  kind: "datetime",
4830
4830
  precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
4831
- offset: (_a324 = options === null || options === void 0 ? void 0 : options.offset) !== null && _a324 !== void 0 ? _a324 : false,
4831
+ offset: (_a326 = options === null || options === void 0 ? void 0 : options.offset) !== null && _a326 !== void 0 ? _a326 : false,
4832
4832
  local: (_b233 = options === null || options === void 0 ? void 0 : options.local) !== null && _b233 !== void 0 ? _b233 : false,
4833
4833
  ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
4834
4834
  });
@@ -4992,11 +4992,11 @@ var init_lib = __esm({
4992
4992
  }
4993
4993
  };
4994
4994
  ZodString.create = (params) => {
4995
- var _a324;
4995
+ var _a326;
4996
4996
  return new ZodString({
4997
4997
  checks: [],
4998
4998
  typeName: ZodFirstPartyTypeKind.ZodString,
4999
- coerce: (_a324 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a324 !== void 0 ? _a324 : false,
4999
+ coerce: (_a326 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a326 !== void 0 ? _a326 : false,
5000
5000
  ...processCreateParams(params)
5001
5001
  });
5002
5002
  };
@@ -5389,11 +5389,11 @@ var init_lib = __esm({
5389
5389
  }
5390
5390
  };
5391
5391
  ZodBigInt.create = (params) => {
5392
- var _a324;
5392
+ var _a326;
5393
5393
  return new ZodBigInt({
5394
5394
  checks: [],
5395
5395
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
5396
- coerce: (_a324 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a324 !== void 0 ? _a324 : false,
5396
+ coerce: (_a326 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a326 !== void 0 ? _a326 : false,
5397
5397
  ...processCreateParams(params)
5398
5398
  });
5399
5399
  };
@@ -5873,8 +5873,8 @@ var init_lib = __esm({
5873
5873
  unknownKeys: "strict",
5874
5874
  ...message !== void 0 ? {
5875
5875
  errorMap: (issue, ctx) => {
5876
- var _a324, _b233, _c11, _d5;
5877
- 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;
5876
+ var _a326, _b233, _c11, _d5;
5877
+ 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;
5878
5878
  if (issue.code === "unrecognized_keys")
5879
5879
  return {
5880
5880
  message: (_d5 = errorUtil.errToObj(message).message) !== null && _d5 !== void 0 ? _d5 : defaultError
@@ -7722,7 +7722,7 @@ var init_vector = __esm({
7722
7722
  });
7723
7723
 
7724
7724
  // src/serializer/pgSchema.ts
7725
- 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;
7725
+ 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;
7726
7726
  var init_pgSchema = __esm({
7727
7727
  "src/serializer/pgSchema.ts"() {
7728
7728
  "use strict";
@@ -7854,6 +7854,12 @@ var init_pgSchema = __esm({
7854
7854
  cycle: booleanType().optional(),
7855
7855
  schema: stringType()
7856
7856
  }).strict();
7857
+ roleSchema = objectType({
7858
+ name: stringType(),
7859
+ createDb: booleanType().optional(),
7860
+ createRole: booleanType().optional(),
7861
+ inherit: booleanType().optional()
7862
+ }).strict();
7857
7863
  sequenceSquashed = objectType({
7858
7864
  name: stringType(),
7859
7865
  schema: stringType(),
@@ -7921,6 +7927,14 @@ var init_pgSchema = __esm({
7921
7927
  columns: stringType().array(),
7922
7928
  nullsNotDistinct: booleanType()
7923
7929
  }).strict();
7930
+ policy = objectType({
7931
+ name: stringType(),
7932
+ as: enumType(["PERMISSIVE", "RESTRICTIVE"]).optional(),
7933
+ for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
7934
+ to: stringType().array().optional(),
7935
+ using: stringType().optional(),
7936
+ withCheck: stringType().optional()
7937
+ }).strict();
7924
7938
  viewWithOption = objectType({
7925
7939
  checkOption: enumType(["local", "cascaded"]).optional(),
7926
7940
  securityBarrier: booleanType().optional(),
@@ -8001,7 +8015,9 @@ var init_pgSchema = __esm({
8001
8015
  foreignKeys: recordType(stringType(), fk2),
8002
8016
  compositePrimaryKeys: recordType(stringType(), compositePK2),
8003
8017
  uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
8004
- checkConstraints: recordType(stringType(), checkConstraint2).default({})
8018
+ policies: recordType(stringType(), policy).default({}),
8019
+ checkConstraints: recordType(stringType(), checkConstraint2).default({}),
8020
+ isRLSEnabled: booleanType().default(false)
8005
8021
  }).strict();
8006
8022
  schemaHash2 = objectType({
8007
8023
  id: stringType(),
@@ -8096,6 +8112,7 @@ var init_pgSchema = __esm({
8096
8112
  schemas: recordType(stringType(), stringType()),
8097
8113
  views: recordType(stringType(), view2).default({}),
8098
8114
  sequences: recordType(stringType(), sequenceSchema).default({}),
8115
+ roles: recordType(stringType(), roleSchema).default({}),
8099
8116
  _meta: objectType({
8100
8117
  schemas: recordType(stringType(), stringType()),
8101
8118
  tables: recordType(stringType(), stringType()),
@@ -8111,7 +8128,9 @@ var init_pgSchema = __esm({
8111
8128
  foreignKeys: recordType(stringType(), stringType()),
8112
8129
  compositePrimaryKeys: recordType(stringType(), stringType()),
8113
8130
  uniqueConstraints: recordType(stringType(), stringType()),
8114
- checkConstraints: recordType(stringType(), stringType())
8131
+ policies: recordType(stringType(), stringType()),
8132
+ checkConstraints: recordType(stringType(), stringType()),
8133
+ isRLSEnabled: booleanType().default(false)
8115
8134
  }).strict();
8116
8135
  tableSquashedV42 = objectType({
8117
8136
  name: stringType(),
@@ -8141,7 +8160,8 @@ var init_pgSchema = __esm({
8141
8160
  enums: recordType(stringType(), enumSchema),
8142
8161
  schemas: recordType(stringType(), stringType()),
8143
8162
  views: recordType(stringType(), view2),
8144
- sequences: recordType(stringType(), sequenceSquashed)
8163
+ sequences: recordType(stringType(), sequenceSquashed),
8164
+ roles: recordType(stringType(), roleSchema).default({})
8145
8165
  }).strict();
8146
8166
  pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
8147
8167
  pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
@@ -8224,6 +8244,23 @@ var init_pgSchema = __esm({
8224
8244
  squashFK: (fk4) => {
8225
8245
  return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${fk4.onUpdate ?? ""};${fk4.onDelete ?? ""};${fk4.schemaTo || "public"}`;
8226
8246
  },
8247
+ squashPolicy: (policy2) => {
8248
+ return `${policy2.name}--${policy2.as}--${policy2.for}--${policy2.to?.join(",")}--${policy2.using}--${policy2.withCheck}`;
8249
+ },
8250
+ unsquashPolicy: (policy2) => {
8251
+ const splitted = policy2.split("--");
8252
+ return {
8253
+ name: splitted[0],
8254
+ as: splitted[1],
8255
+ for: splitted[2],
8256
+ to: splitted[3].split(","),
8257
+ using: splitted[4] !== "undefined" ? splitted[4] : void 0,
8258
+ withCheck: splitted[5] !== "undefined" ? splitted[5] : void 0
8259
+ };
8260
+ },
8261
+ squashPolicyPush: (policy2) => {
8262
+ return `${policy2.name}--${policy2.as}--${policy2.for}--${policy2.to?.join(",")}`;
8263
+ },
8227
8264
  squashPK: (pk) => {
8228
8265
  return `${pk.columns.join(",")};${pk.name}`;
8229
8266
  },
@@ -8336,6 +8373,9 @@ var init_pgSchema = __esm({
8336
8373
  return PgSquasher.squashUnique(unq);
8337
8374
  }
8338
8375
  );
8376
+ const squashedPolicies = mapValues(it[1].policies, (policy2) => {
8377
+ return action === "push" ? PgSquasher.squashPolicyPush(policy2) : PgSquasher.squashPolicy(policy2);
8378
+ });
8339
8379
  const squashedChecksContraints = mapValues(
8340
8380
  it[1].checkConstraints,
8341
8381
  (check) => {
@@ -8352,7 +8392,9 @@ var init_pgSchema = __esm({
8352
8392
  foreignKeys: squashedFKs,
8353
8393
  compositePrimaryKeys: squashedPKs,
8354
8394
  uniqueConstraints: squashedUniqueConstraints,
8355
- checkConstraints: squashedChecksContraints
8395
+ policies: squashedPolicies,
8396
+ checkConstraints: squashedChecksContraints,
8397
+ isRLSEnabled: it[1].isRLSEnabled ?? false
8356
8398
  }
8357
8399
  ];
8358
8400
  })
@@ -8376,7 +8418,8 @@ var init_pgSchema = __esm({
8376
8418
  enums: json3.enums,
8377
8419
  schemas: json3.schemas,
8378
8420
  views: json3.views,
8379
- sequences: mappedSequences
8421
+ sequences: mappedSequences,
8422
+ roles: json3.roles
8380
8423
  };
8381
8424
  };
8382
8425
  dryPg = pgSchema.parse({
@@ -8760,7 +8803,7 @@ var init_utils = __esm({
8760
8803
  });
8761
8804
 
8762
8805
  // src/cli/views.ts
8763
- var import_hanji, warning, error, isRenamePromptItem, ResolveColumnSelect, tableKey, ResolveSelect, ResolveSchemasSelect, Spinner, ProgressView;
8806
+ var import_hanji, warning, error, isRenamePromptItem, ResolveColumnSelect, tableKey, ResolveSelectNamed, ResolveSelect, ResolveSchemasSelect, Spinner, ProgressView;
8764
8807
  var init_views = __esm({
8765
8808
  "src/cli/views.ts"() {
8766
8809
  "use strict";
@@ -8825,6 +8868,53 @@ Is ${source_default.bold.blue(
8825
8868
  tableKey = (it) => {
8826
8869
  return it.schema === "public" || !it.schema ? it.name : `${it.schema}.${it.name}`;
8827
8870
  };
8871
+ ResolveSelectNamed = class extends import_hanji.Prompt {
8872
+ constructor(base, data, entityType) {
8873
+ super();
8874
+ this.base = base;
8875
+ this.entityType = entityType;
8876
+ this.on("attach", (terminal) => terminal.toggleCursor("hide"));
8877
+ this.state = new import_hanji.SelectState(data);
8878
+ this.state.bind(this);
8879
+ this.base = base;
8880
+ }
8881
+ render(status) {
8882
+ if (status === "submitted" || status === "aborted") {
8883
+ return "";
8884
+ }
8885
+ const key = this.base.name;
8886
+ let text4 = `
8887
+ Is ${source_default.bold.blue(key)} ${this.entityType} created or renamed from another ${this.entityType}?
8888
+ `;
8889
+ const isSelectedRenamed = isRenamePromptItem(
8890
+ this.state.items[this.state.selectedIdx]
8891
+ );
8892
+ const selectedPrefix = isSelectedRenamed ? source_default.yellow("\u276F ") : source_default.green("\u276F ");
8893
+ const labelLength = this.state.items.filter((it) => isRenamePromptItem(it)).map((_2) => {
8894
+ const it = _2;
8895
+ const keyFrom = it.from.name;
8896
+ return key.length + 3 + keyFrom.length;
8897
+ }).reduce((a, b) => {
8898
+ if (a > b) {
8899
+ return a;
8900
+ }
8901
+ return b;
8902
+ }, 0);
8903
+ const entityType = this.entityType;
8904
+ this.state.items.forEach((it, idx) => {
8905
+ const isSelected = idx === this.state.selectedIdx;
8906
+ const isRenamed = isRenamePromptItem(it);
8907
+ const title = isRenamed ? `${it.from.name} \u203A ${it.to.name}`.padEnd(labelLength, " ") : it.name.padEnd(labelLength, " ");
8908
+ const label = isRenamed ? `${source_default.yellow("~")} ${title} ${source_default.gray(`rename ${entityType}`)}` : `${source_default.green("+")} ${title} ${source_default.gray(`create ${entityType}`)}`;
8909
+ text4 += isSelected ? `${selectedPrefix}${label}` : ` ${label}`;
8910
+ text4 += idx != this.state.items.length - 1 ? "\n" : "";
8911
+ });
8912
+ return text4;
8913
+ }
8914
+ result() {
8915
+ return this.state.items[this.state.selectedIdx];
8916
+ }
8917
+ };
8828
8918
  ResolveSelect = class extends import_hanji.Prompt {
8829
8919
  constructor(base, data, entityType) {
8830
8920
  super();
@@ -9041,57 +9131,57 @@ var require_heap = __commonJS({
9041
9131
  }
9042
9132
  return [].splice.apply(a, [lo, lo - lo].concat(x)), x;
9043
9133
  };
9044
- heappush = function(array, item, cmp) {
9134
+ heappush = function(array2, item, cmp) {
9045
9135
  if (cmp == null) {
9046
9136
  cmp = defaultCmp;
9047
9137
  }
9048
- array.push(item);
9049
- return _siftdown(array, 0, array.length - 1, cmp);
9138
+ array2.push(item);
9139
+ return _siftdown(array2, 0, array2.length - 1, cmp);
9050
9140
  };
9051
- heappop = function(array, cmp) {
9141
+ heappop = function(array2, cmp) {
9052
9142
  var lastelt, returnitem;
9053
9143
  if (cmp == null) {
9054
9144
  cmp = defaultCmp;
9055
9145
  }
9056
- lastelt = array.pop();
9057
- if (array.length) {
9058
- returnitem = array[0];
9059
- array[0] = lastelt;
9060
- _siftup(array, 0, cmp);
9146
+ lastelt = array2.pop();
9147
+ if (array2.length) {
9148
+ returnitem = array2[0];
9149
+ array2[0] = lastelt;
9150
+ _siftup(array2, 0, cmp);
9061
9151
  } else {
9062
9152
  returnitem = lastelt;
9063
9153
  }
9064
9154
  return returnitem;
9065
9155
  };
9066
- heapreplace = function(array, item, cmp) {
9156
+ heapreplace = function(array2, item, cmp) {
9067
9157
  var returnitem;
9068
9158
  if (cmp == null) {
9069
9159
  cmp = defaultCmp;
9070
9160
  }
9071
- returnitem = array[0];
9072
- array[0] = item;
9073
- _siftup(array, 0, cmp);
9161
+ returnitem = array2[0];
9162
+ array2[0] = item;
9163
+ _siftup(array2, 0, cmp);
9074
9164
  return returnitem;
9075
9165
  };
9076
- heappushpop = function(array, item, cmp) {
9166
+ heappushpop = function(array2, item, cmp) {
9077
9167
  var _ref;
9078
9168
  if (cmp == null) {
9079
9169
  cmp = defaultCmp;
9080
9170
  }
9081
- if (array.length && cmp(array[0], item) < 0) {
9082
- _ref = [array[0], item], item = _ref[0], array[0] = _ref[1];
9083
- _siftup(array, 0, cmp);
9171
+ if (array2.length && cmp(array2[0], item) < 0) {
9172
+ _ref = [array2[0], item], item = _ref[0], array2[0] = _ref[1];
9173
+ _siftup(array2, 0, cmp);
9084
9174
  }
9085
9175
  return item;
9086
9176
  };
9087
- heapify = function(array, cmp) {
9177
+ heapify = function(array2, cmp) {
9088
9178
  var i, _i2, _j2, _len, _ref, _ref1, _results, _results1;
9089
9179
  if (cmp == null) {
9090
9180
  cmp = defaultCmp;
9091
9181
  }
9092
9182
  _ref1 = function() {
9093
9183
  _results1 = [];
9094
- for (var _j3 = 0, _ref2 = floor(array.length / 2); 0 <= _ref2 ? _j3 < _ref2 : _j3 > _ref2; 0 <= _ref2 ? _j3++ : _j3--) {
9184
+ for (var _j3 = 0, _ref2 = floor(array2.length / 2); 0 <= _ref2 ? _j3 < _ref2 : _j3 > _ref2; 0 <= _ref2 ? _j3++ : _j3--) {
9095
9185
  _results1.push(_j3);
9096
9186
  }
9097
9187
  return _results1;
@@ -9099,51 +9189,51 @@ var require_heap = __commonJS({
9099
9189
  _results = [];
9100
9190
  for (_i2 = 0, _len = _ref1.length; _i2 < _len; _i2++) {
9101
9191
  i = _ref1[_i2];
9102
- _results.push(_siftup(array, i, cmp));
9192
+ _results.push(_siftup(array2, i, cmp));
9103
9193
  }
9104
9194
  return _results;
9105
9195
  };
9106
- updateItem = function(array, item, cmp) {
9196
+ updateItem = function(array2, item, cmp) {
9107
9197
  var pos;
9108
9198
  if (cmp == null) {
9109
9199
  cmp = defaultCmp;
9110
9200
  }
9111
- pos = array.indexOf(item);
9201
+ pos = array2.indexOf(item);
9112
9202
  if (pos === -1) {
9113
9203
  return;
9114
9204
  }
9115
- _siftdown(array, 0, pos, cmp);
9116
- return _siftup(array, pos, cmp);
9205
+ _siftdown(array2, 0, pos, cmp);
9206
+ return _siftup(array2, pos, cmp);
9117
9207
  };
9118
- nlargest = function(array, n, cmp) {
9208
+ nlargest = function(array2, n, cmp) {
9119
9209
  var elem, result, _i2, _len, _ref;
9120
9210
  if (cmp == null) {
9121
9211
  cmp = defaultCmp;
9122
9212
  }
9123
- result = array.slice(0, n);
9213
+ result = array2.slice(0, n);
9124
9214
  if (!result.length) {
9125
9215
  return result;
9126
9216
  }
9127
9217
  heapify(result, cmp);
9128
- _ref = array.slice(n);
9218
+ _ref = array2.slice(n);
9129
9219
  for (_i2 = 0, _len = _ref.length; _i2 < _len; _i2++) {
9130
9220
  elem = _ref[_i2];
9131
9221
  heappushpop(result, elem, cmp);
9132
9222
  }
9133
9223
  return result.sort(cmp).reverse();
9134
9224
  };
9135
- nsmallest = function(array, n, cmp) {
9225
+ nsmallest = function(array2, n, cmp) {
9136
9226
  var elem, i, los, result, _i2, _j2, _len, _ref, _ref1, _results;
9137
9227
  if (cmp == null) {
9138
9228
  cmp = defaultCmp;
9139
9229
  }
9140
- if (n * 10 <= array.length) {
9141
- result = array.slice(0, n).sort(cmp);
9230
+ if (n * 10 <= array2.length) {
9231
+ result = array2.slice(0, n).sort(cmp);
9142
9232
  if (!result.length) {
9143
9233
  return result;
9144
9234
  }
9145
9235
  los = result[result.length - 1];
9146
- _ref = array.slice(n);
9236
+ _ref = array2.slice(n);
9147
9237
  for (_i2 = 0, _len = _ref.length; _i2 < _len; _i2++) {
9148
9238
  elem = _ref[_i2];
9149
9239
  if (cmp(elem, los) < 0) {
@@ -9154,51 +9244,51 @@ var require_heap = __commonJS({
9154
9244
  }
9155
9245
  return result;
9156
9246
  }
9157
- heapify(array, cmp);
9247
+ heapify(array2, cmp);
9158
9248
  _results = [];
9159
- for (i = _j2 = 0, _ref1 = min2(n, array.length); 0 <= _ref1 ? _j2 < _ref1 : _j2 > _ref1; i = 0 <= _ref1 ? ++_j2 : --_j2) {
9160
- _results.push(heappop(array, cmp));
9249
+ for (i = _j2 = 0, _ref1 = min2(n, array2.length); 0 <= _ref1 ? _j2 < _ref1 : _j2 > _ref1; i = 0 <= _ref1 ? ++_j2 : --_j2) {
9250
+ _results.push(heappop(array2, cmp));
9161
9251
  }
9162
9252
  return _results;
9163
9253
  };
9164
- _siftdown = function(array, startpos, pos, cmp) {
9254
+ _siftdown = function(array2, startpos, pos, cmp) {
9165
9255
  var newitem, parent, parentpos;
9166
9256
  if (cmp == null) {
9167
9257
  cmp = defaultCmp;
9168
9258
  }
9169
- newitem = array[pos];
9259
+ newitem = array2[pos];
9170
9260
  while (pos > startpos) {
9171
9261
  parentpos = pos - 1 >> 1;
9172
- parent = array[parentpos];
9262
+ parent = array2[parentpos];
9173
9263
  if (cmp(newitem, parent) < 0) {
9174
- array[pos] = parent;
9264
+ array2[pos] = parent;
9175
9265
  pos = parentpos;
9176
9266
  continue;
9177
9267
  }
9178
9268
  break;
9179
9269
  }
9180
- return array[pos] = newitem;
9270
+ return array2[pos] = newitem;
9181
9271
  };
9182
- _siftup = function(array, pos, cmp) {
9272
+ _siftup = function(array2, pos, cmp) {
9183
9273
  var childpos, endpos, newitem, rightpos, startpos;
9184
9274
  if (cmp == null) {
9185
9275
  cmp = defaultCmp;
9186
9276
  }
9187
- endpos = array.length;
9277
+ endpos = array2.length;
9188
9278
  startpos = pos;
9189
- newitem = array[pos];
9279
+ newitem = array2[pos];
9190
9280
  childpos = 2 * pos + 1;
9191
9281
  while (childpos < endpos) {
9192
9282
  rightpos = childpos + 1;
9193
- if (rightpos < endpos && !(cmp(array[childpos], array[rightpos]) < 0)) {
9283
+ if (rightpos < endpos && !(cmp(array2[childpos], array2[rightpos]) < 0)) {
9194
9284
  childpos = rightpos;
9195
9285
  }
9196
- array[pos] = array[childpos];
9286
+ array2[pos] = array2[childpos];
9197
9287
  pos = childpos;
9198
9288
  childpos = 2 * pos + 1;
9199
9289
  }
9200
- array[pos] = newitem;
9201
- return _siftdown(array, startpos, pos, cmp);
9290
+ array2[pos] = newitem;
9291
+ return _siftdown(array2, startpos, pos, cmp);
9202
9292
  };
9203
9293
  Heap = function() {
9204
9294
  Heap2.push = heappush;
@@ -11125,12 +11215,12 @@ var require_lib = __commonJS({
11125
11215
  }
11126
11216
  return bestMatch;
11127
11217
  }
11128
- scalarize(array, originals, fuzzyOriginals) {
11218
+ scalarize(array2, originals, fuzzyOriginals) {
11129
11219
  const fuzzyMatches = [];
11130
11220
  if (fuzzyOriginals) {
11131
11221
  const keyScores = {};
11132
- for (let index4 = 0; index4 < array.length; index4++) {
11133
- const item = array[index4];
11222
+ for (let index4 = 0; index4 < array2.length; index4++) {
11223
+ const item = array2[index4];
11134
11224
  if (this.isScalar(item)) {
11135
11225
  continue;
11136
11226
  }
@@ -11144,8 +11234,8 @@ var require_lib = __commonJS({
11144
11234
  }
11145
11235
  }
11146
11236
  const result = [];
11147
- for (let index4 = 0; index4 < array.length; index4++) {
11148
- const item = array[index4];
11237
+ for (let index4 = 0; index4 < array2.length; index4++) {
11238
+ const item = array2[index4];
11149
11239
  if (this.isScalar(item)) {
11150
11240
  result.push(item);
11151
11241
  } else {
@@ -11367,6 +11457,37 @@ function diffColumns(left, right) {
11367
11457
  );
11368
11458
  return alteredTables;
11369
11459
  }
11460
+ function diffPolicies(left, right) {
11461
+ left = JSON.parse(JSON.stringify(left));
11462
+ right = JSON.parse(JSON.stringify(right));
11463
+ const result = (0, import_json_diff.diff)(left, right) ?? {};
11464
+ const alteredTables = Object.fromEntries(
11465
+ Object.entries(result).filter((it) => {
11466
+ return !(it[0].includes("__added") || it[0].includes("__deleted"));
11467
+ }).map((tableEntry) => {
11468
+ const deletedPolicies = Object.entries(tableEntry[1].policies ?? {}).filter((it) => {
11469
+ return it[0].endsWith("__deleted");
11470
+ }).map((it) => {
11471
+ return it[1];
11472
+ });
11473
+ const addedPolicies = Object.entries(tableEntry[1].policies ?? {}).filter((it) => {
11474
+ return it[0].endsWith("__added");
11475
+ }).map((it) => {
11476
+ return it[1];
11477
+ });
11478
+ tableEntry[1].policies = {
11479
+ added: addedPolicies,
11480
+ deleted: deletedPolicies
11481
+ };
11482
+ const table4 = left[tableEntry[0]];
11483
+ return [
11484
+ tableEntry[0],
11485
+ { name: table4.name, schema: table4.schema, ...tableEntry[1] }
11486
+ ];
11487
+ })
11488
+ );
11489
+ return alteredTables;
11490
+ }
11370
11491
  function applyJsonDiff(json1, json22) {
11371
11492
  json1 = JSON.parse(JSON.stringify(json1));
11372
11493
  json22 = JSON.parse(JSON.stringify(json22));
@@ -11376,6 +11497,7 @@ function applyJsonDiff(json1, json22) {
11376
11497
  difference.tables = difference.tables || {};
11377
11498
  difference.enums = difference.enums || {};
11378
11499
  difference.sequences = difference.sequences || {};
11500
+ difference.roles = difference.roles || {};
11379
11501
  difference.views = difference.views || {};
11380
11502
  const schemaKeys = Object.keys(difference.schemas);
11381
11503
  for (let key of schemaKeys) {
@@ -11432,6 +11554,10 @@ function applyJsonDiff(json1, json22) {
11432
11554
  const alteredSequences = sequencesEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted")) && "values" in it[1]).map((it) => {
11433
11555
  return json22.sequences[it[0]];
11434
11556
  });
11557
+ const rolesEntries = Object.entries(difference.roles);
11558
+ const alteredRoles = rolesEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted"))).map((it) => {
11559
+ return json22.roles[it[0]];
11560
+ });
11435
11561
  const viewsEntries = Object.entries(difference.views);
11436
11562
  const alteredViews = viewsEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted"))).map(
11437
11563
  ([nameWithSchema, view4]) => {
@@ -11505,6 +11631,7 @@ function applyJsonDiff(json1, json22) {
11505
11631
  alteredTablesWithColumns,
11506
11632
  alteredEnums,
11507
11633
  alteredSequences,
11634
+ alteredRoles,
11508
11635
  alteredViews
11509
11636
  };
11510
11637
  }
@@ -11565,6 +11692,21 @@ var init_jsonDiffer = __esm({
11565
11692
  return !it[0].endsWith("__deleted") && !it[0].endsWith("__added");
11566
11693
  })
11567
11694
  );
11695
+ const deletedPolicies = Object.fromEntries(
11696
+ Object.entries(table4.policies__deleted || {}).concat(
11697
+ Object.entries(table4.policies || {}).filter((it) => it[0].includes("__deleted"))
11698
+ ).map((entry) => [entry[0].replace("__deleted", ""), entry[1]])
11699
+ );
11700
+ const addedPolicies = Object.fromEntries(
11701
+ Object.entries(table4.policies__added || {}).concat(
11702
+ Object.entries(table4.policies || {}).filter((it) => it[0].includes("__added"))
11703
+ ).map((entry) => [entry[0].replace("__added", ""), entry[1]])
11704
+ );
11705
+ const alteredPolicies = Object.fromEntries(
11706
+ Object.entries(table4.policies || {}).filter((it) => {
11707
+ return !it[0].endsWith("__deleted") && !it[0].endsWith("__added");
11708
+ })
11709
+ );
11568
11710
  const deletedForeignKeys = Object.fromEntries(
11569
11711
  Object.entries(table4.foreignKeys__deleted || {}).concat(
11570
11712
  Object.entries(table4.foreignKeys || {}).filter((it) => it[0].includes("__deleted"))
@@ -11642,6 +11784,9 @@ var init_jsonDiffer = __esm({
11642
11784
  addedUniqueConstraints,
11643
11785
  deletedUniqueConstraints,
11644
11786
  alteredUniqueConstraints,
11787
+ deletedPolicies,
11788
+ addedPolicies,
11789
+ alteredPolicies,
11645
11790
  addedCheckConstraints,
11646
11791
  deletedCheckConstraints,
11647
11792
  alteredCheckConstraints
@@ -11944,7 +12089,7 @@ function fromJson(statements, dialect4, action, json22) {
11944
12089
  }).filter((it) => it !== "");
11945
12090
  return result;
11946
12091
  }
11947
- 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;
12092
+ 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;
11948
12093
  var init_sqlgenerator = __esm({
11949
12094
  "src/sqlgenerator.ts"() {
11950
12095
  "use strict";
@@ -12000,12 +12145,109 @@ var init_sqlgenerator = __esm({
12000
12145
  };
12001
12146
  Convertor = class {
12002
12147
  };
12148
+ PgCreateRoleConvertor = class extends Convertor {
12149
+ can(statement, dialect4) {
12150
+ return statement.type === "create_role" && dialect4 === "postgresql";
12151
+ }
12152
+ convert(statement) {
12153
+ 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"}` : ""};`;
12154
+ }
12155
+ };
12156
+ PgDropRoleConvertor = class extends Convertor {
12157
+ can(statement, dialect4) {
12158
+ return statement.type === "drop_role" && dialect4 === "postgresql";
12159
+ }
12160
+ convert(statement) {
12161
+ return `DROP ROLE "${statement.name}";`;
12162
+ }
12163
+ };
12164
+ PgRenameRoleConvertor = class extends Convertor {
12165
+ can(statement, dialect4) {
12166
+ return statement.type === "rename_role" && dialect4 === "postgresql";
12167
+ }
12168
+ convert(statement) {
12169
+ return `ALTER ROLE "${statement.nameFrom}" RENAME TO "${statement.nameTo}";`;
12170
+ }
12171
+ };
12172
+ PgAlterRoleConvertor = class extends Convertor {
12173
+ can(statement, dialect4) {
12174
+ return statement.type === "alter_role" && dialect4 === "postgresql";
12175
+ }
12176
+ convert(statement) {
12177
+ return `ALTER ROLE "${statement.name}"${` WITH${statement.values.createDb ? " CREATEDB" : " NOCREATEDB"}${statement.values.createRole ? " CREATEROLE" : " NOCREATEROLE"}${statement.values.inherit ? " INHERIT" : " NOINHERIT"}`};`;
12178
+ }
12179
+ };
12180
+ PgCreatePolicyConvertor = class extends Convertor {
12181
+ can(statement, dialect4) {
12182
+ return statement.type === "create_policy" && dialect4 === "postgresql";
12183
+ }
12184
+ convert(statement) {
12185
+ const policy2 = statement.data;
12186
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12187
+ const usingPart = policy2.using ? ` USING (${policy2.using})` : "";
12188
+ const withCheckPart = policy2.withCheck ? ` WITH CHECK (${policy2.withCheck})` : "";
12189
+ const policyToPart = policy2.to?.map(
12190
+ (v) => ["current_user", "current_role", "session_user", "public"].includes(v) ? v : `"${v}"`
12191
+ ).join(", ");
12192
+ return `CREATE POLICY "${policy2.name}" ON ${tableNameWithSchema} AS ${policy2.as?.toUpperCase()} FOR ${policy2.for?.toUpperCase()} TO ${policyToPart}${usingPart}${withCheckPart};`;
12193
+ }
12194
+ };
12195
+ PgDropPolicyConvertor = class extends Convertor {
12196
+ can(statement, dialect4) {
12197
+ return statement.type === "drop_policy" && dialect4 === "postgresql";
12198
+ }
12199
+ convert(statement) {
12200
+ const policy2 = statement.data;
12201
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12202
+ return `DROP POLICY "${policy2.name}" ON ${tableNameWithSchema} CASCADE;`;
12203
+ }
12204
+ };
12205
+ PgRenamePolicyConvertor = class extends Convertor {
12206
+ can(statement, dialect4) {
12207
+ return statement.type === "rename_policy" && dialect4 === "postgresql";
12208
+ }
12209
+ convert(statement) {
12210
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12211
+ return `ALTER POLICY "${statement.oldName}" ON ${tableNameWithSchema} RENAME TO "${statement.newName}";`;
12212
+ }
12213
+ };
12214
+ PgAlterPolicyConvertor = class extends Convertor {
12215
+ can(statement, dialect4) {
12216
+ return statement.type === "alter_policy" && dialect4 === "postgresql";
12217
+ }
12218
+ convert(statement) {
12219
+ const newPolicy = PgSquasher.unsquashPolicy(statement.newData);
12220
+ const oldPolicy = PgSquasher.unsquashPolicy(statement.oldData);
12221
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12222
+ const usingPart = newPolicy.using ? ` USING (${newPolicy.using})` : oldPolicy.using ? ` USING (${oldPolicy.using})` : "";
12223
+ const withCheckPart = newPolicy.withCheck ? ` WITH CHECK (${newPolicy.withCheck})` : oldPolicy.withCheck ? ` WITH CHECK (${oldPolicy.withCheck})` : "";
12224
+ return `ALTER POLICY "${oldPolicy.name}" ON ${tableNameWithSchema} TO ${newPolicy.to}${usingPart}${withCheckPart};`;
12225
+ }
12226
+ };
12227
+ PgEnableRlsConvertor = class extends Convertor {
12228
+ can(statement, dialect4) {
12229
+ return statement.type === "enable_rls" && dialect4 === "postgresql";
12230
+ }
12231
+ convert(statement) {
12232
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12233
+ return `ALTER TABLE ${tableNameWithSchema} ENABLE ROW LEVEL SECURITY;`;
12234
+ }
12235
+ };
12236
+ PgDisableRlsConvertor = class extends Convertor {
12237
+ can(statement, dialect4) {
12238
+ return statement.type === "disable_rls" && dialect4 === "postgresql";
12239
+ }
12240
+ convert(statement) {
12241
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12242
+ return `ALTER TABLE ${tableNameWithSchema} DISABLE ROW LEVEL SECURITY;`;
12243
+ }
12244
+ };
12003
12245
  PgCreateTableConvertor = class extends Convertor {
12004
12246
  can(statement, dialect4) {
12005
12247
  return statement.type === "create_table" && dialect4 === "postgresql";
12006
12248
  }
12007
12249
  convert(st) {
12008
- const { tableName, schema: schema4, columns, compositePKs, uniqueConstraints, checkConstraints } = st;
12250
+ const { tableName, schema: schema4, columns, compositePKs, uniqueConstraints, checkConstraints, policies, isRLSEnabled } = st;
12009
12251
  let statement = "";
12010
12252
  const name2 = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
12011
12253
  statement += `CREATE TABLE IF NOT EXISTS ${name2} (
@@ -12049,7 +12291,12 @@ var init_sqlgenerator = __esm({
12049
12291
  );`;
12050
12292
  statement += `
12051
12293
  `;
12052
- return statement;
12294
+ const enableRls = new PgEnableRlsConvertor().convert({
12295
+ type: "enable_rls",
12296
+ tableName,
12297
+ schema: schema4
12298
+ });
12299
+ return [statement, ...policies && policies.length > 0 || isRLSEnabled ? [enableRls] : []];
12053
12300
  }
12054
12301
  };
12055
12302
  MySqlCreateTableConvertor = class extends Convertor {
@@ -12648,9 +12895,21 @@ WITH ${withCheckOption} CHECK OPTION` : "";
12648
12895
  return statement.type === "drop_table" && dialect4 === "postgresql";
12649
12896
  }
12650
12897
  convert(statement) {
12651
- const { tableName, schema: schema4 } = statement;
12898
+ const { tableName, schema: schema4, policies } = statement;
12652
12899
  const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
12653
- return `DROP TABLE ${tableNameWithSchema};`;
12900
+ const dropPolicyConvertor = new PgDropPolicyConvertor();
12901
+ const droppedPolicies = policies?.map((p) => {
12902
+ return dropPolicyConvertor.convert({
12903
+ type: "drop_policy",
12904
+ tableName,
12905
+ data: PgSquasher.unsquashPolicy(p),
12906
+ schema: schema4
12907
+ });
12908
+ }) ?? [];
12909
+ return [
12910
+ ...droppedPolicies,
12911
+ `DROP TABLE ${tableNameWithSchema} CASCADE;`
12912
+ ];
12654
12913
  }
12655
12914
  };
12656
12915
  MySQLDropTableConvertor = class extends Convertor {
@@ -13852,6 +14111,16 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
13852
14111
  convertors.push(new PgAlterTableAlterColumnDropNotNullConvertor());
13853
14112
  convertors.push(new PgAlterTableAlterColumnSetDefaultConvertor());
13854
14113
  convertors.push(new PgAlterTableAlterColumnDropDefaultConvertor());
14114
+ convertors.push(new PgAlterPolicyConvertor());
14115
+ convertors.push(new PgCreatePolicyConvertor());
14116
+ convertors.push(new PgDropPolicyConvertor());
14117
+ convertors.push(new PgRenamePolicyConvertor());
14118
+ convertors.push(new PgEnableRlsConvertor());
14119
+ convertors.push(new PgDisableRlsConvertor());
14120
+ convertors.push(new PgDropRoleConvertor());
14121
+ convertors.push(new PgAlterRoleConvertor());
14122
+ convertors.push(new PgCreateRoleConvertor());
14123
+ convertors.push(new PgRenameRoleConvertor());
13855
14124
  convertors.push(new PgAlterTableAlterColumnSetExpressionConvertor());
13856
14125
  convertors.push(new PgAlterTableAlterColumnDropGeneratedConvertor());
13857
14126
  convertors.push(new PgAlterTableAlterColumnAlterrGeneratedConvertor());
@@ -14151,7 +14420,7 @@ var init_sqlitePushUtils = __esm({
14151
14420
  });
14152
14421
 
14153
14422
  // src/jsonStatements.ts
14154
- 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;
14423
+ 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;
14155
14424
  var init_jsonStatements = __esm({
14156
14425
  "src/jsonStatements.ts"() {
14157
14426
  "use strict";
@@ -14162,7 +14431,7 @@ var init_jsonStatements = __esm({
14162
14431
  init_pgSchema();
14163
14432
  init_sqliteSchema();
14164
14433
  preparePgCreateTableJson = (table4, json22) => {
14165
- const { name: name2, schema: schema4, columns, compositePrimaryKeys, uniqueConstraints, checkConstraints } = table4;
14434
+ const { name: name2, schema: schema4, columns, compositePrimaryKeys, uniqueConstraints, checkConstraints, policies, isRLSEnabled } = table4;
14166
14435
  const tableKey2 = `${schema4 || "public"}.${name2}`;
14167
14436
  const compositePkName = Object.values(compositePrimaryKeys).length > 0 ? json22.tables[tableKey2].compositePrimaryKeys[`${PgSquasher.unsquashPK(Object.values(compositePrimaryKeys)[0]).name}`].name : "";
14168
14437
  return {
@@ -14173,7 +14442,9 @@ var init_jsonStatements = __esm({
14173
14442
  compositePKs: Object.values(compositePrimaryKeys),
14174
14443
  compositePkName,
14175
14444
  uniqueConstraints: Object.values(uniqueConstraints),
14176
- checkConstraints: Object.values(checkConstraints)
14445
+ policies: Object.values(policies),
14446
+ checkConstraints: Object.values(checkConstraints),
14447
+ isRLSEnabled: isRLSEnabled ?? false
14177
14448
  };
14178
14449
  };
14179
14450
  prepareMySqlCreateTableJson = (table4, json22, internals) => {
@@ -14213,7 +14484,8 @@ var init_jsonStatements = __esm({
14213
14484
  return {
14214
14485
  type: "drop_table",
14215
14486
  tableName: table4.name,
14216
- schema: table4.schema
14487
+ schema: table4.schema,
14488
+ policies: table4.policies ? Object.values(table4.policies) : []
14217
14489
  };
14218
14490
  };
14219
14491
  prepareRenameTableJson = (tableFrom, tableTo) => {
@@ -14331,6 +14603,41 @@ var init_jsonStatements = __esm({
14331
14603
  schema: schema4
14332
14604
  };
14333
14605
  };
14606
+ prepareCreateRoleJson = (role) => {
14607
+ return {
14608
+ type: "create_role",
14609
+ name: role.name,
14610
+ values: {
14611
+ createDb: role.createDb,
14612
+ createRole: role.createRole,
14613
+ inherit: role.inherit
14614
+ }
14615
+ };
14616
+ };
14617
+ prepareAlterRoleJson = (role) => {
14618
+ return {
14619
+ type: "alter_role",
14620
+ name: role.name,
14621
+ values: {
14622
+ createDb: role.createDb,
14623
+ createRole: role.createRole,
14624
+ inherit: role.inherit
14625
+ }
14626
+ };
14627
+ };
14628
+ prepareDropRoleJson = (name2) => {
14629
+ return {
14630
+ type: "drop_role",
14631
+ name: name2
14632
+ };
14633
+ };
14634
+ prepareRenameRoleJson = (nameFrom, nameTo) => {
14635
+ return {
14636
+ type: "rename_role",
14637
+ nameFrom,
14638
+ nameTo
14639
+ };
14640
+ };
14334
14641
  prepareCreateSchemasJson = (values) => {
14335
14642
  return values.map((it) => {
14336
14643
  return {
@@ -15227,6 +15534,46 @@ var init_jsonStatements = __esm({
15227
15534
  }
15228
15535
  return [...dropPkStatements, ...setPkStatements, ...statements];
15229
15536
  };
15537
+ prepareRenamePolicyJsons = (tableName, schema4, renames) => {
15538
+ return renames.map((it) => {
15539
+ return {
15540
+ type: "rename_policy",
15541
+ tableName,
15542
+ oldName: it.from.name,
15543
+ newName: it.to.name,
15544
+ schema: schema4
15545
+ };
15546
+ });
15547
+ };
15548
+ prepareCreatePolicyJsons = (tableName, schema4, policies) => {
15549
+ return policies.map((it) => {
15550
+ return {
15551
+ type: "create_policy",
15552
+ tableName,
15553
+ data: it,
15554
+ schema: schema4
15555
+ };
15556
+ });
15557
+ };
15558
+ prepareDropPolicyJsons = (tableName, schema4, policies) => {
15559
+ return policies.map((it) => {
15560
+ return {
15561
+ type: "drop_policy",
15562
+ tableName,
15563
+ data: it,
15564
+ schema: schema4
15565
+ };
15566
+ });
15567
+ };
15568
+ prepareAlterPolicyJson = (tableName, schema4, oldPolicy, newPolicy) => {
15569
+ return {
15570
+ type: "alter_policy",
15571
+ tableName,
15572
+ oldData: oldPolicy,
15573
+ newData: newPolicy,
15574
+ schema: schema4
15575
+ };
15576
+ };
15230
15577
  preparePgCreateIndexesJson = (tableName, schema4, indexes, fullSchema, action) => {
15231
15578
  if (action === "push") {
15232
15579
  return Object.values(indexes).map((indexData) => {
@@ -16053,7 +16400,9 @@ var init_snapshotsDiffer = __esm({
16053
16400
  foreignKeys: recordType(stringType(), stringType()),
16054
16401
  compositePrimaryKeys: recordType(stringType(), stringType()).default({}),
16055
16402
  uniqueConstraints: recordType(stringType(), stringType()).default({}),
16056
- checkConstraints: recordType(stringType(), stringType()).default({})
16403
+ policies: recordType(stringType(), stringType()).default({}),
16404
+ checkConstraints: recordType(stringType(), stringType()).default({}),
16405
+ isRLSEnabled: booleanType().default(false)
16057
16406
  }).strict();
16058
16407
  alteredTableScheme = objectType({
16059
16408
  name: stringType(),
@@ -16095,6 +16444,15 @@ var init_snapshotsDiffer = __esm({
16095
16444
  __old: stringType()
16096
16445
  })
16097
16446
  ),
16447
+ addedPolicies: recordType(stringType(), stringType()),
16448
+ deletedPolicies: recordType(stringType(), stringType()),
16449
+ alteredPolicies: recordType(
16450
+ stringType(),
16451
+ objectType({
16452
+ __new: stringType(),
16453
+ __old: stringType()
16454
+ })
16455
+ ),
16098
16456
  addedCheckConstraints: recordType(
16099
16457
  stringType(),
16100
16458
  stringType()
@@ -16156,6 +16514,7 @@ var init_snapshotsDiffer = __esm({
16156
16514
  alteredTablesWithColumns: alteredTableScheme.array(),
16157
16515
  alteredEnums: changedEnumSchema.array(),
16158
16516
  alteredSequences: sequenceSquashed.array(),
16517
+ alteredRoles: roleSchema.array(),
16159
16518
  alteredViews: alteredPgViewSchema.array()
16160
16519
  }).strict();
16161
16520
  diffResultSchemeMysql = objectType({
@@ -16213,7 +16572,7 @@ var init_snapshotsDiffer = __esm({
16213
16572
  }
16214
16573
  return column4;
16215
16574
  };
16216
- applyPgSnapshotsDiff = async (json1, json22, schemasResolver2, enumsResolver2, sequencesResolver2, tablesResolver2, columnsResolver2, viewsResolver2, prevFull, curFull, action) => {
16575
+ applyPgSnapshotsDiff = async (json1, json22, schemasResolver2, enumsResolver2, sequencesResolver2, policyResolver2, roleResolver2, tablesResolver2, columnsResolver2, viewsResolver2, prevFull, curFull, action) => {
16217
16576
  const schemasDiff = diffSchemasOrTables(json1.schemas, json22.schemas);
16218
16577
  const {
16219
16578
  created: createdSchemas,
@@ -16363,6 +16722,47 @@ var init_snapshotsDiffer = __esm({
16363
16722
  return [tableKey2, tableValue];
16364
16723
  }
16365
16724
  );
16725
+ const rolesDiff = diffSchemasOrTables(
16726
+ schemasPatchedSnap1.roles,
16727
+ json22.roles
16728
+ );
16729
+ const {
16730
+ created: createdRoles,
16731
+ deleted: deletedRoles,
16732
+ renamed: renamedRoles
16733
+ } = await roleResolver2({
16734
+ created: rolesDiff.added,
16735
+ deleted: rolesDiff.deleted
16736
+ });
16737
+ schemasPatchedSnap1.roles = mapEntries(
16738
+ schemasPatchedSnap1.roles,
16739
+ (_2, it) => {
16740
+ const { name: name2 } = nameChangeFor(it, renamedRoles);
16741
+ it.name = name2;
16742
+ return [name2, it];
16743
+ }
16744
+ );
16745
+ const rolesChangeMap = renamedRoles.reduce(
16746
+ (acc, it) => {
16747
+ acc[it.from.name] = {
16748
+ nameFrom: it.from.name,
16749
+ nameTo: it.to.name
16750
+ };
16751
+ return acc;
16752
+ },
16753
+ {}
16754
+ );
16755
+ schemasPatchedSnap1.roles = mapEntries(
16756
+ schemasPatchedSnap1.roles,
16757
+ (roleKey, roleValue) => {
16758
+ const key = roleKey;
16759
+ const change = rolesChangeMap[key];
16760
+ if (change) {
16761
+ roleValue.name = change.nameTo;
16762
+ }
16763
+ return [roleKey, roleValue];
16764
+ }
16765
+ );
16366
16766
  const tablesDiff = diffSchemasOrTables(
16367
16767
  schemasPatchedSnap1.tables,
16368
16768
  json22.tables
@@ -16441,7 +16841,66 @@ var init_snapshotsDiffer = __esm({
16441
16841
  return [tableKey2, tableValue];
16442
16842
  }
16443
16843
  );
16444
- const viewsDiff = diffSchemasOrTables(json1.views, json22.views);
16844
+ const policyRes = diffPolicies(tablesPatchedSnap1.tables, json22.tables);
16845
+ const policyRenames = [];
16846
+ const policyCreates = [];
16847
+ const policyDeletes = [];
16848
+ for (let entry of Object.values(policyRes)) {
16849
+ const { renamed, created, deleted } = await policyResolver2({
16850
+ tableName: entry.name,
16851
+ schema: entry.schema,
16852
+ deleted: entry.policies.deleted.map(PgSquasher.unsquashPolicy),
16853
+ created: entry.policies.added.map(PgSquasher.unsquashPolicy)
16854
+ });
16855
+ if (created.length > 0) {
16856
+ policyCreates.push({
16857
+ table: entry.name,
16858
+ schema: entry.schema,
16859
+ columns: created
16860
+ });
16861
+ }
16862
+ if (deleted.length > 0) {
16863
+ policyDeletes.push({
16864
+ table: entry.name,
16865
+ schema: entry.schema,
16866
+ columns: deleted
16867
+ });
16868
+ }
16869
+ if (renamed.length > 0) {
16870
+ policyRenames.push({
16871
+ table: entry.name,
16872
+ schema: entry.schema,
16873
+ renames: renamed
16874
+ });
16875
+ }
16876
+ }
16877
+ const policyRenamesDict = columnRenames.reduce(
16878
+ (acc, it) => {
16879
+ acc[`${it.schema || "public"}.${it.table}`] = it.renames;
16880
+ return acc;
16881
+ },
16882
+ {}
16883
+ );
16884
+ const policyPatchedSnap1 = copy(tablesPatchedSnap1);
16885
+ policyPatchedSnap1.tables = mapEntries(
16886
+ policyPatchedSnap1.tables,
16887
+ (tableKey2, tableValue) => {
16888
+ const patchedPolicies = mapKeys(
16889
+ tableValue.policies,
16890
+ (policyKey, policy2) => {
16891
+ const rens = policyRenamesDict[`${tableValue.schema || "public"}.${tableValue.name}`] || [];
16892
+ const newName = columnChangeFor(policyKey, rens);
16893
+ const unsquashedPolicy = PgSquasher.unsquashPolicy(policy2);
16894
+ unsquashedPolicy.name = newName;
16895
+ policy2 = PgSquasher.squashPolicy(unsquashedPolicy);
16896
+ return newName;
16897
+ }
16898
+ );
16899
+ tableValue.policies = patchedPolicies;
16900
+ return [tableKey2, tableValue];
16901
+ }
16902
+ );
16903
+ const viewsDiff = diffSchemasOrTables(policyPatchedSnap1.views, json22.views);
16445
16904
  const {
16446
16905
  created: createdViews,
16447
16906
  deleted: deletedViews,
@@ -16459,7 +16918,7 @@ var init_snapshotsDiffer = __esm({
16459
16918
  movedViews.forEach((it) => {
16460
16919
  movedViewDic[`${it.schemaFrom}.${it.name}`] = { to: it.schemaTo, from: it.schemaFrom };
16461
16920
  });
16462
- const viewsPatchedSnap1 = copy(columnsPatchedSnap1);
16921
+ const viewsPatchedSnap1 = copy(policyPatchedSnap1);
16463
16922
  viewsPatchedSnap1.views = mapEntries(
16464
16923
  viewsPatchedSnap1.views,
16465
16924
  (viewKey, viewValue) => {
@@ -16517,13 +16976,15 @@ var init_snapshotsDiffer = __esm({
16517
16976
  const jsonDeletedUniqueConstraints = [];
16518
16977
  const jsonAlteredUniqueConstraints = [];
16519
16978
  const jsonSetTableSchemas = [];
16520
- for (let it of movedTables) {
16521
- jsonSetTableSchemas.push({
16522
- type: "alter_table_set_schema",
16523
- tableName: it.name,
16524
- schemaFrom: it.schemaFrom || "public",
16525
- schemaTo: it.schemaTo || "public"
16526
- });
16979
+ if (movedTables) {
16980
+ for (let it of movedTables) {
16981
+ jsonSetTableSchemas.push({
16982
+ type: "alter_table_set_schema",
16983
+ tableName: it.name,
16984
+ schemaFrom: it.schemaFrom || "public",
16985
+ schemaTo: it.schemaTo || "public"
16986
+ });
16987
+ }
16527
16988
  }
16528
16989
  const jsonDeletedCheckConstraints = [];
16529
16990
  const jsonCreatedCheckConstraints = [];
@@ -16650,7 +17111,106 @@ var init_snapshotsDiffer = __esm({
16650
17111
  it.deletedIndexes || {}
16651
17112
  );
16652
17113
  }).flat();
17114
+ const jsonCreatePoliciesStatements = [];
17115
+ const jsonDropPoliciesStatements = [];
17116
+ const jsonAlterPoliciesStatements = [];
17117
+ const jsonRenamePoliciesStatements = [];
17118
+ const jsonEnableRLSStatements = [];
17119
+ const jsonDisableRLSStatements = [];
17120
+ for (let it of policyRenames) {
17121
+ jsonRenamePoliciesStatements.push(
17122
+ ...prepareRenamePolicyJsons(it.table, it.schema, it.renames)
17123
+ );
17124
+ }
17125
+ for (const it of policyCreates) {
17126
+ jsonCreatePoliciesStatements.push(
17127
+ ...prepareCreatePolicyJsons(
17128
+ it.table,
17129
+ it.schema,
17130
+ it.columns
17131
+ )
17132
+ );
17133
+ }
17134
+ for (const it of policyDeletes) {
17135
+ jsonDropPoliciesStatements.push(
17136
+ ...prepareDropPolicyJsons(
17137
+ it.table,
17138
+ it.schema,
17139
+ it.columns
17140
+ )
17141
+ );
17142
+ }
16653
17143
  alteredTables.forEach((it) => {
17144
+ Object.keys(it.alteredPolicies).forEach((policyName) => {
17145
+ const newPolicy = PgSquasher.unsquashPolicy(it.alteredPolicies[policyName].__new);
17146
+ const oldPolicy = PgSquasher.unsquashPolicy(it.alteredPolicies[policyName].__old);
17147
+ if (newPolicy.as !== oldPolicy.as) {
17148
+ jsonDropPoliciesStatements.push(
17149
+ ...prepareDropPolicyJsons(
17150
+ it.name,
17151
+ it.schema,
17152
+ [oldPolicy]
17153
+ )
17154
+ );
17155
+ jsonCreatePoliciesStatements.push(
17156
+ ...prepareCreatePolicyJsons(
17157
+ it.name,
17158
+ it.schema,
17159
+ [newPolicy]
17160
+ )
17161
+ );
17162
+ return;
17163
+ }
17164
+ if (newPolicy.for !== oldPolicy.for) {
17165
+ jsonDropPoliciesStatements.push(
17166
+ ...prepareDropPolicyJsons(
17167
+ it.name,
17168
+ it.schema,
17169
+ [oldPolicy]
17170
+ )
17171
+ );
17172
+ jsonCreatePoliciesStatements.push(
17173
+ ...prepareCreatePolicyJsons(
17174
+ it.name,
17175
+ it.schema,
17176
+ [newPolicy]
17177
+ )
17178
+ );
17179
+ return;
17180
+ }
17181
+ jsonAlterPoliciesStatements.push(
17182
+ prepareAlterPolicyJson(
17183
+ it.name,
17184
+ it.schema,
17185
+ it.alteredPolicies[policyName].__old,
17186
+ it.alteredPolicies[policyName].__new
17187
+ )
17188
+ );
17189
+ });
17190
+ for (const table4 of Object.values(json22.tables)) {
17191
+ const policiesInCurrentState = Object.keys(table4.policies);
17192
+ const tableInPreviousState = columnsPatchedSnap1.tables[`${table4.schema === "" ? "public" : table4.schema}.${table4.name}`];
17193
+ const policiesInPreviousState = tableInPreviousState ? Object.keys(tableInPreviousState.policies) : [];
17194
+ if (policiesInPreviousState.length === 0 && policiesInCurrentState.length > 0 && !table4.isRLSEnabled) {
17195
+ jsonEnableRLSStatements.push({ type: "enable_rls", tableName: table4.name, schema: table4.schema });
17196
+ }
17197
+ if (policiesInPreviousState.length > 0 && policiesInCurrentState.length === 0 && !table4.isRLSEnabled) {
17198
+ jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
17199
+ }
17200
+ if (table4.isRLSEnabled !== tableInPreviousState.isRLSEnabled) {
17201
+ if (table4.isRLSEnabled) {
17202
+ jsonEnableRLSStatements.push({ type: "enable_rls", tableName: table4.name, schema: table4.schema });
17203
+ } else if (!table4.isRLSEnabled && policiesInCurrentState.length === 0) {
17204
+ jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
17205
+ }
17206
+ }
17207
+ }
17208
+ for (const table4 of Object.values(columnsPatchedSnap1.tables)) {
17209
+ const tableInCurrentState = json22.tables[`${table4.schema === "" ? "public" : table4.schema}.${table4.name}`];
17210
+ if (tableInCurrentState === void 0 && !table4.isRLSEnabled) {
17211
+ jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
17212
+ }
17213
+ }
16654
17214
  const droppedIndexes = Object.keys(it.alteredIndexes).reduce(
16655
17215
  (current, item) => {
16656
17216
  current[item] = it.alteredIndexes[item].__old;
@@ -16738,6 +17298,18 @@ var init_snapshotsDiffer = __esm({
16738
17298
  const jsonAlterSequences = typedResult.alteredSequences.map((it) => {
16739
17299
  return prepareAlterSequenceJson(it);
16740
17300
  }).flat() ?? [];
17301
+ const createRoles = createdRoles.map((it) => {
17302
+ return prepareCreateRoleJson(it);
17303
+ }) ?? [];
17304
+ const dropRoles = deletedRoles.map((it) => {
17305
+ return prepareDropRoleJson(it.name);
17306
+ });
17307
+ const renameRoles = renamedRoles.map((it) => {
17308
+ return prepareRenameRoleJson(it.from.name, it.to.name);
17309
+ });
17310
+ const jsonAlterRoles = typedResult.alteredRoles.map((it) => {
17311
+ return prepareAlterRoleJson(it);
17312
+ }).flat() ?? [];
16741
17313
  const createSchemas = prepareCreateSchemasJson(
16742
17314
  createdSchemas.map((it) => it.name)
16743
17315
  );
@@ -16750,6 +17322,11 @@ var init_snapshotsDiffer = __esm({
16750
17322
  const createTables = createdTables.map((it) => {
16751
17323
  return preparePgCreateTableJson(it, curFull);
16752
17324
  });
17325
+ jsonCreatePoliciesStatements.push(...[].concat(
17326
+ ...createdTables.map(
17327
+ (it) => prepareCreatePolicyJsons(it.name, it.schema, Object.values(it.policies).map(PgSquasher.unsquashPolicy))
17328
+ )
17329
+ ));
16753
17330
  const createViews = [];
16754
17331
  const dropViews = [];
16755
17332
  const renameViews = [];
@@ -16891,7 +17468,13 @@ var init_snapshotsDiffer = __esm({
16891
17468
  jsonStatements.push(...moveSequences);
16892
17469
  jsonStatements.push(...renameSequences);
16893
17470
  jsonStatements.push(...jsonAlterSequences);
17471
+ jsonStatements.push(...renameRoles);
17472
+ jsonStatements.push(...dropRoles);
17473
+ jsonStatements.push(...createRoles);
17474
+ jsonStatements.push(...jsonAlterRoles);
16894
17475
  jsonStatements.push(...createTables);
17476
+ jsonStatements.push(...jsonEnableRLSStatements);
17477
+ jsonStatements.push(...jsonDisableRLSStatements);
16895
17478
  jsonStatements.push(...dropViews);
16896
17479
  jsonStatements.push(...renameViews);
16897
17480
  jsonStatements.push(...alterViews);
@@ -16917,6 +17500,10 @@ var init_snapshotsDiffer = __esm({
16917
17500
  jsonStatements.push(...jsonCreatedCheckConstraints);
16918
17501
  jsonStatements.push(...jsonAlteredUniqueConstraints);
16919
17502
  jsonStatements.push(...jsonAlterEnumsWithDroppedValues);
17503
+ jsonStatements.push(...jsonRenamePoliciesStatements);
17504
+ jsonStatements.push(...jsonDropPoliciesStatements);
17505
+ jsonStatements.push(...jsonCreatePoliciesStatements);
17506
+ jsonStatements.push(...jsonAlterPoliciesStatements);
16920
17507
  jsonStatements.push(...createViews);
16921
17508
  jsonStatements.push(...dropEnums);
16922
17509
  jsonStatements.push(...dropSequences);
@@ -18309,7 +18896,7 @@ var init_outputs = __esm({
18309
18896
  });
18310
18897
 
18311
18898
  // src/cli/commands/migrate.ts
18312
- var import_hanji2, schemasResolver, tablesResolver, viewsResolver, mySqlViewsResolver, sqliteViewsResolver, sequencesResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT;
18899
+ var import_hanji2, schemasResolver, tablesResolver, viewsResolver, mySqlViewsResolver, sqliteViewsResolver, sequencesResolver, roleResolver, policyResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedConflict, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT;
18313
18900
  var init_migrate = __esm({
18314
18901
  "src/cli/commands/migrate.ts"() {
18315
18902
  "use strict";
@@ -18426,6 +19013,32 @@ var init_migrate = __esm({
18426
19013
  throw e;
18427
19014
  }
18428
19015
  };
19016
+ roleResolver = async (input) => {
19017
+ const result = await promptNamedConflict(
19018
+ input.created,
19019
+ input.deleted,
19020
+ "role"
19021
+ );
19022
+ return {
19023
+ created: result.created,
19024
+ deleted: result.deleted,
19025
+ renamed: result.renamed
19026
+ };
19027
+ };
19028
+ policyResolver = async (input) => {
19029
+ const result = await promptColumnsConflicts(
19030
+ input.tableName,
19031
+ input.created,
19032
+ input.deleted
19033
+ );
19034
+ return {
19035
+ tableName: input.tableName,
19036
+ schema: input.schema,
19037
+ created: result.created,
19038
+ deleted: result.deleted,
19039
+ renamed: result.renamed
19040
+ };
19041
+ };
18429
19042
  enumsResolver = async (input) => {
18430
19043
  try {
18431
19044
  const { created, deleted, moved, renamed } = await promptNamedWithSchemasConflict(
@@ -18508,6 +19121,56 @@ var init_migrate = __esm({
18508
19121
  result.deleted.push(...leftMissing);
18509
19122
  return result;
18510
19123
  };
19124
+ promptNamedConflict = async (newItems, missingItems, entity) => {
19125
+ if (missingItems.length === 0 || newItems.length === 0) {
19126
+ return {
19127
+ created: newItems,
19128
+ renamed: [],
19129
+ deleted: missingItems
19130
+ };
19131
+ }
19132
+ const result = { created: [], renamed: [], deleted: [] };
19133
+ let index4 = 0;
19134
+ let leftMissing = [...missingItems];
19135
+ do {
19136
+ const created = newItems[index4];
19137
+ const renames = leftMissing.map((it) => {
19138
+ return { from: it, to: created };
19139
+ });
19140
+ const promptData = [created, ...renames];
19141
+ const { status, data } = await (0, import_hanji2.render)(
19142
+ new ResolveSelectNamed(created, promptData, entity)
19143
+ );
19144
+ if (status === "aborted") {
19145
+ console.error("ERROR");
19146
+ process.exit(1);
19147
+ }
19148
+ if (isRenamePromptItem(data)) {
19149
+ console.log(
19150
+ `${source_default.yellow("~")} ${data.from.name} \u203A ${data.to.name} ${source_default.gray(
19151
+ `${entity} will be renamed/moved`
19152
+ )}`
19153
+ );
19154
+ if (data.from.name !== data.to.name) {
19155
+ result.renamed.push(data);
19156
+ }
19157
+ delete leftMissing[leftMissing.indexOf(data.from)];
19158
+ leftMissing = leftMissing.filter(Boolean);
19159
+ } else {
19160
+ console.log(
19161
+ `${source_default.green("+")} ${data.name} ${source_default.gray(
19162
+ `${entity} will be created`
19163
+ )}`
19164
+ );
19165
+ result.created.push(created);
19166
+ }
19167
+ index4 += 1;
19168
+ } while (index4 < newItems.length);
19169
+ console.log(source_default.gray(`--- all ${entity} conflicts resolved ---
19170
+ `));
19171
+ result.deleted.push(...leftMissing);
19172
+ return result;
19173
+ };
18511
19174
  promptNamedWithSchemasConflict = async (newItems, missingItems, entity) => {
18512
19175
  if (missingItems.length === 0 || newItems.length === 0) {
18513
19176
  return {
@@ -20064,8 +20727,8 @@ function parsePgArray(arrayString) {
20064
20727
  const [result] = parsePgNestedArray(arrayString, 1);
20065
20728
  return result;
20066
20729
  }
20067
- function makePgArray(array) {
20068
- return `{${array.map((item) => {
20730
+ function makePgArray(array2) {
20731
+ return `{${array2.map((item) => {
20069
20732
  if (Array.isArray(item)) {
20070
20733
  return makePgArray(item);
20071
20734
  }
@@ -20773,8 +21436,8 @@ var init_sql = __esm({
20773
21436
  sql2.param = param2;
20774
21437
  })(sql || (sql = {}));
20775
21438
  ((SQL2) => {
20776
- var _a324;
20777
- _a324 = entityKind;
21439
+ var _a326;
21440
+ _a326 = entityKind;
20778
21441
  const _Aliased = class _Aliased {
20779
21442
  constructor(sql2, fieldAlias) {
20780
21443
  /** @internal */
@@ -20790,7 +21453,7 @@ var init_sql = __esm({
20790
21453
  return new _Aliased(this.sql, this.fieldAlias);
20791
21454
  }
20792
21455
  };
20793
- __publicField(_Aliased, _a324, "SQL.Aliased");
21456
+ __publicField(_Aliased, _a326, "SQL.Aliased");
20794
21457
  let Aliased = _Aliased;
20795
21458
  SQL2.Aliased = Aliased;
20796
21459
  })(SQL || (SQL = {}));
@@ -21073,8 +21736,8 @@ function arrayContains(column4, values) {
21073
21736
  if (values.length === 0) {
21074
21737
  throw new Error("arrayContains requires at least one value");
21075
21738
  }
21076
- const array = sql`${bindIfParam(values, column4)}`;
21077
- return sql`${column4} @> ${array}`;
21739
+ const array2 = sql`${bindIfParam(values, column4)}`;
21740
+ return sql`${column4} @> ${array2}`;
21078
21741
  }
21079
21742
  return sql`${column4} @> ${bindIfParam(values, column4)}`;
21080
21743
  }
@@ -21083,8 +21746,8 @@ function arrayContained(column4, values) {
21083
21746
  if (values.length === 0) {
21084
21747
  throw new Error("arrayContained requires at least one value");
21085
21748
  }
21086
- const array = sql`${bindIfParam(values, column4)}`;
21087
- return sql`${column4} <@ ${array}`;
21749
+ const array2 = sql`${bindIfParam(values, column4)}`;
21750
+ return sql`${column4} <@ ${array2}`;
21088
21751
  }
21089
21752
  return sql`${column4} <@ ${bindIfParam(values, column4)}`;
21090
21753
  }
@@ -21093,8 +21756,8 @@ function arrayOverlaps(column4, values) {
21093
21756
  if (values.length === 0) {
21094
21757
  throw new Error("arrayOverlaps requires at least one value");
21095
21758
  }
21096
- const array = sql`${bindIfParam(values, column4)}`;
21097
- return sql`${column4} && ${array}`;
21759
+ const array2 = sql`${bindIfParam(values, column4)}`;
21760
+ return sql`${column4} && ${array2}`;
21098
21761
  }
21099
21762
  return sql`${column4} && ${bindIfParam(values, column4)}`;
21100
21763
  }
@@ -23055,9 +23718,14 @@ function pgTableWithSchema(name2, columns, extraConfig, schema4, baseName = name
23055
23718
  if (extraConfig) {
23056
23719
  table4[PgTable.Symbol.ExtraConfigBuilder] = extraConfig;
23057
23720
  }
23058
- return table4;
23721
+ return Object.assign(table4, {
23722
+ enableRLS: () => {
23723
+ table4[PgTable.Symbol.EnableRLS] = true;
23724
+ return table4;
23725
+ }
23726
+ });
23059
23727
  }
23060
- var InlineForeignKeys, _a116, _b94, _c2, _d2, PgTable, pgTable;
23728
+ var InlineForeignKeys, EnableRLS, _a116, _b94, _c2, _d2, _e2, PgTable, pgTable;
23061
23729
  var init_table2 = __esm({
23062
23730
  "../drizzle-orm/dist/pg-core/table.js"() {
23063
23731
  "use strict";
@@ -23065,19 +23733,23 @@ var init_table2 = __esm({
23065
23733
  init_table();
23066
23734
  init_all();
23067
23735
  InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys");
23068
- PgTable = class extends (_d2 = Table, _c2 = entityKind, _b94 = InlineForeignKeys, _a116 = Table.Symbol.ExtraConfigBuilder, _d2) {
23736
+ EnableRLS = Symbol.for("drizzle:EnableRLS");
23737
+ PgTable = class extends (_e2 = Table, _d2 = entityKind, _c2 = InlineForeignKeys, _b94 = EnableRLS, _a116 = Table.Symbol.ExtraConfigBuilder, _e2) {
23069
23738
  constructor() {
23070
23739
  super(...arguments);
23071
23740
  /**@internal */
23072
- __publicField(this, _b94, []);
23741
+ __publicField(this, _c2, []);
23742
+ /** @internal */
23743
+ __publicField(this, _b94, false);
23073
23744
  /** @internal */
23074
23745
  __publicField(this, _a116);
23075
23746
  }
23076
23747
  };
23077
- __publicField(PgTable, _c2, "PgTable");
23748
+ __publicField(PgTable, _d2, "PgTable");
23078
23749
  /** @internal */
23079
23750
  __publicField(PgTable, "Symbol", Object.assign({}, Table.Symbol, {
23080
- InlineForeignKeys
23751
+ InlineForeignKeys,
23752
+ EnableRLS
23081
23753
  }));
23082
23754
  pgTable = (name2, columns, extraConfig) => {
23083
23755
  return pgTableWithSchema(name2, columns, extraConfig, void 0);
@@ -26805,6 +27477,73 @@ var init_indexes = __esm({
26805
27477
  }
26806
27478
  });
26807
27479
 
27480
+ // ../drizzle-orm/dist/pg-core/policies.js
27481
+ var _a147, PgPolicy;
27482
+ var init_policies = __esm({
27483
+ "../drizzle-orm/dist/pg-core/policies.js"() {
27484
+ "use strict";
27485
+ init_entity();
27486
+ _a147 = entityKind;
27487
+ PgPolicy = class {
27488
+ constructor(name2, config) {
27489
+ __publicField(this, "as");
27490
+ __publicField(this, "for");
27491
+ __publicField(this, "to");
27492
+ __publicField(this, "using");
27493
+ __publicField(this, "withCheck");
27494
+ /** @internal */
27495
+ __publicField(this, "_linkedTable");
27496
+ this.name = name2;
27497
+ if (config) {
27498
+ this.as = config.as;
27499
+ this.for = config.for;
27500
+ this.to = config.to;
27501
+ this.using = config.using;
27502
+ this.withCheck = config.withCheck;
27503
+ }
27504
+ }
27505
+ link(table4) {
27506
+ this._linkedTable = table4;
27507
+ return this;
27508
+ }
27509
+ };
27510
+ __publicField(PgPolicy, _a147, "PgPolicy");
27511
+ }
27512
+ });
27513
+
27514
+ // ../drizzle-orm/dist/pg-core/roles.js
27515
+ var _a148, PgRole;
27516
+ var init_roles = __esm({
27517
+ "../drizzle-orm/dist/pg-core/roles.js"() {
27518
+ "use strict";
27519
+ init_entity();
27520
+ _a148 = entityKind;
27521
+ PgRole = class {
27522
+ constructor(name2, config) {
27523
+ /** @internal */
27524
+ __publicField(this, "_existing");
27525
+ /** @internal */
27526
+ __publicField(this, "createDb");
27527
+ /** @internal */
27528
+ __publicField(this, "createRole");
27529
+ /** @internal */
27530
+ __publicField(this, "inherit");
27531
+ this.name = name2;
27532
+ if (config) {
27533
+ this.createDb = config.createDb;
27534
+ this.createRole = config.createRole;
27535
+ this.inherit = config.inherit;
27536
+ }
27537
+ }
27538
+ existing() {
27539
+ this._existing = true;
27540
+ return this;
27541
+ }
27542
+ };
27543
+ __publicField(PgRole, _a148, "PgRole");
27544
+ }
27545
+ });
27546
+
26808
27547
  // ../drizzle-orm/dist/pg-core/sequence.js
26809
27548
  function pgSequenceWithSchema(name2, options, schema4) {
26810
27549
  return new PgSequence(name2, options, schema4);
@@ -26812,12 +27551,12 @@ function pgSequenceWithSchema(name2, options, schema4) {
26812
27551
  function isPgSequence(obj) {
26813
27552
  return is(obj, PgSequence);
26814
27553
  }
26815
- var _a147, PgSequence;
27554
+ var _a149, PgSequence;
26816
27555
  var init_sequence = __esm({
26817
27556
  "../drizzle-orm/dist/pg-core/sequence.js"() {
26818
27557
  "use strict";
26819
27558
  init_entity();
26820
- _a147 = entityKind;
27559
+ _a149 = entityKind;
26821
27560
  PgSequence = class {
26822
27561
  constructor(seqName, seqOptions, schema4) {
26823
27562
  this.seqName = seqName;
@@ -26825,7 +27564,7 @@ var init_sequence = __esm({
26825
27564
  this.schema = schema4;
26826
27565
  }
26827
27566
  };
26828
- __publicField(PgSequence, _a147, "PgSequence");
27567
+ __publicField(PgSequence, _a149, "PgSequence");
26829
27568
  }
26830
27569
  });
26831
27570
 
@@ -26857,7 +27596,7 @@ function isPgView(obj) {
26857
27596
  function isPgMaterializedView(obj) {
26858
27597
  return is(obj, PgMaterializedView);
26859
27598
  }
26860
- 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;
27599
+ 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;
26861
27600
  var init_view = __esm({
26862
27601
  "../drizzle-orm/dist/pg-core/view.js"() {
26863
27602
  "use strict";
@@ -26868,7 +27607,7 @@ var init_view = __esm({
26868
27607
  init_table2();
26869
27608
  init_view_base();
26870
27609
  init_view_common2();
26871
- _a148 = entityKind;
27610
+ _a150 = entityKind;
26872
27611
  DefaultViewBuilderCore = class {
26873
27612
  constructor(name2, schema4) {
26874
27613
  __publicField(this, "config", {});
@@ -26880,8 +27619,8 @@ var init_view = __esm({
26880
27619
  return this;
26881
27620
  }
26882
27621
  };
26883
- __publicField(DefaultViewBuilderCore, _a148, "PgDefaultViewBuilderCore");
26884
- ViewBuilder = class extends (_b107 = DefaultViewBuilderCore, _a149 = entityKind, _b107) {
27622
+ __publicField(DefaultViewBuilderCore, _a150, "PgDefaultViewBuilderCore");
27623
+ ViewBuilder = class extends (_b107 = DefaultViewBuilderCore, _a151 = entityKind, _b107) {
26885
27624
  as(qb) {
26886
27625
  if (typeof qb === "function") {
26887
27626
  qb = qb(new QueryBuilder());
@@ -26907,8 +27646,8 @@ var init_view = __esm({
26907
27646
  );
26908
27647
  }
26909
27648
  };
26910
- __publicField(ViewBuilder, _a149, "PgViewBuilder");
26911
- ManualViewBuilder = class extends (_b108 = DefaultViewBuilderCore, _a150 = entityKind, _b108) {
27649
+ __publicField(ViewBuilder, _a151, "PgViewBuilder");
27650
+ ManualViewBuilder = class extends (_b108 = DefaultViewBuilderCore, _a152 = entityKind, _b108) {
26912
27651
  constructor(name2, columns, schema4) {
26913
27652
  super(name2, schema4);
26914
27653
  __publicField(this, "columns");
@@ -26953,8 +27692,8 @@ var init_view = __esm({
26953
27692
  );
26954
27693
  }
26955
27694
  };
26956
- __publicField(ManualViewBuilder, _a150, "PgManualViewBuilder");
26957
- _a151 = entityKind;
27695
+ __publicField(ManualViewBuilder, _a152, "PgManualViewBuilder");
27696
+ _a153 = entityKind;
26958
27697
  MaterializedViewBuilderCore = class {
26959
27698
  constructor(name2, schema4) {
26960
27699
  __publicField(this, "config", {});
@@ -26978,8 +27717,8 @@ var init_view = __esm({
26978
27717
  return this;
26979
27718
  }
26980
27719
  };
26981
- __publicField(MaterializedViewBuilderCore, _a151, "PgMaterializedViewBuilderCore");
26982
- MaterializedViewBuilder = class extends (_b109 = MaterializedViewBuilderCore, _a152 = entityKind, _b109) {
27720
+ __publicField(MaterializedViewBuilderCore, _a153, "PgMaterializedViewBuilderCore");
27721
+ MaterializedViewBuilder = class extends (_b109 = MaterializedViewBuilderCore, _a154 = entityKind, _b109) {
26983
27722
  as(qb) {
26984
27723
  if (typeof qb === "function") {
26985
27724
  qb = qb(new QueryBuilder());
@@ -27010,8 +27749,8 @@ var init_view = __esm({
27010
27749
  );
27011
27750
  }
27012
27751
  };
27013
- __publicField(MaterializedViewBuilder, _a152, "PgMaterializedViewBuilder");
27014
- ManualMaterializedViewBuilder = class extends (_b110 = MaterializedViewBuilderCore, _a153 = entityKind, _b110) {
27752
+ __publicField(MaterializedViewBuilder, _a154, "PgMaterializedViewBuilder");
27753
+ ManualMaterializedViewBuilder = class extends (_b110 = MaterializedViewBuilderCore, _a155 = entityKind, _b110) {
27015
27754
  constructor(name2, columns, schema4) {
27016
27755
  super(name2, schema4);
27017
27756
  __publicField(this, "columns");
@@ -27066,11 +27805,11 @@ var init_view = __esm({
27066
27805
  );
27067
27806
  }
27068
27807
  };
27069
- __publicField(ManualMaterializedViewBuilder, _a153, "PgManualMaterializedViewBuilder");
27070
- PgView2 = class extends (_c4 = PgViewBase, _b111 = entityKind, _a154 = PgViewConfig, _c4) {
27808
+ __publicField(ManualMaterializedViewBuilder, _a155, "PgManualMaterializedViewBuilder");
27809
+ PgView2 = class extends (_c4 = PgViewBase, _b111 = entityKind, _a156 = PgViewConfig, _c4) {
27071
27810
  constructor({ pgConfig, config }) {
27072
27811
  super(config);
27073
- __publicField(this, _a154);
27812
+ __publicField(this, _a156);
27074
27813
  if (pgConfig) {
27075
27814
  this[PgViewConfig] = {
27076
27815
  with: pgConfig.with
@@ -27080,10 +27819,10 @@ var init_view = __esm({
27080
27819
  };
27081
27820
  __publicField(PgView2, _b111, "PgView");
27082
27821
  PgMaterializedViewConfig = Symbol.for("drizzle:PgMaterializedViewConfig");
27083
- PgMaterializedView = class extends (_c5 = PgViewBase, _b112 = entityKind, _a155 = PgMaterializedViewConfig, _c5) {
27822
+ PgMaterializedView = class extends (_c5 = PgViewBase, _b112 = entityKind, _a157 = PgMaterializedViewConfig, _c5) {
27084
27823
  constructor({ pgConfig, config }) {
27085
27824
  super(config);
27086
- __publicField(this, _a155);
27825
+ __publicField(this, _a157);
27087
27826
  this[PgMaterializedViewConfig] = {
27088
27827
  with: pgConfig?.with,
27089
27828
  using: pgConfig?.using,
@@ -27097,7 +27836,7 @@ var init_view = __esm({
27097
27836
  });
27098
27837
 
27099
27838
  // ../drizzle-orm/dist/pg-core/schema.js
27100
- var _a156, PgSchema5;
27839
+ var _a158, PgSchema5;
27101
27840
  var init_schema = __esm({
27102
27841
  "../drizzle-orm/dist/pg-core/schema.js"() {
27103
27842
  "use strict";
@@ -27107,7 +27846,7 @@ var init_schema = __esm({
27107
27846
  init_sequence();
27108
27847
  init_table2();
27109
27848
  init_view();
27110
- _a156 = entityKind;
27849
+ _a158 = entityKind;
27111
27850
  PgSchema5 = class {
27112
27851
  constructor(schemaName) {
27113
27852
  __publicField(this, "table", (name2, columns, extraConfig) => {
@@ -27134,12 +27873,12 @@ var init_schema = __esm({
27134
27873
  return true;
27135
27874
  }
27136
27875
  };
27137
- __publicField(PgSchema5, _a156, "PgSchema");
27876
+ __publicField(PgSchema5, _a158, "PgSchema");
27138
27877
  }
27139
27878
  });
27140
27879
 
27141
27880
  // ../drizzle-orm/dist/pg-core/session.js
27142
- var _a157, PgPreparedQuery, _a158, PgSession, _a159, _b113, PgTransaction;
27881
+ var _a159, PgPreparedQuery, _a160, PgSession, _a161, _b113, PgTransaction;
27143
27882
  var init_session = __esm({
27144
27883
  "../drizzle-orm/dist/pg-core/session.js"() {
27145
27884
  "use strict";
@@ -27148,7 +27887,7 @@ var init_session = __esm({
27148
27887
  init_sql2();
27149
27888
  init_tracing();
27150
27889
  init_db();
27151
- _a157 = entityKind;
27890
+ _a159 = entityKind;
27152
27891
  PgPreparedQuery = class {
27153
27892
  constructor(query) {
27154
27893
  /** @internal */
@@ -27162,8 +27901,8 @@ var init_session = __esm({
27162
27901
  return response;
27163
27902
  }
27164
27903
  };
27165
- __publicField(PgPreparedQuery, _a157, "PgPreparedQuery");
27166
- _a158 = entityKind;
27904
+ __publicField(PgPreparedQuery, _a159, "PgPreparedQuery");
27905
+ _a160 = entityKind;
27167
27906
  PgSession = class {
27168
27907
  constructor(dialect4) {
27169
27908
  this.dialect = dialect4;
@@ -27196,8 +27935,8 @@ var init_session = __esm({
27196
27935
  );
27197
27936
  }
27198
27937
  };
27199
- __publicField(PgSession, _a158, "PgSession");
27200
- PgTransaction = class extends (_b113 = PgDatabase, _a159 = entityKind, _b113) {
27938
+ __publicField(PgSession, _a160, "PgSession");
27939
+ PgTransaction = class extends (_b113 = PgDatabase, _a161 = entityKind, _b113) {
27201
27940
  constructor(dialect4, session, schema4, nestedIndex = 0) {
27202
27941
  super(dialect4, session, schema4);
27203
27942
  this.schema = schema4;
@@ -27224,7 +27963,7 @@ var init_session = __esm({
27224
27963
  return this.session.execute(sql`set transaction ${this.getTransactionConfigSQL(config)}`);
27225
27964
  }
27226
27965
  };
27227
- __publicField(PgTransaction, _a159, "PgTransaction");
27966
+ __publicField(PgTransaction, _a161, "PgTransaction");
27228
27967
  }
27229
27968
  });
27230
27969
 
@@ -27245,10 +27984,13 @@ function getTableConfig(table4) {
27245
27984
  const uniqueConstraints = [];
27246
27985
  const name2 = table4[Table.Symbol.Name];
27247
27986
  const schema4 = table4[Table.Symbol.Schema];
27987
+ const policies = [];
27988
+ const enableRLS = table4[PgTable.Symbol.EnableRLS];
27248
27989
  const extraConfigBuilder = table4[PgTable.Symbol.ExtraConfigBuilder];
27249
27990
  if (extraConfigBuilder !== void 0) {
27250
27991
  const extraConfig = extraConfigBuilder(table4[Table.Symbol.ExtraConfigColumns]);
27251
- for (const builder of Object.values(extraConfig)) {
27992
+ const extraValues = Array.isArray(extraConfig) ? extraConfig.flat(1) : Object.values(extraConfig);
27993
+ for (const builder of extraValues) {
27252
27994
  if (is(builder, IndexBuilder)) {
27253
27995
  indexes.push(builder.build(table4));
27254
27996
  } else if (is(builder, CheckBuilder)) {
@@ -27259,6 +28001,8 @@ function getTableConfig(table4) {
27259
28001
  primaryKeys.push(builder.build(table4));
27260
28002
  } else if (is(builder, ForeignKeyBuilder)) {
27261
28003
  foreignKeys.push(builder.build(table4));
28004
+ } else if (is(builder, PgPolicy)) {
28005
+ policies.push(builder);
27262
28006
  }
27263
28007
  }
27264
28008
  }
@@ -27270,7 +28014,9 @@ function getTableConfig(table4) {
27270
28014
  primaryKeys,
27271
28015
  uniqueConstraints,
27272
28016
  name: name2,
27273
- schema: schema4
28017
+ schema: schema4,
28018
+ policies,
28019
+ enableRLS
27274
28020
  };
27275
28021
  }
27276
28022
  function getViewConfig(view4) {
@@ -27295,6 +28041,7 @@ var init_utils4 = __esm({
27295
28041
  init_checks();
27296
28042
  init_foreign_keys();
27297
28043
  init_indexes();
28044
+ init_policies();
27298
28045
  init_primary_keys();
27299
28046
  init_unique_constraint();
27300
28047
  init_view_common2();
@@ -27321,8 +28068,10 @@ var init_pg_core = __esm({
27321
28068
  init_dialect();
27322
28069
  init_foreign_keys();
27323
28070
  init_indexes();
28071
+ init_policies();
27324
28072
  init_primary_keys();
27325
28073
  init_query_builders();
28074
+ init_roles();
27326
28075
  init_schema();
27327
28076
  init_sequence();
27328
28077
  init_session();
@@ -27344,14 +28093,14 @@ function maxRangeForIdentityBasedOn(columnType) {
27344
28093
  return columnType === "integer" ? "2147483647" : columnType === "bigint" ? "9223372036854775807" : "32767";
27345
28094
  }
27346
28095
  function minRangeForIdentityBasedOn(columnType) {
27347
- return columnType === "integer" ? "-2147483648" : columnType === "bitint" ? "-9223372036854775808" : "-32768";
28096
+ return columnType === "integer" ? "-2147483648" : columnType === "bigint" ? "-9223372036854775808" : "-32768";
27348
28097
  }
27349
28098
  function stringFromDatabaseIdentityProperty(field) {
27350
28099
  return typeof field === "string" ? field : typeof field === "undefined" ? void 0 : typeof field === "bigint" ? field.toString() : String(field);
27351
28100
  }
27352
- function buildArrayString(array, sqlType) {
28101
+ function buildArrayString(array2, sqlType) {
27353
28102
  sqlType = sqlType.split("[")[0];
27354
- const values = array.map((value) => {
28103
+ const values = array2.map((value) => {
27355
28104
  if (typeof value === "number" || typeof value === "bigint") {
27356
28105
  return value.toString();
27357
28106
  } else if (typeof value === "boolean") {
@@ -27373,6 +28122,40 @@ function buildArrayString(array, sqlType) {
27373
28122
  }).join(",");
27374
28123
  return `{${values}}`;
27375
28124
  }
28125
+ function prepareRoles(entities) {
28126
+ let useRoles = false;
28127
+ const includeRoles = [];
28128
+ const excludeRoles = [];
28129
+ if (entities && entities.roles) {
28130
+ if (typeof entities.roles === "object") {
28131
+ if (entities.roles.provider) {
28132
+ if (entities.roles.provider === "supabase") {
28133
+ excludeRoles.push(...[
28134
+ "anon",
28135
+ "authenticator",
28136
+ "authenticated",
28137
+ "service_role",
28138
+ "supabase_auth_admin",
28139
+ "supabase_storage_admin",
28140
+ "dashboard_user",
28141
+ "supabase_admin"
28142
+ ]);
28143
+ } else if (entities.roles.provider === "neon") {
28144
+ excludeRoles.push(...["authenticated", "anonymous"]);
28145
+ }
28146
+ }
28147
+ if (entities.roles.include) {
28148
+ includeRoles.push(...entities.roles.include);
28149
+ }
28150
+ if (entities.roles.exclude) {
28151
+ excludeRoles.push(...entities.roles.exclude);
28152
+ }
28153
+ } else {
28154
+ useRoles = entities.roles;
28155
+ }
28156
+ }
28157
+ return { useRoles, includeRoles, excludeRoles };
28158
+ }
27376
28159
  var indexName, generatePgSnapshot, trimChar, fromDatabase, defaultForColumn, getColumnsInfoQuery;
27377
28160
  var init_pgSerializer = __esm({
27378
28161
  "src/serializer/pgSerializer.ts"() {
@@ -27388,15 +28171,27 @@ var init_pgSerializer = __esm({
27388
28171
  indexName = (tableName, columns) => {
27389
28172
  return `${tableName}_${columns.join("_")}_index`;
27390
28173
  };
27391
- generatePgSnapshot = (tables, enums, schemas, sequences, views, matViews, casing2, schemaFilter) => {
28174
+ generatePgSnapshot = (tables, enums, schemas, sequences, roles, policies, views, matViews, casing2, schemaFilter) => {
27392
28175
  const dialect4 = new PgDialect({ casing: casing2 });
27393
28176
  const result = {};
27394
28177
  const resultViews = {};
27395
28178
  const sequencesToReturn = {};
28179
+ const rolesToReturn = {};
27396
28180
  const indexesInSchema = {};
27397
28181
  for (const table4 of tables) {
27398
28182
  const checksInTable = {};
27399
- const { name: tableName, columns, indexes, foreignKeys, checks, schema: schema4, primaryKeys, uniqueConstraints } = getTableConfig(table4);
28183
+ const {
28184
+ name: tableName,
28185
+ columns,
28186
+ indexes,
28187
+ foreignKeys,
28188
+ checks,
28189
+ schema: schema4,
28190
+ primaryKeys,
28191
+ uniqueConstraints,
28192
+ policies: policies2,
28193
+ enableRLS
28194
+ } = getTableConfig(table4);
27400
28195
  if (schemaFilter && !schemaFilter.includes(schema4 ?? "public")) {
27401
28196
  continue;
27402
28197
  }
@@ -27406,6 +28201,7 @@ var init_pgSerializer = __esm({
27406
28201
  const foreignKeysObject = {};
27407
28202
  const primaryKeysObject = {};
27408
28203
  const uniqueConstraintObject = {};
28204
+ const policiesObject = {};
27409
28205
  columns.forEach((column4) => {
27410
28206
  const name2 = getColumnCasing(column4, casing2);
27411
28207
  const notNull = column4.notNull;
@@ -27653,6 +28449,45 @@ ${withStyle.errorWarning(
27653
28449
  with: value.config.with ?? {}
27654
28450
  };
27655
28451
  });
28452
+ policies2.forEach((policy2) => {
28453
+ const mappedTo = [];
28454
+ if (!policy2.to) {
28455
+ mappedTo.push("public");
28456
+ } else {
28457
+ if (policy2.to && typeof policy2.to === "string") {
28458
+ mappedTo.push(policy2.to);
28459
+ } else if (policy2.to && is(policy2.to, PgRole)) {
28460
+ mappedTo.push(policy2.to.name);
28461
+ } else if (policy2.to && Array.isArray(policy2.to)) {
28462
+ policy2.to.forEach((it) => {
28463
+ if (typeof it === "string") {
28464
+ mappedTo.push(it);
28465
+ } else if (is(it, PgRole)) {
28466
+ mappedTo.push(it.name);
28467
+ }
28468
+ });
28469
+ }
28470
+ }
28471
+ if (policiesObject[policy2.name] !== void 0) {
28472
+ console.log(
28473
+ `
28474
+ ${withStyle.errorWarning(
28475
+ `We've found duplicated policy name across ${source_default.underline.blue(tableKey2)} table. Please rename one of the policies with ${source_default.underline.blue(
28476
+ policy2.name
28477
+ )} name`
28478
+ )}`
28479
+ );
28480
+ process.exit(1);
28481
+ }
28482
+ policiesObject[policy2.name] = {
28483
+ name: policy2.name,
28484
+ as: policy2.as?.toUpperCase() ?? "PERMISSIVE",
28485
+ for: policy2.for?.toUpperCase() ?? "ALL",
28486
+ to: mappedTo.sort(),
28487
+ using: is(policy2.using, SQL) ? dialect4.sqlToQuery(policy2.using).sql : void 0,
28488
+ withCheck: is(policy2.withCheck, SQL) ? dialect4.sqlToQuery(policy2.withCheck).sql : void 0
28489
+ };
28490
+ });
27656
28491
  checks.forEach((check) => {
27657
28492
  const checkName = check.name;
27658
28493
  if (typeof checksInTable[`"${schema4 ?? "public"}"."${tableName}"`] !== "undefined") {
@@ -27689,7 +28524,59 @@ ${withStyle.errorWarning(
27689
28524
  foreignKeys: foreignKeysObject,
27690
28525
  compositePrimaryKeys: primaryKeysObject,
27691
28526
  uniqueConstraints: uniqueConstraintObject,
27692
- checkConstraints: checksObject
28527
+ policies: policiesObject,
28528
+ checkConstraints: checksObject,
28529
+ isRLSEnabled: enableRLS
28530
+ };
28531
+ }
28532
+ for (const policy2 of policies) {
28533
+ if (!policy2._linkedTable) {
28534
+ console.log(
28535
+ `
28536
+ ${withStyle.errorWarning(
28537
+ `"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:`
28538
+ )}`
28539
+ );
28540
+ continue;
28541
+ }
28542
+ const tableConfig = getTableConfig(policy2._linkedTable);
28543
+ const tableKey2 = `${tableConfig.schema ?? "public"}.${tableConfig.name}`;
28544
+ const mappedTo = [];
28545
+ if (!policy2.to) {
28546
+ mappedTo.push("public");
28547
+ } else {
28548
+ if (policy2.to && typeof policy2.to === "string") {
28549
+ mappedTo.push(policy2.to);
28550
+ } else if (policy2.to && is(policy2.to, PgRole)) {
28551
+ mappedTo.push(policy2.to.name);
28552
+ } else if (policy2.to && Array.isArray(policy2.to)) {
28553
+ policy2.to.forEach((it) => {
28554
+ if (typeof it === "string") {
28555
+ mappedTo.push(it);
28556
+ } else if (is(it, PgRole)) {
28557
+ mappedTo.push(it.name);
28558
+ }
28559
+ });
28560
+ }
28561
+ }
28562
+ if (result[tableKey2].policies[policy2.name] !== void 0) {
28563
+ console.log(
28564
+ `
28565
+ ${withStyle.errorWarning(
28566
+ `We've found duplicated policy name across ${source_default.underline.blue(tableKey2)} table. Please rename one of the policies with ${source_default.underline.blue(
28567
+ policy2.name
28568
+ )} name`
28569
+ )}`
28570
+ );
28571
+ process.exit(1);
28572
+ }
28573
+ result[tableKey2].policies[policy2.name] = {
28574
+ name: policy2.name,
28575
+ as: policy2.as?.toUpperCase() ?? "PERMISSIVE",
28576
+ for: policy2.for?.toUpperCase() ?? "ALL",
28577
+ to: mappedTo.sort(),
28578
+ using: is(policy2.using, SQL) ? dialect4.sqlToQuery(policy2.using).sql : void 0,
28579
+ withCheck: is(policy2.withCheck, SQL) ? dialect4.sqlToQuery(policy2.withCheck).sql : void 0
27693
28580
  };
27694
28581
  }
27695
28582
  for (const sequence of sequences) {
@@ -27713,6 +28600,16 @@ ${withStyle.errorWarning(
27713
28600
  } else {
27714
28601
  }
27715
28602
  }
28603
+ for (const role of roles) {
28604
+ if (!role._existing) {
28605
+ rolesToReturn[role.name] = {
28606
+ name: role.name,
28607
+ createDb: role.createDb === void 0 ? false : role.createDb,
28608
+ createRole: role.createRole === void 0 ? false : role.createRole,
28609
+ inherit: role.inherit === void 0 ? true : role.inherit
28610
+ };
28611
+ }
28612
+ }
27716
28613
  const combinedViews = [...views, ...matViews];
27717
28614
  for (const view4 of combinedViews) {
27718
28615
  let viewName;
@@ -27869,6 +28766,7 @@ ${withStyle.errorWarning(
27869
28766
  enums: enumsToReturn,
27870
28767
  schemas: schemasObject,
27871
28768
  sequences: sequencesToReturn,
28769
+ roles: rolesToReturn,
27872
28770
  views: resultViews,
27873
28771
  _meta: {
27874
28772
  schemas: {},
@@ -27884,7 +28782,7 @@ ${withStyle.errorWarning(
27884
28782
  while (end > start && str[end - 1] === char3) --end;
27885
28783
  return start > 0 || end < str.length ? str.substring(start, end) : str.toString();
27886
28784
  };
27887
- fromDatabase = async (db, tablesFilter = () => true, schemaFilters, progressCallback) => {
28785
+ fromDatabase = async (db, tablesFilter = () => true, schemaFilters, entities, progressCallback) => {
27888
28786
  const result = {};
27889
28787
  const views = {};
27890
28788
  const internals = { tables: {} };
@@ -27897,7 +28795,8 @@ ${withStyle.errorWarning(
27897
28795
  WHEN c.relkind = 'r' THEN 'table'
27898
28796
  WHEN c.relkind = 'v' THEN 'view'
27899
28797
  WHEN c.relkind = 'm' THEN 'materialized_view'
27900
- END AS type
28798
+ END AS type,
28799
+ c.relrowsecurity AS rls_enabled
27901
28800
  FROM
27902
28801
  pg_catalog.pg_class c
27903
28802
  JOIN
@@ -27983,6 +28882,60 @@ WHERE
27983
28882
  if (progressCallback) {
27984
28883
  progressCallback("enums", Object.keys(enumsToReturn).length, "done");
27985
28884
  }
28885
+ const allRoles = await db.query(
28886
+ `SELECT rolname, rolinherit, rolcreatedb, rolcreaterole FROM pg_roles;`
28887
+ );
28888
+ const rolesToReturn = {};
28889
+ const preparedRoles = prepareRoles(entities);
28890
+ if (preparedRoles.useRoles || !(preparedRoles.includeRoles.length === 0 && preparedRoles.excludeRoles.length === 0)) {
28891
+ for (const dbRole of allRoles) {
28892
+ if (preparedRoles.useRoles) {
28893
+ rolesToReturn[dbRole.rolname] = {
28894
+ createDb: dbRole.rolcreatedb,
28895
+ createRole: dbRole.rolcreatedb,
28896
+ inherit: dbRole.rolinherit,
28897
+ name: dbRole.rolname
28898
+ };
28899
+ } else {
28900
+ if (preparedRoles.includeRoles.length === 0 && preparedRoles.excludeRoles.length === 0) continue;
28901
+ if (preparedRoles.includeRoles.includes(dbRole.rolname) && preparedRoles.excludeRoles.includes(dbRole.rolname)) continue;
28902
+ if (preparedRoles.excludeRoles.includes(dbRole.rolname)) continue;
28903
+ if (!preparedRoles.includeRoles.includes(dbRole.rolname)) continue;
28904
+ rolesToReturn[dbRole.rolname] = {
28905
+ createDb: dbRole.rolcreatedb,
28906
+ createRole: dbRole.rolcreaterole,
28907
+ inherit: dbRole.rolinherit,
28908
+ name: dbRole.rolname
28909
+ };
28910
+ }
28911
+ }
28912
+ }
28913
+ const wherePolicies = schemaFilters.map((t) => `schemaname = '${t}'`).join(" or ");
28914
+ const policiesByTable = {};
28915
+ 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}`};`);
28916
+ for (const dbPolicy of allPolicies) {
28917
+ const { tablename, schemaname, to, withCheck, using, ...rest } = dbPolicy;
28918
+ const tableForPolicy = policiesByTable[`${schemaname}.${tablename}`];
28919
+ const parsedTo = to;
28920
+ const parsedWithCheck = withCheck === null ? void 0 : withCheck;
28921
+ const parsedUsing = using === null ? void 0 : using;
28922
+ if (tableForPolicy) {
28923
+ tableForPolicy[dbPolicy.name] = { ...rest, to: parsedTo };
28924
+ } else {
28925
+ policiesByTable[`${schemaname}.${tablename}`] = {
28926
+ [dbPolicy.name]: { ...rest, to: parsedTo, withCheck: parsedWithCheck, using: parsedUsing }
28927
+ };
28928
+ }
28929
+ }
28930
+ if (progressCallback) {
28931
+ progressCallback(
28932
+ "policies",
28933
+ Object.values(policiesByTable).reduce((total, innerRecord) => {
28934
+ return total + Object.keys(innerRecord).length;
28935
+ }, 0),
28936
+ "done"
28937
+ );
28938
+ }
27986
28939
  const sequencesInColumns = [];
27987
28940
  const all = allTables.filter((it) => it.type === "table").map((row) => {
27988
28941
  return new Promise(async (res, rej) => {
@@ -28344,7 +29297,7 @@ WHERE
28344
29297
  }
28345
29298
  ],
28346
29299
  isUnique: indexIsUnique,
28347
- // should not be a part of diff detecs
29300
+ // should not be a part of diff detects
28348
29301
  concurrently: false,
28349
29302
  method: indexMethod,
28350
29303
  where: indexWhere === null ? void 0 : indexWhere,
@@ -28364,7 +29317,9 @@ WHERE
28364
29317
  foreignKeys: foreignKeysToReturn,
28365
29318
  compositePrimaryKeys: primaryKeys,
28366
29319
  uniqueConstraints: uniqueConstrains,
28367
- checkConstraints
29320
+ checkConstraints,
29321
+ policies: policiesByTable[`${tableSchema}.${tableName}`] ?? {},
29322
+ isRLSEnabled: row.rls_enabled
28368
29323
  };
28369
29324
  } catch (e) {
28370
29325
  rej(e);
@@ -28562,6 +29517,7 @@ WHERE
28562
29517
  enums: enumsToReturn,
28563
29518
  schemas: schemasObject,
28564
29519
  sequences: sequencesToReturn,
29520
+ roles: rolesToReturn,
28565
29521
  views,
28566
29522
  _meta: {
28567
29523
  schemas: {},
@@ -28756,12 +29712,12 @@ var init_alias3 = __esm({
28756
29712
  });
28757
29713
 
28758
29714
  // ../drizzle-orm/dist/sqlite-core/checks.js
28759
- var _a160, CheckBuilder2, _a161, Check2;
29715
+ var _a162, CheckBuilder2, _a163, Check2;
28760
29716
  var init_checks2 = __esm({
28761
29717
  "../drizzle-orm/dist/sqlite-core/checks.js"() {
28762
29718
  "use strict";
28763
29719
  init_entity();
28764
- _a160 = entityKind;
29720
+ _a162 = entityKind;
28765
29721
  CheckBuilder2 = class {
28766
29722
  constructor(name2, value) {
28767
29723
  __publicField(this, "brand");
@@ -28772,8 +29728,8 @@ var init_checks2 = __esm({
28772
29728
  return new Check2(table4, this);
28773
29729
  }
28774
29730
  };
28775
- __publicField(CheckBuilder2, _a160, "SQLiteCheckBuilder");
28776
- _a161 = entityKind;
29731
+ __publicField(CheckBuilder2, _a162, "SQLiteCheckBuilder");
29732
+ _a163 = entityKind;
28777
29733
  Check2 = class {
28778
29734
  constructor(table4, builder) {
28779
29735
  __publicField(this, "name");
@@ -28783,18 +29739,18 @@ var init_checks2 = __esm({
28783
29739
  this.value = builder.value;
28784
29740
  }
28785
29741
  };
28786
- __publicField(Check2, _a161, "SQLiteCheck");
29742
+ __publicField(Check2, _a163, "SQLiteCheck");
28787
29743
  }
28788
29744
  });
28789
29745
 
28790
29746
  // ../drizzle-orm/dist/sqlite-core/foreign-keys.js
28791
- var _a162, ForeignKeyBuilder2, _a163, ForeignKey2;
29747
+ var _a164, ForeignKeyBuilder2, _a165, ForeignKey2;
28792
29748
  var init_foreign_keys2 = __esm({
28793
29749
  "../drizzle-orm/dist/sqlite-core/foreign-keys.js"() {
28794
29750
  "use strict";
28795
29751
  init_entity();
28796
29752
  init_table_utils();
28797
- _a162 = entityKind;
29753
+ _a164 = entityKind;
28798
29754
  ForeignKeyBuilder2 = class {
28799
29755
  constructor(config, actions) {
28800
29756
  /** @internal */
@@ -28825,8 +29781,8 @@ var init_foreign_keys2 = __esm({
28825
29781
  return new ForeignKey2(table4, this);
28826
29782
  }
28827
29783
  };
28828
- __publicField(ForeignKeyBuilder2, _a162, "SQLiteForeignKeyBuilder");
28829
- _a163 = entityKind;
29784
+ __publicField(ForeignKeyBuilder2, _a164, "SQLiteForeignKeyBuilder");
29785
+ _a165 = entityKind;
28830
29786
  ForeignKey2 = class {
28831
29787
  constructor(table4, builder) {
28832
29788
  __publicField(this, "reference");
@@ -28850,7 +29806,7 @@ var init_foreign_keys2 = __esm({
28850
29806
  return name2 ?? `${chunks.join("_")}_fk`;
28851
29807
  }
28852
29808
  };
28853
- __publicField(ForeignKey2, _a163, "SQLiteForeignKey");
29809
+ __publicField(ForeignKey2, _a165, "SQLiteForeignKey");
28854
29810
  }
28855
29811
  });
28856
29812
 
@@ -28858,13 +29814,13 @@ var init_foreign_keys2 = __esm({
28858
29814
  function uniqueKeyName2(table4, columns) {
28859
29815
  return `${table4[TableName]}_${columns.join("_")}_unique`;
28860
29816
  }
28861
- var _a164, UniqueConstraintBuilder2, _a165, UniqueOnConstraintBuilder2, _a166, UniqueConstraint2;
29817
+ var _a166, UniqueConstraintBuilder2, _a167, UniqueOnConstraintBuilder2, _a168, UniqueConstraint2;
28862
29818
  var init_unique_constraint2 = __esm({
28863
29819
  "../drizzle-orm/dist/sqlite-core/unique-constraint.js"() {
28864
29820
  "use strict";
28865
29821
  init_entity();
28866
29822
  init_table_utils();
28867
- _a164 = entityKind;
29823
+ _a166 = entityKind;
28868
29824
  UniqueConstraintBuilder2 = class {
28869
29825
  constructor(columns, name2) {
28870
29826
  /** @internal */
@@ -28877,8 +29833,8 @@ var init_unique_constraint2 = __esm({
28877
29833
  return new UniqueConstraint2(table4, this.columns, this.name);
28878
29834
  }
28879
29835
  };
28880
- __publicField(UniqueConstraintBuilder2, _a164, "SQLiteUniqueConstraintBuilder");
28881
- _a165 = entityKind;
29836
+ __publicField(UniqueConstraintBuilder2, _a166, "SQLiteUniqueConstraintBuilder");
29837
+ _a167 = entityKind;
28882
29838
  UniqueOnConstraintBuilder2 = class {
28883
29839
  constructor(name2) {
28884
29840
  /** @internal */
@@ -28889,8 +29845,8 @@ var init_unique_constraint2 = __esm({
28889
29845
  return new UniqueConstraintBuilder2(columns, this.name);
28890
29846
  }
28891
29847
  };
28892
- __publicField(UniqueOnConstraintBuilder2, _a165, "SQLiteUniqueOnConstraintBuilder");
28893
- _a166 = entityKind;
29848
+ __publicField(UniqueOnConstraintBuilder2, _a167, "SQLiteUniqueOnConstraintBuilder");
29849
+ _a168 = entityKind;
28894
29850
  UniqueConstraint2 = class {
28895
29851
  constructor(table4, columns, name2) {
28896
29852
  __publicField(this, "columns");
@@ -28903,12 +29859,12 @@ var init_unique_constraint2 = __esm({
28903
29859
  return this.name;
28904
29860
  }
28905
29861
  };
28906
- __publicField(UniqueConstraint2, _a166, "SQLiteUniqueConstraint");
29862
+ __publicField(UniqueConstraint2, _a168, "SQLiteUniqueConstraint");
28907
29863
  }
28908
29864
  });
28909
29865
 
28910
29866
  // ../drizzle-orm/dist/sqlite-core/columns/common.js
28911
- var _a167, _b114, SQLiteColumnBuilder, _a168, _b115, SQLiteColumn;
29867
+ var _a169, _b114, SQLiteColumnBuilder, _a170, _b115, SQLiteColumn;
28912
29868
  var init_common3 = __esm({
28913
29869
  "../drizzle-orm/dist/sqlite-core/columns/common.js"() {
28914
29870
  "use strict";
@@ -28917,7 +29873,7 @@ var init_common3 = __esm({
28917
29873
  init_entity();
28918
29874
  init_foreign_keys2();
28919
29875
  init_unique_constraint2();
28920
- SQLiteColumnBuilder = class extends (_b114 = ColumnBuilder, _a167 = entityKind, _b114) {
29876
+ SQLiteColumnBuilder = class extends (_b114 = ColumnBuilder, _a169 = entityKind, _b114) {
28921
29877
  constructor() {
28922
29878
  super(...arguments);
28923
29879
  __publicField(this, "foreignKeyConfigs", []);
@@ -28958,8 +29914,8 @@ var init_common3 = __esm({
28958
29914
  });
28959
29915
  }
28960
29916
  };
28961
- __publicField(SQLiteColumnBuilder, _a167, "SQLiteColumnBuilder");
28962
- SQLiteColumn = class extends (_b115 = Column2, _a168 = entityKind, _b115) {
29917
+ __publicField(SQLiteColumnBuilder, _a169, "SQLiteColumnBuilder");
29918
+ SQLiteColumn = class extends (_b115 = Column2, _a170 = entityKind, _b115) {
28963
29919
  constructor(table4, config) {
28964
29920
  if (!config.uniqueName) {
28965
29921
  config.uniqueName = uniqueKeyName2(table4, [config.name]);
@@ -28968,7 +29924,7 @@ var init_common3 = __esm({
28968
29924
  this.table = table4;
28969
29925
  }
28970
29926
  };
28971
- __publicField(SQLiteColumn, _a168, "SQLiteColumn");
29927
+ __publicField(SQLiteColumn, _a170, "SQLiteColumn");
28972
29928
  }
28973
29929
  });
28974
29930
 
@@ -28983,14 +29939,14 @@ function blob(a, b) {
28983
29939
  }
28984
29940
  return new SQLiteBlobBufferBuilder(name2);
28985
29941
  }
28986
- var _a169, _b116, SQLiteBigIntBuilder, _a170, _b117, SQLiteBigInt, _a171, _b118, SQLiteBlobJsonBuilder, _a172, _b119, SQLiteBlobJson, _a173, _b120, SQLiteBlobBufferBuilder, _a174, _b121, SQLiteBlobBuffer;
29942
+ var _a171, _b116, SQLiteBigIntBuilder, _a172, _b117, SQLiteBigInt, _a173, _b118, SQLiteBlobJsonBuilder, _a174, _b119, SQLiteBlobJson, _a175, _b120, SQLiteBlobBufferBuilder, _a176, _b121, SQLiteBlobBuffer;
28987
29943
  var init_blob = __esm({
28988
29944
  "../drizzle-orm/dist/sqlite-core/columns/blob.js"() {
28989
29945
  "use strict";
28990
29946
  init_entity();
28991
29947
  init_utils2();
28992
29948
  init_common3();
28993
- SQLiteBigIntBuilder = class extends (_b116 = SQLiteColumnBuilder, _a169 = entityKind, _b116) {
29949
+ SQLiteBigIntBuilder = class extends (_b116 = SQLiteColumnBuilder, _a171 = entityKind, _b116) {
28994
29950
  constructor(name2) {
28995
29951
  super(name2, "bigint", "SQLiteBigInt");
28996
29952
  }
@@ -28999,8 +29955,8 @@ var init_blob = __esm({
28999
29955
  return new SQLiteBigInt(table4, this.config);
29000
29956
  }
29001
29957
  };
29002
- __publicField(SQLiteBigIntBuilder, _a169, "SQLiteBigIntBuilder");
29003
- SQLiteBigInt = class extends (_b117 = SQLiteColumn, _a170 = entityKind, _b117) {
29958
+ __publicField(SQLiteBigIntBuilder, _a171, "SQLiteBigIntBuilder");
29959
+ SQLiteBigInt = class extends (_b117 = SQLiteColumn, _a172 = entityKind, _b117) {
29004
29960
  getSQLType() {
29005
29961
  return "blob";
29006
29962
  }
@@ -29011,8 +29967,8 @@ var init_blob = __esm({
29011
29967
  return Buffer.from(value.toString());
29012
29968
  }
29013
29969
  };
29014
- __publicField(SQLiteBigInt, _a170, "SQLiteBigInt");
29015
- SQLiteBlobJsonBuilder = class extends (_b118 = SQLiteColumnBuilder, _a171 = entityKind, _b118) {
29970
+ __publicField(SQLiteBigInt, _a172, "SQLiteBigInt");
29971
+ SQLiteBlobJsonBuilder = class extends (_b118 = SQLiteColumnBuilder, _a173 = entityKind, _b118) {
29016
29972
  constructor(name2) {
29017
29973
  super(name2, "json", "SQLiteBlobJson");
29018
29974
  }
@@ -29024,8 +29980,8 @@ var init_blob = __esm({
29024
29980
  );
29025
29981
  }
29026
29982
  };
29027
- __publicField(SQLiteBlobJsonBuilder, _a171, "SQLiteBlobJsonBuilder");
29028
- SQLiteBlobJson = class extends (_b119 = SQLiteColumn, _a172 = entityKind, _b119) {
29983
+ __publicField(SQLiteBlobJsonBuilder, _a173, "SQLiteBlobJsonBuilder");
29984
+ SQLiteBlobJson = class extends (_b119 = SQLiteColumn, _a174 = entityKind, _b119) {
29029
29985
  getSQLType() {
29030
29986
  return "blob";
29031
29987
  }
@@ -29036,8 +29992,8 @@ var init_blob = __esm({
29036
29992
  return Buffer.from(JSON.stringify(value));
29037
29993
  }
29038
29994
  };
29039
- __publicField(SQLiteBlobJson, _a172, "SQLiteBlobJson");
29040
- SQLiteBlobBufferBuilder = class extends (_b120 = SQLiteColumnBuilder, _a173 = entityKind, _b120) {
29995
+ __publicField(SQLiteBlobJson, _a174, "SQLiteBlobJson");
29996
+ SQLiteBlobBufferBuilder = class extends (_b120 = SQLiteColumnBuilder, _a175 = entityKind, _b120) {
29041
29997
  constructor(name2) {
29042
29998
  super(name2, "buffer", "SQLiteBlobBuffer");
29043
29999
  }
@@ -29046,13 +30002,13 @@ var init_blob = __esm({
29046
30002
  return new SQLiteBlobBuffer(table4, this.config);
29047
30003
  }
29048
30004
  };
29049
- __publicField(SQLiteBlobBufferBuilder, _a173, "SQLiteBlobBufferBuilder");
29050
- SQLiteBlobBuffer = class extends (_b121 = SQLiteColumn, _a174 = entityKind, _b121) {
30005
+ __publicField(SQLiteBlobBufferBuilder, _a175, "SQLiteBlobBufferBuilder");
30006
+ SQLiteBlobBuffer = class extends (_b121 = SQLiteColumn, _a176 = entityKind, _b121) {
29051
30007
  getSQLType() {
29052
30008
  return "blob";
29053
30009
  }
29054
30010
  };
29055
- __publicField(SQLiteBlobBuffer, _a174, "SQLiteBlobBuffer");
30011
+ __publicField(SQLiteBlobBuffer, _a176, "SQLiteBlobBuffer");
29056
30012
  }
29057
30013
  });
29058
30014
 
@@ -29067,14 +30023,14 @@ function customType2(customTypeParams) {
29067
30023
  );
29068
30024
  };
29069
30025
  }
29070
- var _a175, _b122, SQLiteCustomColumnBuilder, _a176, _b123, SQLiteCustomColumn;
30026
+ var _a177, _b122, SQLiteCustomColumnBuilder, _a178, _b123, SQLiteCustomColumn;
29071
30027
  var init_custom2 = __esm({
29072
30028
  "../drizzle-orm/dist/sqlite-core/columns/custom.js"() {
29073
30029
  "use strict";
29074
30030
  init_entity();
29075
30031
  init_utils2();
29076
30032
  init_common3();
29077
- SQLiteCustomColumnBuilder = class extends (_b122 = SQLiteColumnBuilder, _a175 = entityKind, _b122) {
30033
+ SQLiteCustomColumnBuilder = class extends (_b122 = SQLiteColumnBuilder, _a177 = entityKind, _b122) {
29078
30034
  constructor(name2, fieldConfig, customTypeParams) {
29079
30035
  super(name2, "custom", "SQLiteCustomColumn");
29080
30036
  this.config.fieldConfig = fieldConfig;
@@ -29088,8 +30044,8 @@ var init_custom2 = __esm({
29088
30044
  );
29089
30045
  }
29090
30046
  };
29091
- __publicField(SQLiteCustomColumnBuilder, _a175, "SQLiteCustomColumnBuilder");
29092
- SQLiteCustomColumn = class extends (_b123 = SQLiteColumn, _a176 = entityKind, _b123) {
30047
+ __publicField(SQLiteCustomColumnBuilder, _a177, "SQLiteCustomColumnBuilder");
30048
+ SQLiteCustomColumn = class extends (_b123 = SQLiteColumn, _a178 = entityKind, _b123) {
29093
30049
  constructor(table4, config) {
29094
30050
  super(table4, config);
29095
30051
  __publicField(this, "sqlName");
@@ -29109,7 +30065,7 @@ var init_custom2 = __esm({
29109
30065
  return typeof this.mapTo === "function" ? this.mapTo(value) : value;
29110
30066
  }
29111
30067
  };
29112
- __publicField(SQLiteCustomColumn, _a176, "SQLiteCustomColumn");
30068
+ __publicField(SQLiteCustomColumn, _a178, "SQLiteCustomColumn");
29113
30069
  }
29114
30070
  });
29115
30071
 
@@ -29124,7 +30080,7 @@ function integer2(a, b) {
29124
30080
  }
29125
30081
  return new SQLiteIntegerBuilder(name2);
29126
30082
  }
29127
- 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;
30083
+ 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;
29128
30084
  var init_integer2 = __esm({
29129
30085
  "../drizzle-orm/dist/sqlite-core/columns/integer.js"() {
29130
30086
  "use strict";
@@ -29132,7 +30088,7 @@ var init_integer2 = __esm({
29132
30088
  init_sql();
29133
30089
  init_utils2();
29134
30090
  init_common3();
29135
- SQLiteBaseIntegerBuilder = class extends (_b124 = SQLiteColumnBuilder, _a177 = entityKind, _b124) {
30091
+ SQLiteBaseIntegerBuilder = class extends (_b124 = SQLiteColumnBuilder, _a179 = entityKind, _b124) {
29136
30092
  constructor(name2, dataType, columnType) {
29137
30093
  super(name2, dataType, columnType);
29138
30094
  this.config.autoIncrement = false;
@@ -29145,8 +30101,8 @@ var init_integer2 = __esm({
29145
30101
  return super.primaryKey();
29146
30102
  }
29147
30103
  };
29148
- __publicField(SQLiteBaseIntegerBuilder, _a177, "SQLiteBaseIntegerBuilder");
29149
- SQLiteBaseInteger = class extends (_b125 = SQLiteColumn, _a178 = entityKind, _b125) {
30104
+ __publicField(SQLiteBaseIntegerBuilder, _a179, "SQLiteBaseIntegerBuilder");
30105
+ SQLiteBaseInteger = class extends (_b125 = SQLiteColumn, _a180 = entityKind, _b125) {
29150
30106
  constructor() {
29151
30107
  super(...arguments);
29152
30108
  __publicField(this, "autoIncrement", this.config.autoIncrement);
@@ -29155,8 +30111,8 @@ var init_integer2 = __esm({
29155
30111
  return "integer";
29156
30112
  }
29157
30113
  };
29158
- __publicField(SQLiteBaseInteger, _a178, "SQLiteBaseInteger");
29159
- SQLiteIntegerBuilder = class extends (_b126 = SQLiteBaseIntegerBuilder, _a179 = entityKind, _b126) {
30114
+ __publicField(SQLiteBaseInteger, _a180, "SQLiteBaseInteger");
30115
+ SQLiteIntegerBuilder = class extends (_b126 = SQLiteBaseIntegerBuilder, _a181 = entityKind, _b126) {
29160
30116
  constructor(name2) {
29161
30117
  super(name2, "number", "SQLiteInteger");
29162
30118
  }
@@ -29167,11 +30123,11 @@ var init_integer2 = __esm({
29167
30123
  );
29168
30124
  }
29169
30125
  };
29170
- __publicField(SQLiteIntegerBuilder, _a179, "SQLiteIntegerBuilder");
29171
- SQLiteInteger = class extends (_b127 = SQLiteBaseInteger, _a180 = entityKind, _b127) {
30126
+ __publicField(SQLiteIntegerBuilder, _a181, "SQLiteIntegerBuilder");
30127
+ SQLiteInteger = class extends (_b127 = SQLiteBaseInteger, _a182 = entityKind, _b127) {
29172
30128
  };
29173
- __publicField(SQLiteInteger, _a180, "SQLiteInteger");
29174
- SQLiteTimestampBuilder = class extends (_b128 = SQLiteBaseIntegerBuilder, _a181 = entityKind, _b128) {
30129
+ __publicField(SQLiteInteger, _a182, "SQLiteInteger");
30130
+ SQLiteTimestampBuilder = class extends (_b128 = SQLiteBaseIntegerBuilder, _a183 = entityKind, _b128) {
29175
30131
  constructor(name2, mode) {
29176
30132
  super(name2, "date", "SQLiteTimestamp");
29177
30133
  this.config.mode = mode;
@@ -29191,8 +30147,8 @@ var init_integer2 = __esm({
29191
30147
  );
29192
30148
  }
29193
30149
  };
29194
- __publicField(SQLiteTimestampBuilder, _a181, "SQLiteTimestampBuilder");
29195
- SQLiteTimestamp = class extends (_b129 = SQLiteBaseInteger, _a182 = entityKind, _b129) {
30150
+ __publicField(SQLiteTimestampBuilder, _a183, "SQLiteTimestampBuilder");
30151
+ SQLiteTimestamp = class extends (_b129 = SQLiteBaseInteger, _a184 = entityKind, _b129) {
29196
30152
  constructor() {
29197
30153
  super(...arguments);
29198
30154
  __publicField(this, "mode", this.config.mode);
@@ -29211,8 +30167,8 @@ var init_integer2 = __esm({
29211
30167
  return unix;
29212
30168
  }
29213
30169
  };
29214
- __publicField(SQLiteTimestamp, _a182, "SQLiteTimestamp");
29215
- SQLiteBooleanBuilder = class extends (_b130 = SQLiteBaseIntegerBuilder, _a183 = entityKind, _b130) {
30170
+ __publicField(SQLiteTimestamp, _a184, "SQLiteTimestamp");
30171
+ SQLiteBooleanBuilder = class extends (_b130 = SQLiteBaseIntegerBuilder, _a185 = entityKind, _b130) {
29216
30172
  constructor(name2, mode) {
29217
30173
  super(name2, "boolean", "SQLiteBoolean");
29218
30174
  this.config.mode = mode;
@@ -29224,8 +30180,8 @@ var init_integer2 = __esm({
29224
30180
  );
29225
30181
  }
29226
30182
  };
29227
- __publicField(SQLiteBooleanBuilder, _a183, "SQLiteBooleanBuilder");
29228
- SQLiteBoolean = class extends (_b131 = SQLiteBaseInteger, _a184 = entityKind, _b131) {
30183
+ __publicField(SQLiteBooleanBuilder, _a185, "SQLiteBooleanBuilder");
30184
+ SQLiteBoolean = class extends (_b131 = SQLiteBaseInteger, _a186 = entityKind, _b131) {
29229
30185
  constructor() {
29230
30186
  super(...arguments);
29231
30187
  __publicField(this, "mode", this.config.mode);
@@ -29237,7 +30193,7 @@ var init_integer2 = __esm({
29237
30193
  return value ? 1 : 0;
29238
30194
  }
29239
30195
  };
29240
- __publicField(SQLiteBoolean, _a184, "SQLiteBoolean");
30196
+ __publicField(SQLiteBoolean, _a186, "SQLiteBoolean");
29241
30197
  }
29242
30198
  });
29243
30199
 
@@ -29245,13 +30201,13 @@ var init_integer2 = __esm({
29245
30201
  function numeric2(name2) {
29246
30202
  return new SQLiteNumericBuilder(name2 ?? "");
29247
30203
  }
29248
- var _a185, _b132, SQLiteNumericBuilder, _a186, _b133, SQLiteNumeric;
30204
+ var _a187, _b132, SQLiteNumericBuilder, _a188, _b133, SQLiteNumeric;
29249
30205
  var init_numeric2 = __esm({
29250
30206
  "../drizzle-orm/dist/sqlite-core/columns/numeric.js"() {
29251
30207
  "use strict";
29252
30208
  init_entity();
29253
30209
  init_common3();
29254
- SQLiteNumericBuilder = class extends (_b132 = SQLiteColumnBuilder, _a185 = entityKind, _b132) {
30210
+ SQLiteNumericBuilder = class extends (_b132 = SQLiteColumnBuilder, _a187 = entityKind, _b132) {
29255
30211
  constructor(name2) {
29256
30212
  super(name2, "string", "SQLiteNumeric");
29257
30213
  }
@@ -29263,13 +30219,13 @@ var init_numeric2 = __esm({
29263
30219
  );
29264
30220
  }
29265
30221
  };
29266
- __publicField(SQLiteNumericBuilder, _a185, "SQLiteNumericBuilder");
29267
- SQLiteNumeric = class extends (_b133 = SQLiteColumn, _a186 = entityKind, _b133) {
30222
+ __publicField(SQLiteNumericBuilder, _a187, "SQLiteNumericBuilder");
30223
+ SQLiteNumeric = class extends (_b133 = SQLiteColumn, _a188 = entityKind, _b133) {
29268
30224
  getSQLType() {
29269
30225
  return "numeric";
29270
30226
  }
29271
30227
  };
29272
- __publicField(SQLiteNumeric, _a186, "SQLiteNumeric");
30228
+ __publicField(SQLiteNumeric, _a188, "SQLiteNumeric");
29273
30229
  }
29274
30230
  });
29275
30231
 
@@ -29277,13 +30233,13 @@ var init_numeric2 = __esm({
29277
30233
  function real2(name2) {
29278
30234
  return new SQLiteRealBuilder(name2 ?? "");
29279
30235
  }
29280
- var _a187, _b134, SQLiteRealBuilder, _a188, _b135, SQLiteReal;
30236
+ var _a189, _b134, SQLiteRealBuilder, _a190, _b135, SQLiteReal;
29281
30237
  var init_real2 = __esm({
29282
30238
  "../drizzle-orm/dist/sqlite-core/columns/real.js"() {
29283
30239
  "use strict";
29284
30240
  init_entity();
29285
30241
  init_common3();
29286
- SQLiteRealBuilder = class extends (_b134 = SQLiteColumnBuilder, _a187 = entityKind, _b134) {
30242
+ SQLiteRealBuilder = class extends (_b134 = SQLiteColumnBuilder, _a189 = entityKind, _b134) {
29287
30243
  constructor(name2) {
29288
30244
  super(name2, "number", "SQLiteReal");
29289
30245
  }
@@ -29292,13 +30248,13 @@ var init_real2 = __esm({
29292
30248
  return new SQLiteReal(table4, this.config);
29293
30249
  }
29294
30250
  };
29295
- __publicField(SQLiteRealBuilder, _a187, "SQLiteRealBuilder");
29296
- SQLiteReal = class extends (_b135 = SQLiteColumn, _a188 = entityKind, _b135) {
30251
+ __publicField(SQLiteRealBuilder, _a189, "SQLiteRealBuilder");
30252
+ SQLiteReal = class extends (_b135 = SQLiteColumn, _a190 = entityKind, _b135) {
29297
30253
  getSQLType() {
29298
30254
  return "real";
29299
30255
  }
29300
30256
  };
29301
- __publicField(SQLiteReal, _a188, "SQLiteReal");
30257
+ __publicField(SQLiteReal, _a190, "SQLiteReal");
29302
30258
  }
29303
30259
  });
29304
30260
 
@@ -29310,14 +30266,14 @@ function text2(a, b = {}) {
29310
30266
  }
29311
30267
  return new SQLiteTextBuilder(name2, config);
29312
30268
  }
29313
- var _a189, _b136, SQLiteTextBuilder, _a190, _b137, SQLiteText, _a191, _b138, SQLiteTextJsonBuilder, _a192, _b139, SQLiteTextJson;
30269
+ var _a191, _b136, SQLiteTextBuilder, _a192, _b137, SQLiteText, _a193, _b138, SQLiteTextJsonBuilder, _a194, _b139, SQLiteTextJson;
29314
30270
  var init_text2 = __esm({
29315
30271
  "../drizzle-orm/dist/sqlite-core/columns/text.js"() {
29316
30272
  "use strict";
29317
30273
  init_entity();
29318
30274
  init_utils2();
29319
30275
  init_common3();
29320
- SQLiteTextBuilder = class extends (_b136 = SQLiteColumnBuilder, _a189 = entityKind, _b136) {
30276
+ SQLiteTextBuilder = class extends (_b136 = SQLiteColumnBuilder, _a191 = entityKind, _b136) {
29321
30277
  constructor(name2, config) {
29322
30278
  super(name2, "string", "SQLiteText");
29323
30279
  this.config.enumValues = config.enum;
@@ -29328,8 +30284,8 @@ var init_text2 = __esm({
29328
30284
  return new SQLiteText(table4, this.config);
29329
30285
  }
29330
30286
  };
29331
- __publicField(SQLiteTextBuilder, _a189, "SQLiteTextBuilder");
29332
- SQLiteText = class extends (_b137 = SQLiteColumn, _a190 = entityKind, _b137) {
30287
+ __publicField(SQLiteTextBuilder, _a191, "SQLiteTextBuilder");
30288
+ SQLiteText = class extends (_b137 = SQLiteColumn, _a192 = entityKind, _b137) {
29333
30289
  constructor(table4, config) {
29334
30290
  super(table4, config);
29335
30291
  __publicField(this, "enumValues", this.config.enumValues);
@@ -29339,8 +30295,8 @@ var init_text2 = __esm({
29339
30295
  return `text${this.config.length ? `(${this.config.length})` : ""}`;
29340
30296
  }
29341
30297
  };
29342
- __publicField(SQLiteText, _a190, "SQLiteText");
29343
- SQLiteTextJsonBuilder = class extends (_b138 = SQLiteColumnBuilder, _a191 = entityKind, _b138) {
30298
+ __publicField(SQLiteText, _a192, "SQLiteText");
30299
+ SQLiteTextJsonBuilder = class extends (_b138 = SQLiteColumnBuilder, _a193 = entityKind, _b138) {
29344
30300
  constructor(name2) {
29345
30301
  super(name2, "json", "SQLiteTextJson");
29346
30302
  }
@@ -29352,8 +30308,8 @@ var init_text2 = __esm({
29352
30308
  );
29353
30309
  }
29354
30310
  };
29355
- __publicField(SQLiteTextJsonBuilder, _a191, "SQLiteTextJsonBuilder");
29356
- SQLiteTextJson = class extends (_b139 = SQLiteColumn, _a192 = entityKind, _b139) {
30311
+ __publicField(SQLiteTextJsonBuilder, _a193, "SQLiteTextJsonBuilder");
30312
+ SQLiteTextJson = class extends (_b139 = SQLiteColumn, _a194 = entityKind, _b139) {
29357
30313
  getSQLType() {
29358
30314
  return "text";
29359
30315
  }
@@ -29364,7 +30320,7 @@ var init_text2 = __esm({
29364
30320
  return JSON.stringify(value);
29365
30321
  }
29366
30322
  };
29367
- __publicField(SQLiteTextJson, _a192, "SQLiteTextJson");
30323
+ __publicField(SQLiteTextJson, _a194, "SQLiteTextJson");
29368
30324
  }
29369
30325
  });
29370
30326
 
@@ -29426,7 +30382,7 @@ function sqliteTableBase(name2, columns, extraConfig, schema4, baseName = name2)
29426
30382
  }
29427
30383
  return table4;
29428
30384
  }
29429
- var InlineForeignKeys2, _a193, _b140, _c6, _d3, _e2, SQLiteTable, sqliteTable;
30385
+ var InlineForeignKeys2, _a195, _b140, _c6, _d3, _e3, SQLiteTable, sqliteTable;
29430
30386
  var init_table3 = __esm({
29431
30387
  "../drizzle-orm/dist/sqlite-core/table.js"() {
29432
30388
  "use strict";
@@ -29434,7 +30390,7 @@ var init_table3 = __esm({
29434
30390
  init_table();
29435
30391
  init_all2();
29436
30392
  InlineForeignKeys2 = Symbol.for("drizzle:SQLiteInlineForeignKeys");
29437
- SQLiteTable = class extends (_e2 = Table, _d3 = entityKind, _c6 = Table.Symbol.Columns, _b140 = InlineForeignKeys2, _a193 = Table.Symbol.ExtraConfigBuilder, _e2) {
30393
+ SQLiteTable = class extends (_e3 = Table, _d3 = entityKind, _c6 = Table.Symbol.Columns, _b140 = InlineForeignKeys2, _a195 = Table.Symbol.ExtraConfigBuilder, _e3) {
29438
30394
  constructor() {
29439
30395
  super(...arguments);
29440
30396
  /** @internal */
@@ -29442,7 +30398,7 @@ var init_table3 = __esm({
29442
30398
  /** @internal */
29443
30399
  __publicField(this, _b140, []);
29444
30400
  /** @internal */
29445
- __publicField(this, _a193);
30401
+ __publicField(this, _a195);
29446
30402
  }
29447
30403
  };
29448
30404
  __publicField(SQLiteTable, _d3, "SQLiteTable");
@@ -29457,7 +30413,7 @@ var init_table3 = __esm({
29457
30413
  });
29458
30414
 
29459
30415
  // ../drizzle-orm/dist/sqlite-core/query-builders/delete.js
29460
- var _a194, _b141, SQLiteDeleteBase;
30416
+ var _a196, _b141, SQLiteDeleteBase;
29461
30417
  var init_delete2 = __esm({
29462
30418
  "../drizzle-orm/dist/sqlite-core/query-builders/delete.js"() {
29463
30419
  "use strict";
@@ -29467,7 +30423,7 @@ var init_delete2 = __esm({
29467
30423
  init_table3();
29468
30424
  init_table();
29469
30425
  init_utils2();
29470
- SQLiteDeleteBase = class extends (_b141 = QueryPromise, _a194 = entityKind, _b141) {
30426
+ SQLiteDeleteBase = class extends (_b141 = QueryPromise, _a196 = entityKind, _b141) {
29471
30427
  constructor(table4, session, dialect4, withList) {
29472
30428
  super();
29473
30429
  /** @internal */
@@ -29573,12 +30529,12 @@ var init_delete2 = __esm({
29573
30529
  return this;
29574
30530
  }
29575
30531
  };
29576
- __publicField(SQLiteDeleteBase, _a194, "SQLiteDelete");
30532
+ __publicField(SQLiteDeleteBase, _a196, "SQLiteDelete");
29577
30533
  }
29578
30534
  });
29579
30535
 
29580
30536
  // ../drizzle-orm/dist/sqlite-core/query-builders/insert.js
29581
- var _a195, SQLiteInsertBuilder, _a196, _b142, SQLiteInsertBase;
30537
+ var _a197, SQLiteInsertBuilder, _a198, _b142, SQLiteInsertBase;
29582
30538
  var init_insert2 = __esm({
29583
30539
  "../drizzle-orm/dist/sqlite-core/query-builders/insert.js"() {
29584
30540
  "use strict";
@@ -29588,7 +30544,7 @@ var init_insert2 = __esm({
29588
30544
  init_table3();
29589
30545
  init_table();
29590
30546
  init_utils2();
29591
- _a195 = entityKind;
30547
+ _a197 = entityKind;
29592
30548
  SQLiteInsertBuilder = class {
29593
30549
  constructor(table4, session, dialect4, withList) {
29594
30550
  this.table = table4;
@@ -29613,8 +30569,8 @@ var init_insert2 = __esm({
29613
30569
  return new SQLiteInsertBase(this.table, mappedValues, this.session, this.dialect, this.withList);
29614
30570
  }
29615
30571
  };
29616
- __publicField(SQLiteInsertBuilder, _a195, "SQLiteInsertBuilder");
29617
- SQLiteInsertBase = class extends (_b142 = QueryPromise, _a196 = entityKind, _b142) {
30572
+ __publicField(SQLiteInsertBuilder, _a197, "SQLiteInsertBuilder");
30573
+ SQLiteInsertBase = class extends (_b142 = QueryPromise, _a198 = entityKind, _b142) {
29618
30574
  constructor(table4, values, session, dialect4, withList) {
29619
30575
  super();
29620
30576
  /** @internal */
@@ -29741,25 +30697,25 @@ var init_insert2 = __esm({
29741
30697
  return this;
29742
30698
  }
29743
30699
  };
29744
- __publicField(SQLiteInsertBase, _a196, "SQLiteInsert");
30700
+ __publicField(SQLiteInsertBase, _a198, "SQLiteInsert");
29745
30701
  }
29746
30702
  });
29747
30703
 
29748
30704
  // ../drizzle-orm/dist/sqlite-core/view-base.js
29749
- var _a197, _b143, SQLiteViewBase;
30705
+ var _a199, _b143, SQLiteViewBase;
29750
30706
  var init_view_base2 = __esm({
29751
30707
  "../drizzle-orm/dist/sqlite-core/view-base.js"() {
29752
30708
  "use strict";
29753
30709
  init_entity();
29754
30710
  init_sql();
29755
- SQLiteViewBase = class extends (_b143 = View3, _a197 = entityKind, _b143) {
30711
+ SQLiteViewBase = class extends (_b143 = View3, _a199 = entityKind, _b143) {
29756
30712
  };
29757
- __publicField(SQLiteViewBase, _a197, "SQLiteViewBase");
30713
+ __publicField(SQLiteViewBase, _a199, "SQLiteViewBase");
29758
30714
  }
29759
30715
  });
29760
30716
 
29761
30717
  // ../drizzle-orm/dist/sqlite-core/dialect.js
29762
- var _a198, SQLiteDialect, _a199, _b144, SQLiteSyncDialect, _a200, _b145, SQLiteAsyncDialect;
30718
+ var _a200, SQLiteDialect, _a201, _b144, SQLiteSyncDialect, _a202, _b145, SQLiteAsyncDialect;
29763
30719
  var init_dialect2 = __esm({
29764
30720
  "../drizzle-orm/dist/sqlite-core/dialect.js"() {
29765
30721
  "use strict";
@@ -29778,7 +30734,7 @@ var init_dialect2 = __esm({
29778
30734
  init_utils2();
29779
30735
  init_view_common();
29780
30736
  init_view_base2();
29781
- _a198 = entityKind;
30737
+ _a200 = entityKind;
29782
30738
  SQLiteDialect = class {
29783
30739
  constructor(config) {
29784
30740
  /** @internal */
@@ -30300,8 +31256,8 @@ var init_dialect2 = __esm({
30300
31256
  };
30301
31257
  }
30302
31258
  };
30303
- __publicField(SQLiteDialect, _a198, "SQLiteDialect");
30304
- SQLiteSyncDialect = class extends (_b144 = SQLiteDialect, _a199 = entityKind, _b144) {
31259
+ __publicField(SQLiteDialect, _a200, "SQLiteDialect");
31260
+ SQLiteSyncDialect = class extends (_b144 = SQLiteDialect, _a201 = entityKind, _b144) {
30305
31261
  migrate(migrations, session, config) {
30306
31262
  const migrationsTable = config === void 0 ? "__drizzle_migrations" : typeof config === "string" ? "__drizzle_migrations" : config.migrationsTable ?? "__drizzle_migrations";
30307
31263
  const migrationTableCreate = sql`
@@ -30335,8 +31291,8 @@ var init_dialect2 = __esm({
30335
31291
  }
30336
31292
  }
30337
31293
  };
30338
- __publicField(SQLiteSyncDialect, _a199, "SQLiteSyncDialect");
30339
- SQLiteAsyncDialect = class extends (_b145 = SQLiteDialect, _a200 = entityKind, _b145) {
31294
+ __publicField(SQLiteSyncDialect, _a201, "SQLiteSyncDialect");
31295
+ SQLiteAsyncDialect = class extends (_b145 = SQLiteDialect, _a202 = entityKind, _b145) {
30340
31296
  async migrate(migrations, session, config) {
30341
31297
  const migrationsTable = config === void 0 ? "__drizzle_migrations" : typeof config === "string" ? "__drizzle_migrations" : config.migrationsTable ?? "__drizzle_migrations";
30342
31298
  const migrationTableCreate = sql`
@@ -30365,7 +31321,7 @@ var init_dialect2 = __esm({
30365
31321
  });
30366
31322
  }
30367
31323
  };
30368
- __publicField(SQLiteAsyncDialect, _a200, "SQLiteAsyncDialect");
31324
+ __publicField(SQLiteAsyncDialect, _a202, "SQLiteAsyncDialect");
30369
31325
  }
30370
31326
  });
30371
31327
 
@@ -30387,7 +31343,7 @@ function createSetOperator2(type, isAll) {
30387
31343
  return leftSelect.addSetOperators(setOperators);
30388
31344
  };
30389
31345
  }
30390
- var _a201, SQLiteSelectBuilder, _a202, _b146, SQLiteSelectQueryBuilderBase, _a203, _b147, SQLiteSelectBase, getSQLiteSetOperators, union2, unionAll2, intersect2, except2;
31346
+ var _a203, SQLiteSelectBuilder, _a204, _b146, SQLiteSelectQueryBuilderBase, _a205, _b147, SQLiteSelectBase, getSQLiteSetOperators, union2, unionAll2, intersect2, except2;
30391
31347
  var init_select3 = __esm({
30392
31348
  "../drizzle-orm/dist/sqlite-core/query-builders/select.js"() {
30393
31349
  "use strict";
@@ -30401,7 +31357,7 @@ var init_select3 = __esm({
30401
31357
  init_utils2();
30402
31358
  init_view_common();
30403
31359
  init_view_base2();
30404
- _a201 = entityKind;
31360
+ _a203 = entityKind;
30405
31361
  SQLiteSelectBuilder = class {
30406
31362
  constructor(config) {
30407
31363
  __publicField(this, "fields");
@@ -30442,8 +31398,8 @@ var init_select3 = __esm({
30442
31398
  });
30443
31399
  }
30444
31400
  };
30445
- __publicField(SQLiteSelectBuilder, _a201, "SQLiteSelectBuilder");
30446
- SQLiteSelectQueryBuilderBase = class extends (_b146 = TypedQueryBuilder, _a202 = entityKind, _b146) {
31401
+ __publicField(SQLiteSelectBuilder, _a203, "SQLiteSelectBuilder");
31402
+ SQLiteSelectQueryBuilderBase = class extends (_b146 = TypedQueryBuilder, _a204 = entityKind, _b146) {
30447
31403
  constructor({ table: table4, fields, isPartialSelect, session, dialect: dialect4, withList, distinct }) {
30448
31404
  super();
30449
31405
  __publicField(this, "_");
@@ -30948,8 +31904,8 @@ var init_select3 = __esm({
30948
31904
  return this;
30949
31905
  }
30950
31906
  };
30951
- __publicField(SQLiteSelectQueryBuilderBase, _a202, "SQLiteSelectQueryBuilder");
30952
- SQLiteSelectBase = class extends (_b147 = SQLiteSelectQueryBuilderBase, _a203 = entityKind, _b147) {
31907
+ __publicField(SQLiteSelectQueryBuilderBase, _a204, "SQLiteSelectQueryBuilder");
31908
+ SQLiteSelectBase = class extends (_b147 = SQLiteSelectQueryBuilderBase, _a205 = entityKind, _b147) {
30953
31909
  constructor() {
30954
31910
  super(...arguments);
30955
31911
  __publicField(this, "run", (placeholderValues) => {
@@ -30987,7 +31943,7 @@ var init_select3 = __esm({
30987
31943
  return this.all();
30988
31944
  }
30989
31945
  };
30990
- __publicField(SQLiteSelectBase, _a203, "SQLiteSelect");
31946
+ __publicField(SQLiteSelectBase, _a205, "SQLiteSelect");
30991
31947
  applyMixins(SQLiteSelectBase, [QueryPromise]);
30992
31948
  getSQLiteSetOperators = () => ({
30993
31949
  union: union2,
@@ -31003,7 +31959,7 @@ var init_select3 = __esm({
31003
31959
  });
31004
31960
 
31005
31961
  // ../drizzle-orm/dist/sqlite-core/query-builders/query-builder.js
31006
- var _a204, QueryBuilder2;
31962
+ var _a206, QueryBuilder2;
31007
31963
  var init_query_builder3 = __esm({
31008
31964
  "../drizzle-orm/dist/sqlite-core/query-builders/query-builder.js"() {
31009
31965
  "use strict";
@@ -31012,7 +31968,7 @@ var init_query_builder3 = __esm({
31012
31968
  init_dialect2();
31013
31969
  init_subquery();
31014
31970
  init_select3();
31015
- _a204 = entityKind;
31971
+ _a206 = entityKind;
31016
31972
  QueryBuilder2 = class {
31017
31973
  constructor(dialect4) {
31018
31974
  __publicField(this, "dialect");
@@ -31074,7 +32030,7 @@ var init_query_builder3 = __esm({
31074
32030
  return this.dialect;
31075
32031
  }
31076
32032
  };
31077
- __publicField(QueryBuilder2, _a204, "SQLiteQueryBuilder");
32033
+ __publicField(QueryBuilder2, _a206, "SQLiteQueryBuilder");
31078
32034
  }
31079
32035
  });
31080
32036
 
@@ -31086,7 +32042,7 @@ var init_select_types2 = __esm({
31086
32042
  });
31087
32043
 
31088
32044
  // ../drizzle-orm/dist/sqlite-core/query-builders/update.js
31089
- var _a205, SQLiteUpdateBuilder, _a206, _b148, SQLiteUpdateBase;
32045
+ var _a207, SQLiteUpdateBuilder, _a208, _b148, SQLiteUpdateBase;
31090
32046
  var init_update2 = __esm({
31091
32047
  "../drizzle-orm/dist/sqlite-core/query-builders/update.js"() {
31092
32048
  "use strict";
@@ -31096,7 +32052,7 @@ var init_update2 = __esm({
31096
32052
  init_table3();
31097
32053
  init_table();
31098
32054
  init_utils2();
31099
- _a205 = entityKind;
32055
+ _a207 = entityKind;
31100
32056
  SQLiteUpdateBuilder = class {
31101
32057
  constructor(table4, session, dialect4, withList) {
31102
32058
  this.table = table4;
@@ -31114,8 +32070,8 @@ var init_update2 = __esm({
31114
32070
  );
31115
32071
  }
31116
32072
  };
31117
- __publicField(SQLiteUpdateBuilder, _a205, "SQLiteUpdateBuilder");
31118
- SQLiteUpdateBase = class extends (_b148 = QueryPromise, _a206 = entityKind, _b148) {
32073
+ __publicField(SQLiteUpdateBuilder, _a207, "SQLiteUpdateBuilder");
32074
+ SQLiteUpdateBase = class extends (_b148 = QueryPromise, _a208 = entityKind, _b148) {
31119
32075
  constructor(table4, set, session, dialect4, withList) {
31120
32076
  super();
31121
32077
  /** @internal */
@@ -31224,7 +32180,7 @@ var init_update2 = __esm({
31224
32180
  return this;
31225
32181
  }
31226
32182
  };
31227
- __publicField(SQLiteUpdateBase, _a206, "SQLiteUpdate");
32183
+ __publicField(SQLiteUpdateBase, _a208, "SQLiteUpdate");
31228
32184
  }
31229
32185
  });
31230
32186
 
@@ -31242,17 +32198,17 @@ var init_query_builders2 = __esm({
31242
32198
  });
31243
32199
 
31244
32200
  // ../drizzle-orm/dist/sqlite-core/query-builders/count.js
31245
- var _a207, _b149, _c7, _SQLiteCountBuilder, SQLiteCountBuilder;
32201
+ var _a209, _b149, _c7, _SQLiteCountBuilder, SQLiteCountBuilder;
31246
32202
  var init_count2 = __esm({
31247
32203
  "../drizzle-orm/dist/sqlite-core/query-builders/count.js"() {
31248
32204
  "use strict";
31249
32205
  init_entity();
31250
32206
  init_sql();
31251
- _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b149 = entityKind, _a207 = Symbol.toStringTag, _c7) {
32207
+ _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b149 = entityKind, _a209 = Symbol.toStringTag, _c7) {
31252
32208
  constructor(params) {
31253
32209
  super(_SQLiteCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
31254
32210
  __publicField(this, "sql");
31255
- __publicField(this, _a207, "SQLiteCountBuilderAsync");
32211
+ __publicField(this, _a209, "SQLiteCountBuilderAsync");
31256
32212
  __publicField(this, "session");
31257
32213
  this.params = params;
31258
32214
  this.session = params.session;
@@ -31295,14 +32251,14 @@ var init_count2 = __esm({
31295
32251
  });
31296
32252
 
31297
32253
  // ../drizzle-orm/dist/sqlite-core/query-builders/query.js
31298
- var _a208, RelationalQueryBuilder2, _a209, _b150, SQLiteRelationalQuery, _a210, _b151, SQLiteSyncRelationalQuery;
32254
+ var _a210, RelationalQueryBuilder2, _a211, _b150, SQLiteRelationalQuery, _a212, _b151, SQLiteSyncRelationalQuery;
31299
32255
  var init_query2 = __esm({
31300
32256
  "../drizzle-orm/dist/sqlite-core/query-builders/query.js"() {
31301
32257
  "use strict";
31302
32258
  init_entity();
31303
32259
  init_query_promise();
31304
32260
  init_relations();
31305
- _a208 = entityKind;
32261
+ _a210 = entityKind;
31306
32262
  RelationalQueryBuilder2 = class {
31307
32263
  constructor(mode, fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session) {
31308
32264
  this.mode = mode;
@@ -31361,8 +32317,8 @@ var init_query2 = __esm({
31361
32317
  );
31362
32318
  }
31363
32319
  };
31364
- __publicField(RelationalQueryBuilder2, _a208, "SQLiteAsyncRelationalQueryBuilder");
31365
- SQLiteRelationalQuery = class extends (_b150 = QueryPromise, _a209 = entityKind, _b150) {
32320
+ __publicField(RelationalQueryBuilder2, _a210, "SQLiteAsyncRelationalQueryBuilder");
32321
+ SQLiteRelationalQuery = class extends (_b150 = QueryPromise, _a211 = entityKind, _b150) {
31366
32322
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, config, mode) {
31367
32323
  super();
31368
32324
  /** @internal */
@@ -31438,24 +32394,24 @@ var init_query2 = __esm({
31438
32394
  return this.executeRaw();
31439
32395
  }
31440
32396
  };
31441
- __publicField(SQLiteRelationalQuery, _a209, "SQLiteAsyncRelationalQuery");
31442
- SQLiteSyncRelationalQuery = class extends (_b151 = SQLiteRelationalQuery, _a210 = entityKind, _b151) {
32397
+ __publicField(SQLiteRelationalQuery, _a211, "SQLiteAsyncRelationalQuery");
32398
+ SQLiteSyncRelationalQuery = class extends (_b151 = SQLiteRelationalQuery, _a212 = entityKind, _b151) {
31443
32399
  sync() {
31444
32400
  return this.executeRaw();
31445
32401
  }
31446
32402
  };
31447
- __publicField(SQLiteSyncRelationalQuery, _a210, "SQLiteSyncRelationalQuery");
32403
+ __publicField(SQLiteSyncRelationalQuery, _a212, "SQLiteSyncRelationalQuery");
31448
32404
  }
31449
32405
  });
31450
32406
 
31451
32407
  // ../drizzle-orm/dist/sqlite-core/query-builders/raw.js
31452
- var _a211, _b152, SQLiteRaw;
32408
+ var _a213, _b152, SQLiteRaw;
31453
32409
  var init_raw2 = __esm({
31454
32410
  "../drizzle-orm/dist/sqlite-core/query-builders/raw.js"() {
31455
32411
  "use strict";
31456
32412
  init_entity();
31457
32413
  init_query_promise();
31458
- SQLiteRaw = class extends (_b152 = QueryPromise, _a211 = entityKind, _b152) {
32414
+ SQLiteRaw = class extends (_b152 = QueryPromise, _a213 = entityKind, _b152) {
31459
32415
  constructor(execute, getSQL, action, dialect4, mapBatchResult) {
31460
32416
  super();
31461
32417
  /** @internal */
@@ -31480,12 +32436,12 @@ var init_raw2 = __esm({
31480
32436
  return false;
31481
32437
  }
31482
32438
  };
31483
- __publicField(SQLiteRaw, _a211, "SQLiteRaw");
32439
+ __publicField(SQLiteRaw, _a213, "SQLiteRaw");
31484
32440
  }
31485
32441
  });
31486
32442
 
31487
32443
  // ../drizzle-orm/dist/sqlite-core/db.js
31488
- var _a212, BaseSQLiteDatabase;
32444
+ var _a214, BaseSQLiteDatabase;
31489
32445
  var init_db2 = __esm({
31490
32446
  "../drizzle-orm/dist/sqlite-core/db.js"() {
31491
32447
  "use strict";
@@ -31497,7 +32453,7 @@ var init_db2 = __esm({
31497
32453
  init_count2();
31498
32454
  init_query2();
31499
32455
  init_raw2();
31500
- _a212 = entityKind;
32456
+ _a214 = entityKind;
31501
32457
  BaseSQLiteDatabase = class {
31502
32458
  constructor(resultKind, dialect4, session, schema4) {
31503
32459
  __publicField(this, "query");
@@ -31779,17 +32735,17 @@ var init_db2 = __esm({
31779
32735
  return this.session.transaction(transaction, config);
31780
32736
  }
31781
32737
  };
31782
- __publicField(BaseSQLiteDatabase, _a212, "BaseSQLiteDatabase");
32738
+ __publicField(BaseSQLiteDatabase, _a214, "BaseSQLiteDatabase");
31783
32739
  }
31784
32740
  });
31785
32741
 
31786
32742
  // ../drizzle-orm/dist/sqlite-core/indexes.js
31787
- var _a213, IndexBuilderOn2, _a214, IndexBuilder2, _a215, Index4;
32743
+ var _a215, IndexBuilderOn2, _a216, IndexBuilder2, _a217, Index4;
31788
32744
  var init_indexes2 = __esm({
31789
32745
  "../drizzle-orm/dist/sqlite-core/indexes.js"() {
31790
32746
  "use strict";
31791
32747
  init_entity();
31792
- _a213 = entityKind;
32748
+ _a215 = entityKind;
31793
32749
  IndexBuilderOn2 = class {
31794
32750
  constructor(name2, unique) {
31795
32751
  this.name = name2;
@@ -31799,8 +32755,8 @@ var init_indexes2 = __esm({
31799
32755
  return new IndexBuilder2(this.name, columns, this.unique);
31800
32756
  }
31801
32757
  };
31802
- __publicField(IndexBuilderOn2, _a213, "SQLiteIndexBuilderOn");
31803
- _a214 = entityKind;
32758
+ __publicField(IndexBuilderOn2, _a215, "SQLiteIndexBuilderOn");
32759
+ _a216 = entityKind;
31804
32760
  IndexBuilder2 = class {
31805
32761
  constructor(name2, columns, unique) {
31806
32762
  /** @internal */
@@ -31824,26 +32780,26 @@ var init_indexes2 = __esm({
31824
32780
  return new Index4(this.config, table4);
31825
32781
  }
31826
32782
  };
31827
- __publicField(IndexBuilder2, _a214, "SQLiteIndexBuilder");
31828
- _a215 = entityKind;
32783
+ __publicField(IndexBuilder2, _a216, "SQLiteIndexBuilder");
32784
+ _a217 = entityKind;
31829
32785
  Index4 = class {
31830
32786
  constructor(config, table4) {
31831
32787
  __publicField(this, "config");
31832
32788
  this.config = { ...config, table: table4 };
31833
32789
  }
31834
32790
  };
31835
- __publicField(Index4, _a215, "SQLiteIndex");
32791
+ __publicField(Index4, _a217, "SQLiteIndex");
31836
32792
  }
31837
32793
  });
31838
32794
 
31839
32795
  // ../drizzle-orm/dist/sqlite-core/primary-keys.js
31840
- var _a216, PrimaryKeyBuilder2, _a217, PrimaryKey2;
32796
+ var _a218, PrimaryKeyBuilder2, _a219, PrimaryKey2;
31841
32797
  var init_primary_keys2 = __esm({
31842
32798
  "../drizzle-orm/dist/sqlite-core/primary-keys.js"() {
31843
32799
  "use strict";
31844
32800
  init_entity();
31845
32801
  init_table3();
31846
- _a216 = entityKind;
32802
+ _a218 = entityKind;
31847
32803
  PrimaryKeyBuilder2 = class {
31848
32804
  constructor(columns, name2) {
31849
32805
  /** @internal */
@@ -31858,8 +32814,8 @@ var init_primary_keys2 = __esm({
31858
32814
  return new PrimaryKey2(table4, this.columns, this.name);
31859
32815
  }
31860
32816
  };
31861
- __publicField(PrimaryKeyBuilder2, _a216, "SQLitePrimaryKeyBuilder");
31862
- _a217 = entityKind;
32817
+ __publicField(PrimaryKeyBuilder2, _a218, "SQLitePrimaryKeyBuilder");
32818
+ _a219 = entityKind;
31863
32819
  PrimaryKey2 = class {
31864
32820
  constructor(table4, columns, name2) {
31865
32821
  __publicField(this, "columns");
@@ -31872,12 +32828,12 @@ var init_primary_keys2 = __esm({
31872
32828
  return this.name ?? `${this.table[SQLiteTable.Symbol.Name]}_${this.columns.map((column4) => column4.name).join("_")}_pk`;
31873
32829
  }
31874
32830
  };
31875
- __publicField(PrimaryKey2, _a217, "SQLitePrimaryKey");
32831
+ __publicField(PrimaryKey2, _a219, "SQLitePrimaryKey");
31876
32832
  }
31877
32833
  });
31878
32834
 
31879
32835
  // ../drizzle-orm/dist/sqlite-core/session.js
31880
- var _a218, _b153, ExecuteResultSync, _a219, SQLitePreparedQuery, _a220, SQLiteSession, _a221, _b154, SQLiteTransaction;
32836
+ var _a220, _b153, ExecuteResultSync, _a221, SQLitePreparedQuery, _a222, SQLiteSession, _a223, _b154, SQLiteTransaction;
31881
32837
  var init_session2 = __esm({
31882
32838
  "../drizzle-orm/dist/sqlite-core/session.js"() {
31883
32839
  "use strict";
@@ -31885,7 +32841,7 @@ var init_session2 = __esm({
31885
32841
  init_errors();
31886
32842
  init_query_promise();
31887
32843
  init_db2();
31888
- ExecuteResultSync = class extends (_b153 = QueryPromise, _a218 = entityKind, _b153) {
32844
+ ExecuteResultSync = class extends (_b153 = QueryPromise, _a220 = entityKind, _b153) {
31889
32845
  constructor(resultCb) {
31890
32846
  super();
31891
32847
  this.resultCb = resultCb;
@@ -31897,8 +32853,8 @@ var init_session2 = __esm({
31897
32853
  return this.resultCb();
31898
32854
  }
31899
32855
  };
31900
- __publicField(ExecuteResultSync, _a218, "ExecuteResultSync");
31901
- _a219 = entityKind;
32856
+ __publicField(ExecuteResultSync, _a220, "ExecuteResultSync");
32857
+ _a221 = entityKind;
31902
32858
  SQLitePreparedQuery = class {
31903
32859
  constructor(mode, executeMethod, query) {
31904
32860
  /** @internal */
@@ -31939,8 +32895,8 @@ var init_session2 = __esm({
31939
32895
  }
31940
32896
  }
31941
32897
  };
31942
- __publicField(SQLitePreparedQuery, _a219, "PreparedQuery");
31943
- _a220 = entityKind;
32898
+ __publicField(SQLitePreparedQuery, _a221, "PreparedQuery");
32899
+ _a222 = entityKind;
31944
32900
  SQLiteSession = class {
31945
32901
  constructor(dialect4) {
31946
32902
  this.dialect = dialect4;
@@ -31986,8 +32942,8 @@ var init_session2 = __esm({
31986
32942
  throw new Error("Not implemented");
31987
32943
  }
31988
32944
  };
31989
- __publicField(SQLiteSession, _a220, "SQLiteSession");
31990
- SQLiteTransaction = class extends (_b154 = BaseSQLiteDatabase, _a221 = entityKind, _b154) {
32945
+ __publicField(SQLiteSession, _a222, "SQLiteSession");
32946
+ SQLiteTransaction = class extends (_b154 = BaseSQLiteDatabase, _a223 = entityKind, _b154) {
31991
32947
  constructor(resultType, dialect4, session, schema4, nestedIndex = 0) {
31992
32948
  super(resultType, dialect4, session, schema4);
31993
32949
  this.schema = schema4;
@@ -31997,7 +32953,7 @@ var init_session2 = __esm({
31997
32953
  throw new TransactionRollbackError();
31998
32954
  }
31999
32955
  };
32000
- __publicField(SQLiteTransaction, _a221, "SQLiteTransaction");
32956
+ __publicField(SQLiteTransaction, _a223, "SQLiteTransaction");
32001
32957
  }
32002
32958
  });
32003
32959
 
@@ -32066,7 +33022,7 @@ var init_utils6 = __esm({
32066
33022
  });
32067
33023
 
32068
33024
  // ../drizzle-orm/dist/sqlite-core/view.js
32069
- var _a222, ViewBuilderCore, _a223, _b155, ViewBuilder2, _a224, _b156, ManualViewBuilder2, _a225, _b157, SQLiteView2;
33025
+ var _a224, ViewBuilderCore, _a225, _b155, ViewBuilder2, _a226, _b156, ManualViewBuilder2, _a227, _b157, SQLiteView2;
32070
33026
  var init_view2 = __esm({
32071
33027
  "../drizzle-orm/dist/sqlite-core/view.js"() {
32072
33028
  "use strict";
@@ -32076,15 +33032,15 @@ var init_view2 = __esm({
32076
33032
  init_query_builder3();
32077
33033
  init_table3();
32078
33034
  init_view_base2();
32079
- _a222 = entityKind;
33035
+ _a224 = entityKind;
32080
33036
  ViewBuilderCore = class {
32081
33037
  constructor(name2) {
32082
33038
  __publicField(this, "config", {});
32083
33039
  this.name = name2;
32084
33040
  }
32085
33041
  };
32086
- __publicField(ViewBuilderCore, _a222, "SQLiteViewBuilderCore");
32087
- ViewBuilder2 = class extends (_b155 = ViewBuilderCore, _a223 = entityKind, _b155) {
33042
+ __publicField(ViewBuilderCore, _a224, "SQLiteViewBuilderCore");
33043
+ ViewBuilder2 = class extends (_b155 = ViewBuilderCore, _a225 = entityKind, _b155) {
32088
33044
  as(qb) {
32089
33045
  if (typeof qb === "function") {
32090
33046
  qb = qb(new QueryBuilder2());
@@ -32110,8 +33066,8 @@ var init_view2 = __esm({
32110
33066
  );
32111
33067
  }
32112
33068
  };
32113
- __publicField(ViewBuilder2, _a223, "SQLiteViewBuilder");
32114
- ManualViewBuilder2 = class extends (_b156 = ViewBuilderCore, _a224 = entityKind, _b156) {
33069
+ __publicField(ViewBuilder2, _a225, "SQLiteViewBuilder");
33070
+ ManualViewBuilder2 = class extends (_b156 = ViewBuilderCore, _a226 = entityKind, _b156) {
32115
33071
  constructor(name2, columns) {
32116
33072
  super(name2);
32117
33073
  __publicField(this, "columns");
@@ -32154,13 +33110,13 @@ var init_view2 = __esm({
32154
33110
  );
32155
33111
  }
32156
33112
  };
32157
- __publicField(ManualViewBuilder2, _a224, "SQLiteManualViewBuilder");
32158
- SQLiteView2 = class extends (_b157 = SQLiteViewBase, _a225 = entityKind, _b157) {
33113
+ __publicField(ManualViewBuilder2, _a226, "SQLiteManualViewBuilder");
33114
+ SQLiteView2 = class extends (_b157 = SQLiteViewBase, _a227 = entityKind, _b157) {
32159
33115
  constructor({ config }) {
32160
33116
  super(config);
32161
33117
  }
32162
33118
  };
32163
- __publicField(SQLiteView2, _a225, "SQLiteView");
33119
+ __publicField(SQLiteView2, _a227, "SQLiteView");
32164
33120
  }
32165
33121
  });
32166
33122
 
@@ -32859,12 +33815,12 @@ var init_alias4 = __esm({
32859
33815
  });
32860
33816
 
32861
33817
  // ../drizzle-orm/dist/mysql-core/checks.js
32862
- var _a226, CheckBuilder3, _a227, Check3;
33818
+ var _a228, CheckBuilder3, _a229, Check3;
32863
33819
  var init_checks3 = __esm({
32864
33820
  "../drizzle-orm/dist/mysql-core/checks.js"() {
32865
33821
  "use strict";
32866
33822
  init_entity();
32867
- _a226 = entityKind;
33823
+ _a228 = entityKind;
32868
33824
  CheckBuilder3 = class {
32869
33825
  constructor(name2, value) {
32870
33826
  __publicField(this, "brand");
@@ -32876,8 +33832,8 @@ var init_checks3 = __esm({
32876
33832
  return new Check3(table4, this);
32877
33833
  }
32878
33834
  };
32879
- __publicField(CheckBuilder3, _a226, "MySqlCheckBuilder");
32880
- _a227 = entityKind;
33835
+ __publicField(CheckBuilder3, _a228, "MySqlCheckBuilder");
33836
+ _a229 = entityKind;
32881
33837
  Check3 = class {
32882
33838
  constructor(table4, builder) {
32883
33839
  __publicField(this, "name");
@@ -32887,18 +33843,18 @@ var init_checks3 = __esm({
32887
33843
  this.value = builder.value;
32888
33844
  }
32889
33845
  };
32890
- __publicField(Check3, _a227, "MySqlCheck");
33846
+ __publicField(Check3, _a229, "MySqlCheck");
32891
33847
  }
32892
33848
  });
32893
33849
 
32894
33850
  // ../drizzle-orm/dist/mysql-core/foreign-keys.js
32895
- var _a228, ForeignKeyBuilder3, _a229, ForeignKey3;
33851
+ var _a230, ForeignKeyBuilder3, _a231, ForeignKey3;
32896
33852
  var init_foreign_keys3 = __esm({
32897
33853
  "../drizzle-orm/dist/mysql-core/foreign-keys.js"() {
32898
33854
  "use strict";
32899
33855
  init_entity();
32900
33856
  init_table_utils();
32901
- _a228 = entityKind;
33857
+ _a230 = entityKind;
32902
33858
  ForeignKeyBuilder3 = class {
32903
33859
  constructor(config, actions) {
32904
33860
  /** @internal */
@@ -32929,8 +33885,8 @@ var init_foreign_keys3 = __esm({
32929
33885
  return new ForeignKey3(table4, this);
32930
33886
  }
32931
33887
  };
32932
- __publicField(ForeignKeyBuilder3, _a228, "MySqlForeignKeyBuilder");
32933
- _a229 = entityKind;
33888
+ __publicField(ForeignKeyBuilder3, _a230, "MySqlForeignKeyBuilder");
33889
+ _a231 = entityKind;
32934
33890
  ForeignKey3 = class {
32935
33891
  constructor(table4, builder) {
32936
33892
  __publicField(this, "reference");
@@ -32954,7 +33910,7 @@ var init_foreign_keys3 = __esm({
32954
33910
  return name2 ?? `${chunks.join("_")}_fk`;
32955
33911
  }
32956
33912
  };
32957
- __publicField(ForeignKey3, _a229, "MySqlForeignKey");
33913
+ __publicField(ForeignKey3, _a231, "MySqlForeignKey");
32958
33914
  }
32959
33915
  });
32960
33916
 
@@ -32962,13 +33918,13 @@ var init_foreign_keys3 = __esm({
32962
33918
  function uniqueKeyName3(table4, columns) {
32963
33919
  return `${table4[TableName]}_${columns.join("_")}_unique`;
32964
33920
  }
32965
- var _a230, UniqueConstraintBuilder3, _a231, UniqueOnConstraintBuilder3, _a232, UniqueConstraint3;
33921
+ var _a232, UniqueConstraintBuilder3, _a233, UniqueOnConstraintBuilder3, _a234, UniqueConstraint3;
32966
33922
  var init_unique_constraint3 = __esm({
32967
33923
  "../drizzle-orm/dist/mysql-core/unique-constraint.js"() {
32968
33924
  "use strict";
32969
33925
  init_entity();
32970
33926
  init_table_utils();
32971
- _a230 = entityKind;
33927
+ _a232 = entityKind;
32972
33928
  UniqueConstraintBuilder3 = class {
32973
33929
  constructor(columns, name2) {
32974
33930
  /** @internal */
@@ -32981,8 +33937,8 @@ var init_unique_constraint3 = __esm({
32981
33937
  return new UniqueConstraint3(table4, this.columns, this.name);
32982
33938
  }
32983
33939
  };
32984
- __publicField(UniqueConstraintBuilder3, _a230, "MySqlUniqueConstraintBuilder");
32985
- _a231 = entityKind;
33940
+ __publicField(UniqueConstraintBuilder3, _a232, "MySqlUniqueConstraintBuilder");
33941
+ _a233 = entityKind;
32986
33942
  UniqueOnConstraintBuilder3 = class {
32987
33943
  constructor(name2) {
32988
33944
  /** @internal */
@@ -32993,8 +33949,8 @@ var init_unique_constraint3 = __esm({
32993
33949
  return new UniqueConstraintBuilder3(columns, this.name);
32994
33950
  }
32995
33951
  };
32996
- __publicField(UniqueOnConstraintBuilder3, _a231, "MySqlUniqueOnConstraintBuilder");
32997
- _a232 = entityKind;
33952
+ __publicField(UniqueOnConstraintBuilder3, _a233, "MySqlUniqueOnConstraintBuilder");
33953
+ _a234 = entityKind;
32998
33954
  UniqueConstraint3 = class {
32999
33955
  constructor(table4, columns, name2) {
33000
33956
  __publicField(this, "columns");
@@ -33008,12 +33964,12 @@ var init_unique_constraint3 = __esm({
33008
33964
  return this.name;
33009
33965
  }
33010
33966
  };
33011
- __publicField(UniqueConstraint3, _a232, "MySqlUniqueConstraint");
33967
+ __publicField(UniqueConstraint3, _a234, "MySqlUniqueConstraint");
33012
33968
  }
33013
33969
  });
33014
33970
 
33015
33971
  // ../drizzle-orm/dist/mysql-core/columns/common.js
33016
- var _a233, _b158, MySqlColumnBuilder, _a234, _b159, MySqlColumn, _a235, _b160, MySqlColumnBuilderWithAutoIncrement, _a236, _b161, MySqlColumnWithAutoIncrement;
33972
+ var _a235, _b158, MySqlColumnBuilder, _a236, _b159, MySqlColumn, _a237, _b160, MySqlColumnBuilderWithAutoIncrement, _a238, _b161, MySqlColumnWithAutoIncrement;
33017
33973
  var init_common4 = __esm({
33018
33974
  "../drizzle-orm/dist/mysql-core/columns/common.js"() {
33019
33975
  "use strict";
@@ -33022,7 +33978,7 @@ var init_common4 = __esm({
33022
33978
  init_entity();
33023
33979
  init_foreign_keys3();
33024
33980
  init_unique_constraint3();
33025
- MySqlColumnBuilder = class extends (_b158 = ColumnBuilder, _a233 = entityKind, _b158) {
33981
+ MySqlColumnBuilder = class extends (_b158 = ColumnBuilder, _a235 = entityKind, _b158) {
33026
33982
  constructor() {
33027
33983
  super(...arguments);
33028
33984
  __publicField(this, "foreignKeyConfigs", []);
@@ -33063,8 +34019,8 @@ var init_common4 = __esm({
33063
34019
  });
33064
34020
  }
33065
34021
  };
33066
- __publicField(MySqlColumnBuilder, _a233, "MySqlColumnBuilder");
33067
- MySqlColumn = class extends (_b159 = Column2, _a234 = entityKind, _b159) {
34022
+ __publicField(MySqlColumnBuilder, _a235, "MySqlColumnBuilder");
34023
+ MySqlColumn = class extends (_b159 = Column2, _a236 = entityKind, _b159) {
33068
34024
  constructor(table4, config) {
33069
34025
  if (!config.uniqueName) {
33070
34026
  config.uniqueName = uniqueKeyName3(table4, [config.name]);
@@ -33073,8 +34029,8 @@ var init_common4 = __esm({
33073
34029
  this.table = table4;
33074
34030
  }
33075
34031
  };
33076
- __publicField(MySqlColumn, _a234, "MySqlColumn");
33077
- MySqlColumnBuilderWithAutoIncrement = class extends (_b160 = MySqlColumnBuilder, _a235 = entityKind, _b160) {
34032
+ __publicField(MySqlColumn, _a236, "MySqlColumn");
34033
+ MySqlColumnBuilderWithAutoIncrement = class extends (_b160 = MySqlColumnBuilder, _a237 = entityKind, _b160) {
33078
34034
  constructor(name2, dataType, columnType) {
33079
34035
  super(name2, dataType, columnType);
33080
34036
  this.config.autoIncrement = false;
@@ -33085,14 +34041,14 @@ var init_common4 = __esm({
33085
34041
  return this;
33086
34042
  }
33087
34043
  };
33088
- __publicField(MySqlColumnBuilderWithAutoIncrement, _a235, "MySqlColumnBuilderWithAutoIncrement");
33089
- MySqlColumnWithAutoIncrement = class extends (_b161 = MySqlColumn, _a236 = entityKind, _b161) {
34044
+ __publicField(MySqlColumnBuilderWithAutoIncrement, _a237, "MySqlColumnBuilderWithAutoIncrement");
34045
+ MySqlColumnWithAutoIncrement = class extends (_b161 = MySqlColumn, _a238 = entityKind, _b161) {
33090
34046
  constructor() {
33091
34047
  super(...arguments);
33092
34048
  __publicField(this, "autoIncrement", this.config.autoIncrement);
33093
34049
  }
33094
34050
  };
33095
- __publicField(MySqlColumnWithAutoIncrement, _a236, "MySqlColumnWithAutoIncrement");
34051
+ __publicField(MySqlColumnWithAutoIncrement, _a238, "MySqlColumnWithAutoIncrement");
33096
34052
  }
33097
34053
  });
33098
34054
 
@@ -33104,14 +34060,14 @@ function bigint2(a, b) {
33104
34060
  }
33105
34061
  return new MySqlBigInt64Builder(name2, config.unsigned);
33106
34062
  }
33107
- var _a237, _b162, MySqlBigInt53Builder, _a238, _b163, MySqlBigInt53, _a239, _b164, MySqlBigInt64Builder, _a240, _b165, MySqlBigInt64;
34063
+ var _a239, _b162, MySqlBigInt53Builder, _a240, _b163, MySqlBigInt53, _a241, _b164, MySqlBigInt64Builder, _a242, _b165, MySqlBigInt64;
33108
34064
  var init_bigint2 = __esm({
33109
34065
  "../drizzle-orm/dist/mysql-core/columns/bigint.js"() {
33110
34066
  "use strict";
33111
34067
  init_entity();
33112
34068
  init_utils2();
33113
34069
  init_common4();
33114
- MySqlBigInt53Builder = class extends (_b162 = MySqlColumnBuilderWithAutoIncrement, _a237 = entityKind, _b162) {
34070
+ MySqlBigInt53Builder = class extends (_b162 = MySqlColumnBuilderWithAutoIncrement, _a239 = entityKind, _b162) {
33115
34071
  constructor(name2, unsigned = false) {
33116
34072
  super(name2, "number", "MySqlBigInt53");
33117
34073
  this.config.unsigned = unsigned;
@@ -33124,8 +34080,8 @@ var init_bigint2 = __esm({
33124
34080
  );
33125
34081
  }
33126
34082
  };
33127
- __publicField(MySqlBigInt53Builder, _a237, "MySqlBigInt53Builder");
33128
- MySqlBigInt53 = class extends (_b163 = MySqlColumnWithAutoIncrement, _a238 = entityKind, _b163) {
34083
+ __publicField(MySqlBigInt53Builder, _a239, "MySqlBigInt53Builder");
34084
+ MySqlBigInt53 = class extends (_b163 = MySqlColumnWithAutoIncrement, _a240 = entityKind, _b163) {
33129
34085
  getSQLType() {
33130
34086
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
33131
34087
  }
@@ -33136,8 +34092,8 @@ var init_bigint2 = __esm({
33136
34092
  return Number(value);
33137
34093
  }
33138
34094
  };
33139
- __publicField(MySqlBigInt53, _a238, "MySqlBigInt53");
33140
- MySqlBigInt64Builder = class extends (_b164 = MySqlColumnBuilderWithAutoIncrement, _a239 = entityKind, _b164) {
34095
+ __publicField(MySqlBigInt53, _a240, "MySqlBigInt53");
34096
+ MySqlBigInt64Builder = class extends (_b164 = MySqlColumnBuilderWithAutoIncrement, _a241 = entityKind, _b164) {
33141
34097
  constructor(name2, unsigned = false) {
33142
34098
  super(name2, "bigint", "MySqlBigInt64");
33143
34099
  this.config.unsigned = unsigned;
@@ -33150,8 +34106,8 @@ var init_bigint2 = __esm({
33150
34106
  );
33151
34107
  }
33152
34108
  };
33153
- __publicField(MySqlBigInt64Builder, _a239, "MySqlBigInt64Builder");
33154
- MySqlBigInt64 = class extends (_b165 = MySqlColumnWithAutoIncrement, _a240 = entityKind, _b165) {
34109
+ __publicField(MySqlBigInt64Builder, _a241, "MySqlBigInt64Builder");
34110
+ MySqlBigInt64 = class extends (_b165 = MySqlColumnWithAutoIncrement, _a242 = entityKind, _b165) {
33155
34111
  getSQLType() {
33156
34112
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
33157
34113
  }
@@ -33160,7 +34116,7 @@ var init_bigint2 = __esm({
33160
34116
  return BigInt(value);
33161
34117
  }
33162
34118
  };
33163
- __publicField(MySqlBigInt64, _a240, "MySqlBigInt64");
34119
+ __publicField(MySqlBigInt64, _a242, "MySqlBigInt64");
33164
34120
  }
33165
34121
  });
33166
34122
 
@@ -33169,14 +34125,14 @@ function binary(a, b = {}) {
33169
34125
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33170
34126
  return new MySqlBinaryBuilder(name2, config.length);
33171
34127
  }
33172
- var _a241, _b166, MySqlBinaryBuilder, _a242, _b167, MySqlBinary;
34128
+ var _a243, _b166, MySqlBinaryBuilder, _a244, _b167, MySqlBinary;
33173
34129
  var init_binary = __esm({
33174
34130
  "../drizzle-orm/dist/mysql-core/columns/binary.js"() {
33175
34131
  "use strict";
33176
34132
  init_entity();
33177
34133
  init_utils2();
33178
34134
  init_common4();
33179
- MySqlBinaryBuilder = class extends (_b166 = MySqlColumnBuilder, _a241 = entityKind, _b166) {
34135
+ MySqlBinaryBuilder = class extends (_b166 = MySqlColumnBuilder, _a243 = entityKind, _b166) {
33180
34136
  constructor(name2, length) {
33181
34137
  super(name2, "string", "MySqlBinary");
33182
34138
  this.config.length = length;
@@ -33186,8 +34142,8 @@ var init_binary = __esm({
33186
34142
  return new MySqlBinary(table4, this.config);
33187
34143
  }
33188
34144
  };
33189
- __publicField(MySqlBinaryBuilder, _a241, "MySqlBinaryBuilder");
33190
- MySqlBinary = class extends (_b167 = MySqlColumn, _a242 = entityKind, _b167) {
34145
+ __publicField(MySqlBinaryBuilder, _a243, "MySqlBinaryBuilder");
34146
+ MySqlBinary = class extends (_b167 = MySqlColumn, _a244 = entityKind, _b167) {
33191
34147
  constructor() {
33192
34148
  super(...arguments);
33193
34149
  __publicField(this, "length", this.config.length);
@@ -33196,7 +34152,7 @@ var init_binary = __esm({
33196
34152
  return this.length === void 0 ? `binary` : `binary(${this.length})`;
33197
34153
  }
33198
34154
  };
33199
- __publicField(MySqlBinary, _a242, "MySqlBinary");
34155
+ __publicField(MySqlBinary, _a244, "MySqlBinary");
33200
34156
  }
33201
34157
  });
33202
34158
 
@@ -33204,13 +34160,13 @@ var init_binary = __esm({
33204
34160
  function boolean2(name2) {
33205
34161
  return new MySqlBooleanBuilder(name2 ?? "");
33206
34162
  }
33207
- var _a243, _b168, MySqlBooleanBuilder, _a244, _b169, MySqlBoolean;
34163
+ var _a245, _b168, MySqlBooleanBuilder, _a246, _b169, MySqlBoolean;
33208
34164
  var init_boolean2 = __esm({
33209
34165
  "../drizzle-orm/dist/mysql-core/columns/boolean.js"() {
33210
34166
  "use strict";
33211
34167
  init_entity();
33212
34168
  init_common4();
33213
- MySqlBooleanBuilder = class extends (_b168 = MySqlColumnBuilder, _a243 = entityKind, _b168) {
34169
+ MySqlBooleanBuilder = class extends (_b168 = MySqlColumnBuilder, _a245 = entityKind, _b168) {
33214
34170
  constructor(name2) {
33215
34171
  super(name2, "boolean", "MySqlBoolean");
33216
34172
  }
@@ -33222,8 +34178,8 @@ var init_boolean2 = __esm({
33222
34178
  );
33223
34179
  }
33224
34180
  };
33225
- __publicField(MySqlBooleanBuilder, _a243, "MySqlBooleanBuilder");
33226
- MySqlBoolean = class extends (_b169 = MySqlColumn, _a244 = entityKind, _b169) {
34181
+ __publicField(MySqlBooleanBuilder, _a245, "MySqlBooleanBuilder");
34182
+ MySqlBoolean = class extends (_b169 = MySqlColumn, _a246 = entityKind, _b169) {
33227
34183
  getSQLType() {
33228
34184
  return "boolean";
33229
34185
  }
@@ -33234,7 +34190,7 @@ var init_boolean2 = __esm({
33234
34190
  return value === 1;
33235
34191
  }
33236
34192
  };
33237
- __publicField(MySqlBoolean, _a244, "MySqlBoolean");
34193
+ __publicField(MySqlBoolean, _a246, "MySqlBoolean");
33238
34194
  }
33239
34195
  });
33240
34196
 
@@ -33243,14 +34199,14 @@ function char2(a, b = {}) {
33243
34199
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33244
34200
  return new MySqlCharBuilder(name2, config);
33245
34201
  }
33246
- var _a245, _b170, MySqlCharBuilder, _a246, _b171, MySqlChar;
34202
+ var _a247, _b170, MySqlCharBuilder, _a248, _b171, MySqlChar;
33247
34203
  var init_char2 = __esm({
33248
34204
  "../drizzle-orm/dist/mysql-core/columns/char.js"() {
33249
34205
  "use strict";
33250
34206
  init_entity();
33251
34207
  init_utils2();
33252
34208
  init_common4();
33253
- MySqlCharBuilder = class extends (_b170 = MySqlColumnBuilder, _a245 = entityKind, _b170) {
34209
+ MySqlCharBuilder = class extends (_b170 = MySqlColumnBuilder, _a247 = entityKind, _b170) {
33254
34210
  constructor(name2, config) {
33255
34211
  super(name2, "string", "MySqlChar");
33256
34212
  this.config.length = config.length;
@@ -33264,8 +34220,8 @@ var init_char2 = __esm({
33264
34220
  );
33265
34221
  }
33266
34222
  };
33267
- __publicField(MySqlCharBuilder, _a245, "MySqlCharBuilder");
33268
- MySqlChar = class extends (_b171 = MySqlColumn, _a246 = entityKind, _b171) {
34223
+ __publicField(MySqlCharBuilder, _a247, "MySqlCharBuilder");
34224
+ MySqlChar = class extends (_b171 = MySqlColumn, _a248 = entityKind, _b171) {
33269
34225
  constructor() {
33270
34226
  super(...arguments);
33271
34227
  __publicField(this, "length", this.config.length);
@@ -33275,7 +34231,7 @@ var init_char2 = __esm({
33275
34231
  return this.length === void 0 ? `char` : `char(${this.length})`;
33276
34232
  }
33277
34233
  };
33278
- __publicField(MySqlChar, _a246, "MySqlChar");
34234
+ __publicField(MySqlChar, _a248, "MySqlChar");
33279
34235
  }
33280
34236
  });
33281
34237
 
@@ -33286,14 +34242,14 @@ function customType3(customTypeParams) {
33286
34242
  return new MySqlCustomColumnBuilder(name2, config, customTypeParams);
33287
34243
  };
33288
34244
  }
33289
- var _a247, _b172, MySqlCustomColumnBuilder, _a248, _b173, MySqlCustomColumn;
34245
+ var _a249, _b172, MySqlCustomColumnBuilder, _a250, _b173, MySqlCustomColumn;
33290
34246
  var init_custom3 = __esm({
33291
34247
  "../drizzle-orm/dist/mysql-core/columns/custom.js"() {
33292
34248
  "use strict";
33293
34249
  init_entity();
33294
34250
  init_utils2();
33295
34251
  init_common4();
33296
- MySqlCustomColumnBuilder = class extends (_b172 = MySqlColumnBuilder, _a247 = entityKind, _b172) {
34252
+ MySqlCustomColumnBuilder = class extends (_b172 = MySqlColumnBuilder, _a249 = entityKind, _b172) {
33297
34253
  constructor(name2, fieldConfig, customTypeParams) {
33298
34254
  super(name2, "custom", "MySqlCustomColumn");
33299
34255
  this.config.fieldConfig = fieldConfig;
@@ -33307,8 +34263,8 @@ var init_custom3 = __esm({
33307
34263
  );
33308
34264
  }
33309
34265
  };
33310
- __publicField(MySqlCustomColumnBuilder, _a247, "MySqlCustomColumnBuilder");
33311
- MySqlCustomColumn = class extends (_b173 = MySqlColumn, _a248 = entityKind, _b173) {
34266
+ __publicField(MySqlCustomColumnBuilder, _a249, "MySqlCustomColumnBuilder");
34267
+ MySqlCustomColumn = class extends (_b173 = MySqlColumn, _a250 = entityKind, _b173) {
33312
34268
  constructor(table4, config) {
33313
34269
  super(table4, config);
33314
34270
  __publicField(this, "sqlName");
@@ -33328,7 +34284,7 @@ var init_custom3 = __esm({
33328
34284
  return typeof this.mapTo === "function" ? this.mapTo(value) : value;
33329
34285
  }
33330
34286
  };
33331
- __publicField(MySqlCustomColumn, _a248, "MySqlCustomColumn");
34287
+ __publicField(MySqlCustomColumn, _a250, "MySqlCustomColumn");
33332
34288
  }
33333
34289
  });
33334
34290
 
@@ -33340,14 +34296,14 @@ function date2(a, b) {
33340
34296
  }
33341
34297
  return new MySqlDateBuilder(name2);
33342
34298
  }
33343
- var _a249, _b174, MySqlDateBuilder, _a250, _b175, MySqlDate, _a251, _b176, MySqlDateStringBuilder, _a252, _b177, MySqlDateString;
34299
+ var _a251, _b174, MySqlDateBuilder, _a252, _b175, MySqlDate, _a253, _b176, MySqlDateStringBuilder, _a254, _b177, MySqlDateString;
33344
34300
  var init_date2 = __esm({
33345
34301
  "../drizzle-orm/dist/mysql-core/columns/date.js"() {
33346
34302
  "use strict";
33347
34303
  init_entity();
33348
34304
  init_utils2();
33349
34305
  init_common4();
33350
- MySqlDateBuilder = class extends (_b174 = MySqlColumnBuilder, _a249 = entityKind, _b174) {
34306
+ MySqlDateBuilder = class extends (_b174 = MySqlColumnBuilder, _a251 = entityKind, _b174) {
33351
34307
  constructor(name2) {
33352
34308
  super(name2, "date", "MySqlDate");
33353
34309
  }
@@ -33356,8 +34312,8 @@ var init_date2 = __esm({
33356
34312
  return new MySqlDate(table4, this.config);
33357
34313
  }
33358
34314
  };
33359
- __publicField(MySqlDateBuilder, _a249, "MySqlDateBuilder");
33360
- MySqlDate = class extends (_b175 = MySqlColumn, _a250 = entityKind, _b175) {
34315
+ __publicField(MySqlDateBuilder, _a251, "MySqlDateBuilder");
34316
+ MySqlDate = class extends (_b175 = MySqlColumn, _a252 = entityKind, _b175) {
33361
34317
  constructor(table4, config) {
33362
34318
  super(table4, config);
33363
34319
  }
@@ -33368,8 +34324,8 @@ var init_date2 = __esm({
33368
34324
  return new Date(value);
33369
34325
  }
33370
34326
  };
33371
- __publicField(MySqlDate, _a250, "MySqlDate");
33372
- MySqlDateStringBuilder = class extends (_b176 = MySqlColumnBuilder, _a251 = entityKind, _b176) {
34327
+ __publicField(MySqlDate, _a252, "MySqlDate");
34328
+ MySqlDateStringBuilder = class extends (_b176 = MySqlColumnBuilder, _a253 = entityKind, _b176) {
33373
34329
  constructor(name2) {
33374
34330
  super(name2, "string", "MySqlDateString");
33375
34331
  }
@@ -33381,8 +34337,8 @@ var init_date2 = __esm({
33381
34337
  );
33382
34338
  }
33383
34339
  };
33384
- __publicField(MySqlDateStringBuilder, _a251, "MySqlDateStringBuilder");
33385
- MySqlDateString = class extends (_b177 = MySqlColumn, _a252 = entityKind, _b177) {
34340
+ __publicField(MySqlDateStringBuilder, _a253, "MySqlDateStringBuilder");
34341
+ MySqlDateString = class extends (_b177 = MySqlColumn, _a254 = entityKind, _b177) {
33386
34342
  constructor(table4, config) {
33387
34343
  super(table4, config);
33388
34344
  }
@@ -33390,7 +34346,7 @@ var init_date2 = __esm({
33390
34346
  return `date`;
33391
34347
  }
33392
34348
  };
33393
- __publicField(MySqlDateString, _a252, "MySqlDateString");
34349
+ __publicField(MySqlDateString, _a254, "MySqlDateString");
33394
34350
  }
33395
34351
  });
33396
34352
 
@@ -33402,14 +34358,14 @@ function datetime(a, b) {
33402
34358
  }
33403
34359
  return new MySqlDateTimeBuilder(name2, config);
33404
34360
  }
33405
- var _a253, _b178, MySqlDateTimeBuilder, _a254, _b179, MySqlDateTime, _a255, _b180, MySqlDateTimeStringBuilder, _a256, _b181, MySqlDateTimeString;
34361
+ var _a255, _b178, MySqlDateTimeBuilder, _a256, _b179, MySqlDateTime, _a257, _b180, MySqlDateTimeStringBuilder, _a258, _b181, MySqlDateTimeString;
33406
34362
  var init_datetime = __esm({
33407
34363
  "../drizzle-orm/dist/mysql-core/columns/datetime.js"() {
33408
34364
  "use strict";
33409
34365
  init_entity();
33410
34366
  init_utils2();
33411
34367
  init_common4();
33412
- MySqlDateTimeBuilder = class extends (_b178 = MySqlColumnBuilder, _a253 = entityKind, _b178) {
34368
+ MySqlDateTimeBuilder = class extends (_b178 = MySqlColumnBuilder, _a255 = entityKind, _b178) {
33413
34369
  constructor(name2, config) {
33414
34370
  super(name2, "date", "MySqlDateTime");
33415
34371
  this.config.fsp = config?.fsp;
@@ -33422,8 +34378,8 @@ var init_datetime = __esm({
33422
34378
  );
33423
34379
  }
33424
34380
  };
33425
- __publicField(MySqlDateTimeBuilder, _a253, "MySqlDateTimeBuilder");
33426
- MySqlDateTime = class extends (_b179 = MySqlColumn, _a254 = entityKind, _b179) {
34381
+ __publicField(MySqlDateTimeBuilder, _a255, "MySqlDateTimeBuilder");
34382
+ MySqlDateTime = class extends (_b179 = MySqlColumn, _a256 = entityKind, _b179) {
33427
34383
  constructor(table4, config) {
33428
34384
  super(table4, config);
33429
34385
  __publicField(this, "fsp");
@@ -33440,8 +34396,8 @@ var init_datetime = __esm({
33440
34396
  return /* @__PURE__ */ new Date(value.replace(" ", "T") + "Z");
33441
34397
  }
33442
34398
  };
33443
- __publicField(MySqlDateTime, _a254, "MySqlDateTime");
33444
- MySqlDateTimeStringBuilder = class extends (_b180 = MySqlColumnBuilder, _a255 = entityKind, _b180) {
34399
+ __publicField(MySqlDateTime, _a256, "MySqlDateTime");
34400
+ MySqlDateTimeStringBuilder = class extends (_b180 = MySqlColumnBuilder, _a257 = entityKind, _b180) {
33445
34401
  constructor(name2, config) {
33446
34402
  super(name2, "string", "MySqlDateTimeString");
33447
34403
  this.config.fsp = config?.fsp;
@@ -33454,8 +34410,8 @@ var init_datetime = __esm({
33454
34410
  );
33455
34411
  }
33456
34412
  };
33457
- __publicField(MySqlDateTimeStringBuilder, _a255, "MySqlDateTimeStringBuilder");
33458
- MySqlDateTimeString = class extends (_b181 = MySqlColumn, _a256 = entityKind, _b181) {
34413
+ __publicField(MySqlDateTimeStringBuilder, _a257, "MySqlDateTimeStringBuilder");
34414
+ MySqlDateTimeString = class extends (_b181 = MySqlColumn, _a258 = entityKind, _b181) {
33459
34415
  constructor(table4, config) {
33460
34416
  super(table4, config);
33461
34417
  __publicField(this, "fsp");
@@ -33466,7 +34422,7 @@ var init_datetime = __esm({
33466
34422
  return `datetime${precision}`;
33467
34423
  }
33468
34424
  };
33469
- __publicField(MySqlDateTimeString, _a256, "MySqlDateTimeString");
34425
+ __publicField(MySqlDateTimeString, _a258, "MySqlDateTimeString");
33470
34426
  }
33471
34427
  });
33472
34428
 
@@ -33475,14 +34431,14 @@ function decimal(a, b = {}) {
33475
34431
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33476
34432
  return new MySqlDecimalBuilder(name2, config.precision, config.scale);
33477
34433
  }
33478
- var _a257, _b182, MySqlDecimalBuilder, _a258, _b183, MySqlDecimal;
34434
+ var _a259, _b182, MySqlDecimalBuilder, _a260, _b183, MySqlDecimal;
33479
34435
  var init_decimal = __esm({
33480
34436
  "../drizzle-orm/dist/mysql-core/columns/decimal.js"() {
33481
34437
  "use strict";
33482
34438
  init_entity();
33483
34439
  init_utils2();
33484
34440
  init_common4();
33485
- MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a257 = entityKind, _b182) {
34441
+ MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b182) {
33486
34442
  constructor(name2, precision, scale) {
33487
34443
  super(name2, "string", "MySqlDecimal");
33488
34444
  this.config.precision = precision;
@@ -33496,8 +34452,8 @@ var init_decimal = __esm({
33496
34452
  );
33497
34453
  }
33498
34454
  };
33499
- __publicField(MySqlDecimalBuilder, _a257, "MySqlDecimalBuilder");
33500
- MySqlDecimal = class extends (_b183 = MySqlColumnWithAutoIncrement, _a258 = entityKind, _b183) {
34455
+ __publicField(MySqlDecimalBuilder, _a259, "MySqlDecimalBuilder");
34456
+ MySqlDecimal = class extends (_b183 = MySqlColumnWithAutoIncrement, _a260 = entityKind, _b183) {
33501
34457
  constructor() {
33502
34458
  super(...arguments);
33503
34459
  __publicField(this, "precision", this.config.precision);
@@ -33513,7 +34469,7 @@ var init_decimal = __esm({
33513
34469
  }
33514
34470
  }
33515
34471
  };
33516
- __publicField(MySqlDecimal, _a258, "MySqlDecimal");
34472
+ __publicField(MySqlDecimal, _a260, "MySqlDecimal");
33517
34473
  }
33518
34474
  });
33519
34475
 
@@ -33522,14 +34478,14 @@ function double(a, b) {
33522
34478
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33523
34479
  return new MySqlDoubleBuilder(name2, config);
33524
34480
  }
33525
- var _a259, _b184, MySqlDoubleBuilder, _a260, _b185, MySqlDouble;
34481
+ var _a261, _b184, MySqlDoubleBuilder, _a262, _b185, MySqlDouble;
33526
34482
  var init_double = __esm({
33527
34483
  "../drizzle-orm/dist/mysql-core/columns/double.js"() {
33528
34484
  "use strict";
33529
34485
  init_entity();
33530
34486
  init_utils2();
33531
34487
  init_common4();
33532
- MySqlDoubleBuilder = class extends (_b184 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b184) {
34488
+ MySqlDoubleBuilder = class extends (_b184 = MySqlColumnBuilderWithAutoIncrement, _a261 = entityKind, _b184) {
33533
34489
  constructor(name2, config) {
33534
34490
  super(name2, "number", "MySqlDouble");
33535
34491
  this.config.precision = config?.precision;
@@ -33540,8 +34496,8 @@ var init_double = __esm({
33540
34496
  return new MySqlDouble(table4, this.config);
33541
34497
  }
33542
34498
  };
33543
- __publicField(MySqlDoubleBuilder, _a259, "MySqlDoubleBuilder");
33544
- MySqlDouble = class extends (_b185 = MySqlColumnWithAutoIncrement, _a260 = entityKind, _b185) {
34499
+ __publicField(MySqlDoubleBuilder, _a261, "MySqlDoubleBuilder");
34500
+ MySqlDouble = class extends (_b185 = MySqlColumnWithAutoIncrement, _a262 = entityKind, _b185) {
33545
34501
  constructor() {
33546
34502
  super(...arguments);
33547
34503
  __publicField(this, "precision", this.config.precision);
@@ -33557,7 +34513,7 @@ var init_double = __esm({
33557
34513
  }
33558
34514
  }
33559
34515
  };
33560
- __publicField(MySqlDouble, _a260, "MySqlDouble");
34516
+ __publicField(MySqlDouble, _a262, "MySqlDouble");
33561
34517
  }
33562
34518
  });
33563
34519
 
@@ -33569,14 +34525,14 @@ function mysqlEnum(a, b) {
33569
34525
  }
33570
34526
  return new MySqlEnumColumnBuilder(name2, values);
33571
34527
  }
33572
- var _a261, _b186, MySqlEnumColumnBuilder, _a262, _b187, MySqlEnumColumn;
34528
+ var _a263, _b186, MySqlEnumColumnBuilder, _a264, _b187, MySqlEnumColumn;
33573
34529
  var init_enum2 = __esm({
33574
34530
  "../drizzle-orm/dist/mysql-core/columns/enum.js"() {
33575
34531
  "use strict";
33576
34532
  init_entity();
33577
34533
  init_utils2();
33578
34534
  init_common4();
33579
- MySqlEnumColumnBuilder = class extends (_b186 = MySqlColumnBuilder, _a261 = entityKind, _b186) {
34535
+ MySqlEnumColumnBuilder = class extends (_b186 = MySqlColumnBuilder, _a263 = entityKind, _b186) {
33580
34536
  constructor(name2, values) {
33581
34537
  super(name2, "string", "MySqlEnumColumn");
33582
34538
  this.config.enumValues = values;
@@ -33589,8 +34545,8 @@ var init_enum2 = __esm({
33589
34545
  );
33590
34546
  }
33591
34547
  };
33592
- __publicField(MySqlEnumColumnBuilder, _a261, "MySqlEnumColumnBuilder");
33593
- MySqlEnumColumn = class extends (_b187 = MySqlColumn, _a262 = entityKind, _b187) {
34548
+ __publicField(MySqlEnumColumnBuilder, _a263, "MySqlEnumColumnBuilder");
34549
+ MySqlEnumColumn = class extends (_b187 = MySqlColumn, _a264 = entityKind, _b187) {
33594
34550
  constructor() {
33595
34551
  super(...arguments);
33596
34552
  __publicField(this, "enumValues", this.config.enumValues);
@@ -33599,7 +34555,7 @@ var init_enum2 = __esm({
33599
34555
  return `enum(${this.enumValues.map((value) => `'${value}'`).join(",")})`;
33600
34556
  }
33601
34557
  };
33602
- __publicField(MySqlEnumColumn, _a262, "MySqlEnumColumn");
34558
+ __publicField(MySqlEnumColumn, _a264, "MySqlEnumColumn");
33603
34559
  }
33604
34560
  });
33605
34561
 
@@ -33607,13 +34563,13 @@ var init_enum2 = __esm({
33607
34563
  function float(name2) {
33608
34564
  return new MySqlFloatBuilder(name2 ?? "");
33609
34565
  }
33610
- var _a263, _b188, MySqlFloatBuilder, _a264, _b189, MySqlFloat;
34566
+ var _a265, _b188, MySqlFloatBuilder, _a266, _b189, MySqlFloat;
33611
34567
  var init_float = __esm({
33612
34568
  "../drizzle-orm/dist/mysql-core/columns/float.js"() {
33613
34569
  "use strict";
33614
34570
  init_entity();
33615
34571
  init_common4();
33616
- MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a263 = entityKind, _b188) {
34572
+ MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b188) {
33617
34573
  constructor(name2) {
33618
34574
  super(name2, "number", "MySqlFloat");
33619
34575
  }
@@ -33622,13 +34578,13 @@ var init_float = __esm({
33622
34578
  return new MySqlFloat(table4, this.config);
33623
34579
  }
33624
34580
  };
33625
- __publicField(MySqlFloatBuilder, _a263, "MySqlFloatBuilder");
33626
- MySqlFloat = class extends (_b189 = MySqlColumnWithAutoIncrement, _a264 = entityKind, _b189) {
34581
+ __publicField(MySqlFloatBuilder, _a265, "MySqlFloatBuilder");
34582
+ MySqlFloat = class extends (_b189 = MySqlColumnWithAutoIncrement, _a266 = entityKind, _b189) {
33627
34583
  getSQLType() {
33628
34584
  return "float";
33629
34585
  }
33630
34586
  };
33631
- __publicField(MySqlFloat, _a264, "MySqlFloat");
34587
+ __publicField(MySqlFloat, _a266, "MySqlFloat");
33632
34588
  }
33633
34589
  });
33634
34590
 
@@ -33637,14 +34593,14 @@ function int(a, b) {
33637
34593
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33638
34594
  return new MySqlIntBuilder(name2, config);
33639
34595
  }
33640
- var _a265, _b190, MySqlIntBuilder, _a266, _b191, MySqlInt;
34596
+ var _a267, _b190, MySqlIntBuilder, _a268, _b191, MySqlInt;
33641
34597
  var init_int = __esm({
33642
34598
  "../drizzle-orm/dist/mysql-core/columns/int.js"() {
33643
34599
  "use strict";
33644
34600
  init_entity();
33645
34601
  init_utils2();
33646
34602
  init_common4();
33647
- MySqlIntBuilder = class extends (_b190 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b190) {
34603
+ MySqlIntBuilder = class extends (_b190 = MySqlColumnBuilderWithAutoIncrement, _a267 = entityKind, _b190) {
33648
34604
  constructor(name2, config) {
33649
34605
  super(name2, "number", "MySqlInt");
33650
34606
  this.config.unsigned = config ? config.unsigned : false;
@@ -33654,8 +34610,8 @@ var init_int = __esm({
33654
34610
  return new MySqlInt(table4, this.config);
33655
34611
  }
33656
34612
  };
33657
- __publicField(MySqlIntBuilder, _a265, "MySqlIntBuilder");
33658
- MySqlInt = class extends (_b191 = MySqlColumnWithAutoIncrement, _a266 = entityKind, _b191) {
34613
+ __publicField(MySqlIntBuilder, _a267, "MySqlIntBuilder");
34614
+ MySqlInt = class extends (_b191 = MySqlColumnWithAutoIncrement, _a268 = entityKind, _b191) {
33659
34615
  getSQLType() {
33660
34616
  return `int${this.config.unsigned ? " unsigned" : ""}`;
33661
34617
  }
@@ -33666,7 +34622,7 @@ var init_int = __esm({
33666
34622
  return value;
33667
34623
  }
33668
34624
  };
33669
- __publicField(MySqlInt, _a266, "MySqlInt");
34625
+ __publicField(MySqlInt, _a268, "MySqlInt");
33670
34626
  }
33671
34627
  });
33672
34628
 
@@ -33674,13 +34630,13 @@ var init_int = __esm({
33674
34630
  function json2(name2) {
33675
34631
  return new MySqlJsonBuilder(name2 ?? "");
33676
34632
  }
33677
- var _a267, _b192, MySqlJsonBuilder, _a268, _b193, MySqlJson;
34633
+ var _a269, _b192, MySqlJsonBuilder, _a270, _b193, MySqlJson;
33678
34634
  var init_json2 = __esm({
33679
34635
  "../drizzle-orm/dist/mysql-core/columns/json.js"() {
33680
34636
  "use strict";
33681
34637
  init_entity();
33682
34638
  init_common4();
33683
- MySqlJsonBuilder = class extends (_b192 = MySqlColumnBuilder, _a267 = entityKind, _b192) {
34639
+ MySqlJsonBuilder = class extends (_b192 = MySqlColumnBuilder, _a269 = entityKind, _b192) {
33684
34640
  constructor(name2) {
33685
34641
  super(name2, "json", "MySqlJson");
33686
34642
  }
@@ -33689,8 +34645,8 @@ var init_json2 = __esm({
33689
34645
  return new MySqlJson(table4, this.config);
33690
34646
  }
33691
34647
  };
33692
- __publicField(MySqlJsonBuilder, _a267, "MySqlJsonBuilder");
33693
- MySqlJson = class extends (_b193 = MySqlColumn, _a268 = entityKind, _b193) {
34648
+ __publicField(MySqlJsonBuilder, _a269, "MySqlJsonBuilder");
34649
+ MySqlJson = class extends (_b193 = MySqlColumn, _a270 = entityKind, _b193) {
33694
34650
  getSQLType() {
33695
34651
  return "json";
33696
34652
  }
@@ -33698,7 +34654,7 @@ var init_json2 = __esm({
33698
34654
  return JSON.stringify(value);
33699
34655
  }
33700
34656
  };
33701
- __publicField(MySqlJson, _a268, "MySqlJson");
34657
+ __publicField(MySqlJson, _a270, "MySqlJson");
33702
34658
  }
33703
34659
  });
33704
34660
 
@@ -33707,14 +34663,14 @@ function mediumint(a, b) {
33707
34663
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33708
34664
  return new MySqlMediumIntBuilder(name2, config);
33709
34665
  }
33710
- var _a269, _b194, MySqlMediumIntBuilder, _a270, _b195, MySqlMediumInt;
34666
+ var _a271, _b194, MySqlMediumIntBuilder, _a272, _b195, MySqlMediumInt;
33711
34667
  var init_mediumint = __esm({
33712
34668
  "../drizzle-orm/dist/mysql-core/columns/mediumint.js"() {
33713
34669
  "use strict";
33714
34670
  init_entity();
33715
34671
  init_utils2();
33716
34672
  init_common4();
33717
- MySqlMediumIntBuilder = class extends (_b194 = MySqlColumnBuilderWithAutoIncrement, _a269 = entityKind, _b194) {
34673
+ MySqlMediumIntBuilder = class extends (_b194 = MySqlColumnBuilderWithAutoIncrement, _a271 = entityKind, _b194) {
33718
34674
  constructor(name2, config) {
33719
34675
  super(name2, "number", "MySqlMediumInt");
33720
34676
  this.config.unsigned = config ? config.unsigned : false;
@@ -33727,8 +34683,8 @@ var init_mediumint = __esm({
33727
34683
  );
33728
34684
  }
33729
34685
  };
33730
- __publicField(MySqlMediumIntBuilder, _a269, "MySqlMediumIntBuilder");
33731
- MySqlMediumInt = class extends (_b195 = MySqlColumnWithAutoIncrement, _a270 = entityKind, _b195) {
34686
+ __publicField(MySqlMediumIntBuilder, _a271, "MySqlMediumIntBuilder");
34687
+ MySqlMediumInt = class extends (_b195 = MySqlColumnWithAutoIncrement, _a272 = entityKind, _b195) {
33732
34688
  getSQLType() {
33733
34689
  return `mediumint${this.config.unsigned ? " unsigned" : ""}`;
33734
34690
  }
@@ -33739,7 +34695,7 @@ var init_mediumint = __esm({
33739
34695
  return value;
33740
34696
  }
33741
34697
  };
33742
- __publicField(MySqlMediumInt, _a270, "MySqlMediumInt");
34698
+ __publicField(MySqlMediumInt, _a272, "MySqlMediumInt");
33743
34699
  }
33744
34700
  });
33745
34701
 
@@ -33748,14 +34704,14 @@ function real3(a, b = {}) {
33748
34704
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33749
34705
  return new MySqlRealBuilder(name2, config);
33750
34706
  }
33751
- var _a271, _b196, MySqlRealBuilder, _a272, _b197, MySqlReal;
34707
+ var _a273, _b196, MySqlRealBuilder, _a274, _b197, MySqlReal;
33752
34708
  var init_real3 = __esm({
33753
34709
  "../drizzle-orm/dist/mysql-core/columns/real.js"() {
33754
34710
  "use strict";
33755
34711
  init_entity();
33756
34712
  init_utils2();
33757
34713
  init_common4();
33758
- MySqlRealBuilder = class extends (_b196 = MySqlColumnBuilderWithAutoIncrement, _a271 = entityKind, _b196) {
34714
+ MySqlRealBuilder = class extends (_b196 = MySqlColumnBuilderWithAutoIncrement, _a273 = entityKind, _b196) {
33759
34715
  constructor(name2, config) {
33760
34716
  super(name2, "number", "MySqlReal");
33761
34717
  this.config.precision = config?.precision;
@@ -33766,8 +34722,8 @@ var init_real3 = __esm({
33766
34722
  return new MySqlReal(table4, this.config);
33767
34723
  }
33768
34724
  };
33769
- __publicField(MySqlRealBuilder, _a271, "MySqlRealBuilder");
33770
- MySqlReal = class extends (_b197 = MySqlColumnWithAutoIncrement, _a272 = entityKind, _b197) {
34725
+ __publicField(MySqlRealBuilder, _a273, "MySqlRealBuilder");
34726
+ MySqlReal = class extends (_b197 = MySqlColumnWithAutoIncrement, _a274 = entityKind, _b197) {
33771
34727
  constructor() {
33772
34728
  super(...arguments);
33773
34729
  __publicField(this, "precision", this.config.precision);
@@ -33783,7 +34739,7 @@ var init_real3 = __esm({
33783
34739
  }
33784
34740
  }
33785
34741
  };
33786
- __publicField(MySqlReal, _a272, "MySqlReal");
34742
+ __publicField(MySqlReal, _a274, "MySqlReal");
33787
34743
  }
33788
34744
  });
33789
34745
 
@@ -33791,13 +34747,13 @@ var init_real3 = __esm({
33791
34747
  function serial2(name2) {
33792
34748
  return new MySqlSerialBuilder(name2 ?? "");
33793
34749
  }
33794
- var _a273, _b198, MySqlSerialBuilder, _a274, _b199, MySqlSerial;
34750
+ var _a275, _b198, MySqlSerialBuilder, _a276, _b199, MySqlSerial;
33795
34751
  var init_serial2 = __esm({
33796
34752
  "../drizzle-orm/dist/mysql-core/columns/serial.js"() {
33797
34753
  "use strict";
33798
34754
  init_entity();
33799
34755
  init_common4();
33800
- MySqlSerialBuilder = class extends (_b198 = MySqlColumnBuilderWithAutoIncrement, _a273 = entityKind, _b198) {
34756
+ MySqlSerialBuilder = class extends (_b198 = MySqlColumnBuilderWithAutoIncrement, _a275 = entityKind, _b198) {
33801
34757
  constructor(name2) {
33802
34758
  super(name2, "number", "MySqlSerial");
33803
34759
  this.config.hasDefault = true;
@@ -33808,8 +34764,8 @@ var init_serial2 = __esm({
33808
34764
  return new MySqlSerial(table4, this.config);
33809
34765
  }
33810
34766
  };
33811
- __publicField(MySqlSerialBuilder, _a273, "MySqlSerialBuilder");
33812
- MySqlSerial = class extends (_b199 = MySqlColumnWithAutoIncrement, _a274 = entityKind, _b199) {
34767
+ __publicField(MySqlSerialBuilder, _a275, "MySqlSerialBuilder");
34768
+ MySqlSerial = class extends (_b199 = MySqlColumnWithAutoIncrement, _a276 = entityKind, _b199) {
33813
34769
  getSQLType() {
33814
34770
  return "serial";
33815
34771
  }
@@ -33820,7 +34776,7 @@ var init_serial2 = __esm({
33820
34776
  return value;
33821
34777
  }
33822
34778
  };
33823
- __publicField(MySqlSerial, _a274, "MySqlSerial");
34779
+ __publicField(MySqlSerial, _a276, "MySqlSerial");
33824
34780
  }
33825
34781
  });
33826
34782
 
@@ -33829,14 +34785,14 @@ function smallint2(a, b) {
33829
34785
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33830
34786
  return new MySqlSmallIntBuilder(name2, config);
33831
34787
  }
33832
- var _a275, _b200, MySqlSmallIntBuilder, _a276, _b201, MySqlSmallInt;
34788
+ var _a277, _b200, MySqlSmallIntBuilder, _a278, _b201, MySqlSmallInt;
33833
34789
  var init_smallint2 = __esm({
33834
34790
  "../drizzle-orm/dist/mysql-core/columns/smallint.js"() {
33835
34791
  "use strict";
33836
34792
  init_entity();
33837
34793
  init_utils2();
33838
34794
  init_common4();
33839
- MySqlSmallIntBuilder = class extends (_b200 = MySqlColumnBuilderWithAutoIncrement, _a275 = entityKind, _b200) {
34795
+ MySqlSmallIntBuilder = class extends (_b200 = MySqlColumnBuilderWithAutoIncrement, _a277 = entityKind, _b200) {
33840
34796
  constructor(name2, config) {
33841
34797
  super(name2, "number", "MySqlSmallInt");
33842
34798
  this.config.unsigned = config ? config.unsigned : false;
@@ -33849,8 +34805,8 @@ var init_smallint2 = __esm({
33849
34805
  );
33850
34806
  }
33851
34807
  };
33852
- __publicField(MySqlSmallIntBuilder, _a275, "MySqlSmallIntBuilder");
33853
- MySqlSmallInt = class extends (_b201 = MySqlColumnWithAutoIncrement, _a276 = entityKind, _b201) {
34808
+ __publicField(MySqlSmallIntBuilder, _a277, "MySqlSmallIntBuilder");
34809
+ MySqlSmallInt = class extends (_b201 = MySqlColumnWithAutoIncrement, _a278 = entityKind, _b201) {
33854
34810
  getSQLType() {
33855
34811
  return `smallint${this.config.unsigned ? " unsigned" : ""}`;
33856
34812
  }
@@ -33861,7 +34817,7 @@ var init_smallint2 = __esm({
33861
34817
  return value;
33862
34818
  }
33863
34819
  };
33864
- __publicField(MySqlSmallInt, _a276, "MySqlSmallInt");
34820
+ __publicField(MySqlSmallInt, _a278, "MySqlSmallInt");
33865
34821
  }
33866
34822
  });
33867
34823
 
@@ -33870,14 +34826,14 @@ function text3(a, b = {}) {
33870
34826
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33871
34827
  return new MySqlTextBuilder(name2, "text", config);
33872
34828
  }
33873
- var _a277, _b202, MySqlTextBuilder, _a278, _b203, MySqlText;
34829
+ var _a279, _b202, MySqlTextBuilder, _a280, _b203, MySqlText;
33874
34830
  var init_text3 = __esm({
33875
34831
  "../drizzle-orm/dist/mysql-core/columns/text.js"() {
33876
34832
  "use strict";
33877
34833
  init_entity();
33878
34834
  init_utils2();
33879
34835
  init_common4();
33880
- MySqlTextBuilder = class extends (_b202 = MySqlColumnBuilder, _a277 = entityKind, _b202) {
34836
+ MySqlTextBuilder = class extends (_b202 = MySqlColumnBuilder, _a279 = entityKind, _b202) {
33881
34837
  constructor(name2, textType, config) {
33882
34838
  super(name2, "string", "MySqlText");
33883
34839
  this.config.textType = textType;
@@ -33888,8 +34844,8 @@ var init_text3 = __esm({
33888
34844
  return new MySqlText(table4, this.config);
33889
34845
  }
33890
34846
  };
33891
- __publicField(MySqlTextBuilder, _a277, "MySqlTextBuilder");
33892
- MySqlText = class extends (_b203 = MySqlColumn, _a278 = entityKind, _b203) {
34847
+ __publicField(MySqlTextBuilder, _a279, "MySqlTextBuilder");
34848
+ MySqlText = class extends (_b203 = MySqlColumn, _a280 = entityKind, _b203) {
33893
34849
  constructor() {
33894
34850
  super(...arguments);
33895
34851
  __publicField(this, "textType", this.config.textType);
@@ -33899,7 +34855,7 @@ var init_text3 = __esm({
33899
34855
  return this.textType;
33900
34856
  }
33901
34857
  };
33902
- __publicField(MySqlText, _a278, "MySqlText");
34858
+ __publicField(MySqlText, _a280, "MySqlText");
33903
34859
  }
33904
34860
  });
33905
34861
 
@@ -33908,14 +34864,14 @@ function time2(a, b) {
33908
34864
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33909
34865
  return new MySqlTimeBuilder(name2, config);
33910
34866
  }
33911
- var _a279, _b204, MySqlTimeBuilder, _a280, _b205, MySqlTime;
34867
+ var _a281, _b204, MySqlTimeBuilder, _a282, _b205, MySqlTime;
33912
34868
  var init_time2 = __esm({
33913
34869
  "../drizzle-orm/dist/mysql-core/columns/time.js"() {
33914
34870
  "use strict";
33915
34871
  init_entity();
33916
34872
  init_utils2();
33917
34873
  init_common4();
33918
- MySqlTimeBuilder = class extends (_b204 = MySqlColumnBuilder, _a279 = entityKind, _b204) {
34874
+ MySqlTimeBuilder = class extends (_b204 = MySqlColumnBuilder, _a281 = entityKind, _b204) {
33919
34875
  constructor(name2, config) {
33920
34876
  super(name2, "string", "MySqlTime");
33921
34877
  this.config.fsp = config?.fsp;
@@ -33925,8 +34881,8 @@ var init_time2 = __esm({
33925
34881
  return new MySqlTime(table4, this.config);
33926
34882
  }
33927
34883
  };
33928
- __publicField(MySqlTimeBuilder, _a279, "MySqlTimeBuilder");
33929
- MySqlTime = class extends (_b205 = MySqlColumn, _a280 = entityKind, _b205) {
34884
+ __publicField(MySqlTimeBuilder, _a281, "MySqlTimeBuilder");
34885
+ MySqlTime = class extends (_b205 = MySqlColumn, _a282 = entityKind, _b205) {
33930
34886
  constructor() {
33931
34887
  super(...arguments);
33932
34888
  __publicField(this, "fsp", this.config.fsp);
@@ -33936,19 +34892,19 @@ var init_time2 = __esm({
33936
34892
  return `time${precision}`;
33937
34893
  }
33938
34894
  };
33939
- __publicField(MySqlTime, _a280, "MySqlTime");
34895
+ __publicField(MySqlTime, _a282, "MySqlTime");
33940
34896
  }
33941
34897
  });
33942
34898
 
33943
34899
  // ../drizzle-orm/dist/mysql-core/columns/date.common.js
33944
- var _a281, _b206, MySqlDateColumnBaseBuilder, _a282, _b207, MySqlDateBaseColumn;
34900
+ var _a283, _b206, MySqlDateColumnBaseBuilder, _a284, _b207, MySqlDateBaseColumn;
33945
34901
  var init_date_common2 = __esm({
33946
34902
  "../drizzle-orm/dist/mysql-core/columns/date.common.js"() {
33947
34903
  "use strict";
33948
34904
  init_entity();
33949
34905
  init_sql();
33950
34906
  init_common4();
33951
- MySqlDateColumnBaseBuilder = class extends (_b206 = MySqlColumnBuilder, _a281 = entityKind, _b206) {
34907
+ MySqlDateColumnBaseBuilder = class extends (_b206 = MySqlColumnBuilder, _a283 = entityKind, _b206) {
33952
34908
  defaultNow() {
33953
34909
  return this.default(sql`(now())`);
33954
34910
  }
@@ -33959,14 +34915,14 @@ var init_date_common2 = __esm({
33959
34915
  return this;
33960
34916
  }
33961
34917
  };
33962
- __publicField(MySqlDateColumnBaseBuilder, _a281, "MySqlDateColumnBuilder");
33963
- MySqlDateBaseColumn = class extends (_b207 = MySqlColumn, _a282 = entityKind, _b207) {
34918
+ __publicField(MySqlDateColumnBaseBuilder, _a283, "MySqlDateColumnBuilder");
34919
+ MySqlDateBaseColumn = class extends (_b207 = MySqlColumn, _a284 = entityKind, _b207) {
33964
34920
  constructor() {
33965
34921
  super(...arguments);
33966
34922
  __publicField(this, "hasOnUpdateNow", this.config.hasOnUpdateNow);
33967
34923
  }
33968
34924
  };
33969
- __publicField(MySqlDateBaseColumn, _a282, "MySqlDateColumn");
34925
+ __publicField(MySqlDateBaseColumn, _a284, "MySqlDateColumn");
33970
34926
  }
33971
34927
  });
33972
34928
 
@@ -33978,14 +34934,14 @@ function timestamp2(a, b = {}) {
33978
34934
  }
33979
34935
  return new MySqlTimestampBuilder(name2, config);
33980
34936
  }
33981
- var _a283, _b208, MySqlTimestampBuilder, _a284, _b209, MySqlTimestamp, _a285, _b210, MySqlTimestampStringBuilder, _a286, _b211, MySqlTimestampString;
34937
+ var _a285, _b208, MySqlTimestampBuilder, _a286, _b209, MySqlTimestamp, _a287, _b210, MySqlTimestampStringBuilder, _a288, _b211, MySqlTimestampString;
33982
34938
  var init_timestamp2 = __esm({
33983
34939
  "../drizzle-orm/dist/mysql-core/columns/timestamp.js"() {
33984
34940
  "use strict";
33985
34941
  init_entity();
33986
34942
  init_utils2();
33987
34943
  init_date_common2();
33988
- MySqlTimestampBuilder = class extends (_b208 = MySqlDateColumnBaseBuilder, _a283 = entityKind, _b208) {
34944
+ MySqlTimestampBuilder = class extends (_b208 = MySqlDateColumnBaseBuilder, _a285 = entityKind, _b208) {
33989
34945
  constructor(name2, config) {
33990
34946
  super(name2, "date", "MySqlTimestamp");
33991
34947
  this.config.fsp = config?.fsp;
@@ -33998,8 +34954,8 @@ var init_timestamp2 = __esm({
33998
34954
  );
33999
34955
  }
34000
34956
  };
34001
- __publicField(MySqlTimestampBuilder, _a283, "MySqlTimestampBuilder");
34002
- MySqlTimestamp = class extends (_b209 = MySqlDateBaseColumn, _a284 = entityKind, _b209) {
34957
+ __publicField(MySqlTimestampBuilder, _a285, "MySqlTimestampBuilder");
34958
+ MySqlTimestamp = class extends (_b209 = MySqlDateBaseColumn, _a286 = entityKind, _b209) {
34003
34959
  constructor() {
34004
34960
  super(...arguments);
34005
34961
  __publicField(this, "fsp", this.config.fsp);
@@ -34015,8 +34971,8 @@ var init_timestamp2 = __esm({
34015
34971
  return value.toISOString().slice(0, -1).replace("T", " ");
34016
34972
  }
34017
34973
  };
34018
- __publicField(MySqlTimestamp, _a284, "MySqlTimestamp");
34019
- MySqlTimestampStringBuilder = class extends (_b210 = MySqlDateColumnBaseBuilder, _a285 = entityKind, _b210) {
34974
+ __publicField(MySqlTimestamp, _a286, "MySqlTimestamp");
34975
+ MySqlTimestampStringBuilder = class extends (_b210 = MySqlDateColumnBaseBuilder, _a287 = entityKind, _b210) {
34020
34976
  constructor(name2, config) {
34021
34977
  super(name2, "string", "MySqlTimestampString");
34022
34978
  this.config.fsp = config?.fsp;
@@ -34029,8 +34985,8 @@ var init_timestamp2 = __esm({
34029
34985
  );
34030
34986
  }
34031
34987
  };
34032
- __publicField(MySqlTimestampStringBuilder, _a285, "MySqlTimestampStringBuilder");
34033
- MySqlTimestampString = class extends (_b211 = MySqlDateBaseColumn, _a286 = entityKind, _b211) {
34988
+ __publicField(MySqlTimestampStringBuilder, _a287, "MySqlTimestampStringBuilder");
34989
+ MySqlTimestampString = class extends (_b211 = MySqlDateBaseColumn, _a288 = entityKind, _b211) {
34034
34990
  constructor() {
34035
34991
  super(...arguments);
34036
34992
  __publicField(this, "fsp", this.config.fsp);
@@ -34040,7 +34996,7 @@ var init_timestamp2 = __esm({
34040
34996
  return `timestamp${precision}`;
34041
34997
  }
34042
34998
  };
34043
- __publicField(MySqlTimestampString, _a286, "MySqlTimestampString");
34999
+ __publicField(MySqlTimestampString, _a288, "MySqlTimestampString");
34044
35000
  }
34045
35001
  });
34046
35002
 
@@ -34049,14 +35005,14 @@ function tinyint(a, b) {
34049
35005
  const { name: name2, config } = getColumnNameAndConfig(a, b);
34050
35006
  return new MySqlTinyIntBuilder(name2, config);
34051
35007
  }
34052
- var _a287, _b212, MySqlTinyIntBuilder, _a288, _b213, MySqlTinyInt;
35008
+ var _a289, _b212, MySqlTinyIntBuilder, _a290, _b213, MySqlTinyInt;
34053
35009
  var init_tinyint = __esm({
34054
35010
  "../drizzle-orm/dist/mysql-core/columns/tinyint.js"() {
34055
35011
  "use strict";
34056
35012
  init_entity();
34057
35013
  init_utils2();
34058
35014
  init_common4();
34059
- MySqlTinyIntBuilder = class extends (_b212 = MySqlColumnBuilderWithAutoIncrement, _a287 = entityKind, _b212) {
35015
+ MySqlTinyIntBuilder = class extends (_b212 = MySqlColumnBuilderWithAutoIncrement, _a289 = entityKind, _b212) {
34060
35016
  constructor(name2, config) {
34061
35017
  super(name2, "number", "MySqlTinyInt");
34062
35018
  this.config.unsigned = config ? config.unsigned : false;
@@ -34069,8 +35025,8 @@ var init_tinyint = __esm({
34069
35025
  );
34070
35026
  }
34071
35027
  };
34072
- __publicField(MySqlTinyIntBuilder, _a287, "MySqlTinyIntBuilder");
34073
- MySqlTinyInt = class extends (_b213 = MySqlColumnWithAutoIncrement, _a288 = entityKind, _b213) {
35028
+ __publicField(MySqlTinyIntBuilder, _a289, "MySqlTinyIntBuilder");
35029
+ MySqlTinyInt = class extends (_b213 = MySqlColumnWithAutoIncrement, _a290 = entityKind, _b213) {
34074
35030
  getSQLType() {
34075
35031
  return `tinyint${this.config.unsigned ? " unsigned" : ""}`;
34076
35032
  }
@@ -34081,7 +35037,7 @@ var init_tinyint = __esm({
34081
35037
  return value;
34082
35038
  }
34083
35039
  };
34084
- __publicField(MySqlTinyInt, _a288, "MySqlTinyInt");
35040
+ __publicField(MySqlTinyInt, _a290, "MySqlTinyInt");
34085
35041
  }
34086
35042
  });
34087
35043
 
@@ -34090,14 +35046,14 @@ function varbinary(a, b) {
34090
35046
  const { name: name2, config } = getColumnNameAndConfig(a, b);
34091
35047
  return new MySqlVarBinaryBuilder(name2, config);
34092
35048
  }
34093
- var _a289, _b214, MySqlVarBinaryBuilder, _a290, _b215, MySqlVarBinary;
35049
+ var _a291, _b214, MySqlVarBinaryBuilder, _a292, _b215, MySqlVarBinary;
34094
35050
  var init_varbinary = __esm({
34095
35051
  "../drizzle-orm/dist/mysql-core/columns/varbinary.js"() {
34096
35052
  "use strict";
34097
35053
  init_entity();
34098
35054
  init_utils2();
34099
35055
  init_common4();
34100
- MySqlVarBinaryBuilder = class extends (_b214 = MySqlColumnBuilder, _a289 = entityKind, _b214) {
35056
+ MySqlVarBinaryBuilder = class extends (_b214 = MySqlColumnBuilder, _a291 = entityKind, _b214) {
34101
35057
  /** @internal */
34102
35058
  constructor(name2, config) {
34103
35059
  super(name2, "string", "MySqlVarBinary");
@@ -34111,8 +35067,8 @@ var init_varbinary = __esm({
34111
35067
  );
34112
35068
  }
34113
35069
  };
34114
- __publicField(MySqlVarBinaryBuilder, _a289, "MySqlVarBinaryBuilder");
34115
- MySqlVarBinary = class extends (_b215 = MySqlColumn, _a290 = entityKind, _b215) {
35070
+ __publicField(MySqlVarBinaryBuilder, _a291, "MySqlVarBinaryBuilder");
35071
+ MySqlVarBinary = class extends (_b215 = MySqlColumn, _a292 = entityKind, _b215) {
34116
35072
  constructor() {
34117
35073
  super(...arguments);
34118
35074
  __publicField(this, "length", this.config.length);
@@ -34121,7 +35077,7 @@ var init_varbinary = __esm({
34121
35077
  return this.length === void 0 ? `varbinary` : `varbinary(${this.length})`;
34122
35078
  }
34123
35079
  };
34124
- __publicField(MySqlVarBinary, _a290, "MySqlVarBinary");
35080
+ __publicField(MySqlVarBinary, _a292, "MySqlVarBinary");
34125
35081
  }
34126
35082
  });
34127
35083
 
@@ -34130,14 +35086,14 @@ function varchar2(a, b) {
34130
35086
  const { name: name2, config } = getColumnNameAndConfig(a, b);
34131
35087
  return new MySqlVarCharBuilder(name2, config);
34132
35088
  }
34133
- var _a291, _b216, MySqlVarCharBuilder, _a292, _b217, MySqlVarChar;
35089
+ var _a293, _b216, MySqlVarCharBuilder, _a294, _b217, MySqlVarChar;
34134
35090
  var init_varchar2 = __esm({
34135
35091
  "../drizzle-orm/dist/mysql-core/columns/varchar.js"() {
34136
35092
  "use strict";
34137
35093
  init_entity();
34138
35094
  init_utils2();
34139
35095
  init_common4();
34140
- MySqlVarCharBuilder = class extends (_b216 = MySqlColumnBuilder, _a291 = entityKind, _b216) {
35096
+ MySqlVarCharBuilder = class extends (_b216 = MySqlColumnBuilder, _a293 = entityKind, _b216) {
34141
35097
  /** @internal */
34142
35098
  constructor(name2, config) {
34143
35099
  super(name2, "string", "MySqlVarChar");
@@ -34152,8 +35108,8 @@ var init_varchar2 = __esm({
34152
35108
  );
34153
35109
  }
34154
35110
  };
34155
- __publicField(MySqlVarCharBuilder, _a291, "MySqlVarCharBuilder");
34156
- MySqlVarChar = class extends (_b217 = MySqlColumn, _a292 = entityKind, _b217) {
35111
+ __publicField(MySqlVarCharBuilder, _a293, "MySqlVarCharBuilder");
35112
+ MySqlVarChar = class extends (_b217 = MySqlColumn, _a294 = entityKind, _b217) {
34157
35113
  constructor() {
34158
35114
  super(...arguments);
34159
35115
  __publicField(this, "length", this.config.length);
@@ -34163,7 +35119,7 @@ var init_varchar2 = __esm({
34163
35119
  return this.length === void 0 ? `varchar` : `varchar(${this.length})`;
34164
35120
  }
34165
35121
  };
34166
- __publicField(MySqlVarChar, _a292, "MySqlVarChar");
35122
+ __publicField(MySqlVarChar, _a294, "MySqlVarChar");
34167
35123
  }
34168
35124
  });
34169
35125
 
@@ -34171,13 +35127,13 @@ var init_varchar2 = __esm({
34171
35127
  function year(name2) {
34172
35128
  return new MySqlYearBuilder(name2 ?? "");
34173
35129
  }
34174
- var _a293, _b218, MySqlYearBuilder, _a294, _b219, MySqlYear;
35130
+ var _a295, _b218, MySqlYearBuilder, _a296, _b219, MySqlYear;
34175
35131
  var init_year = __esm({
34176
35132
  "../drizzle-orm/dist/mysql-core/columns/year.js"() {
34177
35133
  "use strict";
34178
35134
  init_entity();
34179
35135
  init_common4();
34180
- MySqlYearBuilder = class extends (_b218 = MySqlColumnBuilder, _a293 = entityKind, _b218) {
35136
+ MySqlYearBuilder = class extends (_b218 = MySqlColumnBuilder, _a295 = entityKind, _b218) {
34181
35137
  constructor(name2) {
34182
35138
  super(name2, "number", "MySqlYear");
34183
35139
  }
@@ -34186,13 +35142,13 @@ var init_year = __esm({
34186
35142
  return new MySqlYear(table4, this.config);
34187
35143
  }
34188
35144
  };
34189
- __publicField(MySqlYearBuilder, _a293, "MySqlYearBuilder");
34190
- MySqlYear = class extends (_b219 = MySqlColumn, _a294 = entityKind, _b219) {
35145
+ __publicField(MySqlYearBuilder, _a295, "MySqlYearBuilder");
35146
+ MySqlYear = class extends (_b219 = MySqlColumn, _a296 = entityKind, _b219) {
34191
35147
  getSQLType() {
34192
35148
  return `year`;
34193
35149
  }
34194
35150
  };
34195
- __publicField(MySqlYear, _a294, "MySqlYear");
35151
+ __publicField(MySqlYear, _a296, "MySqlYear");
34196
35152
  }
34197
35153
  });
34198
35154
 
@@ -34229,17 +35185,17 @@ var init_columns3 = __esm({
34229
35185
  });
34230
35186
 
34231
35187
  // ../drizzle-orm/dist/mysql-core/query-builders/count.js
34232
- var _a295, _b220, _c8, _MySqlCountBuilder, MySqlCountBuilder;
35188
+ var _a297, _b220, _c8, _MySqlCountBuilder, MySqlCountBuilder;
34233
35189
  var init_count3 = __esm({
34234
35190
  "../drizzle-orm/dist/mysql-core/query-builders/count.js"() {
34235
35191
  "use strict";
34236
35192
  init_entity();
34237
35193
  init_sql();
34238
- _MySqlCountBuilder = class _MySqlCountBuilder extends (_c8 = SQL, _b220 = entityKind, _a295 = Symbol.toStringTag, _c8) {
35194
+ _MySqlCountBuilder = class _MySqlCountBuilder extends (_c8 = SQL, _b220 = entityKind, _a297 = Symbol.toStringTag, _c8) {
34239
35195
  constructor(params) {
34240
35196
  super(_MySqlCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
34241
35197
  __publicField(this, "sql");
34242
- __publicField(this, _a295, "MySqlCountBuilder");
35198
+ __publicField(this, _a297, "MySqlCountBuilder");
34243
35199
  __publicField(this, "session");
34244
35200
  this.params = params;
34245
35201
  this.mapWith(Number);
@@ -34283,7 +35239,7 @@ var init_count3 = __esm({
34283
35239
  });
34284
35240
 
34285
35241
  // ../drizzle-orm/dist/mysql-core/query-builders/delete.js
34286
- var _a296, _b221, MySqlDeleteBase;
35242
+ var _a298, _b221, MySqlDeleteBase;
34287
35243
  var init_delete3 = __esm({
34288
35244
  "../drizzle-orm/dist/mysql-core/query-builders/delete.js"() {
34289
35245
  "use strict";
@@ -34291,7 +35247,7 @@ var init_delete3 = __esm({
34291
35247
  init_query_promise();
34292
35248
  init_selection_proxy();
34293
35249
  init_table();
34294
- MySqlDeleteBase = class extends (_b221 = QueryPromise, _a296 = entityKind, _b221) {
35250
+ MySqlDeleteBase = class extends (_b221 = QueryPromise, _a298 = entityKind, _b221) {
34295
35251
  constructor(table4, session, dialect4, withList) {
34296
35252
  super();
34297
35253
  __publicField(this, "config");
@@ -34381,12 +35337,12 @@ var init_delete3 = __esm({
34381
35337
  return this;
34382
35338
  }
34383
35339
  };
34384
- __publicField(MySqlDeleteBase, _a296, "MySqlDelete");
35340
+ __publicField(MySqlDeleteBase, _a298, "MySqlDelete");
34385
35341
  }
34386
35342
  });
34387
35343
 
34388
35344
  // ../drizzle-orm/dist/mysql-core/query-builders/insert.js
34389
- var _a297, MySqlInsertBuilder, _a298, _b222, MySqlInsertBase;
35345
+ var _a299, MySqlInsertBuilder, _a300, _b222, MySqlInsertBase;
34390
35346
  var init_insert3 = __esm({
34391
35347
  "../drizzle-orm/dist/mysql-core/query-builders/insert.js"() {
34392
35348
  "use strict";
@@ -34395,7 +35351,7 @@ var init_insert3 = __esm({
34395
35351
  init_sql();
34396
35352
  init_table();
34397
35353
  init_utils2();
34398
- _a297 = entityKind;
35354
+ _a299 = entityKind;
34399
35355
  MySqlInsertBuilder = class {
34400
35356
  constructor(table4, session, dialect4) {
34401
35357
  __publicField(this, "shouldIgnore", false);
@@ -34424,8 +35380,8 @@ var init_insert3 = __esm({
34424
35380
  return new MySqlInsertBase(this.table, mappedValues, this.shouldIgnore, this.session, this.dialect);
34425
35381
  }
34426
35382
  };
34427
- __publicField(MySqlInsertBuilder, _a297, "MySqlInsertBuilder");
34428
- MySqlInsertBase = class extends (_b222 = QueryPromise, _a298 = entityKind, _b222) {
35383
+ __publicField(MySqlInsertBuilder, _a299, "MySqlInsertBuilder");
35384
+ MySqlInsertBase = class extends (_b222 = QueryPromise, _a300 = entityKind, _b222) {
34429
35385
  constructor(table4, values, ignore, session, dialect4) {
34430
35386
  super();
34431
35387
  __publicField(this, "config");
@@ -34506,7 +35462,7 @@ var init_insert3 = __esm({
34506
35462
  return this;
34507
35463
  }
34508
35464
  };
34509
- __publicField(MySqlInsertBase, _a298, "MySqlInsert");
35465
+ __publicField(MySqlInsertBase, _a300, "MySqlInsert");
34510
35466
  }
34511
35467
  });
34512
35468
 
@@ -34590,7 +35546,7 @@ function mysqlTableWithSchema(name2, columns, extraConfig, schema4, baseName = n
34590
35546
  }
34591
35547
  return table4;
34592
35548
  }
34593
- var InlineForeignKeys3, _a299, _b223, _c9, _d4, _e3, MySqlTable, mysqlTable;
35549
+ var InlineForeignKeys3, _a301, _b223, _c9, _d4, _e4, MySqlTable, mysqlTable;
34594
35550
  var init_table4 = __esm({
34595
35551
  "../drizzle-orm/dist/mysql-core/table.js"() {
34596
35552
  "use strict";
@@ -34598,7 +35554,7 @@ var init_table4 = __esm({
34598
35554
  init_table();
34599
35555
  init_all3();
34600
35556
  InlineForeignKeys3 = Symbol.for("drizzle:MySqlInlineForeignKeys");
34601
- MySqlTable = class extends (_e3 = Table, _d4 = entityKind, _c9 = Table.Symbol.Columns, _b223 = InlineForeignKeys3, _a299 = Table.Symbol.ExtraConfigBuilder, _e3) {
35557
+ MySqlTable = class extends (_e4 = Table, _d4 = entityKind, _c9 = Table.Symbol.Columns, _b223 = InlineForeignKeys3, _a301 = Table.Symbol.ExtraConfigBuilder, _e4) {
34602
35558
  constructor() {
34603
35559
  super(...arguments);
34604
35560
  /** @internal */
@@ -34606,7 +35562,7 @@ var init_table4 = __esm({
34606
35562
  /** @internal */
34607
35563
  __publicField(this, _b223, []);
34608
35564
  /** @internal */
34609
- __publicField(this, _a299);
35565
+ __publicField(this, _a301);
34610
35566
  }
34611
35567
  };
34612
35568
  __publicField(MySqlTable, _d4, "MySqlTable");
@@ -34621,20 +35577,20 @@ var init_table4 = __esm({
34621
35577
  });
34622
35578
 
34623
35579
  // ../drizzle-orm/dist/mysql-core/view-base.js
34624
- var _a300, _b224, MySqlViewBase;
35580
+ var _a302, _b224, MySqlViewBase;
34625
35581
  var init_view_base3 = __esm({
34626
35582
  "../drizzle-orm/dist/mysql-core/view-base.js"() {
34627
35583
  "use strict";
34628
35584
  init_entity();
34629
35585
  init_sql();
34630
- MySqlViewBase = class extends (_b224 = View3, _a300 = entityKind, _b224) {
35586
+ MySqlViewBase = class extends (_b224 = View3, _a302 = entityKind, _b224) {
34631
35587
  };
34632
- __publicField(MySqlViewBase, _a300, "MySqlViewBase");
35588
+ __publicField(MySqlViewBase, _a302, "MySqlViewBase");
34633
35589
  }
34634
35590
  });
34635
35591
 
34636
35592
  // ../drizzle-orm/dist/mysql-core/dialect.js
34637
- var _a301, MySqlDialect;
35593
+ var _a303, MySqlDialect;
34638
35594
  var init_dialect3 = __esm({
34639
35595
  "../drizzle-orm/dist/mysql-core/dialect.js"() {
34640
35596
  "use strict";
@@ -34653,7 +35609,7 @@ var init_dialect3 = __esm({
34653
35609
  init_common4();
34654
35610
  init_table4();
34655
35611
  init_view_base3();
34656
- _a301 = entityKind;
35612
+ _a303 = entityKind;
34657
35613
  MySqlDialect = class {
34658
35614
  constructor(config) {
34659
35615
  /** @internal */
@@ -35439,7 +36395,7 @@ var init_dialect3 = __esm({
35439
36395
  };
35440
36396
  }
35441
36397
  };
35442
- __publicField(MySqlDialect, _a301, "MySqlDialect");
36398
+ __publicField(MySqlDialect, _a303, "MySqlDialect");
35443
36399
  }
35444
36400
  });
35445
36401
 
@@ -35461,7 +36417,7 @@ function createSetOperator3(type, isAll) {
35461
36417
  return leftSelect.addSetOperators(setOperators);
35462
36418
  };
35463
36419
  }
35464
- var _a302, MySqlSelectBuilder, _a303, _b225, MySqlSelectQueryBuilderBase, _a304, _b226, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
36420
+ var _a304, MySqlSelectBuilder, _a305, _b225, MySqlSelectQueryBuilderBase, _a306, _b226, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
35465
36421
  var init_select4 = __esm({
35466
36422
  "../drizzle-orm/dist/mysql-core/query-builders/select.js"() {
35467
36423
  "use strict";
@@ -35476,7 +36432,7 @@ var init_select4 = __esm({
35476
36432
  init_utils2();
35477
36433
  init_view_common();
35478
36434
  init_view_base3();
35479
- _a302 = entityKind;
36435
+ _a304 = entityKind;
35480
36436
  MySqlSelectBuilder = class {
35481
36437
  constructor(config) {
35482
36438
  __publicField(this, "fields");
@@ -35521,8 +36477,8 @@ var init_select4 = __esm({
35521
36477
  );
35522
36478
  }
35523
36479
  };
35524
- __publicField(MySqlSelectBuilder, _a302, "MySqlSelectBuilder");
35525
- MySqlSelectQueryBuilderBase = class extends (_b225 = TypedQueryBuilder, _a303 = entityKind, _b225) {
36480
+ __publicField(MySqlSelectBuilder, _a304, "MySqlSelectBuilder");
36481
+ MySqlSelectQueryBuilderBase = class extends (_b225 = TypedQueryBuilder, _a305 = entityKind, _b225) {
35526
36482
  constructor({ table: table4, fields, isPartialSelect, session, dialect: dialect4, withList, distinct }) {
35527
36483
  super();
35528
36484
  __publicField(this, "_");
@@ -36123,8 +37079,8 @@ var init_select4 = __esm({
36123
37079
  return this;
36124
37080
  }
36125
37081
  };
36126
- __publicField(MySqlSelectQueryBuilderBase, _a303, "MySqlSelectQueryBuilder");
36127
- MySqlSelectBase = class extends (_b226 = MySqlSelectQueryBuilderBase, _a304 = entityKind, _b226) {
37082
+ __publicField(MySqlSelectQueryBuilderBase, _a305, "MySqlSelectQueryBuilder");
37083
+ MySqlSelectBase = class extends (_b226 = MySqlSelectQueryBuilderBase, _a306 = entityKind, _b226) {
36128
37084
  constructor() {
36129
37085
  super(...arguments);
36130
37086
  __publicField(this, "execute", (placeholderValues) => {
@@ -36148,7 +37104,7 @@ var init_select4 = __esm({
36148
37104
  return query;
36149
37105
  }
36150
37106
  };
36151
- __publicField(MySqlSelectBase, _a304, "MySqlSelect");
37107
+ __publicField(MySqlSelectBase, _a306, "MySqlSelect");
36152
37108
  applyMixins(MySqlSelectBase, [QueryPromise]);
36153
37109
  getMySqlSetOperators = () => ({
36154
37110
  union: union3,
@@ -36168,7 +37124,7 @@ var init_select4 = __esm({
36168
37124
  });
36169
37125
 
36170
37126
  // ../drizzle-orm/dist/mysql-core/query-builders/query-builder.js
36171
- var _a305, QueryBuilder3;
37127
+ var _a307, QueryBuilder3;
36172
37128
  var init_query_builder4 = __esm({
36173
37129
  "../drizzle-orm/dist/mysql-core/query-builders/query-builder.js"() {
36174
37130
  "use strict";
@@ -36177,7 +37133,7 @@ var init_query_builder4 = __esm({
36177
37133
  init_selection_proxy();
36178
37134
  init_subquery();
36179
37135
  init_select4();
36180
- _a305 = entityKind;
37136
+ _a307 = entityKind;
36181
37137
  QueryBuilder3 = class {
36182
37138
  constructor(dialect4) {
36183
37139
  __publicField(this, "dialect");
@@ -36239,7 +37195,7 @@ var init_query_builder4 = __esm({
36239
37195
  return this.dialect;
36240
37196
  }
36241
37197
  };
36242
- __publicField(QueryBuilder3, _a305, "MySqlQueryBuilder");
37198
+ __publicField(QueryBuilder3, _a307, "MySqlQueryBuilder");
36243
37199
  }
36244
37200
  });
36245
37201
 
@@ -36251,7 +37207,7 @@ var init_select_types3 = __esm({
36251
37207
  });
36252
37208
 
36253
37209
  // ../drizzle-orm/dist/mysql-core/query-builders/update.js
36254
- var _a306, MySqlUpdateBuilder, _a307, _b227, MySqlUpdateBase;
37210
+ var _a308, MySqlUpdateBuilder, _a309, _b227, MySqlUpdateBase;
36255
37211
  var init_update3 = __esm({
36256
37212
  "../drizzle-orm/dist/mysql-core/query-builders/update.js"() {
36257
37213
  "use strict";
@@ -36260,7 +37216,7 @@ var init_update3 = __esm({
36260
37216
  init_selection_proxy();
36261
37217
  init_table();
36262
37218
  init_utils2();
36263
- _a306 = entityKind;
37219
+ _a308 = entityKind;
36264
37220
  MySqlUpdateBuilder = class {
36265
37221
  constructor(table4, session, dialect4, withList) {
36266
37222
  this.table = table4;
@@ -36272,8 +37228,8 @@ var init_update3 = __esm({
36272
37228
  return new MySqlUpdateBase(this.table, mapUpdateSet(this.table, values), this.session, this.dialect, this.withList);
36273
37229
  }
36274
37230
  };
36275
- __publicField(MySqlUpdateBuilder, _a306, "MySqlUpdateBuilder");
36276
- MySqlUpdateBase = class extends (_b227 = QueryPromise, _a307 = entityKind, _b227) {
37231
+ __publicField(MySqlUpdateBuilder, _a308, "MySqlUpdateBuilder");
37232
+ MySqlUpdateBase = class extends (_b227 = QueryPromise, _a309 = entityKind, _b227) {
36277
37233
  constructor(table4, set, session, dialect4, withList) {
36278
37234
  super();
36279
37235
  __publicField(this, "config");
@@ -36366,7 +37322,7 @@ var init_update3 = __esm({
36366
37322
  return this;
36367
37323
  }
36368
37324
  };
36369
- __publicField(MySqlUpdateBase, _a307, "MySqlUpdate");
37325
+ __publicField(MySqlUpdateBase, _a309, "MySqlUpdate");
36370
37326
  }
36371
37327
  });
36372
37328
 
@@ -36384,14 +37340,14 @@ var init_query_builders3 = __esm({
36384
37340
  });
36385
37341
 
36386
37342
  // ../drizzle-orm/dist/mysql-core/query-builders/query.js
36387
- var _a308, RelationalQueryBuilder3, _a309, _b228, MySqlRelationalQuery;
37343
+ var _a310, RelationalQueryBuilder3, _a311, _b228, MySqlRelationalQuery;
36388
37344
  var init_query3 = __esm({
36389
37345
  "../drizzle-orm/dist/mysql-core/query-builders/query.js"() {
36390
37346
  "use strict";
36391
37347
  init_entity();
36392
37348
  init_query_promise();
36393
37349
  init_relations();
36394
- _a308 = entityKind;
37350
+ _a310 = entityKind;
36395
37351
  RelationalQueryBuilder3 = class {
36396
37352
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, mode) {
36397
37353
  this.fullSchema = fullSchema;
@@ -36432,8 +37388,8 @@ var init_query3 = __esm({
36432
37388
  );
36433
37389
  }
36434
37390
  };
36435
- __publicField(RelationalQueryBuilder3, _a308, "MySqlRelationalQueryBuilder");
36436
- MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a309 = entityKind, _b228) {
37391
+ __publicField(RelationalQueryBuilder3, _a310, "MySqlRelationalQueryBuilder");
37392
+ MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a311 = entityKind, _b228) {
36437
37393
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, config, queryMode, mode) {
36438
37394
  super();
36439
37395
  this.fullSchema = fullSchema;
@@ -36497,12 +37453,12 @@ var init_query3 = __esm({
36497
37453
  return this.prepare().execute();
36498
37454
  }
36499
37455
  };
36500
- __publicField(MySqlRelationalQuery, _a309, "MySqlRelationalQuery");
37456
+ __publicField(MySqlRelationalQuery, _a311, "MySqlRelationalQuery");
36501
37457
  }
36502
37458
  });
36503
37459
 
36504
37460
  // ../drizzle-orm/dist/mysql-core/db.js
36505
- var _a310, MySqlDatabase;
37461
+ var _a312, MySqlDatabase;
36506
37462
  var init_db3 = __esm({
36507
37463
  "../drizzle-orm/dist/mysql-core/db.js"() {
36508
37464
  "use strict";
@@ -36513,7 +37469,7 @@ var init_db3 = __esm({
36513
37469
  init_count3();
36514
37470
  init_query_builders3();
36515
37471
  init_query3();
36516
- _a310 = entityKind;
37472
+ _a312 = entityKind;
36517
37473
  MySqlDatabase = class {
36518
37474
  constructor(dialect4, session, schema4, mode) {
36519
37475
  __publicField(this, "query");
@@ -36726,17 +37682,17 @@ var init_db3 = __esm({
36726
37682
  return this.session.transaction(transaction, config);
36727
37683
  }
36728
37684
  };
36729
- __publicField(MySqlDatabase, _a310, "MySqlDatabase");
37685
+ __publicField(MySqlDatabase, _a312, "MySqlDatabase");
36730
37686
  }
36731
37687
  });
36732
37688
 
36733
37689
  // ../drizzle-orm/dist/mysql-core/indexes.js
36734
- var _a311, IndexBuilderOn3, _a312, IndexBuilder3, _a313, Index5;
37690
+ var _a313, IndexBuilderOn3, _a314, IndexBuilder3, _a315, Index5;
36735
37691
  var init_indexes3 = __esm({
36736
37692
  "../drizzle-orm/dist/mysql-core/indexes.js"() {
36737
37693
  "use strict";
36738
37694
  init_entity();
36739
- _a311 = entityKind;
37695
+ _a313 = entityKind;
36740
37696
  IndexBuilderOn3 = class {
36741
37697
  constructor(name2, unique) {
36742
37698
  this.name = name2;
@@ -36746,8 +37702,8 @@ var init_indexes3 = __esm({
36746
37702
  return new IndexBuilder3(this.name, columns, this.unique);
36747
37703
  }
36748
37704
  };
36749
- __publicField(IndexBuilderOn3, _a311, "MySqlIndexBuilderOn");
36750
- _a312 = entityKind;
37705
+ __publicField(IndexBuilderOn3, _a313, "MySqlIndexBuilderOn");
37706
+ _a314 = entityKind;
36751
37707
  IndexBuilder3 = class {
36752
37708
  constructor(name2, columns, unique) {
36753
37709
  /** @internal */
@@ -36775,26 +37731,26 @@ var init_indexes3 = __esm({
36775
37731
  return new Index5(this.config, table4);
36776
37732
  }
36777
37733
  };
36778
- __publicField(IndexBuilder3, _a312, "MySqlIndexBuilder");
36779
- _a313 = entityKind;
37734
+ __publicField(IndexBuilder3, _a314, "MySqlIndexBuilder");
37735
+ _a315 = entityKind;
36780
37736
  Index5 = class {
36781
37737
  constructor(config, table4) {
36782
37738
  __publicField(this, "config");
36783
37739
  this.config = { ...config, table: table4 };
36784
37740
  }
36785
37741
  };
36786
- __publicField(Index5, _a313, "MySqlIndex");
37742
+ __publicField(Index5, _a315, "MySqlIndex");
36787
37743
  }
36788
37744
  });
36789
37745
 
36790
37746
  // ../drizzle-orm/dist/mysql-core/primary-keys.js
36791
- var _a314, PrimaryKeyBuilder3, _a315, PrimaryKey3;
37747
+ var _a316, PrimaryKeyBuilder3, _a317, PrimaryKey3;
36792
37748
  var init_primary_keys3 = __esm({
36793
37749
  "../drizzle-orm/dist/mysql-core/primary-keys.js"() {
36794
37750
  "use strict";
36795
37751
  init_entity();
36796
37752
  init_table4();
36797
- _a314 = entityKind;
37753
+ _a316 = entityKind;
36798
37754
  PrimaryKeyBuilder3 = class {
36799
37755
  constructor(columns, name2) {
36800
37756
  /** @internal */
@@ -36809,8 +37765,8 @@ var init_primary_keys3 = __esm({
36809
37765
  return new PrimaryKey3(table4, this.columns, this.name);
36810
37766
  }
36811
37767
  };
36812
- __publicField(PrimaryKeyBuilder3, _a314, "MySqlPrimaryKeyBuilder");
36813
- _a315 = entityKind;
37768
+ __publicField(PrimaryKeyBuilder3, _a316, "MySqlPrimaryKeyBuilder");
37769
+ _a317 = entityKind;
36814
37770
  PrimaryKey3 = class {
36815
37771
  constructor(table4, columns, name2) {
36816
37772
  __publicField(this, "columns");
@@ -36823,7 +37779,7 @@ var init_primary_keys3 = __esm({
36823
37779
  return this.name ?? `${this.table[MySqlTable.Symbol.Name]}_${this.columns.map((column4) => column4.name).join("_")}_pk`;
36824
37780
  }
36825
37781
  };
36826
- __publicField(PrimaryKey3, _a315, "MySqlPrimaryKey");
37782
+ __publicField(PrimaryKey3, _a317, "MySqlPrimaryKey");
36827
37783
  }
36828
37784
  });
36829
37785
 
@@ -36843,7 +37799,7 @@ function mysqlViewWithSchema(name2, selection, schema4) {
36843
37799
  }
36844
37800
  return new ViewBuilder3(name2, schema4);
36845
37801
  }
36846
- var _a316, ViewBuilderCore2, _a317, _b229, ViewBuilder3, _a318, _b230, ManualViewBuilder3, _a319, _b231, _c10, MySqlView2;
37802
+ var _a318, ViewBuilderCore2, _a319, _b229, ViewBuilder3, _a320, _b230, ManualViewBuilder3, _a321, _b231, _c10, MySqlView2;
36847
37803
  var init_view3 = __esm({
36848
37804
  "../drizzle-orm/dist/mysql-core/view.js"() {
36849
37805
  "use strict";
@@ -36854,7 +37810,7 @@ var init_view3 = __esm({
36854
37810
  init_table4();
36855
37811
  init_view_base3();
36856
37812
  init_view_common3();
36857
- _a316 = entityKind;
37813
+ _a318 = entityKind;
36858
37814
  ViewBuilderCore2 = class {
36859
37815
  constructor(name2, schema4) {
36860
37816
  __publicField(this, "config", {});
@@ -36874,8 +37830,8 @@ var init_view3 = __esm({
36874
37830
  return this;
36875
37831
  }
36876
37832
  };
36877
- __publicField(ViewBuilderCore2, _a316, "MySqlViewBuilder");
36878
- ViewBuilder3 = class extends (_b229 = ViewBuilderCore2, _a317 = entityKind, _b229) {
37833
+ __publicField(ViewBuilderCore2, _a318, "MySqlViewBuilder");
37834
+ ViewBuilder3 = class extends (_b229 = ViewBuilderCore2, _a319 = entityKind, _b229) {
36879
37835
  as(qb) {
36880
37836
  if (typeof qb === "function") {
36881
37837
  qb = qb(new QueryBuilder3());
@@ -36901,8 +37857,8 @@ var init_view3 = __esm({
36901
37857
  );
36902
37858
  }
36903
37859
  };
36904
- __publicField(ViewBuilder3, _a317, "MySqlViewBuilder");
36905
- ManualViewBuilder3 = class extends (_b230 = ViewBuilderCore2, _a318 = entityKind, _b230) {
37860
+ __publicField(ViewBuilder3, _a319, "MySqlViewBuilder");
37861
+ ManualViewBuilder3 = class extends (_b230 = ViewBuilderCore2, _a320 = entityKind, _b230) {
36906
37862
  constructor(name2, columns, schema4) {
36907
37863
  super(name2, schema4);
36908
37864
  __publicField(this, "columns");
@@ -36947,11 +37903,11 @@ var init_view3 = __esm({
36947
37903
  );
36948
37904
  }
36949
37905
  };
36950
- __publicField(ManualViewBuilder3, _a318, "MySqlManualViewBuilder");
36951
- MySqlView2 = class extends (_c10 = MySqlViewBase, _b231 = entityKind, _a319 = MySqlViewConfig, _c10) {
37906
+ __publicField(ManualViewBuilder3, _a320, "MySqlManualViewBuilder");
37907
+ MySqlView2 = class extends (_c10 = MySqlViewBase, _b231 = entityKind, _a321 = MySqlViewConfig, _c10) {
36952
37908
  constructor({ mysqlConfig, config }) {
36953
37909
  super(config);
36954
- __publicField(this, _a319);
37910
+ __publicField(this, _a321);
36955
37911
  this[MySqlViewConfig] = mysqlConfig;
36956
37912
  }
36957
37913
  };
@@ -36960,14 +37916,14 @@ var init_view3 = __esm({
36960
37916
  });
36961
37917
 
36962
37918
  // ../drizzle-orm/dist/mysql-core/schema.js
36963
- var _a320, MySqlSchema5;
37919
+ var _a322, MySqlSchema5;
36964
37920
  var init_schema2 = __esm({
36965
37921
  "../drizzle-orm/dist/mysql-core/schema.js"() {
36966
37922
  "use strict";
36967
37923
  init_entity();
36968
37924
  init_table4();
36969
37925
  init_view3();
36970
- _a320 = entityKind;
37926
+ _a322 = entityKind;
36971
37927
  MySqlSchema5 = class {
36972
37928
  constructor(schemaName) {
36973
37929
  __publicField(this, "table", (name2, columns, extraConfig) => {
@@ -36979,12 +37935,12 @@ var init_schema2 = __esm({
36979
37935
  this.schemaName = schemaName;
36980
37936
  }
36981
37937
  };
36982
- __publicField(MySqlSchema5, _a320, "MySqlSchema");
37938
+ __publicField(MySqlSchema5, _a322, "MySqlSchema");
36983
37939
  }
36984
37940
  });
36985
37941
 
36986
37942
  // ../drizzle-orm/dist/mysql-core/session.js
36987
- var _a321, MySqlPreparedQuery, _a322, MySqlSession, _a323, _b232, MySqlTransaction;
37943
+ var _a323, MySqlPreparedQuery, _a324, MySqlSession, _a325, _b232, MySqlTransaction;
36988
37944
  var init_session3 = __esm({
36989
37945
  "../drizzle-orm/dist/mysql-core/session.js"() {
36990
37946
  "use strict";
@@ -36992,15 +37948,15 @@ var init_session3 = __esm({
36992
37948
  init_errors();
36993
37949
  init_sql();
36994
37950
  init_db3();
36995
- _a321 = entityKind;
37951
+ _a323 = entityKind;
36996
37952
  MySqlPreparedQuery = class {
36997
37953
  constructor() {
36998
37954
  /** @internal */
36999
37955
  __publicField(this, "joinsNotNullableMap");
37000
37956
  }
37001
37957
  };
37002
- __publicField(MySqlPreparedQuery, _a321, "MySqlPreparedQuery");
37003
- _a322 = entityKind;
37958
+ __publicField(MySqlPreparedQuery, _a323, "MySqlPreparedQuery");
37959
+ _a324 = entityKind;
37004
37960
  MySqlSession = class {
37005
37961
  constructor(dialect4) {
37006
37962
  this.dialect = dialect4;
@@ -37035,8 +37991,8 @@ var init_session3 = __esm({
37035
37991
  return parts.length ? sql`start transaction ${sql.raw(parts.join(" "))}` : void 0;
37036
37992
  }
37037
37993
  };
37038
- __publicField(MySqlSession, _a322, "MySqlSession");
37039
- MySqlTransaction = class extends (_b232 = MySqlDatabase, _a323 = entityKind, _b232) {
37994
+ __publicField(MySqlSession, _a324, "MySqlSession");
37995
+ MySqlTransaction = class extends (_b232 = MySqlDatabase, _a325 = entityKind, _b232) {
37040
37996
  constructor(dialect4, session, schema4, nestedIndex, mode) {
37041
37997
  super(dialect4, session, schema4, mode);
37042
37998
  this.schema = schema4;
@@ -37046,7 +38002,7 @@ var init_session3 = __esm({
37046
38002
  throw new TransactionRollbackError();
37047
38003
  }
37048
38004
  };
37049
- __publicField(MySqlTransaction, _a323, "MySqlTransaction");
38005
+ __publicField(MySqlTransaction, _a325, "MySqlTransaction");
37050
38006
  }
37051
38007
  });
37052
38008
 
@@ -37934,6 +38890,13 @@ var init_cli = __esm({
37934
38890
  breakpoints: booleanType().optional().default(true),
37935
38891
  migrations: objectType({
37936
38892
  prefix: prefix.optional().default("index")
38893
+ }).optional(),
38894
+ entities: objectType({
38895
+ roles: booleanType().or(objectType({
38896
+ provider: stringType().optional(),
38897
+ include: stringType().array().optional(),
38898
+ exclude: stringType().array().optional()
38899
+ })).optional().default(false)
37937
38900
  }).optional()
37938
38901
  }).passthrough();
37939
38902
  configCheck = objectType({
@@ -38200,6 +39163,8 @@ var init_pgImports = __esm({
38200
39163
  const enums = [];
38201
39164
  const schemas = [];
38202
39165
  const sequences = [];
39166
+ const roles = [];
39167
+ const policies = [];
38203
39168
  const views = [];
38204
39169
  const matViews = [];
38205
39170
  const i0values = Object.values(exports2);
@@ -38223,8 +39188,14 @@ var init_pgImports = __esm({
38223
39188
  if (isPgSequence(t)) {
38224
39189
  sequences.push(t);
38225
39190
  }
39191
+ if (is(t, PgRole)) {
39192
+ roles.push(t);
39193
+ }
39194
+ if (is(t, PgPolicy)) {
39195
+ policies.push(t);
39196
+ }
38226
39197
  });
38227
- return { tables, enums, schemas, sequences, views, matViews };
39198
+ return { tables, enums, schemas, sequences, views, matViews, roles, policies };
38228
39199
  };
38229
39200
  }
38230
39201
  });
@@ -38644,7 +39615,7 @@ init_mjs();
38644
39615
  init_global();
38645
39616
  init_pgSerializer();
38646
39617
  init_views();
38647
- var pgPushIntrospect = async (db, filters, schemaFilters) => {
39618
+ var pgPushIntrospect = async (db, filters, schemaFilters, entities = { roles: true }) => {
38648
39619
  const matchers = filters.map((it) => {
38649
39620
  return new Minimatch(it);
38650
39621
  });
@@ -38672,7 +39643,7 @@ var pgPushIntrospect = async (db, filters, schemaFilters) => {
38672
39643
  );
38673
39644
  const res = await (0, import_hanji3.renderWithTask)(
38674
39645
  progress,
38675
- fromDatabase(db, filter2, schemaFilters)
39646
+ fromDatabase(db, filter2, schemaFilters, entities)
38676
39647
  );
38677
39648
  const schema4 = { id: originUUID, prevId: "", ...res };
38678
39649
  const { internal, ...schemaWithoutInternals } = schema4;
@@ -38842,17 +39813,11 @@ var pgSuggestions = async (db, statements) => {
38842
39813
  }
38843
39814
  const stmnt = fromJson([statement], "postgresql");
38844
39815
  if (typeof stmnt !== "undefined") {
38845
- if (statement.type === "drop_table") {
38846
- statementsToExecute.push(
38847
- `DROP TABLE ${concatSchemaAndTableName(statement.schema, statement.tableName)} CASCADE;`
38848
- );
38849
- } else {
38850
- statementsToExecute.push(...stmnt);
38851
- }
39816
+ statementsToExecute.push(...stmnt);
38852
39817
  }
38853
39818
  }
38854
39819
  return {
38855
- statementsToExecute,
39820
+ statementsToExecute: [...new Set(statementsToExecute)],
38856
39821
  shouldAskForApprove,
38857
39822
  infoToPrint,
38858
39823
  matViewsToRemove: [...new Set(matViewsToRemove)],
@@ -39098,6 +40063,8 @@ var generateDrizzleJson = (imports, prevId, schemaFilters, casing2) => {
39098
40063
  prepared.enums,
39099
40064
  prepared.schemas,
39100
40065
  prepared.sequences,
40066
+ prepared.roles,
40067
+ prepared.policies,
39101
40068
  prepared.views,
39102
40069
  prepared.matViews,
39103
40070
  casing2,
@@ -39121,6 +40088,8 @@ var generateMigration = async (prev, cur) => {
39121
40088
  schemasResolver,
39122
40089
  enumsResolver,
39123
40090
  sequencesResolver,
40091
+ policyResolver,
40092
+ roleResolver,
39124
40093
  tablesResolver,
39125
40094
  columnsResolver,
39126
40095
  viewsResolver,
@@ -39154,6 +40123,8 @@ var pushSchema = async (imports, drizzleInstance, schemaFilters) => {
39154
40123
  schemasResolver,
39155
40124
  enumsResolver,
39156
40125
  sequencesResolver,
40126
+ policyResolver,
40127
+ roleResolver,
39157
40128
  tablesResolver,
39158
40129
  columnsResolver,
39159
40130
  viewsResolver,