drizzle-kit 0.26.0 → 0.26.2-05e88e4

Sign up to get free protection for your applications and to get access to all the features.
package/api.mjs CHANGED
@@ -2480,9 +2480,9 @@ var require_inflight = __commonJS({
2480
2480
  }
2481
2481
  function slice(args) {
2482
2482
  var length = args.length;
2483
- var array = [];
2484
- for (var i = 0; i < length; i++) array[i] = args[i];
2485
- return array;
2483
+ var array2 = [];
2484
+ for (var i = 0; i < length; i++) array2[i] = args[i];
2485
+ return array2;
2486
2486
  }
2487
2487
  }
2488
2488
  });
@@ -3652,13 +3652,13 @@ function processCreateParams(params) {
3652
3652
  if (errorMap2)
3653
3653
  return { errorMap: errorMap2, description };
3654
3654
  const customMap = (iss, ctx) => {
3655
- var _a324, _b233;
3655
+ var _a326, _b233;
3656
3656
  const { message } = params;
3657
3657
  if (iss.code === "invalid_enum_value") {
3658
3658
  return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
3659
3659
  }
3660
3660
  if (typeof ctx.data === "undefined") {
3661
- return { message: (_a324 = message !== null && message !== void 0 ? message : required_error) !== null && _a324 !== void 0 ? _a324 : ctx.defaultError };
3661
+ return { message: (_a326 = message !== null && message !== void 0 ? message : required_error) !== null && _a326 !== void 0 ? _a326 : ctx.defaultError };
3662
3662
  }
3663
3663
  if (iss.code !== "invalid_type")
3664
3664
  return { message: ctx.defaultError };
@@ -3825,8 +3825,8 @@ var init_lib = __esm({
3825
3825
  return void 0;
3826
3826
  };
3827
3827
  util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
3828
- function joinValues(array, separator = " | ") {
3829
- return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
3828
+ function joinValues(array2, separator = " | ") {
3829
+ return array2.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
3830
3830
  }
3831
3831
  util2.joinValues = joinValues;
3832
3832
  util2.jsonStringifyReplacer = (_2, value) => {
@@ -4324,11 +4324,11 @@ var init_lib = __esm({
4324
4324
  throw result.error;
4325
4325
  }
4326
4326
  safeParse(data, params) {
4327
- var _a324;
4327
+ var _a326;
4328
4328
  const ctx = {
4329
4329
  common: {
4330
4330
  issues: [],
4331
- async: (_a324 = params === null || params === void 0 ? void 0 : params.async) !== null && _a324 !== void 0 ? _a324 : false,
4331
+ async: (_a326 = params === null || params === void 0 ? void 0 : params.async) !== null && _a326 !== void 0 ? _a326 : false,
4332
4332
  contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
4333
4333
  },
4334
4334
  path: (params === null || params === void 0 ? void 0 : params.path) || [],
@@ -4650,7 +4650,7 @@ var init_lib = __esm({
4650
4650
  } else if (check.kind === "url") {
4651
4651
  try {
4652
4652
  new URL(input.data);
4653
- } catch (_a324) {
4653
+ } catch (_a326) {
4654
4654
  ctx = this._getOrReturnCtx(input, ctx);
4655
4655
  addIssueToContext(ctx, {
4656
4656
  validation: "url",
@@ -4820,7 +4820,7 @@ var init_lib = __esm({
4820
4820
  return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
4821
4821
  }
4822
4822
  datetime(options) {
4823
- var _a324, _b233;
4823
+ var _a326, _b233;
4824
4824
  if (typeof options === "string") {
4825
4825
  return this._addCheck({
4826
4826
  kind: "datetime",
@@ -4833,7 +4833,7 @@ var init_lib = __esm({
4833
4833
  return this._addCheck({
4834
4834
  kind: "datetime",
4835
4835
  precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
4836
- offset: (_a324 = options === null || options === void 0 ? void 0 : options.offset) !== null && _a324 !== void 0 ? _a324 : false,
4836
+ offset: (_a326 = options === null || options === void 0 ? void 0 : options.offset) !== null && _a326 !== void 0 ? _a326 : false,
4837
4837
  local: (_b233 = options === null || options === void 0 ? void 0 : options.local) !== null && _b233 !== void 0 ? _b233 : false,
4838
4838
  ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
4839
4839
  });
@@ -4997,11 +4997,11 @@ var init_lib = __esm({
4997
4997
  }
4998
4998
  };
4999
4999
  ZodString.create = (params) => {
5000
- var _a324;
5000
+ var _a326;
5001
5001
  return new ZodString({
5002
5002
  checks: [],
5003
5003
  typeName: ZodFirstPartyTypeKind.ZodString,
5004
- coerce: (_a324 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a324 !== void 0 ? _a324 : false,
5004
+ coerce: (_a326 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a326 !== void 0 ? _a326 : false,
5005
5005
  ...processCreateParams(params)
5006
5006
  });
5007
5007
  };
@@ -5394,11 +5394,11 @@ var init_lib = __esm({
5394
5394
  }
5395
5395
  };
5396
5396
  ZodBigInt.create = (params) => {
5397
- var _a324;
5397
+ var _a326;
5398
5398
  return new ZodBigInt({
5399
5399
  checks: [],
5400
5400
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
5401
- coerce: (_a324 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a324 !== void 0 ? _a324 : false,
5401
+ coerce: (_a326 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a326 !== void 0 ? _a326 : false,
5402
5402
  ...processCreateParams(params)
5403
5403
  });
5404
5404
  };
@@ -5878,8 +5878,8 @@ var init_lib = __esm({
5878
5878
  unknownKeys: "strict",
5879
5879
  ...message !== void 0 ? {
5880
5880
  errorMap: (issue, ctx) => {
5881
- var _a324, _b233, _c11, _d5;
5882
- const defaultError = (_c11 = (_b233 = (_a324 = this._def).errorMap) === null || _b233 === void 0 ? void 0 : _b233.call(_a324, issue, ctx).message) !== null && _c11 !== void 0 ? _c11 : ctx.defaultError;
5881
+ var _a326, _b233, _c11, _d5;
5882
+ const defaultError = (_c11 = (_b233 = (_a326 = this._def).errorMap) === null || _b233 === void 0 ? void 0 : _b233.call(_a326, issue, ctx).message) !== null && _c11 !== void 0 ? _c11 : ctx.defaultError;
5883
5883
  if (issue.code === "unrecognized_keys")
5884
5884
  return {
5885
5885
  message: (_d5 = errorUtil.errToObj(message).message) !== null && _d5 !== void 0 ? _d5 : defaultError
@@ -7514,7 +7514,7 @@ var init_mysqlSchema = __esm({
7514
7514
  version: literalType("5"),
7515
7515
  dialect,
7516
7516
  tables: recordType(stringType(), table),
7517
- views: recordType(stringType(), view),
7517
+ views: recordType(stringType(), view).default({}),
7518
7518
  _meta: objectType({
7519
7519
  tables: recordType(stringType(), stringType()),
7520
7520
  columns: recordType(stringType(), stringType())
@@ -7727,7 +7727,7 @@ var init_vector = __esm({
7727
7727
  });
7728
7728
 
7729
7729
  // src/serializer/pgSchema.ts
7730
- var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn, index2, indexV4, indexV5, indexV6, fk2, sequenceSchema, sequenceSquashed, columnV7, column2, checkConstraint2, columnSquashed, tableV32, compositePK2, uniqueConstraint2, viewWithOption, matViewWithOption, mergedViewWithOption, view2, tableV42, tableV5, tableV6, tableV7, table2, schemaHash2, kitInternals2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaInternalV6, pgSchemaExternal, pgSchemaInternalV7, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashedV6, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchemaV6, pgSchemaV7, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg;
7730
+ var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn, index2, indexV4, indexV5, indexV6, fk2, sequenceSchema, roleSchema, sequenceSquashed, columnV7, column2, checkConstraint2, columnSquashed, tableV32, compositePK2, uniqueConstraint2, policy, viewWithOption, matViewWithOption, mergedViewWithOption, view2, tableV42, tableV5, tableV6, tableV7, table2, schemaHash2, kitInternals2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaInternalV6, pgSchemaExternal, pgSchemaInternalV7, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashedV6, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchemaV6, pgSchemaV7, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg;
7731
7731
  var init_pgSchema = __esm({
7732
7732
  "src/serializer/pgSchema.ts"() {
7733
7733
  "use strict";
@@ -7859,6 +7859,12 @@ var init_pgSchema = __esm({
7859
7859
  cycle: booleanType().optional(),
7860
7860
  schema: stringType()
7861
7861
  }).strict();
7862
+ roleSchema = objectType({
7863
+ name: stringType(),
7864
+ createDb: booleanType().optional(),
7865
+ createRole: booleanType().optional(),
7866
+ inherit: booleanType().optional()
7867
+ }).strict();
7862
7868
  sequenceSquashed = objectType({
7863
7869
  name: stringType(),
7864
7870
  schema: stringType(),
@@ -7926,6 +7932,14 @@ var init_pgSchema = __esm({
7926
7932
  columns: stringType().array(),
7927
7933
  nullsNotDistinct: booleanType()
7928
7934
  }).strict();
7935
+ policy = objectType({
7936
+ name: stringType(),
7937
+ as: enumType(["PERMISSIVE", "RESTRICTIVE"]).optional(),
7938
+ for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
7939
+ to: stringType().array().optional(),
7940
+ using: stringType().optional(),
7941
+ withCheck: stringType().optional()
7942
+ }).strict();
7929
7943
  viewWithOption = objectType({
7930
7944
  checkOption: enumType(["local", "cascaded"]).optional(),
7931
7945
  securityBarrier: booleanType().optional(),
@@ -8006,7 +8020,9 @@ var init_pgSchema = __esm({
8006
8020
  foreignKeys: recordType(stringType(), fk2),
8007
8021
  compositePrimaryKeys: recordType(stringType(), compositePK2),
8008
8022
  uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
8009
- checkConstraints: recordType(stringType(), checkConstraint2).default({})
8023
+ policies: recordType(stringType(), policy).default({}),
8024
+ checkConstraints: recordType(stringType(), checkConstraint2).default({}),
8025
+ isRLSEnabled: booleanType().default(false)
8010
8026
  }).strict();
8011
8027
  schemaHash2 = objectType({
8012
8028
  id: stringType(),
@@ -8101,6 +8117,7 @@ var init_pgSchema = __esm({
8101
8117
  schemas: recordType(stringType(), stringType()),
8102
8118
  views: recordType(stringType(), view2).default({}),
8103
8119
  sequences: recordType(stringType(), sequenceSchema).default({}),
8120
+ roles: recordType(stringType(), roleSchema).default({}),
8104
8121
  _meta: objectType({
8105
8122
  schemas: recordType(stringType(), stringType()),
8106
8123
  tables: recordType(stringType(), stringType()),
@@ -8116,7 +8133,9 @@ var init_pgSchema = __esm({
8116
8133
  foreignKeys: recordType(stringType(), stringType()),
8117
8134
  compositePrimaryKeys: recordType(stringType(), stringType()),
8118
8135
  uniqueConstraints: recordType(stringType(), stringType()),
8119
- checkConstraints: recordType(stringType(), stringType())
8136
+ policies: recordType(stringType(), stringType()),
8137
+ checkConstraints: recordType(stringType(), stringType()),
8138
+ isRLSEnabled: booleanType().default(false)
8120
8139
  }).strict();
8121
8140
  tableSquashedV42 = objectType({
8122
8141
  name: stringType(),
@@ -8146,7 +8165,8 @@ var init_pgSchema = __esm({
8146
8165
  enums: recordType(stringType(), enumSchema),
8147
8166
  schemas: recordType(stringType(), stringType()),
8148
8167
  views: recordType(stringType(), view2),
8149
- sequences: recordType(stringType(), sequenceSquashed)
8168
+ sequences: recordType(stringType(), sequenceSquashed),
8169
+ roles: recordType(stringType(), roleSchema).default({})
8150
8170
  }).strict();
8151
8171
  pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
8152
8172
  pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
@@ -8229,6 +8249,23 @@ var init_pgSchema = __esm({
8229
8249
  squashFK: (fk4) => {
8230
8250
  return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${fk4.onUpdate ?? ""};${fk4.onDelete ?? ""};${fk4.schemaTo || "public"}`;
8231
8251
  },
8252
+ squashPolicy: (policy2) => {
8253
+ return `${policy2.name}--${policy2.as}--${policy2.for}--${policy2.to?.join(",")}--${policy2.using}--${policy2.withCheck}`;
8254
+ },
8255
+ unsquashPolicy: (policy2) => {
8256
+ const splitted = policy2.split("--");
8257
+ return {
8258
+ name: splitted[0],
8259
+ as: splitted[1],
8260
+ for: splitted[2],
8261
+ to: splitted[3].split(","),
8262
+ using: splitted[4] !== "undefined" ? splitted[4] : void 0,
8263
+ withCheck: splitted[5] !== "undefined" ? splitted[5] : void 0
8264
+ };
8265
+ },
8266
+ squashPolicyPush: (policy2) => {
8267
+ return `${policy2.name}--${policy2.as}--${policy2.for}--${policy2.to?.join(",")}`;
8268
+ },
8232
8269
  squashPK: (pk) => {
8233
8270
  return `${pk.columns.join(",")};${pk.name}`;
8234
8271
  },
@@ -8341,6 +8378,9 @@ var init_pgSchema = __esm({
8341
8378
  return PgSquasher.squashUnique(unq);
8342
8379
  }
8343
8380
  );
8381
+ const squashedPolicies = mapValues(it[1].policies, (policy2) => {
8382
+ return action === "push" ? PgSquasher.squashPolicyPush(policy2) : PgSquasher.squashPolicy(policy2);
8383
+ });
8344
8384
  const squashedChecksContraints = mapValues(
8345
8385
  it[1].checkConstraints,
8346
8386
  (check) => {
@@ -8357,7 +8397,9 @@ var init_pgSchema = __esm({
8357
8397
  foreignKeys: squashedFKs,
8358
8398
  compositePrimaryKeys: squashedPKs,
8359
8399
  uniqueConstraints: squashedUniqueConstraints,
8360
- checkConstraints: squashedChecksContraints
8400
+ policies: squashedPolicies,
8401
+ checkConstraints: squashedChecksContraints,
8402
+ isRLSEnabled: it[1].isRLSEnabled ?? false
8361
8403
  }
8362
8404
  ];
8363
8405
  })
@@ -8381,7 +8423,8 @@ var init_pgSchema = __esm({
8381
8423
  enums: json3.enums,
8382
8424
  schemas: json3.schemas,
8383
8425
  views: json3.views,
8384
- sequences: mappedSequences
8426
+ sequences: mappedSequences,
8427
+ roles: json3.roles
8385
8428
  };
8386
8429
  };
8387
8430
  dryPg = pgSchema.parse({
@@ -8484,7 +8527,7 @@ var init_sqliteSchema = __esm({
8484
8527
  version: literalType("4"),
8485
8528
  dialect: dialect2,
8486
8529
  tables: recordType(stringType(), table3),
8487
- views: recordType(stringType(), view3),
8530
+ views: recordType(stringType(), view3).default({}),
8488
8531
  enums: objectType({})
8489
8532
  }).strict();
8490
8533
  schemaInternalV52 = objectType({
@@ -8513,7 +8556,7 @@ var init_sqliteSchema = __esm({
8513
8556
  version: latestVersion,
8514
8557
  dialect: dialect2,
8515
8558
  tables: recordType(stringType(), table3),
8516
- views: recordType(stringType(), view3),
8559
+ views: recordType(stringType(), view3).default({}),
8517
8560
  enums: objectType({}),
8518
8561
  _meta: objectType({
8519
8562
  tables: recordType(stringType(), stringType()),
@@ -8765,7 +8808,7 @@ var init_utils = __esm({
8765
8808
  });
8766
8809
 
8767
8810
  // src/cli/views.ts
8768
- var import_hanji, warning, error, isRenamePromptItem, ResolveColumnSelect, tableKey, ResolveSelect, ResolveSchemasSelect, Spinner, ProgressView;
8811
+ var import_hanji, warning, error, isRenamePromptItem, ResolveColumnSelect, tableKey, ResolveSelectNamed, ResolveSelect, ResolveSchemasSelect, Spinner, ProgressView;
8769
8812
  var init_views = __esm({
8770
8813
  "src/cli/views.ts"() {
8771
8814
  "use strict";
@@ -8830,6 +8873,53 @@ Is ${source_default.bold.blue(
8830
8873
  tableKey = (it) => {
8831
8874
  return it.schema === "public" || !it.schema ? it.name : `${it.schema}.${it.name}`;
8832
8875
  };
8876
+ ResolveSelectNamed = class extends import_hanji.Prompt {
8877
+ constructor(base, data, entityType) {
8878
+ super();
8879
+ this.base = base;
8880
+ this.entityType = entityType;
8881
+ this.on("attach", (terminal) => terminal.toggleCursor("hide"));
8882
+ this.state = new import_hanji.SelectState(data);
8883
+ this.state.bind(this);
8884
+ this.base = base;
8885
+ }
8886
+ render(status) {
8887
+ if (status === "submitted" || status === "aborted") {
8888
+ return "";
8889
+ }
8890
+ const key = this.base.name;
8891
+ let text4 = `
8892
+ Is ${source_default.bold.blue(key)} ${this.entityType} created or renamed from another ${this.entityType}?
8893
+ `;
8894
+ const isSelectedRenamed = isRenamePromptItem(
8895
+ this.state.items[this.state.selectedIdx]
8896
+ );
8897
+ const selectedPrefix = isSelectedRenamed ? source_default.yellow("\u276F ") : source_default.green("\u276F ");
8898
+ const labelLength = this.state.items.filter((it) => isRenamePromptItem(it)).map((_2) => {
8899
+ const it = _2;
8900
+ const keyFrom = it.from.name;
8901
+ return key.length + 3 + keyFrom.length;
8902
+ }).reduce((a, b) => {
8903
+ if (a > b) {
8904
+ return a;
8905
+ }
8906
+ return b;
8907
+ }, 0);
8908
+ const entityType = this.entityType;
8909
+ this.state.items.forEach((it, idx) => {
8910
+ const isSelected = idx === this.state.selectedIdx;
8911
+ const isRenamed = isRenamePromptItem(it);
8912
+ const title = isRenamed ? `${it.from.name} \u203A ${it.to.name}`.padEnd(labelLength, " ") : it.name.padEnd(labelLength, " ");
8913
+ const label = isRenamed ? `${source_default.yellow("~")} ${title} ${source_default.gray(`rename ${entityType}`)}` : `${source_default.green("+")} ${title} ${source_default.gray(`create ${entityType}`)}`;
8914
+ text4 += isSelected ? `${selectedPrefix}${label}` : ` ${label}`;
8915
+ text4 += idx != this.state.items.length - 1 ? "\n" : "";
8916
+ });
8917
+ return text4;
8918
+ }
8919
+ result() {
8920
+ return this.state.items[this.state.selectedIdx];
8921
+ }
8922
+ };
8833
8923
  ResolveSelect = class extends import_hanji.Prompt {
8834
8924
  constructor(base, data, entityType) {
8835
8925
  super();
@@ -9046,57 +9136,57 @@ var require_heap = __commonJS({
9046
9136
  }
9047
9137
  return [].splice.apply(a, [lo, lo - lo].concat(x)), x;
9048
9138
  };
9049
- heappush = function(array, item, cmp) {
9139
+ heappush = function(array2, item, cmp) {
9050
9140
  if (cmp == null) {
9051
9141
  cmp = defaultCmp;
9052
9142
  }
9053
- array.push(item);
9054
- return _siftdown(array, 0, array.length - 1, cmp);
9143
+ array2.push(item);
9144
+ return _siftdown(array2, 0, array2.length - 1, cmp);
9055
9145
  };
9056
- heappop = function(array, cmp) {
9146
+ heappop = function(array2, cmp) {
9057
9147
  var lastelt, returnitem;
9058
9148
  if (cmp == null) {
9059
9149
  cmp = defaultCmp;
9060
9150
  }
9061
- lastelt = array.pop();
9062
- if (array.length) {
9063
- returnitem = array[0];
9064
- array[0] = lastelt;
9065
- _siftup(array, 0, cmp);
9151
+ lastelt = array2.pop();
9152
+ if (array2.length) {
9153
+ returnitem = array2[0];
9154
+ array2[0] = lastelt;
9155
+ _siftup(array2, 0, cmp);
9066
9156
  } else {
9067
9157
  returnitem = lastelt;
9068
9158
  }
9069
9159
  return returnitem;
9070
9160
  };
9071
- heapreplace = function(array, item, cmp) {
9161
+ heapreplace = function(array2, item, cmp) {
9072
9162
  var returnitem;
9073
9163
  if (cmp == null) {
9074
9164
  cmp = defaultCmp;
9075
9165
  }
9076
- returnitem = array[0];
9077
- array[0] = item;
9078
- _siftup(array, 0, cmp);
9166
+ returnitem = array2[0];
9167
+ array2[0] = item;
9168
+ _siftup(array2, 0, cmp);
9079
9169
  return returnitem;
9080
9170
  };
9081
- heappushpop = function(array, item, cmp) {
9171
+ heappushpop = function(array2, item, cmp) {
9082
9172
  var _ref;
9083
9173
  if (cmp == null) {
9084
9174
  cmp = defaultCmp;
9085
9175
  }
9086
- if (array.length && cmp(array[0], item) < 0) {
9087
- _ref = [array[0], item], item = _ref[0], array[0] = _ref[1];
9088
- _siftup(array, 0, cmp);
9176
+ if (array2.length && cmp(array2[0], item) < 0) {
9177
+ _ref = [array2[0], item], item = _ref[0], array2[0] = _ref[1];
9178
+ _siftup(array2, 0, cmp);
9089
9179
  }
9090
9180
  return item;
9091
9181
  };
9092
- heapify = function(array, cmp) {
9182
+ heapify = function(array2, cmp) {
9093
9183
  var i, _i2, _j2, _len, _ref, _ref1, _results, _results1;
9094
9184
  if (cmp == null) {
9095
9185
  cmp = defaultCmp;
9096
9186
  }
9097
9187
  _ref1 = function() {
9098
9188
  _results1 = [];
9099
- for (var _j3 = 0, _ref2 = floor(array.length / 2); 0 <= _ref2 ? _j3 < _ref2 : _j3 > _ref2; 0 <= _ref2 ? _j3++ : _j3--) {
9189
+ for (var _j3 = 0, _ref2 = floor(array2.length / 2); 0 <= _ref2 ? _j3 < _ref2 : _j3 > _ref2; 0 <= _ref2 ? _j3++ : _j3--) {
9100
9190
  _results1.push(_j3);
9101
9191
  }
9102
9192
  return _results1;
@@ -9104,51 +9194,51 @@ var require_heap = __commonJS({
9104
9194
  _results = [];
9105
9195
  for (_i2 = 0, _len = _ref1.length; _i2 < _len; _i2++) {
9106
9196
  i = _ref1[_i2];
9107
- _results.push(_siftup(array, i, cmp));
9197
+ _results.push(_siftup(array2, i, cmp));
9108
9198
  }
9109
9199
  return _results;
9110
9200
  };
9111
- updateItem = function(array, item, cmp) {
9201
+ updateItem = function(array2, item, cmp) {
9112
9202
  var pos;
9113
9203
  if (cmp == null) {
9114
9204
  cmp = defaultCmp;
9115
9205
  }
9116
- pos = array.indexOf(item);
9206
+ pos = array2.indexOf(item);
9117
9207
  if (pos === -1) {
9118
9208
  return;
9119
9209
  }
9120
- _siftdown(array, 0, pos, cmp);
9121
- return _siftup(array, pos, cmp);
9210
+ _siftdown(array2, 0, pos, cmp);
9211
+ return _siftup(array2, pos, cmp);
9122
9212
  };
9123
- nlargest = function(array, n, cmp) {
9213
+ nlargest = function(array2, n, cmp) {
9124
9214
  var elem, result, _i2, _len, _ref;
9125
9215
  if (cmp == null) {
9126
9216
  cmp = defaultCmp;
9127
9217
  }
9128
- result = array.slice(0, n);
9218
+ result = array2.slice(0, n);
9129
9219
  if (!result.length) {
9130
9220
  return result;
9131
9221
  }
9132
9222
  heapify(result, cmp);
9133
- _ref = array.slice(n);
9223
+ _ref = array2.slice(n);
9134
9224
  for (_i2 = 0, _len = _ref.length; _i2 < _len; _i2++) {
9135
9225
  elem = _ref[_i2];
9136
9226
  heappushpop(result, elem, cmp);
9137
9227
  }
9138
9228
  return result.sort(cmp).reverse();
9139
9229
  };
9140
- nsmallest = function(array, n, cmp) {
9230
+ nsmallest = function(array2, n, cmp) {
9141
9231
  var elem, i, los, result, _i2, _j2, _len, _ref, _ref1, _results;
9142
9232
  if (cmp == null) {
9143
9233
  cmp = defaultCmp;
9144
9234
  }
9145
- if (n * 10 <= array.length) {
9146
- result = array.slice(0, n).sort(cmp);
9235
+ if (n * 10 <= array2.length) {
9236
+ result = array2.slice(0, n).sort(cmp);
9147
9237
  if (!result.length) {
9148
9238
  return result;
9149
9239
  }
9150
9240
  los = result[result.length - 1];
9151
- _ref = array.slice(n);
9241
+ _ref = array2.slice(n);
9152
9242
  for (_i2 = 0, _len = _ref.length; _i2 < _len; _i2++) {
9153
9243
  elem = _ref[_i2];
9154
9244
  if (cmp(elem, los) < 0) {
@@ -9159,51 +9249,51 @@ var require_heap = __commonJS({
9159
9249
  }
9160
9250
  return result;
9161
9251
  }
9162
- heapify(array, cmp);
9252
+ heapify(array2, cmp);
9163
9253
  _results = [];
9164
- for (i = _j2 = 0, _ref1 = min2(n, array.length); 0 <= _ref1 ? _j2 < _ref1 : _j2 > _ref1; i = 0 <= _ref1 ? ++_j2 : --_j2) {
9165
- _results.push(heappop(array, cmp));
9254
+ for (i = _j2 = 0, _ref1 = min2(n, array2.length); 0 <= _ref1 ? _j2 < _ref1 : _j2 > _ref1; i = 0 <= _ref1 ? ++_j2 : --_j2) {
9255
+ _results.push(heappop(array2, cmp));
9166
9256
  }
9167
9257
  return _results;
9168
9258
  };
9169
- _siftdown = function(array, startpos, pos, cmp) {
9259
+ _siftdown = function(array2, startpos, pos, cmp) {
9170
9260
  var newitem, parent, parentpos;
9171
9261
  if (cmp == null) {
9172
9262
  cmp = defaultCmp;
9173
9263
  }
9174
- newitem = array[pos];
9264
+ newitem = array2[pos];
9175
9265
  while (pos > startpos) {
9176
9266
  parentpos = pos - 1 >> 1;
9177
- parent = array[parentpos];
9267
+ parent = array2[parentpos];
9178
9268
  if (cmp(newitem, parent) < 0) {
9179
- array[pos] = parent;
9269
+ array2[pos] = parent;
9180
9270
  pos = parentpos;
9181
9271
  continue;
9182
9272
  }
9183
9273
  break;
9184
9274
  }
9185
- return array[pos] = newitem;
9275
+ return array2[pos] = newitem;
9186
9276
  };
9187
- _siftup = function(array, pos, cmp) {
9277
+ _siftup = function(array2, pos, cmp) {
9188
9278
  var childpos, endpos, newitem, rightpos, startpos;
9189
9279
  if (cmp == null) {
9190
9280
  cmp = defaultCmp;
9191
9281
  }
9192
- endpos = array.length;
9282
+ endpos = array2.length;
9193
9283
  startpos = pos;
9194
- newitem = array[pos];
9284
+ newitem = array2[pos];
9195
9285
  childpos = 2 * pos + 1;
9196
9286
  while (childpos < endpos) {
9197
9287
  rightpos = childpos + 1;
9198
- if (rightpos < endpos && !(cmp(array[childpos], array[rightpos]) < 0)) {
9288
+ if (rightpos < endpos && !(cmp(array2[childpos], array2[rightpos]) < 0)) {
9199
9289
  childpos = rightpos;
9200
9290
  }
9201
- array[pos] = array[childpos];
9291
+ array2[pos] = array2[childpos];
9202
9292
  pos = childpos;
9203
9293
  childpos = 2 * pos + 1;
9204
9294
  }
9205
- array[pos] = newitem;
9206
- return _siftdown(array, startpos, pos, cmp);
9295
+ array2[pos] = newitem;
9296
+ return _siftdown(array2, startpos, pos, cmp);
9207
9297
  };
9208
9298
  Heap = function() {
9209
9299
  Heap2.push = heappush;
@@ -11130,12 +11220,12 @@ var require_lib = __commonJS({
11130
11220
  }
11131
11221
  return bestMatch;
11132
11222
  }
11133
- scalarize(array, originals, fuzzyOriginals) {
11223
+ scalarize(array2, originals, fuzzyOriginals) {
11134
11224
  const fuzzyMatches = [];
11135
11225
  if (fuzzyOriginals) {
11136
11226
  const keyScores = {};
11137
- for (let index4 = 0; index4 < array.length; index4++) {
11138
- const item = array[index4];
11227
+ for (let index4 = 0; index4 < array2.length; index4++) {
11228
+ const item = array2[index4];
11139
11229
  if (this.isScalar(item)) {
11140
11230
  continue;
11141
11231
  }
@@ -11149,8 +11239,8 @@ var require_lib = __commonJS({
11149
11239
  }
11150
11240
  }
11151
11241
  const result = [];
11152
- for (let index4 = 0; index4 < array.length; index4++) {
11153
- const item = array[index4];
11242
+ for (let index4 = 0; index4 < array2.length; index4++) {
11243
+ const item = array2[index4];
11154
11244
  if (this.isScalar(item)) {
11155
11245
  result.push(item);
11156
11246
  } else {
@@ -11372,6 +11462,37 @@ function diffColumns(left, right) {
11372
11462
  );
11373
11463
  return alteredTables;
11374
11464
  }
11465
+ function diffPolicies(left, right) {
11466
+ left = JSON.parse(JSON.stringify(left));
11467
+ right = JSON.parse(JSON.stringify(right));
11468
+ const result = (0, import_json_diff.diff)(left, right) ?? {};
11469
+ const alteredTables = Object.fromEntries(
11470
+ Object.entries(result).filter((it) => {
11471
+ return !(it[0].includes("__added") || it[0].includes("__deleted"));
11472
+ }).map((tableEntry) => {
11473
+ const deletedPolicies = Object.entries(tableEntry[1].policies ?? {}).filter((it) => {
11474
+ return it[0].endsWith("__deleted");
11475
+ }).map((it) => {
11476
+ return it[1];
11477
+ });
11478
+ const addedPolicies = Object.entries(tableEntry[1].policies ?? {}).filter((it) => {
11479
+ return it[0].endsWith("__added");
11480
+ }).map((it) => {
11481
+ return it[1];
11482
+ });
11483
+ tableEntry[1].policies = {
11484
+ added: addedPolicies,
11485
+ deleted: deletedPolicies
11486
+ };
11487
+ const table4 = left[tableEntry[0]];
11488
+ return [
11489
+ tableEntry[0],
11490
+ { name: table4.name, schema: table4.schema, ...tableEntry[1] }
11491
+ ];
11492
+ })
11493
+ );
11494
+ return alteredTables;
11495
+ }
11375
11496
  function applyJsonDiff(json1, json22) {
11376
11497
  json1 = JSON.parse(JSON.stringify(json1));
11377
11498
  json22 = JSON.parse(JSON.stringify(json22));
@@ -11381,6 +11502,7 @@ function applyJsonDiff(json1, json22) {
11381
11502
  difference.tables = difference.tables || {};
11382
11503
  difference.enums = difference.enums || {};
11383
11504
  difference.sequences = difference.sequences || {};
11505
+ difference.roles = difference.roles || {};
11384
11506
  difference.views = difference.views || {};
11385
11507
  const schemaKeys = Object.keys(difference.schemas);
11386
11508
  for (let key of schemaKeys) {
@@ -11437,6 +11559,10 @@ function applyJsonDiff(json1, json22) {
11437
11559
  const alteredSequences = sequencesEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted")) && "values" in it[1]).map((it) => {
11438
11560
  return json22.sequences[it[0]];
11439
11561
  });
11562
+ const rolesEntries = Object.entries(difference.roles);
11563
+ const alteredRoles = rolesEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted"))).map((it) => {
11564
+ return json22.roles[it[0]];
11565
+ });
11440
11566
  const viewsEntries = Object.entries(difference.views);
11441
11567
  const alteredViews = viewsEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted"))).map(
11442
11568
  ([nameWithSchema, view4]) => {
@@ -11510,6 +11636,7 @@ function applyJsonDiff(json1, json22) {
11510
11636
  alteredTablesWithColumns,
11511
11637
  alteredEnums,
11512
11638
  alteredSequences,
11639
+ alteredRoles,
11513
11640
  alteredViews
11514
11641
  };
11515
11642
  }
@@ -11570,6 +11697,21 @@ var init_jsonDiffer = __esm({
11570
11697
  return !it[0].endsWith("__deleted") && !it[0].endsWith("__added");
11571
11698
  })
11572
11699
  );
11700
+ const deletedPolicies = Object.fromEntries(
11701
+ Object.entries(table4.policies__deleted || {}).concat(
11702
+ Object.entries(table4.policies || {}).filter((it) => it[0].includes("__deleted"))
11703
+ ).map((entry) => [entry[0].replace("__deleted", ""), entry[1]])
11704
+ );
11705
+ const addedPolicies = Object.fromEntries(
11706
+ Object.entries(table4.policies__added || {}).concat(
11707
+ Object.entries(table4.policies || {}).filter((it) => it[0].includes("__added"))
11708
+ ).map((entry) => [entry[0].replace("__added", ""), entry[1]])
11709
+ );
11710
+ const alteredPolicies = Object.fromEntries(
11711
+ Object.entries(table4.policies || {}).filter((it) => {
11712
+ return !it[0].endsWith("__deleted") && !it[0].endsWith("__added");
11713
+ })
11714
+ );
11573
11715
  const deletedForeignKeys = Object.fromEntries(
11574
11716
  Object.entries(table4.foreignKeys__deleted || {}).concat(
11575
11717
  Object.entries(table4.foreignKeys || {}).filter((it) => it[0].includes("__deleted"))
@@ -11647,6 +11789,9 @@ var init_jsonDiffer = __esm({
11647
11789
  addedUniqueConstraints,
11648
11790
  deletedUniqueConstraints,
11649
11791
  alteredUniqueConstraints,
11792
+ deletedPolicies,
11793
+ addedPolicies,
11794
+ alteredPolicies,
11650
11795
  addedCheckConstraints,
11651
11796
  deletedCheckConstraints,
11652
11797
  alteredCheckConstraints
@@ -11949,7 +12094,7 @@ function fromJson(statements, dialect4, action, json22) {
11949
12094
  }).filter((it) => it !== "");
11950
12095
  return result;
11951
12096
  }
11952
- var pgNativeTypes, isPgNativeType, Convertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, PgCreateViewConvertor, MySqlCreateViewConvertor, SqliteCreateViewConvertor, PgDropViewConvertor, MySqlDropViewConvertor, SqliteDropViewConvertor, MySqlAlterViewConvertor, PgRenameViewConvertor, MySqlRenameViewConvertor, PgAlterViewSchemaConvertor, PgAlterViewAddWithOptionConvertor, PgAlterViewDropWithOptionConvertor, PgAlterViewAlterTablespaceConvertor, PgAlterViewAlterUsingConvertor, PgAlterTableAlterColumnSetGenerated, PgAlterTableAlterColumnDropGenerated, PgAlterTableAlterColumnAlterGenerated, PgAlterTableAddUniqueConstraintConvertor, PgAlterTableDropUniqueConstraintConvertor, PgAlterTableAddCheckConstraintConvertor, PgAlterTableDeleteCheckConstraintConvertor, MySQLAlterTableAddUniqueConstraintConvertor, MySQLAlterTableDropUniqueConstraintConvertor, MySqlAlterTableAddCheckConstraintConvertor, MySqlAlterTableDeleteCheckConstraintConvertor, CreatePgSequenceConvertor, DropPgSequenceConvertor, RenamePgSequenceConvertor, MovePgSequenceConvertor, AlterPgSequenceConvertor, CreateTypeEnumConvertor, DropTypeEnumConvertor, AlterTypeAddValueConvertor, AlterTypeSetSchemaConvertor, AlterRenameTypeConvertor, AlterTypeDropValueConvertor, PgDropTableConvertor, MySQLDropTableConvertor, SQLiteDropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, PgAlterTableAlterColumnDropGeneratedConvertor, PgAlterTableAlterColumnSetExpressionConvertor, PgAlterTableAlterColumnAlterrGeneratedConvertor, SqliteAlterTableAlterColumnDropGeneratedConvertor, SqliteAlterTableAlterColumnSetExpressionConvertor, SqliteAlterTableAlterColumnAlterGeneratedConvertor, MySqlAlterTableAlterColumnAlterrGeneratedConvertor, MySqlAlterTableAddPk, MySqlAlterTableDropPk, LibSQLModifyColumn, MySqlModifyColumn, PgAlterTableCreateCompositePrimaryKeyConvertor, PgAlterTableDeleteCompositePrimaryKeyConvertor, PgAlterTableAlterCompositePrimaryKeyConvertor, MySqlAlterTableCreateCompositePrimaryKeyConvertor, MySqlAlterTableDeleteCompositePrimaryKeyConvertor, MySqlAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetPrimaryKeyConvertor, PgAlterTableAlterColumnDropPrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, PgAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, LibSQLCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MySqlDropIndexConvertor, SQLiteRecreateTableConvertor, LibSQLRecreateTableConvertor, convertors;
12097
+ var pgNativeTypes, isPgNativeType, Convertor, PgCreateRoleConvertor, PgDropRoleConvertor, PgRenameRoleConvertor, PgAlterRoleConvertor, PgCreatePolicyConvertor, PgDropPolicyConvertor, PgRenamePolicyConvertor, PgAlterPolicyConvertor, PgEnableRlsConvertor, PgDisableRlsConvertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, PgCreateViewConvertor, MySqlCreateViewConvertor, SqliteCreateViewConvertor, PgDropViewConvertor, MySqlDropViewConvertor, SqliteDropViewConvertor, MySqlAlterViewConvertor, PgRenameViewConvertor, MySqlRenameViewConvertor, PgAlterViewSchemaConvertor, PgAlterViewAddWithOptionConvertor, PgAlterViewDropWithOptionConvertor, PgAlterViewAlterTablespaceConvertor, PgAlterViewAlterUsingConvertor, PgAlterTableAlterColumnSetGenerated, PgAlterTableAlterColumnDropGenerated, PgAlterTableAlterColumnAlterGenerated, PgAlterTableAddUniqueConstraintConvertor, PgAlterTableDropUniqueConstraintConvertor, PgAlterTableAddCheckConstraintConvertor, PgAlterTableDeleteCheckConstraintConvertor, MySQLAlterTableAddUniqueConstraintConvertor, MySQLAlterTableDropUniqueConstraintConvertor, MySqlAlterTableAddCheckConstraintConvertor, MySqlAlterTableDeleteCheckConstraintConvertor, CreatePgSequenceConvertor, DropPgSequenceConvertor, RenamePgSequenceConvertor, MovePgSequenceConvertor, AlterPgSequenceConvertor, CreateTypeEnumConvertor, DropTypeEnumConvertor, AlterTypeAddValueConvertor, AlterTypeSetSchemaConvertor, AlterRenameTypeConvertor, AlterTypeDropValueConvertor, PgDropTableConvertor, MySQLDropTableConvertor, SQLiteDropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, PgAlterTableAlterColumnDropGeneratedConvertor, PgAlterTableAlterColumnSetExpressionConvertor, PgAlterTableAlterColumnAlterrGeneratedConvertor, SqliteAlterTableAlterColumnDropGeneratedConvertor, SqliteAlterTableAlterColumnSetExpressionConvertor, SqliteAlterTableAlterColumnAlterGeneratedConvertor, MySqlAlterTableAlterColumnAlterrGeneratedConvertor, MySqlAlterTableAddPk, MySqlAlterTableDropPk, LibSQLModifyColumn, MySqlModifyColumn, PgAlterTableCreateCompositePrimaryKeyConvertor, PgAlterTableDeleteCompositePrimaryKeyConvertor, PgAlterTableAlterCompositePrimaryKeyConvertor, MySqlAlterTableCreateCompositePrimaryKeyConvertor, MySqlAlterTableDeleteCompositePrimaryKeyConvertor, MySqlAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetPrimaryKeyConvertor, PgAlterTableAlterColumnDropPrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, PgAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, LibSQLCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MySqlDropIndexConvertor, SQLiteRecreateTableConvertor, LibSQLRecreateTableConvertor, convertors;
11953
12098
  var init_sqlgenerator = __esm({
11954
12099
  "src/sqlgenerator.ts"() {
11955
12100
  "use strict";
@@ -12005,12 +12150,109 @@ var init_sqlgenerator = __esm({
12005
12150
  };
12006
12151
  Convertor = class {
12007
12152
  };
12153
+ PgCreateRoleConvertor = class extends Convertor {
12154
+ can(statement, dialect4) {
12155
+ return statement.type === "create_role" && dialect4 === "postgresql";
12156
+ }
12157
+ convert(statement) {
12158
+ return `CREATE ROLE "${statement.name}"${statement.values.createDb || statement.values.createRole || !statement.values.inherit ? ` WITH${statement.values.createDb ? " CREATEDB" : ""}${statement.values.createRole ? " CREATEROLE" : ""}${statement.values.inherit ? "" : " NOINHERIT"}` : ""};`;
12159
+ }
12160
+ };
12161
+ PgDropRoleConvertor = class extends Convertor {
12162
+ can(statement, dialect4) {
12163
+ return statement.type === "drop_role" && dialect4 === "postgresql";
12164
+ }
12165
+ convert(statement) {
12166
+ return `DROP ROLE "${statement.name}";`;
12167
+ }
12168
+ };
12169
+ PgRenameRoleConvertor = class extends Convertor {
12170
+ can(statement, dialect4) {
12171
+ return statement.type === "rename_role" && dialect4 === "postgresql";
12172
+ }
12173
+ convert(statement) {
12174
+ return `ALTER ROLE "${statement.nameFrom}" RENAME TO "${statement.nameTo}";`;
12175
+ }
12176
+ };
12177
+ PgAlterRoleConvertor = class extends Convertor {
12178
+ can(statement, dialect4) {
12179
+ return statement.type === "alter_role" && dialect4 === "postgresql";
12180
+ }
12181
+ convert(statement) {
12182
+ return `ALTER ROLE "${statement.name}"${` WITH${statement.values.createDb ? " CREATEDB" : " NOCREATEDB"}${statement.values.createRole ? " CREATEROLE" : " NOCREATEROLE"}${statement.values.inherit ? " INHERIT" : " NOINHERIT"}`};`;
12183
+ }
12184
+ };
12185
+ PgCreatePolicyConvertor = class extends Convertor {
12186
+ can(statement, dialect4) {
12187
+ return statement.type === "create_policy" && dialect4 === "postgresql";
12188
+ }
12189
+ convert(statement) {
12190
+ const policy2 = statement.data;
12191
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12192
+ const usingPart = policy2.using ? ` USING (${policy2.using})` : "";
12193
+ const withCheckPart = policy2.withCheck ? ` WITH CHECK (${policy2.withCheck})` : "";
12194
+ const policyToPart = policy2.to?.map(
12195
+ (v) => ["current_user", "current_role", "session_user", "public"].includes(v) ? v : `"${v}"`
12196
+ ).join(", ");
12197
+ return `CREATE POLICY "${policy2.name}" ON ${tableNameWithSchema} AS ${policy2.as?.toUpperCase()} FOR ${policy2.for?.toUpperCase()} TO ${policyToPart}${usingPart}${withCheckPart};`;
12198
+ }
12199
+ };
12200
+ PgDropPolicyConvertor = class extends Convertor {
12201
+ can(statement, dialect4) {
12202
+ return statement.type === "drop_policy" && dialect4 === "postgresql";
12203
+ }
12204
+ convert(statement) {
12205
+ const policy2 = statement.data;
12206
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12207
+ return `DROP POLICY "${policy2.name}" ON ${tableNameWithSchema} CASCADE;`;
12208
+ }
12209
+ };
12210
+ PgRenamePolicyConvertor = class extends Convertor {
12211
+ can(statement, dialect4) {
12212
+ return statement.type === "rename_policy" && dialect4 === "postgresql";
12213
+ }
12214
+ convert(statement) {
12215
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12216
+ return `ALTER POLICY "${statement.oldName}" ON ${tableNameWithSchema} RENAME TO "${statement.newName}";`;
12217
+ }
12218
+ };
12219
+ PgAlterPolicyConvertor = class extends Convertor {
12220
+ can(statement, dialect4) {
12221
+ return statement.type === "alter_policy" && dialect4 === "postgresql";
12222
+ }
12223
+ convert(statement) {
12224
+ const newPolicy = PgSquasher.unsquashPolicy(statement.newData);
12225
+ const oldPolicy = PgSquasher.unsquashPolicy(statement.oldData);
12226
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12227
+ const usingPart = newPolicy.using ? ` USING (${newPolicy.using})` : oldPolicy.using ? ` USING (${oldPolicy.using})` : "";
12228
+ const withCheckPart = newPolicy.withCheck ? ` WITH CHECK (${newPolicy.withCheck})` : oldPolicy.withCheck ? ` WITH CHECK (${oldPolicy.withCheck})` : "";
12229
+ return `ALTER POLICY "${oldPolicy.name}" ON ${tableNameWithSchema} TO ${newPolicy.to}${usingPart}${withCheckPart};`;
12230
+ }
12231
+ };
12232
+ PgEnableRlsConvertor = class extends Convertor {
12233
+ can(statement, dialect4) {
12234
+ return statement.type === "enable_rls" && dialect4 === "postgresql";
12235
+ }
12236
+ convert(statement) {
12237
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12238
+ return `ALTER TABLE ${tableNameWithSchema} ENABLE ROW LEVEL SECURITY;`;
12239
+ }
12240
+ };
12241
+ PgDisableRlsConvertor = class extends Convertor {
12242
+ can(statement, dialect4) {
12243
+ return statement.type === "disable_rls" && dialect4 === "postgresql";
12244
+ }
12245
+ convert(statement) {
12246
+ const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12247
+ return `ALTER TABLE ${tableNameWithSchema} DISABLE ROW LEVEL SECURITY;`;
12248
+ }
12249
+ };
12008
12250
  PgCreateTableConvertor = class extends Convertor {
12009
12251
  can(statement, dialect4) {
12010
12252
  return statement.type === "create_table" && dialect4 === "postgresql";
12011
12253
  }
12012
12254
  convert(st) {
12013
- const { tableName, schema: schema4, columns, compositePKs, uniqueConstraints, checkConstraints } = st;
12255
+ const { tableName, schema: schema4, columns, compositePKs, uniqueConstraints, checkConstraints, policies, isRLSEnabled } = st;
12014
12256
  let statement = "";
12015
12257
  const name2 = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
12016
12258
  statement += `CREATE TABLE IF NOT EXISTS ${name2} (
@@ -12054,7 +12296,12 @@ var init_sqlgenerator = __esm({
12054
12296
  );`;
12055
12297
  statement += `
12056
12298
  `;
12057
- return statement;
12299
+ const enableRls = new PgEnableRlsConvertor().convert({
12300
+ type: "enable_rls",
12301
+ tableName,
12302
+ schema: schema4
12303
+ });
12304
+ return [statement, ...policies && policies.length > 0 || isRLSEnabled ? [enableRls] : []];
12058
12305
  }
12059
12306
  };
12060
12307
  MySqlCreateTableConvertor = class extends Convertor {
@@ -12653,9 +12900,21 @@ WITH ${withCheckOption} CHECK OPTION` : "";
12653
12900
  return statement.type === "drop_table" && dialect4 === "postgresql";
12654
12901
  }
12655
12902
  convert(statement) {
12656
- const { tableName, schema: schema4 } = statement;
12903
+ const { tableName, schema: schema4, policies } = statement;
12657
12904
  const tableNameWithSchema = schema4 ? `"${schema4}"."${tableName}"` : `"${tableName}"`;
12658
- return `DROP TABLE ${tableNameWithSchema};`;
12905
+ const dropPolicyConvertor = new PgDropPolicyConvertor();
12906
+ const droppedPolicies = policies?.map((p) => {
12907
+ return dropPolicyConvertor.convert({
12908
+ type: "drop_policy",
12909
+ tableName,
12910
+ data: PgSquasher.unsquashPolicy(p),
12911
+ schema: schema4
12912
+ });
12913
+ }) ?? [];
12914
+ return [
12915
+ ...droppedPolicies,
12916
+ `DROP TABLE ${tableNameWithSchema} CASCADE;`
12917
+ ];
12659
12918
  }
12660
12919
  };
12661
12920
  MySQLDropTableConvertor = class extends Convertor {
@@ -13857,6 +14116,16 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
13857
14116
  convertors.push(new PgAlterTableAlterColumnDropNotNullConvertor());
13858
14117
  convertors.push(new PgAlterTableAlterColumnSetDefaultConvertor());
13859
14118
  convertors.push(new PgAlterTableAlterColumnDropDefaultConvertor());
14119
+ convertors.push(new PgAlterPolicyConvertor());
14120
+ convertors.push(new PgCreatePolicyConvertor());
14121
+ convertors.push(new PgDropPolicyConvertor());
14122
+ convertors.push(new PgRenamePolicyConvertor());
14123
+ convertors.push(new PgEnableRlsConvertor());
14124
+ convertors.push(new PgDisableRlsConvertor());
14125
+ convertors.push(new PgDropRoleConvertor());
14126
+ convertors.push(new PgAlterRoleConvertor());
14127
+ convertors.push(new PgCreateRoleConvertor());
14128
+ convertors.push(new PgRenameRoleConvertor());
13860
14129
  convertors.push(new PgAlterTableAlterColumnSetExpressionConvertor());
13861
14130
  convertors.push(new PgAlterTableAlterColumnDropGeneratedConvertor());
13862
14131
  convertors.push(new PgAlterTableAlterColumnAlterrGeneratedConvertor());
@@ -14156,7 +14425,7 @@ var init_sqlitePushUtils = __esm({
14156
14425
  });
14157
14426
 
14158
14427
  // src/jsonStatements.ts
14159
- var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumValues, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareLibSQLCreateReferencesJson, prepareDropReferencesJson, prepareLibSQLDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCheckConstraint, prepareDeleteCheckConstraint, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql, preparePgCreateViewJson, prepareMySqlCreateViewJson, prepareSqliteCreateViewJson, prepareDropViewJson, prepareRenameViewJson, preparePgAlterViewAlterSchemaJson, preparePgAlterViewAddWithOptionJson, preparePgAlterViewDropWithOptionJson, preparePgAlterViewAlterTablespaceJson, preparePgAlterViewAlterUsingJson, prepareMySqlAlterView;
14428
+ var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumValues, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson, prepareCreateRoleJson, prepareAlterRoleJson, prepareDropRoleJson, prepareRenameRoleJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, prepareRenamePolicyJsons, prepareCreatePolicyJsons, prepareDropPolicyJsons, prepareAlterPolicyJson, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareLibSQLCreateReferencesJson, prepareDropReferencesJson, prepareLibSQLDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCheckConstraint, prepareDeleteCheckConstraint, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql, preparePgCreateViewJson, prepareMySqlCreateViewJson, prepareSqliteCreateViewJson, prepareDropViewJson, prepareRenameViewJson, preparePgAlterViewAlterSchemaJson, preparePgAlterViewAddWithOptionJson, preparePgAlterViewDropWithOptionJson, preparePgAlterViewAlterTablespaceJson, preparePgAlterViewAlterUsingJson, prepareMySqlAlterView;
14160
14429
  var init_jsonStatements = __esm({
14161
14430
  "src/jsonStatements.ts"() {
14162
14431
  "use strict";
@@ -14167,7 +14436,7 @@ var init_jsonStatements = __esm({
14167
14436
  init_pgSchema();
14168
14437
  init_sqliteSchema();
14169
14438
  preparePgCreateTableJson = (table4, json22) => {
14170
- const { name: name2, schema: schema4, columns, compositePrimaryKeys, uniqueConstraints, checkConstraints } = table4;
14439
+ const { name: name2, schema: schema4, columns, compositePrimaryKeys, uniqueConstraints, checkConstraints, policies, isRLSEnabled } = table4;
14171
14440
  const tableKey2 = `${schema4 || "public"}.${name2}`;
14172
14441
  const compositePkName = Object.values(compositePrimaryKeys).length > 0 ? json22.tables[tableKey2].compositePrimaryKeys[`${PgSquasher.unsquashPK(Object.values(compositePrimaryKeys)[0]).name}`].name : "";
14173
14442
  return {
@@ -14178,7 +14447,9 @@ var init_jsonStatements = __esm({
14178
14447
  compositePKs: Object.values(compositePrimaryKeys),
14179
14448
  compositePkName,
14180
14449
  uniqueConstraints: Object.values(uniqueConstraints),
14181
- checkConstraints: Object.values(checkConstraints)
14450
+ policies: Object.values(policies),
14451
+ checkConstraints: Object.values(checkConstraints),
14452
+ isRLSEnabled: isRLSEnabled ?? false
14182
14453
  };
14183
14454
  };
14184
14455
  prepareMySqlCreateTableJson = (table4, json22, internals) => {
@@ -14218,7 +14489,8 @@ var init_jsonStatements = __esm({
14218
14489
  return {
14219
14490
  type: "drop_table",
14220
14491
  tableName: table4.name,
14221
- schema: table4.schema
14492
+ schema: table4.schema,
14493
+ policies: table4.policies ? Object.values(table4.policies) : []
14222
14494
  };
14223
14495
  };
14224
14496
  prepareRenameTableJson = (tableFrom, tableTo) => {
@@ -14336,6 +14608,41 @@ var init_jsonStatements = __esm({
14336
14608
  schema: schema4
14337
14609
  };
14338
14610
  };
14611
+ prepareCreateRoleJson = (role) => {
14612
+ return {
14613
+ type: "create_role",
14614
+ name: role.name,
14615
+ values: {
14616
+ createDb: role.createDb,
14617
+ createRole: role.createRole,
14618
+ inherit: role.inherit
14619
+ }
14620
+ };
14621
+ };
14622
+ prepareAlterRoleJson = (role) => {
14623
+ return {
14624
+ type: "alter_role",
14625
+ name: role.name,
14626
+ values: {
14627
+ createDb: role.createDb,
14628
+ createRole: role.createRole,
14629
+ inherit: role.inherit
14630
+ }
14631
+ };
14632
+ };
14633
+ prepareDropRoleJson = (name2) => {
14634
+ return {
14635
+ type: "drop_role",
14636
+ name: name2
14637
+ };
14638
+ };
14639
+ prepareRenameRoleJson = (nameFrom, nameTo) => {
14640
+ return {
14641
+ type: "rename_role",
14642
+ nameFrom,
14643
+ nameTo
14644
+ };
14645
+ };
14339
14646
  prepareCreateSchemasJson = (values) => {
14340
14647
  return values.map((it) => {
14341
14648
  return {
@@ -15232,6 +15539,46 @@ var init_jsonStatements = __esm({
15232
15539
  }
15233
15540
  return [...dropPkStatements, ...setPkStatements, ...statements];
15234
15541
  };
15542
+ prepareRenamePolicyJsons = (tableName, schema4, renames) => {
15543
+ return renames.map((it) => {
15544
+ return {
15545
+ type: "rename_policy",
15546
+ tableName,
15547
+ oldName: it.from.name,
15548
+ newName: it.to.name,
15549
+ schema: schema4
15550
+ };
15551
+ });
15552
+ };
15553
+ prepareCreatePolicyJsons = (tableName, schema4, policies) => {
15554
+ return policies.map((it) => {
15555
+ return {
15556
+ type: "create_policy",
15557
+ tableName,
15558
+ data: it,
15559
+ schema: schema4
15560
+ };
15561
+ });
15562
+ };
15563
+ prepareDropPolicyJsons = (tableName, schema4, policies) => {
15564
+ return policies.map((it) => {
15565
+ return {
15566
+ type: "drop_policy",
15567
+ tableName,
15568
+ data: it,
15569
+ schema: schema4
15570
+ };
15571
+ });
15572
+ };
15573
+ prepareAlterPolicyJson = (tableName, schema4, oldPolicy, newPolicy) => {
15574
+ return {
15575
+ type: "alter_policy",
15576
+ tableName,
15577
+ oldData: oldPolicy,
15578
+ newData: newPolicy,
15579
+ schema: schema4
15580
+ };
15581
+ };
15235
15582
  preparePgCreateIndexesJson = (tableName, schema4, indexes, fullSchema, action) => {
15236
15583
  if (action === "push") {
15237
15584
  return Object.values(indexes).map((indexData) => {
@@ -16058,7 +16405,9 @@ var init_snapshotsDiffer = __esm({
16058
16405
  foreignKeys: recordType(stringType(), stringType()),
16059
16406
  compositePrimaryKeys: recordType(stringType(), stringType()).default({}),
16060
16407
  uniqueConstraints: recordType(stringType(), stringType()).default({}),
16061
- checkConstraints: recordType(stringType(), stringType()).default({})
16408
+ policies: recordType(stringType(), stringType()).default({}),
16409
+ checkConstraints: recordType(stringType(), stringType()).default({}),
16410
+ isRLSEnabled: booleanType().default(false)
16062
16411
  }).strict();
16063
16412
  alteredTableScheme = objectType({
16064
16413
  name: stringType(),
@@ -16100,6 +16449,15 @@ var init_snapshotsDiffer = __esm({
16100
16449
  __old: stringType()
16101
16450
  })
16102
16451
  ),
16452
+ addedPolicies: recordType(stringType(), stringType()),
16453
+ deletedPolicies: recordType(stringType(), stringType()),
16454
+ alteredPolicies: recordType(
16455
+ stringType(),
16456
+ objectType({
16457
+ __new: stringType(),
16458
+ __old: stringType()
16459
+ })
16460
+ ),
16103
16461
  addedCheckConstraints: recordType(
16104
16462
  stringType(),
16105
16463
  stringType()
@@ -16161,6 +16519,7 @@ var init_snapshotsDiffer = __esm({
16161
16519
  alteredTablesWithColumns: alteredTableScheme.array(),
16162
16520
  alteredEnums: changedEnumSchema.array(),
16163
16521
  alteredSequences: sequenceSquashed.array(),
16522
+ alteredRoles: roleSchema.array(),
16164
16523
  alteredViews: alteredPgViewSchema.array()
16165
16524
  }).strict();
16166
16525
  diffResultSchemeMysql = objectType({
@@ -16218,7 +16577,7 @@ var init_snapshotsDiffer = __esm({
16218
16577
  }
16219
16578
  return column4;
16220
16579
  };
16221
- applyPgSnapshotsDiff = async (json1, json22, schemasResolver2, enumsResolver2, sequencesResolver2, tablesResolver2, columnsResolver2, viewsResolver2, prevFull, curFull, action) => {
16580
+ applyPgSnapshotsDiff = async (json1, json22, schemasResolver2, enumsResolver2, sequencesResolver2, policyResolver2, roleResolver2, tablesResolver2, columnsResolver2, viewsResolver2, prevFull, curFull, action) => {
16222
16581
  const schemasDiff = diffSchemasOrTables(json1.schemas, json22.schemas);
16223
16582
  const {
16224
16583
  created: createdSchemas,
@@ -16368,6 +16727,47 @@ var init_snapshotsDiffer = __esm({
16368
16727
  return [tableKey2, tableValue];
16369
16728
  }
16370
16729
  );
16730
+ const rolesDiff = diffSchemasOrTables(
16731
+ schemasPatchedSnap1.roles,
16732
+ json22.roles
16733
+ );
16734
+ const {
16735
+ created: createdRoles,
16736
+ deleted: deletedRoles,
16737
+ renamed: renamedRoles
16738
+ } = await roleResolver2({
16739
+ created: rolesDiff.added,
16740
+ deleted: rolesDiff.deleted
16741
+ });
16742
+ schemasPatchedSnap1.roles = mapEntries(
16743
+ schemasPatchedSnap1.roles,
16744
+ (_2, it) => {
16745
+ const { name: name2 } = nameChangeFor(it, renamedRoles);
16746
+ it.name = name2;
16747
+ return [name2, it];
16748
+ }
16749
+ );
16750
+ const rolesChangeMap = renamedRoles.reduce(
16751
+ (acc, it) => {
16752
+ acc[it.from.name] = {
16753
+ nameFrom: it.from.name,
16754
+ nameTo: it.to.name
16755
+ };
16756
+ return acc;
16757
+ },
16758
+ {}
16759
+ );
16760
+ schemasPatchedSnap1.roles = mapEntries(
16761
+ schemasPatchedSnap1.roles,
16762
+ (roleKey, roleValue) => {
16763
+ const key = roleKey;
16764
+ const change = rolesChangeMap[key];
16765
+ if (change) {
16766
+ roleValue.name = change.nameTo;
16767
+ }
16768
+ return [roleKey, roleValue];
16769
+ }
16770
+ );
16371
16771
  const tablesDiff = diffSchemasOrTables(
16372
16772
  schemasPatchedSnap1.tables,
16373
16773
  json22.tables
@@ -16446,7 +16846,66 @@ var init_snapshotsDiffer = __esm({
16446
16846
  return [tableKey2, tableValue];
16447
16847
  }
16448
16848
  );
16449
- const viewsDiff = diffSchemasOrTables(json1.views, json22.views);
16849
+ const policyRes = diffPolicies(tablesPatchedSnap1.tables, json22.tables);
16850
+ const policyRenames = [];
16851
+ const policyCreates = [];
16852
+ const policyDeletes = [];
16853
+ for (let entry of Object.values(policyRes)) {
16854
+ const { renamed, created, deleted } = await policyResolver2({
16855
+ tableName: entry.name,
16856
+ schema: entry.schema,
16857
+ deleted: entry.policies.deleted.map(PgSquasher.unsquashPolicy),
16858
+ created: entry.policies.added.map(PgSquasher.unsquashPolicy)
16859
+ });
16860
+ if (created.length > 0) {
16861
+ policyCreates.push({
16862
+ table: entry.name,
16863
+ schema: entry.schema,
16864
+ columns: created
16865
+ });
16866
+ }
16867
+ if (deleted.length > 0) {
16868
+ policyDeletes.push({
16869
+ table: entry.name,
16870
+ schema: entry.schema,
16871
+ columns: deleted
16872
+ });
16873
+ }
16874
+ if (renamed.length > 0) {
16875
+ policyRenames.push({
16876
+ table: entry.name,
16877
+ schema: entry.schema,
16878
+ renames: renamed
16879
+ });
16880
+ }
16881
+ }
16882
+ const policyRenamesDict = columnRenames.reduce(
16883
+ (acc, it) => {
16884
+ acc[`${it.schema || "public"}.${it.table}`] = it.renames;
16885
+ return acc;
16886
+ },
16887
+ {}
16888
+ );
16889
+ const policyPatchedSnap1 = copy(tablesPatchedSnap1);
16890
+ policyPatchedSnap1.tables = mapEntries(
16891
+ policyPatchedSnap1.tables,
16892
+ (tableKey2, tableValue) => {
16893
+ const patchedPolicies = mapKeys(
16894
+ tableValue.policies,
16895
+ (policyKey, policy2) => {
16896
+ const rens = policyRenamesDict[`${tableValue.schema || "public"}.${tableValue.name}`] || [];
16897
+ const newName = columnChangeFor(policyKey, rens);
16898
+ const unsquashedPolicy = PgSquasher.unsquashPolicy(policy2);
16899
+ unsquashedPolicy.name = newName;
16900
+ policy2 = PgSquasher.squashPolicy(unsquashedPolicy);
16901
+ return newName;
16902
+ }
16903
+ );
16904
+ tableValue.policies = patchedPolicies;
16905
+ return [tableKey2, tableValue];
16906
+ }
16907
+ );
16908
+ const viewsDiff = diffSchemasOrTables(policyPatchedSnap1.views, json22.views);
16450
16909
  const {
16451
16910
  created: createdViews,
16452
16911
  deleted: deletedViews,
@@ -16464,7 +16923,7 @@ var init_snapshotsDiffer = __esm({
16464
16923
  movedViews.forEach((it) => {
16465
16924
  movedViewDic[`${it.schemaFrom}.${it.name}`] = { to: it.schemaTo, from: it.schemaFrom };
16466
16925
  });
16467
- const viewsPatchedSnap1 = copy(columnsPatchedSnap1);
16926
+ const viewsPatchedSnap1 = copy(policyPatchedSnap1);
16468
16927
  viewsPatchedSnap1.views = mapEntries(
16469
16928
  viewsPatchedSnap1.views,
16470
16929
  (viewKey, viewValue) => {
@@ -16522,13 +16981,15 @@ var init_snapshotsDiffer = __esm({
16522
16981
  const jsonDeletedUniqueConstraints = [];
16523
16982
  const jsonAlteredUniqueConstraints = [];
16524
16983
  const jsonSetTableSchemas = [];
16525
- for (let it of movedTables) {
16526
- jsonSetTableSchemas.push({
16527
- type: "alter_table_set_schema",
16528
- tableName: it.name,
16529
- schemaFrom: it.schemaFrom || "public",
16530
- schemaTo: it.schemaTo || "public"
16531
- });
16984
+ if (movedTables) {
16985
+ for (let it of movedTables) {
16986
+ jsonSetTableSchemas.push({
16987
+ type: "alter_table_set_schema",
16988
+ tableName: it.name,
16989
+ schemaFrom: it.schemaFrom || "public",
16990
+ schemaTo: it.schemaTo || "public"
16991
+ });
16992
+ }
16532
16993
  }
16533
16994
  const jsonDeletedCheckConstraints = [];
16534
16995
  const jsonCreatedCheckConstraints = [];
@@ -16655,7 +17116,106 @@ var init_snapshotsDiffer = __esm({
16655
17116
  it.deletedIndexes || {}
16656
17117
  );
16657
17118
  }).flat();
17119
+ const jsonCreatePoliciesStatements = [];
17120
+ const jsonDropPoliciesStatements = [];
17121
+ const jsonAlterPoliciesStatements = [];
17122
+ const jsonRenamePoliciesStatements = [];
17123
+ const jsonEnableRLSStatements = [];
17124
+ const jsonDisableRLSStatements = [];
17125
+ for (let it of policyRenames) {
17126
+ jsonRenamePoliciesStatements.push(
17127
+ ...prepareRenamePolicyJsons(it.table, it.schema, it.renames)
17128
+ );
17129
+ }
17130
+ for (const it of policyCreates) {
17131
+ jsonCreatePoliciesStatements.push(
17132
+ ...prepareCreatePolicyJsons(
17133
+ it.table,
17134
+ it.schema,
17135
+ it.columns
17136
+ )
17137
+ );
17138
+ }
17139
+ for (const it of policyDeletes) {
17140
+ jsonDropPoliciesStatements.push(
17141
+ ...prepareDropPolicyJsons(
17142
+ it.table,
17143
+ it.schema,
17144
+ it.columns
17145
+ )
17146
+ );
17147
+ }
16658
17148
  alteredTables.forEach((it) => {
17149
+ Object.keys(it.alteredPolicies).forEach((policyName) => {
17150
+ const newPolicy = PgSquasher.unsquashPolicy(it.alteredPolicies[policyName].__new);
17151
+ const oldPolicy = PgSquasher.unsquashPolicy(it.alteredPolicies[policyName].__old);
17152
+ if (newPolicy.as !== oldPolicy.as) {
17153
+ jsonDropPoliciesStatements.push(
17154
+ ...prepareDropPolicyJsons(
17155
+ it.name,
17156
+ it.schema,
17157
+ [oldPolicy]
17158
+ )
17159
+ );
17160
+ jsonCreatePoliciesStatements.push(
17161
+ ...prepareCreatePolicyJsons(
17162
+ it.name,
17163
+ it.schema,
17164
+ [newPolicy]
17165
+ )
17166
+ );
17167
+ return;
17168
+ }
17169
+ if (newPolicy.for !== oldPolicy.for) {
17170
+ jsonDropPoliciesStatements.push(
17171
+ ...prepareDropPolicyJsons(
17172
+ it.name,
17173
+ it.schema,
17174
+ [oldPolicy]
17175
+ )
17176
+ );
17177
+ jsonCreatePoliciesStatements.push(
17178
+ ...prepareCreatePolicyJsons(
17179
+ it.name,
17180
+ it.schema,
17181
+ [newPolicy]
17182
+ )
17183
+ );
17184
+ return;
17185
+ }
17186
+ jsonAlterPoliciesStatements.push(
17187
+ prepareAlterPolicyJson(
17188
+ it.name,
17189
+ it.schema,
17190
+ it.alteredPolicies[policyName].__old,
17191
+ it.alteredPolicies[policyName].__new
17192
+ )
17193
+ );
17194
+ });
17195
+ for (const table4 of Object.values(json22.tables)) {
17196
+ const policiesInCurrentState = Object.keys(table4.policies);
17197
+ const tableInPreviousState = columnsPatchedSnap1.tables[`${table4.schema === "" ? "public" : table4.schema}.${table4.name}`];
17198
+ const policiesInPreviousState = tableInPreviousState ? Object.keys(tableInPreviousState.policies) : [];
17199
+ if (policiesInPreviousState.length === 0 && policiesInCurrentState.length > 0 && !table4.isRLSEnabled) {
17200
+ jsonEnableRLSStatements.push({ type: "enable_rls", tableName: table4.name, schema: table4.schema });
17201
+ }
17202
+ if (policiesInPreviousState.length > 0 && policiesInCurrentState.length === 0 && !table4.isRLSEnabled) {
17203
+ jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
17204
+ }
17205
+ if (table4.isRLSEnabled !== tableInPreviousState.isRLSEnabled) {
17206
+ if (table4.isRLSEnabled) {
17207
+ jsonEnableRLSStatements.push({ type: "enable_rls", tableName: table4.name, schema: table4.schema });
17208
+ } else if (!table4.isRLSEnabled && policiesInCurrentState.length === 0) {
17209
+ jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
17210
+ }
17211
+ }
17212
+ }
17213
+ for (const table4 of Object.values(columnsPatchedSnap1.tables)) {
17214
+ const tableInCurrentState = json22.tables[`${table4.schema === "" ? "public" : table4.schema}.${table4.name}`];
17215
+ if (tableInCurrentState === void 0 && !table4.isRLSEnabled) {
17216
+ jsonDisableRLSStatements.push({ type: "disable_rls", tableName: table4.name, schema: table4.schema });
17217
+ }
17218
+ }
16659
17219
  const droppedIndexes = Object.keys(it.alteredIndexes).reduce(
16660
17220
  (current, item) => {
16661
17221
  current[item] = it.alteredIndexes[item].__old;
@@ -16743,6 +17303,18 @@ var init_snapshotsDiffer = __esm({
16743
17303
  const jsonAlterSequences = typedResult.alteredSequences.map((it) => {
16744
17304
  return prepareAlterSequenceJson(it);
16745
17305
  }).flat() ?? [];
17306
+ const createRoles = createdRoles.map((it) => {
17307
+ return prepareCreateRoleJson(it);
17308
+ }) ?? [];
17309
+ const dropRoles = deletedRoles.map((it) => {
17310
+ return prepareDropRoleJson(it.name);
17311
+ });
17312
+ const renameRoles = renamedRoles.map((it) => {
17313
+ return prepareRenameRoleJson(it.from.name, it.to.name);
17314
+ });
17315
+ const jsonAlterRoles = typedResult.alteredRoles.map((it) => {
17316
+ return prepareAlterRoleJson(it);
17317
+ }).flat() ?? [];
16746
17318
  const createSchemas = prepareCreateSchemasJson(
16747
17319
  createdSchemas.map((it) => it.name)
16748
17320
  );
@@ -16755,6 +17327,11 @@ var init_snapshotsDiffer = __esm({
16755
17327
  const createTables = createdTables.map((it) => {
16756
17328
  return preparePgCreateTableJson(it, curFull);
16757
17329
  });
17330
+ jsonCreatePoliciesStatements.push(...[].concat(
17331
+ ...createdTables.map(
17332
+ (it) => prepareCreatePolicyJsons(it.name, it.schema, Object.values(it.policies).map(PgSquasher.unsquashPolicy))
17333
+ )
17334
+ ));
16758
17335
  const createViews = [];
16759
17336
  const dropViews = [];
16760
17337
  const renameViews = [];
@@ -16896,7 +17473,13 @@ var init_snapshotsDiffer = __esm({
16896
17473
  jsonStatements.push(...moveSequences);
16897
17474
  jsonStatements.push(...renameSequences);
16898
17475
  jsonStatements.push(...jsonAlterSequences);
17476
+ jsonStatements.push(...renameRoles);
17477
+ jsonStatements.push(...dropRoles);
17478
+ jsonStatements.push(...createRoles);
17479
+ jsonStatements.push(...jsonAlterRoles);
16899
17480
  jsonStatements.push(...createTables);
17481
+ jsonStatements.push(...jsonEnableRLSStatements);
17482
+ jsonStatements.push(...jsonDisableRLSStatements);
16900
17483
  jsonStatements.push(...dropViews);
16901
17484
  jsonStatements.push(...renameViews);
16902
17485
  jsonStatements.push(...alterViews);
@@ -16922,6 +17505,10 @@ var init_snapshotsDiffer = __esm({
16922
17505
  jsonStatements.push(...jsonCreatedCheckConstraints);
16923
17506
  jsonStatements.push(...jsonAlteredUniqueConstraints);
16924
17507
  jsonStatements.push(...jsonAlterEnumsWithDroppedValues);
17508
+ jsonStatements.push(...jsonRenamePoliciesStatements);
17509
+ jsonStatements.push(...jsonDropPoliciesStatements);
17510
+ jsonStatements.push(...jsonCreatePoliciesStatements);
17511
+ jsonStatements.push(...jsonAlterPoliciesStatements);
16925
17512
  jsonStatements.push(...createViews);
16926
17513
  jsonStatements.push(...dropEnums);
16927
17514
  jsonStatements.push(...dropSequences);
@@ -18314,7 +18901,7 @@ var init_outputs = __esm({
18314
18901
  });
18315
18902
 
18316
18903
  // src/cli/commands/migrate.ts
18317
- var import_hanji2, schemasResolver, tablesResolver, viewsResolver, mySqlViewsResolver, sqliteViewsResolver, sequencesResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT;
18904
+ var import_hanji2, schemasResolver, tablesResolver, viewsResolver, mySqlViewsResolver, sqliteViewsResolver, sequencesResolver, roleResolver, policyResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedConflict, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT;
18318
18905
  var init_migrate = __esm({
18319
18906
  "src/cli/commands/migrate.ts"() {
18320
18907
  "use strict";
@@ -18431,6 +19018,32 @@ var init_migrate = __esm({
18431
19018
  throw e;
18432
19019
  }
18433
19020
  };
19021
+ roleResolver = async (input) => {
19022
+ const result = await promptNamedConflict(
19023
+ input.created,
19024
+ input.deleted,
19025
+ "role"
19026
+ );
19027
+ return {
19028
+ created: result.created,
19029
+ deleted: result.deleted,
19030
+ renamed: result.renamed
19031
+ };
19032
+ };
19033
+ policyResolver = async (input) => {
19034
+ const result = await promptColumnsConflicts(
19035
+ input.tableName,
19036
+ input.created,
19037
+ input.deleted
19038
+ );
19039
+ return {
19040
+ tableName: input.tableName,
19041
+ schema: input.schema,
19042
+ created: result.created,
19043
+ deleted: result.deleted,
19044
+ renamed: result.renamed
19045
+ };
19046
+ };
18434
19047
  enumsResolver = async (input) => {
18435
19048
  try {
18436
19049
  const { created, deleted, moved, renamed } = await promptNamedWithSchemasConflict(
@@ -18513,6 +19126,56 @@ var init_migrate = __esm({
18513
19126
  result.deleted.push(...leftMissing);
18514
19127
  return result;
18515
19128
  };
19129
+ promptNamedConflict = async (newItems, missingItems, entity) => {
19130
+ if (missingItems.length === 0 || newItems.length === 0) {
19131
+ return {
19132
+ created: newItems,
19133
+ renamed: [],
19134
+ deleted: missingItems
19135
+ };
19136
+ }
19137
+ const result = { created: [], renamed: [], deleted: [] };
19138
+ let index4 = 0;
19139
+ let leftMissing = [...missingItems];
19140
+ do {
19141
+ const created = newItems[index4];
19142
+ const renames = leftMissing.map((it) => {
19143
+ return { from: it, to: created };
19144
+ });
19145
+ const promptData = [created, ...renames];
19146
+ const { status, data } = await (0, import_hanji2.render)(
19147
+ new ResolveSelectNamed(created, promptData, entity)
19148
+ );
19149
+ if (status === "aborted") {
19150
+ console.error("ERROR");
19151
+ process.exit(1);
19152
+ }
19153
+ if (isRenamePromptItem(data)) {
19154
+ console.log(
19155
+ `${source_default.yellow("~")} ${data.from.name} \u203A ${data.to.name} ${source_default.gray(
19156
+ `${entity} will be renamed/moved`
19157
+ )}`
19158
+ );
19159
+ if (data.from.name !== data.to.name) {
19160
+ result.renamed.push(data);
19161
+ }
19162
+ delete leftMissing[leftMissing.indexOf(data.from)];
19163
+ leftMissing = leftMissing.filter(Boolean);
19164
+ } else {
19165
+ console.log(
19166
+ `${source_default.green("+")} ${data.name} ${source_default.gray(
19167
+ `${entity} will be created`
19168
+ )}`
19169
+ );
19170
+ result.created.push(created);
19171
+ }
19172
+ index4 += 1;
19173
+ } while (index4 < newItems.length);
19174
+ console.log(source_default.gray(`--- all ${entity} conflicts resolved ---
19175
+ `));
19176
+ result.deleted.push(...leftMissing);
19177
+ return result;
19178
+ };
18516
19179
  promptNamedWithSchemasConflict = async (newItems, missingItems, entity) => {
18517
19180
  if (missingItems.length === 0 || newItems.length === 0) {
18518
19181
  return {
@@ -20069,8 +20732,8 @@ function parsePgArray(arrayString) {
20069
20732
  const [result] = parsePgNestedArray(arrayString, 1);
20070
20733
  return result;
20071
20734
  }
20072
- function makePgArray(array) {
20073
- return `{${array.map((item) => {
20735
+ function makePgArray(array2) {
20736
+ return `{${array2.map((item) => {
20074
20737
  if (Array.isArray(item)) {
20075
20738
  return makePgArray(item);
20076
20739
  }
@@ -20377,7 +21040,7 @@ var version;
20377
21040
  var init_version = __esm({
20378
21041
  "../drizzle-orm/dist/version.js"() {
20379
21042
  "use strict";
20380
- version = "0.35.0";
21043
+ version = "0.35.3";
20381
21044
  }
20382
21045
  });
20383
21046
 
@@ -20778,8 +21441,8 @@ var init_sql = __esm({
20778
21441
  sql2.param = param2;
20779
21442
  })(sql || (sql = {}));
20780
21443
  ((SQL2) => {
20781
- var _a324;
20782
- _a324 = entityKind;
21444
+ var _a326;
21445
+ _a326 = entityKind;
20783
21446
  const _Aliased = class _Aliased {
20784
21447
  constructor(sql2, fieldAlias) {
20785
21448
  /** @internal */
@@ -20795,7 +21458,7 @@ var init_sql = __esm({
20795
21458
  return new _Aliased(this.sql, this.fieldAlias);
20796
21459
  }
20797
21460
  };
20798
- __publicField(_Aliased, _a324, "SQL.Aliased");
21461
+ __publicField(_Aliased, _a326, "SQL.Aliased");
20799
21462
  let Aliased = _Aliased;
20800
21463
  SQL2.Aliased = Aliased;
20801
21464
  })(SQL || (SQL = {}));
@@ -21078,8 +21741,8 @@ function arrayContains(column4, values) {
21078
21741
  if (values.length === 0) {
21079
21742
  throw new Error("arrayContains requires at least one value");
21080
21743
  }
21081
- const array = sql`${bindIfParam(values, column4)}`;
21082
- return sql`${column4} @> ${array}`;
21744
+ const array2 = sql`${bindIfParam(values, column4)}`;
21745
+ return sql`${column4} @> ${array2}`;
21083
21746
  }
21084
21747
  return sql`${column4} @> ${bindIfParam(values, column4)}`;
21085
21748
  }
@@ -21088,8 +21751,8 @@ function arrayContained(column4, values) {
21088
21751
  if (values.length === 0) {
21089
21752
  throw new Error("arrayContained requires at least one value");
21090
21753
  }
21091
- const array = sql`${bindIfParam(values, column4)}`;
21092
- return sql`${column4} <@ ${array}`;
21754
+ const array2 = sql`${bindIfParam(values, column4)}`;
21755
+ return sql`${column4} <@ ${array2}`;
21093
21756
  }
21094
21757
  return sql`${column4} <@ ${bindIfParam(values, column4)}`;
21095
21758
  }
@@ -21098,8 +21761,8 @@ function arrayOverlaps(column4, values) {
21098
21761
  if (values.length === 0) {
21099
21762
  throw new Error("arrayOverlaps requires at least one value");
21100
21763
  }
21101
- const array = sql`${bindIfParam(values, column4)}`;
21102
- return sql`${column4} && ${array}`;
21764
+ const array2 = sql`${bindIfParam(values, column4)}`;
21765
+ return sql`${column4} && ${array2}`;
21103
21766
  }
21104
21767
  return sql`${column4} && ${bindIfParam(values, column4)}`;
21105
21768
  }
@@ -21358,6 +22021,50 @@ function getColumnNameAndConfig(a, b) {
21358
22021
  config: typeof a === "object" ? a : b
21359
22022
  };
21360
22023
  }
22024
+ function isConfig(data) {
22025
+ if (typeof data !== "object" || data === null)
22026
+ return false;
22027
+ if (data.constructor.name !== "Object")
22028
+ return false;
22029
+ if ("logger" in data) {
22030
+ const type = typeof data["logger"];
22031
+ if (type !== "boolean" && (type !== "object" || typeof data["logger"]["logQuery"] !== "function") && type !== "undefined")
22032
+ return false;
22033
+ return true;
22034
+ }
22035
+ if ("schema" in data) {
22036
+ const type = typeof data["logger"];
22037
+ if (type !== "object" && type !== "undefined")
22038
+ return false;
22039
+ return true;
22040
+ }
22041
+ if ("casing" in data) {
22042
+ const type = typeof data["logger"];
22043
+ if (type !== "string" && type !== "undefined")
22044
+ return false;
22045
+ return true;
22046
+ }
22047
+ if ("mode" in data) {
22048
+ if (data["mode"] !== "default" || data["mode"] !== "planetscale" || data["mode"] !== void 0)
22049
+ return false;
22050
+ return true;
22051
+ }
22052
+ if ("connection" in data) {
22053
+ const type = typeof data["connection"];
22054
+ if (type !== "string" && type !== "object" && type !== "undefined")
22055
+ return false;
22056
+ return true;
22057
+ }
22058
+ if ("client" in data) {
22059
+ const type = typeof data["client"];
22060
+ if (type !== "object" && type !== "undefined")
22061
+ return false;
22062
+ return true;
22063
+ }
22064
+ if (Object.keys(data).length === 0)
22065
+ return true;
22066
+ return false;
22067
+ }
21361
22068
  var init_utils2 = __esm({
21362
22069
  "../drizzle-orm/dist/utils.js"() {
21363
22070
  "use strict";
@@ -23016,9 +23723,14 @@ function pgTableWithSchema(name2, columns, extraConfig, schema4, baseName = name
23016
23723
  if (extraConfig) {
23017
23724
  table4[PgTable.Symbol.ExtraConfigBuilder] = extraConfig;
23018
23725
  }
23019
- return table4;
23726
+ return Object.assign(table4, {
23727
+ enableRLS: () => {
23728
+ table4[PgTable.Symbol.EnableRLS] = true;
23729
+ return table4;
23730
+ }
23731
+ });
23020
23732
  }
23021
- var InlineForeignKeys, _a116, _b94, _c2, _d2, PgTable, pgTable;
23733
+ var InlineForeignKeys, EnableRLS, _a116, _b94, _c2, _d2, _e2, PgTable, pgTable;
23022
23734
  var init_table2 = __esm({
23023
23735
  "../drizzle-orm/dist/pg-core/table.js"() {
23024
23736
  "use strict";
@@ -23026,19 +23738,23 @@ var init_table2 = __esm({
23026
23738
  init_table();
23027
23739
  init_all();
23028
23740
  InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys");
23029
- PgTable = class extends (_d2 = Table, _c2 = entityKind, _b94 = InlineForeignKeys, _a116 = Table.Symbol.ExtraConfigBuilder, _d2) {
23741
+ EnableRLS = Symbol.for("drizzle:EnableRLS");
23742
+ PgTable = class extends (_e2 = Table, _d2 = entityKind, _c2 = InlineForeignKeys, _b94 = EnableRLS, _a116 = Table.Symbol.ExtraConfigBuilder, _e2) {
23030
23743
  constructor() {
23031
23744
  super(...arguments);
23032
23745
  /**@internal */
23033
- __publicField(this, _b94, []);
23746
+ __publicField(this, _c2, []);
23747
+ /** @internal */
23748
+ __publicField(this, _b94, false);
23034
23749
  /** @internal */
23035
23750
  __publicField(this, _a116);
23036
23751
  }
23037
23752
  };
23038
- __publicField(PgTable, _c2, "PgTable");
23753
+ __publicField(PgTable, _d2, "PgTable");
23039
23754
  /** @internal */
23040
23755
  __publicField(PgTable, "Symbol", Object.assign({}, Table.Symbol, {
23041
- InlineForeignKeys
23756
+ InlineForeignKeys,
23757
+ EnableRLS
23042
23758
  }));
23043
23759
  pgTable = (name2, columns, extraConfig) => {
23044
23760
  return pgTableWithSchema(name2, columns, extraConfig, void 0);
@@ -23551,6 +24267,7 @@ __export(dist_exports, {
23551
24267
  inArray: () => inArray,
23552
24268
  innerProduct: () => innerProduct,
23553
24269
  is: () => is,
24270
+ isConfig: () => isConfig,
23554
24271
  isDriverValueEncoder: () => isDriverValueEncoder,
23555
24272
  isNotNull: () => isNotNull,
23556
24273
  isNull: () => isNull,
@@ -26765,6 +27482,67 @@ var init_indexes = __esm({
26765
27482
  }
26766
27483
  });
26767
27484
 
27485
+ // ../drizzle-orm/dist/pg-core/policies.js
27486
+ var _a147, PgPolicy;
27487
+ var init_policies = __esm({
27488
+ "../drizzle-orm/dist/pg-core/policies.js"() {
27489
+ "use strict";
27490
+ init_entity();
27491
+ _a147 = entityKind;
27492
+ PgPolicy = class {
27493
+ constructor(name2, config) {
27494
+ __publicField(this, "as");
27495
+ __publicField(this, "for");
27496
+ __publicField(this, "to");
27497
+ __publicField(this, "using");
27498
+ __publicField(this, "withCheck");
27499
+ this.name = name2;
27500
+ if (config) {
27501
+ this.as = config.as;
27502
+ this.for = config.for;
27503
+ this.to = config.to;
27504
+ this.using = config.using;
27505
+ this.withCheck = config.withCheck;
27506
+ }
27507
+ }
27508
+ };
27509
+ __publicField(PgPolicy, _a147, "PgPolicy");
27510
+ }
27511
+ });
27512
+
27513
+ // ../drizzle-orm/dist/pg-core/roles.js
27514
+ var _a148, PgRole;
27515
+ var init_roles = __esm({
27516
+ "../drizzle-orm/dist/pg-core/roles.js"() {
27517
+ "use strict";
27518
+ init_entity();
27519
+ _a148 = entityKind;
27520
+ PgRole = class {
27521
+ constructor(name2, config) {
27522
+ /** @internal */
27523
+ __publicField(this, "_existing");
27524
+ /** @internal */
27525
+ __publicField(this, "createDb");
27526
+ /** @internal */
27527
+ __publicField(this, "createRole");
27528
+ /** @internal */
27529
+ __publicField(this, "inherit");
27530
+ this.name = name2;
27531
+ if (config) {
27532
+ this.createDb = config.createDb;
27533
+ this.createRole = config.createRole;
27534
+ this.inherit = config.inherit;
27535
+ }
27536
+ }
27537
+ existing() {
27538
+ this._existing = true;
27539
+ return this;
27540
+ }
27541
+ };
27542
+ __publicField(PgRole, _a148, "PgRole");
27543
+ }
27544
+ });
27545
+
26768
27546
  // ../drizzle-orm/dist/pg-core/sequence.js
26769
27547
  function pgSequenceWithSchema(name2, options, schema4) {
26770
27548
  return new PgSequence(name2, options, schema4);
@@ -26772,12 +27550,12 @@ function pgSequenceWithSchema(name2, options, schema4) {
26772
27550
  function isPgSequence(obj) {
26773
27551
  return is(obj, PgSequence);
26774
27552
  }
26775
- var _a147, PgSequence;
27553
+ var _a149, PgSequence;
26776
27554
  var init_sequence = __esm({
26777
27555
  "../drizzle-orm/dist/pg-core/sequence.js"() {
26778
27556
  "use strict";
26779
27557
  init_entity();
26780
- _a147 = entityKind;
27558
+ _a149 = entityKind;
26781
27559
  PgSequence = class {
26782
27560
  constructor(seqName, seqOptions, schema4) {
26783
27561
  this.seqName = seqName;
@@ -26785,7 +27563,7 @@ var init_sequence = __esm({
26785
27563
  this.schema = schema4;
26786
27564
  }
26787
27565
  };
26788
- __publicField(PgSequence, _a147, "PgSequence");
27566
+ __publicField(PgSequence, _a149, "PgSequence");
26789
27567
  }
26790
27568
  });
26791
27569
 
@@ -26817,7 +27595,7 @@ function isPgView(obj) {
26817
27595
  function isPgMaterializedView(obj) {
26818
27596
  return is(obj, PgMaterializedView);
26819
27597
  }
26820
- var _a148, DefaultViewBuilderCore, _a149, _b107, ViewBuilder, _a150, _b108, ManualViewBuilder, _a151, MaterializedViewBuilderCore, _a152, _b109, MaterializedViewBuilder, _a153, _b110, ManualMaterializedViewBuilder, _a154, _b111, _c4, PgView2, PgMaterializedViewConfig, _a155, _b112, _c5, PgMaterializedView;
27598
+ var _a150, DefaultViewBuilderCore, _a151, _b107, ViewBuilder, _a152, _b108, ManualViewBuilder, _a153, MaterializedViewBuilderCore, _a154, _b109, MaterializedViewBuilder, _a155, _b110, ManualMaterializedViewBuilder, _a156, _b111, _c4, PgView2, PgMaterializedViewConfig, _a157, _b112, _c5, PgMaterializedView;
26821
27599
  var init_view = __esm({
26822
27600
  "../drizzle-orm/dist/pg-core/view.js"() {
26823
27601
  "use strict";
@@ -26828,7 +27606,7 @@ var init_view = __esm({
26828
27606
  init_table2();
26829
27607
  init_view_base();
26830
27608
  init_view_common2();
26831
- _a148 = entityKind;
27609
+ _a150 = entityKind;
26832
27610
  DefaultViewBuilderCore = class {
26833
27611
  constructor(name2, schema4) {
26834
27612
  __publicField(this, "config", {});
@@ -26840,8 +27618,8 @@ var init_view = __esm({
26840
27618
  return this;
26841
27619
  }
26842
27620
  };
26843
- __publicField(DefaultViewBuilderCore, _a148, "PgDefaultViewBuilderCore");
26844
- ViewBuilder = class extends (_b107 = DefaultViewBuilderCore, _a149 = entityKind, _b107) {
27621
+ __publicField(DefaultViewBuilderCore, _a150, "PgDefaultViewBuilderCore");
27622
+ ViewBuilder = class extends (_b107 = DefaultViewBuilderCore, _a151 = entityKind, _b107) {
26845
27623
  as(qb) {
26846
27624
  if (typeof qb === "function") {
26847
27625
  qb = qb(new QueryBuilder());
@@ -26867,8 +27645,8 @@ var init_view = __esm({
26867
27645
  );
26868
27646
  }
26869
27647
  };
26870
- __publicField(ViewBuilder, _a149, "PgViewBuilder");
26871
- ManualViewBuilder = class extends (_b108 = DefaultViewBuilderCore, _a150 = entityKind, _b108) {
27648
+ __publicField(ViewBuilder, _a151, "PgViewBuilder");
27649
+ ManualViewBuilder = class extends (_b108 = DefaultViewBuilderCore, _a152 = entityKind, _b108) {
26872
27650
  constructor(name2, columns, schema4) {
26873
27651
  super(name2, schema4);
26874
27652
  __publicField(this, "columns");
@@ -26913,8 +27691,8 @@ var init_view = __esm({
26913
27691
  );
26914
27692
  }
26915
27693
  };
26916
- __publicField(ManualViewBuilder, _a150, "PgManualViewBuilder");
26917
- _a151 = entityKind;
27694
+ __publicField(ManualViewBuilder, _a152, "PgManualViewBuilder");
27695
+ _a153 = entityKind;
26918
27696
  MaterializedViewBuilderCore = class {
26919
27697
  constructor(name2, schema4) {
26920
27698
  __publicField(this, "config", {});
@@ -26938,8 +27716,8 @@ var init_view = __esm({
26938
27716
  return this;
26939
27717
  }
26940
27718
  };
26941
- __publicField(MaterializedViewBuilderCore, _a151, "PgMaterializedViewBuilderCore");
26942
- MaterializedViewBuilder = class extends (_b109 = MaterializedViewBuilderCore, _a152 = entityKind, _b109) {
27719
+ __publicField(MaterializedViewBuilderCore, _a153, "PgMaterializedViewBuilderCore");
27720
+ MaterializedViewBuilder = class extends (_b109 = MaterializedViewBuilderCore, _a154 = entityKind, _b109) {
26943
27721
  as(qb) {
26944
27722
  if (typeof qb === "function") {
26945
27723
  qb = qb(new QueryBuilder());
@@ -26970,8 +27748,8 @@ var init_view = __esm({
26970
27748
  );
26971
27749
  }
26972
27750
  };
26973
- __publicField(MaterializedViewBuilder, _a152, "PgMaterializedViewBuilder");
26974
- ManualMaterializedViewBuilder = class extends (_b110 = MaterializedViewBuilderCore, _a153 = entityKind, _b110) {
27751
+ __publicField(MaterializedViewBuilder, _a154, "PgMaterializedViewBuilder");
27752
+ ManualMaterializedViewBuilder = class extends (_b110 = MaterializedViewBuilderCore, _a155 = entityKind, _b110) {
26975
27753
  constructor(name2, columns, schema4) {
26976
27754
  super(name2, schema4);
26977
27755
  __publicField(this, "columns");
@@ -27026,11 +27804,11 @@ var init_view = __esm({
27026
27804
  );
27027
27805
  }
27028
27806
  };
27029
- __publicField(ManualMaterializedViewBuilder, _a153, "PgManualMaterializedViewBuilder");
27030
- PgView2 = class extends (_c4 = PgViewBase, _b111 = entityKind, _a154 = PgViewConfig, _c4) {
27807
+ __publicField(ManualMaterializedViewBuilder, _a155, "PgManualMaterializedViewBuilder");
27808
+ PgView2 = class extends (_c4 = PgViewBase, _b111 = entityKind, _a156 = PgViewConfig, _c4) {
27031
27809
  constructor({ pgConfig, config }) {
27032
27810
  super(config);
27033
- __publicField(this, _a154);
27811
+ __publicField(this, _a156);
27034
27812
  if (pgConfig) {
27035
27813
  this[PgViewConfig] = {
27036
27814
  with: pgConfig.with
@@ -27040,10 +27818,10 @@ var init_view = __esm({
27040
27818
  };
27041
27819
  __publicField(PgView2, _b111, "PgView");
27042
27820
  PgMaterializedViewConfig = Symbol.for("drizzle:PgMaterializedViewConfig");
27043
- PgMaterializedView = class extends (_c5 = PgViewBase, _b112 = entityKind, _a155 = PgMaterializedViewConfig, _c5) {
27821
+ PgMaterializedView = class extends (_c5 = PgViewBase, _b112 = entityKind, _a157 = PgMaterializedViewConfig, _c5) {
27044
27822
  constructor({ pgConfig, config }) {
27045
27823
  super(config);
27046
- __publicField(this, _a155);
27824
+ __publicField(this, _a157);
27047
27825
  this[PgMaterializedViewConfig] = {
27048
27826
  with: pgConfig?.with,
27049
27827
  using: pgConfig?.using,
@@ -27057,7 +27835,7 @@ var init_view = __esm({
27057
27835
  });
27058
27836
 
27059
27837
  // ../drizzle-orm/dist/pg-core/schema.js
27060
- var _a156, PgSchema5;
27838
+ var _a158, PgSchema5;
27061
27839
  var init_schema = __esm({
27062
27840
  "../drizzle-orm/dist/pg-core/schema.js"() {
27063
27841
  "use strict";
@@ -27067,7 +27845,7 @@ var init_schema = __esm({
27067
27845
  init_sequence();
27068
27846
  init_table2();
27069
27847
  init_view();
27070
- _a156 = entityKind;
27848
+ _a158 = entityKind;
27071
27849
  PgSchema5 = class {
27072
27850
  constructor(schemaName) {
27073
27851
  __publicField(this, "table", (name2, columns, extraConfig) => {
@@ -27094,12 +27872,12 @@ var init_schema = __esm({
27094
27872
  return true;
27095
27873
  }
27096
27874
  };
27097
- __publicField(PgSchema5, _a156, "PgSchema");
27875
+ __publicField(PgSchema5, _a158, "PgSchema");
27098
27876
  }
27099
27877
  });
27100
27878
 
27101
27879
  // ../drizzle-orm/dist/pg-core/session.js
27102
- var _a157, PgPreparedQuery, _a158, PgSession, _a159, _b113, PgTransaction;
27880
+ var _a159, PgPreparedQuery, _a160, PgSession, _a161, _b113, PgTransaction;
27103
27881
  var init_session = __esm({
27104
27882
  "../drizzle-orm/dist/pg-core/session.js"() {
27105
27883
  "use strict";
@@ -27108,7 +27886,7 @@ var init_session = __esm({
27108
27886
  init_sql2();
27109
27887
  init_tracing();
27110
27888
  init_db();
27111
- _a157 = entityKind;
27889
+ _a159 = entityKind;
27112
27890
  PgPreparedQuery = class {
27113
27891
  constructor(query) {
27114
27892
  /** @internal */
@@ -27122,8 +27900,8 @@ var init_session = __esm({
27122
27900
  return response;
27123
27901
  }
27124
27902
  };
27125
- __publicField(PgPreparedQuery, _a157, "PgPreparedQuery");
27126
- _a158 = entityKind;
27903
+ __publicField(PgPreparedQuery, _a159, "PgPreparedQuery");
27904
+ _a160 = entityKind;
27127
27905
  PgSession = class {
27128
27906
  constructor(dialect4) {
27129
27907
  this.dialect = dialect4;
@@ -27156,8 +27934,8 @@ var init_session = __esm({
27156
27934
  );
27157
27935
  }
27158
27936
  };
27159
- __publicField(PgSession, _a158, "PgSession");
27160
- PgTransaction = class extends (_b113 = PgDatabase, _a159 = entityKind, _b113) {
27937
+ __publicField(PgSession, _a160, "PgSession");
27938
+ PgTransaction = class extends (_b113 = PgDatabase, _a161 = entityKind, _b113) {
27161
27939
  constructor(dialect4, session, schema4, nestedIndex = 0) {
27162
27940
  super(dialect4, session, schema4);
27163
27941
  this.schema = schema4;
@@ -27184,7 +27962,7 @@ var init_session = __esm({
27184
27962
  return this.session.execute(sql`set transaction ${this.getTransactionConfigSQL(config)}`);
27185
27963
  }
27186
27964
  };
27187
- __publicField(PgTransaction, _a159, "PgTransaction");
27965
+ __publicField(PgTransaction, _a161, "PgTransaction");
27188
27966
  }
27189
27967
  });
27190
27968
 
@@ -27205,10 +27983,13 @@ function getTableConfig(table4) {
27205
27983
  const uniqueConstraints = [];
27206
27984
  const name2 = table4[Table.Symbol.Name];
27207
27985
  const schema4 = table4[Table.Symbol.Schema];
27986
+ const policies = [];
27987
+ const enableRLS = table4[PgTable.Symbol.EnableRLS];
27208
27988
  const extraConfigBuilder = table4[PgTable.Symbol.ExtraConfigBuilder];
27209
27989
  if (extraConfigBuilder !== void 0) {
27210
27990
  const extraConfig = extraConfigBuilder(table4[Table.Symbol.ExtraConfigColumns]);
27211
- for (const builder of Object.values(extraConfig)) {
27991
+ const extraValues = Array.isArray(extraConfig) ? extraConfig.flat(1) : Object.values(extraConfig);
27992
+ for (const builder of extraValues) {
27212
27993
  if (is(builder, IndexBuilder)) {
27213
27994
  indexes.push(builder.build(table4));
27214
27995
  } else if (is(builder, CheckBuilder)) {
@@ -27219,6 +28000,8 @@ function getTableConfig(table4) {
27219
28000
  primaryKeys.push(builder.build(table4));
27220
28001
  } else if (is(builder, ForeignKeyBuilder)) {
27221
28002
  foreignKeys.push(builder.build(table4));
28003
+ } else if (is(builder, PgPolicy)) {
28004
+ policies.push(builder);
27222
28005
  }
27223
28006
  }
27224
28007
  }
@@ -27230,7 +28013,9 @@ function getTableConfig(table4) {
27230
28013
  primaryKeys,
27231
28014
  uniqueConstraints,
27232
28015
  name: name2,
27233
- schema: schema4
28016
+ schema: schema4,
28017
+ policies,
28018
+ enableRLS
27234
28019
  };
27235
28020
  }
27236
28021
  function getViewConfig(view4) {
@@ -27255,6 +28040,7 @@ var init_utils4 = __esm({
27255
28040
  init_checks();
27256
28041
  init_foreign_keys();
27257
28042
  init_indexes();
28043
+ init_policies();
27258
28044
  init_primary_keys();
27259
28045
  init_unique_constraint();
27260
28046
  init_view_common2();
@@ -27281,8 +28067,10 @@ var init_pg_core = __esm({
27281
28067
  init_dialect();
27282
28068
  init_foreign_keys();
27283
28069
  init_indexes();
28070
+ init_policies();
27284
28071
  init_primary_keys();
27285
28072
  init_query_builders();
28073
+ init_roles();
27286
28074
  init_schema();
27287
28075
  init_sequence();
27288
28076
  init_session();
@@ -27304,14 +28092,14 @@ function maxRangeForIdentityBasedOn(columnType) {
27304
28092
  return columnType === "integer" ? "2147483647" : columnType === "bigint" ? "9223372036854775807" : "32767";
27305
28093
  }
27306
28094
  function minRangeForIdentityBasedOn(columnType) {
27307
- return columnType === "integer" ? "-2147483648" : columnType === "bitint" ? "-9223372036854775808" : "-32768";
28095
+ return columnType === "integer" ? "-2147483648" : columnType === "bigint" ? "-9223372036854775808" : "-32768";
27308
28096
  }
27309
28097
  function stringFromDatabaseIdentityProperty(field) {
27310
28098
  return typeof field === "string" ? field : typeof field === "undefined" ? void 0 : typeof field === "bigint" ? field.toString() : String(field);
27311
28099
  }
27312
- function buildArrayString(array, sqlType) {
28100
+ function buildArrayString(array2, sqlType) {
27313
28101
  sqlType = sqlType.split("[")[0];
27314
- const values = array.map((value) => {
28102
+ const values = array2.map((value) => {
27315
28103
  if (typeof value === "number" || typeof value === "bigint") {
27316
28104
  return value.toString();
27317
28105
  } else if (typeof value === "boolean") {
@@ -27333,6 +28121,40 @@ function buildArrayString(array, sqlType) {
27333
28121
  }).join(",");
27334
28122
  return `{${values}}`;
27335
28123
  }
28124
+ function prepareRoles(entities) {
28125
+ let useRoles = false;
28126
+ const includeRoles = [];
28127
+ const excludeRoles = [];
28128
+ if (entities && entities.roles) {
28129
+ if (typeof entities.roles === "object") {
28130
+ if (entities.roles.provider) {
28131
+ if (entities.roles.provider === "supabase") {
28132
+ excludeRoles.push(...[
28133
+ "anon",
28134
+ "authenticator",
28135
+ "authenticated",
28136
+ "service_role",
28137
+ "supabase_auth_admin",
28138
+ "supabase_storage_admin",
28139
+ "dashboard_user",
28140
+ "supabase_admin"
28141
+ ]);
28142
+ } else if (entities.roles.provider === "neon") {
28143
+ excludeRoles.push(...["authenticated", "anonymous"]);
28144
+ }
28145
+ }
28146
+ if (entities.roles.include) {
28147
+ includeRoles.push(...entities.roles.include);
28148
+ }
28149
+ if (entities.roles.exclude) {
28150
+ excludeRoles.push(...entities.roles.exclude);
28151
+ }
28152
+ } else {
28153
+ useRoles = entities.roles;
28154
+ }
28155
+ }
28156
+ return { useRoles, includeRoles, excludeRoles };
28157
+ }
27336
28158
  var indexName, generatePgSnapshot, trimChar, fromDatabase, defaultForColumn, getColumnsInfoQuery;
27337
28159
  var init_pgSerializer = __esm({
27338
28160
  "src/serializer/pgSerializer.ts"() {
@@ -27348,15 +28170,27 @@ var init_pgSerializer = __esm({
27348
28170
  indexName = (tableName, columns) => {
27349
28171
  return `${tableName}_${columns.join("_")}_index`;
27350
28172
  };
27351
- generatePgSnapshot = (tables, enums, schemas, sequences, views, matViews, casing2, schemaFilter) => {
28173
+ generatePgSnapshot = (tables, enums, schemas, sequences, roles, views, matViews, casing2, schemaFilter) => {
27352
28174
  const dialect4 = new PgDialect({ casing: casing2 });
27353
28175
  const result = {};
27354
28176
  const resultViews = {};
27355
28177
  const sequencesToReturn = {};
28178
+ const rolesToReturn = {};
27356
28179
  const indexesInSchema = {};
27357
28180
  for (const table4 of tables) {
27358
28181
  const checksInTable = {};
27359
- const { name: tableName, columns, indexes, foreignKeys, checks, schema: schema4, primaryKeys, uniqueConstraints } = getTableConfig(table4);
28182
+ const {
28183
+ name: tableName,
28184
+ columns,
28185
+ indexes,
28186
+ foreignKeys,
28187
+ checks,
28188
+ schema: schema4,
28189
+ primaryKeys,
28190
+ uniqueConstraints,
28191
+ policies,
28192
+ enableRLS
28193
+ } = getTableConfig(table4);
27360
28194
  if (schemaFilter && !schemaFilter.includes(schema4 ?? "public")) {
27361
28195
  continue;
27362
28196
  }
@@ -27366,6 +28200,7 @@ var init_pgSerializer = __esm({
27366
28200
  const foreignKeysObject = {};
27367
28201
  const primaryKeysObject = {};
27368
28202
  const uniqueConstraintObject = {};
28203
+ const policiesObject = {};
27369
28204
  columns.forEach((column4) => {
27370
28205
  const name2 = getColumnCasing(column4, casing2);
27371
28206
  const notNull = column4.notNull;
@@ -27613,6 +28448,34 @@ ${withStyle.errorWarning(
27613
28448
  with: value.config.with ?? {}
27614
28449
  };
27615
28450
  });
28451
+ policies.forEach((policy2) => {
28452
+ const mappedTo = [];
28453
+ if (!policy2.to) {
28454
+ mappedTo.push("public");
28455
+ } else {
28456
+ if (policy2.to && typeof policy2.to === "string") {
28457
+ mappedTo.push(policy2.to);
28458
+ } else if (policy2.to && is(policy2.to, PgRole)) {
28459
+ mappedTo.push(policy2.to.name);
28460
+ } else if (policy2.to && Array.isArray(policy2.to)) {
28461
+ policy2.to.forEach((it) => {
28462
+ if (typeof it === "string") {
28463
+ mappedTo.push(it);
28464
+ } else if (is(it, PgRole)) {
28465
+ mappedTo.push(it.name);
28466
+ }
28467
+ });
28468
+ }
28469
+ }
28470
+ policiesObject[policy2.name] = {
28471
+ name: policy2.name,
28472
+ as: policy2.as?.toUpperCase() ?? "PERMISSIVE",
28473
+ for: policy2.for?.toUpperCase() ?? "ALL",
28474
+ to: mappedTo.sort(),
28475
+ using: is(policy2.using, SQL) ? dialect4.sqlToQuery(policy2.using).sql : void 0,
28476
+ withCheck: is(policy2.withCheck, SQL) ? dialect4.sqlToQuery(policy2.withCheck).sql : void 0
28477
+ };
28478
+ });
27616
28479
  checks.forEach((check) => {
27617
28480
  const checkName = check.name;
27618
28481
  if (typeof checksInTable[`"${schema4 ?? "public"}"."${tableName}"`] !== "undefined") {
@@ -27649,7 +28512,9 @@ ${withStyle.errorWarning(
27649
28512
  foreignKeys: foreignKeysObject,
27650
28513
  compositePrimaryKeys: primaryKeysObject,
27651
28514
  uniqueConstraints: uniqueConstraintObject,
27652
- checkConstraints: checksObject
28515
+ policies: policiesObject,
28516
+ checkConstraints: checksObject,
28517
+ isRLSEnabled: enableRLS
27653
28518
  };
27654
28519
  }
27655
28520
  for (const sequence of sequences) {
@@ -27673,6 +28538,16 @@ ${withStyle.errorWarning(
27673
28538
  } else {
27674
28539
  }
27675
28540
  }
28541
+ for (const role of roles) {
28542
+ if (!role._existing) {
28543
+ rolesToReturn[role.name] = {
28544
+ name: role.name,
28545
+ createDb: role.createDb === void 0 ? false : role.createDb,
28546
+ createRole: role.createRole === void 0 ? false : role.createRole,
28547
+ inherit: role.inherit === void 0 ? true : role.inherit
28548
+ };
28549
+ }
28550
+ }
27676
28551
  const combinedViews = [...views, ...matViews];
27677
28552
  for (const view4 of combinedViews) {
27678
28553
  let viewName;
@@ -27829,6 +28704,7 @@ ${withStyle.errorWarning(
27829
28704
  enums: enumsToReturn,
27830
28705
  schemas: schemasObject,
27831
28706
  sequences: sequencesToReturn,
28707
+ roles: rolesToReturn,
27832
28708
  views: resultViews,
27833
28709
  _meta: {
27834
28710
  schemas: {},
@@ -27844,7 +28720,7 @@ ${withStyle.errorWarning(
27844
28720
  while (end > start && str[end - 1] === char3) --end;
27845
28721
  return start > 0 || end < str.length ? str.substring(start, end) : str.toString();
27846
28722
  };
27847
- fromDatabase = async (db, tablesFilter = () => true, schemaFilters, progressCallback) => {
28723
+ fromDatabase = async (db, tablesFilter = () => true, schemaFilters, entities, progressCallback) => {
27848
28724
  const result = {};
27849
28725
  const views = {};
27850
28726
  const internals = { tables: {} };
@@ -27857,7 +28733,8 @@ ${withStyle.errorWarning(
27857
28733
  WHEN c.relkind = 'r' THEN 'table'
27858
28734
  WHEN c.relkind = 'v' THEN 'view'
27859
28735
  WHEN c.relkind = 'm' THEN 'materialized_view'
27860
- END AS type
28736
+ END AS type,
28737
+ c.relrowsecurity AS rls_enabled
27861
28738
  FROM
27862
28739
  pg_catalog.pg_class c
27863
28740
  JOIN
@@ -27943,6 +28820,60 @@ WHERE
27943
28820
  if (progressCallback) {
27944
28821
  progressCallback("enums", Object.keys(enumsToReturn).length, "done");
27945
28822
  }
28823
+ const allRoles = await db.query(
28824
+ `SELECT rolname, rolinherit, rolcreatedb, rolcreaterole FROM pg_roles;`
28825
+ );
28826
+ const rolesToReturn = {};
28827
+ const preparedRoles = prepareRoles(entities);
28828
+ if (preparedRoles.useRoles || !(preparedRoles.includeRoles.length === 0 && preparedRoles.excludeRoles.length === 0)) {
28829
+ for (const dbRole of allRoles) {
28830
+ if (preparedRoles.useRoles) {
28831
+ rolesToReturn[dbRole.rolname] = {
28832
+ createDb: dbRole.rolcreatedb,
28833
+ createRole: dbRole.rolcreatedb,
28834
+ inherit: dbRole.rolinherit,
28835
+ name: dbRole.rolname
28836
+ };
28837
+ } else {
28838
+ if (preparedRoles.includeRoles.length === 0 && preparedRoles.excludeRoles.length === 0) continue;
28839
+ if (preparedRoles.includeRoles.includes(dbRole.rolname) && preparedRoles.excludeRoles.includes(dbRole.rolname)) continue;
28840
+ if (preparedRoles.excludeRoles.includes(dbRole.rolname)) continue;
28841
+ if (!preparedRoles.includeRoles.includes(dbRole.rolname)) continue;
28842
+ rolesToReturn[dbRole.rolname] = {
28843
+ createDb: dbRole.rolcreatedb,
28844
+ createRole: dbRole.rolcreaterole,
28845
+ inherit: dbRole.rolinherit,
28846
+ name: dbRole.rolname
28847
+ };
28848
+ }
28849
+ }
28850
+ }
28851
+ const wherePolicies = schemaFilters.map((t) => `schemaname = '${t}'`).join(" or ");
28852
+ const policiesByTable = {};
28853
+ const allPolicies = await db.query(`SELECT schemaname, tablename, policyname as name, permissive as "as", roles as to, cmd as for, qual as using, with_check as "withCheck" FROM pg_policies${wherePolicies === "" ? "" : ` WHERE ${wherePolicies}`};`);
28854
+ for (const dbPolicy of allPolicies) {
28855
+ const { tablename, schemaname, to, withCheck, using, ...rest } = dbPolicy;
28856
+ const tableForPolicy = policiesByTable[`${schemaname}.${tablename}`];
28857
+ const parsedTo = to;
28858
+ const parsedWithCheck = withCheck === null ? void 0 : withCheck;
28859
+ const parsedUsing = using === null ? void 0 : using;
28860
+ if (tableForPolicy) {
28861
+ tableForPolicy[dbPolicy.name] = { ...rest, to: parsedTo };
28862
+ } else {
28863
+ policiesByTable[`${schemaname}.${tablename}`] = {
28864
+ [dbPolicy.name]: { ...rest, to: parsedTo, withCheck: parsedWithCheck, using: parsedUsing }
28865
+ };
28866
+ }
28867
+ }
28868
+ if (progressCallback) {
28869
+ progressCallback(
28870
+ "policies",
28871
+ Object.values(policiesByTable).reduce((total, innerRecord) => {
28872
+ return total + Object.keys(innerRecord).length;
28873
+ }, 0),
28874
+ "done"
28875
+ );
28876
+ }
27946
28877
  const sequencesInColumns = [];
27947
28878
  const all = allTables.filter((it) => it.type === "table").map((row) => {
27948
28879
  return new Promise(async (res, rej) => {
@@ -28304,7 +29235,7 @@ WHERE
28304
29235
  }
28305
29236
  ],
28306
29237
  isUnique: indexIsUnique,
28307
- // should not be a part of diff detecs
29238
+ // should not be a part of diff detects
28308
29239
  concurrently: false,
28309
29240
  method: indexMethod,
28310
29241
  where: indexWhere === null ? void 0 : indexWhere,
@@ -28324,7 +29255,9 @@ WHERE
28324
29255
  foreignKeys: foreignKeysToReturn,
28325
29256
  compositePrimaryKeys: primaryKeys,
28326
29257
  uniqueConstraints: uniqueConstrains,
28327
- checkConstraints
29258
+ checkConstraints,
29259
+ policies: policiesByTable[`${tableSchema}.${tableName}`] ?? {},
29260
+ isRLSEnabled: row.rls_enabled
28328
29261
  };
28329
29262
  } catch (e) {
28330
29263
  rej(e);
@@ -28522,6 +29455,7 @@ WHERE
28522
29455
  enums: enumsToReturn,
28523
29456
  schemas: schemasObject,
28524
29457
  sequences: sequencesToReturn,
29458
+ roles: rolesToReturn,
28525
29459
  views,
28526
29460
  _meta: {
28527
29461
  schemas: {},
@@ -28716,12 +29650,12 @@ var init_alias3 = __esm({
28716
29650
  });
28717
29651
 
28718
29652
  // ../drizzle-orm/dist/sqlite-core/checks.js
28719
- var _a160, CheckBuilder2, _a161, Check2;
29653
+ var _a162, CheckBuilder2, _a163, Check2;
28720
29654
  var init_checks2 = __esm({
28721
29655
  "../drizzle-orm/dist/sqlite-core/checks.js"() {
28722
29656
  "use strict";
28723
29657
  init_entity();
28724
- _a160 = entityKind;
29658
+ _a162 = entityKind;
28725
29659
  CheckBuilder2 = class {
28726
29660
  constructor(name2, value) {
28727
29661
  __publicField(this, "brand");
@@ -28732,8 +29666,8 @@ var init_checks2 = __esm({
28732
29666
  return new Check2(table4, this);
28733
29667
  }
28734
29668
  };
28735
- __publicField(CheckBuilder2, _a160, "SQLiteCheckBuilder");
28736
- _a161 = entityKind;
29669
+ __publicField(CheckBuilder2, _a162, "SQLiteCheckBuilder");
29670
+ _a163 = entityKind;
28737
29671
  Check2 = class {
28738
29672
  constructor(table4, builder) {
28739
29673
  __publicField(this, "name");
@@ -28743,18 +29677,18 @@ var init_checks2 = __esm({
28743
29677
  this.value = builder.value;
28744
29678
  }
28745
29679
  };
28746
- __publicField(Check2, _a161, "SQLiteCheck");
29680
+ __publicField(Check2, _a163, "SQLiteCheck");
28747
29681
  }
28748
29682
  });
28749
29683
 
28750
29684
  // ../drizzle-orm/dist/sqlite-core/foreign-keys.js
28751
- var _a162, ForeignKeyBuilder2, _a163, ForeignKey2;
29685
+ var _a164, ForeignKeyBuilder2, _a165, ForeignKey2;
28752
29686
  var init_foreign_keys2 = __esm({
28753
29687
  "../drizzle-orm/dist/sqlite-core/foreign-keys.js"() {
28754
29688
  "use strict";
28755
29689
  init_entity();
28756
29690
  init_table_utils();
28757
- _a162 = entityKind;
29691
+ _a164 = entityKind;
28758
29692
  ForeignKeyBuilder2 = class {
28759
29693
  constructor(config, actions) {
28760
29694
  /** @internal */
@@ -28785,8 +29719,8 @@ var init_foreign_keys2 = __esm({
28785
29719
  return new ForeignKey2(table4, this);
28786
29720
  }
28787
29721
  };
28788
- __publicField(ForeignKeyBuilder2, _a162, "SQLiteForeignKeyBuilder");
28789
- _a163 = entityKind;
29722
+ __publicField(ForeignKeyBuilder2, _a164, "SQLiteForeignKeyBuilder");
29723
+ _a165 = entityKind;
28790
29724
  ForeignKey2 = class {
28791
29725
  constructor(table4, builder) {
28792
29726
  __publicField(this, "reference");
@@ -28810,7 +29744,7 @@ var init_foreign_keys2 = __esm({
28810
29744
  return name2 ?? `${chunks.join("_")}_fk`;
28811
29745
  }
28812
29746
  };
28813
- __publicField(ForeignKey2, _a163, "SQLiteForeignKey");
29747
+ __publicField(ForeignKey2, _a165, "SQLiteForeignKey");
28814
29748
  }
28815
29749
  });
28816
29750
 
@@ -28818,13 +29752,13 @@ var init_foreign_keys2 = __esm({
28818
29752
  function uniqueKeyName2(table4, columns) {
28819
29753
  return `${table4[TableName]}_${columns.join("_")}_unique`;
28820
29754
  }
28821
- var _a164, UniqueConstraintBuilder2, _a165, UniqueOnConstraintBuilder2, _a166, UniqueConstraint2;
29755
+ var _a166, UniqueConstraintBuilder2, _a167, UniqueOnConstraintBuilder2, _a168, UniqueConstraint2;
28822
29756
  var init_unique_constraint2 = __esm({
28823
29757
  "../drizzle-orm/dist/sqlite-core/unique-constraint.js"() {
28824
29758
  "use strict";
28825
29759
  init_entity();
28826
29760
  init_table_utils();
28827
- _a164 = entityKind;
29761
+ _a166 = entityKind;
28828
29762
  UniqueConstraintBuilder2 = class {
28829
29763
  constructor(columns, name2) {
28830
29764
  /** @internal */
@@ -28837,8 +29771,8 @@ var init_unique_constraint2 = __esm({
28837
29771
  return new UniqueConstraint2(table4, this.columns, this.name);
28838
29772
  }
28839
29773
  };
28840
- __publicField(UniqueConstraintBuilder2, _a164, "SQLiteUniqueConstraintBuilder");
28841
- _a165 = entityKind;
29774
+ __publicField(UniqueConstraintBuilder2, _a166, "SQLiteUniqueConstraintBuilder");
29775
+ _a167 = entityKind;
28842
29776
  UniqueOnConstraintBuilder2 = class {
28843
29777
  constructor(name2) {
28844
29778
  /** @internal */
@@ -28849,8 +29783,8 @@ var init_unique_constraint2 = __esm({
28849
29783
  return new UniqueConstraintBuilder2(columns, this.name);
28850
29784
  }
28851
29785
  };
28852
- __publicField(UniqueOnConstraintBuilder2, _a165, "SQLiteUniqueOnConstraintBuilder");
28853
- _a166 = entityKind;
29786
+ __publicField(UniqueOnConstraintBuilder2, _a167, "SQLiteUniqueOnConstraintBuilder");
29787
+ _a168 = entityKind;
28854
29788
  UniqueConstraint2 = class {
28855
29789
  constructor(table4, columns, name2) {
28856
29790
  __publicField(this, "columns");
@@ -28863,12 +29797,12 @@ var init_unique_constraint2 = __esm({
28863
29797
  return this.name;
28864
29798
  }
28865
29799
  };
28866
- __publicField(UniqueConstraint2, _a166, "SQLiteUniqueConstraint");
29800
+ __publicField(UniqueConstraint2, _a168, "SQLiteUniqueConstraint");
28867
29801
  }
28868
29802
  });
28869
29803
 
28870
29804
  // ../drizzle-orm/dist/sqlite-core/columns/common.js
28871
- var _a167, _b114, SQLiteColumnBuilder, _a168, _b115, SQLiteColumn;
29805
+ var _a169, _b114, SQLiteColumnBuilder, _a170, _b115, SQLiteColumn;
28872
29806
  var init_common3 = __esm({
28873
29807
  "../drizzle-orm/dist/sqlite-core/columns/common.js"() {
28874
29808
  "use strict";
@@ -28877,7 +29811,7 @@ var init_common3 = __esm({
28877
29811
  init_entity();
28878
29812
  init_foreign_keys2();
28879
29813
  init_unique_constraint2();
28880
- SQLiteColumnBuilder = class extends (_b114 = ColumnBuilder, _a167 = entityKind, _b114) {
29814
+ SQLiteColumnBuilder = class extends (_b114 = ColumnBuilder, _a169 = entityKind, _b114) {
28881
29815
  constructor() {
28882
29816
  super(...arguments);
28883
29817
  __publicField(this, "foreignKeyConfigs", []);
@@ -28918,8 +29852,8 @@ var init_common3 = __esm({
28918
29852
  });
28919
29853
  }
28920
29854
  };
28921
- __publicField(SQLiteColumnBuilder, _a167, "SQLiteColumnBuilder");
28922
- SQLiteColumn = class extends (_b115 = Column2, _a168 = entityKind, _b115) {
29855
+ __publicField(SQLiteColumnBuilder, _a169, "SQLiteColumnBuilder");
29856
+ SQLiteColumn = class extends (_b115 = Column2, _a170 = entityKind, _b115) {
28923
29857
  constructor(table4, config) {
28924
29858
  if (!config.uniqueName) {
28925
29859
  config.uniqueName = uniqueKeyName2(table4, [config.name]);
@@ -28928,7 +29862,7 @@ var init_common3 = __esm({
28928
29862
  this.table = table4;
28929
29863
  }
28930
29864
  };
28931
- __publicField(SQLiteColumn, _a168, "SQLiteColumn");
29865
+ __publicField(SQLiteColumn, _a170, "SQLiteColumn");
28932
29866
  }
28933
29867
  });
28934
29868
 
@@ -28943,14 +29877,14 @@ function blob(a, b) {
28943
29877
  }
28944
29878
  return new SQLiteBlobBufferBuilder(name2);
28945
29879
  }
28946
- var _a169, _b116, SQLiteBigIntBuilder, _a170, _b117, SQLiteBigInt, _a171, _b118, SQLiteBlobJsonBuilder, _a172, _b119, SQLiteBlobJson, _a173, _b120, SQLiteBlobBufferBuilder, _a174, _b121, SQLiteBlobBuffer;
29880
+ var _a171, _b116, SQLiteBigIntBuilder, _a172, _b117, SQLiteBigInt, _a173, _b118, SQLiteBlobJsonBuilder, _a174, _b119, SQLiteBlobJson, _a175, _b120, SQLiteBlobBufferBuilder, _a176, _b121, SQLiteBlobBuffer;
28947
29881
  var init_blob = __esm({
28948
29882
  "../drizzle-orm/dist/sqlite-core/columns/blob.js"() {
28949
29883
  "use strict";
28950
29884
  init_entity();
28951
29885
  init_utils2();
28952
29886
  init_common3();
28953
- SQLiteBigIntBuilder = class extends (_b116 = SQLiteColumnBuilder, _a169 = entityKind, _b116) {
29887
+ SQLiteBigIntBuilder = class extends (_b116 = SQLiteColumnBuilder, _a171 = entityKind, _b116) {
28954
29888
  constructor(name2) {
28955
29889
  super(name2, "bigint", "SQLiteBigInt");
28956
29890
  }
@@ -28959,8 +29893,8 @@ var init_blob = __esm({
28959
29893
  return new SQLiteBigInt(table4, this.config);
28960
29894
  }
28961
29895
  };
28962
- __publicField(SQLiteBigIntBuilder, _a169, "SQLiteBigIntBuilder");
28963
- SQLiteBigInt = class extends (_b117 = SQLiteColumn, _a170 = entityKind, _b117) {
29896
+ __publicField(SQLiteBigIntBuilder, _a171, "SQLiteBigIntBuilder");
29897
+ SQLiteBigInt = class extends (_b117 = SQLiteColumn, _a172 = entityKind, _b117) {
28964
29898
  getSQLType() {
28965
29899
  return "blob";
28966
29900
  }
@@ -28971,8 +29905,8 @@ var init_blob = __esm({
28971
29905
  return Buffer.from(value.toString());
28972
29906
  }
28973
29907
  };
28974
- __publicField(SQLiteBigInt, _a170, "SQLiteBigInt");
28975
- SQLiteBlobJsonBuilder = class extends (_b118 = SQLiteColumnBuilder, _a171 = entityKind, _b118) {
29908
+ __publicField(SQLiteBigInt, _a172, "SQLiteBigInt");
29909
+ SQLiteBlobJsonBuilder = class extends (_b118 = SQLiteColumnBuilder, _a173 = entityKind, _b118) {
28976
29910
  constructor(name2) {
28977
29911
  super(name2, "json", "SQLiteBlobJson");
28978
29912
  }
@@ -28984,8 +29918,8 @@ var init_blob = __esm({
28984
29918
  );
28985
29919
  }
28986
29920
  };
28987
- __publicField(SQLiteBlobJsonBuilder, _a171, "SQLiteBlobJsonBuilder");
28988
- SQLiteBlobJson = class extends (_b119 = SQLiteColumn, _a172 = entityKind, _b119) {
29921
+ __publicField(SQLiteBlobJsonBuilder, _a173, "SQLiteBlobJsonBuilder");
29922
+ SQLiteBlobJson = class extends (_b119 = SQLiteColumn, _a174 = entityKind, _b119) {
28989
29923
  getSQLType() {
28990
29924
  return "blob";
28991
29925
  }
@@ -28996,8 +29930,8 @@ var init_blob = __esm({
28996
29930
  return Buffer.from(JSON.stringify(value));
28997
29931
  }
28998
29932
  };
28999
- __publicField(SQLiteBlobJson, _a172, "SQLiteBlobJson");
29000
- SQLiteBlobBufferBuilder = class extends (_b120 = SQLiteColumnBuilder, _a173 = entityKind, _b120) {
29933
+ __publicField(SQLiteBlobJson, _a174, "SQLiteBlobJson");
29934
+ SQLiteBlobBufferBuilder = class extends (_b120 = SQLiteColumnBuilder, _a175 = entityKind, _b120) {
29001
29935
  constructor(name2) {
29002
29936
  super(name2, "buffer", "SQLiteBlobBuffer");
29003
29937
  }
@@ -29006,13 +29940,13 @@ var init_blob = __esm({
29006
29940
  return new SQLiteBlobBuffer(table4, this.config);
29007
29941
  }
29008
29942
  };
29009
- __publicField(SQLiteBlobBufferBuilder, _a173, "SQLiteBlobBufferBuilder");
29010
- SQLiteBlobBuffer = class extends (_b121 = SQLiteColumn, _a174 = entityKind, _b121) {
29943
+ __publicField(SQLiteBlobBufferBuilder, _a175, "SQLiteBlobBufferBuilder");
29944
+ SQLiteBlobBuffer = class extends (_b121 = SQLiteColumn, _a176 = entityKind, _b121) {
29011
29945
  getSQLType() {
29012
29946
  return "blob";
29013
29947
  }
29014
29948
  };
29015
- __publicField(SQLiteBlobBuffer, _a174, "SQLiteBlobBuffer");
29949
+ __publicField(SQLiteBlobBuffer, _a176, "SQLiteBlobBuffer");
29016
29950
  }
29017
29951
  });
29018
29952
 
@@ -29027,14 +29961,14 @@ function customType2(customTypeParams) {
29027
29961
  );
29028
29962
  };
29029
29963
  }
29030
- var _a175, _b122, SQLiteCustomColumnBuilder, _a176, _b123, SQLiteCustomColumn;
29964
+ var _a177, _b122, SQLiteCustomColumnBuilder, _a178, _b123, SQLiteCustomColumn;
29031
29965
  var init_custom2 = __esm({
29032
29966
  "../drizzle-orm/dist/sqlite-core/columns/custom.js"() {
29033
29967
  "use strict";
29034
29968
  init_entity();
29035
29969
  init_utils2();
29036
29970
  init_common3();
29037
- SQLiteCustomColumnBuilder = class extends (_b122 = SQLiteColumnBuilder, _a175 = entityKind, _b122) {
29971
+ SQLiteCustomColumnBuilder = class extends (_b122 = SQLiteColumnBuilder, _a177 = entityKind, _b122) {
29038
29972
  constructor(name2, fieldConfig, customTypeParams) {
29039
29973
  super(name2, "custom", "SQLiteCustomColumn");
29040
29974
  this.config.fieldConfig = fieldConfig;
@@ -29048,8 +29982,8 @@ var init_custom2 = __esm({
29048
29982
  );
29049
29983
  }
29050
29984
  };
29051
- __publicField(SQLiteCustomColumnBuilder, _a175, "SQLiteCustomColumnBuilder");
29052
- SQLiteCustomColumn = class extends (_b123 = SQLiteColumn, _a176 = entityKind, _b123) {
29985
+ __publicField(SQLiteCustomColumnBuilder, _a177, "SQLiteCustomColumnBuilder");
29986
+ SQLiteCustomColumn = class extends (_b123 = SQLiteColumn, _a178 = entityKind, _b123) {
29053
29987
  constructor(table4, config) {
29054
29988
  super(table4, config);
29055
29989
  __publicField(this, "sqlName");
@@ -29069,7 +30003,7 @@ var init_custom2 = __esm({
29069
30003
  return typeof this.mapTo === "function" ? this.mapTo(value) : value;
29070
30004
  }
29071
30005
  };
29072
- __publicField(SQLiteCustomColumn, _a176, "SQLiteCustomColumn");
30006
+ __publicField(SQLiteCustomColumn, _a178, "SQLiteCustomColumn");
29073
30007
  }
29074
30008
  });
29075
30009
 
@@ -29084,7 +30018,7 @@ function integer2(a, b) {
29084
30018
  }
29085
30019
  return new SQLiteIntegerBuilder(name2);
29086
30020
  }
29087
- var _a177, _b124, SQLiteBaseIntegerBuilder, _a178, _b125, SQLiteBaseInteger, _a179, _b126, SQLiteIntegerBuilder, _a180, _b127, SQLiteInteger, _a181, _b128, SQLiteTimestampBuilder, _a182, _b129, SQLiteTimestamp, _a183, _b130, SQLiteBooleanBuilder, _a184, _b131, SQLiteBoolean;
30021
+ var _a179, _b124, SQLiteBaseIntegerBuilder, _a180, _b125, SQLiteBaseInteger, _a181, _b126, SQLiteIntegerBuilder, _a182, _b127, SQLiteInteger, _a183, _b128, SQLiteTimestampBuilder, _a184, _b129, SQLiteTimestamp, _a185, _b130, SQLiteBooleanBuilder, _a186, _b131, SQLiteBoolean;
29088
30022
  var init_integer2 = __esm({
29089
30023
  "../drizzle-orm/dist/sqlite-core/columns/integer.js"() {
29090
30024
  "use strict";
@@ -29092,7 +30026,7 @@ var init_integer2 = __esm({
29092
30026
  init_sql();
29093
30027
  init_utils2();
29094
30028
  init_common3();
29095
- SQLiteBaseIntegerBuilder = class extends (_b124 = SQLiteColumnBuilder, _a177 = entityKind, _b124) {
30029
+ SQLiteBaseIntegerBuilder = class extends (_b124 = SQLiteColumnBuilder, _a179 = entityKind, _b124) {
29096
30030
  constructor(name2, dataType, columnType) {
29097
30031
  super(name2, dataType, columnType);
29098
30032
  this.config.autoIncrement = false;
@@ -29105,8 +30039,8 @@ var init_integer2 = __esm({
29105
30039
  return super.primaryKey();
29106
30040
  }
29107
30041
  };
29108
- __publicField(SQLiteBaseIntegerBuilder, _a177, "SQLiteBaseIntegerBuilder");
29109
- SQLiteBaseInteger = class extends (_b125 = SQLiteColumn, _a178 = entityKind, _b125) {
30042
+ __publicField(SQLiteBaseIntegerBuilder, _a179, "SQLiteBaseIntegerBuilder");
30043
+ SQLiteBaseInteger = class extends (_b125 = SQLiteColumn, _a180 = entityKind, _b125) {
29110
30044
  constructor() {
29111
30045
  super(...arguments);
29112
30046
  __publicField(this, "autoIncrement", this.config.autoIncrement);
@@ -29115,8 +30049,8 @@ var init_integer2 = __esm({
29115
30049
  return "integer";
29116
30050
  }
29117
30051
  };
29118
- __publicField(SQLiteBaseInteger, _a178, "SQLiteBaseInteger");
29119
- SQLiteIntegerBuilder = class extends (_b126 = SQLiteBaseIntegerBuilder, _a179 = entityKind, _b126) {
30052
+ __publicField(SQLiteBaseInteger, _a180, "SQLiteBaseInteger");
30053
+ SQLiteIntegerBuilder = class extends (_b126 = SQLiteBaseIntegerBuilder, _a181 = entityKind, _b126) {
29120
30054
  constructor(name2) {
29121
30055
  super(name2, "number", "SQLiteInteger");
29122
30056
  }
@@ -29127,11 +30061,11 @@ var init_integer2 = __esm({
29127
30061
  );
29128
30062
  }
29129
30063
  };
29130
- __publicField(SQLiteIntegerBuilder, _a179, "SQLiteIntegerBuilder");
29131
- SQLiteInteger = class extends (_b127 = SQLiteBaseInteger, _a180 = entityKind, _b127) {
30064
+ __publicField(SQLiteIntegerBuilder, _a181, "SQLiteIntegerBuilder");
30065
+ SQLiteInteger = class extends (_b127 = SQLiteBaseInteger, _a182 = entityKind, _b127) {
29132
30066
  };
29133
- __publicField(SQLiteInteger, _a180, "SQLiteInteger");
29134
- SQLiteTimestampBuilder = class extends (_b128 = SQLiteBaseIntegerBuilder, _a181 = entityKind, _b128) {
30067
+ __publicField(SQLiteInteger, _a182, "SQLiteInteger");
30068
+ SQLiteTimestampBuilder = class extends (_b128 = SQLiteBaseIntegerBuilder, _a183 = entityKind, _b128) {
29135
30069
  constructor(name2, mode) {
29136
30070
  super(name2, "date", "SQLiteTimestamp");
29137
30071
  this.config.mode = mode;
@@ -29151,8 +30085,8 @@ var init_integer2 = __esm({
29151
30085
  );
29152
30086
  }
29153
30087
  };
29154
- __publicField(SQLiteTimestampBuilder, _a181, "SQLiteTimestampBuilder");
29155
- SQLiteTimestamp = class extends (_b129 = SQLiteBaseInteger, _a182 = entityKind, _b129) {
30088
+ __publicField(SQLiteTimestampBuilder, _a183, "SQLiteTimestampBuilder");
30089
+ SQLiteTimestamp = class extends (_b129 = SQLiteBaseInteger, _a184 = entityKind, _b129) {
29156
30090
  constructor() {
29157
30091
  super(...arguments);
29158
30092
  __publicField(this, "mode", this.config.mode);
@@ -29171,8 +30105,8 @@ var init_integer2 = __esm({
29171
30105
  return unix;
29172
30106
  }
29173
30107
  };
29174
- __publicField(SQLiteTimestamp, _a182, "SQLiteTimestamp");
29175
- SQLiteBooleanBuilder = class extends (_b130 = SQLiteBaseIntegerBuilder, _a183 = entityKind, _b130) {
30108
+ __publicField(SQLiteTimestamp, _a184, "SQLiteTimestamp");
30109
+ SQLiteBooleanBuilder = class extends (_b130 = SQLiteBaseIntegerBuilder, _a185 = entityKind, _b130) {
29176
30110
  constructor(name2, mode) {
29177
30111
  super(name2, "boolean", "SQLiteBoolean");
29178
30112
  this.config.mode = mode;
@@ -29184,8 +30118,8 @@ var init_integer2 = __esm({
29184
30118
  );
29185
30119
  }
29186
30120
  };
29187
- __publicField(SQLiteBooleanBuilder, _a183, "SQLiteBooleanBuilder");
29188
- SQLiteBoolean = class extends (_b131 = SQLiteBaseInteger, _a184 = entityKind, _b131) {
30121
+ __publicField(SQLiteBooleanBuilder, _a185, "SQLiteBooleanBuilder");
30122
+ SQLiteBoolean = class extends (_b131 = SQLiteBaseInteger, _a186 = entityKind, _b131) {
29189
30123
  constructor() {
29190
30124
  super(...arguments);
29191
30125
  __publicField(this, "mode", this.config.mode);
@@ -29197,7 +30131,7 @@ var init_integer2 = __esm({
29197
30131
  return value ? 1 : 0;
29198
30132
  }
29199
30133
  };
29200
- __publicField(SQLiteBoolean, _a184, "SQLiteBoolean");
30134
+ __publicField(SQLiteBoolean, _a186, "SQLiteBoolean");
29201
30135
  }
29202
30136
  });
29203
30137
 
@@ -29205,13 +30139,13 @@ var init_integer2 = __esm({
29205
30139
  function numeric2(name2) {
29206
30140
  return new SQLiteNumericBuilder(name2 ?? "");
29207
30141
  }
29208
- var _a185, _b132, SQLiteNumericBuilder, _a186, _b133, SQLiteNumeric;
30142
+ var _a187, _b132, SQLiteNumericBuilder, _a188, _b133, SQLiteNumeric;
29209
30143
  var init_numeric2 = __esm({
29210
30144
  "../drizzle-orm/dist/sqlite-core/columns/numeric.js"() {
29211
30145
  "use strict";
29212
30146
  init_entity();
29213
30147
  init_common3();
29214
- SQLiteNumericBuilder = class extends (_b132 = SQLiteColumnBuilder, _a185 = entityKind, _b132) {
30148
+ SQLiteNumericBuilder = class extends (_b132 = SQLiteColumnBuilder, _a187 = entityKind, _b132) {
29215
30149
  constructor(name2) {
29216
30150
  super(name2, "string", "SQLiteNumeric");
29217
30151
  }
@@ -29223,13 +30157,13 @@ var init_numeric2 = __esm({
29223
30157
  );
29224
30158
  }
29225
30159
  };
29226
- __publicField(SQLiteNumericBuilder, _a185, "SQLiteNumericBuilder");
29227
- SQLiteNumeric = class extends (_b133 = SQLiteColumn, _a186 = entityKind, _b133) {
30160
+ __publicField(SQLiteNumericBuilder, _a187, "SQLiteNumericBuilder");
30161
+ SQLiteNumeric = class extends (_b133 = SQLiteColumn, _a188 = entityKind, _b133) {
29228
30162
  getSQLType() {
29229
30163
  return "numeric";
29230
30164
  }
29231
30165
  };
29232
- __publicField(SQLiteNumeric, _a186, "SQLiteNumeric");
30166
+ __publicField(SQLiteNumeric, _a188, "SQLiteNumeric");
29233
30167
  }
29234
30168
  });
29235
30169
 
@@ -29237,13 +30171,13 @@ var init_numeric2 = __esm({
29237
30171
  function real2(name2) {
29238
30172
  return new SQLiteRealBuilder(name2 ?? "");
29239
30173
  }
29240
- var _a187, _b134, SQLiteRealBuilder, _a188, _b135, SQLiteReal;
30174
+ var _a189, _b134, SQLiteRealBuilder, _a190, _b135, SQLiteReal;
29241
30175
  var init_real2 = __esm({
29242
30176
  "../drizzle-orm/dist/sqlite-core/columns/real.js"() {
29243
30177
  "use strict";
29244
30178
  init_entity();
29245
30179
  init_common3();
29246
- SQLiteRealBuilder = class extends (_b134 = SQLiteColumnBuilder, _a187 = entityKind, _b134) {
30180
+ SQLiteRealBuilder = class extends (_b134 = SQLiteColumnBuilder, _a189 = entityKind, _b134) {
29247
30181
  constructor(name2) {
29248
30182
  super(name2, "number", "SQLiteReal");
29249
30183
  }
@@ -29252,13 +30186,13 @@ var init_real2 = __esm({
29252
30186
  return new SQLiteReal(table4, this.config);
29253
30187
  }
29254
30188
  };
29255
- __publicField(SQLiteRealBuilder, _a187, "SQLiteRealBuilder");
29256
- SQLiteReal = class extends (_b135 = SQLiteColumn, _a188 = entityKind, _b135) {
30189
+ __publicField(SQLiteRealBuilder, _a189, "SQLiteRealBuilder");
30190
+ SQLiteReal = class extends (_b135 = SQLiteColumn, _a190 = entityKind, _b135) {
29257
30191
  getSQLType() {
29258
30192
  return "real";
29259
30193
  }
29260
30194
  };
29261
- __publicField(SQLiteReal, _a188, "SQLiteReal");
30195
+ __publicField(SQLiteReal, _a190, "SQLiteReal");
29262
30196
  }
29263
30197
  });
29264
30198
 
@@ -29270,14 +30204,14 @@ function text2(a, b = {}) {
29270
30204
  }
29271
30205
  return new SQLiteTextBuilder(name2, config);
29272
30206
  }
29273
- var _a189, _b136, SQLiteTextBuilder, _a190, _b137, SQLiteText, _a191, _b138, SQLiteTextJsonBuilder, _a192, _b139, SQLiteTextJson;
30207
+ var _a191, _b136, SQLiteTextBuilder, _a192, _b137, SQLiteText, _a193, _b138, SQLiteTextJsonBuilder, _a194, _b139, SQLiteTextJson;
29274
30208
  var init_text2 = __esm({
29275
30209
  "../drizzle-orm/dist/sqlite-core/columns/text.js"() {
29276
30210
  "use strict";
29277
30211
  init_entity();
29278
30212
  init_utils2();
29279
30213
  init_common3();
29280
- SQLiteTextBuilder = class extends (_b136 = SQLiteColumnBuilder, _a189 = entityKind, _b136) {
30214
+ SQLiteTextBuilder = class extends (_b136 = SQLiteColumnBuilder, _a191 = entityKind, _b136) {
29281
30215
  constructor(name2, config) {
29282
30216
  super(name2, "string", "SQLiteText");
29283
30217
  this.config.enumValues = config.enum;
@@ -29288,8 +30222,8 @@ var init_text2 = __esm({
29288
30222
  return new SQLiteText(table4, this.config);
29289
30223
  }
29290
30224
  };
29291
- __publicField(SQLiteTextBuilder, _a189, "SQLiteTextBuilder");
29292
- SQLiteText = class extends (_b137 = SQLiteColumn, _a190 = entityKind, _b137) {
30225
+ __publicField(SQLiteTextBuilder, _a191, "SQLiteTextBuilder");
30226
+ SQLiteText = class extends (_b137 = SQLiteColumn, _a192 = entityKind, _b137) {
29293
30227
  constructor(table4, config) {
29294
30228
  super(table4, config);
29295
30229
  __publicField(this, "enumValues", this.config.enumValues);
@@ -29299,8 +30233,8 @@ var init_text2 = __esm({
29299
30233
  return `text${this.config.length ? `(${this.config.length})` : ""}`;
29300
30234
  }
29301
30235
  };
29302
- __publicField(SQLiteText, _a190, "SQLiteText");
29303
- SQLiteTextJsonBuilder = class extends (_b138 = SQLiteColumnBuilder, _a191 = entityKind, _b138) {
30236
+ __publicField(SQLiteText, _a192, "SQLiteText");
30237
+ SQLiteTextJsonBuilder = class extends (_b138 = SQLiteColumnBuilder, _a193 = entityKind, _b138) {
29304
30238
  constructor(name2) {
29305
30239
  super(name2, "json", "SQLiteTextJson");
29306
30240
  }
@@ -29312,8 +30246,8 @@ var init_text2 = __esm({
29312
30246
  );
29313
30247
  }
29314
30248
  };
29315
- __publicField(SQLiteTextJsonBuilder, _a191, "SQLiteTextJsonBuilder");
29316
- SQLiteTextJson = class extends (_b139 = SQLiteColumn, _a192 = entityKind, _b139) {
30249
+ __publicField(SQLiteTextJsonBuilder, _a193, "SQLiteTextJsonBuilder");
30250
+ SQLiteTextJson = class extends (_b139 = SQLiteColumn, _a194 = entityKind, _b139) {
29317
30251
  getSQLType() {
29318
30252
  return "text";
29319
30253
  }
@@ -29324,7 +30258,7 @@ var init_text2 = __esm({
29324
30258
  return JSON.stringify(value);
29325
30259
  }
29326
30260
  };
29327
- __publicField(SQLiteTextJson, _a192, "SQLiteTextJson");
30261
+ __publicField(SQLiteTextJson, _a194, "SQLiteTextJson");
29328
30262
  }
29329
30263
  });
29330
30264
 
@@ -29386,7 +30320,7 @@ function sqliteTableBase(name2, columns, extraConfig, schema4, baseName = name2)
29386
30320
  }
29387
30321
  return table4;
29388
30322
  }
29389
- var InlineForeignKeys2, _a193, _b140, _c6, _d3, _e2, SQLiteTable, sqliteTable;
30323
+ var InlineForeignKeys2, _a195, _b140, _c6, _d3, _e3, SQLiteTable, sqliteTable;
29390
30324
  var init_table3 = __esm({
29391
30325
  "../drizzle-orm/dist/sqlite-core/table.js"() {
29392
30326
  "use strict";
@@ -29394,7 +30328,7 @@ var init_table3 = __esm({
29394
30328
  init_table();
29395
30329
  init_all2();
29396
30330
  InlineForeignKeys2 = Symbol.for("drizzle:SQLiteInlineForeignKeys");
29397
- SQLiteTable = class extends (_e2 = Table, _d3 = entityKind, _c6 = Table.Symbol.Columns, _b140 = InlineForeignKeys2, _a193 = Table.Symbol.ExtraConfigBuilder, _e2) {
30331
+ SQLiteTable = class extends (_e3 = Table, _d3 = entityKind, _c6 = Table.Symbol.Columns, _b140 = InlineForeignKeys2, _a195 = Table.Symbol.ExtraConfigBuilder, _e3) {
29398
30332
  constructor() {
29399
30333
  super(...arguments);
29400
30334
  /** @internal */
@@ -29402,7 +30336,7 @@ var init_table3 = __esm({
29402
30336
  /** @internal */
29403
30337
  __publicField(this, _b140, []);
29404
30338
  /** @internal */
29405
- __publicField(this, _a193);
30339
+ __publicField(this, _a195);
29406
30340
  }
29407
30341
  };
29408
30342
  __publicField(SQLiteTable, _d3, "SQLiteTable");
@@ -29417,7 +30351,7 @@ var init_table3 = __esm({
29417
30351
  });
29418
30352
 
29419
30353
  // ../drizzle-orm/dist/sqlite-core/query-builders/delete.js
29420
- var _a194, _b141, SQLiteDeleteBase;
30354
+ var _a196, _b141, SQLiteDeleteBase;
29421
30355
  var init_delete2 = __esm({
29422
30356
  "../drizzle-orm/dist/sqlite-core/query-builders/delete.js"() {
29423
30357
  "use strict";
@@ -29427,7 +30361,7 @@ var init_delete2 = __esm({
29427
30361
  init_table3();
29428
30362
  init_table();
29429
30363
  init_utils2();
29430
- SQLiteDeleteBase = class extends (_b141 = QueryPromise, _a194 = entityKind, _b141) {
30364
+ SQLiteDeleteBase = class extends (_b141 = QueryPromise, _a196 = entityKind, _b141) {
29431
30365
  constructor(table4, session, dialect4, withList) {
29432
30366
  super();
29433
30367
  /** @internal */
@@ -29533,12 +30467,12 @@ var init_delete2 = __esm({
29533
30467
  return this;
29534
30468
  }
29535
30469
  };
29536
- __publicField(SQLiteDeleteBase, _a194, "SQLiteDelete");
30470
+ __publicField(SQLiteDeleteBase, _a196, "SQLiteDelete");
29537
30471
  }
29538
30472
  });
29539
30473
 
29540
30474
  // ../drizzle-orm/dist/sqlite-core/query-builders/insert.js
29541
- var _a195, SQLiteInsertBuilder, _a196, _b142, SQLiteInsertBase;
30475
+ var _a197, SQLiteInsertBuilder, _a198, _b142, SQLiteInsertBase;
29542
30476
  var init_insert2 = __esm({
29543
30477
  "../drizzle-orm/dist/sqlite-core/query-builders/insert.js"() {
29544
30478
  "use strict";
@@ -29548,7 +30482,7 @@ var init_insert2 = __esm({
29548
30482
  init_table3();
29549
30483
  init_table();
29550
30484
  init_utils2();
29551
- _a195 = entityKind;
30485
+ _a197 = entityKind;
29552
30486
  SQLiteInsertBuilder = class {
29553
30487
  constructor(table4, session, dialect4, withList) {
29554
30488
  this.table = table4;
@@ -29573,8 +30507,8 @@ var init_insert2 = __esm({
29573
30507
  return new SQLiteInsertBase(this.table, mappedValues, this.session, this.dialect, this.withList);
29574
30508
  }
29575
30509
  };
29576
- __publicField(SQLiteInsertBuilder, _a195, "SQLiteInsertBuilder");
29577
- SQLiteInsertBase = class extends (_b142 = QueryPromise, _a196 = entityKind, _b142) {
30510
+ __publicField(SQLiteInsertBuilder, _a197, "SQLiteInsertBuilder");
30511
+ SQLiteInsertBase = class extends (_b142 = QueryPromise, _a198 = entityKind, _b142) {
29578
30512
  constructor(table4, values, session, dialect4, withList) {
29579
30513
  super();
29580
30514
  /** @internal */
@@ -29701,25 +30635,25 @@ var init_insert2 = __esm({
29701
30635
  return this;
29702
30636
  }
29703
30637
  };
29704
- __publicField(SQLiteInsertBase, _a196, "SQLiteInsert");
30638
+ __publicField(SQLiteInsertBase, _a198, "SQLiteInsert");
29705
30639
  }
29706
30640
  });
29707
30641
 
29708
30642
  // ../drizzle-orm/dist/sqlite-core/view-base.js
29709
- var _a197, _b143, SQLiteViewBase;
30643
+ var _a199, _b143, SQLiteViewBase;
29710
30644
  var init_view_base2 = __esm({
29711
30645
  "../drizzle-orm/dist/sqlite-core/view-base.js"() {
29712
30646
  "use strict";
29713
30647
  init_entity();
29714
30648
  init_sql();
29715
- SQLiteViewBase = class extends (_b143 = View3, _a197 = entityKind, _b143) {
30649
+ SQLiteViewBase = class extends (_b143 = View3, _a199 = entityKind, _b143) {
29716
30650
  };
29717
- __publicField(SQLiteViewBase, _a197, "SQLiteViewBase");
30651
+ __publicField(SQLiteViewBase, _a199, "SQLiteViewBase");
29718
30652
  }
29719
30653
  });
29720
30654
 
29721
30655
  // ../drizzle-orm/dist/sqlite-core/dialect.js
29722
- var _a198, SQLiteDialect, _a199, _b144, SQLiteSyncDialect, _a200, _b145, SQLiteAsyncDialect;
30656
+ var _a200, SQLiteDialect, _a201, _b144, SQLiteSyncDialect, _a202, _b145, SQLiteAsyncDialect;
29723
30657
  var init_dialect2 = __esm({
29724
30658
  "../drizzle-orm/dist/sqlite-core/dialect.js"() {
29725
30659
  "use strict";
@@ -29738,7 +30672,7 @@ var init_dialect2 = __esm({
29738
30672
  init_utils2();
29739
30673
  init_view_common();
29740
30674
  init_view_base2();
29741
- _a198 = entityKind;
30675
+ _a200 = entityKind;
29742
30676
  SQLiteDialect = class {
29743
30677
  constructor(config) {
29744
30678
  /** @internal */
@@ -30260,8 +31194,8 @@ var init_dialect2 = __esm({
30260
31194
  };
30261
31195
  }
30262
31196
  };
30263
- __publicField(SQLiteDialect, _a198, "SQLiteDialect");
30264
- SQLiteSyncDialect = class extends (_b144 = SQLiteDialect, _a199 = entityKind, _b144) {
31197
+ __publicField(SQLiteDialect, _a200, "SQLiteDialect");
31198
+ SQLiteSyncDialect = class extends (_b144 = SQLiteDialect, _a201 = entityKind, _b144) {
30265
31199
  migrate(migrations, session, config) {
30266
31200
  const migrationsTable = config === void 0 ? "__drizzle_migrations" : typeof config === "string" ? "__drizzle_migrations" : config.migrationsTable ?? "__drizzle_migrations";
30267
31201
  const migrationTableCreate = sql`
@@ -30295,8 +31229,8 @@ var init_dialect2 = __esm({
30295
31229
  }
30296
31230
  }
30297
31231
  };
30298
- __publicField(SQLiteSyncDialect, _a199, "SQLiteSyncDialect");
30299
- SQLiteAsyncDialect = class extends (_b145 = SQLiteDialect, _a200 = entityKind, _b145) {
31232
+ __publicField(SQLiteSyncDialect, _a201, "SQLiteSyncDialect");
31233
+ SQLiteAsyncDialect = class extends (_b145 = SQLiteDialect, _a202 = entityKind, _b145) {
30300
31234
  async migrate(migrations, session, config) {
30301
31235
  const migrationsTable = config === void 0 ? "__drizzle_migrations" : typeof config === "string" ? "__drizzle_migrations" : config.migrationsTable ?? "__drizzle_migrations";
30302
31236
  const migrationTableCreate = sql`
@@ -30325,7 +31259,7 @@ var init_dialect2 = __esm({
30325
31259
  });
30326
31260
  }
30327
31261
  };
30328
- __publicField(SQLiteAsyncDialect, _a200, "SQLiteAsyncDialect");
31262
+ __publicField(SQLiteAsyncDialect, _a202, "SQLiteAsyncDialect");
30329
31263
  }
30330
31264
  });
30331
31265
 
@@ -30347,7 +31281,7 @@ function createSetOperator2(type, isAll) {
30347
31281
  return leftSelect.addSetOperators(setOperators);
30348
31282
  };
30349
31283
  }
30350
- var _a201, SQLiteSelectBuilder, _a202, _b146, SQLiteSelectQueryBuilderBase, _a203, _b147, SQLiteSelectBase, getSQLiteSetOperators, union2, unionAll2, intersect2, except2;
31284
+ var _a203, SQLiteSelectBuilder, _a204, _b146, SQLiteSelectQueryBuilderBase, _a205, _b147, SQLiteSelectBase, getSQLiteSetOperators, union2, unionAll2, intersect2, except2;
30351
31285
  var init_select3 = __esm({
30352
31286
  "../drizzle-orm/dist/sqlite-core/query-builders/select.js"() {
30353
31287
  "use strict";
@@ -30361,7 +31295,7 @@ var init_select3 = __esm({
30361
31295
  init_utils2();
30362
31296
  init_view_common();
30363
31297
  init_view_base2();
30364
- _a201 = entityKind;
31298
+ _a203 = entityKind;
30365
31299
  SQLiteSelectBuilder = class {
30366
31300
  constructor(config) {
30367
31301
  __publicField(this, "fields");
@@ -30402,8 +31336,8 @@ var init_select3 = __esm({
30402
31336
  });
30403
31337
  }
30404
31338
  };
30405
- __publicField(SQLiteSelectBuilder, _a201, "SQLiteSelectBuilder");
30406
- SQLiteSelectQueryBuilderBase = class extends (_b146 = TypedQueryBuilder, _a202 = entityKind, _b146) {
31339
+ __publicField(SQLiteSelectBuilder, _a203, "SQLiteSelectBuilder");
31340
+ SQLiteSelectQueryBuilderBase = class extends (_b146 = TypedQueryBuilder, _a204 = entityKind, _b146) {
30407
31341
  constructor({ table: table4, fields, isPartialSelect, session, dialect: dialect4, withList, distinct }) {
30408
31342
  super();
30409
31343
  __publicField(this, "_");
@@ -30908,8 +31842,8 @@ var init_select3 = __esm({
30908
31842
  return this;
30909
31843
  }
30910
31844
  };
30911
- __publicField(SQLiteSelectQueryBuilderBase, _a202, "SQLiteSelectQueryBuilder");
30912
- SQLiteSelectBase = class extends (_b147 = SQLiteSelectQueryBuilderBase, _a203 = entityKind, _b147) {
31845
+ __publicField(SQLiteSelectQueryBuilderBase, _a204, "SQLiteSelectQueryBuilder");
31846
+ SQLiteSelectBase = class extends (_b147 = SQLiteSelectQueryBuilderBase, _a205 = entityKind, _b147) {
30913
31847
  constructor() {
30914
31848
  super(...arguments);
30915
31849
  __publicField(this, "run", (placeholderValues) => {
@@ -30947,7 +31881,7 @@ var init_select3 = __esm({
30947
31881
  return this.all();
30948
31882
  }
30949
31883
  };
30950
- __publicField(SQLiteSelectBase, _a203, "SQLiteSelect");
31884
+ __publicField(SQLiteSelectBase, _a205, "SQLiteSelect");
30951
31885
  applyMixins(SQLiteSelectBase, [QueryPromise]);
30952
31886
  getSQLiteSetOperators = () => ({
30953
31887
  union: union2,
@@ -30963,7 +31897,7 @@ var init_select3 = __esm({
30963
31897
  });
30964
31898
 
30965
31899
  // ../drizzle-orm/dist/sqlite-core/query-builders/query-builder.js
30966
- var _a204, QueryBuilder2;
31900
+ var _a206, QueryBuilder2;
30967
31901
  var init_query_builder3 = __esm({
30968
31902
  "../drizzle-orm/dist/sqlite-core/query-builders/query-builder.js"() {
30969
31903
  "use strict";
@@ -30972,7 +31906,7 @@ var init_query_builder3 = __esm({
30972
31906
  init_dialect2();
30973
31907
  init_subquery();
30974
31908
  init_select3();
30975
- _a204 = entityKind;
31909
+ _a206 = entityKind;
30976
31910
  QueryBuilder2 = class {
30977
31911
  constructor(dialect4) {
30978
31912
  __publicField(this, "dialect");
@@ -31034,7 +31968,7 @@ var init_query_builder3 = __esm({
31034
31968
  return this.dialect;
31035
31969
  }
31036
31970
  };
31037
- __publicField(QueryBuilder2, _a204, "SQLiteQueryBuilder");
31971
+ __publicField(QueryBuilder2, _a206, "SQLiteQueryBuilder");
31038
31972
  }
31039
31973
  });
31040
31974
 
@@ -31046,7 +31980,7 @@ var init_select_types2 = __esm({
31046
31980
  });
31047
31981
 
31048
31982
  // ../drizzle-orm/dist/sqlite-core/query-builders/update.js
31049
- var _a205, SQLiteUpdateBuilder, _a206, _b148, SQLiteUpdateBase;
31983
+ var _a207, SQLiteUpdateBuilder, _a208, _b148, SQLiteUpdateBase;
31050
31984
  var init_update2 = __esm({
31051
31985
  "../drizzle-orm/dist/sqlite-core/query-builders/update.js"() {
31052
31986
  "use strict";
@@ -31056,7 +31990,7 @@ var init_update2 = __esm({
31056
31990
  init_table3();
31057
31991
  init_table();
31058
31992
  init_utils2();
31059
- _a205 = entityKind;
31993
+ _a207 = entityKind;
31060
31994
  SQLiteUpdateBuilder = class {
31061
31995
  constructor(table4, session, dialect4, withList) {
31062
31996
  this.table = table4;
@@ -31074,8 +32008,8 @@ var init_update2 = __esm({
31074
32008
  );
31075
32009
  }
31076
32010
  };
31077
- __publicField(SQLiteUpdateBuilder, _a205, "SQLiteUpdateBuilder");
31078
- SQLiteUpdateBase = class extends (_b148 = QueryPromise, _a206 = entityKind, _b148) {
32011
+ __publicField(SQLiteUpdateBuilder, _a207, "SQLiteUpdateBuilder");
32012
+ SQLiteUpdateBase = class extends (_b148 = QueryPromise, _a208 = entityKind, _b148) {
31079
32013
  constructor(table4, set, session, dialect4, withList) {
31080
32014
  super();
31081
32015
  /** @internal */
@@ -31184,7 +32118,7 @@ var init_update2 = __esm({
31184
32118
  return this;
31185
32119
  }
31186
32120
  };
31187
- __publicField(SQLiteUpdateBase, _a206, "SQLiteUpdate");
32121
+ __publicField(SQLiteUpdateBase, _a208, "SQLiteUpdate");
31188
32122
  }
31189
32123
  });
31190
32124
 
@@ -31202,17 +32136,17 @@ var init_query_builders2 = __esm({
31202
32136
  });
31203
32137
 
31204
32138
  // ../drizzle-orm/dist/sqlite-core/query-builders/count.js
31205
- var _a207, _b149, _c7, _SQLiteCountBuilder, SQLiteCountBuilder;
32139
+ var _a209, _b149, _c7, _SQLiteCountBuilder, SQLiteCountBuilder;
31206
32140
  var init_count2 = __esm({
31207
32141
  "../drizzle-orm/dist/sqlite-core/query-builders/count.js"() {
31208
32142
  "use strict";
31209
32143
  init_entity();
31210
32144
  init_sql();
31211
- _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b149 = entityKind, _a207 = Symbol.toStringTag, _c7) {
32145
+ _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b149 = entityKind, _a209 = Symbol.toStringTag, _c7) {
31212
32146
  constructor(params) {
31213
32147
  super(_SQLiteCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
31214
32148
  __publicField(this, "sql");
31215
- __publicField(this, _a207, "SQLiteCountBuilderAsync");
32149
+ __publicField(this, _a209, "SQLiteCountBuilderAsync");
31216
32150
  __publicField(this, "session");
31217
32151
  this.params = params;
31218
32152
  this.session = params.session;
@@ -31255,14 +32189,14 @@ var init_count2 = __esm({
31255
32189
  });
31256
32190
 
31257
32191
  // ../drizzle-orm/dist/sqlite-core/query-builders/query.js
31258
- var _a208, RelationalQueryBuilder2, _a209, _b150, SQLiteRelationalQuery, _a210, _b151, SQLiteSyncRelationalQuery;
32192
+ var _a210, RelationalQueryBuilder2, _a211, _b150, SQLiteRelationalQuery, _a212, _b151, SQLiteSyncRelationalQuery;
31259
32193
  var init_query2 = __esm({
31260
32194
  "../drizzle-orm/dist/sqlite-core/query-builders/query.js"() {
31261
32195
  "use strict";
31262
32196
  init_entity();
31263
32197
  init_query_promise();
31264
32198
  init_relations();
31265
- _a208 = entityKind;
32199
+ _a210 = entityKind;
31266
32200
  RelationalQueryBuilder2 = class {
31267
32201
  constructor(mode, fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session) {
31268
32202
  this.mode = mode;
@@ -31321,8 +32255,8 @@ var init_query2 = __esm({
31321
32255
  );
31322
32256
  }
31323
32257
  };
31324
- __publicField(RelationalQueryBuilder2, _a208, "SQLiteAsyncRelationalQueryBuilder");
31325
- SQLiteRelationalQuery = class extends (_b150 = QueryPromise, _a209 = entityKind, _b150) {
32258
+ __publicField(RelationalQueryBuilder2, _a210, "SQLiteAsyncRelationalQueryBuilder");
32259
+ SQLiteRelationalQuery = class extends (_b150 = QueryPromise, _a211 = entityKind, _b150) {
31326
32260
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, config, mode) {
31327
32261
  super();
31328
32262
  /** @internal */
@@ -31398,24 +32332,24 @@ var init_query2 = __esm({
31398
32332
  return this.executeRaw();
31399
32333
  }
31400
32334
  };
31401
- __publicField(SQLiteRelationalQuery, _a209, "SQLiteAsyncRelationalQuery");
31402
- SQLiteSyncRelationalQuery = class extends (_b151 = SQLiteRelationalQuery, _a210 = entityKind, _b151) {
32335
+ __publicField(SQLiteRelationalQuery, _a211, "SQLiteAsyncRelationalQuery");
32336
+ SQLiteSyncRelationalQuery = class extends (_b151 = SQLiteRelationalQuery, _a212 = entityKind, _b151) {
31403
32337
  sync() {
31404
32338
  return this.executeRaw();
31405
32339
  }
31406
32340
  };
31407
- __publicField(SQLiteSyncRelationalQuery, _a210, "SQLiteSyncRelationalQuery");
32341
+ __publicField(SQLiteSyncRelationalQuery, _a212, "SQLiteSyncRelationalQuery");
31408
32342
  }
31409
32343
  });
31410
32344
 
31411
32345
  // ../drizzle-orm/dist/sqlite-core/query-builders/raw.js
31412
- var _a211, _b152, SQLiteRaw;
32346
+ var _a213, _b152, SQLiteRaw;
31413
32347
  var init_raw2 = __esm({
31414
32348
  "../drizzle-orm/dist/sqlite-core/query-builders/raw.js"() {
31415
32349
  "use strict";
31416
32350
  init_entity();
31417
32351
  init_query_promise();
31418
- SQLiteRaw = class extends (_b152 = QueryPromise, _a211 = entityKind, _b152) {
32352
+ SQLiteRaw = class extends (_b152 = QueryPromise, _a213 = entityKind, _b152) {
31419
32353
  constructor(execute, getSQL, action, dialect4, mapBatchResult) {
31420
32354
  super();
31421
32355
  /** @internal */
@@ -31440,12 +32374,12 @@ var init_raw2 = __esm({
31440
32374
  return false;
31441
32375
  }
31442
32376
  };
31443
- __publicField(SQLiteRaw, _a211, "SQLiteRaw");
32377
+ __publicField(SQLiteRaw, _a213, "SQLiteRaw");
31444
32378
  }
31445
32379
  });
31446
32380
 
31447
32381
  // ../drizzle-orm/dist/sqlite-core/db.js
31448
- var _a212, BaseSQLiteDatabase;
32382
+ var _a214, BaseSQLiteDatabase;
31449
32383
  var init_db2 = __esm({
31450
32384
  "../drizzle-orm/dist/sqlite-core/db.js"() {
31451
32385
  "use strict";
@@ -31457,7 +32391,7 @@ var init_db2 = __esm({
31457
32391
  init_count2();
31458
32392
  init_query2();
31459
32393
  init_raw2();
31460
- _a212 = entityKind;
32394
+ _a214 = entityKind;
31461
32395
  BaseSQLiteDatabase = class {
31462
32396
  constructor(resultKind, dialect4, session, schema4) {
31463
32397
  __publicField(this, "query");
@@ -31739,17 +32673,17 @@ var init_db2 = __esm({
31739
32673
  return this.session.transaction(transaction, config);
31740
32674
  }
31741
32675
  };
31742
- __publicField(BaseSQLiteDatabase, _a212, "BaseSQLiteDatabase");
32676
+ __publicField(BaseSQLiteDatabase, _a214, "BaseSQLiteDatabase");
31743
32677
  }
31744
32678
  });
31745
32679
 
31746
32680
  // ../drizzle-orm/dist/sqlite-core/indexes.js
31747
- var _a213, IndexBuilderOn2, _a214, IndexBuilder2, _a215, Index4;
32681
+ var _a215, IndexBuilderOn2, _a216, IndexBuilder2, _a217, Index4;
31748
32682
  var init_indexes2 = __esm({
31749
32683
  "../drizzle-orm/dist/sqlite-core/indexes.js"() {
31750
32684
  "use strict";
31751
32685
  init_entity();
31752
- _a213 = entityKind;
32686
+ _a215 = entityKind;
31753
32687
  IndexBuilderOn2 = class {
31754
32688
  constructor(name2, unique) {
31755
32689
  this.name = name2;
@@ -31759,8 +32693,8 @@ var init_indexes2 = __esm({
31759
32693
  return new IndexBuilder2(this.name, columns, this.unique);
31760
32694
  }
31761
32695
  };
31762
- __publicField(IndexBuilderOn2, _a213, "SQLiteIndexBuilderOn");
31763
- _a214 = entityKind;
32696
+ __publicField(IndexBuilderOn2, _a215, "SQLiteIndexBuilderOn");
32697
+ _a216 = entityKind;
31764
32698
  IndexBuilder2 = class {
31765
32699
  constructor(name2, columns, unique) {
31766
32700
  /** @internal */
@@ -31784,26 +32718,26 @@ var init_indexes2 = __esm({
31784
32718
  return new Index4(this.config, table4);
31785
32719
  }
31786
32720
  };
31787
- __publicField(IndexBuilder2, _a214, "SQLiteIndexBuilder");
31788
- _a215 = entityKind;
32721
+ __publicField(IndexBuilder2, _a216, "SQLiteIndexBuilder");
32722
+ _a217 = entityKind;
31789
32723
  Index4 = class {
31790
32724
  constructor(config, table4) {
31791
32725
  __publicField(this, "config");
31792
32726
  this.config = { ...config, table: table4 };
31793
32727
  }
31794
32728
  };
31795
- __publicField(Index4, _a215, "SQLiteIndex");
32729
+ __publicField(Index4, _a217, "SQLiteIndex");
31796
32730
  }
31797
32731
  });
31798
32732
 
31799
32733
  // ../drizzle-orm/dist/sqlite-core/primary-keys.js
31800
- var _a216, PrimaryKeyBuilder2, _a217, PrimaryKey2;
32734
+ var _a218, PrimaryKeyBuilder2, _a219, PrimaryKey2;
31801
32735
  var init_primary_keys2 = __esm({
31802
32736
  "../drizzle-orm/dist/sqlite-core/primary-keys.js"() {
31803
32737
  "use strict";
31804
32738
  init_entity();
31805
32739
  init_table3();
31806
- _a216 = entityKind;
32740
+ _a218 = entityKind;
31807
32741
  PrimaryKeyBuilder2 = class {
31808
32742
  constructor(columns, name2) {
31809
32743
  /** @internal */
@@ -31818,8 +32752,8 @@ var init_primary_keys2 = __esm({
31818
32752
  return new PrimaryKey2(table4, this.columns, this.name);
31819
32753
  }
31820
32754
  };
31821
- __publicField(PrimaryKeyBuilder2, _a216, "SQLitePrimaryKeyBuilder");
31822
- _a217 = entityKind;
32755
+ __publicField(PrimaryKeyBuilder2, _a218, "SQLitePrimaryKeyBuilder");
32756
+ _a219 = entityKind;
31823
32757
  PrimaryKey2 = class {
31824
32758
  constructor(table4, columns, name2) {
31825
32759
  __publicField(this, "columns");
@@ -31832,12 +32766,12 @@ var init_primary_keys2 = __esm({
31832
32766
  return this.name ?? `${this.table[SQLiteTable.Symbol.Name]}_${this.columns.map((column4) => column4.name).join("_")}_pk`;
31833
32767
  }
31834
32768
  };
31835
- __publicField(PrimaryKey2, _a217, "SQLitePrimaryKey");
32769
+ __publicField(PrimaryKey2, _a219, "SQLitePrimaryKey");
31836
32770
  }
31837
32771
  });
31838
32772
 
31839
32773
  // ../drizzle-orm/dist/sqlite-core/session.js
31840
- var _a218, _b153, ExecuteResultSync, _a219, SQLitePreparedQuery, _a220, SQLiteSession, _a221, _b154, SQLiteTransaction;
32774
+ var _a220, _b153, ExecuteResultSync, _a221, SQLitePreparedQuery, _a222, SQLiteSession, _a223, _b154, SQLiteTransaction;
31841
32775
  var init_session2 = __esm({
31842
32776
  "../drizzle-orm/dist/sqlite-core/session.js"() {
31843
32777
  "use strict";
@@ -31845,7 +32779,7 @@ var init_session2 = __esm({
31845
32779
  init_errors();
31846
32780
  init_query_promise();
31847
32781
  init_db2();
31848
- ExecuteResultSync = class extends (_b153 = QueryPromise, _a218 = entityKind, _b153) {
32782
+ ExecuteResultSync = class extends (_b153 = QueryPromise, _a220 = entityKind, _b153) {
31849
32783
  constructor(resultCb) {
31850
32784
  super();
31851
32785
  this.resultCb = resultCb;
@@ -31857,8 +32791,8 @@ var init_session2 = __esm({
31857
32791
  return this.resultCb();
31858
32792
  }
31859
32793
  };
31860
- __publicField(ExecuteResultSync, _a218, "ExecuteResultSync");
31861
- _a219 = entityKind;
32794
+ __publicField(ExecuteResultSync, _a220, "ExecuteResultSync");
32795
+ _a221 = entityKind;
31862
32796
  SQLitePreparedQuery = class {
31863
32797
  constructor(mode, executeMethod, query) {
31864
32798
  /** @internal */
@@ -31899,8 +32833,8 @@ var init_session2 = __esm({
31899
32833
  }
31900
32834
  }
31901
32835
  };
31902
- __publicField(SQLitePreparedQuery, _a219, "PreparedQuery");
31903
- _a220 = entityKind;
32836
+ __publicField(SQLitePreparedQuery, _a221, "PreparedQuery");
32837
+ _a222 = entityKind;
31904
32838
  SQLiteSession = class {
31905
32839
  constructor(dialect4) {
31906
32840
  this.dialect = dialect4;
@@ -31946,8 +32880,8 @@ var init_session2 = __esm({
31946
32880
  throw new Error("Not implemented");
31947
32881
  }
31948
32882
  };
31949
- __publicField(SQLiteSession, _a220, "SQLiteSession");
31950
- SQLiteTransaction = class extends (_b154 = BaseSQLiteDatabase, _a221 = entityKind, _b154) {
32883
+ __publicField(SQLiteSession, _a222, "SQLiteSession");
32884
+ SQLiteTransaction = class extends (_b154 = BaseSQLiteDatabase, _a223 = entityKind, _b154) {
31951
32885
  constructor(resultType, dialect4, session, schema4, nestedIndex = 0) {
31952
32886
  super(resultType, dialect4, session, schema4);
31953
32887
  this.schema = schema4;
@@ -31957,7 +32891,7 @@ var init_session2 = __esm({
31957
32891
  throw new TransactionRollbackError();
31958
32892
  }
31959
32893
  };
31960
- __publicField(SQLiteTransaction, _a221, "SQLiteTransaction");
32894
+ __publicField(SQLiteTransaction, _a223, "SQLiteTransaction");
31961
32895
  }
31962
32896
  });
31963
32897
 
@@ -32026,7 +32960,7 @@ var init_utils6 = __esm({
32026
32960
  });
32027
32961
 
32028
32962
  // ../drizzle-orm/dist/sqlite-core/view.js
32029
- var _a222, ViewBuilderCore, _a223, _b155, ViewBuilder2, _a224, _b156, ManualViewBuilder2, _a225, _b157, SQLiteView2;
32963
+ var _a224, ViewBuilderCore, _a225, _b155, ViewBuilder2, _a226, _b156, ManualViewBuilder2, _a227, _b157, SQLiteView2;
32030
32964
  var init_view2 = __esm({
32031
32965
  "../drizzle-orm/dist/sqlite-core/view.js"() {
32032
32966
  "use strict";
@@ -32036,15 +32970,15 @@ var init_view2 = __esm({
32036
32970
  init_query_builder3();
32037
32971
  init_table3();
32038
32972
  init_view_base2();
32039
- _a222 = entityKind;
32973
+ _a224 = entityKind;
32040
32974
  ViewBuilderCore = class {
32041
32975
  constructor(name2) {
32042
32976
  __publicField(this, "config", {});
32043
32977
  this.name = name2;
32044
32978
  }
32045
32979
  };
32046
- __publicField(ViewBuilderCore, _a222, "SQLiteViewBuilderCore");
32047
- ViewBuilder2 = class extends (_b155 = ViewBuilderCore, _a223 = entityKind, _b155) {
32980
+ __publicField(ViewBuilderCore, _a224, "SQLiteViewBuilderCore");
32981
+ ViewBuilder2 = class extends (_b155 = ViewBuilderCore, _a225 = entityKind, _b155) {
32048
32982
  as(qb) {
32049
32983
  if (typeof qb === "function") {
32050
32984
  qb = qb(new QueryBuilder2());
@@ -32070,8 +33004,8 @@ var init_view2 = __esm({
32070
33004
  );
32071
33005
  }
32072
33006
  };
32073
- __publicField(ViewBuilder2, _a223, "SQLiteViewBuilder");
32074
- ManualViewBuilder2 = class extends (_b156 = ViewBuilderCore, _a224 = entityKind, _b156) {
33007
+ __publicField(ViewBuilder2, _a225, "SQLiteViewBuilder");
33008
+ ManualViewBuilder2 = class extends (_b156 = ViewBuilderCore, _a226 = entityKind, _b156) {
32075
33009
  constructor(name2, columns) {
32076
33010
  super(name2);
32077
33011
  __publicField(this, "columns");
@@ -32114,13 +33048,13 @@ var init_view2 = __esm({
32114
33048
  );
32115
33049
  }
32116
33050
  };
32117
- __publicField(ManualViewBuilder2, _a224, "SQLiteManualViewBuilder");
32118
- SQLiteView2 = class extends (_b157 = SQLiteViewBase, _a225 = entityKind, _b157) {
33051
+ __publicField(ManualViewBuilder2, _a226, "SQLiteManualViewBuilder");
33052
+ SQLiteView2 = class extends (_b157 = SQLiteViewBase, _a227 = entityKind, _b157) {
32119
33053
  constructor({ config }) {
32120
33054
  super(config);
32121
33055
  }
32122
33056
  };
32123
- __publicField(SQLiteView2, _a225, "SQLiteView");
33057
+ __publicField(SQLiteView2, _a227, "SQLiteView");
32124
33058
  }
32125
33059
  });
32126
33060
 
@@ -32819,12 +33753,12 @@ var init_alias4 = __esm({
32819
33753
  });
32820
33754
 
32821
33755
  // ../drizzle-orm/dist/mysql-core/checks.js
32822
- var _a226, CheckBuilder3, _a227, Check3;
33756
+ var _a228, CheckBuilder3, _a229, Check3;
32823
33757
  var init_checks3 = __esm({
32824
33758
  "../drizzle-orm/dist/mysql-core/checks.js"() {
32825
33759
  "use strict";
32826
33760
  init_entity();
32827
- _a226 = entityKind;
33761
+ _a228 = entityKind;
32828
33762
  CheckBuilder3 = class {
32829
33763
  constructor(name2, value) {
32830
33764
  __publicField(this, "brand");
@@ -32836,8 +33770,8 @@ var init_checks3 = __esm({
32836
33770
  return new Check3(table4, this);
32837
33771
  }
32838
33772
  };
32839
- __publicField(CheckBuilder3, _a226, "MySqlCheckBuilder");
32840
- _a227 = entityKind;
33773
+ __publicField(CheckBuilder3, _a228, "MySqlCheckBuilder");
33774
+ _a229 = entityKind;
32841
33775
  Check3 = class {
32842
33776
  constructor(table4, builder) {
32843
33777
  __publicField(this, "name");
@@ -32847,18 +33781,18 @@ var init_checks3 = __esm({
32847
33781
  this.value = builder.value;
32848
33782
  }
32849
33783
  };
32850
- __publicField(Check3, _a227, "MySqlCheck");
33784
+ __publicField(Check3, _a229, "MySqlCheck");
32851
33785
  }
32852
33786
  });
32853
33787
 
32854
33788
  // ../drizzle-orm/dist/mysql-core/foreign-keys.js
32855
- var _a228, ForeignKeyBuilder3, _a229, ForeignKey3;
33789
+ var _a230, ForeignKeyBuilder3, _a231, ForeignKey3;
32856
33790
  var init_foreign_keys3 = __esm({
32857
33791
  "../drizzle-orm/dist/mysql-core/foreign-keys.js"() {
32858
33792
  "use strict";
32859
33793
  init_entity();
32860
33794
  init_table_utils();
32861
- _a228 = entityKind;
33795
+ _a230 = entityKind;
32862
33796
  ForeignKeyBuilder3 = class {
32863
33797
  constructor(config, actions) {
32864
33798
  /** @internal */
@@ -32889,8 +33823,8 @@ var init_foreign_keys3 = __esm({
32889
33823
  return new ForeignKey3(table4, this);
32890
33824
  }
32891
33825
  };
32892
- __publicField(ForeignKeyBuilder3, _a228, "MySqlForeignKeyBuilder");
32893
- _a229 = entityKind;
33826
+ __publicField(ForeignKeyBuilder3, _a230, "MySqlForeignKeyBuilder");
33827
+ _a231 = entityKind;
32894
33828
  ForeignKey3 = class {
32895
33829
  constructor(table4, builder) {
32896
33830
  __publicField(this, "reference");
@@ -32914,7 +33848,7 @@ var init_foreign_keys3 = __esm({
32914
33848
  return name2 ?? `${chunks.join("_")}_fk`;
32915
33849
  }
32916
33850
  };
32917
- __publicField(ForeignKey3, _a229, "MySqlForeignKey");
33851
+ __publicField(ForeignKey3, _a231, "MySqlForeignKey");
32918
33852
  }
32919
33853
  });
32920
33854
 
@@ -32922,13 +33856,13 @@ var init_foreign_keys3 = __esm({
32922
33856
  function uniqueKeyName3(table4, columns) {
32923
33857
  return `${table4[TableName]}_${columns.join("_")}_unique`;
32924
33858
  }
32925
- var _a230, UniqueConstraintBuilder3, _a231, UniqueOnConstraintBuilder3, _a232, UniqueConstraint3;
33859
+ var _a232, UniqueConstraintBuilder3, _a233, UniqueOnConstraintBuilder3, _a234, UniqueConstraint3;
32926
33860
  var init_unique_constraint3 = __esm({
32927
33861
  "../drizzle-orm/dist/mysql-core/unique-constraint.js"() {
32928
33862
  "use strict";
32929
33863
  init_entity();
32930
33864
  init_table_utils();
32931
- _a230 = entityKind;
33865
+ _a232 = entityKind;
32932
33866
  UniqueConstraintBuilder3 = class {
32933
33867
  constructor(columns, name2) {
32934
33868
  /** @internal */
@@ -32941,8 +33875,8 @@ var init_unique_constraint3 = __esm({
32941
33875
  return new UniqueConstraint3(table4, this.columns, this.name);
32942
33876
  }
32943
33877
  };
32944
- __publicField(UniqueConstraintBuilder3, _a230, "MySqlUniqueConstraintBuilder");
32945
- _a231 = entityKind;
33878
+ __publicField(UniqueConstraintBuilder3, _a232, "MySqlUniqueConstraintBuilder");
33879
+ _a233 = entityKind;
32946
33880
  UniqueOnConstraintBuilder3 = class {
32947
33881
  constructor(name2) {
32948
33882
  /** @internal */
@@ -32953,8 +33887,8 @@ var init_unique_constraint3 = __esm({
32953
33887
  return new UniqueConstraintBuilder3(columns, this.name);
32954
33888
  }
32955
33889
  };
32956
- __publicField(UniqueOnConstraintBuilder3, _a231, "MySqlUniqueOnConstraintBuilder");
32957
- _a232 = entityKind;
33890
+ __publicField(UniqueOnConstraintBuilder3, _a233, "MySqlUniqueOnConstraintBuilder");
33891
+ _a234 = entityKind;
32958
33892
  UniqueConstraint3 = class {
32959
33893
  constructor(table4, columns, name2) {
32960
33894
  __publicField(this, "columns");
@@ -32968,12 +33902,12 @@ var init_unique_constraint3 = __esm({
32968
33902
  return this.name;
32969
33903
  }
32970
33904
  };
32971
- __publicField(UniqueConstraint3, _a232, "MySqlUniqueConstraint");
33905
+ __publicField(UniqueConstraint3, _a234, "MySqlUniqueConstraint");
32972
33906
  }
32973
33907
  });
32974
33908
 
32975
33909
  // ../drizzle-orm/dist/mysql-core/columns/common.js
32976
- var _a233, _b158, MySqlColumnBuilder, _a234, _b159, MySqlColumn, _a235, _b160, MySqlColumnBuilderWithAutoIncrement, _a236, _b161, MySqlColumnWithAutoIncrement;
33910
+ var _a235, _b158, MySqlColumnBuilder, _a236, _b159, MySqlColumn, _a237, _b160, MySqlColumnBuilderWithAutoIncrement, _a238, _b161, MySqlColumnWithAutoIncrement;
32977
33911
  var init_common4 = __esm({
32978
33912
  "../drizzle-orm/dist/mysql-core/columns/common.js"() {
32979
33913
  "use strict";
@@ -32982,7 +33916,7 @@ var init_common4 = __esm({
32982
33916
  init_entity();
32983
33917
  init_foreign_keys3();
32984
33918
  init_unique_constraint3();
32985
- MySqlColumnBuilder = class extends (_b158 = ColumnBuilder, _a233 = entityKind, _b158) {
33919
+ MySqlColumnBuilder = class extends (_b158 = ColumnBuilder, _a235 = entityKind, _b158) {
32986
33920
  constructor() {
32987
33921
  super(...arguments);
32988
33922
  __publicField(this, "foreignKeyConfigs", []);
@@ -33023,8 +33957,8 @@ var init_common4 = __esm({
33023
33957
  });
33024
33958
  }
33025
33959
  };
33026
- __publicField(MySqlColumnBuilder, _a233, "MySqlColumnBuilder");
33027
- MySqlColumn = class extends (_b159 = Column2, _a234 = entityKind, _b159) {
33960
+ __publicField(MySqlColumnBuilder, _a235, "MySqlColumnBuilder");
33961
+ MySqlColumn = class extends (_b159 = Column2, _a236 = entityKind, _b159) {
33028
33962
  constructor(table4, config) {
33029
33963
  if (!config.uniqueName) {
33030
33964
  config.uniqueName = uniqueKeyName3(table4, [config.name]);
@@ -33033,8 +33967,8 @@ var init_common4 = __esm({
33033
33967
  this.table = table4;
33034
33968
  }
33035
33969
  };
33036
- __publicField(MySqlColumn, _a234, "MySqlColumn");
33037
- MySqlColumnBuilderWithAutoIncrement = class extends (_b160 = MySqlColumnBuilder, _a235 = entityKind, _b160) {
33970
+ __publicField(MySqlColumn, _a236, "MySqlColumn");
33971
+ MySqlColumnBuilderWithAutoIncrement = class extends (_b160 = MySqlColumnBuilder, _a237 = entityKind, _b160) {
33038
33972
  constructor(name2, dataType, columnType) {
33039
33973
  super(name2, dataType, columnType);
33040
33974
  this.config.autoIncrement = false;
@@ -33045,14 +33979,14 @@ var init_common4 = __esm({
33045
33979
  return this;
33046
33980
  }
33047
33981
  };
33048
- __publicField(MySqlColumnBuilderWithAutoIncrement, _a235, "MySqlColumnBuilderWithAutoIncrement");
33049
- MySqlColumnWithAutoIncrement = class extends (_b161 = MySqlColumn, _a236 = entityKind, _b161) {
33982
+ __publicField(MySqlColumnBuilderWithAutoIncrement, _a237, "MySqlColumnBuilderWithAutoIncrement");
33983
+ MySqlColumnWithAutoIncrement = class extends (_b161 = MySqlColumn, _a238 = entityKind, _b161) {
33050
33984
  constructor() {
33051
33985
  super(...arguments);
33052
33986
  __publicField(this, "autoIncrement", this.config.autoIncrement);
33053
33987
  }
33054
33988
  };
33055
- __publicField(MySqlColumnWithAutoIncrement, _a236, "MySqlColumnWithAutoIncrement");
33989
+ __publicField(MySqlColumnWithAutoIncrement, _a238, "MySqlColumnWithAutoIncrement");
33056
33990
  }
33057
33991
  });
33058
33992
 
@@ -33064,14 +33998,14 @@ function bigint2(a, b) {
33064
33998
  }
33065
33999
  return new MySqlBigInt64Builder(name2, config.unsigned);
33066
34000
  }
33067
- var _a237, _b162, MySqlBigInt53Builder, _a238, _b163, MySqlBigInt53, _a239, _b164, MySqlBigInt64Builder, _a240, _b165, MySqlBigInt64;
34001
+ var _a239, _b162, MySqlBigInt53Builder, _a240, _b163, MySqlBigInt53, _a241, _b164, MySqlBigInt64Builder, _a242, _b165, MySqlBigInt64;
33068
34002
  var init_bigint2 = __esm({
33069
34003
  "../drizzle-orm/dist/mysql-core/columns/bigint.js"() {
33070
34004
  "use strict";
33071
34005
  init_entity();
33072
34006
  init_utils2();
33073
34007
  init_common4();
33074
- MySqlBigInt53Builder = class extends (_b162 = MySqlColumnBuilderWithAutoIncrement, _a237 = entityKind, _b162) {
34008
+ MySqlBigInt53Builder = class extends (_b162 = MySqlColumnBuilderWithAutoIncrement, _a239 = entityKind, _b162) {
33075
34009
  constructor(name2, unsigned = false) {
33076
34010
  super(name2, "number", "MySqlBigInt53");
33077
34011
  this.config.unsigned = unsigned;
@@ -33084,8 +34018,8 @@ var init_bigint2 = __esm({
33084
34018
  );
33085
34019
  }
33086
34020
  };
33087
- __publicField(MySqlBigInt53Builder, _a237, "MySqlBigInt53Builder");
33088
- MySqlBigInt53 = class extends (_b163 = MySqlColumnWithAutoIncrement, _a238 = entityKind, _b163) {
34021
+ __publicField(MySqlBigInt53Builder, _a239, "MySqlBigInt53Builder");
34022
+ MySqlBigInt53 = class extends (_b163 = MySqlColumnWithAutoIncrement, _a240 = entityKind, _b163) {
33089
34023
  getSQLType() {
33090
34024
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
33091
34025
  }
@@ -33096,8 +34030,8 @@ var init_bigint2 = __esm({
33096
34030
  return Number(value);
33097
34031
  }
33098
34032
  };
33099
- __publicField(MySqlBigInt53, _a238, "MySqlBigInt53");
33100
- MySqlBigInt64Builder = class extends (_b164 = MySqlColumnBuilderWithAutoIncrement, _a239 = entityKind, _b164) {
34033
+ __publicField(MySqlBigInt53, _a240, "MySqlBigInt53");
34034
+ MySqlBigInt64Builder = class extends (_b164 = MySqlColumnBuilderWithAutoIncrement, _a241 = entityKind, _b164) {
33101
34035
  constructor(name2, unsigned = false) {
33102
34036
  super(name2, "bigint", "MySqlBigInt64");
33103
34037
  this.config.unsigned = unsigned;
@@ -33110,8 +34044,8 @@ var init_bigint2 = __esm({
33110
34044
  );
33111
34045
  }
33112
34046
  };
33113
- __publicField(MySqlBigInt64Builder, _a239, "MySqlBigInt64Builder");
33114
- MySqlBigInt64 = class extends (_b165 = MySqlColumnWithAutoIncrement, _a240 = entityKind, _b165) {
34047
+ __publicField(MySqlBigInt64Builder, _a241, "MySqlBigInt64Builder");
34048
+ MySqlBigInt64 = class extends (_b165 = MySqlColumnWithAutoIncrement, _a242 = entityKind, _b165) {
33115
34049
  getSQLType() {
33116
34050
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
33117
34051
  }
@@ -33120,7 +34054,7 @@ var init_bigint2 = __esm({
33120
34054
  return BigInt(value);
33121
34055
  }
33122
34056
  };
33123
- __publicField(MySqlBigInt64, _a240, "MySqlBigInt64");
34057
+ __publicField(MySqlBigInt64, _a242, "MySqlBigInt64");
33124
34058
  }
33125
34059
  });
33126
34060
 
@@ -33129,14 +34063,14 @@ function binary(a, b = {}) {
33129
34063
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33130
34064
  return new MySqlBinaryBuilder(name2, config.length);
33131
34065
  }
33132
- var _a241, _b166, MySqlBinaryBuilder, _a242, _b167, MySqlBinary;
34066
+ var _a243, _b166, MySqlBinaryBuilder, _a244, _b167, MySqlBinary;
33133
34067
  var init_binary = __esm({
33134
34068
  "../drizzle-orm/dist/mysql-core/columns/binary.js"() {
33135
34069
  "use strict";
33136
34070
  init_entity();
33137
34071
  init_utils2();
33138
34072
  init_common4();
33139
- MySqlBinaryBuilder = class extends (_b166 = MySqlColumnBuilder, _a241 = entityKind, _b166) {
34073
+ MySqlBinaryBuilder = class extends (_b166 = MySqlColumnBuilder, _a243 = entityKind, _b166) {
33140
34074
  constructor(name2, length) {
33141
34075
  super(name2, "string", "MySqlBinary");
33142
34076
  this.config.length = length;
@@ -33146,8 +34080,8 @@ var init_binary = __esm({
33146
34080
  return new MySqlBinary(table4, this.config);
33147
34081
  }
33148
34082
  };
33149
- __publicField(MySqlBinaryBuilder, _a241, "MySqlBinaryBuilder");
33150
- MySqlBinary = class extends (_b167 = MySqlColumn, _a242 = entityKind, _b167) {
34083
+ __publicField(MySqlBinaryBuilder, _a243, "MySqlBinaryBuilder");
34084
+ MySqlBinary = class extends (_b167 = MySqlColumn, _a244 = entityKind, _b167) {
33151
34085
  constructor() {
33152
34086
  super(...arguments);
33153
34087
  __publicField(this, "length", this.config.length);
@@ -33156,7 +34090,7 @@ var init_binary = __esm({
33156
34090
  return this.length === void 0 ? `binary` : `binary(${this.length})`;
33157
34091
  }
33158
34092
  };
33159
- __publicField(MySqlBinary, _a242, "MySqlBinary");
34093
+ __publicField(MySqlBinary, _a244, "MySqlBinary");
33160
34094
  }
33161
34095
  });
33162
34096
 
@@ -33164,13 +34098,13 @@ var init_binary = __esm({
33164
34098
  function boolean2(name2) {
33165
34099
  return new MySqlBooleanBuilder(name2 ?? "");
33166
34100
  }
33167
- var _a243, _b168, MySqlBooleanBuilder, _a244, _b169, MySqlBoolean;
34101
+ var _a245, _b168, MySqlBooleanBuilder, _a246, _b169, MySqlBoolean;
33168
34102
  var init_boolean2 = __esm({
33169
34103
  "../drizzle-orm/dist/mysql-core/columns/boolean.js"() {
33170
34104
  "use strict";
33171
34105
  init_entity();
33172
34106
  init_common4();
33173
- MySqlBooleanBuilder = class extends (_b168 = MySqlColumnBuilder, _a243 = entityKind, _b168) {
34107
+ MySqlBooleanBuilder = class extends (_b168 = MySqlColumnBuilder, _a245 = entityKind, _b168) {
33174
34108
  constructor(name2) {
33175
34109
  super(name2, "boolean", "MySqlBoolean");
33176
34110
  }
@@ -33182,8 +34116,8 @@ var init_boolean2 = __esm({
33182
34116
  );
33183
34117
  }
33184
34118
  };
33185
- __publicField(MySqlBooleanBuilder, _a243, "MySqlBooleanBuilder");
33186
- MySqlBoolean = class extends (_b169 = MySqlColumn, _a244 = entityKind, _b169) {
34119
+ __publicField(MySqlBooleanBuilder, _a245, "MySqlBooleanBuilder");
34120
+ MySqlBoolean = class extends (_b169 = MySqlColumn, _a246 = entityKind, _b169) {
33187
34121
  getSQLType() {
33188
34122
  return "boolean";
33189
34123
  }
@@ -33194,7 +34128,7 @@ var init_boolean2 = __esm({
33194
34128
  return value === 1;
33195
34129
  }
33196
34130
  };
33197
- __publicField(MySqlBoolean, _a244, "MySqlBoolean");
34131
+ __publicField(MySqlBoolean, _a246, "MySqlBoolean");
33198
34132
  }
33199
34133
  });
33200
34134
 
@@ -33203,14 +34137,14 @@ function char2(a, b = {}) {
33203
34137
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33204
34138
  return new MySqlCharBuilder(name2, config);
33205
34139
  }
33206
- var _a245, _b170, MySqlCharBuilder, _a246, _b171, MySqlChar;
34140
+ var _a247, _b170, MySqlCharBuilder, _a248, _b171, MySqlChar;
33207
34141
  var init_char2 = __esm({
33208
34142
  "../drizzle-orm/dist/mysql-core/columns/char.js"() {
33209
34143
  "use strict";
33210
34144
  init_entity();
33211
34145
  init_utils2();
33212
34146
  init_common4();
33213
- MySqlCharBuilder = class extends (_b170 = MySqlColumnBuilder, _a245 = entityKind, _b170) {
34147
+ MySqlCharBuilder = class extends (_b170 = MySqlColumnBuilder, _a247 = entityKind, _b170) {
33214
34148
  constructor(name2, config) {
33215
34149
  super(name2, "string", "MySqlChar");
33216
34150
  this.config.length = config.length;
@@ -33224,8 +34158,8 @@ var init_char2 = __esm({
33224
34158
  );
33225
34159
  }
33226
34160
  };
33227
- __publicField(MySqlCharBuilder, _a245, "MySqlCharBuilder");
33228
- MySqlChar = class extends (_b171 = MySqlColumn, _a246 = entityKind, _b171) {
34161
+ __publicField(MySqlCharBuilder, _a247, "MySqlCharBuilder");
34162
+ MySqlChar = class extends (_b171 = MySqlColumn, _a248 = entityKind, _b171) {
33229
34163
  constructor() {
33230
34164
  super(...arguments);
33231
34165
  __publicField(this, "length", this.config.length);
@@ -33235,7 +34169,7 @@ var init_char2 = __esm({
33235
34169
  return this.length === void 0 ? `char` : `char(${this.length})`;
33236
34170
  }
33237
34171
  };
33238
- __publicField(MySqlChar, _a246, "MySqlChar");
34172
+ __publicField(MySqlChar, _a248, "MySqlChar");
33239
34173
  }
33240
34174
  });
33241
34175
 
@@ -33246,14 +34180,14 @@ function customType3(customTypeParams) {
33246
34180
  return new MySqlCustomColumnBuilder(name2, config, customTypeParams);
33247
34181
  };
33248
34182
  }
33249
- var _a247, _b172, MySqlCustomColumnBuilder, _a248, _b173, MySqlCustomColumn;
34183
+ var _a249, _b172, MySqlCustomColumnBuilder, _a250, _b173, MySqlCustomColumn;
33250
34184
  var init_custom3 = __esm({
33251
34185
  "../drizzle-orm/dist/mysql-core/columns/custom.js"() {
33252
34186
  "use strict";
33253
34187
  init_entity();
33254
34188
  init_utils2();
33255
34189
  init_common4();
33256
- MySqlCustomColumnBuilder = class extends (_b172 = MySqlColumnBuilder, _a247 = entityKind, _b172) {
34190
+ MySqlCustomColumnBuilder = class extends (_b172 = MySqlColumnBuilder, _a249 = entityKind, _b172) {
33257
34191
  constructor(name2, fieldConfig, customTypeParams) {
33258
34192
  super(name2, "custom", "MySqlCustomColumn");
33259
34193
  this.config.fieldConfig = fieldConfig;
@@ -33267,8 +34201,8 @@ var init_custom3 = __esm({
33267
34201
  );
33268
34202
  }
33269
34203
  };
33270
- __publicField(MySqlCustomColumnBuilder, _a247, "MySqlCustomColumnBuilder");
33271
- MySqlCustomColumn = class extends (_b173 = MySqlColumn, _a248 = entityKind, _b173) {
34204
+ __publicField(MySqlCustomColumnBuilder, _a249, "MySqlCustomColumnBuilder");
34205
+ MySqlCustomColumn = class extends (_b173 = MySqlColumn, _a250 = entityKind, _b173) {
33272
34206
  constructor(table4, config) {
33273
34207
  super(table4, config);
33274
34208
  __publicField(this, "sqlName");
@@ -33288,7 +34222,7 @@ var init_custom3 = __esm({
33288
34222
  return typeof this.mapTo === "function" ? this.mapTo(value) : value;
33289
34223
  }
33290
34224
  };
33291
- __publicField(MySqlCustomColumn, _a248, "MySqlCustomColumn");
34225
+ __publicField(MySqlCustomColumn, _a250, "MySqlCustomColumn");
33292
34226
  }
33293
34227
  });
33294
34228
 
@@ -33300,14 +34234,14 @@ function date2(a, b) {
33300
34234
  }
33301
34235
  return new MySqlDateBuilder(name2);
33302
34236
  }
33303
- var _a249, _b174, MySqlDateBuilder, _a250, _b175, MySqlDate, _a251, _b176, MySqlDateStringBuilder, _a252, _b177, MySqlDateString;
34237
+ var _a251, _b174, MySqlDateBuilder, _a252, _b175, MySqlDate, _a253, _b176, MySqlDateStringBuilder, _a254, _b177, MySqlDateString;
33304
34238
  var init_date2 = __esm({
33305
34239
  "../drizzle-orm/dist/mysql-core/columns/date.js"() {
33306
34240
  "use strict";
33307
34241
  init_entity();
33308
34242
  init_utils2();
33309
34243
  init_common4();
33310
- MySqlDateBuilder = class extends (_b174 = MySqlColumnBuilder, _a249 = entityKind, _b174) {
34244
+ MySqlDateBuilder = class extends (_b174 = MySqlColumnBuilder, _a251 = entityKind, _b174) {
33311
34245
  constructor(name2) {
33312
34246
  super(name2, "date", "MySqlDate");
33313
34247
  }
@@ -33316,8 +34250,8 @@ var init_date2 = __esm({
33316
34250
  return new MySqlDate(table4, this.config);
33317
34251
  }
33318
34252
  };
33319
- __publicField(MySqlDateBuilder, _a249, "MySqlDateBuilder");
33320
- MySqlDate = class extends (_b175 = MySqlColumn, _a250 = entityKind, _b175) {
34253
+ __publicField(MySqlDateBuilder, _a251, "MySqlDateBuilder");
34254
+ MySqlDate = class extends (_b175 = MySqlColumn, _a252 = entityKind, _b175) {
33321
34255
  constructor(table4, config) {
33322
34256
  super(table4, config);
33323
34257
  }
@@ -33328,8 +34262,8 @@ var init_date2 = __esm({
33328
34262
  return new Date(value);
33329
34263
  }
33330
34264
  };
33331
- __publicField(MySqlDate, _a250, "MySqlDate");
33332
- MySqlDateStringBuilder = class extends (_b176 = MySqlColumnBuilder, _a251 = entityKind, _b176) {
34265
+ __publicField(MySqlDate, _a252, "MySqlDate");
34266
+ MySqlDateStringBuilder = class extends (_b176 = MySqlColumnBuilder, _a253 = entityKind, _b176) {
33333
34267
  constructor(name2) {
33334
34268
  super(name2, "string", "MySqlDateString");
33335
34269
  }
@@ -33341,8 +34275,8 @@ var init_date2 = __esm({
33341
34275
  );
33342
34276
  }
33343
34277
  };
33344
- __publicField(MySqlDateStringBuilder, _a251, "MySqlDateStringBuilder");
33345
- MySqlDateString = class extends (_b177 = MySqlColumn, _a252 = entityKind, _b177) {
34278
+ __publicField(MySqlDateStringBuilder, _a253, "MySqlDateStringBuilder");
34279
+ MySqlDateString = class extends (_b177 = MySqlColumn, _a254 = entityKind, _b177) {
33346
34280
  constructor(table4, config) {
33347
34281
  super(table4, config);
33348
34282
  }
@@ -33350,7 +34284,7 @@ var init_date2 = __esm({
33350
34284
  return `date`;
33351
34285
  }
33352
34286
  };
33353
- __publicField(MySqlDateString, _a252, "MySqlDateString");
34287
+ __publicField(MySqlDateString, _a254, "MySqlDateString");
33354
34288
  }
33355
34289
  });
33356
34290
 
@@ -33362,14 +34296,14 @@ function datetime(a, b) {
33362
34296
  }
33363
34297
  return new MySqlDateTimeBuilder(name2, config);
33364
34298
  }
33365
- var _a253, _b178, MySqlDateTimeBuilder, _a254, _b179, MySqlDateTime, _a255, _b180, MySqlDateTimeStringBuilder, _a256, _b181, MySqlDateTimeString;
34299
+ var _a255, _b178, MySqlDateTimeBuilder, _a256, _b179, MySqlDateTime, _a257, _b180, MySqlDateTimeStringBuilder, _a258, _b181, MySqlDateTimeString;
33366
34300
  var init_datetime = __esm({
33367
34301
  "../drizzle-orm/dist/mysql-core/columns/datetime.js"() {
33368
34302
  "use strict";
33369
34303
  init_entity();
33370
34304
  init_utils2();
33371
34305
  init_common4();
33372
- MySqlDateTimeBuilder = class extends (_b178 = MySqlColumnBuilder, _a253 = entityKind, _b178) {
34306
+ MySqlDateTimeBuilder = class extends (_b178 = MySqlColumnBuilder, _a255 = entityKind, _b178) {
33373
34307
  constructor(name2, config) {
33374
34308
  super(name2, "date", "MySqlDateTime");
33375
34309
  this.config.fsp = config?.fsp;
@@ -33382,8 +34316,8 @@ var init_datetime = __esm({
33382
34316
  );
33383
34317
  }
33384
34318
  };
33385
- __publicField(MySqlDateTimeBuilder, _a253, "MySqlDateTimeBuilder");
33386
- MySqlDateTime = class extends (_b179 = MySqlColumn, _a254 = entityKind, _b179) {
34319
+ __publicField(MySqlDateTimeBuilder, _a255, "MySqlDateTimeBuilder");
34320
+ MySqlDateTime = class extends (_b179 = MySqlColumn, _a256 = entityKind, _b179) {
33387
34321
  constructor(table4, config) {
33388
34322
  super(table4, config);
33389
34323
  __publicField(this, "fsp");
@@ -33400,8 +34334,8 @@ var init_datetime = __esm({
33400
34334
  return /* @__PURE__ */ new Date(value.replace(" ", "T") + "Z");
33401
34335
  }
33402
34336
  };
33403
- __publicField(MySqlDateTime, _a254, "MySqlDateTime");
33404
- MySqlDateTimeStringBuilder = class extends (_b180 = MySqlColumnBuilder, _a255 = entityKind, _b180) {
34337
+ __publicField(MySqlDateTime, _a256, "MySqlDateTime");
34338
+ MySqlDateTimeStringBuilder = class extends (_b180 = MySqlColumnBuilder, _a257 = entityKind, _b180) {
33405
34339
  constructor(name2, config) {
33406
34340
  super(name2, "string", "MySqlDateTimeString");
33407
34341
  this.config.fsp = config?.fsp;
@@ -33414,8 +34348,8 @@ var init_datetime = __esm({
33414
34348
  );
33415
34349
  }
33416
34350
  };
33417
- __publicField(MySqlDateTimeStringBuilder, _a255, "MySqlDateTimeStringBuilder");
33418
- MySqlDateTimeString = class extends (_b181 = MySqlColumn, _a256 = entityKind, _b181) {
34351
+ __publicField(MySqlDateTimeStringBuilder, _a257, "MySqlDateTimeStringBuilder");
34352
+ MySqlDateTimeString = class extends (_b181 = MySqlColumn, _a258 = entityKind, _b181) {
33419
34353
  constructor(table4, config) {
33420
34354
  super(table4, config);
33421
34355
  __publicField(this, "fsp");
@@ -33426,7 +34360,7 @@ var init_datetime = __esm({
33426
34360
  return `datetime${precision}`;
33427
34361
  }
33428
34362
  };
33429
- __publicField(MySqlDateTimeString, _a256, "MySqlDateTimeString");
34363
+ __publicField(MySqlDateTimeString, _a258, "MySqlDateTimeString");
33430
34364
  }
33431
34365
  });
33432
34366
 
@@ -33435,14 +34369,14 @@ function decimal(a, b = {}) {
33435
34369
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33436
34370
  return new MySqlDecimalBuilder(name2, config.precision, config.scale);
33437
34371
  }
33438
- var _a257, _b182, MySqlDecimalBuilder, _a258, _b183, MySqlDecimal;
34372
+ var _a259, _b182, MySqlDecimalBuilder, _a260, _b183, MySqlDecimal;
33439
34373
  var init_decimal = __esm({
33440
34374
  "../drizzle-orm/dist/mysql-core/columns/decimal.js"() {
33441
34375
  "use strict";
33442
34376
  init_entity();
33443
34377
  init_utils2();
33444
34378
  init_common4();
33445
- MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a257 = entityKind, _b182) {
34379
+ MySqlDecimalBuilder = class extends (_b182 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b182) {
33446
34380
  constructor(name2, precision, scale) {
33447
34381
  super(name2, "string", "MySqlDecimal");
33448
34382
  this.config.precision = precision;
@@ -33456,8 +34390,8 @@ var init_decimal = __esm({
33456
34390
  );
33457
34391
  }
33458
34392
  };
33459
- __publicField(MySqlDecimalBuilder, _a257, "MySqlDecimalBuilder");
33460
- MySqlDecimal = class extends (_b183 = MySqlColumnWithAutoIncrement, _a258 = entityKind, _b183) {
34393
+ __publicField(MySqlDecimalBuilder, _a259, "MySqlDecimalBuilder");
34394
+ MySqlDecimal = class extends (_b183 = MySqlColumnWithAutoIncrement, _a260 = entityKind, _b183) {
33461
34395
  constructor() {
33462
34396
  super(...arguments);
33463
34397
  __publicField(this, "precision", this.config.precision);
@@ -33473,7 +34407,7 @@ var init_decimal = __esm({
33473
34407
  }
33474
34408
  }
33475
34409
  };
33476
- __publicField(MySqlDecimal, _a258, "MySqlDecimal");
34410
+ __publicField(MySqlDecimal, _a260, "MySqlDecimal");
33477
34411
  }
33478
34412
  });
33479
34413
 
@@ -33482,14 +34416,14 @@ function double(a, b) {
33482
34416
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33483
34417
  return new MySqlDoubleBuilder(name2, config);
33484
34418
  }
33485
- var _a259, _b184, MySqlDoubleBuilder, _a260, _b185, MySqlDouble;
34419
+ var _a261, _b184, MySqlDoubleBuilder, _a262, _b185, MySqlDouble;
33486
34420
  var init_double = __esm({
33487
34421
  "../drizzle-orm/dist/mysql-core/columns/double.js"() {
33488
34422
  "use strict";
33489
34423
  init_entity();
33490
34424
  init_utils2();
33491
34425
  init_common4();
33492
- MySqlDoubleBuilder = class extends (_b184 = MySqlColumnBuilderWithAutoIncrement, _a259 = entityKind, _b184) {
34426
+ MySqlDoubleBuilder = class extends (_b184 = MySqlColumnBuilderWithAutoIncrement, _a261 = entityKind, _b184) {
33493
34427
  constructor(name2, config) {
33494
34428
  super(name2, "number", "MySqlDouble");
33495
34429
  this.config.precision = config?.precision;
@@ -33500,8 +34434,8 @@ var init_double = __esm({
33500
34434
  return new MySqlDouble(table4, this.config);
33501
34435
  }
33502
34436
  };
33503
- __publicField(MySqlDoubleBuilder, _a259, "MySqlDoubleBuilder");
33504
- MySqlDouble = class extends (_b185 = MySqlColumnWithAutoIncrement, _a260 = entityKind, _b185) {
34437
+ __publicField(MySqlDoubleBuilder, _a261, "MySqlDoubleBuilder");
34438
+ MySqlDouble = class extends (_b185 = MySqlColumnWithAutoIncrement, _a262 = entityKind, _b185) {
33505
34439
  constructor() {
33506
34440
  super(...arguments);
33507
34441
  __publicField(this, "precision", this.config.precision);
@@ -33517,7 +34451,7 @@ var init_double = __esm({
33517
34451
  }
33518
34452
  }
33519
34453
  };
33520
- __publicField(MySqlDouble, _a260, "MySqlDouble");
34454
+ __publicField(MySqlDouble, _a262, "MySqlDouble");
33521
34455
  }
33522
34456
  });
33523
34457
 
@@ -33529,14 +34463,14 @@ function mysqlEnum(a, b) {
33529
34463
  }
33530
34464
  return new MySqlEnumColumnBuilder(name2, values);
33531
34465
  }
33532
- var _a261, _b186, MySqlEnumColumnBuilder, _a262, _b187, MySqlEnumColumn;
34466
+ var _a263, _b186, MySqlEnumColumnBuilder, _a264, _b187, MySqlEnumColumn;
33533
34467
  var init_enum2 = __esm({
33534
34468
  "../drizzle-orm/dist/mysql-core/columns/enum.js"() {
33535
34469
  "use strict";
33536
34470
  init_entity();
33537
34471
  init_utils2();
33538
34472
  init_common4();
33539
- MySqlEnumColumnBuilder = class extends (_b186 = MySqlColumnBuilder, _a261 = entityKind, _b186) {
34473
+ MySqlEnumColumnBuilder = class extends (_b186 = MySqlColumnBuilder, _a263 = entityKind, _b186) {
33540
34474
  constructor(name2, values) {
33541
34475
  super(name2, "string", "MySqlEnumColumn");
33542
34476
  this.config.enumValues = values;
@@ -33549,8 +34483,8 @@ var init_enum2 = __esm({
33549
34483
  );
33550
34484
  }
33551
34485
  };
33552
- __publicField(MySqlEnumColumnBuilder, _a261, "MySqlEnumColumnBuilder");
33553
- MySqlEnumColumn = class extends (_b187 = MySqlColumn, _a262 = entityKind, _b187) {
34486
+ __publicField(MySqlEnumColumnBuilder, _a263, "MySqlEnumColumnBuilder");
34487
+ MySqlEnumColumn = class extends (_b187 = MySqlColumn, _a264 = entityKind, _b187) {
33554
34488
  constructor() {
33555
34489
  super(...arguments);
33556
34490
  __publicField(this, "enumValues", this.config.enumValues);
@@ -33559,7 +34493,7 @@ var init_enum2 = __esm({
33559
34493
  return `enum(${this.enumValues.map((value) => `'${value}'`).join(",")})`;
33560
34494
  }
33561
34495
  };
33562
- __publicField(MySqlEnumColumn, _a262, "MySqlEnumColumn");
34496
+ __publicField(MySqlEnumColumn, _a264, "MySqlEnumColumn");
33563
34497
  }
33564
34498
  });
33565
34499
 
@@ -33567,13 +34501,13 @@ var init_enum2 = __esm({
33567
34501
  function float(name2) {
33568
34502
  return new MySqlFloatBuilder(name2 ?? "");
33569
34503
  }
33570
- var _a263, _b188, MySqlFloatBuilder, _a264, _b189, MySqlFloat;
34504
+ var _a265, _b188, MySqlFloatBuilder, _a266, _b189, MySqlFloat;
33571
34505
  var init_float = __esm({
33572
34506
  "../drizzle-orm/dist/mysql-core/columns/float.js"() {
33573
34507
  "use strict";
33574
34508
  init_entity();
33575
34509
  init_common4();
33576
- MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a263 = entityKind, _b188) {
34510
+ MySqlFloatBuilder = class extends (_b188 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b188) {
33577
34511
  constructor(name2) {
33578
34512
  super(name2, "number", "MySqlFloat");
33579
34513
  }
@@ -33582,13 +34516,13 @@ var init_float = __esm({
33582
34516
  return new MySqlFloat(table4, this.config);
33583
34517
  }
33584
34518
  };
33585
- __publicField(MySqlFloatBuilder, _a263, "MySqlFloatBuilder");
33586
- MySqlFloat = class extends (_b189 = MySqlColumnWithAutoIncrement, _a264 = entityKind, _b189) {
34519
+ __publicField(MySqlFloatBuilder, _a265, "MySqlFloatBuilder");
34520
+ MySqlFloat = class extends (_b189 = MySqlColumnWithAutoIncrement, _a266 = entityKind, _b189) {
33587
34521
  getSQLType() {
33588
34522
  return "float";
33589
34523
  }
33590
34524
  };
33591
- __publicField(MySqlFloat, _a264, "MySqlFloat");
34525
+ __publicField(MySqlFloat, _a266, "MySqlFloat");
33592
34526
  }
33593
34527
  });
33594
34528
 
@@ -33597,14 +34531,14 @@ function int(a, b) {
33597
34531
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33598
34532
  return new MySqlIntBuilder(name2, config);
33599
34533
  }
33600
- var _a265, _b190, MySqlIntBuilder, _a266, _b191, MySqlInt;
34534
+ var _a267, _b190, MySqlIntBuilder, _a268, _b191, MySqlInt;
33601
34535
  var init_int = __esm({
33602
34536
  "../drizzle-orm/dist/mysql-core/columns/int.js"() {
33603
34537
  "use strict";
33604
34538
  init_entity();
33605
34539
  init_utils2();
33606
34540
  init_common4();
33607
- MySqlIntBuilder = class extends (_b190 = MySqlColumnBuilderWithAutoIncrement, _a265 = entityKind, _b190) {
34541
+ MySqlIntBuilder = class extends (_b190 = MySqlColumnBuilderWithAutoIncrement, _a267 = entityKind, _b190) {
33608
34542
  constructor(name2, config) {
33609
34543
  super(name2, "number", "MySqlInt");
33610
34544
  this.config.unsigned = config ? config.unsigned : false;
@@ -33614,8 +34548,8 @@ var init_int = __esm({
33614
34548
  return new MySqlInt(table4, this.config);
33615
34549
  }
33616
34550
  };
33617
- __publicField(MySqlIntBuilder, _a265, "MySqlIntBuilder");
33618
- MySqlInt = class extends (_b191 = MySqlColumnWithAutoIncrement, _a266 = entityKind, _b191) {
34551
+ __publicField(MySqlIntBuilder, _a267, "MySqlIntBuilder");
34552
+ MySqlInt = class extends (_b191 = MySqlColumnWithAutoIncrement, _a268 = entityKind, _b191) {
33619
34553
  getSQLType() {
33620
34554
  return `int${this.config.unsigned ? " unsigned" : ""}`;
33621
34555
  }
@@ -33626,7 +34560,7 @@ var init_int = __esm({
33626
34560
  return value;
33627
34561
  }
33628
34562
  };
33629
- __publicField(MySqlInt, _a266, "MySqlInt");
34563
+ __publicField(MySqlInt, _a268, "MySqlInt");
33630
34564
  }
33631
34565
  });
33632
34566
 
@@ -33634,13 +34568,13 @@ var init_int = __esm({
33634
34568
  function json2(name2) {
33635
34569
  return new MySqlJsonBuilder(name2 ?? "");
33636
34570
  }
33637
- var _a267, _b192, MySqlJsonBuilder, _a268, _b193, MySqlJson;
34571
+ var _a269, _b192, MySqlJsonBuilder, _a270, _b193, MySqlJson;
33638
34572
  var init_json2 = __esm({
33639
34573
  "../drizzle-orm/dist/mysql-core/columns/json.js"() {
33640
34574
  "use strict";
33641
34575
  init_entity();
33642
34576
  init_common4();
33643
- MySqlJsonBuilder = class extends (_b192 = MySqlColumnBuilder, _a267 = entityKind, _b192) {
34577
+ MySqlJsonBuilder = class extends (_b192 = MySqlColumnBuilder, _a269 = entityKind, _b192) {
33644
34578
  constructor(name2) {
33645
34579
  super(name2, "json", "MySqlJson");
33646
34580
  }
@@ -33649,8 +34583,8 @@ var init_json2 = __esm({
33649
34583
  return new MySqlJson(table4, this.config);
33650
34584
  }
33651
34585
  };
33652
- __publicField(MySqlJsonBuilder, _a267, "MySqlJsonBuilder");
33653
- MySqlJson = class extends (_b193 = MySqlColumn, _a268 = entityKind, _b193) {
34586
+ __publicField(MySqlJsonBuilder, _a269, "MySqlJsonBuilder");
34587
+ MySqlJson = class extends (_b193 = MySqlColumn, _a270 = entityKind, _b193) {
33654
34588
  getSQLType() {
33655
34589
  return "json";
33656
34590
  }
@@ -33658,7 +34592,7 @@ var init_json2 = __esm({
33658
34592
  return JSON.stringify(value);
33659
34593
  }
33660
34594
  };
33661
- __publicField(MySqlJson, _a268, "MySqlJson");
34595
+ __publicField(MySqlJson, _a270, "MySqlJson");
33662
34596
  }
33663
34597
  });
33664
34598
 
@@ -33667,14 +34601,14 @@ function mediumint(a, b) {
33667
34601
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33668
34602
  return new MySqlMediumIntBuilder(name2, config);
33669
34603
  }
33670
- var _a269, _b194, MySqlMediumIntBuilder, _a270, _b195, MySqlMediumInt;
34604
+ var _a271, _b194, MySqlMediumIntBuilder, _a272, _b195, MySqlMediumInt;
33671
34605
  var init_mediumint = __esm({
33672
34606
  "../drizzle-orm/dist/mysql-core/columns/mediumint.js"() {
33673
34607
  "use strict";
33674
34608
  init_entity();
33675
34609
  init_utils2();
33676
34610
  init_common4();
33677
- MySqlMediumIntBuilder = class extends (_b194 = MySqlColumnBuilderWithAutoIncrement, _a269 = entityKind, _b194) {
34611
+ MySqlMediumIntBuilder = class extends (_b194 = MySqlColumnBuilderWithAutoIncrement, _a271 = entityKind, _b194) {
33678
34612
  constructor(name2, config) {
33679
34613
  super(name2, "number", "MySqlMediumInt");
33680
34614
  this.config.unsigned = config ? config.unsigned : false;
@@ -33687,8 +34621,8 @@ var init_mediumint = __esm({
33687
34621
  );
33688
34622
  }
33689
34623
  };
33690
- __publicField(MySqlMediumIntBuilder, _a269, "MySqlMediumIntBuilder");
33691
- MySqlMediumInt = class extends (_b195 = MySqlColumnWithAutoIncrement, _a270 = entityKind, _b195) {
34624
+ __publicField(MySqlMediumIntBuilder, _a271, "MySqlMediumIntBuilder");
34625
+ MySqlMediumInt = class extends (_b195 = MySqlColumnWithAutoIncrement, _a272 = entityKind, _b195) {
33692
34626
  getSQLType() {
33693
34627
  return `mediumint${this.config.unsigned ? " unsigned" : ""}`;
33694
34628
  }
@@ -33699,7 +34633,7 @@ var init_mediumint = __esm({
33699
34633
  return value;
33700
34634
  }
33701
34635
  };
33702
- __publicField(MySqlMediumInt, _a270, "MySqlMediumInt");
34636
+ __publicField(MySqlMediumInt, _a272, "MySqlMediumInt");
33703
34637
  }
33704
34638
  });
33705
34639
 
@@ -33708,14 +34642,14 @@ function real3(a, b = {}) {
33708
34642
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33709
34643
  return new MySqlRealBuilder(name2, config);
33710
34644
  }
33711
- var _a271, _b196, MySqlRealBuilder, _a272, _b197, MySqlReal;
34645
+ var _a273, _b196, MySqlRealBuilder, _a274, _b197, MySqlReal;
33712
34646
  var init_real3 = __esm({
33713
34647
  "../drizzle-orm/dist/mysql-core/columns/real.js"() {
33714
34648
  "use strict";
33715
34649
  init_entity();
33716
34650
  init_utils2();
33717
34651
  init_common4();
33718
- MySqlRealBuilder = class extends (_b196 = MySqlColumnBuilderWithAutoIncrement, _a271 = entityKind, _b196) {
34652
+ MySqlRealBuilder = class extends (_b196 = MySqlColumnBuilderWithAutoIncrement, _a273 = entityKind, _b196) {
33719
34653
  constructor(name2, config) {
33720
34654
  super(name2, "number", "MySqlReal");
33721
34655
  this.config.precision = config?.precision;
@@ -33726,8 +34660,8 @@ var init_real3 = __esm({
33726
34660
  return new MySqlReal(table4, this.config);
33727
34661
  }
33728
34662
  };
33729
- __publicField(MySqlRealBuilder, _a271, "MySqlRealBuilder");
33730
- MySqlReal = class extends (_b197 = MySqlColumnWithAutoIncrement, _a272 = entityKind, _b197) {
34663
+ __publicField(MySqlRealBuilder, _a273, "MySqlRealBuilder");
34664
+ MySqlReal = class extends (_b197 = MySqlColumnWithAutoIncrement, _a274 = entityKind, _b197) {
33731
34665
  constructor() {
33732
34666
  super(...arguments);
33733
34667
  __publicField(this, "precision", this.config.precision);
@@ -33743,7 +34677,7 @@ var init_real3 = __esm({
33743
34677
  }
33744
34678
  }
33745
34679
  };
33746
- __publicField(MySqlReal, _a272, "MySqlReal");
34680
+ __publicField(MySqlReal, _a274, "MySqlReal");
33747
34681
  }
33748
34682
  });
33749
34683
 
@@ -33751,13 +34685,13 @@ var init_real3 = __esm({
33751
34685
  function serial2(name2) {
33752
34686
  return new MySqlSerialBuilder(name2 ?? "");
33753
34687
  }
33754
- var _a273, _b198, MySqlSerialBuilder, _a274, _b199, MySqlSerial;
34688
+ var _a275, _b198, MySqlSerialBuilder, _a276, _b199, MySqlSerial;
33755
34689
  var init_serial2 = __esm({
33756
34690
  "../drizzle-orm/dist/mysql-core/columns/serial.js"() {
33757
34691
  "use strict";
33758
34692
  init_entity();
33759
34693
  init_common4();
33760
- MySqlSerialBuilder = class extends (_b198 = MySqlColumnBuilderWithAutoIncrement, _a273 = entityKind, _b198) {
34694
+ MySqlSerialBuilder = class extends (_b198 = MySqlColumnBuilderWithAutoIncrement, _a275 = entityKind, _b198) {
33761
34695
  constructor(name2) {
33762
34696
  super(name2, "number", "MySqlSerial");
33763
34697
  this.config.hasDefault = true;
@@ -33768,8 +34702,8 @@ var init_serial2 = __esm({
33768
34702
  return new MySqlSerial(table4, this.config);
33769
34703
  }
33770
34704
  };
33771
- __publicField(MySqlSerialBuilder, _a273, "MySqlSerialBuilder");
33772
- MySqlSerial = class extends (_b199 = MySqlColumnWithAutoIncrement, _a274 = entityKind, _b199) {
34705
+ __publicField(MySqlSerialBuilder, _a275, "MySqlSerialBuilder");
34706
+ MySqlSerial = class extends (_b199 = MySqlColumnWithAutoIncrement, _a276 = entityKind, _b199) {
33773
34707
  getSQLType() {
33774
34708
  return "serial";
33775
34709
  }
@@ -33780,7 +34714,7 @@ var init_serial2 = __esm({
33780
34714
  return value;
33781
34715
  }
33782
34716
  };
33783
- __publicField(MySqlSerial, _a274, "MySqlSerial");
34717
+ __publicField(MySqlSerial, _a276, "MySqlSerial");
33784
34718
  }
33785
34719
  });
33786
34720
 
@@ -33789,14 +34723,14 @@ function smallint2(a, b) {
33789
34723
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33790
34724
  return new MySqlSmallIntBuilder(name2, config);
33791
34725
  }
33792
- var _a275, _b200, MySqlSmallIntBuilder, _a276, _b201, MySqlSmallInt;
34726
+ var _a277, _b200, MySqlSmallIntBuilder, _a278, _b201, MySqlSmallInt;
33793
34727
  var init_smallint2 = __esm({
33794
34728
  "../drizzle-orm/dist/mysql-core/columns/smallint.js"() {
33795
34729
  "use strict";
33796
34730
  init_entity();
33797
34731
  init_utils2();
33798
34732
  init_common4();
33799
- MySqlSmallIntBuilder = class extends (_b200 = MySqlColumnBuilderWithAutoIncrement, _a275 = entityKind, _b200) {
34733
+ MySqlSmallIntBuilder = class extends (_b200 = MySqlColumnBuilderWithAutoIncrement, _a277 = entityKind, _b200) {
33800
34734
  constructor(name2, config) {
33801
34735
  super(name2, "number", "MySqlSmallInt");
33802
34736
  this.config.unsigned = config ? config.unsigned : false;
@@ -33809,8 +34743,8 @@ var init_smallint2 = __esm({
33809
34743
  );
33810
34744
  }
33811
34745
  };
33812
- __publicField(MySqlSmallIntBuilder, _a275, "MySqlSmallIntBuilder");
33813
- MySqlSmallInt = class extends (_b201 = MySqlColumnWithAutoIncrement, _a276 = entityKind, _b201) {
34746
+ __publicField(MySqlSmallIntBuilder, _a277, "MySqlSmallIntBuilder");
34747
+ MySqlSmallInt = class extends (_b201 = MySqlColumnWithAutoIncrement, _a278 = entityKind, _b201) {
33814
34748
  getSQLType() {
33815
34749
  return `smallint${this.config.unsigned ? " unsigned" : ""}`;
33816
34750
  }
@@ -33821,7 +34755,7 @@ var init_smallint2 = __esm({
33821
34755
  return value;
33822
34756
  }
33823
34757
  };
33824
- __publicField(MySqlSmallInt, _a276, "MySqlSmallInt");
34758
+ __publicField(MySqlSmallInt, _a278, "MySqlSmallInt");
33825
34759
  }
33826
34760
  });
33827
34761
 
@@ -33830,14 +34764,14 @@ function text3(a, b = {}) {
33830
34764
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33831
34765
  return new MySqlTextBuilder(name2, "text", config);
33832
34766
  }
33833
- var _a277, _b202, MySqlTextBuilder, _a278, _b203, MySqlText;
34767
+ var _a279, _b202, MySqlTextBuilder, _a280, _b203, MySqlText;
33834
34768
  var init_text3 = __esm({
33835
34769
  "../drizzle-orm/dist/mysql-core/columns/text.js"() {
33836
34770
  "use strict";
33837
34771
  init_entity();
33838
34772
  init_utils2();
33839
34773
  init_common4();
33840
- MySqlTextBuilder = class extends (_b202 = MySqlColumnBuilder, _a277 = entityKind, _b202) {
34774
+ MySqlTextBuilder = class extends (_b202 = MySqlColumnBuilder, _a279 = entityKind, _b202) {
33841
34775
  constructor(name2, textType, config) {
33842
34776
  super(name2, "string", "MySqlText");
33843
34777
  this.config.textType = textType;
@@ -33848,8 +34782,8 @@ var init_text3 = __esm({
33848
34782
  return new MySqlText(table4, this.config);
33849
34783
  }
33850
34784
  };
33851
- __publicField(MySqlTextBuilder, _a277, "MySqlTextBuilder");
33852
- MySqlText = class extends (_b203 = MySqlColumn, _a278 = entityKind, _b203) {
34785
+ __publicField(MySqlTextBuilder, _a279, "MySqlTextBuilder");
34786
+ MySqlText = class extends (_b203 = MySqlColumn, _a280 = entityKind, _b203) {
33853
34787
  constructor() {
33854
34788
  super(...arguments);
33855
34789
  __publicField(this, "textType", this.config.textType);
@@ -33859,7 +34793,7 @@ var init_text3 = __esm({
33859
34793
  return this.textType;
33860
34794
  }
33861
34795
  };
33862
- __publicField(MySqlText, _a278, "MySqlText");
34796
+ __publicField(MySqlText, _a280, "MySqlText");
33863
34797
  }
33864
34798
  });
33865
34799
 
@@ -33868,14 +34802,14 @@ function time2(a, b) {
33868
34802
  const { name: name2, config } = getColumnNameAndConfig(a, b);
33869
34803
  return new MySqlTimeBuilder(name2, config);
33870
34804
  }
33871
- var _a279, _b204, MySqlTimeBuilder, _a280, _b205, MySqlTime;
34805
+ var _a281, _b204, MySqlTimeBuilder, _a282, _b205, MySqlTime;
33872
34806
  var init_time2 = __esm({
33873
34807
  "../drizzle-orm/dist/mysql-core/columns/time.js"() {
33874
34808
  "use strict";
33875
34809
  init_entity();
33876
34810
  init_utils2();
33877
34811
  init_common4();
33878
- MySqlTimeBuilder = class extends (_b204 = MySqlColumnBuilder, _a279 = entityKind, _b204) {
34812
+ MySqlTimeBuilder = class extends (_b204 = MySqlColumnBuilder, _a281 = entityKind, _b204) {
33879
34813
  constructor(name2, config) {
33880
34814
  super(name2, "string", "MySqlTime");
33881
34815
  this.config.fsp = config?.fsp;
@@ -33885,8 +34819,8 @@ var init_time2 = __esm({
33885
34819
  return new MySqlTime(table4, this.config);
33886
34820
  }
33887
34821
  };
33888
- __publicField(MySqlTimeBuilder, _a279, "MySqlTimeBuilder");
33889
- MySqlTime = class extends (_b205 = MySqlColumn, _a280 = entityKind, _b205) {
34822
+ __publicField(MySqlTimeBuilder, _a281, "MySqlTimeBuilder");
34823
+ MySqlTime = class extends (_b205 = MySqlColumn, _a282 = entityKind, _b205) {
33890
34824
  constructor() {
33891
34825
  super(...arguments);
33892
34826
  __publicField(this, "fsp", this.config.fsp);
@@ -33896,19 +34830,19 @@ var init_time2 = __esm({
33896
34830
  return `time${precision}`;
33897
34831
  }
33898
34832
  };
33899
- __publicField(MySqlTime, _a280, "MySqlTime");
34833
+ __publicField(MySqlTime, _a282, "MySqlTime");
33900
34834
  }
33901
34835
  });
33902
34836
 
33903
34837
  // ../drizzle-orm/dist/mysql-core/columns/date.common.js
33904
- var _a281, _b206, MySqlDateColumnBaseBuilder, _a282, _b207, MySqlDateBaseColumn;
34838
+ var _a283, _b206, MySqlDateColumnBaseBuilder, _a284, _b207, MySqlDateBaseColumn;
33905
34839
  var init_date_common2 = __esm({
33906
34840
  "../drizzle-orm/dist/mysql-core/columns/date.common.js"() {
33907
34841
  "use strict";
33908
34842
  init_entity();
33909
34843
  init_sql();
33910
34844
  init_common4();
33911
- MySqlDateColumnBaseBuilder = class extends (_b206 = MySqlColumnBuilder, _a281 = entityKind, _b206) {
34845
+ MySqlDateColumnBaseBuilder = class extends (_b206 = MySqlColumnBuilder, _a283 = entityKind, _b206) {
33912
34846
  defaultNow() {
33913
34847
  return this.default(sql`(now())`);
33914
34848
  }
@@ -33919,14 +34853,14 @@ var init_date_common2 = __esm({
33919
34853
  return this;
33920
34854
  }
33921
34855
  };
33922
- __publicField(MySqlDateColumnBaseBuilder, _a281, "MySqlDateColumnBuilder");
33923
- MySqlDateBaseColumn = class extends (_b207 = MySqlColumn, _a282 = entityKind, _b207) {
34856
+ __publicField(MySqlDateColumnBaseBuilder, _a283, "MySqlDateColumnBuilder");
34857
+ MySqlDateBaseColumn = class extends (_b207 = MySqlColumn, _a284 = entityKind, _b207) {
33924
34858
  constructor() {
33925
34859
  super(...arguments);
33926
34860
  __publicField(this, "hasOnUpdateNow", this.config.hasOnUpdateNow);
33927
34861
  }
33928
34862
  };
33929
- __publicField(MySqlDateBaseColumn, _a282, "MySqlDateColumn");
34863
+ __publicField(MySqlDateBaseColumn, _a284, "MySqlDateColumn");
33930
34864
  }
33931
34865
  });
33932
34866
 
@@ -33938,14 +34872,14 @@ function timestamp2(a, b = {}) {
33938
34872
  }
33939
34873
  return new MySqlTimestampBuilder(name2, config);
33940
34874
  }
33941
- var _a283, _b208, MySqlTimestampBuilder, _a284, _b209, MySqlTimestamp, _a285, _b210, MySqlTimestampStringBuilder, _a286, _b211, MySqlTimestampString;
34875
+ var _a285, _b208, MySqlTimestampBuilder, _a286, _b209, MySqlTimestamp, _a287, _b210, MySqlTimestampStringBuilder, _a288, _b211, MySqlTimestampString;
33942
34876
  var init_timestamp2 = __esm({
33943
34877
  "../drizzle-orm/dist/mysql-core/columns/timestamp.js"() {
33944
34878
  "use strict";
33945
34879
  init_entity();
33946
34880
  init_utils2();
33947
34881
  init_date_common2();
33948
- MySqlTimestampBuilder = class extends (_b208 = MySqlDateColumnBaseBuilder, _a283 = entityKind, _b208) {
34882
+ MySqlTimestampBuilder = class extends (_b208 = MySqlDateColumnBaseBuilder, _a285 = entityKind, _b208) {
33949
34883
  constructor(name2, config) {
33950
34884
  super(name2, "date", "MySqlTimestamp");
33951
34885
  this.config.fsp = config?.fsp;
@@ -33958,8 +34892,8 @@ var init_timestamp2 = __esm({
33958
34892
  );
33959
34893
  }
33960
34894
  };
33961
- __publicField(MySqlTimestampBuilder, _a283, "MySqlTimestampBuilder");
33962
- MySqlTimestamp = class extends (_b209 = MySqlDateBaseColumn, _a284 = entityKind, _b209) {
34895
+ __publicField(MySqlTimestampBuilder, _a285, "MySqlTimestampBuilder");
34896
+ MySqlTimestamp = class extends (_b209 = MySqlDateBaseColumn, _a286 = entityKind, _b209) {
33963
34897
  constructor() {
33964
34898
  super(...arguments);
33965
34899
  __publicField(this, "fsp", this.config.fsp);
@@ -33975,8 +34909,8 @@ var init_timestamp2 = __esm({
33975
34909
  return value.toISOString().slice(0, -1).replace("T", " ");
33976
34910
  }
33977
34911
  };
33978
- __publicField(MySqlTimestamp, _a284, "MySqlTimestamp");
33979
- MySqlTimestampStringBuilder = class extends (_b210 = MySqlDateColumnBaseBuilder, _a285 = entityKind, _b210) {
34912
+ __publicField(MySqlTimestamp, _a286, "MySqlTimestamp");
34913
+ MySqlTimestampStringBuilder = class extends (_b210 = MySqlDateColumnBaseBuilder, _a287 = entityKind, _b210) {
33980
34914
  constructor(name2, config) {
33981
34915
  super(name2, "string", "MySqlTimestampString");
33982
34916
  this.config.fsp = config?.fsp;
@@ -33989,8 +34923,8 @@ var init_timestamp2 = __esm({
33989
34923
  );
33990
34924
  }
33991
34925
  };
33992
- __publicField(MySqlTimestampStringBuilder, _a285, "MySqlTimestampStringBuilder");
33993
- MySqlTimestampString = class extends (_b211 = MySqlDateBaseColumn, _a286 = entityKind, _b211) {
34926
+ __publicField(MySqlTimestampStringBuilder, _a287, "MySqlTimestampStringBuilder");
34927
+ MySqlTimestampString = class extends (_b211 = MySqlDateBaseColumn, _a288 = entityKind, _b211) {
33994
34928
  constructor() {
33995
34929
  super(...arguments);
33996
34930
  __publicField(this, "fsp", this.config.fsp);
@@ -34000,7 +34934,7 @@ var init_timestamp2 = __esm({
34000
34934
  return `timestamp${precision}`;
34001
34935
  }
34002
34936
  };
34003
- __publicField(MySqlTimestampString, _a286, "MySqlTimestampString");
34937
+ __publicField(MySqlTimestampString, _a288, "MySqlTimestampString");
34004
34938
  }
34005
34939
  });
34006
34940
 
@@ -34009,14 +34943,14 @@ function tinyint(a, b) {
34009
34943
  const { name: name2, config } = getColumnNameAndConfig(a, b);
34010
34944
  return new MySqlTinyIntBuilder(name2, config);
34011
34945
  }
34012
- var _a287, _b212, MySqlTinyIntBuilder, _a288, _b213, MySqlTinyInt;
34946
+ var _a289, _b212, MySqlTinyIntBuilder, _a290, _b213, MySqlTinyInt;
34013
34947
  var init_tinyint = __esm({
34014
34948
  "../drizzle-orm/dist/mysql-core/columns/tinyint.js"() {
34015
34949
  "use strict";
34016
34950
  init_entity();
34017
34951
  init_utils2();
34018
34952
  init_common4();
34019
- MySqlTinyIntBuilder = class extends (_b212 = MySqlColumnBuilderWithAutoIncrement, _a287 = entityKind, _b212) {
34953
+ MySqlTinyIntBuilder = class extends (_b212 = MySqlColumnBuilderWithAutoIncrement, _a289 = entityKind, _b212) {
34020
34954
  constructor(name2, config) {
34021
34955
  super(name2, "number", "MySqlTinyInt");
34022
34956
  this.config.unsigned = config ? config.unsigned : false;
@@ -34029,8 +34963,8 @@ var init_tinyint = __esm({
34029
34963
  );
34030
34964
  }
34031
34965
  };
34032
- __publicField(MySqlTinyIntBuilder, _a287, "MySqlTinyIntBuilder");
34033
- MySqlTinyInt = class extends (_b213 = MySqlColumnWithAutoIncrement, _a288 = entityKind, _b213) {
34966
+ __publicField(MySqlTinyIntBuilder, _a289, "MySqlTinyIntBuilder");
34967
+ MySqlTinyInt = class extends (_b213 = MySqlColumnWithAutoIncrement, _a290 = entityKind, _b213) {
34034
34968
  getSQLType() {
34035
34969
  return `tinyint${this.config.unsigned ? " unsigned" : ""}`;
34036
34970
  }
@@ -34041,7 +34975,7 @@ var init_tinyint = __esm({
34041
34975
  return value;
34042
34976
  }
34043
34977
  };
34044
- __publicField(MySqlTinyInt, _a288, "MySqlTinyInt");
34978
+ __publicField(MySqlTinyInt, _a290, "MySqlTinyInt");
34045
34979
  }
34046
34980
  });
34047
34981
 
@@ -34050,14 +34984,14 @@ function varbinary(a, b) {
34050
34984
  const { name: name2, config } = getColumnNameAndConfig(a, b);
34051
34985
  return new MySqlVarBinaryBuilder(name2, config);
34052
34986
  }
34053
- var _a289, _b214, MySqlVarBinaryBuilder, _a290, _b215, MySqlVarBinary;
34987
+ var _a291, _b214, MySqlVarBinaryBuilder, _a292, _b215, MySqlVarBinary;
34054
34988
  var init_varbinary = __esm({
34055
34989
  "../drizzle-orm/dist/mysql-core/columns/varbinary.js"() {
34056
34990
  "use strict";
34057
34991
  init_entity();
34058
34992
  init_utils2();
34059
34993
  init_common4();
34060
- MySqlVarBinaryBuilder = class extends (_b214 = MySqlColumnBuilder, _a289 = entityKind, _b214) {
34994
+ MySqlVarBinaryBuilder = class extends (_b214 = MySqlColumnBuilder, _a291 = entityKind, _b214) {
34061
34995
  /** @internal */
34062
34996
  constructor(name2, config) {
34063
34997
  super(name2, "string", "MySqlVarBinary");
@@ -34071,8 +35005,8 @@ var init_varbinary = __esm({
34071
35005
  );
34072
35006
  }
34073
35007
  };
34074
- __publicField(MySqlVarBinaryBuilder, _a289, "MySqlVarBinaryBuilder");
34075
- MySqlVarBinary = class extends (_b215 = MySqlColumn, _a290 = entityKind, _b215) {
35008
+ __publicField(MySqlVarBinaryBuilder, _a291, "MySqlVarBinaryBuilder");
35009
+ MySqlVarBinary = class extends (_b215 = MySqlColumn, _a292 = entityKind, _b215) {
34076
35010
  constructor() {
34077
35011
  super(...arguments);
34078
35012
  __publicField(this, "length", this.config.length);
@@ -34081,7 +35015,7 @@ var init_varbinary = __esm({
34081
35015
  return this.length === void 0 ? `varbinary` : `varbinary(${this.length})`;
34082
35016
  }
34083
35017
  };
34084
- __publicField(MySqlVarBinary, _a290, "MySqlVarBinary");
35018
+ __publicField(MySqlVarBinary, _a292, "MySqlVarBinary");
34085
35019
  }
34086
35020
  });
34087
35021
 
@@ -34090,14 +35024,14 @@ function varchar2(a, b) {
34090
35024
  const { name: name2, config } = getColumnNameAndConfig(a, b);
34091
35025
  return new MySqlVarCharBuilder(name2, config);
34092
35026
  }
34093
- var _a291, _b216, MySqlVarCharBuilder, _a292, _b217, MySqlVarChar;
35027
+ var _a293, _b216, MySqlVarCharBuilder, _a294, _b217, MySqlVarChar;
34094
35028
  var init_varchar2 = __esm({
34095
35029
  "../drizzle-orm/dist/mysql-core/columns/varchar.js"() {
34096
35030
  "use strict";
34097
35031
  init_entity();
34098
35032
  init_utils2();
34099
35033
  init_common4();
34100
- MySqlVarCharBuilder = class extends (_b216 = MySqlColumnBuilder, _a291 = entityKind, _b216) {
35034
+ MySqlVarCharBuilder = class extends (_b216 = MySqlColumnBuilder, _a293 = entityKind, _b216) {
34101
35035
  /** @internal */
34102
35036
  constructor(name2, config) {
34103
35037
  super(name2, "string", "MySqlVarChar");
@@ -34112,8 +35046,8 @@ var init_varchar2 = __esm({
34112
35046
  );
34113
35047
  }
34114
35048
  };
34115
- __publicField(MySqlVarCharBuilder, _a291, "MySqlVarCharBuilder");
34116
- MySqlVarChar = class extends (_b217 = MySqlColumn, _a292 = entityKind, _b217) {
35049
+ __publicField(MySqlVarCharBuilder, _a293, "MySqlVarCharBuilder");
35050
+ MySqlVarChar = class extends (_b217 = MySqlColumn, _a294 = entityKind, _b217) {
34117
35051
  constructor() {
34118
35052
  super(...arguments);
34119
35053
  __publicField(this, "length", this.config.length);
@@ -34123,7 +35057,7 @@ var init_varchar2 = __esm({
34123
35057
  return this.length === void 0 ? `varchar` : `varchar(${this.length})`;
34124
35058
  }
34125
35059
  };
34126
- __publicField(MySqlVarChar, _a292, "MySqlVarChar");
35060
+ __publicField(MySqlVarChar, _a294, "MySqlVarChar");
34127
35061
  }
34128
35062
  });
34129
35063
 
@@ -34131,13 +35065,13 @@ var init_varchar2 = __esm({
34131
35065
  function year(name2) {
34132
35066
  return new MySqlYearBuilder(name2 ?? "");
34133
35067
  }
34134
- var _a293, _b218, MySqlYearBuilder, _a294, _b219, MySqlYear;
35068
+ var _a295, _b218, MySqlYearBuilder, _a296, _b219, MySqlYear;
34135
35069
  var init_year = __esm({
34136
35070
  "../drizzle-orm/dist/mysql-core/columns/year.js"() {
34137
35071
  "use strict";
34138
35072
  init_entity();
34139
35073
  init_common4();
34140
- MySqlYearBuilder = class extends (_b218 = MySqlColumnBuilder, _a293 = entityKind, _b218) {
35074
+ MySqlYearBuilder = class extends (_b218 = MySqlColumnBuilder, _a295 = entityKind, _b218) {
34141
35075
  constructor(name2) {
34142
35076
  super(name2, "number", "MySqlYear");
34143
35077
  }
@@ -34146,13 +35080,13 @@ var init_year = __esm({
34146
35080
  return new MySqlYear(table4, this.config);
34147
35081
  }
34148
35082
  };
34149
- __publicField(MySqlYearBuilder, _a293, "MySqlYearBuilder");
34150
- MySqlYear = class extends (_b219 = MySqlColumn, _a294 = entityKind, _b219) {
35083
+ __publicField(MySqlYearBuilder, _a295, "MySqlYearBuilder");
35084
+ MySqlYear = class extends (_b219 = MySqlColumn, _a296 = entityKind, _b219) {
34151
35085
  getSQLType() {
34152
35086
  return `year`;
34153
35087
  }
34154
35088
  };
34155
- __publicField(MySqlYear, _a294, "MySqlYear");
35089
+ __publicField(MySqlYear, _a296, "MySqlYear");
34156
35090
  }
34157
35091
  });
34158
35092
 
@@ -34189,17 +35123,17 @@ var init_columns3 = __esm({
34189
35123
  });
34190
35124
 
34191
35125
  // ../drizzle-orm/dist/mysql-core/query-builders/count.js
34192
- var _a295, _b220, _c8, _MySqlCountBuilder, MySqlCountBuilder;
35126
+ var _a297, _b220, _c8, _MySqlCountBuilder, MySqlCountBuilder;
34193
35127
  var init_count3 = __esm({
34194
35128
  "../drizzle-orm/dist/mysql-core/query-builders/count.js"() {
34195
35129
  "use strict";
34196
35130
  init_entity();
34197
35131
  init_sql();
34198
- _MySqlCountBuilder = class _MySqlCountBuilder extends (_c8 = SQL, _b220 = entityKind, _a295 = Symbol.toStringTag, _c8) {
35132
+ _MySqlCountBuilder = class _MySqlCountBuilder extends (_c8 = SQL, _b220 = entityKind, _a297 = Symbol.toStringTag, _c8) {
34199
35133
  constructor(params) {
34200
35134
  super(_MySqlCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
34201
35135
  __publicField(this, "sql");
34202
- __publicField(this, _a295, "MySqlCountBuilder");
35136
+ __publicField(this, _a297, "MySqlCountBuilder");
34203
35137
  __publicField(this, "session");
34204
35138
  this.params = params;
34205
35139
  this.mapWith(Number);
@@ -34243,7 +35177,7 @@ var init_count3 = __esm({
34243
35177
  });
34244
35178
 
34245
35179
  // ../drizzle-orm/dist/mysql-core/query-builders/delete.js
34246
- var _a296, _b221, MySqlDeleteBase;
35180
+ var _a298, _b221, MySqlDeleteBase;
34247
35181
  var init_delete3 = __esm({
34248
35182
  "../drizzle-orm/dist/mysql-core/query-builders/delete.js"() {
34249
35183
  "use strict";
@@ -34251,7 +35185,7 @@ var init_delete3 = __esm({
34251
35185
  init_query_promise();
34252
35186
  init_selection_proxy();
34253
35187
  init_table();
34254
- MySqlDeleteBase = class extends (_b221 = QueryPromise, _a296 = entityKind, _b221) {
35188
+ MySqlDeleteBase = class extends (_b221 = QueryPromise, _a298 = entityKind, _b221) {
34255
35189
  constructor(table4, session, dialect4, withList) {
34256
35190
  super();
34257
35191
  __publicField(this, "config");
@@ -34341,12 +35275,12 @@ var init_delete3 = __esm({
34341
35275
  return this;
34342
35276
  }
34343
35277
  };
34344
- __publicField(MySqlDeleteBase, _a296, "MySqlDelete");
35278
+ __publicField(MySqlDeleteBase, _a298, "MySqlDelete");
34345
35279
  }
34346
35280
  });
34347
35281
 
34348
35282
  // ../drizzle-orm/dist/mysql-core/query-builders/insert.js
34349
- var _a297, MySqlInsertBuilder, _a298, _b222, MySqlInsertBase;
35283
+ var _a299, MySqlInsertBuilder, _a300, _b222, MySqlInsertBase;
34350
35284
  var init_insert3 = __esm({
34351
35285
  "../drizzle-orm/dist/mysql-core/query-builders/insert.js"() {
34352
35286
  "use strict";
@@ -34355,7 +35289,7 @@ var init_insert3 = __esm({
34355
35289
  init_sql();
34356
35290
  init_table();
34357
35291
  init_utils2();
34358
- _a297 = entityKind;
35292
+ _a299 = entityKind;
34359
35293
  MySqlInsertBuilder = class {
34360
35294
  constructor(table4, session, dialect4) {
34361
35295
  __publicField(this, "shouldIgnore", false);
@@ -34384,8 +35318,8 @@ var init_insert3 = __esm({
34384
35318
  return new MySqlInsertBase(this.table, mappedValues, this.shouldIgnore, this.session, this.dialect);
34385
35319
  }
34386
35320
  };
34387
- __publicField(MySqlInsertBuilder, _a297, "MySqlInsertBuilder");
34388
- MySqlInsertBase = class extends (_b222 = QueryPromise, _a298 = entityKind, _b222) {
35321
+ __publicField(MySqlInsertBuilder, _a299, "MySqlInsertBuilder");
35322
+ MySqlInsertBase = class extends (_b222 = QueryPromise, _a300 = entityKind, _b222) {
34389
35323
  constructor(table4, values, ignore, session, dialect4) {
34390
35324
  super();
34391
35325
  __publicField(this, "config");
@@ -34466,7 +35400,7 @@ var init_insert3 = __esm({
34466
35400
  return this;
34467
35401
  }
34468
35402
  };
34469
- __publicField(MySqlInsertBase, _a298, "MySqlInsert");
35403
+ __publicField(MySqlInsertBase, _a300, "MySqlInsert");
34470
35404
  }
34471
35405
  });
34472
35406
 
@@ -34550,7 +35484,7 @@ function mysqlTableWithSchema(name2, columns, extraConfig, schema4, baseName = n
34550
35484
  }
34551
35485
  return table4;
34552
35486
  }
34553
- var InlineForeignKeys3, _a299, _b223, _c9, _d4, _e3, MySqlTable, mysqlTable;
35487
+ var InlineForeignKeys3, _a301, _b223, _c9, _d4, _e4, MySqlTable, mysqlTable;
34554
35488
  var init_table4 = __esm({
34555
35489
  "../drizzle-orm/dist/mysql-core/table.js"() {
34556
35490
  "use strict";
@@ -34558,7 +35492,7 @@ var init_table4 = __esm({
34558
35492
  init_table();
34559
35493
  init_all3();
34560
35494
  InlineForeignKeys3 = Symbol.for("drizzle:MySqlInlineForeignKeys");
34561
- MySqlTable = class extends (_e3 = Table, _d4 = entityKind, _c9 = Table.Symbol.Columns, _b223 = InlineForeignKeys3, _a299 = Table.Symbol.ExtraConfigBuilder, _e3) {
35495
+ MySqlTable = class extends (_e4 = Table, _d4 = entityKind, _c9 = Table.Symbol.Columns, _b223 = InlineForeignKeys3, _a301 = Table.Symbol.ExtraConfigBuilder, _e4) {
34562
35496
  constructor() {
34563
35497
  super(...arguments);
34564
35498
  /** @internal */
@@ -34566,7 +35500,7 @@ var init_table4 = __esm({
34566
35500
  /** @internal */
34567
35501
  __publicField(this, _b223, []);
34568
35502
  /** @internal */
34569
- __publicField(this, _a299);
35503
+ __publicField(this, _a301);
34570
35504
  }
34571
35505
  };
34572
35506
  __publicField(MySqlTable, _d4, "MySqlTable");
@@ -34581,20 +35515,20 @@ var init_table4 = __esm({
34581
35515
  });
34582
35516
 
34583
35517
  // ../drizzle-orm/dist/mysql-core/view-base.js
34584
- var _a300, _b224, MySqlViewBase;
35518
+ var _a302, _b224, MySqlViewBase;
34585
35519
  var init_view_base3 = __esm({
34586
35520
  "../drizzle-orm/dist/mysql-core/view-base.js"() {
34587
35521
  "use strict";
34588
35522
  init_entity();
34589
35523
  init_sql();
34590
- MySqlViewBase = class extends (_b224 = View3, _a300 = entityKind, _b224) {
35524
+ MySqlViewBase = class extends (_b224 = View3, _a302 = entityKind, _b224) {
34591
35525
  };
34592
- __publicField(MySqlViewBase, _a300, "MySqlViewBase");
35526
+ __publicField(MySqlViewBase, _a302, "MySqlViewBase");
34593
35527
  }
34594
35528
  });
34595
35529
 
34596
35530
  // ../drizzle-orm/dist/mysql-core/dialect.js
34597
- var _a301, MySqlDialect;
35531
+ var _a303, MySqlDialect;
34598
35532
  var init_dialect3 = __esm({
34599
35533
  "../drizzle-orm/dist/mysql-core/dialect.js"() {
34600
35534
  "use strict";
@@ -34613,7 +35547,7 @@ var init_dialect3 = __esm({
34613
35547
  init_common4();
34614
35548
  init_table4();
34615
35549
  init_view_base3();
34616
- _a301 = entityKind;
35550
+ _a303 = entityKind;
34617
35551
  MySqlDialect = class {
34618
35552
  constructor(config) {
34619
35553
  /** @internal */
@@ -35399,7 +36333,7 @@ var init_dialect3 = __esm({
35399
36333
  };
35400
36334
  }
35401
36335
  };
35402
- __publicField(MySqlDialect, _a301, "MySqlDialect");
36336
+ __publicField(MySqlDialect, _a303, "MySqlDialect");
35403
36337
  }
35404
36338
  });
35405
36339
 
@@ -35421,7 +36355,7 @@ function createSetOperator3(type, isAll) {
35421
36355
  return leftSelect.addSetOperators(setOperators);
35422
36356
  };
35423
36357
  }
35424
- var _a302, MySqlSelectBuilder, _a303, _b225, MySqlSelectQueryBuilderBase, _a304, _b226, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
36358
+ var _a304, MySqlSelectBuilder, _a305, _b225, MySqlSelectQueryBuilderBase, _a306, _b226, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
35425
36359
  var init_select4 = __esm({
35426
36360
  "../drizzle-orm/dist/mysql-core/query-builders/select.js"() {
35427
36361
  "use strict";
@@ -35436,7 +36370,7 @@ var init_select4 = __esm({
35436
36370
  init_utils2();
35437
36371
  init_view_common();
35438
36372
  init_view_base3();
35439
- _a302 = entityKind;
36373
+ _a304 = entityKind;
35440
36374
  MySqlSelectBuilder = class {
35441
36375
  constructor(config) {
35442
36376
  __publicField(this, "fields");
@@ -35481,8 +36415,8 @@ var init_select4 = __esm({
35481
36415
  );
35482
36416
  }
35483
36417
  };
35484
- __publicField(MySqlSelectBuilder, _a302, "MySqlSelectBuilder");
35485
- MySqlSelectQueryBuilderBase = class extends (_b225 = TypedQueryBuilder, _a303 = entityKind, _b225) {
36418
+ __publicField(MySqlSelectBuilder, _a304, "MySqlSelectBuilder");
36419
+ MySqlSelectQueryBuilderBase = class extends (_b225 = TypedQueryBuilder, _a305 = entityKind, _b225) {
35486
36420
  constructor({ table: table4, fields, isPartialSelect, session, dialect: dialect4, withList, distinct }) {
35487
36421
  super();
35488
36422
  __publicField(this, "_");
@@ -36083,8 +37017,8 @@ var init_select4 = __esm({
36083
37017
  return this;
36084
37018
  }
36085
37019
  };
36086
- __publicField(MySqlSelectQueryBuilderBase, _a303, "MySqlSelectQueryBuilder");
36087
- MySqlSelectBase = class extends (_b226 = MySqlSelectQueryBuilderBase, _a304 = entityKind, _b226) {
37020
+ __publicField(MySqlSelectQueryBuilderBase, _a305, "MySqlSelectQueryBuilder");
37021
+ MySqlSelectBase = class extends (_b226 = MySqlSelectQueryBuilderBase, _a306 = entityKind, _b226) {
36088
37022
  constructor() {
36089
37023
  super(...arguments);
36090
37024
  __publicField(this, "execute", (placeholderValues) => {
@@ -36108,7 +37042,7 @@ var init_select4 = __esm({
36108
37042
  return query;
36109
37043
  }
36110
37044
  };
36111
- __publicField(MySqlSelectBase, _a304, "MySqlSelect");
37045
+ __publicField(MySqlSelectBase, _a306, "MySqlSelect");
36112
37046
  applyMixins(MySqlSelectBase, [QueryPromise]);
36113
37047
  getMySqlSetOperators = () => ({
36114
37048
  union: union3,
@@ -36128,7 +37062,7 @@ var init_select4 = __esm({
36128
37062
  });
36129
37063
 
36130
37064
  // ../drizzle-orm/dist/mysql-core/query-builders/query-builder.js
36131
- var _a305, QueryBuilder3;
37065
+ var _a307, QueryBuilder3;
36132
37066
  var init_query_builder4 = __esm({
36133
37067
  "../drizzle-orm/dist/mysql-core/query-builders/query-builder.js"() {
36134
37068
  "use strict";
@@ -36137,7 +37071,7 @@ var init_query_builder4 = __esm({
36137
37071
  init_selection_proxy();
36138
37072
  init_subquery();
36139
37073
  init_select4();
36140
- _a305 = entityKind;
37074
+ _a307 = entityKind;
36141
37075
  QueryBuilder3 = class {
36142
37076
  constructor(dialect4) {
36143
37077
  __publicField(this, "dialect");
@@ -36199,7 +37133,7 @@ var init_query_builder4 = __esm({
36199
37133
  return this.dialect;
36200
37134
  }
36201
37135
  };
36202
- __publicField(QueryBuilder3, _a305, "MySqlQueryBuilder");
37136
+ __publicField(QueryBuilder3, _a307, "MySqlQueryBuilder");
36203
37137
  }
36204
37138
  });
36205
37139
 
@@ -36211,7 +37145,7 @@ var init_select_types3 = __esm({
36211
37145
  });
36212
37146
 
36213
37147
  // ../drizzle-orm/dist/mysql-core/query-builders/update.js
36214
- var _a306, MySqlUpdateBuilder, _a307, _b227, MySqlUpdateBase;
37148
+ var _a308, MySqlUpdateBuilder, _a309, _b227, MySqlUpdateBase;
36215
37149
  var init_update3 = __esm({
36216
37150
  "../drizzle-orm/dist/mysql-core/query-builders/update.js"() {
36217
37151
  "use strict";
@@ -36220,7 +37154,7 @@ var init_update3 = __esm({
36220
37154
  init_selection_proxy();
36221
37155
  init_table();
36222
37156
  init_utils2();
36223
- _a306 = entityKind;
37157
+ _a308 = entityKind;
36224
37158
  MySqlUpdateBuilder = class {
36225
37159
  constructor(table4, session, dialect4, withList) {
36226
37160
  this.table = table4;
@@ -36232,8 +37166,8 @@ var init_update3 = __esm({
36232
37166
  return new MySqlUpdateBase(this.table, mapUpdateSet(this.table, values), this.session, this.dialect, this.withList);
36233
37167
  }
36234
37168
  };
36235
- __publicField(MySqlUpdateBuilder, _a306, "MySqlUpdateBuilder");
36236
- MySqlUpdateBase = class extends (_b227 = QueryPromise, _a307 = entityKind, _b227) {
37169
+ __publicField(MySqlUpdateBuilder, _a308, "MySqlUpdateBuilder");
37170
+ MySqlUpdateBase = class extends (_b227 = QueryPromise, _a309 = entityKind, _b227) {
36237
37171
  constructor(table4, set, session, dialect4, withList) {
36238
37172
  super();
36239
37173
  __publicField(this, "config");
@@ -36326,7 +37260,7 @@ var init_update3 = __esm({
36326
37260
  return this;
36327
37261
  }
36328
37262
  };
36329
- __publicField(MySqlUpdateBase, _a307, "MySqlUpdate");
37263
+ __publicField(MySqlUpdateBase, _a309, "MySqlUpdate");
36330
37264
  }
36331
37265
  });
36332
37266
 
@@ -36344,14 +37278,14 @@ var init_query_builders3 = __esm({
36344
37278
  });
36345
37279
 
36346
37280
  // ../drizzle-orm/dist/mysql-core/query-builders/query.js
36347
- var _a308, RelationalQueryBuilder3, _a309, _b228, MySqlRelationalQuery;
37281
+ var _a310, RelationalQueryBuilder3, _a311, _b228, MySqlRelationalQuery;
36348
37282
  var init_query3 = __esm({
36349
37283
  "../drizzle-orm/dist/mysql-core/query-builders/query.js"() {
36350
37284
  "use strict";
36351
37285
  init_entity();
36352
37286
  init_query_promise();
36353
37287
  init_relations();
36354
- _a308 = entityKind;
37288
+ _a310 = entityKind;
36355
37289
  RelationalQueryBuilder3 = class {
36356
37290
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, mode) {
36357
37291
  this.fullSchema = fullSchema;
@@ -36392,8 +37326,8 @@ var init_query3 = __esm({
36392
37326
  );
36393
37327
  }
36394
37328
  };
36395
- __publicField(RelationalQueryBuilder3, _a308, "MySqlRelationalQueryBuilder");
36396
- MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a309 = entityKind, _b228) {
37329
+ __publicField(RelationalQueryBuilder3, _a310, "MySqlRelationalQueryBuilder");
37330
+ MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a311 = entityKind, _b228) {
36397
37331
  constructor(fullSchema, schema4, tableNamesMap, table4, tableConfig, dialect4, session, config, queryMode, mode) {
36398
37332
  super();
36399
37333
  this.fullSchema = fullSchema;
@@ -36457,12 +37391,12 @@ var init_query3 = __esm({
36457
37391
  return this.prepare().execute();
36458
37392
  }
36459
37393
  };
36460
- __publicField(MySqlRelationalQuery, _a309, "MySqlRelationalQuery");
37394
+ __publicField(MySqlRelationalQuery, _a311, "MySqlRelationalQuery");
36461
37395
  }
36462
37396
  });
36463
37397
 
36464
37398
  // ../drizzle-orm/dist/mysql-core/db.js
36465
- var _a310, MySqlDatabase;
37399
+ var _a312, MySqlDatabase;
36466
37400
  var init_db3 = __esm({
36467
37401
  "../drizzle-orm/dist/mysql-core/db.js"() {
36468
37402
  "use strict";
@@ -36473,7 +37407,7 @@ var init_db3 = __esm({
36473
37407
  init_count3();
36474
37408
  init_query_builders3();
36475
37409
  init_query3();
36476
- _a310 = entityKind;
37410
+ _a312 = entityKind;
36477
37411
  MySqlDatabase = class {
36478
37412
  constructor(dialect4, session, schema4, mode) {
36479
37413
  __publicField(this, "query");
@@ -36686,17 +37620,17 @@ var init_db3 = __esm({
36686
37620
  return this.session.transaction(transaction, config);
36687
37621
  }
36688
37622
  };
36689
- __publicField(MySqlDatabase, _a310, "MySqlDatabase");
37623
+ __publicField(MySqlDatabase, _a312, "MySqlDatabase");
36690
37624
  }
36691
37625
  });
36692
37626
 
36693
37627
  // ../drizzle-orm/dist/mysql-core/indexes.js
36694
- var _a311, IndexBuilderOn3, _a312, IndexBuilder3, _a313, Index5;
37628
+ var _a313, IndexBuilderOn3, _a314, IndexBuilder3, _a315, Index5;
36695
37629
  var init_indexes3 = __esm({
36696
37630
  "../drizzle-orm/dist/mysql-core/indexes.js"() {
36697
37631
  "use strict";
36698
37632
  init_entity();
36699
- _a311 = entityKind;
37633
+ _a313 = entityKind;
36700
37634
  IndexBuilderOn3 = class {
36701
37635
  constructor(name2, unique) {
36702
37636
  this.name = name2;
@@ -36706,8 +37640,8 @@ var init_indexes3 = __esm({
36706
37640
  return new IndexBuilder3(this.name, columns, this.unique);
36707
37641
  }
36708
37642
  };
36709
- __publicField(IndexBuilderOn3, _a311, "MySqlIndexBuilderOn");
36710
- _a312 = entityKind;
37643
+ __publicField(IndexBuilderOn3, _a313, "MySqlIndexBuilderOn");
37644
+ _a314 = entityKind;
36711
37645
  IndexBuilder3 = class {
36712
37646
  constructor(name2, columns, unique) {
36713
37647
  /** @internal */
@@ -36735,26 +37669,26 @@ var init_indexes3 = __esm({
36735
37669
  return new Index5(this.config, table4);
36736
37670
  }
36737
37671
  };
36738
- __publicField(IndexBuilder3, _a312, "MySqlIndexBuilder");
36739
- _a313 = entityKind;
37672
+ __publicField(IndexBuilder3, _a314, "MySqlIndexBuilder");
37673
+ _a315 = entityKind;
36740
37674
  Index5 = class {
36741
37675
  constructor(config, table4) {
36742
37676
  __publicField(this, "config");
36743
37677
  this.config = { ...config, table: table4 };
36744
37678
  }
36745
37679
  };
36746
- __publicField(Index5, _a313, "MySqlIndex");
37680
+ __publicField(Index5, _a315, "MySqlIndex");
36747
37681
  }
36748
37682
  });
36749
37683
 
36750
37684
  // ../drizzle-orm/dist/mysql-core/primary-keys.js
36751
- var _a314, PrimaryKeyBuilder3, _a315, PrimaryKey3;
37685
+ var _a316, PrimaryKeyBuilder3, _a317, PrimaryKey3;
36752
37686
  var init_primary_keys3 = __esm({
36753
37687
  "../drizzle-orm/dist/mysql-core/primary-keys.js"() {
36754
37688
  "use strict";
36755
37689
  init_entity();
36756
37690
  init_table4();
36757
- _a314 = entityKind;
37691
+ _a316 = entityKind;
36758
37692
  PrimaryKeyBuilder3 = class {
36759
37693
  constructor(columns, name2) {
36760
37694
  /** @internal */
@@ -36769,8 +37703,8 @@ var init_primary_keys3 = __esm({
36769
37703
  return new PrimaryKey3(table4, this.columns, this.name);
36770
37704
  }
36771
37705
  };
36772
- __publicField(PrimaryKeyBuilder3, _a314, "MySqlPrimaryKeyBuilder");
36773
- _a315 = entityKind;
37706
+ __publicField(PrimaryKeyBuilder3, _a316, "MySqlPrimaryKeyBuilder");
37707
+ _a317 = entityKind;
36774
37708
  PrimaryKey3 = class {
36775
37709
  constructor(table4, columns, name2) {
36776
37710
  __publicField(this, "columns");
@@ -36783,7 +37717,7 @@ var init_primary_keys3 = __esm({
36783
37717
  return this.name ?? `${this.table[MySqlTable.Symbol.Name]}_${this.columns.map((column4) => column4.name).join("_")}_pk`;
36784
37718
  }
36785
37719
  };
36786
- __publicField(PrimaryKey3, _a315, "MySqlPrimaryKey");
37720
+ __publicField(PrimaryKey3, _a317, "MySqlPrimaryKey");
36787
37721
  }
36788
37722
  });
36789
37723
 
@@ -36803,7 +37737,7 @@ function mysqlViewWithSchema(name2, selection, schema4) {
36803
37737
  }
36804
37738
  return new ViewBuilder3(name2, schema4);
36805
37739
  }
36806
- var _a316, ViewBuilderCore2, _a317, _b229, ViewBuilder3, _a318, _b230, ManualViewBuilder3, _a319, _b231, _c10, MySqlView2;
37740
+ var _a318, ViewBuilderCore2, _a319, _b229, ViewBuilder3, _a320, _b230, ManualViewBuilder3, _a321, _b231, _c10, MySqlView2;
36807
37741
  var init_view3 = __esm({
36808
37742
  "../drizzle-orm/dist/mysql-core/view.js"() {
36809
37743
  "use strict";
@@ -36814,7 +37748,7 @@ var init_view3 = __esm({
36814
37748
  init_table4();
36815
37749
  init_view_base3();
36816
37750
  init_view_common3();
36817
- _a316 = entityKind;
37751
+ _a318 = entityKind;
36818
37752
  ViewBuilderCore2 = class {
36819
37753
  constructor(name2, schema4) {
36820
37754
  __publicField(this, "config", {});
@@ -36834,8 +37768,8 @@ var init_view3 = __esm({
36834
37768
  return this;
36835
37769
  }
36836
37770
  };
36837
- __publicField(ViewBuilderCore2, _a316, "MySqlViewBuilder");
36838
- ViewBuilder3 = class extends (_b229 = ViewBuilderCore2, _a317 = entityKind, _b229) {
37771
+ __publicField(ViewBuilderCore2, _a318, "MySqlViewBuilder");
37772
+ ViewBuilder3 = class extends (_b229 = ViewBuilderCore2, _a319 = entityKind, _b229) {
36839
37773
  as(qb) {
36840
37774
  if (typeof qb === "function") {
36841
37775
  qb = qb(new QueryBuilder3());
@@ -36861,8 +37795,8 @@ var init_view3 = __esm({
36861
37795
  );
36862
37796
  }
36863
37797
  };
36864
- __publicField(ViewBuilder3, _a317, "MySqlViewBuilder");
36865
- ManualViewBuilder3 = class extends (_b230 = ViewBuilderCore2, _a318 = entityKind, _b230) {
37798
+ __publicField(ViewBuilder3, _a319, "MySqlViewBuilder");
37799
+ ManualViewBuilder3 = class extends (_b230 = ViewBuilderCore2, _a320 = entityKind, _b230) {
36866
37800
  constructor(name2, columns, schema4) {
36867
37801
  super(name2, schema4);
36868
37802
  __publicField(this, "columns");
@@ -36907,11 +37841,11 @@ var init_view3 = __esm({
36907
37841
  );
36908
37842
  }
36909
37843
  };
36910
- __publicField(ManualViewBuilder3, _a318, "MySqlManualViewBuilder");
36911
- MySqlView2 = class extends (_c10 = MySqlViewBase, _b231 = entityKind, _a319 = MySqlViewConfig, _c10) {
37844
+ __publicField(ManualViewBuilder3, _a320, "MySqlManualViewBuilder");
37845
+ MySqlView2 = class extends (_c10 = MySqlViewBase, _b231 = entityKind, _a321 = MySqlViewConfig, _c10) {
36912
37846
  constructor({ mysqlConfig, config }) {
36913
37847
  super(config);
36914
- __publicField(this, _a319);
37848
+ __publicField(this, _a321);
36915
37849
  this[MySqlViewConfig] = mysqlConfig;
36916
37850
  }
36917
37851
  };
@@ -36920,14 +37854,14 @@ var init_view3 = __esm({
36920
37854
  });
36921
37855
 
36922
37856
  // ../drizzle-orm/dist/mysql-core/schema.js
36923
- var _a320, MySqlSchema5;
37857
+ var _a322, MySqlSchema5;
36924
37858
  var init_schema2 = __esm({
36925
37859
  "../drizzle-orm/dist/mysql-core/schema.js"() {
36926
37860
  "use strict";
36927
37861
  init_entity();
36928
37862
  init_table4();
36929
37863
  init_view3();
36930
- _a320 = entityKind;
37864
+ _a322 = entityKind;
36931
37865
  MySqlSchema5 = class {
36932
37866
  constructor(schemaName) {
36933
37867
  __publicField(this, "table", (name2, columns, extraConfig) => {
@@ -36939,12 +37873,12 @@ var init_schema2 = __esm({
36939
37873
  this.schemaName = schemaName;
36940
37874
  }
36941
37875
  };
36942
- __publicField(MySqlSchema5, _a320, "MySqlSchema");
37876
+ __publicField(MySqlSchema5, _a322, "MySqlSchema");
36943
37877
  }
36944
37878
  });
36945
37879
 
36946
37880
  // ../drizzle-orm/dist/mysql-core/session.js
36947
- var _a321, MySqlPreparedQuery, _a322, MySqlSession, _a323, _b232, MySqlTransaction;
37881
+ var _a323, MySqlPreparedQuery, _a324, MySqlSession, _a325, _b232, MySqlTransaction;
36948
37882
  var init_session3 = __esm({
36949
37883
  "../drizzle-orm/dist/mysql-core/session.js"() {
36950
37884
  "use strict";
@@ -36952,15 +37886,15 @@ var init_session3 = __esm({
36952
37886
  init_errors();
36953
37887
  init_sql();
36954
37888
  init_db3();
36955
- _a321 = entityKind;
37889
+ _a323 = entityKind;
36956
37890
  MySqlPreparedQuery = class {
36957
37891
  constructor() {
36958
37892
  /** @internal */
36959
37893
  __publicField(this, "joinsNotNullableMap");
36960
37894
  }
36961
37895
  };
36962
- __publicField(MySqlPreparedQuery, _a321, "MySqlPreparedQuery");
36963
- _a322 = entityKind;
37896
+ __publicField(MySqlPreparedQuery, _a323, "MySqlPreparedQuery");
37897
+ _a324 = entityKind;
36964
37898
  MySqlSession = class {
36965
37899
  constructor(dialect4) {
36966
37900
  this.dialect = dialect4;
@@ -36995,8 +37929,8 @@ var init_session3 = __esm({
36995
37929
  return parts.length ? sql`start transaction ${sql.raw(parts.join(" "))}` : void 0;
36996
37930
  }
36997
37931
  };
36998
- __publicField(MySqlSession, _a322, "MySqlSession");
36999
- MySqlTransaction = class extends (_b232 = MySqlDatabase, _a323 = entityKind, _b232) {
37932
+ __publicField(MySqlSession, _a324, "MySqlSession");
37933
+ MySqlTransaction = class extends (_b232 = MySqlDatabase, _a325 = entityKind, _b232) {
37000
37934
  constructor(dialect4, session, schema4, nestedIndex, mode) {
37001
37935
  super(dialect4, session, schema4, mode);
37002
37936
  this.schema = schema4;
@@ -37006,7 +37940,7 @@ var init_session3 = __esm({
37006
37940
  throw new TransactionRollbackError();
37007
37941
  }
37008
37942
  };
37009
- __publicField(MySqlTransaction, _a323, "MySqlTransaction");
37943
+ __publicField(MySqlTransaction, _a325, "MySqlTransaction");
37010
37944
  }
37011
37945
  });
37012
37946
 
@@ -37894,6 +38828,13 @@ var init_cli = __esm({
37894
38828
  breakpoints: booleanType().optional().default(true),
37895
38829
  migrations: objectType({
37896
38830
  prefix: prefix.optional().default("index")
38831
+ }).optional(),
38832
+ entities: objectType({
38833
+ roles: booleanType().or(objectType({
38834
+ provider: stringType().optional(),
38835
+ include: stringType().array().optional(),
38836
+ exclude: stringType().array().optional()
38837
+ })).optional().default(false)
37897
38838
  }).optional()
37898
38839
  }).passthrough();
37899
38840
  configCheck = objectType({
@@ -38160,6 +39101,7 @@ var init_pgImports = __esm({
38160
39101
  const enums = [];
38161
39102
  const schemas = [];
38162
39103
  const sequences = [];
39104
+ const roles = [];
38163
39105
  const views = [];
38164
39106
  const matViews = [];
38165
39107
  const i0values = Object.values(exports);
@@ -38183,8 +39125,11 @@ var init_pgImports = __esm({
38183
39125
  if (isPgSequence(t)) {
38184
39126
  sequences.push(t);
38185
39127
  }
39128
+ if (is(t, PgRole)) {
39129
+ roles.push(t);
39130
+ }
38186
39131
  });
38187
- return { tables, enums, schemas, sequences, views, matViews };
39132
+ return { tables, enums, schemas, sequences, views, matViews, roles };
38188
39133
  };
38189
39134
  }
38190
39135
  });
@@ -38590,7 +39535,7 @@ init_mjs();
38590
39535
  init_global();
38591
39536
  init_pgSerializer();
38592
39537
  init_views();
38593
- var pgPushIntrospect = async (db, filters, schemaFilters) => {
39538
+ var pgPushIntrospect = async (db, filters, schemaFilters, entities = { roles: true }) => {
38594
39539
  const matchers = filters.map((it) => {
38595
39540
  return new Minimatch(it);
38596
39541
  });
@@ -38618,7 +39563,7 @@ var pgPushIntrospect = async (db, filters, schemaFilters) => {
38618
39563
  );
38619
39564
  const res = await (0, import_hanji3.renderWithTask)(
38620
39565
  progress,
38621
- fromDatabase(db, filter2, schemaFilters)
39566
+ fromDatabase(db, filter2, schemaFilters, entities)
38622
39567
  );
38623
39568
  const schema4 = { id: originUUID, prevId: "", ...res };
38624
39569
  const { internal, ...schemaWithoutInternals } = schema4;
@@ -38788,17 +39733,11 @@ var pgSuggestions = async (db, statements) => {
38788
39733
  }
38789
39734
  const stmnt = fromJson([statement], "postgresql");
38790
39735
  if (typeof stmnt !== "undefined") {
38791
- if (statement.type === "drop_table") {
38792
- statementsToExecute.push(
38793
- `DROP TABLE ${concatSchemaAndTableName(statement.schema, statement.tableName)} CASCADE;`
38794
- );
38795
- } else {
38796
- statementsToExecute.push(...stmnt);
38797
- }
39736
+ statementsToExecute.push(...stmnt);
38798
39737
  }
38799
39738
  }
38800
39739
  return {
38801
- statementsToExecute,
39740
+ statementsToExecute: [...new Set(statementsToExecute)],
38802
39741
  shouldAskForApprove,
38803
39742
  infoToPrint,
38804
39743
  matViewsToRemove: [...new Set(matViewsToRemove)],
@@ -39044,6 +39983,7 @@ var generateDrizzleJson = (imports, prevId, schemaFilters, casing2) => {
39044
39983
  prepared.enums,
39045
39984
  prepared.schemas,
39046
39985
  prepared.sequences,
39986
+ prepared.roles,
39047
39987
  prepared.views,
39048
39988
  prepared.matViews,
39049
39989
  casing2,
@@ -39067,6 +40007,8 @@ var generateMigration = async (prev, cur) => {
39067
40007
  schemasResolver,
39068
40008
  enumsResolver,
39069
40009
  sequencesResolver,
40010
+ policyResolver,
40011
+ roleResolver,
39070
40012
  tablesResolver,
39071
40013
  columnsResolver,
39072
40014
  viewsResolver,
@@ -39100,6 +40042,8 @@ var pushSchema = async (imports, drizzleInstance, schemaFilters) => {
39100
40042
  schemasResolver,
39101
40043
  enumsResolver,
39102
40044
  sequencesResolver,
40045
+ policyResolver,
40046
+ roleResolver,
39103
40047
  tablesResolver,
39104
40048
  columnsResolver,
39105
40049
  viewsResolver,