drizzle-kit 0.26.2-1b1151d → 0.26.2-31c8041

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,67 @@ 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
+ this.name = name2;
27495
+ if (config) {
27496
+ this.as = config.as;
27497
+ this.for = config.for;
27498
+ this.to = config.to;
27499
+ this.using = config.using;
27500
+ this.withCheck = config.withCheck;
27501
+ }
27502
+ }
27503
+ };
27504
+ __publicField(PgPolicy, _a147, "PgPolicy");
27505
+ }
27506
+ });
27507
+
27508
+ // ../drizzle-orm/dist/pg-core/roles.js
27509
+ var _a148, PgRole;
27510
+ var init_roles = __esm({
27511
+ "../drizzle-orm/dist/pg-core/roles.js"() {
27512
+ "use strict";
27513
+ init_entity();
27514
+ _a148 = entityKind;
27515
+ PgRole = class {
27516
+ constructor(name2, config) {
27517
+ /** @internal */
27518
+ __publicField(this, "_existing");
27519
+ /** @internal */
27520
+ __publicField(this, "createDb");
27521
+ /** @internal */
27522
+ __publicField(this, "createRole");
27523
+ /** @internal */
27524
+ __publicField(this, "inherit");
27525
+ this.name = name2;
27526
+ if (config) {
27527
+ this.createDb = config.createDb;
27528
+ this.createRole = config.createRole;
27529
+ this.inherit = config.inherit;
27530
+ }
27531
+ }
27532
+ existing() {
27533
+ this._existing = true;
27534
+ return this;
27535
+ }
27536
+ };
27537
+ __publicField(PgRole, _a148, "PgRole");
27538
+ }
27539
+ });
27540
+
26808
27541
  // ../drizzle-orm/dist/pg-core/sequence.js
26809
27542
  function pgSequenceWithSchema(name2, options, schema4) {
26810
27543
  return new PgSequence(name2, options, schema4);
@@ -26812,12 +27545,12 @@ function pgSequenceWithSchema(name2, options, schema4) {
26812
27545
  function isPgSequence(obj) {
26813
27546
  return is(obj, PgSequence);
26814
27547
  }
26815
- var _a147, PgSequence;
27548
+ var _a149, PgSequence;
26816
27549
  var init_sequence = __esm({
26817
27550
  "../drizzle-orm/dist/pg-core/sequence.js"() {
26818
27551
  "use strict";
26819
27552
  init_entity();
26820
- _a147 = entityKind;
27553
+ _a149 = entityKind;
26821
27554
  PgSequence = class {
26822
27555
  constructor(seqName, seqOptions, schema4) {
26823
27556
  this.seqName = seqName;
@@ -26825,7 +27558,7 @@ var init_sequence = __esm({
26825
27558
  this.schema = schema4;
26826
27559
  }
26827
27560
  };
26828
- __publicField(PgSequence, _a147, "PgSequence");
27561
+ __publicField(PgSequence, _a149, "PgSequence");
26829
27562
  }
26830
27563
  });
26831
27564
 
@@ -26857,7 +27590,7 @@ function isPgView(obj) {
26857
27590
  function isPgMaterializedView(obj) {
26858
27591
  return is(obj, PgMaterializedView);
26859
27592
  }
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;
27593
+ 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
27594
  var init_view = __esm({
26862
27595
  "../drizzle-orm/dist/pg-core/view.js"() {
26863
27596
  "use strict";
@@ -26868,7 +27601,7 @@ var init_view = __esm({
26868
27601
  init_table2();
26869
27602
  init_view_base();
26870
27603
  init_view_common2();
26871
- _a148 = entityKind;
27604
+ _a150 = entityKind;
26872
27605
  DefaultViewBuilderCore = class {
26873
27606
  constructor(name2, schema4) {
26874
27607
  __publicField(this, "config", {});
@@ -26880,8 +27613,8 @@ var init_view = __esm({
26880
27613
  return this;
26881
27614
  }
26882
27615
  };
26883
- __publicField(DefaultViewBuilderCore, _a148, "PgDefaultViewBuilderCore");
26884
- ViewBuilder = class extends (_b107 = DefaultViewBuilderCore, _a149 = entityKind, _b107) {
27616
+ __publicField(DefaultViewBuilderCore, _a150, "PgDefaultViewBuilderCore");
27617
+ ViewBuilder = class extends (_b107 = DefaultViewBuilderCore, _a151 = entityKind, _b107) {
26885
27618
  as(qb) {
26886
27619
  if (typeof qb === "function") {
26887
27620
  qb = qb(new QueryBuilder());
@@ -26907,8 +27640,8 @@ var init_view = __esm({
26907
27640
  );
26908
27641
  }
26909
27642
  };
26910
- __publicField(ViewBuilder, _a149, "PgViewBuilder");
26911
- ManualViewBuilder = class extends (_b108 = DefaultViewBuilderCore, _a150 = entityKind, _b108) {
27643
+ __publicField(ViewBuilder, _a151, "PgViewBuilder");
27644
+ ManualViewBuilder = class extends (_b108 = DefaultViewBuilderCore, _a152 = entityKind, _b108) {
26912
27645
  constructor(name2, columns, schema4) {
26913
27646
  super(name2, schema4);
26914
27647
  __publicField(this, "columns");
@@ -26953,8 +27686,8 @@ var init_view = __esm({
26953
27686
  );
26954
27687
  }
26955
27688
  };
26956
- __publicField(ManualViewBuilder, _a150, "PgManualViewBuilder");
26957
- _a151 = entityKind;
27689
+ __publicField(ManualViewBuilder, _a152, "PgManualViewBuilder");
27690
+ _a153 = entityKind;
26958
27691
  MaterializedViewBuilderCore = class {
26959
27692
  constructor(name2, schema4) {
26960
27693
  __publicField(this, "config", {});
@@ -26978,8 +27711,8 @@ var init_view = __esm({
26978
27711
  return this;
26979
27712
  }
26980
27713
  };
26981
- __publicField(MaterializedViewBuilderCore, _a151, "PgMaterializedViewBuilderCore");
26982
- MaterializedViewBuilder = class extends (_b109 = MaterializedViewBuilderCore, _a152 = entityKind, _b109) {
27714
+ __publicField(MaterializedViewBuilderCore, _a153, "PgMaterializedViewBuilderCore");
27715
+ MaterializedViewBuilder = class extends (_b109 = MaterializedViewBuilderCore, _a154 = entityKind, _b109) {
26983
27716
  as(qb) {
26984
27717
  if (typeof qb === "function") {
26985
27718
  qb = qb(new QueryBuilder());
@@ -27010,8 +27743,8 @@ var init_view = __esm({
27010
27743
  );
27011
27744
  }
27012
27745
  };
27013
- __publicField(MaterializedViewBuilder, _a152, "PgMaterializedViewBuilder");
27014
- ManualMaterializedViewBuilder = class extends (_b110 = MaterializedViewBuilderCore, _a153 = entityKind, _b110) {
27746
+ __publicField(MaterializedViewBuilder, _a154, "PgMaterializedViewBuilder");
27747
+ ManualMaterializedViewBuilder = class extends (_b110 = MaterializedViewBuilderCore, _a155 = entityKind, _b110) {
27015
27748
  constructor(name2, columns, schema4) {
27016
27749
  super(name2, schema4);
27017
27750
  __publicField(this, "columns");
@@ -27066,11 +27799,11 @@ var init_view = __esm({
27066
27799
  );
27067
27800
  }
27068
27801
  };
27069
- __publicField(ManualMaterializedViewBuilder, _a153, "PgManualMaterializedViewBuilder");
27070
- PgView2 = class extends (_c4 = PgViewBase, _b111 = entityKind, _a154 = PgViewConfig, _c4) {
27802
+ __publicField(ManualMaterializedViewBuilder, _a155, "PgManualMaterializedViewBuilder");
27803
+ PgView2 = class extends (_c4 = PgViewBase, _b111 = entityKind, _a156 = PgViewConfig, _c4) {
27071
27804
  constructor({ pgConfig, config }) {
27072
27805
  super(config);
27073
- __publicField(this, _a154);
27806
+ __publicField(this, _a156);
27074
27807
  if (pgConfig) {
27075
27808
  this[PgViewConfig] = {
27076
27809
  with: pgConfig.with
@@ -27080,10 +27813,10 @@ var init_view = __esm({
27080
27813
  };
27081
27814
  __publicField(PgView2, _b111, "PgView");
27082
27815
  PgMaterializedViewConfig = Symbol.for("drizzle:PgMaterializedViewConfig");
27083
- PgMaterializedView = class extends (_c5 = PgViewBase, _b112 = entityKind, _a155 = PgMaterializedViewConfig, _c5) {
27816
+ PgMaterializedView = class extends (_c5 = PgViewBase, _b112 = entityKind, _a157 = PgMaterializedViewConfig, _c5) {
27084
27817
  constructor({ pgConfig, config }) {
27085
27818
  super(config);
27086
- __publicField(this, _a155);
27819
+ __publicField(this, _a157);
27087
27820
  this[PgMaterializedViewConfig] = {
27088
27821
  with: pgConfig?.with,
27089
27822
  using: pgConfig?.using,
@@ -27097,7 +27830,7 @@ var init_view = __esm({
27097
27830
  });
27098
27831
 
27099
27832
  // ../drizzle-orm/dist/pg-core/schema.js
27100
- var _a156, PgSchema5;
27833
+ var _a158, PgSchema5;
27101
27834
  var init_schema = __esm({
27102
27835
  "../drizzle-orm/dist/pg-core/schema.js"() {
27103
27836
  "use strict";
@@ -27107,7 +27840,7 @@ var init_schema = __esm({
27107
27840
  init_sequence();
27108
27841
  init_table2();
27109
27842
  init_view();
27110
- _a156 = entityKind;
27843
+ _a158 = entityKind;
27111
27844
  PgSchema5 = class {
27112
27845
  constructor(schemaName) {
27113
27846
  __publicField(this, "table", (name2, columns, extraConfig) => {
@@ -27134,12 +27867,12 @@ var init_schema = __esm({
27134
27867
  return true;
27135
27868
  }
27136
27869
  };
27137
- __publicField(PgSchema5, _a156, "PgSchema");
27870
+ __publicField(PgSchema5, _a158, "PgSchema");
27138
27871
  }
27139
27872
  });
27140
27873
 
27141
27874
  // ../drizzle-orm/dist/pg-core/session.js
27142
- var _a157, PgPreparedQuery, _a158, PgSession, _a159, _b113, PgTransaction;
27875
+ var _a159, PgPreparedQuery, _a160, PgSession, _a161, _b113, PgTransaction;
27143
27876
  var init_session = __esm({
27144
27877
  "../drizzle-orm/dist/pg-core/session.js"() {
27145
27878
  "use strict";
@@ -27148,7 +27881,7 @@ var init_session = __esm({
27148
27881
  init_sql2();
27149
27882
  init_tracing();
27150
27883
  init_db();
27151
- _a157 = entityKind;
27884
+ _a159 = entityKind;
27152
27885
  PgPreparedQuery = class {
27153
27886
  constructor(query) {
27154
27887
  /** @internal */
@@ -27162,8 +27895,8 @@ var init_session = __esm({
27162
27895
  return response;
27163
27896
  }
27164
27897
  };
27165
- __publicField(PgPreparedQuery, _a157, "PgPreparedQuery");
27166
- _a158 = entityKind;
27898
+ __publicField(PgPreparedQuery, _a159, "PgPreparedQuery");
27899
+ _a160 = entityKind;
27167
27900
  PgSession = class {
27168
27901
  constructor(dialect4) {
27169
27902
  this.dialect = dialect4;
@@ -27196,8 +27929,8 @@ var init_session = __esm({
27196
27929
  );
27197
27930
  }
27198
27931
  };
27199
- __publicField(PgSession, _a158, "PgSession");
27200
- PgTransaction = class extends (_b113 = PgDatabase, _a159 = entityKind, _b113) {
27932
+ __publicField(PgSession, _a160, "PgSession");
27933
+ PgTransaction = class extends (_b113 = PgDatabase, _a161 = entityKind, _b113) {
27201
27934
  constructor(dialect4, session, schema4, nestedIndex = 0) {
27202
27935
  super(dialect4, session, schema4);
27203
27936
  this.schema = schema4;
@@ -27224,7 +27957,7 @@ var init_session = __esm({
27224
27957
  return this.session.execute(sql`set transaction ${this.getTransactionConfigSQL(config)}`);
27225
27958
  }
27226
27959
  };
27227
- __publicField(PgTransaction, _a159, "PgTransaction");
27960
+ __publicField(PgTransaction, _a161, "PgTransaction");
27228
27961
  }
27229
27962
  });
27230
27963
 
@@ -27245,10 +27978,13 @@ function getTableConfig(table4) {
27245
27978
  const uniqueConstraints = [];
27246
27979
  const name2 = table4[Table.Symbol.Name];
27247
27980
  const schema4 = table4[Table.Symbol.Schema];
27981
+ const policies = [];
27982
+ const enableRLS = table4[PgTable.Symbol.EnableRLS];
27248
27983
  const extraConfigBuilder = table4[PgTable.Symbol.ExtraConfigBuilder];
27249
27984
  if (extraConfigBuilder !== void 0) {
27250
27985
  const extraConfig = extraConfigBuilder(table4[Table.Symbol.ExtraConfigColumns]);
27251
- for (const builder of Object.values(extraConfig)) {
27986
+ const extraValues = Array.isArray(extraConfig) ? extraConfig.flat(1) : Object.values(extraConfig);
27987
+ for (const builder of extraValues) {
27252
27988
  if (is(builder, IndexBuilder)) {
27253
27989
  indexes.push(builder.build(table4));
27254
27990
  } else if (is(builder, CheckBuilder)) {
@@ -27259,6 +27995,8 @@ function getTableConfig(table4) {
27259
27995
  primaryKeys.push(builder.build(table4));
27260
27996
  } else if (is(builder, ForeignKeyBuilder)) {
27261
27997
  foreignKeys.push(builder.build(table4));
27998
+ } else if (is(builder, PgPolicy)) {
27999
+ policies.push(builder);
27262
28000
  }
27263
28001
  }
27264
28002
  }
@@ -27270,7 +28008,9 @@ function getTableConfig(table4) {
27270
28008
  primaryKeys,
27271
28009
  uniqueConstraints,
27272
28010
  name: name2,
27273
- schema: schema4
28011
+ schema: schema4,
28012
+ policies,
28013
+ enableRLS
27274
28014
  };
27275
28015
  }
27276
28016
  function getViewConfig(view4) {
@@ -27295,6 +28035,7 @@ var init_utils4 = __esm({
27295
28035
  init_checks();
27296
28036
  init_foreign_keys();
27297
28037
  init_indexes();
28038
+ init_policies();
27298
28039
  init_primary_keys();
27299
28040
  init_unique_constraint();
27300
28041
  init_view_common2();
@@ -27321,8 +28062,10 @@ var init_pg_core = __esm({
27321
28062
  init_dialect();
27322
28063
  init_foreign_keys();
27323
28064
  init_indexes();
28065
+ init_policies();
27324
28066
  init_primary_keys();
27325
28067
  init_query_builders();
28068
+ init_roles();
27326
28069
  init_schema();
27327
28070
  init_sequence();
27328
28071
  init_session();
@@ -27344,14 +28087,14 @@ function maxRangeForIdentityBasedOn(columnType) {
27344
28087
  return columnType === "integer" ? "2147483647" : columnType === "bigint" ? "9223372036854775807" : "32767";
27345
28088
  }
27346
28089
  function minRangeForIdentityBasedOn(columnType) {
27347
- return columnType === "integer" ? "-2147483648" : columnType === "bitint" ? "-9223372036854775808" : "-32768";
28090
+ return columnType === "integer" ? "-2147483648" : columnType === "bigint" ? "-9223372036854775808" : "-32768";
27348
28091
  }
27349
28092
  function stringFromDatabaseIdentityProperty(field) {
27350
28093
  return typeof field === "string" ? field : typeof field === "undefined" ? void 0 : typeof field === "bigint" ? field.toString() : String(field);
27351
28094
  }
27352
- function buildArrayString(array, sqlType) {
28095
+ function buildArrayString(array2, sqlType) {
27353
28096
  sqlType = sqlType.split("[")[0];
27354
- const values = array.map((value) => {
28097
+ const values = array2.map((value) => {
27355
28098
  if (typeof value === "number" || typeof value === "bigint") {
27356
28099
  return value.toString();
27357
28100
  } else if (typeof value === "boolean") {
@@ -27373,6 +28116,40 @@ function buildArrayString(array, sqlType) {
27373
28116
  }).join(",");
27374
28117
  return `{${values}}`;
27375
28118
  }
28119
+ function prepareRoles(entities) {
28120
+ let useRoles = false;
28121
+ const includeRoles = [];
28122
+ const excludeRoles = [];
28123
+ if (entities && entities.roles) {
28124
+ if (typeof entities.roles === "object") {
28125
+ if (entities.roles.provider) {
28126
+ if (entities.roles.provider === "supabase") {
28127
+ excludeRoles.push(...[
28128
+ "anon",
28129
+ "authenticator",
28130
+ "authenticated",
28131
+ "service_role",
28132
+ "supabase_auth_admin",
28133
+ "supabase_storage_admin",
28134
+ "dashboard_user",
28135
+ "supabase_admin"
28136
+ ]);
28137
+ } else if (entities.roles.provider === "neon") {
28138
+ excludeRoles.push(...["authenticated", "anonymous"]);
28139
+ }
28140
+ }
28141
+ if (entities.roles.include) {
28142
+ includeRoles.push(...entities.roles.include);
28143
+ }
28144
+ if (entities.roles.exclude) {
28145
+ excludeRoles.push(...entities.roles.exclude);
28146
+ }
28147
+ } else {
28148
+ useRoles = entities.roles;
28149
+ }
28150
+ }
28151
+ return { useRoles, includeRoles, excludeRoles };
28152
+ }
27376
28153
  var indexName, generatePgSnapshot, trimChar, fromDatabase, defaultForColumn, getColumnsInfoQuery;
27377
28154
  var init_pgSerializer = __esm({
27378
28155
  "src/serializer/pgSerializer.ts"() {
@@ -27388,15 +28165,27 @@ var init_pgSerializer = __esm({
27388
28165
  indexName = (tableName, columns) => {
27389
28166
  return `${tableName}_${columns.join("_")}_index`;
27390
28167
  };
27391
- generatePgSnapshot = (tables, enums, schemas, sequences, views, matViews, casing2, schemaFilter) => {
28168
+ generatePgSnapshot = (tables, enums, schemas, sequences, roles, views, matViews, casing2, schemaFilter) => {
27392
28169
  const dialect4 = new PgDialect({ casing: casing2 });
27393
28170
  const result = {};
27394
28171
  const resultViews = {};
27395
28172
  const sequencesToReturn = {};
28173
+ const rolesToReturn = {};
27396
28174
  const indexesInSchema = {};
27397
28175
  for (const table4 of tables) {
27398
28176
  const checksInTable = {};
27399
- const { name: tableName, columns, indexes, foreignKeys, checks, schema: schema4, primaryKeys, uniqueConstraints } = getTableConfig(table4);
28177
+ const {
28178
+ name: tableName,
28179
+ columns,
28180
+ indexes,
28181
+ foreignKeys,
28182
+ checks,
28183
+ schema: schema4,
28184
+ primaryKeys,
28185
+ uniqueConstraints,
28186
+ policies,
28187
+ enableRLS
28188
+ } = getTableConfig(table4);
27400
28189
  if (schemaFilter && !schemaFilter.includes(schema4 ?? "public")) {
27401
28190
  continue;
27402
28191
  }
@@ -27406,6 +28195,7 @@ var init_pgSerializer = __esm({
27406
28195
  const foreignKeysObject = {};
27407
28196
  const primaryKeysObject = {};
27408
28197
  const uniqueConstraintObject = {};
28198
+ const policiesObject = {};
27409
28199
  columns.forEach((column4) => {
27410
28200
  const name2 = getColumnCasing(column4, casing2);
27411
28201
  const notNull = column4.notNull;
@@ -27653,6 +28443,34 @@ ${withStyle.errorWarning(
27653
28443
  with: value.config.with ?? {}
27654
28444
  };
27655
28445
  });
28446
+ policies.forEach((policy2) => {
28447
+ const mappedTo = [];
28448
+ if (!policy2.to) {
28449
+ mappedTo.push("public");
28450
+ } else {
28451
+ if (policy2.to && typeof policy2.to === "string") {
28452
+ mappedTo.push(policy2.to);
28453
+ } else if (policy2.to && is(policy2.to, PgRole)) {
28454
+ mappedTo.push(policy2.to.name);
28455
+ } else if (policy2.to && Array.isArray(policy2.to)) {
28456
+ policy2.to.forEach((it) => {
28457
+ if (typeof it === "string") {
28458
+ mappedTo.push(it);
28459
+ } else if (is(it, PgRole)) {
28460
+ mappedTo.push(it.name);
28461
+ }
28462
+ });
28463
+ }
28464
+ }
28465
+ policiesObject[policy2.name] = {
28466
+ name: policy2.name,
28467
+ as: policy2.as?.toUpperCase() ?? "PERMISSIVE",
28468
+ for: policy2.for?.toUpperCase() ?? "ALL",
28469
+ to: mappedTo.sort(),
28470
+ using: is(policy2.using, SQL) ? dialect4.sqlToQuery(policy2.using).sql : void 0,
28471
+ withCheck: is(policy2.withCheck, SQL) ? dialect4.sqlToQuery(policy2.withCheck).sql : void 0
28472
+ };
28473
+ });
27656
28474
  checks.forEach((check) => {
27657
28475
  const checkName = check.name;
27658
28476
  if (typeof checksInTable[`"${schema4 ?? "public"}"."${tableName}"`] !== "undefined") {
@@ -27689,7 +28507,9 @@ ${withStyle.errorWarning(
27689
28507
  foreignKeys: foreignKeysObject,
27690
28508
  compositePrimaryKeys: primaryKeysObject,
27691
28509
  uniqueConstraints: uniqueConstraintObject,
27692
- checkConstraints: checksObject
28510
+ policies: policiesObject,
28511
+ checkConstraints: checksObject,
28512
+ isRLSEnabled: enableRLS
27693
28513
  };
27694
28514
  }
27695
28515
  for (const sequence of sequences) {
@@ -27713,6 +28533,16 @@ ${withStyle.errorWarning(
27713
28533
  } else {
27714
28534
  }
27715
28535
  }
28536
+ for (const role of roles) {
28537
+ if (!role._existing) {
28538
+ rolesToReturn[role.name] = {
28539
+ name: role.name,
28540
+ createDb: role.createDb === void 0 ? false : role.createDb,
28541
+ createRole: role.createRole === void 0 ? false : role.createRole,
28542
+ inherit: role.inherit === void 0 ? true : role.inherit
28543
+ };
28544
+ }
28545
+ }
27716
28546
  const combinedViews = [...views, ...matViews];
27717
28547
  for (const view4 of combinedViews) {
27718
28548
  let viewName;
@@ -27869,6 +28699,7 @@ ${withStyle.errorWarning(
27869
28699
  enums: enumsToReturn,
27870
28700
  schemas: schemasObject,
27871
28701
  sequences: sequencesToReturn,
28702
+ roles: rolesToReturn,
27872
28703
  views: resultViews,
27873
28704
  _meta: {
27874
28705
  schemas: {},
@@ -27884,7 +28715,7 @@ ${withStyle.errorWarning(
27884
28715
  while (end > start && str[end - 1] === char3) --end;
27885
28716
  return start > 0 || end < str.length ? str.substring(start, end) : str.toString();
27886
28717
  };
27887
- fromDatabase = async (db, tablesFilter = () => true, schemaFilters, progressCallback) => {
28718
+ fromDatabase = async (db, tablesFilter = () => true, schemaFilters, entities, progressCallback) => {
27888
28719
  const result = {};
27889
28720
  const views = {};
27890
28721
  const internals = { tables: {} };
@@ -27897,7 +28728,8 @@ ${withStyle.errorWarning(
27897
28728
  WHEN c.relkind = 'r' THEN 'table'
27898
28729
  WHEN c.relkind = 'v' THEN 'view'
27899
28730
  WHEN c.relkind = 'm' THEN 'materialized_view'
27900
- END AS type
28731
+ END AS type,
28732
+ c.relrowsecurity AS rls_enabled
27901
28733
  FROM
27902
28734
  pg_catalog.pg_class c
27903
28735
  JOIN
@@ -27983,6 +28815,60 @@ WHERE
27983
28815
  if (progressCallback) {
27984
28816
  progressCallback("enums", Object.keys(enumsToReturn).length, "done");
27985
28817
  }
28818
+ const allRoles = await db.query(
28819
+ `SELECT rolname, rolinherit, rolcreatedb, rolcreaterole FROM pg_roles;`
28820
+ );
28821
+ const rolesToReturn = {};
28822
+ const preparedRoles = prepareRoles(entities);
28823
+ if (preparedRoles.useRoles || !(preparedRoles.includeRoles.length === 0 && preparedRoles.excludeRoles.length === 0)) {
28824
+ for (const dbRole of allRoles) {
28825
+ if (preparedRoles.useRoles) {
28826
+ rolesToReturn[dbRole.rolname] = {
28827
+ createDb: dbRole.rolcreatedb,
28828
+ createRole: dbRole.rolcreatedb,
28829
+ inherit: dbRole.rolinherit,
28830
+ name: dbRole.rolname
28831
+ };
28832
+ } else {
28833
+ if (preparedRoles.includeRoles.length === 0 && preparedRoles.excludeRoles.length === 0) continue;
28834
+ if (preparedRoles.includeRoles.includes(dbRole.rolname) && preparedRoles.excludeRoles.includes(dbRole.rolname)) continue;
28835
+ if (preparedRoles.excludeRoles.includes(dbRole.rolname)) continue;
28836
+ if (!preparedRoles.includeRoles.includes(dbRole.rolname)) continue;
28837
+ rolesToReturn[dbRole.rolname] = {
28838
+ createDb: dbRole.rolcreatedb,
28839
+ createRole: dbRole.rolcreaterole,
28840
+ inherit: dbRole.rolinherit,
28841
+ name: dbRole.rolname
28842
+ };
28843
+ }
28844
+ }
28845
+ }
28846
+ const wherePolicies = schemaFilters.map((t) => `schemaname = '${t}'`).join(" or ");
28847
+ const policiesByTable = {};
28848
+ 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}`};`);
28849
+ for (const dbPolicy of allPolicies) {
28850
+ const { tablename, schemaname, to, withCheck, using, ...rest } = dbPolicy;
28851
+ const tableForPolicy = policiesByTable[`${schemaname}.${tablename}`];
28852
+ const parsedTo = to;
28853
+ const parsedWithCheck = withCheck === null ? void 0 : withCheck;
28854
+ const parsedUsing = using === null ? void 0 : using;
28855
+ if (tableForPolicy) {
28856
+ tableForPolicy[dbPolicy.name] = { ...rest, to: parsedTo };
28857
+ } else {
28858
+ policiesByTable[`${schemaname}.${tablename}`] = {
28859
+ [dbPolicy.name]: { ...rest, to: parsedTo, withCheck: parsedWithCheck, using: parsedUsing }
28860
+ };
28861
+ }
28862
+ }
28863
+ if (progressCallback) {
28864
+ progressCallback(
28865
+ "policies",
28866
+ Object.values(policiesByTable).reduce((total, innerRecord) => {
28867
+ return total + Object.keys(innerRecord).length;
28868
+ }, 0),
28869
+ "done"
28870
+ );
28871
+ }
27986
28872
  const sequencesInColumns = [];
27987
28873
  const all = allTables.filter((it) => it.type === "table").map((row) => {
27988
28874
  return new Promise(async (res, rej) => {
@@ -28344,7 +29230,7 @@ WHERE
28344
29230
  }
28345
29231
  ],
28346
29232
  isUnique: indexIsUnique,
28347
- // should not be a part of diff detecs
29233
+ // should not be a part of diff detects
28348
29234
  concurrently: false,
28349
29235
  method: indexMethod,
28350
29236
  where: indexWhere === null ? void 0 : indexWhere,
@@ -28364,7 +29250,9 @@ WHERE
28364
29250
  foreignKeys: foreignKeysToReturn,
28365
29251
  compositePrimaryKeys: primaryKeys,
28366
29252
  uniqueConstraints: uniqueConstrains,
28367
- checkConstraints
29253
+ checkConstraints,
29254
+ policies: policiesByTable[`${tableSchema}.${tableName}`] ?? {},
29255
+ isRLSEnabled: row.rls_enabled
28368
29256
  };
28369
29257
  } catch (e) {
28370
29258
  rej(e);
@@ -28562,6 +29450,7 @@ WHERE
28562
29450
  enums: enumsToReturn,
28563
29451
  schemas: schemasObject,
28564
29452
  sequences: sequencesToReturn,
29453
+ roles: rolesToReturn,
28565
29454
  views,
28566
29455
  _meta: {
28567
29456
  schemas: {},
@@ -28756,12 +29645,12 @@ var init_alias3 = __esm({
28756
29645
  });
28757
29646
 
28758
29647
  // ../drizzle-orm/dist/sqlite-core/checks.js
28759
- var _a160, CheckBuilder2, _a161, Check2;
29648
+ var _a162, CheckBuilder2, _a163, Check2;
28760
29649
  var init_checks2 = __esm({
28761
29650
  "../drizzle-orm/dist/sqlite-core/checks.js"() {
28762
29651
  "use strict";
28763
29652
  init_entity();
28764
- _a160 = entityKind;
29653
+ _a162 = entityKind;
28765
29654
  CheckBuilder2 = class {
28766
29655
  constructor(name2, value) {
28767
29656
  __publicField(this, "brand");
@@ -28772,8 +29661,8 @@ var init_checks2 = __esm({
28772
29661
  return new Check2(table4, this);
28773
29662
  }
28774
29663
  };
28775
- __publicField(CheckBuilder2, _a160, "SQLiteCheckBuilder");
28776
- _a161 = entityKind;
29664
+ __publicField(CheckBuilder2, _a162, "SQLiteCheckBuilder");
29665
+ _a163 = entityKind;
28777
29666
  Check2 = class {
28778
29667
  constructor(table4, builder) {
28779
29668
  __publicField(this, "name");
@@ -28783,18 +29672,18 @@ var init_checks2 = __esm({
28783
29672
  this.value = builder.value;
28784
29673
  }
28785
29674
  };
28786
- __publicField(Check2, _a161, "SQLiteCheck");
29675
+ __publicField(Check2, _a163, "SQLiteCheck");
28787
29676
  }
28788
29677
  });
28789
29678
 
28790
29679
  // ../drizzle-orm/dist/sqlite-core/foreign-keys.js
28791
- var _a162, ForeignKeyBuilder2, _a163, ForeignKey2;
29680
+ var _a164, ForeignKeyBuilder2, _a165, ForeignKey2;
28792
29681
  var init_foreign_keys2 = __esm({
28793
29682
  "../drizzle-orm/dist/sqlite-core/foreign-keys.js"() {
28794
29683
  "use strict";
28795
29684
  init_entity();
28796
29685
  init_table_utils();
28797
- _a162 = entityKind;
29686
+ _a164 = entityKind;
28798
29687
  ForeignKeyBuilder2 = class {
28799
29688
  constructor(config, actions) {
28800
29689
  /** @internal */
@@ -28825,8 +29714,8 @@ var init_foreign_keys2 = __esm({
28825
29714
  return new ForeignKey2(table4, this);
28826
29715
  }
28827
29716
  };
28828
- __publicField(ForeignKeyBuilder2, _a162, "SQLiteForeignKeyBuilder");
28829
- _a163 = entityKind;
29717
+ __publicField(ForeignKeyBuilder2, _a164, "SQLiteForeignKeyBuilder");
29718
+ _a165 = entityKind;
28830
29719
  ForeignKey2 = class {
28831
29720
  constructor(table4, builder) {
28832
29721
  __publicField(this, "reference");
@@ -28850,7 +29739,7 @@ var init_foreign_keys2 = __esm({
28850
29739
  return name2 ?? `${chunks.join("_")}_fk`;
28851
29740
  }
28852
29741
  };
28853
- __publicField(ForeignKey2, _a163, "SQLiteForeignKey");
29742
+ __publicField(ForeignKey2, _a165, "SQLiteForeignKey");
28854
29743
  }
28855
29744
  });
28856
29745
 
@@ -28858,13 +29747,13 @@ var init_foreign_keys2 = __esm({
28858
29747
  function uniqueKeyName2(table4, columns) {
28859
29748
  return `${table4[TableName]}_${columns.join("_")}_unique`;
28860
29749
  }
28861
- var _a164, UniqueConstraintBuilder2, _a165, UniqueOnConstraintBuilder2, _a166, UniqueConstraint2;
29750
+ var _a166, UniqueConstraintBuilder2, _a167, UniqueOnConstraintBuilder2, _a168, UniqueConstraint2;
28862
29751
  var init_unique_constraint2 = __esm({
28863
29752
  "../drizzle-orm/dist/sqlite-core/unique-constraint.js"() {
28864
29753
  "use strict";
28865
29754
  init_entity();
28866
29755
  init_table_utils();
28867
- _a164 = entityKind;
29756
+ _a166 = entityKind;
28868
29757
  UniqueConstraintBuilder2 = class {
28869
29758
  constructor(columns, name2) {
28870
29759
  /** @internal */
@@ -28877,8 +29766,8 @@ var init_unique_constraint2 = __esm({
28877
29766
  return new UniqueConstraint2(table4, this.columns, this.name);
28878
29767
  }
28879
29768
  };
28880
- __publicField(UniqueConstraintBuilder2, _a164, "SQLiteUniqueConstraintBuilder");
28881
- _a165 = entityKind;
29769
+ __publicField(UniqueConstraintBuilder2, _a166, "SQLiteUniqueConstraintBuilder");
29770
+ _a167 = entityKind;
28882
29771
  UniqueOnConstraintBuilder2 = class {
28883
29772
  constructor(name2) {
28884
29773
  /** @internal */
@@ -28889,8 +29778,8 @@ var init_unique_constraint2 = __esm({
28889
29778
  return new UniqueConstraintBuilder2(columns, this.name);
28890
29779
  }
28891
29780
  };
28892
- __publicField(UniqueOnConstraintBuilder2, _a165, "SQLiteUniqueOnConstraintBuilder");
28893
- _a166 = entityKind;
29781
+ __publicField(UniqueOnConstraintBuilder2, _a167, "SQLiteUniqueOnConstraintBuilder");
29782
+ _a168 = entityKind;
28894
29783
  UniqueConstraint2 = class {
28895
29784
  constructor(table4, columns, name2) {
28896
29785
  __publicField(this, "columns");
@@ -28903,12 +29792,12 @@ var init_unique_constraint2 = __esm({
28903
29792
  return this.name;
28904
29793
  }
28905
29794
  };
28906
- __publicField(UniqueConstraint2, _a166, "SQLiteUniqueConstraint");
29795
+ __publicField(UniqueConstraint2, _a168, "SQLiteUniqueConstraint");
28907
29796
  }
28908
29797
  });
28909
29798
 
28910
29799
  // ../drizzle-orm/dist/sqlite-core/columns/common.js
28911
- var _a167, _b114, SQLiteColumnBuilder, _a168, _b115, SQLiteColumn;
29800
+ var _a169, _b114, SQLiteColumnBuilder, _a170, _b115, SQLiteColumn;
28912
29801
  var init_common3 = __esm({
28913
29802
  "../drizzle-orm/dist/sqlite-core/columns/common.js"() {
28914
29803
  "use strict";
@@ -28917,7 +29806,7 @@ var init_common3 = __esm({
28917
29806
  init_entity();
28918
29807
  init_foreign_keys2();
28919
29808
  init_unique_constraint2();
28920
- SQLiteColumnBuilder = class extends (_b114 = ColumnBuilder, _a167 = entityKind, _b114) {
29809
+ SQLiteColumnBuilder = class extends (_b114 = ColumnBuilder, _a169 = entityKind, _b114) {
28921
29810
  constructor() {
28922
29811
  super(...arguments);
28923
29812
  __publicField(this, "foreignKeyConfigs", []);
@@ -28958,8 +29847,8 @@ var init_common3 = __esm({
28958
29847
  });
28959
29848
  }
28960
29849
  };
28961
- __publicField(SQLiteColumnBuilder, _a167, "SQLiteColumnBuilder");
28962
- SQLiteColumn = class extends (_b115 = Column2, _a168 = entityKind, _b115) {
29850
+ __publicField(SQLiteColumnBuilder, _a169, "SQLiteColumnBuilder");
29851
+ SQLiteColumn = class extends (_b115 = Column2, _a170 = entityKind, _b115) {
28963
29852
  constructor(table4, config) {
28964
29853
  if (!config.uniqueName) {
28965
29854
  config.uniqueName = uniqueKeyName2(table4, [config.name]);
@@ -28968,7 +29857,7 @@ var init_common3 = __esm({
28968
29857
  this.table = table4;
28969
29858
  }
28970
29859
  };
28971
- __publicField(SQLiteColumn, _a168, "SQLiteColumn");
29860
+ __publicField(SQLiteColumn, _a170, "SQLiteColumn");
28972
29861
  }
28973
29862
  });
28974
29863
 
@@ -28983,14 +29872,14 @@ function blob(a, b) {
28983
29872
  }
28984
29873
  return new SQLiteBlobBufferBuilder(name2);
28985
29874
  }
28986
- var _a169, _b116, SQLiteBigIntBuilder, _a170, _b117, SQLiteBigInt, _a171, _b118, SQLiteBlobJsonBuilder, _a172, _b119, SQLiteBlobJson, _a173, _b120, SQLiteBlobBufferBuilder, _a174, _b121, SQLiteBlobBuffer;
29875
+ var _a171, _b116, SQLiteBigIntBuilder, _a172, _b117, SQLiteBigInt, _a173, _b118, SQLiteBlobJsonBuilder, _a174, _b119, SQLiteBlobJson, _a175, _b120, SQLiteBlobBufferBuilder, _a176, _b121, SQLiteBlobBuffer;
28987
29876
  var init_blob = __esm({
28988
29877
  "../drizzle-orm/dist/sqlite-core/columns/blob.js"() {
28989
29878
  "use strict";
28990
29879
  init_entity();
28991
29880
  init_utils2();
28992
29881
  init_common3();
28993
- SQLiteBigIntBuilder = class extends (_b116 = SQLiteColumnBuilder, _a169 = entityKind, _b116) {
29882
+ SQLiteBigIntBuilder = class extends (_b116 = SQLiteColumnBuilder, _a171 = entityKind, _b116) {
28994
29883
  constructor(name2) {
28995
29884
  super(name2, "bigint", "SQLiteBigInt");
28996
29885
  }
@@ -28999,8 +29888,8 @@ var init_blob = __esm({
28999
29888
  return new SQLiteBigInt(table4, this.config);
29000
29889
  }
29001
29890
  };
29002
- __publicField(SQLiteBigIntBuilder, _a169, "SQLiteBigIntBuilder");
29003
- SQLiteBigInt = class extends (_b117 = SQLiteColumn, _a170 = entityKind, _b117) {
29891
+ __publicField(SQLiteBigIntBuilder, _a171, "SQLiteBigIntBuilder");
29892
+ SQLiteBigInt = class extends (_b117 = SQLiteColumn, _a172 = entityKind, _b117) {
29004
29893
  getSQLType() {
29005
29894
  return "blob";
29006
29895
  }
@@ -29011,8 +29900,8 @@ var init_blob = __esm({
29011
29900
  return Buffer.from(value.toString());
29012
29901
  }
29013
29902
  };
29014
- __publicField(SQLiteBigInt, _a170, "SQLiteBigInt");
29015
- SQLiteBlobJsonBuilder = class extends (_b118 = SQLiteColumnBuilder, _a171 = entityKind, _b118) {
29903
+ __publicField(SQLiteBigInt, _a172, "SQLiteBigInt");
29904
+ SQLiteBlobJsonBuilder = class extends (_b118 = SQLiteColumnBuilder, _a173 = entityKind, _b118) {
29016
29905
  constructor(name2) {
29017
29906
  super(name2, "json", "SQLiteBlobJson");
29018
29907
  }
@@ -29024,8 +29913,8 @@ var init_blob = __esm({
29024
29913
  );
29025
29914
  }
29026
29915
  };
29027
- __publicField(SQLiteBlobJsonBuilder, _a171, "SQLiteBlobJsonBuilder");
29028
- SQLiteBlobJson = class extends (_b119 = SQLiteColumn, _a172 = entityKind, _b119) {
29916
+ __publicField(SQLiteBlobJsonBuilder, _a173, "SQLiteBlobJsonBuilder");
29917
+ SQLiteBlobJson = class extends (_b119 = SQLiteColumn, _a174 = entityKind, _b119) {
29029
29918
  getSQLType() {
29030
29919
  return "blob";
29031
29920
  }
@@ -29036,8 +29925,8 @@ var init_blob = __esm({
29036
29925
  return Buffer.from(JSON.stringify(value));
29037
29926
  }
29038
29927
  };
29039
- __publicField(SQLiteBlobJson, _a172, "SQLiteBlobJson");
29040
- SQLiteBlobBufferBuilder = class extends (_b120 = SQLiteColumnBuilder, _a173 = entityKind, _b120) {
29928
+ __publicField(SQLiteBlobJson, _a174, "SQLiteBlobJson");
29929
+ SQLiteBlobBufferBuilder = class extends (_b120 = SQLiteColumnBuilder, _a175 = entityKind, _b120) {
29041
29930
  constructor(name2) {
29042
29931
  super(name2, "buffer", "SQLiteBlobBuffer");
29043
29932
  }
@@ -29046,13 +29935,13 @@ var init_blob = __esm({
29046
29935
  return new SQLiteBlobBuffer(table4, this.config);
29047
29936
  }
29048
29937
  };
29049
- __publicField(SQLiteBlobBufferBuilder, _a173, "SQLiteBlobBufferBuilder");
29050
- SQLiteBlobBuffer = class extends (_b121 = SQLiteColumn, _a174 = entityKind, _b121) {
29938
+ __publicField(SQLiteBlobBufferBuilder, _a175, "SQLiteBlobBufferBuilder");
29939
+ SQLiteBlobBuffer = class extends (_b121 = SQLiteColumn, _a176 = entityKind, _b121) {
29051
29940
  getSQLType() {
29052
29941
  return "blob";
29053
29942
  }
29054
29943
  };
29055
- __publicField(SQLiteBlobBuffer, _a174, "SQLiteBlobBuffer");
29944
+ __publicField(SQLiteBlobBuffer, _a176, "SQLiteBlobBuffer");
29056
29945
  }
29057
29946
  });
29058
29947
 
@@ -29067,14 +29956,14 @@ function customType2(customTypeParams) {
29067
29956
  );
29068
29957
  };
29069
29958
  }
29070
- var _a175, _b122, SQLiteCustomColumnBuilder, _a176, _b123, SQLiteCustomColumn;
29959
+ var _a177, _b122, SQLiteCustomColumnBuilder, _a178, _b123, SQLiteCustomColumn;
29071
29960
  var init_custom2 = __esm({
29072
29961
  "../drizzle-orm/dist/sqlite-core/columns/custom.js"() {
29073
29962
  "use strict";
29074
29963
  init_entity();
29075
29964
  init_utils2();
29076
29965
  init_common3();
29077
- SQLiteCustomColumnBuilder = class extends (_b122 = SQLiteColumnBuilder, _a175 = entityKind, _b122) {
29966
+ SQLiteCustomColumnBuilder = class extends (_b122 = SQLiteColumnBuilder, _a177 = entityKind, _b122) {
29078
29967
  constructor(name2, fieldConfig, customTypeParams) {
29079
29968
  super(name2, "custom", "SQLiteCustomColumn");
29080
29969
  this.config.fieldConfig = fieldConfig;
@@ -29088,8 +29977,8 @@ var init_custom2 = __esm({
29088
29977
  );
29089
29978
  }
29090
29979
  };
29091
- __publicField(SQLiteCustomColumnBuilder, _a175, "SQLiteCustomColumnBuilder");
29092
- SQLiteCustomColumn = class extends (_b123 = SQLiteColumn, _a176 = entityKind, _b123) {
29980
+ __publicField(SQLiteCustomColumnBuilder, _a177, "SQLiteCustomColumnBuilder");
29981
+ SQLiteCustomColumn = class extends (_b123 = SQLiteColumn, _a178 = entityKind, _b123) {
29093
29982
  constructor(table4, config) {
29094
29983
  super(table4, config);
29095
29984
  __publicField(this, "sqlName");
@@ -29109,7 +29998,7 @@ var init_custom2 = __esm({
29109
29998
  return typeof this.mapTo === "function" ? this.mapTo(value) : value;
29110
29999
  }
29111
30000
  };
29112
- __publicField(SQLiteCustomColumn, _a176, "SQLiteCustomColumn");
30001
+ __publicField(SQLiteCustomColumn, _a178, "SQLiteCustomColumn");
29113
30002
  }
29114
30003
  });
29115
30004
 
@@ -29124,7 +30013,7 @@ function integer2(a, b) {
29124
30013
  }
29125
30014
  return new SQLiteIntegerBuilder(name2);
29126
30015
  }
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;
30016
+ 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
30017
  var init_integer2 = __esm({
29129
30018
  "../drizzle-orm/dist/sqlite-core/columns/integer.js"() {
29130
30019
  "use strict";
@@ -29132,7 +30021,7 @@ var init_integer2 = __esm({
29132
30021
  init_sql();
29133
30022
  init_utils2();
29134
30023
  init_common3();
29135
- SQLiteBaseIntegerBuilder = class extends (_b124 = SQLiteColumnBuilder, _a177 = entityKind, _b124) {
30024
+ SQLiteBaseIntegerBuilder = class extends (_b124 = SQLiteColumnBuilder, _a179 = entityKind, _b124) {
29136
30025
  constructor(name2, dataType, columnType) {
29137
30026
  super(name2, dataType, columnType);
29138
30027
  this.config.autoIncrement = false;
@@ -29145,8 +30034,8 @@ var init_integer2 = __esm({
29145
30034
  return super.primaryKey();
29146
30035
  }
29147
30036
  };
29148
- __publicField(SQLiteBaseIntegerBuilder, _a177, "SQLiteBaseIntegerBuilder");
29149
- SQLiteBaseInteger = class extends (_b125 = SQLiteColumn, _a178 = entityKind, _b125) {
30037
+ __publicField(SQLiteBaseIntegerBuilder, _a179, "SQLiteBaseIntegerBuilder");
30038
+ SQLiteBaseInteger = class extends (_b125 = SQLiteColumn, _a180 = entityKind, _b125) {
29150
30039
  constructor() {
29151
30040
  super(...arguments);
29152
30041
  __publicField(this, "autoIncrement", this.config.autoIncrement);
@@ -29155,8 +30044,8 @@ var init_integer2 = __esm({
29155
30044
  return "integer";
29156
30045
  }
29157
30046
  };
29158
- __publicField(SQLiteBaseInteger, _a178, "SQLiteBaseInteger");
29159
- SQLiteIntegerBuilder = class extends (_b126 = SQLiteBaseIntegerBuilder, _a179 = entityKind, _b126) {
30047
+ __publicField(SQLiteBaseInteger, _a180, "SQLiteBaseInteger");
30048
+ SQLiteIntegerBuilder = class extends (_b126 = SQLiteBaseIntegerBuilder, _a181 = entityKind, _b126) {
29160
30049
  constructor(name2) {
29161
30050
  super(name2, "number", "SQLiteInteger");
29162
30051
  }
@@ -29167,11 +30056,11 @@ var init_integer2 = __esm({
29167
30056
  );
29168
30057
  }
29169
30058
  };
29170
- __publicField(SQLiteIntegerBuilder, _a179, "SQLiteIntegerBuilder");
29171
- SQLiteInteger = class extends (_b127 = SQLiteBaseInteger, _a180 = entityKind, _b127) {
30059
+ __publicField(SQLiteIntegerBuilder, _a181, "SQLiteIntegerBuilder");
30060
+ SQLiteInteger = class extends (_b127 = SQLiteBaseInteger, _a182 = entityKind, _b127) {
29172
30061
  };
29173
- __publicField(SQLiteInteger, _a180, "SQLiteInteger");
29174
- SQLiteTimestampBuilder = class extends (_b128 = SQLiteBaseIntegerBuilder, _a181 = entityKind, _b128) {
30062
+ __publicField(SQLiteInteger, _a182, "SQLiteInteger");
30063
+ SQLiteTimestampBuilder = class extends (_b128 = SQLiteBaseIntegerBuilder, _a183 = entityKind, _b128) {
29175
30064
  constructor(name2, mode) {
29176
30065
  super(name2, "date", "SQLiteTimestamp");
29177
30066
  this.config.mode = mode;
@@ -29191,8 +30080,8 @@ var init_integer2 = __esm({
29191
30080
  );
29192
30081
  }
29193
30082
  };
29194
- __publicField(SQLiteTimestampBuilder, _a181, "SQLiteTimestampBuilder");
29195
- SQLiteTimestamp = class extends (_b129 = SQLiteBaseInteger, _a182 = entityKind, _b129) {
30083
+ __publicField(SQLiteTimestampBuilder, _a183, "SQLiteTimestampBuilder");
30084
+ SQLiteTimestamp = class extends (_b129 = SQLiteBaseInteger, _a184 = entityKind, _b129) {
29196
30085
  constructor() {
29197
30086
  super(...arguments);
29198
30087
  __publicField(this, "mode", this.config.mode);
@@ -29211,8 +30100,8 @@ var init_integer2 = __esm({
29211
30100
  return unix;
29212
30101
  }
29213
30102
  };
29214
- __publicField(SQLiteTimestamp, _a182, "SQLiteTimestamp");
29215
- SQLiteBooleanBuilder = class extends (_b130 = SQLiteBaseIntegerBuilder, _a183 = entityKind, _b130) {
30103
+ __publicField(SQLiteTimestamp, _a184, "SQLiteTimestamp");
30104
+ SQLiteBooleanBuilder = class extends (_b130 = SQLiteBaseIntegerBuilder, _a185 = entityKind, _b130) {
29216
30105
  constructor(name2, mode) {
29217
30106
  super(name2, "boolean", "SQLiteBoolean");
29218
30107
  this.config.mode = mode;
@@ -29224,8 +30113,8 @@ var init_integer2 = __esm({
29224
30113
  );
29225
30114
  }
29226
30115
  };
29227
- __publicField(SQLiteBooleanBuilder, _a183, "SQLiteBooleanBuilder");
29228
- SQLiteBoolean = class extends (_b131 = SQLiteBaseInteger, _a184 = entityKind, _b131) {
30116
+ __publicField(SQLiteBooleanBuilder, _a185, "SQLiteBooleanBuilder");
30117
+ SQLiteBoolean = class extends (_b131 = SQLiteBaseInteger, _a186 = entityKind, _b131) {
29229
30118
  constructor() {
29230
30119
  super(...arguments);
29231
30120
  __publicField(this, "mode", this.config.mode);
@@ -29237,7 +30126,7 @@ var init_integer2 = __esm({
29237
30126
  return value ? 1 : 0;
29238
30127
  }
29239
30128
  };
29240
- __publicField(SQLiteBoolean, _a184, "SQLiteBoolean");
30129
+ __publicField(SQLiteBoolean, _a186, "SQLiteBoolean");
29241
30130
  }
29242
30131
  });
29243
30132
 
@@ -29245,13 +30134,13 @@ var init_integer2 = __esm({
29245
30134
  function numeric2(name2) {
29246
30135
  return new SQLiteNumericBuilder(name2 ?? "");
29247
30136
  }
29248
- var _a185, _b132, SQLiteNumericBuilder, _a186, _b133, SQLiteNumeric;
30137
+ var _a187, _b132, SQLiteNumericBuilder, _a188, _b133, SQLiteNumeric;
29249
30138
  var init_numeric2 = __esm({
29250
30139
  "../drizzle-orm/dist/sqlite-core/columns/numeric.js"() {
29251
30140
  "use strict";
29252
30141
  init_entity();
29253
30142
  init_common3();
29254
- SQLiteNumericBuilder = class extends (_b132 = SQLiteColumnBuilder, _a185 = entityKind, _b132) {
30143
+ SQLiteNumericBuilder = class extends (_b132 = SQLiteColumnBuilder, _a187 = entityKind, _b132) {
29255
30144
  constructor(name2) {
29256
30145
  super(name2, "string", "SQLiteNumeric");
29257
30146
  }
@@ -29263,13 +30152,13 @@ var init_numeric2 = __esm({
29263
30152
  );
29264
30153
  }
29265
30154
  };
29266
- __publicField(SQLiteNumericBuilder, _a185, "SQLiteNumericBuilder");
29267
- SQLiteNumeric = class extends (_b133 = SQLiteColumn, _a186 = entityKind, _b133) {
30155
+ __publicField(SQLiteNumericBuilder, _a187, "SQLiteNumericBuilder");
30156
+ SQLiteNumeric = class extends (_b133 = SQLiteColumn, _a188 = entityKind, _b133) {
29268
30157
  getSQLType() {
29269
30158
  return "numeric";
29270
30159
  }
29271
30160
  };
29272
- __publicField(SQLiteNumeric, _a186, "SQLiteNumeric");
30161
+ __publicField(SQLiteNumeric, _a188, "SQLiteNumeric");
29273
30162
  }
29274
30163
  });
29275
30164
 
@@ -29277,13 +30166,13 @@ var init_numeric2 = __esm({
29277
30166
  function real2(name2) {
29278
30167
  return new SQLiteRealBuilder(name2 ?? "");
29279
30168
  }
29280
- var _a187, _b134, SQLiteRealBuilder, _a188, _b135, SQLiteReal;
30169
+ var _a189, _b134, SQLiteRealBuilder, _a190, _b135, SQLiteReal;
29281
30170
  var init_real2 = __esm({
29282
30171
  "../drizzle-orm/dist/sqlite-core/columns/real.js"() {
29283
30172
  "use strict";
29284
30173
  init_entity();
29285
30174
  init_common3();
29286
- SQLiteRealBuilder = class extends (_b134 = SQLiteColumnBuilder, _a187 = entityKind, _b134) {
30175
+ SQLiteRealBuilder = class extends (_b134 = SQLiteColumnBuilder, _a189 = entityKind, _b134) {
29287
30176
  constructor(name2) {
29288
30177
  super(name2, "number", "SQLiteReal");
29289
30178
  }
@@ -29292,13 +30181,13 @@ var init_real2 = __esm({
29292
30181
  return new SQLiteReal(table4, this.config);
29293
30182
  }
29294
30183
  };
29295
- __publicField(SQLiteRealBuilder, _a187, "SQLiteRealBuilder");
29296
- SQLiteReal = class extends (_b135 = SQLiteColumn, _a188 = entityKind, _b135) {
30184
+ __publicField(SQLiteRealBuilder, _a189, "SQLiteRealBuilder");
30185
+ SQLiteReal = class extends (_b135 = SQLiteColumn, _a190 = entityKind, _b135) {
29297
30186
  getSQLType() {
29298
30187
  return "real";
29299
30188
  }
29300
30189
  };
29301
- __publicField(SQLiteReal, _a188, "SQLiteReal");
30190
+ __publicField(SQLiteReal, _a190, "SQLiteReal");
29302
30191
  }
29303
30192
  });
29304
30193
 
@@ -29310,14 +30199,14 @@ function text2(a, b = {}) {
29310
30199
  }
29311
30200
  return new SQLiteTextBuilder(name2, config);
29312
30201
  }
29313
- var _a189, _b136, SQLiteTextBuilder, _a190, _b137, SQLiteText, _a191, _b138, SQLiteTextJsonBuilder, _a192, _b139, SQLiteTextJson;
30202
+ var _a191, _b136, SQLiteTextBuilder, _a192, _b137, SQLiteText, _a193, _b138, SQLiteTextJsonBuilder, _a194, _b139, SQLiteTextJson;
29314
30203
  var init_text2 = __esm({
29315
30204
  "../drizzle-orm/dist/sqlite-core/columns/text.js"() {
29316
30205
  "use strict";
29317
30206
  init_entity();
29318
30207
  init_utils2();
29319
30208
  init_common3();
29320
- SQLiteTextBuilder = class extends (_b136 = SQLiteColumnBuilder, _a189 = entityKind, _b136) {
30209
+ SQLiteTextBuilder = class extends (_b136 = SQLiteColumnBuilder, _a191 = entityKind, _b136) {
29321
30210
  constructor(name2, config) {
29322
30211
  super(name2, "string", "SQLiteText");
29323
30212
  this.config.enumValues = config.enum;
@@ -29328,8 +30217,8 @@ var init_text2 = __esm({
29328
30217
  return new SQLiteText(table4, this.config);
29329
30218
  }
29330
30219
  };
29331
- __publicField(SQLiteTextBuilder, _a189, "SQLiteTextBuilder");
29332
- SQLiteText = class extends (_b137 = SQLiteColumn, _a190 = entityKind, _b137) {
30220
+ __publicField(SQLiteTextBuilder, _a191, "SQLiteTextBuilder");
30221
+ SQLiteText = class extends (_b137 = SQLiteColumn, _a192 = entityKind, _b137) {
29333
30222
  constructor(table4, config) {
29334
30223
  super(table4, config);
29335
30224
  __publicField(this, "enumValues", this.config.enumValues);
@@ -29339,8 +30228,8 @@ var init_text2 = __esm({
29339
30228
  return `text${this.config.length ? `(${this.config.length})` : ""}`;
29340
30229
  }
29341
30230
  };
29342
- __publicField(SQLiteText, _a190, "SQLiteText");
29343
- SQLiteTextJsonBuilder = class extends (_b138 = SQLiteColumnBuilder, _a191 = entityKind, _b138) {
30231
+ __publicField(SQLiteText, _a192, "SQLiteText");
30232
+ SQLiteTextJsonBuilder = class extends (_b138 = SQLiteColumnBuilder, _a193 = entityKind, _b138) {
29344
30233
  constructor(name2) {
29345
30234
  super(name2, "json", "SQLiteTextJson");
29346
30235
  }
@@ -29352,8 +30241,8 @@ var init_text2 = __esm({
29352
30241
  );
29353
30242
  }
29354
30243
  };
29355
- __publicField(SQLiteTextJsonBuilder, _a191, "SQLiteTextJsonBuilder");
29356
- SQLiteTextJson = class extends (_b139 = SQLiteColumn, _a192 = entityKind, _b139) {
30244
+ __publicField(SQLiteTextJsonBuilder, _a193, "SQLiteTextJsonBuilder");
30245
+ SQLiteTextJson = class extends (_b139 = SQLiteColumn, _a194 = entityKind, _b139) {
29357
30246
  getSQLType() {
29358
30247
  return "text";
29359
30248
  }
@@ -29364,7 +30253,7 @@ var init_text2 = __esm({
29364
30253
  return JSON.stringify(value);
29365
30254
  }
29366
30255
  };
29367
- __publicField(SQLiteTextJson, _a192, "SQLiteTextJson");
30256
+ __publicField(SQLiteTextJson, _a194, "SQLiteTextJson");
29368
30257
  }
29369
30258
  });
29370
30259
 
@@ -29426,7 +30315,7 @@ function sqliteTableBase(name2, columns, extraConfig, schema4, baseName = name2)
29426
30315
  }
29427
30316
  return table4;
29428
30317
  }
29429
- var InlineForeignKeys2, _a193, _b140, _c6, _d3, _e2, SQLiteTable, sqliteTable;
30318
+ var InlineForeignKeys2, _a195, _b140, _c6, _d3, _e3, SQLiteTable, sqliteTable;
29430
30319
  var init_table3 = __esm({
29431
30320
  "../drizzle-orm/dist/sqlite-core/table.js"() {
29432
30321
  "use strict";
@@ -29434,7 +30323,7 @@ var init_table3 = __esm({
29434
30323
  init_table();
29435
30324
  init_all2();
29436
30325
  InlineForeignKeys2 = Symbol.for("drizzle:SQLiteInlineForeignKeys");
29437
- SQLiteTable = class extends (_e2 = Table, _d3 = entityKind, _c6 = Table.Symbol.Columns, _b140 = InlineForeignKeys2, _a193 = Table.Symbol.ExtraConfigBuilder, _e2) {
30326
+ SQLiteTable = class extends (_e3 = Table, _d3 = entityKind, _c6 = Table.Symbol.Columns, _b140 = InlineForeignKeys2, _a195 = Table.Symbol.ExtraConfigBuilder, _e3) {
29438
30327
  constructor() {
29439
30328
  super(...arguments);
29440
30329
  /** @internal */
@@ -29442,7 +30331,7 @@ var init_table3 = __esm({
29442
30331
  /** @internal */
29443
30332
  __publicField(this, _b140, []);
29444
30333
  /** @internal */
29445
- __publicField(this, _a193);
30334
+ __publicField(this, _a195);
29446
30335
  }
29447
30336
  };
29448
30337
  __publicField(SQLiteTable, _d3, "SQLiteTable");
@@ -29457,7 +30346,7 @@ var init_table3 = __esm({
29457
30346
  });
29458
30347
 
29459
30348
  // ../drizzle-orm/dist/sqlite-core/query-builders/delete.js
29460
- var _a194, _b141, SQLiteDeleteBase;
30349
+ var _a196, _b141, SQLiteDeleteBase;
29461
30350
  var init_delete2 = __esm({
29462
30351
  "../drizzle-orm/dist/sqlite-core/query-builders/delete.js"() {
29463
30352
  "use strict";
@@ -29467,7 +30356,7 @@ var init_delete2 = __esm({
29467
30356
  init_table3();
29468
30357
  init_table();
29469
30358
  init_utils2();
29470
- SQLiteDeleteBase = class extends (_b141 = QueryPromise, _a194 = entityKind, _b141) {
30359
+ SQLiteDeleteBase = class extends (_b141 = QueryPromise, _a196 = entityKind, _b141) {
29471
30360
  constructor(table4, session, dialect4, withList) {
29472
30361
  super();
29473
30362
  /** @internal */
@@ -29573,12 +30462,12 @@ var init_delete2 = __esm({
29573
30462
  return this;
29574
30463
  }
29575
30464
  };
29576
- __publicField(SQLiteDeleteBase, _a194, "SQLiteDelete");
30465
+ __publicField(SQLiteDeleteBase, _a196, "SQLiteDelete");
29577
30466
  }
29578
30467
  });
29579
30468
 
29580
30469
  // ../drizzle-orm/dist/sqlite-core/query-builders/insert.js
29581
- var _a195, SQLiteInsertBuilder, _a196, _b142, SQLiteInsertBase;
30470
+ var _a197, SQLiteInsertBuilder, _a198, _b142, SQLiteInsertBase;
29582
30471
  var init_insert2 = __esm({
29583
30472
  "../drizzle-orm/dist/sqlite-core/query-builders/insert.js"() {
29584
30473
  "use strict";
@@ -29588,7 +30477,7 @@ var init_insert2 = __esm({
29588
30477
  init_table3();
29589
30478
  init_table();
29590
30479
  init_utils2();
29591
- _a195 = entityKind;
30480
+ _a197 = entityKind;
29592
30481
  SQLiteInsertBuilder = class {
29593
30482
  constructor(table4, session, dialect4, withList) {
29594
30483
  this.table = table4;
@@ -29613,8 +30502,8 @@ var init_insert2 = __esm({
29613
30502
  return new SQLiteInsertBase(this.table, mappedValues, this.session, this.dialect, this.withList);
29614
30503
  }
29615
30504
  };
29616
- __publicField(SQLiteInsertBuilder, _a195, "SQLiteInsertBuilder");
29617
- SQLiteInsertBase = class extends (_b142 = QueryPromise, _a196 = entityKind, _b142) {
30505
+ __publicField(SQLiteInsertBuilder, _a197, "SQLiteInsertBuilder");
30506
+ SQLiteInsertBase = class extends (_b142 = QueryPromise, _a198 = entityKind, _b142) {
29618
30507
  constructor(table4, values, session, dialect4, withList) {
29619
30508
  super();
29620
30509
  /** @internal */
@@ -29741,25 +30630,25 @@ var init_insert2 = __esm({
29741
30630
  return this;
29742
30631
  }
29743
30632
  };
29744
- __publicField(SQLiteInsertBase, _a196, "SQLiteInsert");
30633
+ __publicField(SQLiteInsertBase, _a198, "SQLiteInsert");
29745
30634
  }
29746
30635
  });
29747
30636
 
29748
30637
  // ../drizzle-orm/dist/sqlite-core/view-base.js
29749
- var _a197, _b143, SQLiteViewBase;
30638
+ var _a199, _b143, SQLiteViewBase;
29750
30639
  var init_view_base2 = __esm({
29751
30640
  "../drizzle-orm/dist/sqlite-core/view-base.js"() {
29752
30641
  "use strict";
29753
30642
  init_entity();
29754
30643
  init_sql();
29755
- SQLiteViewBase = class extends (_b143 = View3, _a197 = entityKind, _b143) {
30644
+ SQLiteViewBase = class extends (_b143 = View3, _a199 = entityKind, _b143) {
29756
30645
  };
29757
- __publicField(SQLiteViewBase, _a197, "SQLiteViewBase");
30646
+ __publicField(SQLiteViewBase, _a199, "SQLiteViewBase");
29758
30647
  }
29759
30648
  });
29760
30649
 
29761
30650
  // ../drizzle-orm/dist/sqlite-core/dialect.js
29762
- var _a198, SQLiteDialect, _a199, _b144, SQLiteSyncDialect, _a200, _b145, SQLiteAsyncDialect;
30651
+ var _a200, SQLiteDialect, _a201, _b144, SQLiteSyncDialect, _a202, _b145, SQLiteAsyncDialect;
29763
30652
  var init_dialect2 = __esm({
29764
30653
  "../drizzle-orm/dist/sqlite-core/dialect.js"() {
29765
30654
  "use strict";
@@ -29778,7 +30667,7 @@ var init_dialect2 = __esm({
29778
30667
  init_utils2();
29779
30668
  init_view_common();
29780
30669
  init_view_base2();
29781
- _a198 = entityKind;
30670
+ _a200 = entityKind;
29782
30671
  SQLiteDialect = class {
29783
30672
  constructor(config) {
29784
30673
  /** @internal */
@@ -30300,8 +31189,8 @@ var init_dialect2 = __esm({
30300
31189
  };
30301
31190
  }
30302
31191
  };
30303
- __publicField(SQLiteDialect, _a198, "SQLiteDialect");
30304
- SQLiteSyncDialect = class extends (_b144 = SQLiteDialect, _a199 = entityKind, _b144) {
31192
+ __publicField(SQLiteDialect, _a200, "SQLiteDialect");
31193
+ SQLiteSyncDialect = class extends (_b144 = SQLiteDialect, _a201 = entityKind, _b144) {
30305
31194
  migrate(migrations, session, config) {
30306
31195
  const migrationsTable = config === void 0 ? "__drizzle_migrations" : typeof config === "string" ? "__drizzle_migrations" : config.migrationsTable ?? "__drizzle_migrations";
30307
31196
  const migrationTableCreate = sql`
@@ -30335,8 +31224,8 @@ var init_dialect2 = __esm({
30335
31224
  }
30336
31225
  }
30337
31226
  };
30338
- __publicField(SQLiteSyncDialect, _a199, "SQLiteSyncDialect");
30339
- SQLiteAsyncDialect = class extends (_b145 = SQLiteDialect, _a200 = entityKind, _b145) {
31227
+ __publicField(SQLiteSyncDialect, _a201, "SQLiteSyncDialect");
31228
+ SQLiteAsyncDialect = class extends (_b145 = SQLiteDialect, _a202 = entityKind, _b145) {
30340
31229
  async migrate(migrations, session, config) {
30341
31230
  const migrationsTable = config === void 0 ? "__drizzle_migrations" : typeof config === "string" ? "__drizzle_migrations" : config.migrationsTable ?? "__drizzle_migrations";
30342
31231
  const migrationTableCreate = sql`
@@ -30365,7 +31254,7 @@ var init_dialect2 = __esm({
30365
31254
  });
30366
31255
  }
30367
31256
  };
30368
- __publicField(SQLiteAsyncDialect, _a200, "SQLiteAsyncDialect");
31257
+ __publicField(SQLiteAsyncDialect, _a202, "SQLiteAsyncDialect");
30369
31258
  }
30370
31259
  });
30371
31260
 
@@ -30387,7 +31276,7 @@ function createSetOperator2(type, isAll) {
30387
31276
  return leftSelect.addSetOperators(setOperators);
30388
31277
  };
30389
31278
  }
30390
- var _a201, SQLiteSelectBuilder, _a202, _b146, SQLiteSelectQueryBuilderBase, _a203, _b147, SQLiteSelectBase, getSQLiteSetOperators, union2, unionAll2, intersect2, except2;
31279
+ var _a203, SQLiteSelectBuilder, _a204, _b146, SQLiteSelectQueryBuilderBase, _a205, _b147, SQLiteSelectBase, getSQLiteSetOperators, union2, unionAll2, intersect2, except2;
30391
31280
  var init_select3 = __esm({
30392
31281
  "../drizzle-orm/dist/sqlite-core/query-builders/select.js"() {
30393
31282
  "use strict";
@@ -30401,7 +31290,7 @@ var init_select3 = __esm({
30401
31290
  init_utils2();
30402
31291
  init_view_common();
30403
31292
  init_view_base2();
30404
- _a201 = entityKind;
31293
+ _a203 = entityKind;
30405
31294
  SQLiteSelectBuilder = class {
30406
31295
  constructor(config) {
30407
31296
  __publicField(this, "fields");
@@ -30442,8 +31331,8 @@ var init_select3 = __esm({
30442
31331
  });
30443
31332
  }
30444
31333
  };
30445
- __publicField(SQLiteSelectBuilder, _a201, "SQLiteSelectBuilder");
30446
- SQLiteSelectQueryBuilderBase = class extends (_b146 = TypedQueryBuilder, _a202 = entityKind, _b146) {
31334
+ __publicField(SQLiteSelectBuilder, _a203, "SQLiteSelectBuilder");
31335
+ SQLiteSelectQueryBuilderBase = class extends (_b146 = TypedQueryBuilder, _a204 = entityKind, _b146) {
30447
31336
  constructor({ table: table4, fields, isPartialSelect, session, dialect: dialect4, withList, distinct }) {
30448
31337
  super();
30449
31338
  __publicField(this, "_");
@@ -30948,8 +31837,8 @@ var init_select3 = __esm({
30948
31837
  return this;
30949
31838
  }
30950
31839
  };
30951
- __publicField(SQLiteSelectQueryBuilderBase, _a202, "SQLiteSelectQueryBuilder");
30952
- SQLiteSelectBase = class extends (_b147 = SQLiteSelectQueryBuilderBase, _a203 = entityKind, _b147) {
31840
+ __publicField(SQLiteSelectQueryBuilderBase, _a204, "SQLiteSelectQueryBuilder");
31841
+ SQLiteSelectBase = class extends (_b147 = SQLiteSelectQueryBuilderBase, _a205 = entityKind, _b147) {
30953
31842
  constructor() {
30954
31843
  super(...arguments);
30955
31844
  __publicField(this, "run", (placeholderValues) => {
@@ -30987,7 +31876,7 @@ var init_select3 = __esm({
30987
31876
  return this.all();
30988
31877
  }
30989
31878
  };
30990
- __publicField(SQLiteSelectBase, _a203, "SQLiteSelect");
31879
+ __publicField(SQLiteSelectBase, _a205, "SQLiteSelect");
30991
31880
  applyMixins(SQLiteSelectBase, [QueryPromise]);
30992
31881
  getSQLiteSetOperators = () => ({
30993
31882
  union: union2,
@@ -31003,7 +31892,7 @@ var init_select3 = __esm({
31003
31892
  });
31004
31893
 
31005
31894
  // ../drizzle-orm/dist/sqlite-core/query-builders/query-builder.js
31006
- var _a204, QueryBuilder2;
31895
+ var _a206, QueryBuilder2;
31007
31896
  var init_query_builder3 = __esm({
31008
31897
  "../drizzle-orm/dist/sqlite-core/query-builders/query-builder.js"() {
31009
31898
  "use strict";
@@ -31012,7 +31901,7 @@ var init_query_builder3 = __esm({
31012
31901
  init_dialect2();
31013
31902
  init_subquery();
31014
31903
  init_select3();
31015
- _a204 = entityKind;
31904
+ _a206 = entityKind;
31016
31905
  QueryBuilder2 = class {
31017
31906
  constructor(dialect4) {
31018
31907
  __publicField(this, "dialect");
@@ -31074,7 +31963,7 @@ var init_query_builder3 = __esm({
31074
31963
  return this.dialect;
31075
31964
  }
31076
31965
  };
31077
- __publicField(QueryBuilder2, _a204, "SQLiteQueryBuilder");
31966
+ __publicField(QueryBuilder2, _a206, "SQLiteQueryBuilder");
31078
31967
  }
31079
31968
  });
31080
31969
 
@@ -31086,7 +31975,7 @@ var init_select_types2 = __esm({
31086
31975
  });
31087
31976
 
31088
31977
  // ../drizzle-orm/dist/sqlite-core/query-builders/update.js
31089
- var _a205, SQLiteUpdateBuilder, _a206, _b148, SQLiteUpdateBase;
31978
+ var _a207, SQLiteUpdateBuilder, _a208, _b148, SQLiteUpdateBase;
31090
31979
  var init_update2 = __esm({
31091
31980
  "../drizzle-orm/dist/sqlite-core/query-builders/update.js"() {
31092
31981
  "use strict";
@@ -31096,7 +31985,7 @@ var init_update2 = __esm({
31096
31985
  init_table3();
31097
31986
  init_table();
31098
31987
  init_utils2();
31099
- _a205 = entityKind;
31988
+ _a207 = entityKind;
31100
31989
  SQLiteUpdateBuilder = class {
31101
31990
  constructor(table4, session, dialect4, withList) {
31102
31991
  this.table = table4;
@@ -31114,8 +32003,8 @@ var init_update2 = __esm({
31114
32003
  );
31115
32004
  }
31116
32005
  };
31117
- __publicField(SQLiteUpdateBuilder, _a205, "SQLiteUpdateBuilder");
31118
- SQLiteUpdateBase = class extends (_b148 = QueryPromise, _a206 = entityKind, _b148) {
32006
+ __publicField(SQLiteUpdateBuilder, _a207, "SQLiteUpdateBuilder");
32007
+ SQLiteUpdateBase = class extends (_b148 = QueryPromise, _a208 = entityKind, _b148) {
31119
32008
  constructor(table4, set, session, dialect4, withList) {
31120
32009
  super();
31121
32010
  /** @internal */
@@ -31224,7 +32113,7 @@ var init_update2 = __esm({
31224
32113
  return this;
31225
32114
  }
31226
32115
  };
31227
- __publicField(SQLiteUpdateBase, _a206, "SQLiteUpdate");
32116
+ __publicField(SQLiteUpdateBase, _a208, "SQLiteUpdate");
31228
32117
  }
31229
32118
  });
31230
32119
 
@@ -31242,17 +32131,17 @@ var init_query_builders2 = __esm({
31242
32131
  });
31243
32132
 
31244
32133
  // ../drizzle-orm/dist/sqlite-core/query-builders/count.js
31245
- var _a207, _b149, _c7, _SQLiteCountBuilder, SQLiteCountBuilder;
32134
+ var _a209, _b149, _c7, _SQLiteCountBuilder, SQLiteCountBuilder;
31246
32135
  var init_count2 = __esm({
31247
32136
  "../drizzle-orm/dist/sqlite-core/query-builders/count.js"() {
31248
32137
  "use strict";
31249
32138
  init_entity();
31250
32139
  init_sql();
31251
- _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b149 = entityKind, _a207 = Symbol.toStringTag, _c7) {
32140
+ _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b149 = entityKind, _a209 = Symbol.toStringTag, _c7) {
31252
32141
  constructor(params) {
31253
32142
  super(_SQLiteCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
31254
32143
  __publicField(this, "sql");
31255
- __publicField(this, _a207, "SQLiteCountBuilderAsync");
32144
+ __publicField(this, _a209, "SQLiteCountBuilderAsync");
31256
32145
  __publicField(this, "session");
31257
32146
  this.params = params;
31258
32147
  this.session = params.session;
@@ -31295,14 +32184,14 @@ var init_count2 = __esm({
31295
32184
  });
31296
32185
 
31297
32186
  // ../drizzle-orm/dist/sqlite-core/query-builders/query.js
31298
- var _a208, RelationalQueryBuilder2, _a209, _b150, SQLiteRelationalQuery, _a210, _b151, SQLiteSyncRelationalQuery;
32187
+ var _a210, RelationalQueryBuilder2, _a211, _b150, SQLiteRelationalQuery, _a212, _b151, SQLiteSyncRelationalQuery;
31299
32188
  var init_query2 = __esm({
31300
32189
  "../drizzle-orm/dist/sqlite-core/query-builders/query.js"() {
31301
32190
  "use strict";
31302
32191
  init_entity();
31303
32192
  init_query_promise();
31304
32193
  init_relations();
31305
- _a208 = entityKind;
32194
+ _a210 = entityKind;
31306
32195
  RelationalQueryBuilder2 = class {
31307
32196
  constructor(mode, fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session) {
31308
32197
  this.mode = mode;
@@ -31361,8 +32250,8 @@ var init_query2 = __esm({
31361
32250
  );
31362
32251
  }
31363
32252
  };
31364
- __publicField(RelationalQueryBuilder2, _a208, "SQLiteAsyncRelationalQueryBuilder");
31365
- SQLiteRelationalQuery = class extends (_b150 = QueryPromise, _a209 = entityKind, _b150) {
32253
+ __publicField(RelationalQueryBuilder2, _a210, "SQLiteAsyncRelationalQueryBuilder");
32254
+ SQLiteRelationalQuery = class extends (_b150 = QueryPromise, _a211 = entityKind, _b150) {
31366
32255
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, config, mode) {
31367
32256
  super();
31368
32257
  /** @internal */
@@ -31438,24 +32327,24 @@ var init_query2 = __esm({
31438
32327
  return this.executeRaw();
31439
32328
  }
31440
32329
  };
31441
- __publicField(SQLiteRelationalQuery, _a209, "SQLiteAsyncRelationalQuery");
31442
- SQLiteSyncRelationalQuery = class extends (_b151 = SQLiteRelationalQuery, _a210 = entityKind, _b151) {
32330
+ __publicField(SQLiteRelationalQuery, _a211, "SQLiteAsyncRelationalQuery");
32331
+ SQLiteSyncRelationalQuery = class extends (_b151 = SQLiteRelationalQuery, _a212 = entityKind, _b151) {
31443
32332
  sync() {
31444
32333
  return this.executeRaw();
31445
32334
  }
31446
32335
  };
31447
- __publicField(SQLiteSyncRelationalQuery, _a210, "SQLiteSyncRelationalQuery");
32336
+ __publicField(SQLiteSyncRelationalQuery, _a212, "SQLiteSyncRelationalQuery");
31448
32337
  }
31449
32338
  });
31450
32339
 
31451
32340
  // ../drizzle-orm/dist/sqlite-core/query-builders/raw.js
31452
- var _a211, _b152, SQLiteRaw;
32341
+ var _a213, _b152, SQLiteRaw;
31453
32342
  var init_raw2 = __esm({
31454
32343
  "../drizzle-orm/dist/sqlite-core/query-builders/raw.js"() {
31455
32344
  "use strict";
31456
32345
  init_entity();
31457
32346
  init_query_promise();
31458
- SQLiteRaw = class extends (_b152 = QueryPromise, _a211 = entityKind, _b152) {
32347
+ SQLiteRaw = class extends (_b152 = QueryPromise, _a213 = entityKind, _b152) {
31459
32348
  constructor(execute, getSQL, action, dialect4, mapBatchResult) {
31460
32349
  super();
31461
32350
  /** @internal */
@@ -31480,12 +32369,12 @@ var init_raw2 = __esm({
31480
32369
  return false;
31481
32370
  }
31482
32371
  };
31483
- __publicField(SQLiteRaw, _a211, "SQLiteRaw");
32372
+ __publicField(SQLiteRaw, _a213, "SQLiteRaw");
31484
32373
  }
31485
32374
  });
31486
32375
 
31487
32376
  // ../drizzle-orm/dist/sqlite-core/db.js
31488
- var _a212, BaseSQLiteDatabase;
32377
+ var _a214, BaseSQLiteDatabase;
31489
32378
  var init_db2 = __esm({
31490
32379
  "../drizzle-orm/dist/sqlite-core/db.js"() {
31491
32380
  "use strict";
@@ -31497,7 +32386,7 @@ var init_db2 = __esm({
31497
32386
  init_count2();
31498
32387
  init_query2();
31499
32388
  init_raw2();
31500
- _a212 = entityKind;
32389
+ _a214 = entityKind;
31501
32390
  BaseSQLiteDatabase = class {
31502
32391
  constructor(resultKind, dialect4, session, schema4) {
31503
32392
  __publicField(this, "query");
@@ -31779,17 +32668,17 @@ var init_db2 = __esm({
31779
32668
  return this.session.transaction(transaction, config);
31780
32669
  }
31781
32670
  };
31782
- __publicField(BaseSQLiteDatabase, _a212, "BaseSQLiteDatabase");
32671
+ __publicField(BaseSQLiteDatabase, _a214, "BaseSQLiteDatabase");
31783
32672
  }
31784
32673
  });
31785
32674
 
31786
32675
  // ../drizzle-orm/dist/sqlite-core/indexes.js
31787
- var _a213, IndexBuilderOn2, _a214, IndexBuilder2, _a215, Index4;
32676
+ var _a215, IndexBuilderOn2, _a216, IndexBuilder2, _a217, Index4;
31788
32677
  var init_indexes2 = __esm({
31789
32678
  "../drizzle-orm/dist/sqlite-core/indexes.js"() {
31790
32679
  "use strict";
31791
32680
  init_entity();
31792
- _a213 = entityKind;
32681
+ _a215 = entityKind;
31793
32682
  IndexBuilderOn2 = class {
31794
32683
  constructor(name2, unique) {
31795
32684
  this.name = name2;
@@ -31799,8 +32688,8 @@ var init_indexes2 = __esm({
31799
32688
  return new IndexBuilder2(this.name, columns, this.unique);
31800
32689
  }
31801
32690
  };
31802
- __publicField(IndexBuilderOn2, _a213, "SQLiteIndexBuilderOn");
31803
- _a214 = entityKind;
32691
+ __publicField(IndexBuilderOn2, _a215, "SQLiteIndexBuilderOn");
32692
+ _a216 = entityKind;
31804
32693
  IndexBuilder2 = class {
31805
32694
  constructor(name2, columns, unique) {
31806
32695
  /** @internal */
@@ -31824,26 +32713,26 @@ var init_indexes2 = __esm({
31824
32713
  return new Index4(this.config, table4);
31825
32714
  }
31826
32715
  };
31827
- __publicField(IndexBuilder2, _a214, "SQLiteIndexBuilder");
31828
- _a215 = entityKind;
32716
+ __publicField(IndexBuilder2, _a216, "SQLiteIndexBuilder");
32717
+ _a217 = entityKind;
31829
32718
  Index4 = class {
31830
32719
  constructor(config, table4) {
31831
32720
  __publicField(this, "config");
31832
32721
  this.config = { ...config, table: table4 };
31833
32722
  }
31834
32723
  };
31835
- __publicField(Index4, _a215, "SQLiteIndex");
32724
+ __publicField(Index4, _a217, "SQLiteIndex");
31836
32725
  }
31837
32726
  });
31838
32727
 
31839
32728
  // ../drizzle-orm/dist/sqlite-core/primary-keys.js
31840
- var _a216, PrimaryKeyBuilder2, _a217, PrimaryKey2;
32729
+ var _a218, PrimaryKeyBuilder2, _a219, PrimaryKey2;
31841
32730
  var init_primary_keys2 = __esm({
31842
32731
  "../drizzle-orm/dist/sqlite-core/primary-keys.js"() {
31843
32732
  "use strict";
31844
32733
  init_entity();
31845
32734
  init_table3();
31846
- _a216 = entityKind;
32735
+ _a218 = entityKind;
31847
32736
  PrimaryKeyBuilder2 = class {
31848
32737
  constructor(columns, name2) {
31849
32738
  /** @internal */
@@ -31858,8 +32747,8 @@ var init_primary_keys2 = __esm({
31858
32747
  return new PrimaryKey2(table4, this.columns, this.name);
31859
32748
  }
31860
32749
  };
31861
- __publicField(PrimaryKeyBuilder2, _a216, "SQLitePrimaryKeyBuilder");
31862
- _a217 = entityKind;
32750
+ __publicField(PrimaryKeyBuilder2, _a218, "SQLitePrimaryKeyBuilder");
32751
+ _a219 = entityKind;
31863
32752
  PrimaryKey2 = class {
31864
32753
  constructor(table4, columns, name2) {
31865
32754
  __publicField(this, "columns");
@@ -31872,12 +32761,12 @@ var init_primary_keys2 = __esm({
31872
32761
  return this.name ?? `${this.table[SQLiteTable.Symbol.Name]}_${this.columns.map((column4) => column4.name).join("_")}_pk`;
31873
32762
  }
31874
32763
  };
31875
- __publicField(PrimaryKey2, _a217, "SQLitePrimaryKey");
32764
+ __publicField(PrimaryKey2, _a219, "SQLitePrimaryKey");
31876
32765
  }
31877
32766
  });
31878
32767
 
31879
32768
  // ../drizzle-orm/dist/sqlite-core/session.js
31880
- var _a218, _b153, ExecuteResultSync, _a219, SQLitePreparedQuery, _a220, SQLiteSession, _a221, _b154, SQLiteTransaction;
32769
+ var _a220, _b153, ExecuteResultSync, _a221, SQLitePreparedQuery, _a222, SQLiteSession, _a223, _b154, SQLiteTransaction;
31881
32770
  var init_session2 = __esm({
31882
32771
  "../drizzle-orm/dist/sqlite-core/session.js"() {
31883
32772
  "use strict";
@@ -31885,7 +32774,7 @@ var init_session2 = __esm({
31885
32774
  init_errors();
31886
32775
  init_query_promise();
31887
32776
  init_db2();
31888
- ExecuteResultSync = class extends (_b153 = QueryPromise, _a218 = entityKind, _b153) {
32777
+ ExecuteResultSync = class extends (_b153 = QueryPromise, _a220 = entityKind, _b153) {
31889
32778
  constructor(resultCb) {
31890
32779
  super();
31891
32780
  this.resultCb = resultCb;
@@ -31897,8 +32786,8 @@ var init_session2 = __esm({
31897
32786
  return this.resultCb();
31898
32787
  }
31899
32788
  };
31900
- __publicField(ExecuteResultSync, _a218, "ExecuteResultSync");
31901
- _a219 = entityKind;
32789
+ __publicField(ExecuteResultSync, _a220, "ExecuteResultSync");
32790
+ _a221 = entityKind;
31902
32791
  SQLitePreparedQuery = class {
31903
32792
  constructor(mode, executeMethod, query) {
31904
32793
  /** @internal */
@@ -31939,8 +32828,8 @@ var init_session2 = __esm({
31939
32828
  }
31940
32829
  }
31941
32830
  };
31942
- __publicField(SQLitePreparedQuery, _a219, "PreparedQuery");
31943
- _a220 = entityKind;
32831
+ __publicField(SQLitePreparedQuery, _a221, "PreparedQuery");
32832
+ _a222 = entityKind;
31944
32833
  SQLiteSession = class {
31945
32834
  constructor(dialect4) {
31946
32835
  this.dialect = dialect4;
@@ -31986,8 +32875,8 @@ var init_session2 = __esm({
31986
32875
  throw new Error("Not implemented");
31987
32876
  }
31988
32877
  };
31989
- __publicField(SQLiteSession, _a220, "SQLiteSession");
31990
- SQLiteTransaction = class extends (_b154 = BaseSQLiteDatabase, _a221 = entityKind, _b154) {
32878
+ __publicField(SQLiteSession, _a222, "SQLiteSession");
32879
+ SQLiteTransaction = class extends (_b154 = BaseSQLiteDatabase, _a223 = entityKind, _b154) {
31991
32880
  constructor(resultType, dialect4, session, schema4, nestedIndex = 0) {
31992
32881
  super(resultType, dialect4, session, schema4);
31993
32882
  this.schema = schema4;
@@ -31997,7 +32886,7 @@ var init_session2 = __esm({
31997
32886
  throw new TransactionRollbackError();
31998
32887
  }
31999
32888
  };
32000
- __publicField(SQLiteTransaction, _a221, "SQLiteTransaction");
32889
+ __publicField(SQLiteTransaction, _a223, "SQLiteTransaction");
32001
32890
  }
32002
32891
  });
32003
32892
 
@@ -32066,7 +32955,7 @@ var init_utils6 = __esm({
32066
32955
  });
32067
32956
 
32068
32957
  // ../drizzle-orm/dist/sqlite-core/view.js
32069
- var _a222, ViewBuilderCore, _a223, _b155, ViewBuilder2, _a224, _b156, ManualViewBuilder2, _a225, _b157, SQLiteView2;
32958
+ var _a224, ViewBuilderCore, _a225, _b155, ViewBuilder2, _a226, _b156, ManualViewBuilder2, _a227, _b157, SQLiteView2;
32070
32959
  var init_view2 = __esm({
32071
32960
  "../drizzle-orm/dist/sqlite-core/view.js"() {
32072
32961
  "use strict";
@@ -32076,15 +32965,15 @@ var init_view2 = __esm({
32076
32965
  init_query_builder3();
32077
32966
  init_table3();
32078
32967
  init_view_base2();
32079
- _a222 = entityKind;
32968
+ _a224 = entityKind;
32080
32969
  ViewBuilderCore = class {
32081
32970
  constructor(name2) {
32082
32971
  __publicField(this, "config", {});
32083
32972
  this.name = name2;
32084
32973
  }
32085
32974
  };
32086
- __publicField(ViewBuilderCore, _a222, "SQLiteViewBuilderCore");
32087
- ViewBuilder2 = class extends (_b155 = ViewBuilderCore, _a223 = entityKind, _b155) {
32975
+ __publicField(ViewBuilderCore, _a224, "SQLiteViewBuilderCore");
32976
+ ViewBuilder2 = class extends (_b155 = ViewBuilderCore, _a225 = entityKind, _b155) {
32088
32977
  as(qb) {
32089
32978
  if (typeof qb === "function") {
32090
32979
  qb = qb(new QueryBuilder2());
@@ -32110,8 +32999,8 @@ var init_view2 = __esm({
32110
32999
  );
32111
33000
  }
32112
33001
  };
32113
- __publicField(ViewBuilder2, _a223, "SQLiteViewBuilder");
32114
- ManualViewBuilder2 = class extends (_b156 = ViewBuilderCore, _a224 = entityKind, _b156) {
33002
+ __publicField(ViewBuilder2, _a225, "SQLiteViewBuilder");
33003
+ ManualViewBuilder2 = class extends (_b156 = ViewBuilderCore, _a226 = entityKind, _b156) {
32115
33004
  constructor(name2, columns) {
32116
33005
  super(name2);
32117
33006
  __publicField(this, "columns");
@@ -32154,13 +33043,13 @@ var init_view2 = __esm({
32154
33043
  );
32155
33044
  }
32156
33045
  };
32157
- __publicField(ManualViewBuilder2, _a224, "SQLiteManualViewBuilder");
32158
- SQLiteView2 = class extends (_b157 = SQLiteViewBase, _a225 = entityKind, _b157) {
33046
+ __publicField(ManualViewBuilder2, _a226, "SQLiteManualViewBuilder");
33047
+ SQLiteView2 = class extends (_b157 = SQLiteViewBase, _a227 = entityKind, _b157) {
32159
33048
  constructor({ config }) {
32160
33049
  super(config);
32161
33050
  }
32162
33051
  };
32163
- __publicField(SQLiteView2, _a225, "SQLiteView");
33052
+ __publicField(SQLiteView2, _a227, "SQLiteView");
32164
33053
  }
32165
33054
  });
32166
33055
 
@@ -32859,12 +33748,12 @@ var init_alias4 = __esm({
32859
33748
  });
32860
33749
 
32861
33750
  // ../drizzle-orm/dist/mysql-core/checks.js
32862
- var _a226, CheckBuilder3, _a227, Check3;
33751
+ var _a228, CheckBuilder3, _a229, Check3;
32863
33752
  var init_checks3 = __esm({
32864
33753
  "../drizzle-orm/dist/mysql-core/checks.js"() {
32865
33754
  "use strict";
32866
33755
  init_entity();
32867
- _a226 = entityKind;
33756
+ _a228 = entityKind;
32868
33757
  CheckBuilder3 = class {
32869
33758
  constructor(name2, value) {
32870
33759
  __publicField(this, "brand");
@@ -32876,8 +33765,8 @@ var init_checks3 = __esm({
32876
33765
  return new Check3(table4, this);
32877
33766
  }
32878
33767
  };
32879
- __publicField(CheckBuilder3, _a226, "MySqlCheckBuilder");
32880
- _a227 = entityKind;
33768
+ __publicField(CheckBuilder3, _a228, "MySqlCheckBuilder");
33769
+ _a229 = entityKind;
32881
33770
  Check3 = class {
32882
33771
  constructor(table4, builder) {
32883
33772
  __publicField(this, "name");
@@ -32887,18 +33776,18 @@ var init_checks3 = __esm({
32887
33776
  this.value = builder.value;
32888
33777
  }
32889
33778
  };
32890
- __publicField(Check3, _a227, "MySqlCheck");
33779
+ __publicField(Check3, _a229, "MySqlCheck");
32891
33780
  }
32892
33781
  });
32893
33782
 
32894
33783
  // ../drizzle-orm/dist/mysql-core/foreign-keys.js
32895
- var _a228, ForeignKeyBuilder3, _a229, ForeignKey3;
33784
+ var _a230, ForeignKeyBuilder3, _a231, ForeignKey3;
32896
33785
  var init_foreign_keys3 = __esm({
32897
33786
  "../drizzle-orm/dist/mysql-core/foreign-keys.js"() {
32898
33787
  "use strict";
32899
33788
  init_entity();
32900
33789
  init_table_utils();
32901
- _a228 = entityKind;
33790
+ _a230 = entityKind;
32902
33791
  ForeignKeyBuilder3 = class {
32903
33792
  constructor(config, actions) {
32904
33793
  /** @internal */
@@ -32929,8 +33818,8 @@ var init_foreign_keys3 = __esm({
32929
33818
  return new ForeignKey3(table4, this);
32930
33819
  }
32931
33820
  };
32932
- __publicField(ForeignKeyBuilder3, _a228, "MySqlForeignKeyBuilder");
32933
- _a229 = entityKind;
33821
+ __publicField(ForeignKeyBuilder3, _a230, "MySqlForeignKeyBuilder");
33822
+ _a231 = entityKind;
32934
33823
  ForeignKey3 = class {
32935
33824
  constructor(table4, builder) {
32936
33825
  __publicField(this, "reference");
@@ -32954,7 +33843,7 @@ var init_foreign_keys3 = __esm({
32954
33843
  return name2 ?? `${chunks.join("_")}_fk`;
32955
33844
  }
32956
33845
  };
32957
- __publicField(ForeignKey3, _a229, "MySqlForeignKey");
33846
+ __publicField(ForeignKey3, _a231, "MySqlForeignKey");
32958
33847
  }
32959
33848
  });
32960
33849
 
@@ -32962,13 +33851,13 @@ var init_foreign_keys3 = __esm({
32962
33851
  function uniqueKeyName3(table4, columns) {
32963
33852
  return `${table4[TableName]}_${columns.join("_")}_unique`;
32964
33853
  }
32965
- var _a230, UniqueConstraintBuilder3, _a231, UniqueOnConstraintBuilder3, _a232, UniqueConstraint3;
33854
+ var _a232, UniqueConstraintBuilder3, _a233, UniqueOnConstraintBuilder3, _a234, UniqueConstraint3;
32966
33855
  var init_unique_constraint3 = __esm({
32967
33856
  "../drizzle-orm/dist/mysql-core/unique-constraint.js"() {
32968
33857
  "use strict";
32969
33858
  init_entity();
32970
33859
  init_table_utils();
32971
- _a230 = entityKind;
33860
+ _a232 = entityKind;
32972
33861
  UniqueConstraintBuilder3 = class {
32973
33862
  constructor(columns, name2) {
32974
33863
  /** @internal */
@@ -32981,8 +33870,8 @@ var init_unique_constraint3 = __esm({
32981
33870
  return new UniqueConstraint3(table4, this.columns, this.name);
32982
33871
  }
32983
33872
  };
32984
- __publicField(UniqueConstraintBuilder3, _a230, "MySqlUniqueConstraintBuilder");
32985
- _a231 = entityKind;
33873
+ __publicField(UniqueConstraintBuilder3, _a232, "MySqlUniqueConstraintBuilder");
33874
+ _a233 = entityKind;
32986
33875
  UniqueOnConstraintBuilder3 = class {
32987
33876
  constructor(name2) {
32988
33877
  /** @internal */
@@ -32993,8 +33882,8 @@ var init_unique_constraint3 = __esm({
32993
33882
  return new UniqueConstraintBuilder3(columns, this.name);
32994
33883
  }
32995
33884
  };
32996
- __publicField(UniqueOnConstraintBuilder3, _a231, "MySqlUniqueOnConstraintBuilder");
32997
- _a232 = entityKind;
33885
+ __publicField(UniqueOnConstraintBuilder3, _a233, "MySqlUniqueOnConstraintBuilder");
33886
+ _a234 = entityKind;
32998
33887
  UniqueConstraint3 = class {
32999
33888
  constructor(table4, columns, name2) {
33000
33889
  __publicField(this, "columns");
@@ -33008,12 +33897,12 @@ var init_unique_constraint3 = __esm({
33008
33897
  return this.name;
33009
33898
  }
33010
33899
  };
33011
- __publicField(UniqueConstraint3, _a232, "MySqlUniqueConstraint");
33900
+ __publicField(UniqueConstraint3, _a234, "MySqlUniqueConstraint");
33012
33901
  }
33013
33902
  });
33014
33903
 
33015
33904
  // ../drizzle-orm/dist/mysql-core/columns/common.js
33016
- var _a233, _b158, MySqlColumnBuilder, _a234, _b159, MySqlColumn, _a235, _b160, MySqlColumnBuilderWithAutoIncrement, _a236, _b161, MySqlColumnWithAutoIncrement;
33905
+ var _a235, _b158, MySqlColumnBuilder, _a236, _b159, MySqlColumn, _a237, _b160, MySqlColumnBuilderWithAutoIncrement, _a238, _b161, MySqlColumnWithAutoIncrement;
33017
33906
  var init_common4 = __esm({
33018
33907
  "../drizzle-orm/dist/mysql-core/columns/common.js"() {
33019
33908
  "use strict";
@@ -33022,7 +33911,7 @@ var init_common4 = __esm({
33022
33911
  init_entity();
33023
33912
  init_foreign_keys3();
33024
33913
  init_unique_constraint3();
33025
- MySqlColumnBuilder = class extends (_b158 = ColumnBuilder, _a233 = entityKind, _b158) {
33914
+ MySqlColumnBuilder = class extends (_b158 = ColumnBuilder, _a235 = entityKind, _b158) {
33026
33915
  constructor() {
33027
33916
  super(...arguments);
33028
33917
  __publicField(this, "foreignKeyConfigs", []);
@@ -33063,8 +33952,8 @@ var init_common4 = __esm({
33063
33952
  });
33064
33953
  }
33065
33954
  };
33066
- __publicField(MySqlColumnBuilder, _a233, "MySqlColumnBuilder");
33067
- MySqlColumn = class extends (_b159 = Column2, _a234 = entityKind, _b159) {
33955
+ __publicField(MySqlColumnBuilder, _a235, "MySqlColumnBuilder");
33956
+ MySqlColumn = class extends (_b159 = Column2, _a236 = entityKind, _b159) {
33068
33957
  constructor(table4, config) {
33069
33958
  if (!config.uniqueName) {
33070
33959
  config.uniqueName = uniqueKeyName3(table4, [config.name]);
@@ -33073,8 +33962,8 @@ var init_common4 = __esm({
33073
33962
  this.table = table4;
33074
33963
  }
33075
33964
  };
33076
- __publicField(MySqlColumn, _a234, "MySqlColumn");
33077
- MySqlColumnBuilderWithAutoIncrement = class extends (_b160 = MySqlColumnBuilder, _a235 = entityKind, _b160) {
33965
+ __publicField(MySqlColumn, _a236, "MySqlColumn");
33966
+ MySqlColumnBuilderWithAutoIncrement = class extends (_b160 = MySqlColumnBuilder, _a237 = entityKind, _b160) {
33078
33967
  constructor(name2, dataType, columnType) {
33079
33968
  super(name2, dataType, columnType);
33080
33969
  this.config.autoIncrement = false;
@@ -33085,14 +33974,14 @@ var init_common4 = __esm({
33085
33974
  return this;
33086
33975
  }
33087
33976
  };
33088
- __publicField(MySqlColumnBuilderWithAutoIncrement, _a235, "MySqlColumnBuilderWithAutoIncrement");
33089
- MySqlColumnWithAutoIncrement = class extends (_b161 = MySqlColumn, _a236 = entityKind, _b161) {
33977
+ __publicField(MySqlColumnBuilderWithAutoIncrement, _a237, "MySqlColumnBuilderWithAutoIncrement");
33978
+ MySqlColumnWithAutoIncrement = class extends (_b161 = MySqlColumn, _a238 = entityKind, _b161) {
33090
33979
  constructor() {
33091
33980
  super(...arguments);
33092
33981
  __publicField(this, "autoIncrement", this.config.autoIncrement);
33093
33982
  }
33094
33983
  };
33095
- __publicField(MySqlColumnWithAutoIncrement, _a236, "MySqlColumnWithAutoIncrement");
33984
+ __publicField(MySqlColumnWithAutoIncrement, _a238, "MySqlColumnWithAutoIncrement");
33096
33985
  }
33097
33986
  });
33098
33987
 
@@ -33104,14 +33993,14 @@ function bigint2(a, b) {
33104
33993
  }
33105
33994
  return new MySqlBigInt64Builder(name2, config.unsigned);
33106
33995
  }
33107
- var _a237, _b162, MySqlBigInt53Builder, _a238, _b163, MySqlBigInt53, _a239, _b164, MySqlBigInt64Builder, _a240, _b165, MySqlBigInt64;
33996
+ var _a239, _b162, MySqlBigInt53Builder, _a240, _b163, MySqlBigInt53, _a241, _b164, MySqlBigInt64Builder, _a242, _b165, MySqlBigInt64;
33108
33997
  var init_bigint2 = __esm({
33109
33998
  "../drizzle-orm/dist/mysql-core/columns/bigint.js"() {
33110
33999
  "use strict";
33111
34000
  init_entity();
33112
34001
  init_utils2();
33113
34002
  init_common4();
33114
- MySqlBigInt53Builder = class extends (_b162 = MySqlColumnBuilderWithAutoIncrement, _a237 = entityKind, _b162) {
34003
+ MySqlBigInt53Builder = class extends (_b162 = MySqlColumnBuilderWithAutoIncrement, _a239 = entityKind, _b162) {
33115
34004
  constructor(name2, unsigned = false) {
33116
34005
  super(name2, "number", "MySqlBigInt53");
33117
34006
  this.config.unsigned = unsigned;
@@ -33124,8 +34013,8 @@ var init_bigint2 = __esm({
33124
34013
  );
33125
34014
  }
33126
34015
  };
33127
- __publicField(MySqlBigInt53Builder, _a237, "MySqlBigInt53Builder");
33128
- MySqlBigInt53 = class extends (_b163 = MySqlColumnWithAutoIncrement, _a238 = entityKind, _b163) {
34016
+ __publicField(MySqlBigInt53Builder, _a239, "MySqlBigInt53Builder");
34017
+ MySqlBigInt53 = class extends (_b163 = MySqlColumnWithAutoIncrement, _a240 = entityKind, _b163) {
33129
34018
  getSQLType() {
33130
34019
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
33131
34020
  }
@@ -33136,8 +34025,8 @@ var init_bigint2 = __esm({
33136
34025
  return Number(value);
33137
34026
  }
33138
34027
  };
33139
- __publicField(MySqlBigInt53, _a238, "MySqlBigInt53");
33140
- MySqlBigInt64Builder = class extends (_b164 = MySqlColumnBuilderWithAutoIncrement, _a239 = entityKind, _b164) {
34028
+ __publicField(MySqlBigInt53, _a240, "MySqlBigInt53");
34029
+ MySqlBigInt64Builder = class extends (_b164 = MySqlColumnBuilderWithAutoIncrement, _a241 = entityKind, _b164) {
33141
34030
  constructor(name2, unsigned = false) {
33142
34031
  super(name2, "bigint", "MySqlBigInt64");
33143
34032
  this.config.unsigned = unsigned;
@@ -33150,8 +34039,8 @@ var init_bigint2 = __esm({
33150
34039
  );
33151
34040
  }
33152
34041
  };
33153
- __publicField(MySqlBigInt64Builder, _a239, "MySqlBigInt64Builder");
33154
- MySqlBigInt64 = class extends (_b165 = MySqlColumnWithAutoIncrement, _a240 = entityKind, _b165) {
34042
+ __publicField(MySqlBigInt64Builder, _a241, "MySqlBigInt64Builder");
34043
+ MySqlBigInt64 = class extends (_b165 = MySqlColumnWithAutoIncrement, _a242 = entityKind, _b165) {
33155
34044
  getSQLType() {
33156
34045
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
33157
34046
  }
@@ -33160,7 +34049,7 @@ var init_bigint2 = __esm({
33160
34049
  return BigInt(value);
33161
34050
  }
33162
34051
  };
33163
- __publicField(MySqlBigInt64, _a240, "MySqlBigInt64");
34052
+ __publicField(MySqlBigInt64, _a242, "MySqlBigInt64");
33164
34053
  }
33165
34054
  });
33166
34055
 
@@ -33169,14 +34058,14 @@ function binary(a, b = {}) {
33169
34058
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33170
34059
  return new MySqlBinaryBuilder(name2, config.length);
33171
34060
  }
33172
- var _a241, _b166, MySqlBinaryBuilder, _a242, _b167, MySqlBinary;
34061
+ var _a243, _b166, MySqlBinaryBuilder, _a244, _b167, MySqlBinary;
33173
34062
  var init_binary = __esm({
33174
34063
  "../drizzle-orm/dist/mysql-core/columns/binary.js"() {
33175
34064
  "use strict";
33176
34065
  init_entity();
33177
34066
  init_utils2();
33178
34067
  init_common4();
33179
- MySqlBinaryBuilder = class extends (_b166 = MySqlColumnBuilder, _a241 = entityKind, _b166) {
34068
+ MySqlBinaryBuilder = class extends (_b166 = MySqlColumnBuilder, _a243 = entityKind, _b166) {
33180
34069
  constructor(name2, length) {
33181
34070
  super(name2, "string", "MySqlBinary");
33182
34071
  this.config.length = length;
@@ -33186,8 +34075,8 @@ var init_binary = __esm({
33186
34075
  return new MySqlBinary(table4, this.config);
33187
34076
  }
33188
34077
  };
33189
- __publicField(MySqlBinaryBuilder, _a241, "MySqlBinaryBuilder");
33190
- MySqlBinary = class extends (_b167 = MySqlColumn, _a242 = entityKind, _b167) {
34078
+ __publicField(MySqlBinaryBuilder, _a243, "MySqlBinaryBuilder");
34079
+ MySqlBinary = class extends (_b167 = MySqlColumn, _a244 = entityKind, _b167) {
33191
34080
  constructor() {
33192
34081
  super(...arguments);
33193
34082
  __publicField(this, "length", this.config.length);
@@ -33196,7 +34085,7 @@ var init_binary = __esm({
33196
34085
  return this.length === void 0 ? `binary` : `binary(${this.length})`;
33197
34086
  }
33198
34087
  };
33199
- __publicField(MySqlBinary, _a242, "MySqlBinary");
34088
+ __publicField(MySqlBinary, _a244, "MySqlBinary");
33200
34089
  }
33201
34090
  });
33202
34091
 
@@ -33204,13 +34093,13 @@ var init_binary = __esm({
33204
34093
  function boolean2(name2) {
33205
34094
  return new MySqlBooleanBuilder(name2 ?? "");
33206
34095
  }
33207
- var _a243, _b168, MySqlBooleanBuilder, _a244, _b169, MySqlBoolean;
34096
+ var _a245, _b168, MySqlBooleanBuilder, _a246, _b169, MySqlBoolean;
33208
34097
  var init_boolean2 = __esm({
33209
34098
  "../drizzle-orm/dist/mysql-core/columns/boolean.js"() {
33210
34099
  "use strict";
33211
34100
  init_entity();
33212
34101
  init_common4();
33213
- MySqlBooleanBuilder = class extends (_b168 = MySqlColumnBuilder, _a243 = entityKind, _b168) {
34102
+ MySqlBooleanBuilder = class extends (_b168 = MySqlColumnBuilder, _a245 = entityKind, _b168) {
33214
34103
  constructor(name2) {
33215
34104
  super(name2, "boolean", "MySqlBoolean");
33216
34105
  }
@@ -33222,8 +34111,8 @@ var init_boolean2 = __esm({
33222
34111
  );
33223
34112
  }
33224
34113
  };
33225
- __publicField(MySqlBooleanBuilder, _a243, "MySqlBooleanBuilder");
33226
- MySqlBoolean = class extends (_b169 = MySqlColumn, _a244 = entityKind, _b169) {
34114
+ __publicField(MySqlBooleanBuilder, _a245, "MySqlBooleanBuilder");
34115
+ MySqlBoolean = class extends (_b169 = MySqlColumn, _a246 = entityKind, _b169) {
33227
34116
  getSQLType() {
33228
34117
  return "boolean";
33229
34118
  }
@@ -33234,7 +34123,7 @@ var init_boolean2 = __esm({
33234
34123
  return value === 1;
33235
34124
  }
33236
34125
  };
33237
- __publicField(MySqlBoolean, _a244, "MySqlBoolean");
34126
+ __publicField(MySqlBoolean, _a246, "MySqlBoolean");
33238
34127
  }
33239
34128
  });
33240
34129
 
@@ -33243,14 +34132,14 @@ function char2(a, b = {}) {
33243
34132
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33244
34133
  return new MySqlCharBuilder(name2, config);
33245
34134
  }
33246
- var _a245, _b170, MySqlCharBuilder, _a246, _b171, MySqlChar;
34135
+ var _a247, _b170, MySqlCharBuilder, _a248, _b171, MySqlChar;
33247
34136
  var init_char2 = __esm({
33248
34137
  "../drizzle-orm/dist/mysql-core/columns/char.js"() {
33249
34138
  "use strict";
33250
34139
  init_entity();
33251
34140
  init_utils2();
33252
34141
  init_common4();
33253
- MySqlCharBuilder = class extends (_b170 = MySqlColumnBuilder, _a245 = entityKind, _b170) {
34142
+ MySqlCharBuilder = class extends (_b170 = MySqlColumnBuilder, _a247 = entityKind, _b170) {
33254
34143
  constructor(name2, config) {
33255
34144
  super(name2, "string", "MySqlChar");
33256
34145
  this.config.length = config.length;
@@ -33264,8 +34153,8 @@ var init_char2 = __esm({
33264
34153
  );
33265
34154
  }
33266
34155
  };
33267
- __publicField(MySqlCharBuilder, _a245, "MySqlCharBuilder");
33268
- MySqlChar = class extends (_b171 = MySqlColumn, _a246 = entityKind, _b171) {
34156
+ __publicField(MySqlCharBuilder, _a247, "MySqlCharBuilder");
34157
+ MySqlChar = class extends (_b171 = MySqlColumn, _a248 = entityKind, _b171) {
33269
34158
  constructor() {
33270
34159
  super(...arguments);
33271
34160
  __publicField(this, "length", this.config.length);
@@ -33275,7 +34164,7 @@ var init_char2 = __esm({
33275
34164
  return this.length === void 0 ? `char` : `char(${this.length})`;
33276
34165
  }
33277
34166
  };
33278
- __publicField(MySqlChar, _a246, "MySqlChar");
34167
+ __publicField(MySqlChar, _a248, "MySqlChar");
33279
34168
  }
33280
34169
  });
33281
34170
 
@@ -33286,14 +34175,14 @@ function customType3(customTypeParams) {
33286
34175
  return new MySqlCustomColumnBuilder(name2, config, customTypeParams);
33287
34176
  };
33288
34177
  }
33289
- var _a247, _b172, MySqlCustomColumnBuilder, _a248, _b173, MySqlCustomColumn;
34178
+ var _a249, _b172, MySqlCustomColumnBuilder, _a250, _b173, MySqlCustomColumn;
33290
34179
  var init_custom3 = __esm({
33291
34180
  "../drizzle-orm/dist/mysql-core/columns/custom.js"() {
33292
34181
  "use strict";
33293
34182
  init_entity();
33294
34183
  init_utils2();
33295
34184
  init_common4();
33296
- MySqlCustomColumnBuilder = class extends (_b172 = MySqlColumnBuilder, _a247 = entityKind, _b172) {
34185
+ MySqlCustomColumnBuilder = class extends (_b172 = MySqlColumnBuilder, _a249 = entityKind, _b172) {
33297
34186
  constructor(name2, fieldConfig, customTypeParams) {
33298
34187
  super(name2, "custom", "MySqlCustomColumn");
33299
34188
  this.config.fieldConfig = fieldConfig;
@@ -33307,8 +34196,8 @@ var init_custom3 = __esm({
33307
34196
  );
33308
34197
  }
33309
34198
  };
33310
- __publicField(MySqlCustomColumnBuilder, _a247, "MySqlCustomColumnBuilder");
33311
- MySqlCustomColumn = class extends (_b173 = MySqlColumn, _a248 = entityKind, _b173) {
34199
+ __publicField(MySqlCustomColumnBuilder, _a249, "MySqlCustomColumnBuilder");
34200
+ MySqlCustomColumn = class extends (_b173 = MySqlColumn, _a250 = entityKind, _b173) {
33312
34201
  constructor(table4, config) {
33313
34202
  super(table4, config);
33314
34203
  __publicField(this, "sqlName");
@@ -33328,7 +34217,7 @@ var init_custom3 = __esm({
33328
34217
  return typeof this.mapTo === "function" ? this.mapTo(value) : value;
33329
34218
  }
33330
34219
  };
33331
- __publicField(MySqlCustomColumn, _a248, "MySqlCustomColumn");
34220
+ __publicField(MySqlCustomColumn, _a250, "MySqlCustomColumn");
33332
34221
  }
33333
34222
  });
33334
34223
 
@@ -33340,14 +34229,14 @@ function date2(a, b) {
33340
34229
  }
33341
34230
  return new MySqlDateBuilder(name2);
33342
34231
  }
33343
- var _a249, _b174, MySqlDateBuilder, _a250, _b175, MySqlDate, _a251, _b176, MySqlDateStringBuilder, _a252, _b177, MySqlDateString;
34232
+ var _a251, _b174, MySqlDateBuilder, _a252, _b175, MySqlDate, _a253, _b176, MySqlDateStringBuilder, _a254, _b177, MySqlDateString;
33344
34233
  var init_date2 = __esm({
33345
34234
  "../drizzle-orm/dist/mysql-core/columns/date.js"() {
33346
34235
  "use strict";
33347
34236
  init_entity();
33348
34237
  init_utils2();
33349
34238
  init_common4();
33350
- MySqlDateBuilder = class extends (_b174 = MySqlColumnBuilder, _a249 = entityKind, _b174) {
34239
+ MySqlDateBuilder = class extends (_b174 = MySqlColumnBuilder, _a251 = entityKind, _b174) {
33351
34240
  constructor(name2) {
33352
34241
  super(name2, "date", "MySqlDate");
33353
34242
  }
@@ -33356,8 +34245,8 @@ var init_date2 = __esm({
33356
34245
  return new MySqlDate(table4, this.config);
33357
34246
  }
33358
34247
  };
33359
- __publicField(MySqlDateBuilder, _a249, "MySqlDateBuilder");
33360
- MySqlDate = class extends (_b175 = MySqlColumn, _a250 = entityKind, _b175) {
34248
+ __publicField(MySqlDateBuilder, _a251, "MySqlDateBuilder");
34249
+ MySqlDate = class extends (_b175 = MySqlColumn, _a252 = entityKind, _b175) {
33361
34250
  constructor(table4, config) {
33362
34251
  super(table4, config);
33363
34252
  }
@@ -33368,8 +34257,8 @@ var init_date2 = __esm({
33368
34257
  return new Date(value);
33369
34258
  }
33370
34259
  };
33371
- __publicField(MySqlDate, _a250, "MySqlDate");
33372
- MySqlDateStringBuilder = class extends (_b176 = MySqlColumnBuilder, _a251 = entityKind, _b176) {
34260
+ __publicField(MySqlDate, _a252, "MySqlDate");
34261
+ MySqlDateStringBuilder = class extends (_b176 = MySqlColumnBuilder, _a253 = entityKind, _b176) {
33373
34262
  constructor(name2) {
33374
34263
  super(name2, "string", "MySqlDateString");
33375
34264
  }
@@ -33381,8 +34270,8 @@ var init_date2 = __esm({
33381
34270
  );
33382
34271
  }
33383
34272
  };
33384
- __publicField(MySqlDateStringBuilder, _a251, "MySqlDateStringBuilder");
33385
- MySqlDateString = class extends (_b177 = MySqlColumn, _a252 = entityKind, _b177) {
34273
+ __publicField(MySqlDateStringBuilder, _a253, "MySqlDateStringBuilder");
34274
+ MySqlDateString = class extends (_b177 = MySqlColumn, _a254 = entityKind, _b177) {
33386
34275
  constructor(table4, config) {
33387
34276
  super(table4, config);
33388
34277
  }
@@ -33390,7 +34279,7 @@ var init_date2 = __esm({
33390
34279
  return `date`;
33391
34280
  }
33392
34281
  };
33393
- __publicField(MySqlDateString, _a252, "MySqlDateString");
34282
+ __publicField(MySqlDateString, _a254, "MySqlDateString");
33394
34283
  }
33395
34284
  });
33396
34285
 
@@ -33402,14 +34291,14 @@ function datetime(a, b) {
33402
34291
  }
33403
34292
  return new MySqlDateTimeBuilder(name2, config);
33404
34293
  }
33405
- var _a253, _b178, MySqlDateTimeBuilder, _a254, _b179, MySqlDateTime, _a255, _b180, MySqlDateTimeStringBuilder, _a256, _b181, MySqlDateTimeString;
34294
+ var _a255, _b178, MySqlDateTimeBuilder, _a256, _b179, MySqlDateTime, _a257, _b180, MySqlDateTimeStringBuilder, _a258, _b181, MySqlDateTimeString;
33406
34295
  var init_datetime = __esm({
33407
34296
  "../drizzle-orm/dist/mysql-core/columns/datetime.js"() {
33408
34297
  "use strict";
33409
34298
  init_entity();
33410
34299
  init_utils2();
33411
34300
  init_common4();
33412
- MySqlDateTimeBuilder = class extends (_b178 = MySqlColumnBuilder, _a253 = entityKind, _b178) {
34301
+ MySqlDateTimeBuilder = class extends (_b178 = MySqlColumnBuilder, _a255 = entityKind, _b178) {
33413
34302
  constructor(name2, config) {
33414
34303
  super(name2, "date", "MySqlDateTime");
33415
34304
  this.config.fsp = config?.fsp;
@@ -33422,8 +34311,8 @@ var init_datetime = __esm({
33422
34311
  );
33423
34312
  }
33424
34313
  };
33425
- __publicField(MySqlDateTimeBuilder, _a253, "MySqlDateTimeBuilder");
33426
- MySqlDateTime = class extends (_b179 = MySqlColumn, _a254 = entityKind, _b179) {
34314
+ __publicField(MySqlDateTimeBuilder, _a255, "MySqlDateTimeBuilder");
34315
+ MySqlDateTime = class extends (_b179 = MySqlColumn, _a256 = entityKind, _b179) {
33427
34316
  constructor(table4, config) {
33428
34317
  super(table4, config);
33429
34318
  __publicField(this, "fsp");
@@ -33440,8 +34329,8 @@ var init_datetime = __esm({
33440
34329
  return /* @__PURE__ */ new Date(value.replace(" ", "T") + "Z");
33441
34330
  }
33442
34331
  };
33443
- __publicField(MySqlDateTime, _a254, "MySqlDateTime");
33444
- MySqlDateTimeStringBuilder = class extends (_b180 = MySqlColumnBuilder, _a255 = entityKind, _b180) {
34332
+ __publicField(MySqlDateTime, _a256, "MySqlDateTime");
34333
+ MySqlDateTimeStringBuilder = class extends (_b180 = MySqlColumnBuilder, _a257 = entityKind, _b180) {
33445
34334
  constructor(name2, config) {
33446
34335
  super(name2, "string", "MySqlDateTimeString");
33447
34336
  this.config.fsp = config?.fsp;
@@ -33454,8 +34343,8 @@ var init_datetime = __esm({
33454
34343
  );
33455
34344
  }
33456
34345
  };
33457
- __publicField(MySqlDateTimeStringBuilder, _a255, "MySqlDateTimeStringBuilder");
33458
- MySqlDateTimeString = class extends (_b181 = MySqlColumn, _a256 = entityKind, _b181) {
34346
+ __publicField(MySqlDateTimeStringBuilder, _a257, "MySqlDateTimeStringBuilder");
34347
+ MySqlDateTimeString = class extends (_b181 = MySqlColumn, _a258 = entityKind, _b181) {
33459
34348
  constructor(table4, config) {
33460
34349
  super(table4, config);
33461
34350
  __publicField(this, "fsp");
@@ -33466,7 +34355,7 @@ var init_datetime = __esm({
33466
34355
  return `datetime${precision}`;
33467
34356
  }
33468
34357
  };
33469
- __publicField(MySqlDateTimeString, _a256, "MySqlDateTimeString");
34358
+ __publicField(MySqlDateTimeString, _a258, "MySqlDateTimeString");
33470
34359
  }
33471
34360
  });
33472
34361
 
@@ -33475,14 +34364,14 @@ function decimal(a, b = {}) {
33475
34364
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33476
34365
  return new MySqlDecimalBuilder(name2, config.precision, config.scale);
33477
34366
  }
33478
- var _a257, _b182, MySqlDecimalBuilder, _a258, _b183, MySqlDecimal;
34367
+ var _a259, _b182, MySqlDecimalBuilder, _a260, _b183, MySqlDecimal;
33479
34368
  var init_decimal = __esm({
33480
34369
  "../drizzle-orm/dist/mysql-core/columns/decimal.js"() {
33481
34370
  "use strict";
33482
34371
  init_entity();
33483
34372
  init_utils2();
33484
34373
  init_common4();
33485
- MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a257 = entityKind, _b182) {
34374
+ MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b182) {
33486
34375
  constructor(name2, precision, scale) {
33487
34376
  super(name2, "string", "MySqlDecimal");
33488
34377
  this.config.precision = precision;
@@ -33496,8 +34385,8 @@ var init_decimal = __esm({
33496
34385
  );
33497
34386
  }
33498
34387
  };
33499
- __publicField(MySqlDecimalBuilder, _a257, "MySqlDecimalBuilder");
33500
- MySqlDecimal = class extends (_b183 = MySqlColumnWithAutoIncrement, _a258 = entityKind, _b183) {
34388
+ __publicField(MySqlDecimalBuilder, _a259, "MySqlDecimalBuilder");
34389
+ MySqlDecimal = class extends (_b183 = MySqlColumnWithAutoIncrement, _a260 = entityKind, _b183) {
33501
34390
  constructor() {
33502
34391
  super(...arguments);
33503
34392
  __publicField(this, "precision", this.config.precision);
@@ -33513,7 +34402,7 @@ var init_decimal = __esm({
33513
34402
  }
33514
34403
  }
33515
34404
  };
33516
- __publicField(MySqlDecimal, _a258, "MySqlDecimal");
34405
+ __publicField(MySqlDecimal, _a260, "MySqlDecimal");
33517
34406
  }
33518
34407
  });
33519
34408
 
@@ -33522,14 +34411,14 @@ function double(a, b) {
33522
34411
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33523
34412
  return new MySqlDoubleBuilder(name2, config);
33524
34413
  }
33525
- var _a259, _b184, MySqlDoubleBuilder, _a260, _b185, MySqlDouble;
34414
+ var _a261, _b184, MySqlDoubleBuilder, _a262, _b185, MySqlDouble;
33526
34415
  var init_double = __esm({
33527
34416
  "../drizzle-orm/dist/mysql-core/columns/double.js"() {
33528
34417
  "use strict";
33529
34418
  init_entity();
33530
34419
  init_utils2();
33531
34420
  init_common4();
33532
- MySqlDoubleBuilder = class extends (_b184 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b184) {
34421
+ MySqlDoubleBuilder = class extends (_b184 = MySqlColumnBuilderWithAutoIncrement, _a261 = entityKind, _b184) {
33533
34422
  constructor(name2, config) {
33534
34423
  super(name2, "number", "MySqlDouble");
33535
34424
  this.config.precision = config?.precision;
@@ -33540,8 +34429,8 @@ var init_double = __esm({
33540
34429
  return new MySqlDouble(table4, this.config);
33541
34430
  }
33542
34431
  };
33543
- __publicField(MySqlDoubleBuilder, _a259, "MySqlDoubleBuilder");
33544
- MySqlDouble = class extends (_b185 = MySqlColumnWithAutoIncrement, _a260 = entityKind, _b185) {
34432
+ __publicField(MySqlDoubleBuilder, _a261, "MySqlDoubleBuilder");
34433
+ MySqlDouble = class extends (_b185 = MySqlColumnWithAutoIncrement, _a262 = entityKind, _b185) {
33545
34434
  constructor() {
33546
34435
  super(...arguments);
33547
34436
  __publicField(this, "precision", this.config.precision);
@@ -33557,7 +34446,7 @@ var init_double = __esm({
33557
34446
  }
33558
34447
  }
33559
34448
  };
33560
- __publicField(MySqlDouble, _a260, "MySqlDouble");
34449
+ __publicField(MySqlDouble, _a262, "MySqlDouble");
33561
34450
  }
33562
34451
  });
33563
34452
 
@@ -33569,14 +34458,14 @@ function mysqlEnum(a, b) {
33569
34458
  }
33570
34459
  return new MySqlEnumColumnBuilder(name2, values);
33571
34460
  }
33572
- var _a261, _b186, MySqlEnumColumnBuilder, _a262, _b187, MySqlEnumColumn;
34461
+ var _a263, _b186, MySqlEnumColumnBuilder, _a264, _b187, MySqlEnumColumn;
33573
34462
  var init_enum2 = __esm({
33574
34463
  "../drizzle-orm/dist/mysql-core/columns/enum.js"() {
33575
34464
  "use strict";
33576
34465
  init_entity();
33577
34466
  init_utils2();
33578
34467
  init_common4();
33579
- MySqlEnumColumnBuilder = class extends (_b186 = MySqlColumnBuilder, _a261 = entityKind, _b186) {
34468
+ MySqlEnumColumnBuilder = class extends (_b186 = MySqlColumnBuilder, _a263 = entityKind, _b186) {
33580
34469
  constructor(name2, values) {
33581
34470
  super(name2, "string", "MySqlEnumColumn");
33582
34471
  this.config.enumValues = values;
@@ -33589,8 +34478,8 @@ var init_enum2 = __esm({
33589
34478
  );
33590
34479
  }
33591
34480
  };
33592
- __publicField(MySqlEnumColumnBuilder, _a261, "MySqlEnumColumnBuilder");
33593
- MySqlEnumColumn = class extends (_b187 = MySqlColumn, _a262 = entityKind, _b187) {
34481
+ __publicField(MySqlEnumColumnBuilder, _a263, "MySqlEnumColumnBuilder");
34482
+ MySqlEnumColumn = class extends (_b187 = MySqlColumn, _a264 = entityKind, _b187) {
33594
34483
  constructor() {
33595
34484
  super(...arguments);
33596
34485
  __publicField(this, "enumValues", this.config.enumValues);
@@ -33599,7 +34488,7 @@ var init_enum2 = __esm({
33599
34488
  return `enum(${this.enumValues.map((value) => `'${value}'`).join(",")})`;
33600
34489
  }
33601
34490
  };
33602
- __publicField(MySqlEnumColumn, _a262, "MySqlEnumColumn");
34491
+ __publicField(MySqlEnumColumn, _a264, "MySqlEnumColumn");
33603
34492
  }
33604
34493
  });
33605
34494
 
@@ -33607,13 +34496,13 @@ var init_enum2 = __esm({
33607
34496
  function float(name2) {
33608
34497
  return new MySqlFloatBuilder(name2 ?? "");
33609
34498
  }
33610
- var _a263, _b188, MySqlFloatBuilder, _a264, _b189, MySqlFloat;
34499
+ var _a265, _b188, MySqlFloatBuilder, _a266, _b189, MySqlFloat;
33611
34500
  var init_float = __esm({
33612
34501
  "../drizzle-orm/dist/mysql-core/columns/float.js"() {
33613
34502
  "use strict";
33614
34503
  init_entity();
33615
34504
  init_common4();
33616
- MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a263 = entityKind, _b188) {
34505
+ MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b188) {
33617
34506
  constructor(name2) {
33618
34507
  super(name2, "number", "MySqlFloat");
33619
34508
  }
@@ -33622,13 +34511,13 @@ var init_float = __esm({
33622
34511
  return new MySqlFloat(table4, this.config);
33623
34512
  }
33624
34513
  };
33625
- __publicField(MySqlFloatBuilder, _a263, "MySqlFloatBuilder");
33626
- MySqlFloat = class extends (_b189 = MySqlColumnWithAutoIncrement, _a264 = entityKind, _b189) {
34514
+ __publicField(MySqlFloatBuilder, _a265, "MySqlFloatBuilder");
34515
+ MySqlFloat = class extends (_b189 = MySqlColumnWithAutoIncrement, _a266 = entityKind, _b189) {
33627
34516
  getSQLType() {
33628
34517
  return "float";
33629
34518
  }
33630
34519
  };
33631
- __publicField(MySqlFloat, _a264, "MySqlFloat");
34520
+ __publicField(MySqlFloat, _a266, "MySqlFloat");
33632
34521
  }
33633
34522
  });
33634
34523
 
@@ -33637,14 +34526,14 @@ function int(a, b) {
33637
34526
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33638
34527
  return new MySqlIntBuilder(name2, config);
33639
34528
  }
33640
- var _a265, _b190, MySqlIntBuilder, _a266, _b191, MySqlInt;
34529
+ var _a267, _b190, MySqlIntBuilder, _a268, _b191, MySqlInt;
33641
34530
  var init_int = __esm({
33642
34531
  "../drizzle-orm/dist/mysql-core/columns/int.js"() {
33643
34532
  "use strict";
33644
34533
  init_entity();
33645
34534
  init_utils2();
33646
34535
  init_common4();
33647
- MySqlIntBuilder = class extends (_b190 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b190) {
34536
+ MySqlIntBuilder = class extends (_b190 = MySqlColumnBuilderWithAutoIncrement, _a267 = entityKind, _b190) {
33648
34537
  constructor(name2, config) {
33649
34538
  super(name2, "number", "MySqlInt");
33650
34539
  this.config.unsigned = config ? config.unsigned : false;
@@ -33654,8 +34543,8 @@ var init_int = __esm({
33654
34543
  return new MySqlInt(table4, this.config);
33655
34544
  }
33656
34545
  };
33657
- __publicField(MySqlIntBuilder, _a265, "MySqlIntBuilder");
33658
- MySqlInt = class extends (_b191 = MySqlColumnWithAutoIncrement, _a266 = entityKind, _b191) {
34546
+ __publicField(MySqlIntBuilder, _a267, "MySqlIntBuilder");
34547
+ MySqlInt = class extends (_b191 = MySqlColumnWithAutoIncrement, _a268 = entityKind, _b191) {
33659
34548
  getSQLType() {
33660
34549
  return `int${this.config.unsigned ? " unsigned" : ""}`;
33661
34550
  }
@@ -33666,7 +34555,7 @@ var init_int = __esm({
33666
34555
  return value;
33667
34556
  }
33668
34557
  };
33669
- __publicField(MySqlInt, _a266, "MySqlInt");
34558
+ __publicField(MySqlInt, _a268, "MySqlInt");
33670
34559
  }
33671
34560
  });
33672
34561
 
@@ -33674,13 +34563,13 @@ var init_int = __esm({
33674
34563
  function json2(name2) {
33675
34564
  return new MySqlJsonBuilder(name2 ?? "");
33676
34565
  }
33677
- var _a267, _b192, MySqlJsonBuilder, _a268, _b193, MySqlJson;
34566
+ var _a269, _b192, MySqlJsonBuilder, _a270, _b193, MySqlJson;
33678
34567
  var init_json2 = __esm({
33679
34568
  "../drizzle-orm/dist/mysql-core/columns/json.js"() {
33680
34569
  "use strict";
33681
34570
  init_entity();
33682
34571
  init_common4();
33683
- MySqlJsonBuilder = class extends (_b192 = MySqlColumnBuilder, _a267 = entityKind, _b192) {
34572
+ MySqlJsonBuilder = class extends (_b192 = MySqlColumnBuilder, _a269 = entityKind, _b192) {
33684
34573
  constructor(name2) {
33685
34574
  super(name2, "json", "MySqlJson");
33686
34575
  }
@@ -33689,8 +34578,8 @@ var init_json2 = __esm({
33689
34578
  return new MySqlJson(table4, this.config);
33690
34579
  }
33691
34580
  };
33692
- __publicField(MySqlJsonBuilder, _a267, "MySqlJsonBuilder");
33693
- MySqlJson = class extends (_b193 = MySqlColumn, _a268 = entityKind, _b193) {
34581
+ __publicField(MySqlJsonBuilder, _a269, "MySqlJsonBuilder");
34582
+ MySqlJson = class extends (_b193 = MySqlColumn, _a270 = entityKind, _b193) {
33694
34583
  getSQLType() {
33695
34584
  return "json";
33696
34585
  }
@@ -33698,7 +34587,7 @@ var init_json2 = __esm({
33698
34587
  return JSON.stringify(value);
33699
34588
  }
33700
34589
  };
33701
- __publicField(MySqlJson, _a268, "MySqlJson");
34590
+ __publicField(MySqlJson, _a270, "MySqlJson");
33702
34591
  }
33703
34592
  });
33704
34593
 
@@ -33707,14 +34596,14 @@ function mediumint(a, b) {
33707
34596
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33708
34597
  return new MySqlMediumIntBuilder(name2, config);
33709
34598
  }
33710
- var _a269, _b194, MySqlMediumIntBuilder, _a270, _b195, MySqlMediumInt;
34599
+ var _a271, _b194, MySqlMediumIntBuilder, _a272, _b195, MySqlMediumInt;
33711
34600
  var init_mediumint = __esm({
33712
34601
  "../drizzle-orm/dist/mysql-core/columns/mediumint.js"() {
33713
34602
  "use strict";
33714
34603
  init_entity();
33715
34604
  init_utils2();
33716
34605
  init_common4();
33717
- MySqlMediumIntBuilder = class extends (_b194 = MySqlColumnBuilderWithAutoIncrement, _a269 = entityKind, _b194) {
34606
+ MySqlMediumIntBuilder = class extends (_b194 = MySqlColumnBuilderWithAutoIncrement, _a271 = entityKind, _b194) {
33718
34607
  constructor(name2, config) {
33719
34608
  super(name2, "number", "MySqlMediumInt");
33720
34609
  this.config.unsigned = config ? config.unsigned : false;
@@ -33727,8 +34616,8 @@ var init_mediumint = __esm({
33727
34616
  );
33728
34617
  }
33729
34618
  };
33730
- __publicField(MySqlMediumIntBuilder, _a269, "MySqlMediumIntBuilder");
33731
- MySqlMediumInt = class extends (_b195 = MySqlColumnWithAutoIncrement, _a270 = entityKind, _b195) {
34619
+ __publicField(MySqlMediumIntBuilder, _a271, "MySqlMediumIntBuilder");
34620
+ MySqlMediumInt = class extends (_b195 = MySqlColumnWithAutoIncrement, _a272 = entityKind, _b195) {
33732
34621
  getSQLType() {
33733
34622
  return `mediumint${this.config.unsigned ? " unsigned" : ""}`;
33734
34623
  }
@@ -33739,7 +34628,7 @@ var init_mediumint = __esm({
33739
34628
  return value;
33740
34629
  }
33741
34630
  };
33742
- __publicField(MySqlMediumInt, _a270, "MySqlMediumInt");
34631
+ __publicField(MySqlMediumInt, _a272, "MySqlMediumInt");
33743
34632
  }
33744
34633
  });
33745
34634
 
@@ -33748,14 +34637,14 @@ function real3(a, b = {}) {
33748
34637
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33749
34638
  return new MySqlRealBuilder(name2, config);
33750
34639
  }
33751
- var _a271, _b196, MySqlRealBuilder, _a272, _b197, MySqlReal;
34640
+ var _a273, _b196, MySqlRealBuilder, _a274, _b197, MySqlReal;
33752
34641
  var init_real3 = __esm({
33753
34642
  "../drizzle-orm/dist/mysql-core/columns/real.js"() {
33754
34643
  "use strict";
33755
34644
  init_entity();
33756
34645
  init_utils2();
33757
34646
  init_common4();
33758
- MySqlRealBuilder = class extends (_b196 = MySqlColumnBuilderWithAutoIncrement, _a271 = entityKind, _b196) {
34647
+ MySqlRealBuilder = class extends (_b196 = MySqlColumnBuilderWithAutoIncrement, _a273 = entityKind, _b196) {
33759
34648
  constructor(name2, config) {
33760
34649
  super(name2, "number", "MySqlReal");
33761
34650
  this.config.precision = config?.precision;
@@ -33766,8 +34655,8 @@ var init_real3 = __esm({
33766
34655
  return new MySqlReal(table4, this.config);
33767
34656
  }
33768
34657
  };
33769
- __publicField(MySqlRealBuilder, _a271, "MySqlRealBuilder");
33770
- MySqlReal = class extends (_b197 = MySqlColumnWithAutoIncrement, _a272 = entityKind, _b197) {
34658
+ __publicField(MySqlRealBuilder, _a273, "MySqlRealBuilder");
34659
+ MySqlReal = class extends (_b197 = MySqlColumnWithAutoIncrement, _a274 = entityKind, _b197) {
33771
34660
  constructor() {
33772
34661
  super(...arguments);
33773
34662
  __publicField(this, "precision", this.config.precision);
@@ -33783,7 +34672,7 @@ var init_real3 = __esm({
33783
34672
  }
33784
34673
  }
33785
34674
  };
33786
- __publicField(MySqlReal, _a272, "MySqlReal");
34675
+ __publicField(MySqlReal, _a274, "MySqlReal");
33787
34676
  }
33788
34677
  });
33789
34678
 
@@ -33791,13 +34680,13 @@ var init_real3 = __esm({
33791
34680
  function serial2(name2) {
33792
34681
  return new MySqlSerialBuilder(name2 ?? "");
33793
34682
  }
33794
- var _a273, _b198, MySqlSerialBuilder, _a274, _b199, MySqlSerial;
34683
+ var _a275, _b198, MySqlSerialBuilder, _a276, _b199, MySqlSerial;
33795
34684
  var init_serial2 = __esm({
33796
34685
  "../drizzle-orm/dist/mysql-core/columns/serial.js"() {
33797
34686
  "use strict";
33798
34687
  init_entity();
33799
34688
  init_common4();
33800
- MySqlSerialBuilder = class extends (_b198 = MySqlColumnBuilderWithAutoIncrement, _a273 = entityKind, _b198) {
34689
+ MySqlSerialBuilder = class extends (_b198 = MySqlColumnBuilderWithAutoIncrement, _a275 = entityKind, _b198) {
33801
34690
  constructor(name2) {
33802
34691
  super(name2, "number", "MySqlSerial");
33803
34692
  this.config.hasDefault = true;
@@ -33808,8 +34697,8 @@ var init_serial2 = __esm({
33808
34697
  return new MySqlSerial(table4, this.config);
33809
34698
  }
33810
34699
  };
33811
- __publicField(MySqlSerialBuilder, _a273, "MySqlSerialBuilder");
33812
- MySqlSerial = class extends (_b199 = MySqlColumnWithAutoIncrement, _a274 = entityKind, _b199) {
34700
+ __publicField(MySqlSerialBuilder, _a275, "MySqlSerialBuilder");
34701
+ MySqlSerial = class extends (_b199 = MySqlColumnWithAutoIncrement, _a276 = entityKind, _b199) {
33813
34702
  getSQLType() {
33814
34703
  return "serial";
33815
34704
  }
@@ -33820,7 +34709,7 @@ var init_serial2 = __esm({
33820
34709
  return value;
33821
34710
  }
33822
34711
  };
33823
- __publicField(MySqlSerial, _a274, "MySqlSerial");
34712
+ __publicField(MySqlSerial, _a276, "MySqlSerial");
33824
34713
  }
33825
34714
  });
33826
34715
 
@@ -33829,14 +34718,14 @@ function smallint2(a, b) {
33829
34718
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33830
34719
  return new MySqlSmallIntBuilder(name2, config);
33831
34720
  }
33832
- var _a275, _b200, MySqlSmallIntBuilder, _a276, _b201, MySqlSmallInt;
34721
+ var _a277, _b200, MySqlSmallIntBuilder, _a278, _b201, MySqlSmallInt;
33833
34722
  var init_smallint2 = __esm({
33834
34723
  "../drizzle-orm/dist/mysql-core/columns/smallint.js"() {
33835
34724
  "use strict";
33836
34725
  init_entity();
33837
34726
  init_utils2();
33838
34727
  init_common4();
33839
- MySqlSmallIntBuilder = class extends (_b200 = MySqlColumnBuilderWithAutoIncrement, _a275 = entityKind, _b200) {
34728
+ MySqlSmallIntBuilder = class extends (_b200 = MySqlColumnBuilderWithAutoIncrement, _a277 = entityKind, _b200) {
33840
34729
  constructor(name2, config) {
33841
34730
  super(name2, "number", "MySqlSmallInt");
33842
34731
  this.config.unsigned = config ? config.unsigned : false;
@@ -33849,8 +34738,8 @@ var init_smallint2 = __esm({
33849
34738
  );
33850
34739
  }
33851
34740
  };
33852
- __publicField(MySqlSmallIntBuilder, _a275, "MySqlSmallIntBuilder");
33853
- MySqlSmallInt = class extends (_b201 = MySqlColumnWithAutoIncrement, _a276 = entityKind, _b201) {
34741
+ __publicField(MySqlSmallIntBuilder, _a277, "MySqlSmallIntBuilder");
34742
+ MySqlSmallInt = class extends (_b201 = MySqlColumnWithAutoIncrement, _a278 = entityKind, _b201) {
33854
34743
  getSQLType() {
33855
34744
  return `smallint${this.config.unsigned ? " unsigned" : ""}`;
33856
34745
  }
@@ -33861,7 +34750,7 @@ var init_smallint2 = __esm({
33861
34750
  return value;
33862
34751
  }
33863
34752
  };
33864
- __publicField(MySqlSmallInt, _a276, "MySqlSmallInt");
34753
+ __publicField(MySqlSmallInt, _a278, "MySqlSmallInt");
33865
34754
  }
33866
34755
  });
33867
34756
 
@@ -33870,14 +34759,14 @@ function text3(a, b = {}) {
33870
34759
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33871
34760
  return new MySqlTextBuilder(name2, "text", config);
33872
34761
  }
33873
- var _a277, _b202, MySqlTextBuilder, _a278, _b203, MySqlText;
34762
+ var _a279, _b202, MySqlTextBuilder, _a280, _b203, MySqlText;
33874
34763
  var init_text3 = __esm({
33875
34764
  "../drizzle-orm/dist/mysql-core/columns/text.js"() {
33876
34765
  "use strict";
33877
34766
  init_entity();
33878
34767
  init_utils2();
33879
34768
  init_common4();
33880
- MySqlTextBuilder = class extends (_b202 = MySqlColumnBuilder, _a277 = entityKind, _b202) {
34769
+ MySqlTextBuilder = class extends (_b202 = MySqlColumnBuilder, _a279 = entityKind, _b202) {
33881
34770
  constructor(name2, textType, config) {
33882
34771
  super(name2, "string", "MySqlText");
33883
34772
  this.config.textType = textType;
@@ -33888,8 +34777,8 @@ var init_text3 = __esm({
33888
34777
  return new MySqlText(table4, this.config);
33889
34778
  }
33890
34779
  };
33891
- __publicField(MySqlTextBuilder, _a277, "MySqlTextBuilder");
33892
- MySqlText = class extends (_b203 = MySqlColumn, _a278 = entityKind, _b203) {
34780
+ __publicField(MySqlTextBuilder, _a279, "MySqlTextBuilder");
34781
+ MySqlText = class extends (_b203 = MySqlColumn, _a280 = entityKind, _b203) {
33893
34782
  constructor() {
33894
34783
  super(...arguments);
33895
34784
  __publicField(this, "textType", this.config.textType);
@@ -33899,7 +34788,7 @@ var init_text3 = __esm({
33899
34788
  return this.textType;
33900
34789
  }
33901
34790
  };
33902
- __publicField(MySqlText, _a278, "MySqlText");
34791
+ __publicField(MySqlText, _a280, "MySqlText");
33903
34792
  }
33904
34793
  });
33905
34794
 
@@ -33908,14 +34797,14 @@ function time2(a, b) {
33908
34797
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33909
34798
  return new MySqlTimeBuilder(name2, config);
33910
34799
  }
33911
- var _a279, _b204, MySqlTimeBuilder, _a280, _b205, MySqlTime;
34800
+ var _a281, _b204, MySqlTimeBuilder, _a282, _b205, MySqlTime;
33912
34801
  var init_time2 = __esm({
33913
34802
  "../drizzle-orm/dist/mysql-core/columns/time.js"() {
33914
34803
  "use strict";
33915
34804
  init_entity();
33916
34805
  init_utils2();
33917
34806
  init_common4();
33918
- MySqlTimeBuilder = class extends (_b204 = MySqlColumnBuilder, _a279 = entityKind, _b204) {
34807
+ MySqlTimeBuilder = class extends (_b204 = MySqlColumnBuilder, _a281 = entityKind, _b204) {
33919
34808
  constructor(name2, config) {
33920
34809
  super(name2, "string", "MySqlTime");
33921
34810
  this.config.fsp = config?.fsp;
@@ -33925,8 +34814,8 @@ var init_time2 = __esm({
33925
34814
  return new MySqlTime(table4, this.config);
33926
34815
  }
33927
34816
  };
33928
- __publicField(MySqlTimeBuilder, _a279, "MySqlTimeBuilder");
33929
- MySqlTime = class extends (_b205 = MySqlColumn, _a280 = entityKind, _b205) {
34817
+ __publicField(MySqlTimeBuilder, _a281, "MySqlTimeBuilder");
34818
+ MySqlTime = class extends (_b205 = MySqlColumn, _a282 = entityKind, _b205) {
33930
34819
  constructor() {
33931
34820
  super(...arguments);
33932
34821
  __publicField(this, "fsp", this.config.fsp);
@@ -33936,19 +34825,19 @@ var init_time2 = __esm({
33936
34825
  return `time${precision}`;
33937
34826
  }
33938
34827
  };
33939
- __publicField(MySqlTime, _a280, "MySqlTime");
34828
+ __publicField(MySqlTime, _a282, "MySqlTime");
33940
34829
  }
33941
34830
  });
33942
34831
 
33943
34832
  // ../drizzle-orm/dist/mysql-core/columns/date.common.js
33944
- var _a281, _b206, MySqlDateColumnBaseBuilder, _a282, _b207, MySqlDateBaseColumn;
34833
+ var _a283, _b206, MySqlDateColumnBaseBuilder, _a284, _b207, MySqlDateBaseColumn;
33945
34834
  var init_date_common2 = __esm({
33946
34835
  "../drizzle-orm/dist/mysql-core/columns/date.common.js"() {
33947
34836
  "use strict";
33948
34837
  init_entity();
33949
34838
  init_sql();
33950
34839
  init_common4();
33951
- MySqlDateColumnBaseBuilder = class extends (_b206 = MySqlColumnBuilder, _a281 = entityKind, _b206) {
34840
+ MySqlDateColumnBaseBuilder = class extends (_b206 = MySqlColumnBuilder, _a283 = entityKind, _b206) {
33952
34841
  defaultNow() {
33953
34842
  return this.default(sql`(now())`);
33954
34843
  }
@@ -33959,14 +34848,14 @@ var init_date_common2 = __esm({
33959
34848
  return this;
33960
34849
  }
33961
34850
  };
33962
- __publicField(MySqlDateColumnBaseBuilder, _a281, "MySqlDateColumnBuilder");
33963
- MySqlDateBaseColumn = class extends (_b207 = MySqlColumn, _a282 = entityKind, _b207) {
34851
+ __publicField(MySqlDateColumnBaseBuilder, _a283, "MySqlDateColumnBuilder");
34852
+ MySqlDateBaseColumn = class extends (_b207 = MySqlColumn, _a284 = entityKind, _b207) {
33964
34853
  constructor() {
33965
34854
  super(...arguments);
33966
34855
  __publicField(this, "hasOnUpdateNow", this.config.hasOnUpdateNow);
33967
34856
  }
33968
34857
  };
33969
- __publicField(MySqlDateBaseColumn, _a282, "MySqlDateColumn");
34858
+ __publicField(MySqlDateBaseColumn, _a284, "MySqlDateColumn");
33970
34859
  }
33971
34860
  });
33972
34861
 
@@ -33978,14 +34867,14 @@ function timestamp2(a, b = {}) {
33978
34867
  }
33979
34868
  return new MySqlTimestampBuilder(name2, config);
33980
34869
  }
33981
- var _a283, _b208, MySqlTimestampBuilder, _a284, _b209, MySqlTimestamp, _a285, _b210, MySqlTimestampStringBuilder, _a286, _b211, MySqlTimestampString;
34870
+ var _a285, _b208, MySqlTimestampBuilder, _a286, _b209, MySqlTimestamp, _a287, _b210, MySqlTimestampStringBuilder, _a288, _b211, MySqlTimestampString;
33982
34871
  var init_timestamp2 = __esm({
33983
34872
  "../drizzle-orm/dist/mysql-core/columns/timestamp.js"() {
33984
34873
  "use strict";
33985
34874
  init_entity();
33986
34875
  init_utils2();
33987
34876
  init_date_common2();
33988
- MySqlTimestampBuilder = class extends (_b208 = MySqlDateColumnBaseBuilder, _a283 = entityKind, _b208) {
34877
+ MySqlTimestampBuilder = class extends (_b208 = MySqlDateColumnBaseBuilder, _a285 = entityKind, _b208) {
33989
34878
  constructor(name2, config) {
33990
34879
  super(name2, "date", "MySqlTimestamp");
33991
34880
  this.config.fsp = config?.fsp;
@@ -33998,8 +34887,8 @@ var init_timestamp2 = __esm({
33998
34887
  );
33999
34888
  }
34000
34889
  };
34001
- __publicField(MySqlTimestampBuilder, _a283, "MySqlTimestampBuilder");
34002
- MySqlTimestamp = class extends (_b209 = MySqlDateBaseColumn, _a284 = entityKind, _b209) {
34890
+ __publicField(MySqlTimestampBuilder, _a285, "MySqlTimestampBuilder");
34891
+ MySqlTimestamp = class extends (_b209 = MySqlDateBaseColumn, _a286 = entityKind, _b209) {
34003
34892
  constructor() {
34004
34893
  super(...arguments);
34005
34894
  __publicField(this, "fsp", this.config.fsp);
@@ -34015,8 +34904,8 @@ var init_timestamp2 = __esm({
34015
34904
  return value.toISOString().slice(0, -1).replace("T", " ");
34016
34905
  }
34017
34906
  };
34018
- __publicField(MySqlTimestamp, _a284, "MySqlTimestamp");
34019
- MySqlTimestampStringBuilder = class extends (_b210 = MySqlDateColumnBaseBuilder, _a285 = entityKind, _b210) {
34907
+ __publicField(MySqlTimestamp, _a286, "MySqlTimestamp");
34908
+ MySqlTimestampStringBuilder = class extends (_b210 = MySqlDateColumnBaseBuilder, _a287 = entityKind, _b210) {
34020
34909
  constructor(name2, config) {
34021
34910
  super(name2, "string", "MySqlTimestampString");
34022
34911
  this.config.fsp = config?.fsp;
@@ -34029,8 +34918,8 @@ var init_timestamp2 = __esm({
34029
34918
  );
34030
34919
  }
34031
34920
  };
34032
- __publicField(MySqlTimestampStringBuilder, _a285, "MySqlTimestampStringBuilder");
34033
- MySqlTimestampString = class extends (_b211 = MySqlDateBaseColumn, _a286 = entityKind, _b211) {
34921
+ __publicField(MySqlTimestampStringBuilder, _a287, "MySqlTimestampStringBuilder");
34922
+ MySqlTimestampString = class extends (_b211 = MySqlDateBaseColumn, _a288 = entityKind, _b211) {
34034
34923
  constructor() {
34035
34924
  super(...arguments);
34036
34925
  __publicField(this, "fsp", this.config.fsp);
@@ -34040,7 +34929,7 @@ var init_timestamp2 = __esm({
34040
34929
  return `timestamp${precision}`;
34041
34930
  }
34042
34931
  };
34043
- __publicField(MySqlTimestampString, _a286, "MySqlTimestampString");
34932
+ __publicField(MySqlTimestampString, _a288, "MySqlTimestampString");
34044
34933
  }
34045
34934
  });
34046
34935
 
@@ -34049,14 +34938,14 @@ function tinyint(a, b) {
34049
34938
  const { name: name2, config } = getColumnNameAndConfig(a, b);
34050
34939
  return new MySqlTinyIntBuilder(name2, config);
34051
34940
  }
34052
- var _a287, _b212, MySqlTinyIntBuilder, _a288, _b213, MySqlTinyInt;
34941
+ var _a289, _b212, MySqlTinyIntBuilder, _a290, _b213, MySqlTinyInt;
34053
34942
  var init_tinyint = __esm({
34054
34943
  "../drizzle-orm/dist/mysql-core/columns/tinyint.js"() {
34055
34944
  "use strict";
34056
34945
  init_entity();
34057
34946
  init_utils2();
34058
34947
  init_common4();
34059
- MySqlTinyIntBuilder = class extends (_b212 = MySqlColumnBuilderWithAutoIncrement, _a287 = entityKind, _b212) {
34948
+ MySqlTinyIntBuilder = class extends (_b212 = MySqlColumnBuilderWithAutoIncrement, _a289 = entityKind, _b212) {
34060
34949
  constructor(name2, config) {
34061
34950
  super(name2, "number", "MySqlTinyInt");
34062
34951
  this.config.unsigned = config ? config.unsigned : false;
@@ -34069,8 +34958,8 @@ var init_tinyint = __esm({
34069
34958
  );
34070
34959
  }
34071
34960
  };
34072
- __publicField(MySqlTinyIntBuilder, _a287, "MySqlTinyIntBuilder");
34073
- MySqlTinyInt = class extends (_b213 = MySqlColumnWithAutoIncrement, _a288 = entityKind, _b213) {
34961
+ __publicField(MySqlTinyIntBuilder, _a289, "MySqlTinyIntBuilder");
34962
+ MySqlTinyInt = class extends (_b213 = MySqlColumnWithAutoIncrement, _a290 = entityKind, _b213) {
34074
34963
  getSQLType() {
34075
34964
  return `tinyint${this.config.unsigned ? " unsigned" : ""}`;
34076
34965
  }
@@ -34081,7 +34970,7 @@ var init_tinyint = __esm({
34081
34970
  return value;
34082
34971
  }
34083
34972
  };
34084
- __publicField(MySqlTinyInt, _a288, "MySqlTinyInt");
34973
+ __publicField(MySqlTinyInt, _a290, "MySqlTinyInt");
34085
34974
  }
34086
34975
  });
34087
34976
 
@@ -34090,14 +34979,14 @@ function varbinary(a, b) {
34090
34979
  const { name: name2, config } = getColumnNameAndConfig(a, b);
34091
34980
  return new MySqlVarBinaryBuilder(name2, config);
34092
34981
  }
34093
- var _a289, _b214, MySqlVarBinaryBuilder, _a290, _b215, MySqlVarBinary;
34982
+ var _a291, _b214, MySqlVarBinaryBuilder, _a292, _b215, MySqlVarBinary;
34094
34983
  var init_varbinary = __esm({
34095
34984
  "../drizzle-orm/dist/mysql-core/columns/varbinary.js"() {
34096
34985
  "use strict";
34097
34986
  init_entity();
34098
34987
  init_utils2();
34099
34988
  init_common4();
34100
- MySqlVarBinaryBuilder = class extends (_b214 = MySqlColumnBuilder, _a289 = entityKind, _b214) {
34989
+ MySqlVarBinaryBuilder = class extends (_b214 = MySqlColumnBuilder, _a291 = entityKind, _b214) {
34101
34990
  /** @internal */
34102
34991
  constructor(name2, config) {
34103
34992
  super(name2, "string", "MySqlVarBinary");
@@ -34111,8 +35000,8 @@ var init_varbinary = __esm({
34111
35000
  );
34112
35001
  }
34113
35002
  };
34114
- __publicField(MySqlVarBinaryBuilder, _a289, "MySqlVarBinaryBuilder");
34115
- MySqlVarBinary = class extends (_b215 = MySqlColumn, _a290 = entityKind, _b215) {
35003
+ __publicField(MySqlVarBinaryBuilder, _a291, "MySqlVarBinaryBuilder");
35004
+ MySqlVarBinary = class extends (_b215 = MySqlColumn, _a292 = entityKind, _b215) {
34116
35005
  constructor() {
34117
35006
  super(...arguments);
34118
35007
  __publicField(this, "length", this.config.length);
@@ -34121,7 +35010,7 @@ var init_varbinary = __esm({
34121
35010
  return this.length === void 0 ? `varbinary` : `varbinary(${this.length})`;
34122
35011
  }
34123
35012
  };
34124
- __publicField(MySqlVarBinary, _a290, "MySqlVarBinary");
35013
+ __publicField(MySqlVarBinary, _a292, "MySqlVarBinary");
34125
35014
  }
34126
35015
  });
34127
35016
 
@@ -34130,14 +35019,14 @@ function varchar2(a, b) {
34130
35019
  const { name: name2, config } = getColumnNameAndConfig(a, b);
34131
35020
  return new MySqlVarCharBuilder(name2, config);
34132
35021
  }
34133
- var _a291, _b216, MySqlVarCharBuilder, _a292, _b217, MySqlVarChar;
35022
+ var _a293, _b216, MySqlVarCharBuilder, _a294, _b217, MySqlVarChar;
34134
35023
  var init_varchar2 = __esm({
34135
35024
  "../drizzle-orm/dist/mysql-core/columns/varchar.js"() {
34136
35025
  "use strict";
34137
35026
  init_entity();
34138
35027
  init_utils2();
34139
35028
  init_common4();
34140
- MySqlVarCharBuilder = class extends (_b216 = MySqlColumnBuilder, _a291 = entityKind, _b216) {
35029
+ MySqlVarCharBuilder = class extends (_b216 = MySqlColumnBuilder, _a293 = entityKind, _b216) {
34141
35030
  /** @internal */
34142
35031
  constructor(name2, config) {
34143
35032
  super(name2, "string", "MySqlVarChar");
@@ -34152,8 +35041,8 @@ var init_varchar2 = __esm({
34152
35041
  );
34153
35042
  }
34154
35043
  };
34155
- __publicField(MySqlVarCharBuilder, _a291, "MySqlVarCharBuilder");
34156
- MySqlVarChar = class extends (_b217 = MySqlColumn, _a292 = entityKind, _b217) {
35044
+ __publicField(MySqlVarCharBuilder, _a293, "MySqlVarCharBuilder");
35045
+ MySqlVarChar = class extends (_b217 = MySqlColumn, _a294 = entityKind, _b217) {
34157
35046
  constructor() {
34158
35047
  super(...arguments);
34159
35048
  __publicField(this, "length", this.config.length);
@@ -34163,7 +35052,7 @@ var init_varchar2 = __esm({
34163
35052
  return this.length === void 0 ? `varchar` : `varchar(${this.length})`;
34164
35053
  }
34165
35054
  };
34166
- __publicField(MySqlVarChar, _a292, "MySqlVarChar");
35055
+ __publicField(MySqlVarChar, _a294, "MySqlVarChar");
34167
35056
  }
34168
35057
  });
34169
35058
 
@@ -34171,13 +35060,13 @@ var init_varchar2 = __esm({
34171
35060
  function year(name2) {
34172
35061
  return new MySqlYearBuilder(name2 ?? "");
34173
35062
  }
34174
- var _a293, _b218, MySqlYearBuilder, _a294, _b219, MySqlYear;
35063
+ var _a295, _b218, MySqlYearBuilder, _a296, _b219, MySqlYear;
34175
35064
  var init_year = __esm({
34176
35065
  "../drizzle-orm/dist/mysql-core/columns/year.js"() {
34177
35066
  "use strict";
34178
35067
  init_entity();
34179
35068
  init_common4();
34180
- MySqlYearBuilder = class extends (_b218 = MySqlColumnBuilder, _a293 = entityKind, _b218) {
35069
+ MySqlYearBuilder = class extends (_b218 = MySqlColumnBuilder, _a295 = entityKind, _b218) {
34181
35070
  constructor(name2) {
34182
35071
  super(name2, "number", "MySqlYear");
34183
35072
  }
@@ -34186,13 +35075,13 @@ var init_year = __esm({
34186
35075
  return new MySqlYear(table4, this.config);
34187
35076
  }
34188
35077
  };
34189
- __publicField(MySqlYearBuilder, _a293, "MySqlYearBuilder");
34190
- MySqlYear = class extends (_b219 = MySqlColumn, _a294 = entityKind, _b219) {
35078
+ __publicField(MySqlYearBuilder, _a295, "MySqlYearBuilder");
35079
+ MySqlYear = class extends (_b219 = MySqlColumn, _a296 = entityKind, _b219) {
34191
35080
  getSQLType() {
34192
35081
  return `year`;
34193
35082
  }
34194
35083
  };
34195
- __publicField(MySqlYear, _a294, "MySqlYear");
35084
+ __publicField(MySqlYear, _a296, "MySqlYear");
34196
35085
  }
34197
35086
  });
34198
35087
 
@@ -34229,17 +35118,17 @@ var init_columns3 = __esm({
34229
35118
  });
34230
35119
 
34231
35120
  // ../drizzle-orm/dist/mysql-core/query-builders/count.js
34232
- var _a295, _b220, _c8, _MySqlCountBuilder, MySqlCountBuilder;
35121
+ var _a297, _b220, _c8, _MySqlCountBuilder, MySqlCountBuilder;
34233
35122
  var init_count3 = __esm({
34234
35123
  "../drizzle-orm/dist/mysql-core/query-builders/count.js"() {
34235
35124
  "use strict";
34236
35125
  init_entity();
34237
35126
  init_sql();
34238
- _MySqlCountBuilder = class _MySqlCountBuilder extends (_c8 = SQL, _b220 = entityKind, _a295 = Symbol.toStringTag, _c8) {
35127
+ _MySqlCountBuilder = class _MySqlCountBuilder extends (_c8 = SQL, _b220 = entityKind, _a297 = Symbol.toStringTag, _c8) {
34239
35128
  constructor(params) {
34240
35129
  super(_MySqlCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
34241
35130
  __publicField(this, "sql");
34242
- __publicField(this, _a295, "MySqlCountBuilder");
35131
+ __publicField(this, _a297, "MySqlCountBuilder");
34243
35132
  __publicField(this, "session");
34244
35133
  this.params = params;
34245
35134
  this.mapWith(Number);
@@ -34283,7 +35172,7 @@ var init_count3 = __esm({
34283
35172
  });
34284
35173
 
34285
35174
  // ../drizzle-orm/dist/mysql-core/query-builders/delete.js
34286
- var _a296, _b221, MySqlDeleteBase;
35175
+ var _a298, _b221, MySqlDeleteBase;
34287
35176
  var init_delete3 = __esm({
34288
35177
  "../drizzle-orm/dist/mysql-core/query-builders/delete.js"() {
34289
35178
  "use strict";
@@ -34291,7 +35180,7 @@ var init_delete3 = __esm({
34291
35180
  init_query_promise();
34292
35181
  init_selection_proxy();
34293
35182
  init_table();
34294
- MySqlDeleteBase = class extends (_b221 = QueryPromise, _a296 = entityKind, _b221) {
35183
+ MySqlDeleteBase = class extends (_b221 = QueryPromise, _a298 = entityKind, _b221) {
34295
35184
  constructor(table4, session, dialect4, withList) {
34296
35185
  super();
34297
35186
  __publicField(this, "config");
@@ -34381,12 +35270,12 @@ var init_delete3 = __esm({
34381
35270
  return this;
34382
35271
  }
34383
35272
  };
34384
- __publicField(MySqlDeleteBase, _a296, "MySqlDelete");
35273
+ __publicField(MySqlDeleteBase, _a298, "MySqlDelete");
34385
35274
  }
34386
35275
  });
34387
35276
 
34388
35277
  // ../drizzle-orm/dist/mysql-core/query-builders/insert.js
34389
- var _a297, MySqlInsertBuilder, _a298, _b222, MySqlInsertBase;
35278
+ var _a299, MySqlInsertBuilder, _a300, _b222, MySqlInsertBase;
34390
35279
  var init_insert3 = __esm({
34391
35280
  "../drizzle-orm/dist/mysql-core/query-builders/insert.js"() {
34392
35281
  "use strict";
@@ -34395,7 +35284,7 @@ var init_insert3 = __esm({
34395
35284
  init_sql();
34396
35285
  init_table();
34397
35286
  init_utils2();
34398
- _a297 = entityKind;
35287
+ _a299 = entityKind;
34399
35288
  MySqlInsertBuilder = class {
34400
35289
  constructor(table4, session, dialect4) {
34401
35290
  __publicField(this, "shouldIgnore", false);
@@ -34424,8 +35313,8 @@ var init_insert3 = __esm({
34424
35313
  return new MySqlInsertBase(this.table, mappedValues, this.shouldIgnore, this.session, this.dialect);
34425
35314
  }
34426
35315
  };
34427
- __publicField(MySqlInsertBuilder, _a297, "MySqlInsertBuilder");
34428
- MySqlInsertBase = class extends (_b222 = QueryPromise, _a298 = entityKind, _b222) {
35316
+ __publicField(MySqlInsertBuilder, _a299, "MySqlInsertBuilder");
35317
+ MySqlInsertBase = class extends (_b222 = QueryPromise, _a300 = entityKind, _b222) {
34429
35318
  constructor(table4, values, ignore, session, dialect4) {
34430
35319
  super();
34431
35320
  __publicField(this, "config");
@@ -34506,7 +35395,7 @@ var init_insert3 = __esm({
34506
35395
  return this;
34507
35396
  }
34508
35397
  };
34509
- __publicField(MySqlInsertBase, _a298, "MySqlInsert");
35398
+ __publicField(MySqlInsertBase, _a300, "MySqlInsert");
34510
35399
  }
34511
35400
  });
34512
35401
 
@@ -34590,7 +35479,7 @@ function mysqlTableWithSchema(name2, columns, extraConfig, schema4, baseName = n
34590
35479
  }
34591
35480
  return table4;
34592
35481
  }
34593
- var InlineForeignKeys3, _a299, _b223, _c9, _d4, _e3, MySqlTable, mysqlTable;
35482
+ var InlineForeignKeys3, _a301, _b223, _c9, _d4, _e4, MySqlTable, mysqlTable;
34594
35483
  var init_table4 = __esm({
34595
35484
  "../drizzle-orm/dist/mysql-core/table.js"() {
34596
35485
  "use strict";
@@ -34598,7 +35487,7 @@ var init_table4 = __esm({
34598
35487
  init_table();
34599
35488
  init_all3();
34600
35489
  InlineForeignKeys3 = Symbol.for("drizzle:MySqlInlineForeignKeys");
34601
- MySqlTable = class extends (_e3 = Table, _d4 = entityKind, _c9 = Table.Symbol.Columns, _b223 = InlineForeignKeys3, _a299 = Table.Symbol.ExtraConfigBuilder, _e3) {
35490
+ MySqlTable = class extends (_e4 = Table, _d4 = entityKind, _c9 = Table.Symbol.Columns, _b223 = InlineForeignKeys3, _a301 = Table.Symbol.ExtraConfigBuilder, _e4) {
34602
35491
  constructor() {
34603
35492
  super(...arguments);
34604
35493
  /** @internal */
@@ -34606,7 +35495,7 @@ var init_table4 = __esm({
34606
35495
  /** @internal */
34607
35496
  __publicField(this, _b223, []);
34608
35497
  /** @internal */
34609
- __publicField(this, _a299);
35498
+ __publicField(this, _a301);
34610
35499
  }
34611
35500
  };
34612
35501
  __publicField(MySqlTable, _d4, "MySqlTable");
@@ -34621,20 +35510,20 @@ var init_table4 = __esm({
34621
35510
  });
34622
35511
 
34623
35512
  // ../drizzle-orm/dist/mysql-core/view-base.js
34624
- var _a300, _b224, MySqlViewBase;
35513
+ var _a302, _b224, MySqlViewBase;
34625
35514
  var init_view_base3 = __esm({
34626
35515
  "../drizzle-orm/dist/mysql-core/view-base.js"() {
34627
35516
  "use strict";
34628
35517
  init_entity();
34629
35518
  init_sql();
34630
- MySqlViewBase = class extends (_b224 = View3, _a300 = entityKind, _b224) {
35519
+ MySqlViewBase = class extends (_b224 = View3, _a302 = entityKind, _b224) {
34631
35520
  };
34632
- __publicField(MySqlViewBase, _a300, "MySqlViewBase");
35521
+ __publicField(MySqlViewBase, _a302, "MySqlViewBase");
34633
35522
  }
34634
35523
  });
34635
35524
 
34636
35525
  // ../drizzle-orm/dist/mysql-core/dialect.js
34637
- var _a301, MySqlDialect;
35526
+ var _a303, MySqlDialect;
34638
35527
  var init_dialect3 = __esm({
34639
35528
  "../drizzle-orm/dist/mysql-core/dialect.js"() {
34640
35529
  "use strict";
@@ -34653,7 +35542,7 @@ var init_dialect3 = __esm({
34653
35542
  init_common4();
34654
35543
  init_table4();
34655
35544
  init_view_base3();
34656
- _a301 = entityKind;
35545
+ _a303 = entityKind;
34657
35546
  MySqlDialect = class {
34658
35547
  constructor(config) {
34659
35548
  /** @internal */
@@ -35439,7 +36328,7 @@ var init_dialect3 = __esm({
35439
36328
  };
35440
36329
  }
35441
36330
  };
35442
- __publicField(MySqlDialect, _a301, "MySqlDialect");
36331
+ __publicField(MySqlDialect, _a303, "MySqlDialect");
35443
36332
  }
35444
36333
  });
35445
36334
 
@@ -35461,7 +36350,7 @@ function createSetOperator3(type, isAll) {
35461
36350
  return leftSelect.addSetOperators(setOperators);
35462
36351
  };
35463
36352
  }
35464
- var _a302, MySqlSelectBuilder, _a303, _b225, MySqlSelectQueryBuilderBase, _a304, _b226, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
36353
+ var _a304, MySqlSelectBuilder, _a305, _b225, MySqlSelectQueryBuilderBase, _a306, _b226, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
35465
36354
  var init_select4 = __esm({
35466
36355
  "../drizzle-orm/dist/mysql-core/query-builders/select.js"() {
35467
36356
  "use strict";
@@ -35476,7 +36365,7 @@ var init_select4 = __esm({
35476
36365
  init_utils2();
35477
36366
  init_view_common();
35478
36367
  init_view_base3();
35479
- _a302 = entityKind;
36368
+ _a304 = entityKind;
35480
36369
  MySqlSelectBuilder = class {
35481
36370
  constructor(config) {
35482
36371
  __publicField(this, "fields");
@@ -35521,8 +36410,8 @@ var init_select4 = __esm({
35521
36410
  );
35522
36411
  }
35523
36412
  };
35524
- __publicField(MySqlSelectBuilder, _a302, "MySqlSelectBuilder");
35525
- MySqlSelectQueryBuilderBase = class extends (_b225 = TypedQueryBuilder, _a303 = entityKind, _b225) {
36413
+ __publicField(MySqlSelectBuilder, _a304, "MySqlSelectBuilder");
36414
+ MySqlSelectQueryBuilderBase = class extends (_b225 = TypedQueryBuilder, _a305 = entityKind, _b225) {
35526
36415
  constructor({ table: table4, fields, isPartialSelect, session, dialect: dialect4, withList, distinct }) {
35527
36416
  super();
35528
36417
  __publicField(this, "_");
@@ -36123,8 +37012,8 @@ var init_select4 = __esm({
36123
37012
  return this;
36124
37013
  }
36125
37014
  };
36126
- __publicField(MySqlSelectQueryBuilderBase, _a303, "MySqlSelectQueryBuilder");
36127
- MySqlSelectBase = class extends (_b226 = MySqlSelectQueryBuilderBase, _a304 = entityKind, _b226) {
37015
+ __publicField(MySqlSelectQueryBuilderBase, _a305, "MySqlSelectQueryBuilder");
37016
+ MySqlSelectBase = class extends (_b226 = MySqlSelectQueryBuilderBase, _a306 = entityKind, _b226) {
36128
37017
  constructor() {
36129
37018
  super(...arguments);
36130
37019
  __publicField(this, "execute", (placeholderValues) => {
@@ -36148,7 +37037,7 @@ var init_select4 = __esm({
36148
37037
  return query;
36149
37038
  }
36150
37039
  };
36151
- __publicField(MySqlSelectBase, _a304, "MySqlSelect");
37040
+ __publicField(MySqlSelectBase, _a306, "MySqlSelect");
36152
37041
  applyMixins(MySqlSelectBase, [QueryPromise]);
36153
37042
  getMySqlSetOperators = () => ({
36154
37043
  union: union3,
@@ -36168,7 +37057,7 @@ var init_select4 = __esm({
36168
37057
  });
36169
37058
 
36170
37059
  // ../drizzle-orm/dist/mysql-core/query-builders/query-builder.js
36171
- var _a305, QueryBuilder3;
37060
+ var _a307, QueryBuilder3;
36172
37061
  var init_query_builder4 = __esm({
36173
37062
  "../drizzle-orm/dist/mysql-core/query-builders/query-builder.js"() {
36174
37063
  "use strict";
@@ -36177,7 +37066,7 @@ var init_query_builder4 = __esm({
36177
37066
  init_selection_proxy();
36178
37067
  init_subquery();
36179
37068
  init_select4();
36180
- _a305 = entityKind;
37069
+ _a307 = entityKind;
36181
37070
  QueryBuilder3 = class {
36182
37071
  constructor(dialect4) {
36183
37072
  __publicField(this, "dialect");
@@ -36239,7 +37128,7 @@ var init_query_builder4 = __esm({
36239
37128
  return this.dialect;
36240
37129
  }
36241
37130
  };
36242
- __publicField(QueryBuilder3, _a305, "MySqlQueryBuilder");
37131
+ __publicField(QueryBuilder3, _a307, "MySqlQueryBuilder");
36243
37132
  }
36244
37133
  });
36245
37134
 
@@ -36251,7 +37140,7 @@ var init_select_types3 = __esm({
36251
37140
  });
36252
37141
 
36253
37142
  // ../drizzle-orm/dist/mysql-core/query-builders/update.js
36254
- var _a306, MySqlUpdateBuilder, _a307, _b227, MySqlUpdateBase;
37143
+ var _a308, MySqlUpdateBuilder, _a309, _b227, MySqlUpdateBase;
36255
37144
  var init_update3 = __esm({
36256
37145
  "../drizzle-orm/dist/mysql-core/query-builders/update.js"() {
36257
37146
  "use strict";
@@ -36260,7 +37149,7 @@ var init_update3 = __esm({
36260
37149
  init_selection_proxy();
36261
37150
  init_table();
36262
37151
  init_utils2();
36263
- _a306 = entityKind;
37152
+ _a308 = entityKind;
36264
37153
  MySqlUpdateBuilder = class {
36265
37154
  constructor(table4, session, dialect4, withList) {
36266
37155
  this.table = table4;
@@ -36272,8 +37161,8 @@ var init_update3 = __esm({
36272
37161
  return new MySqlUpdateBase(this.table, mapUpdateSet(this.table, values), this.session, this.dialect, this.withList);
36273
37162
  }
36274
37163
  };
36275
- __publicField(MySqlUpdateBuilder, _a306, "MySqlUpdateBuilder");
36276
- MySqlUpdateBase = class extends (_b227 = QueryPromise, _a307 = entityKind, _b227) {
37164
+ __publicField(MySqlUpdateBuilder, _a308, "MySqlUpdateBuilder");
37165
+ MySqlUpdateBase = class extends (_b227 = QueryPromise, _a309 = entityKind, _b227) {
36277
37166
  constructor(table4, set, session, dialect4, withList) {
36278
37167
  super();
36279
37168
  __publicField(this, "config");
@@ -36366,7 +37255,7 @@ var init_update3 = __esm({
36366
37255
  return this;
36367
37256
  }
36368
37257
  };
36369
- __publicField(MySqlUpdateBase, _a307, "MySqlUpdate");
37258
+ __publicField(MySqlUpdateBase, _a309, "MySqlUpdate");
36370
37259
  }
36371
37260
  });
36372
37261
 
@@ -36384,14 +37273,14 @@ var init_query_builders3 = __esm({
36384
37273
  });
36385
37274
 
36386
37275
  // ../drizzle-orm/dist/mysql-core/query-builders/query.js
36387
- var _a308, RelationalQueryBuilder3, _a309, _b228, MySqlRelationalQuery;
37276
+ var _a310, RelationalQueryBuilder3, _a311, _b228, MySqlRelationalQuery;
36388
37277
  var init_query3 = __esm({
36389
37278
  "../drizzle-orm/dist/mysql-core/query-builders/query.js"() {
36390
37279
  "use strict";
36391
37280
  init_entity();
36392
37281
  init_query_promise();
36393
37282
  init_relations();
36394
- _a308 = entityKind;
37283
+ _a310 = entityKind;
36395
37284
  RelationalQueryBuilder3 = class {
36396
37285
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, mode) {
36397
37286
  this.fullSchema = fullSchema;
@@ -36432,8 +37321,8 @@ var init_query3 = __esm({
36432
37321
  );
36433
37322
  }
36434
37323
  };
36435
- __publicField(RelationalQueryBuilder3, _a308, "MySqlRelationalQueryBuilder");
36436
- MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a309 = entityKind, _b228) {
37324
+ __publicField(RelationalQueryBuilder3, _a310, "MySqlRelationalQueryBuilder");
37325
+ MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a311 = entityKind, _b228) {
36437
37326
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, config, queryMode, mode) {
36438
37327
  super();
36439
37328
  this.fullSchema = fullSchema;
@@ -36497,12 +37386,12 @@ var init_query3 = __esm({
36497
37386
  return this.prepare().execute();
36498
37387
  }
36499
37388
  };
36500
- __publicField(MySqlRelationalQuery, _a309, "MySqlRelationalQuery");
37389
+ __publicField(MySqlRelationalQuery, _a311, "MySqlRelationalQuery");
36501
37390
  }
36502
37391
  });
36503
37392
 
36504
37393
  // ../drizzle-orm/dist/mysql-core/db.js
36505
- var _a310, MySqlDatabase;
37394
+ var _a312, MySqlDatabase;
36506
37395
  var init_db3 = __esm({
36507
37396
  "../drizzle-orm/dist/mysql-core/db.js"() {
36508
37397
  "use strict";
@@ -36513,7 +37402,7 @@ var init_db3 = __esm({
36513
37402
  init_count3();
36514
37403
  init_query_builders3();
36515
37404
  init_query3();
36516
- _a310 = entityKind;
37405
+ _a312 = entityKind;
36517
37406
  MySqlDatabase = class {
36518
37407
  constructor(dialect4, session, schema4, mode) {
36519
37408
  __publicField(this, "query");
@@ -36726,17 +37615,17 @@ var init_db3 = __esm({
36726
37615
  return this.session.transaction(transaction, config);
36727
37616
  }
36728
37617
  };
36729
- __publicField(MySqlDatabase, _a310, "MySqlDatabase");
37618
+ __publicField(MySqlDatabase, _a312, "MySqlDatabase");
36730
37619
  }
36731
37620
  });
36732
37621
 
36733
37622
  // ../drizzle-orm/dist/mysql-core/indexes.js
36734
- var _a311, IndexBuilderOn3, _a312, IndexBuilder3, _a313, Index5;
37623
+ var _a313, IndexBuilderOn3, _a314, IndexBuilder3, _a315, Index5;
36735
37624
  var init_indexes3 = __esm({
36736
37625
  "../drizzle-orm/dist/mysql-core/indexes.js"() {
36737
37626
  "use strict";
36738
37627
  init_entity();
36739
- _a311 = entityKind;
37628
+ _a313 = entityKind;
36740
37629
  IndexBuilderOn3 = class {
36741
37630
  constructor(name2, unique) {
36742
37631
  this.name = name2;
@@ -36746,8 +37635,8 @@ var init_indexes3 = __esm({
36746
37635
  return new IndexBuilder3(this.name, columns, this.unique);
36747
37636
  }
36748
37637
  };
36749
- __publicField(IndexBuilderOn3, _a311, "MySqlIndexBuilderOn");
36750
- _a312 = entityKind;
37638
+ __publicField(IndexBuilderOn3, _a313, "MySqlIndexBuilderOn");
37639
+ _a314 = entityKind;
36751
37640
  IndexBuilder3 = class {
36752
37641
  constructor(name2, columns, unique) {
36753
37642
  /** @internal */
@@ -36775,26 +37664,26 @@ var init_indexes3 = __esm({
36775
37664
  return new Index5(this.config, table4);
36776
37665
  }
36777
37666
  };
36778
- __publicField(IndexBuilder3, _a312, "MySqlIndexBuilder");
36779
- _a313 = entityKind;
37667
+ __publicField(IndexBuilder3, _a314, "MySqlIndexBuilder");
37668
+ _a315 = entityKind;
36780
37669
  Index5 = class {
36781
37670
  constructor(config, table4) {
36782
37671
  __publicField(this, "config");
36783
37672
  this.config = { ...config, table: table4 };
36784
37673
  }
36785
37674
  };
36786
- __publicField(Index5, _a313, "MySqlIndex");
37675
+ __publicField(Index5, _a315, "MySqlIndex");
36787
37676
  }
36788
37677
  });
36789
37678
 
36790
37679
  // ../drizzle-orm/dist/mysql-core/primary-keys.js
36791
- var _a314, PrimaryKeyBuilder3, _a315, PrimaryKey3;
37680
+ var _a316, PrimaryKeyBuilder3, _a317, PrimaryKey3;
36792
37681
  var init_primary_keys3 = __esm({
36793
37682
  "../drizzle-orm/dist/mysql-core/primary-keys.js"() {
36794
37683
  "use strict";
36795
37684
  init_entity();
36796
37685
  init_table4();
36797
- _a314 = entityKind;
37686
+ _a316 = entityKind;
36798
37687
  PrimaryKeyBuilder3 = class {
36799
37688
  constructor(columns, name2) {
36800
37689
  /** @internal */
@@ -36809,8 +37698,8 @@ var init_primary_keys3 = __esm({
36809
37698
  return new PrimaryKey3(table4, this.columns, this.name);
36810
37699
  }
36811
37700
  };
36812
- __publicField(PrimaryKeyBuilder3, _a314, "MySqlPrimaryKeyBuilder");
36813
- _a315 = entityKind;
37701
+ __publicField(PrimaryKeyBuilder3, _a316, "MySqlPrimaryKeyBuilder");
37702
+ _a317 = entityKind;
36814
37703
  PrimaryKey3 = class {
36815
37704
  constructor(table4, columns, name2) {
36816
37705
  __publicField(this, "columns");
@@ -36823,7 +37712,7 @@ var init_primary_keys3 = __esm({
36823
37712
  return this.name ?? `${this.table[MySqlTable.Symbol.Name]}_${this.columns.map((column4) => column4.name).join("_")}_pk`;
36824
37713
  }
36825
37714
  };
36826
- __publicField(PrimaryKey3, _a315, "MySqlPrimaryKey");
37715
+ __publicField(PrimaryKey3, _a317, "MySqlPrimaryKey");
36827
37716
  }
36828
37717
  });
36829
37718
 
@@ -36843,7 +37732,7 @@ function mysqlViewWithSchema(name2, selection, schema4) {
36843
37732
  }
36844
37733
  return new ViewBuilder3(name2, schema4);
36845
37734
  }
36846
- var _a316, ViewBuilderCore2, _a317, _b229, ViewBuilder3, _a318, _b230, ManualViewBuilder3, _a319, _b231, _c10, MySqlView2;
37735
+ var _a318, ViewBuilderCore2, _a319, _b229, ViewBuilder3, _a320, _b230, ManualViewBuilder3, _a321, _b231, _c10, MySqlView2;
36847
37736
  var init_view3 = __esm({
36848
37737
  "../drizzle-orm/dist/mysql-core/view.js"() {
36849
37738
  "use strict";
@@ -36854,7 +37743,7 @@ var init_view3 = __esm({
36854
37743
  init_table4();
36855
37744
  init_view_base3();
36856
37745
  init_view_common3();
36857
- _a316 = entityKind;
37746
+ _a318 = entityKind;
36858
37747
  ViewBuilderCore2 = class {
36859
37748
  constructor(name2, schema4) {
36860
37749
  __publicField(this, "config", {});
@@ -36874,8 +37763,8 @@ var init_view3 = __esm({
36874
37763
  return this;
36875
37764
  }
36876
37765
  };
36877
- __publicField(ViewBuilderCore2, _a316, "MySqlViewBuilder");
36878
- ViewBuilder3 = class extends (_b229 = ViewBuilderCore2, _a317 = entityKind, _b229) {
37766
+ __publicField(ViewBuilderCore2, _a318, "MySqlViewBuilder");
37767
+ ViewBuilder3 = class extends (_b229 = ViewBuilderCore2, _a319 = entityKind, _b229) {
36879
37768
  as(qb) {
36880
37769
  if (typeof qb === "function") {
36881
37770
  qb = qb(new QueryBuilder3());
@@ -36901,8 +37790,8 @@ var init_view3 = __esm({
36901
37790
  );
36902
37791
  }
36903
37792
  };
36904
- __publicField(ViewBuilder3, _a317, "MySqlViewBuilder");
36905
- ManualViewBuilder3 = class extends (_b230 = ViewBuilderCore2, _a318 = entityKind, _b230) {
37793
+ __publicField(ViewBuilder3, _a319, "MySqlViewBuilder");
37794
+ ManualViewBuilder3 = class extends (_b230 = ViewBuilderCore2, _a320 = entityKind, _b230) {
36906
37795
  constructor(name2, columns, schema4) {
36907
37796
  super(name2, schema4);
36908
37797
  __publicField(this, "columns");
@@ -36947,11 +37836,11 @@ var init_view3 = __esm({
36947
37836
  );
36948
37837
  }
36949
37838
  };
36950
- __publicField(ManualViewBuilder3, _a318, "MySqlManualViewBuilder");
36951
- MySqlView2 = class extends (_c10 = MySqlViewBase, _b231 = entityKind, _a319 = MySqlViewConfig, _c10) {
37839
+ __publicField(ManualViewBuilder3, _a320, "MySqlManualViewBuilder");
37840
+ MySqlView2 = class extends (_c10 = MySqlViewBase, _b231 = entityKind, _a321 = MySqlViewConfig, _c10) {
36952
37841
  constructor({ mysqlConfig, config }) {
36953
37842
  super(config);
36954
- __publicField(this, _a319);
37843
+ __publicField(this, _a321);
36955
37844
  this[MySqlViewConfig] = mysqlConfig;
36956
37845
  }
36957
37846
  };
@@ -36960,14 +37849,14 @@ var init_view3 = __esm({
36960
37849
  });
36961
37850
 
36962
37851
  // ../drizzle-orm/dist/mysql-core/schema.js
36963
- var _a320, MySqlSchema5;
37852
+ var _a322, MySqlSchema5;
36964
37853
  var init_schema2 = __esm({
36965
37854
  "../drizzle-orm/dist/mysql-core/schema.js"() {
36966
37855
  "use strict";
36967
37856
  init_entity();
36968
37857
  init_table4();
36969
37858
  init_view3();
36970
- _a320 = entityKind;
37859
+ _a322 = entityKind;
36971
37860
  MySqlSchema5 = class {
36972
37861
  constructor(schemaName) {
36973
37862
  __publicField(this, "table", (name2, columns, extraConfig) => {
@@ -36979,12 +37868,12 @@ var init_schema2 = __esm({
36979
37868
  this.schemaName = schemaName;
36980
37869
  }
36981
37870
  };
36982
- __publicField(MySqlSchema5, _a320, "MySqlSchema");
37871
+ __publicField(MySqlSchema5, _a322, "MySqlSchema");
36983
37872
  }
36984
37873
  });
36985
37874
 
36986
37875
  // ../drizzle-orm/dist/mysql-core/session.js
36987
- var _a321, MySqlPreparedQuery, _a322, MySqlSession, _a323, _b232, MySqlTransaction;
37876
+ var _a323, MySqlPreparedQuery, _a324, MySqlSession, _a325, _b232, MySqlTransaction;
36988
37877
  var init_session3 = __esm({
36989
37878
  "../drizzle-orm/dist/mysql-core/session.js"() {
36990
37879
  "use strict";
@@ -36992,15 +37881,15 @@ var init_session3 = __esm({
36992
37881
  init_errors();
36993
37882
  init_sql();
36994
37883
  init_db3();
36995
- _a321 = entityKind;
37884
+ _a323 = entityKind;
36996
37885
  MySqlPreparedQuery = class {
36997
37886
  constructor() {
36998
37887
  /** @internal */
36999
37888
  __publicField(this, "joinsNotNullableMap");
37000
37889
  }
37001
37890
  };
37002
- __publicField(MySqlPreparedQuery, _a321, "MySqlPreparedQuery");
37003
- _a322 = entityKind;
37891
+ __publicField(MySqlPreparedQuery, _a323, "MySqlPreparedQuery");
37892
+ _a324 = entityKind;
37004
37893
  MySqlSession = class {
37005
37894
  constructor(dialect4) {
37006
37895
  this.dialect = dialect4;
@@ -37035,8 +37924,8 @@ var init_session3 = __esm({
37035
37924
  return parts.length ? sql`start transaction ${sql.raw(parts.join(" "))}` : void 0;
37036
37925
  }
37037
37926
  };
37038
- __publicField(MySqlSession, _a322, "MySqlSession");
37039
- MySqlTransaction = class extends (_b232 = MySqlDatabase, _a323 = entityKind, _b232) {
37927
+ __publicField(MySqlSession, _a324, "MySqlSession");
37928
+ MySqlTransaction = class extends (_b232 = MySqlDatabase, _a325 = entityKind, _b232) {
37040
37929
  constructor(dialect4, session, schema4, nestedIndex, mode) {
37041
37930
  super(dialect4, session, schema4, mode);
37042
37931
  this.schema = schema4;
@@ -37046,7 +37935,7 @@ var init_session3 = __esm({
37046
37935
  throw new TransactionRollbackError();
37047
37936
  }
37048
37937
  };
37049
- __publicField(MySqlTransaction, _a323, "MySqlTransaction");
37938
+ __publicField(MySqlTransaction, _a325, "MySqlTransaction");
37050
37939
  }
37051
37940
  });
37052
37941
 
@@ -37934,6 +38823,13 @@ var init_cli = __esm({
37934
38823
  breakpoints: booleanType().optional().default(true),
37935
38824
  migrations: objectType({
37936
38825
  prefix: prefix.optional().default("index")
38826
+ }).optional(),
38827
+ entities: objectType({
38828
+ roles: booleanType().or(objectType({
38829
+ provider: stringType().optional(),
38830
+ include: stringType().array().optional(),
38831
+ exclude: stringType().array().optional()
38832
+ })).optional().default(false)
37937
38833
  }).optional()
37938
38834
  }).passthrough();
37939
38835
  configCheck = objectType({
@@ -38200,6 +39096,7 @@ var init_pgImports = __esm({
38200
39096
  const enums = [];
38201
39097
  const schemas = [];
38202
39098
  const sequences = [];
39099
+ const roles = [];
38203
39100
  const views = [];
38204
39101
  const matViews = [];
38205
39102
  const i0values = Object.values(exports2);
@@ -38223,8 +39120,11 @@ var init_pgImports = __esm({
38223
39120
  if (isPgSequence(t)) {
38224
39121
  sequences.push(t);
38225
39122
  }
39123
+ if (is(t, PgRole)) {
39124
+ roles.push(t);
39125
+ }
38226
39126
  });
38227
- return { tables, enums, schemas, sequences, views, matViews };
39127
+ return { tables, enums, schemas, sequences, views, matViews, roles };
38228
39128
  };
38229
39129
  }
38230
39130
  });
@@ -38644,7 +39544,7 @@ init_mjs();
38644
39544
  init_global();
38645
39545
  init_pgSerializer();
38646
39546
  init_views();
38647
- var pgPushIntrospect = async (db, filters, schemaFilters) => {
39547
+ var pgPushIntrospect = async (db, filters, schemaFilters, entities = { roles: true }) => {
38648
39548
  const matchers = filters.map((it) => {
38649
39549
  return new Minimatch(it);
38650
39550
  });
@@ -38672,7 +39572,7 @@ var pgPushIntrospect = async (db, filters, schemaFilters) => {
38672
39572
  );
38673
39573
  const res = await (0, import_hanji3.renderWithTask)(
38674
39574
  progress,
38675
- fromDatabase(db, filter2, schemaFilters)
39575
+ fromDatabase(db, filter2, schemaFilters, entities)
38676
39576
  );
38677
39577
  const schema4 = { id: originUUID, prevId: "", ...res };
38678
39578
  const { internal, ...schemaWithoutInternals } = schema4;
@@ -38842,17 +39742,11 @@ var pgSuggestions = async (db, statements) => {
38842
39742
  }
38843
39743
  const stmnt = fromJson([statement], "postgresql");
38844
39744
  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
- }
39745
+ statementsToExecute.push(...stmnt);
38852
39746
  }
38853
39747
  }
38854
39748
  return {
38855
- statementsToExecute,
39749
+ statementsToExecute: [...new Set(statementsToExecute)],
38856
39750
  shouldAskForApprove,
38857
39751
  infoToPrint,
38858
39752
  matViewsToRemove: [...new Set(matViewsToRemove)],
@@ -39098,6 +39992,7 @@ var generateDrizzleJson = (imports, prevId, schemaFilters, casing2) => {
39098
39992
  prepared.enums,
39099
39993
  prepared.schemas,
39100
39994
  prepared.sequences,
39995
+ prepared.roles,
39101
39996
  prepared.views,
39102
39997
  prepared.matViews,
39103
39998
  casing2,
@@ -39121,6 +40016,8 @@ var generateMigration = async (prev, cur) => {
39121
40016
  schemasResolver,
39122
40017
  enumsResolver,
39123
40018
  sequencesResolver,
40019
+ policyResolver,
40020
+ roleResolver,
39124
40021
  tablesResolver,
39125
40022
  columnsResolver,
39126
40023
  viewsResolver,
@@ -39154,6 +40051,8 @@ var pushSchema = async (imports, drizzleInstance, schemaFilters) => {
39154
40051
  schemasResolver,
39155
40052
  enumsResolver,
39156
40053
  sequencesResolver,
40054
+ policyResolver,
40055
+ roleResolver,
39157
40056
  tablesResolver,
39158
40057
  columnsResolver,
39159
40058
  viewsResolver,