drizzle-kit 0.26.2-31c8041 → 0.26.2-4b200a2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/api.mjs CHANGED
@@ -554,184 +554,6 @@ var init_source = __esm({
554
554
  }
555
555
  });
556
556
 
557
- // ../drizzle-orm/dist/entity.js
558
- function is(value, type) {
559
- if (!value || typeof value !== "object") {
560
- return false;
561
- }
562
- if (value instanceof type) {
563
- return true;
564
- }
565
- if (!Object.prototype.hasOwnProperty.call(type, entityKind)) {
566
- throw new Error(
567
- `Class "${type.name ?? "<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`
568
- );
569
- }
570
- let cls = Object.getPrototypeOf(value).constructor;
571
- if (cls) {
572
- while (cls) {
573
- if (entityKind in cls && cls[entityKind] === type[entityKind]) {
574
- return true;
575
- }
576
- cls = Object.getPrototypeOf(cls);
577
- }
578
- }
579
- return false;
580
- }
581
- var entityKind, hasOwnEntityKind;
582
- var init_entity = __esm({
583
- "../drizzle-orm/dist/entity.js"() {
584
- "use strict";
585
- entityKind = Symbol.for("drizzle:entityKind");
586
- hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
587
- }
588
- });
589
-
590
- // ../drizzle-orm/dist/table.utils.js
591
- var TableName;
592
- var init_table_utils = __esm({
593
- "../drizzle-orm/dist/table.utils.js"() {
594
- "use strict";
595
- TableName = Symbol.for("drizzle:Name");
596
- }
597
- });
598
-
599
- // ../drizzle-orm/dist/table.js
600
- function isTable(table4) {
601
- return typeof table4 === "object" && table4 !== null && IsDrizzleTable in table4;
602
- }
603
- function getTableName(table4) {
604
- return table4[TableName];
605
- }
606
- function getTableUniqueName(table4) {
607
- return `${table4[Schema] ?? "public"}.${table4[TableName]}`;
608
- }
609
- var Schema, Columns, ExtraConfigColumns, OriginalName, BaseName, IsAlias, ExtraConfigBuilder, IsDrizzleTable, _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, Table;
610
- var init_table = __esm({
611
- "../drizzle-orm/dist/table.js"() {
612
- "use strict";
613
- init_entity();
614
- init_table_utils();
615
- Schema = Symbol.for("drizzle:Schema");
616
- Columns = Symbol.for("drizzle:Columns");
617
- ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
618
- OriginalName = Symbol.for("drizzle:OriginalName");
619
- BaseName = Symbol.for("drizzle:BaseName");
620
- IsAlias = Symbol.for("drizzle:IsAlias");
621
- ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
622
- IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
623
- _j = entityKind, _i = TableName, _h = OriginalName, _g = Schema, _f = Columns, _e = ExtraConfigColumns, _d = BaseName, _c = IsAlias, _b = IsDrizzleTable, _a = ExtraConfigBuilder;
624
- Table = class {
625
- constructor(name2, schema4, baseName) {
626
- /**
627
- * @internal
628
- * Can be changed if the table is aliased.
629
- */
630
- __publicField(this, _i);
631
- /**
632
- * @internal
633
- * Used to store the original name of the table, before any aliasing.
634
- */
635
- __publicField(this, _h);
636
- /** @internal */
637
- __publicField(this, _g);
638
- /** @internal */
639
- __publicField(this, _f);
640
- /** @internal */
641
- __publicField(this, _e);
642
- /**
643
- * @internal
644
- * Used to store the table name before the transformation via the `tableCreator` functions.
645
- */
646
- __publicField(this, _d);
647
- /** @internal */
648
- __publicField(this, _c, false);
649
- /** @internal */
650
- __publicField(this, _b, true);
651
- /** @internal */
652
- __publicField(this, _a);
653
- this[TableName] = this[OriginalName] = name2;
654
- this[Schema] = schema4;
655
- this[BaseName] = baseName;
656
- }
657
- };
658
- __publicField(Table, _j, "Table");
659
- /** @internal */
660
- __publicField(Table, "Symbol", {
661
- Name: TableName,
662
- Schema,
663
- OriginalName,
664
- Columns,
665
- ExtraConfigColumns,
666
- BaseName,
667
- IsAlias,
668
- ExtraConfigBuilder
669
- });
670
- }
671
- });
672
-
673
- // ../drizzle-orm/dist/casing.js
674
- function toSnakeCase(input) {
675
- const words = input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? [];
676
- return words.map((word) => word.toLowerCase()).join("_");
677
- }
678
- function toCamelCase(input) {
679
- const words = input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? [];
680
- return words.reduce((acc, word, i) => {
681
- const formattedWord = i === 0 ? word.toLowerCase() : `${word[0].toUpperCase()}${word.slice(1)}`;
682
- return acc + formattedWord;
683
- }, "");
684
- }
685
- function noopCase(input) {
686
- return input;
687
- }
688
- var _a2, CasingCache;
689
- var init_casing = __esm({
690
- "../drizzle-orm/dist/casing.js"() {
691
- "use strict";
692
- init_entity();
693
- init_table();
694
- _a2 = entityKind;
695
- CasingCache = class {
696
- constructor(casing2) {
697
- /** @internal */
698
- __publicField(this, "cache", {});
699
- __publicField(this, "cachedTables", {});
700
- __publicField(this, "convert");
701
- this.convert = casing2 === "snake_case" ? toSnakeCase : casing2 === "camelCase" ? toCamelCase : noopCase;
702
- }
703
- getColumnCasing(column4) {
704
- if (!column4.keyAsName)
705
- return column4.name;
706
- const schema4 = column4.table[Table.Symbol.Schema] ?? "public";
707
- const tableName = column4.table[Table.Symbol.OriginalName];
708
- const key = `${schema4}.${tableName}.${column4.name}`;
709
- if (!this.cache[key]) {
710
- this.cacheTable(column4.table);
711
- }
712
- return this.cache[key];
713
- }
714
- cacheTable(table4) {
715
- const schema4 = table4[Table.Symbol.Schema] ?? "public";
716
- const tableName = table4[Table.Symbol.OriginalName];
717
- const tableKey2 = `${schema4}.${tableName}`;
718
- if (!this.cachedTables[tableKey2]) {
719
- for (const column4 of Object.values(table4[Table.Symbol.Columns])) {
720
- const columnKey = `${tableKey2}.${column4.name}`;
721
- this.cache[columnKey] = this.convert(column4.name);
722
- }
723
- this.cachedTables[tableKey2] = true;
724
- }
725
- }
726
- clearCache() {
727
- this.cache = {};
728
- this.cachedTables = {};
729
- }
730
- };
731
- __publicField(CasingCache, _a2, "CasingCache");
732
- }
733
- });
734
-
735
557
  // ../node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/old.js
736
558
  var require_old = __commonJS({
737
559
  "../node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/old.js"(exports) {
@@ -7727,7 +7549,7 @@ var init_vector = __esm({
7727
7549
  });
7728
7550
 
7729
7551
  // src/serializer/pgSchema.ts
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;
7552
+ 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, policySquashed, 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
7553
  var init_pgSchema = __esm({
7732
7554
  "src/serializer/pgSchema.ts"() {
7733
7555
  "use strict";
@@ -7938,7 +7760,12 @@ var init_pgSchema = __esm({
7938
7760
  for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
7939
7761
  to: stringType().array().optional(),
7940
7762
  using: stringType().optional(),
7941
- withCheck: stringType().optional()
7763
+ withCheck: stringType().optional(),
7764
+ on: stringType().optional()
7765
+ }).strict();
7766
+ policySquashed = objectType({
7767
+ name: stringType(),
7768
+ values: stringType()
7942
7769
  }).strict();
7943
7770
  viewWithOption = objectType({
7944
7771
  checkOption: enumType(["local", "cascaded"]).optional(),
@@ -8118,6 +7945,7 @@ var init_pgSchema = __esm({
8118
7945
  views: recordType(stringType(), view2).default({}),
8119
7946
  sequences: recordType(stringType(), sequenceSchema).default({}),
8120
7947
  roles: recordType(stringType(), roleSchema).default({}),
7948
+ policies: recordType(stringType(), policy).default({}),
8121
7949
  _meta: objectType({
8122
7950
  schemas: recordType(stringType(), stringType()),
8123
7951
  tables: recordType(stringType(), stringType()),
@@ -8166,7 +7994,8 @@ var init_pgSchema = __esm({
8166
7994
  schemas: recordType(stringType(), stringType()),
8167
7995
  views: recordType(stringType(), view2),
8168
7996
  sequences: recordType(stringType(), sequenceSquashed),
8169
- roles: recordType(stringType(), roleSchema).default({})
7997
+ roles: recordType(stringType(), roleSchema).default({}),
7998
+ policies: recordType(stringType(), policySquashed).default({})
8170
7999
  }).strict();
8171
8000
  pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
8172
8001
  pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
@@ -8249,22 +8078,23 @@ var init_pgSchema = __esm({
8249
8078
  squashFK: (fk4) => {
8250
8079
  return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${fk4.onUpdate ?? ""};${fk4.onDelete ?? ""};${fk4.schemaTo || "public"}`;
8251
8080
  },
8252
- squashPolicy: (policy2) => {
8253
- return `${policy2.name}--${policy2.as}--${policy2.for}--${policy2.to?.join(",")}--${policy2.using}--${policy2.withCheck}`;
8081
+ squashPolicy: (policy4) => {
8082
+ return `${policy4.name}--${policy4.as}--${policy4.for}--${policy4.to?.join(",")}--${policy4.using}--${policy4.withCheck}--${policy4.on}`;
8254
8083
  },
8255
- unsquashPolicy: (policy2) => {
8256
- const splitted = policy2.split("--");
8084
+ unsquashPolicy: (policy4) => {
8085
+ const splitted = policy4.split("--");
8257
8086
  return {
8258
8087
  name: splitted[0],
8259
8088
  as: splitted[1],
8260
8089
  for: splitted[2],
8261
8090
  to: splitted[3].split(","),
8262
8091
  using: splitted[4] !== "undefined" ? splitted[4] : void 0,
8263
- withCheck: splitted[5] !== "undefined" ? splitted[5] : void 0
8092
+ withCheck: splitted[5] !== "undefined" ? splitted[5] : void 0,
8093
+ on: splitted[6] !== "undefined" ? splitted[6] : void 0
8264
8094
  };
8265
8095
  },
8266
- squashPolicyPush: (policy2) => {
8267
- return `${policy2.name}--${policy2.as}--${policy2.for}--${policy2.to?.join(",")}`;
8096
+ squashPolicyPush: (policy4) => {
8097
+ return `${policy4.name}--${policy4.as}--${policy4.for}--${policy4.to?.join(",")}--${policy4.on}`;
8268
8098
  },
8269
8099
  squashPK: (pk) => {
8270
8100
  return `${pk.columns.join(",")};${pk.name}`;
@@ -8378,8 +8208,8 @@ var init_pgSchema = __esm({
8378
8208
  return PgSquasher.squashUnique(unq);
8379
8209
  }
8380
8210
  );
8381
- const squashedPolicies = mapValues(it[1].policies, (policy2) => {
8382
- return action === "push" ? PgSquasher.squashPolicyPush(policy2) : PgSquasher.squashPolicy(policy2);
8211
+ const squashedPolicies = mapValues(it[1].policies, (policy4) => {
8212
+ return action === "push" ? PgSquasher.squashPolicyPush(policy4) : PgSquasher.squashPolicy(policy4);
8383
8213
  });
8384
8214
  const squashedChecksContraints = mapValues(
8385
8215
  it[1].checkConstraints,
@@ -8416,6 +8246,17 @@ var init_pgSchema = __esm({
8416
8246
  ];
8417
8247
  })
8418
8248
  );
8249
+ const mappedPolicies = Object.fromEntries(
8250
+ Object.entries(json3.policies).map((it) => {
8251
+ return [
8252
+ it[0],
8253
+ {
8254
+ name: it[1].name,
8255
+ values: action === "push" ? PgSquasher.squashPolicyPush(it[1]) : PgSquasher.squashPolicy(it[1])
8256
+ }
8257
+ ];
8258
+ })
8259
+ );
8419
8260
  return {
8420
8261
  version: "7",
8421
8262
  dialect: json3.dialect,
@@ -8423,6 +8264,7 @@ var init_pgSchema = __esm({
8423
8264
  enums: json3.enums,
8424
8265
  schemas: json3.schemas,
8425
8266
  views: json3.views,
8267
+ policies: mappedPolicies,
8426
8268
  sequences: mappedSequences,
8427
8269
  roles: json3.roles
8428
8270
  };
@@ -8435,6 +8277,8 @@ var init_pgSchema = __esm({
8435
8277
  tables: {},
8436
8278
  enums: {},
8437
8279
  schemas: {},
8280
+ policies: {},
8281
+ roles: {},
8438
8282
  sequences: {},
8439
8283
  _meta: {
8440
8284
  schemas: {},
@@ -8753,15 +8597,10 @@ function findAddedAndRemoved(columnNames1, columnNames2) {
8753
8597
  const removedColumns = columnNames1.filter((it) => !set2.has(it));
8754
8598
  return { addedColumns, removedColumns };
8755
8599
  }
8756
- function getColumnCasing(column4, casing2) {
8757
- if (!column4.name) return "";
8758
- return !column4.keyAsName || casing2 === void 0 ? column4.name : casing2 === "camelCase" ? toCamelCase(column4.name) : toSnakeCase(column4.name);
8759
- }
8760
8600
  var copy, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey;
8761
8601
  var init_utils = __esm({
8762
8602
  "src/utils.ts"() {
8763
8603
  "use strict";
8764
- init_casing();
8765
8604
  init_views();
8766
8605
  init_global();
8767
8606
  init_mysqlSchema();
@@ -9053,27 +8892,12 @@ Is ${source_default.bold.blue(
9053
8892
  });
9054
8893
 
9055
8894
  // src/serializer/index.ts
9056
- var glob, sqlToStr;
8895
+ var glob;
9057
8896
  var init_serializer = __esm({
9058
8897
  "src/serializer/index.ts"() {
9059
8898
  "use strict";
9060
- init_casing();
9061
8899
  glob = __toESM(require_glob());
9062
8900
  init_views();
9063
- sqlToStr = (sql2, casing2) => {
9064
- return sql2.toQuery({
9065
- escapeName: () => {
9066
- throw new Error("we don't support params for `sql` default values");
9067
- },
9068
- escapeParam: () => {
9069
- throw new Error("we don't support params for `sql` default values");
9070
- },
9071
- escapeString: () => {
9072
- throw new Error("we don't support params for `sql` default values");
9073
- },
9074
- casing: new CasingCache(casing2)
9075
- }).sql;
9076
- };
9077
8901
  }
9078
8902
  });
9079
8903
 
@@ -11431,6 +11255,14 @@ function diffSchemasOrTables(left, right) {
11431
11255
  const deleted = result.filter((it) => it[0].endsWith("__deleted")).map((it) => it[1]);
11432
11256
  return { added, deleted };
11433
11257
  }
11258
+ function diffIndPolicies(left, right) {
11259
+ left = JSON.parse(JSON.stringify(left));
11260
+ right = JSON.parse(JSON.stringify(right));
11261
+ const result = Object.entries((0, import_json_diff.diff)(left, right) ?? {});
11262
+ const added = result.filter((it) => it[0].endsWith("__added")).map((it) => it[1]);
11263
+ const deleted = result.filter((it) => it[0].endsWith("__deleted")).map((it) => it[1]);
11264
+ return { added, deleted };
11265
+ }
11434
11266
  function diffColumns(left, right) {
11435
11267
  left = JSON.parse(JSON.stringify(left));
11436
11268
  right = JSON.parse(JSON.stringify(right));
@@ -11503,6 +11335,7 @@ function applyJsonDiff(json1, json22) {
11503
11335
  difference.enums = difference.enums || {};
11504
11336
  difference.sequences = difference.sequences || {};
11505
11337
  difference.roles = difference.roles || {};
11338
+ difference.policies = difference.policies || {};
11506
11339
  difference.views = difference.views || {};
11507
11340
  const schemaKeys = Object.keys(difference.schemas);
11508
11341
  for (let key of schemaKeys) {
@@ -11563,6 +11396,10 @@ function applyJsonDiff(json1, json22) {
11563
11396
  const alteredRoles = rolesEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted"))).map((it) => {
11564
11397
  return json22.roles[it[0]];
11565
11398
  });
11399
+ const policiesEntries = Object.entries(difference.policies);
11400
+ const alteredPolicies = policiesEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted"))).map((it) => {
11401
+ return json22.policies[it[0]];
11402
+ });
11566
11403
  const viewsEntries = Object.entries(difference.views);
11567
11404
  const alteredViews = viewsEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted"))).map(
11568
11405
  ([nameWithSchema, view4]) => {
@@ -11637,7 +11474,8 @@ function applyJsonDiff(json1, json22) {
11637
11474
  alteredEnums,
11638
11475
  alteredSequences,
11639
11476
  alteredRoles,
11640
- alteredViews
11477
+ alteredViews,
11478
+ alteredPolicies
11641
11479
  };
11642
11480
  }
11643
11481
  var import_json_diff, mapArraysDiff, findAlternationsInTable, alternationsInColumn;
@@ -12094,7 +11932,7 @@ function fromJson(statements, dialect4, action, json22) {
12094
11932
  }).filter((it) => it !== "");
12095
11933
  return result;
12096
11934
  }
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;
11935
+ var pgNativeTypes, isPgNativeType, Convertor, PgCreateRoleConvertor, PgDropRoleConvertor, PgRenameRoleConvertor, PgAlterRoleConvertor, PgCreatePolicyConvertor, PgDropPolicyConvertor, PgRenamePolicyConvertor, PgAlterPolicyConvertor, PgCreateIndPolicyConvertor, PgDropIndPolicyConvertor, PgRenameIndPolicyConvertor, PgAlterIndPolicyConvertor, 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;
12098
11936
  var init_sqlgenerator = __esm({
12099
11937
  "src/sqlgenerator.ts"() {
12100
11938
  "use strict";
@@ -12187,14 +12025,14 @@ var init_sqlgenerator = __esm({
12187
12025
  return statement.type === "create_policy" && dialect4 === "postgresql";
12188
12026
  }
12189
12027
  convert(statement) {
12190
- const policy2 = statement.data;
12028
+ const policy4 = statement.data;
12191
12029
  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(
12030
+ const usingPart = policy4.using ? ` USING (${policy4.using})` : "";
12031
+ const withCheckPart = policy4.withCheck ? ` WITH CHECK (${policy4.withCheck})` : "";
12032
+ const policyToPart = policy4.to?.map(
12195
12033
  (v) => ["current_user", "current_role", "session_user", "public"].includes(v) ? v : `"${v}"`
12196
12034
  ).join(", ");
12197
- return `CREATE POLICY "${policy2.name}" ON ${tableNameWithSchema} AS ${policy2.as?.toUpperCase()} FOR ${policy2.for?.toUpperCase()} TO ${policyToPart}${usingPart}${withCheckPart};`;
12035
+ return `CREATE POLICY "${policy4.name}" ON ${tableNameWithSchema} AS ${policy4.as?.toUpperCase()} FOR ${policy4.for?.toUpperCase()} TO ${policyToPart}${usingPart}${withCheckPart};`;
12198
12036
  }
12199
12037
  };
12200
12038
  PgDropPolicyConvertor = class extends Convertor {
@@ -12202,9 +12040,9 @@ var init_sqlgenerator = __esm({
12202
12040
  return statement.type === "drop_policy" && dialect4 === "postgresql";
12203
12041
  }
12204
12042
  convert(statement) {
12205
- const policy2 = statement.data;
12043
+ const policy4 = statement.data;
12206
12044
  const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12207
- return `DROP POLICY "${policy2.name}" ON ${tableNameWithSchema} CASCADE;`;
12045
+ return `DROP POLICY "${policy4.name}" ON ${tableNameWithSchema} CASCADE;`;
12208
12046
  }
12209
12047
  };
12210
12048
  PgRenamePolicyConvertor = class extends Convertor {
@@ -12229,6 +12067,49 @@ var init_sqlgenerator = __esm({
12229
12067
  return `ALTER POLICY "${oldPolicy.name}" ON ${tableNameWithSchema} TO ${newPolicy.to}${usingPart}${withCheckPart};`;
12230
12068
  }
12231
12069
  };
12070
+ PgCreateIndPolicyConvertor = class extends Convertor {
12071
+ can(statement, dialect4) {
12072
+ return statement.type === "create_ind_policy" && dialect4 === "postgresql";
12073
+ }
12074
+ convert(statement) {
12075
+ const policy4 = statement.data;
12076
+ const usingPart = policy4.using ? ` USING (${policy4.using})` : "";
12077
+ const withCheckPart = policy4.withCheck ? ` WITH CHECK (${policy4.withCheck})` : "";
12078
+ const policyToPart = policy4.to?.map(
12079
+ (v) => ["current_user", "current_role", "session_user", "public"].includes(v) ? v : `"${v}"`
12080
+ ).join(", ");
12081
+ return `CREATE POLICY "${policy4.name}" ON ${policy4.on} AS ${policy4.as?.toUpperCase()} FOR ${policy4.for?.toUpperCase()} TO ${policyToPart}${usingPart}${withCheckPart};`;
12082
+ }
12083
+ };
12084
+ PgDropIndPolicyConvertor = class extends Convertor {
12085
+ can(statement, dialect4) {
12086
+ return statement.type === "drop_ind_policy" && dialect4 === "postgresql";
12087
+ }
12088
+ convert(statement) {
12089
+ const policy4 = statement.data;
12090
+ return `DROP POLICY "${policy4.name}" ON ${policy4.on} CASCADE;`;
12091
+ }
12092
+ };
12093
+ PgRenameIndPolicyConvertor = class extends Convertor {
12094
+ can(statement, dialect4) {
12095
+ return statement.type === "rename_ind_policy" && dialect4 === "postgresql";
12096
+ }
12097
+ convert(statement) {
12098
+ return `ALTER POLICY "${statement.oldName}" ON ${statement.tableKey} RENAME TO "${statement.newName}";`;
12099
+ }
12100
+ };
12101
+ PgAlterIndPolicyConvertor = class extends Convertor {
12102
+ can(statement, dialect4) {
12103
+ return statement.type === "alter_ind_policy" && dialect4 === "postgresql";
12104
+ }
12105
+ convert(statement) {
12106
+ const newPolicy = statement.newData;
12107
+ const oldPolicy = statement.oldData;
12108
+ const usingPart = newPolicy.using ? ` USING (${newPolicy.using})` : oldPolicy.using ? ` USING (${oldPolicy.using})` : "";
12109
+ const withCheckPart = newPolicy.withCheck ? ` WITH CHECK (${newPolicy.withCheck})` : oldPolicy.withCheck ? ` WITH CHECK (${oldPolicy.withCheck})` : "";
12110
+ return `ALTER POLICY "${oldPolicy.name}" ON ${oldPolicy.on} TO ${newPolicy.to}${usingPart}${withCheckPart};`;
12111
+ }
12112
+ };
12232
12113
  PgEnableRlsConvertor = class extends Convertor {
12233
12114
  can(statement, dialect4) {
12234
12115
  return statement.type === "enable_rls" && dialect4 === "postgresql";
@@ -14120,6 +14001,10 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
14120
14001
  convertors.push(new PgCreatePolicyConvertor());
14121
14002
  convertors.push(new PgDropPolicyConvertor());
14122
14003
  convertors.push(new PgRenamePolicyConvertor());
14004
+ convertors.push(new PgAlterIndPolicyConvertor());
14005
+ convertors.push(new PgCreateIndPolicyConvertor());
14006
+ convertors.push(new PgDropIndPolicyConvertor());
14007
+ convertors.push(new PgRenameIndPolicyConvertor());
14123
14008
  convertors.push(new PgEnableRlsConvertor());
14124
14009
  convertors.push(new PgDisableRlsConvertor());
14125
14010
  convertors.push(new PgDropRoleConvertor());
@@ -14425,7 +14310,7 @@ var init_sqlitePushUtils = __esm({
14425
14310
  });
14426
14311
 
14427
14312
  // src/jsonStatements.ts
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;
14313
+ 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, prepareRenameIndPolicyJsons, prepareCreatePolicyJsons, prepareCreateIndPolicyJsons, prepareDropPolicyJsons, prepareDropIndPolicyJsons, prepareAlterPolicyJson, prepareAlterIndPolicyJson, 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;
14429
14314
  var init_jsonStatements = __esm({
14430
14315
  "src/jsonStatements.ts"() {
14431
14316
  "use strict";
@@ -15550,6 +15435,16 @@ var init_jsonStatements = __esm({
15550
15435
  };
15551
15436
  });
15552
15437
  };
15438
+ prepareRenameIndPolicyJsons = (renames) => {
15439
+ return renames.map((it) => {
15440
+ return {
15441
+ type: "rename_ind_policy",
15442
+ tableKey: it.from.on,
15443
+ oldName: it.from.name,
15444
+ newName: it.to.name
15445
+ };
15446
+ });
15447
+ };
15553
15448
  prepareCreatePolicyJsons = (tableName, schema4, policies) => {
15554
15449
  return policies.map((it) => {
15555
15450
  return {
@@ -15560,6 +15455,15 @@ var init_jsonStatements = __esm({
15560
15455
  };
15561
15456
  });
15562
15457
  };
15458
+ prepareCreateIndPolicyJsons = (policies) => {
15459
+ return policies.map((it) => {
15460
+ return {
15461
+ type: "create_ind_policy",
15462
+ tableName: it.on,
15463
+ data: it
15464
+ };
15465
+ });
15466
+ };
15563
15467
  prepareDropPolicyJsons = (tableName, schema4, policies) => {
15564
15468
  return policies.map((it) => {
15565
15469
  return {
@@ -15570,6 +15474,15 @@ var init_jsonStatements = __esm({
15570
15474
  };
15571
15475
  });
15572
15476
  };
15477
+ prepareDropIndPolicyJsons = (policies) => {
15478
+ return policies.map((it) => {
15479
+ return {
15480
+ type: "drop_ind_policy",
15481
+ tableName: it.on,
15482
+ data: it
15483
+ };
15484
+ });
15485
+ };
15573
15486
  prepareAlterPolicyJson = (tableName, schema4, oldPolicy, newPolicy) => {
15574
15487
  return {
15575
15488
  type: "alter_policy",
@@ -15579,6 +15492,13 @@ var init_jsonStatements = __esm({
15579
15492
  schema: schema4
15580
15493
  };
15581
15494
  };
15495
+ prepareAlterIndPolicyJson = (oldPolicy, newPolicy) => {
15496
+ return {
15497
+ type: "alter_ind_policy",
15498
+ oldData: oldPolicy,
15499
+ newData: newPolicy
15500
+ };
15501
+ };
15582
15502
  preparePgCreateIndexesJson = (tableName, schema4, indexes, fullSchema, action) => {
15583
15503
  if (action === "push") {
15584
15504
  return Object.values(indexes).map((indexData) => {
@@ -16520,6 +16440,7 @@ var init_snapshotsDiffer = __esm({
16520
16440
  alteredEnums: changedEnumSchema.array(),
16521
16441
  alteredSequences: sequenceSquashed.array(),
16522
16442
  alteredRoles: roleSchema.array(),
16443
+ alteredPolicies: policySquashed.array(),
16523
16444
  alteredViews: alteredPgViewSchema.array()
16524
16445
  }).strict();
16525
16446
  diffResultSchemeMysql = objectType({
@@ -16577,7 +16498,7 @@ var init_snapshotsDiffer = __esm({
16577
16498
  }
16578
16499
  return column4;
16579
16500
  };
16580
- applyPgSnapshotsDiff = async (json1, json22, schemasResolver2, enumsResolver2, sequencesResolver2, policyResolver2, roleResolver2, tablesResolver2, columnsResolver2, viewsResolver2, prevFull, curFull, action) => {
16501
+ applyPgSnapshotsDiff = async (json1, json22, schemasResolver2, enumsResolver2, sequencesResolver2, policyResolver2, indPolicyResolver2, roleResolver2, tablesResolver2, columnsResolver2, viewsResolver2, prevFull, curFull, action) => {
16581
16502
  const schemasDiff = diffSchemasOrTables(json1.schemas, json22.schemas);
16582
16503
  const {
16583
16504
  created: createdSchemas,
@@ -16794,24 +16715,24 @@ var init_snapshotsDiffer = __esm({
16794
16715
  const columnCreates = [];
16795
16716
  const columnDeletes = [];
16796
16717
  for (let entry of Object.values(res)) {
16797
- const { renamed, created, deleted } = await columnsResolver2({
16718
+ const { renamed, created: created2, deleted: deleted2 } = await columnsResolver2({
16798
16719
  tableName: entry.name,
16799
16720
  schema: entry.schema,
16800
16721
  deleted: entry.columns.deleted,
16801
16722
  created: entry.columns.added
16802
16723
  });
16803
- if (created.length > 0) {
16724
+ if (created2.length > 0) {
16804
16725
  columnCreates.push({
16805
16726
  table: entry.name,
16806
16727
  schema: entry.schema,
16807
- columns: created
16728
+ columns: created2
16808
16729
  });
16809
16730
  }
16810
- if (deleted.length > 0) {
16731
+ if (deleted2.length > 0) {
16811
16732
  columnDeletes.push({
16812
16733
  table: entry.name,
16813
16734
  schema: entry.schema,
16814
- columns: deleted
16735
+ columns: deleted2
16815
16736
  });
16816
16737
  }
16817
16738
  if (renamed.length > 0) {
@@ -16851,24 +16772,24 @@ var init_snapshotsDiffer = __esm({
16851
16772
  const policyCreates = [];
16852
16773
  const policyDeletes = [];
16853
16774
  for (let entry of Object.values(policyRes)) {
16854
- const { renamed, created, deleted } = await policyResolver2({
16775
+ const { renamed, created: created2, deleted: deleted2 } = await policyResolver2({
16855
16776
  tableName: entry.name,
16856
16777
  schema: entry.schema,
16857
16778
  deleted: entry.policies.deleted.map(PgSquasher.unsquashPolicy),
16858
16779
  created: entry.policies.added.map(PgSquasher.unsquashPolicy)
16859
16780
  });
16860
- if (created.length > 0) {
16781
+ if (created2.length > 0) {
16861
16782
  policyCreates.push({
16862
16783
  table: entry.name,
16863
16784
  schema: entry.schema,
16864
- columns: created
16785
+ columns: created2
16865
16786
  });
16866
16787
  }
16867
- if (deleted.length > 0) {
16788
+ if (deleted2.length > 0) {
16868
16789
  policyDeletes.push({
16869
16790
  table: entry.name,
16870
16791
  schema: entry.schema,
16871
- columns: deleted
16792
+ columns: deleted2
16872
16793
  });
16873
16794
  }
16874
16795
  if (renamed.length > 0) {
@@ -16892,12 +16813,12 @@ var init_snapshotsDiffer = __esm({
16892
16813
  (tableKey2, tableValue) => {
16893
16814
  const patchedPolicies = mapKeys(
16894
16815
  tableValue.policies,
16895
- (policyKey, policy2) => {
16816
+ (policyKey, policy4) => {
16896
16817
  const rens = policyRenamesDict[`${tableValue.schema || "public"}.${tableValue.name}`] || [];
16897
16818
  const newName = columnChangeFor(policyKey, rens);
16898
- const unsquashedPolicy = PgSquasher.unsquashPolicy(policy2);
16819
+ const unsquashedPolicy = PgSquasher.unsquashPolicy(policy4);
16899
16820
  unsquashedPolicy.name = newName;
16900
- policy2 = PgSquasher.squashPolicy(unsquashedPolicy);
16821
+ policy4 = PgSquasher.squashPolicy(unsquashedPolicy);
16901
16822
  return newName;
16902
16823
  }
16903
16824
  );
@@ -16905,7 +16826,46 @@ var init_snapshotsDiffer = __esm({
16905
16826
  return [tableKey2, tableValue];
16906
16827
  }
16907
16828
  );
16908
- const viewsDiff = diffSchemasOrTables(policyPatchedSnap1.views, json22.views);
16829
+ const indPolicyRes = diffIndPolicies(policyPatchedSnap1.policies, json22.policies);
16830
+ const indPolicyCreates = [];
16831
+ const indPolicyDeletes = [];
16832
+ const { renamed: indPolicyRenames, created, deleted } = await indPolicyResolver2({
16833
+ deleted: indPolicyRes.deleted.map((t) => PgSquasher.unsquashPolicy(t.values)),
16834
+ created: indPolicyRes.added.map((t) => PgSquasher.unsquashPolicy(t.values))
16835
+ });
16836
+ if (created.length > 0) {
16837
+ indPolicyCreates.push({
16838
+ policies: created
16839
+ });
16840
+ }
16841
+ if (deleted.length > 0) {
16842
+ indPolicyDeletes.push({
16843
+ policies: deleted
16844
+ });
16845
+ }
16846
+ const indPolicyRenamesDict = indPolicyRenames.reduce(
16847
+ (acc, it) => {
16848
+ acc[it.from.name] = {
16849
+ nameFrom: it.from.name,
16850
+ nameTo: it.to.name
16851
+ };
16852
+ return acc;
16853
+ },
16854
+ {}
16855
+ );
16856
+ const indPolicyPatchedSnap1 = copy(policyPatchedSnap1);
16857
+ indPolicyPatchedSnap1.policies = mapEntries(
16858
+ indPolicyPatchedSnap1.policies,
16859
+ (policyKey, policyValue) => {
16860
+ const key = policyKey;
16861
+ const change = indPolicyRenamesDict[key];
16862
+ if (change) {
16863
+ policyValue.name = change.nameTo;
16864
+ }
16865
+ return [policyKey, policyValue];
16866
+ }
16867
+ );
16868
+ const viewsDiff = diffSchemasOrTables(indPolicyPatchedSnap1.views, json22.views);
16909
16869
  const {
16910
16870
  created: createdViews,
16911
16871
  deleted: deletedViews,
@@ -17046,16 +17006,16 @@ var init_snapshotsDiffer = __esm({
17046
17006
  );
17047
17007
  if (it.alteredUniqueConstraints) {
17048
17008
  const added = {};
17049
- const deleted = {};
17009
+ const deleted2 = {};
17050
17010
  for (const k of Object.keys(it.alteredUniqueConstraints)) {
17051
17011
  added[k] = it.alteredUniqueConstraints[k].__new;
17052
- deleted[k] = it.alteredUniqueConstraints[k].__old;
17012
+ deleted2[k] = it.alteredUniqueConstraints[k].__old;
17053
17013
  }
17054
17014
  addedUniqueConstraints.push(
17055
17015
  ...prepareAddUniqueConstraintPg(it.name, it.schema, added)
17056
17016
  );
17057
17017
  deletedUniqueConstraints.push(
17058
- ...prepareDeleteUniqueConstraintPg(it.name, it.schema, deleted)
17018
+ ...prepareDeleteUniqueConstraintPg(it.name, it.schema, deleted2)
17059
17019
  );
17060
17020
  }
17061
17021
  createCheckConstraints = prepareAddCheckConstraint(it.name, it.schema, it.addedCheckConstraints);
@@ -17066,13 +17026,13 @@ var init_snapshotsDiffer = __esm({
17066
17026
  );
17067
17027
  if (it.alteredCheckConstraints && action !== "push") {
17068
17028
  const added = {};
17069
- const deleted = {};
17029
+ const deleted2 = {};
17070
17030
  for (const k of Object.keys(it.alteredCheckConstraints)) {
17071
17031
  added[k] = it.alteredCheckConstraints[k].__new;
17072
- deleted[k] = it.alteredCheckConstraints[k].__old;
17032
+ deleted2[k] = it.alteredCheckConstraints[k].__old;
17073
17033
  }
17074
17034
  createCheckConstraints.push(...prepareAddCheckConstraint(it.name, it.schema, added));
17075
- deleteCheckConstraints.push(...prepareDeleteCheckConstraint(it.name, it.schema, deleted));
17035
+ deleteCheckConstraints.push(...prepareDeleteCheckConstraint(it.name, it.schema, deleted2));
17076
17036
  }
17077
17037
  jsonCreatedCheckConstraints.push(...createCheckConstraints);
17078
17038
  jsonDeletedCheckConstraints.push(...deleteCheckConstraints);
@@ -17120,8 +17080,68 @@ var init_snapshotsDiffer = __esm({
17120
17080
  const jsonDropPoliciesStatements = [];
17121
17081
  const jsonAlterPoliciesStatements = [];
17122
17082
  const jsonRenamePoliciesStatements = [];
17083
+ const jsonRenameIndPoliciesStatements = [];
17084
+ const jsonCreateIndPoliciesStatements = [];
17085
+ const jsonDropIndPoliciesStatements = [];
17086
+ const jsonAlterIndPoliciesStatements = [];
17123
17087
  const jsonEnableRLSStatements = [];
17124
17088
  const jsonDisableRLSStatements = [];
17089
+ for (let it of indPolicyRenames) {
17090
+ jsonRenameIndPoliciesStatements.push(
17091
+ ...prepareRenameIndPolicyJsons([it])
17092
+ );
17093
+ }
17094
+ for (const it of indPolicyCreates) {
17095
+ jsonCreateIndPoliciesStatements.push(
17096
+ ...prepareCreateIndPolicyJsons(
17097
+ it.policies
17098
+ )
17099
+ );
17100
+ }
17101
+ for (const it of indPolicyDeletes) {
17102
+ jsonDropIndPoliciesStatements.push(
17103
+ ...prepareDropIndPolicyJsons(
17104
+ it.policies
17105
+ )
17106
+ );
17107
+ }
17108
+ typedResult.alteredPolicies.forEach(({ values }) => {
17109
+ const policy4 = PgSquasher.unsquashPolicy(values);
17110
+ const newPolicy = PgSquasher.unsquashPolicy(json22.policies[policy4.name].values);
17111
+ const oldPolicy = PgSquasher.unsquashPolicy(json1.policies[policy4.name].values);
17112
+ if (newPolicy.as !== oldPolicy.as) {
17113
+ jsonDropIndPoliciesStatements.push(
17114
+ ...prepareDropIndPolicyJsons(
17115
+ [oldPolicy]
17116
+ )
17117
+ );
17118
+ jsonCreateIndPoliciesStatements.push(
17119
+ ...prepareCreateIndPolicyJsons(
17120
+ [newPolicy]
17121
+ )
17122
+ );
17123
+ return;
17124
+ }
17125
+ if (newPolicy.for !== oldPolicy.for) {
17126
+ jsonDropIndPoliciesStatements.push(
17127
+ ...prepareDropIndPolicyJsons(
17128
+ [oldPolicy]
17129
+ )
17130
+ );
17131
+ jsonCreateIndPoliciesStatements.push(
17132
+ ...prepareCreateIndPolicyJsons(
17133
+ [newPolicy]
17134
+ )
17135
+ );
17136
+ return;
17137
+ }
17138
+ jsonAlterIndPoliciesStatements.push(
17139
+ prepareAlterIndPolicyJson(
17140
+ oldPolicy,
17141
+ newPolicy
17142
+ )
17143
+ );
17144
+ });
17125
17145
  for (let it of policyRenames) {
17126
17146
  jsonRenamePoliciesStatements.push(
17127
17147
  ...prepareRenamePolicyJsons(it.table, it.schema, it.renames)
@@ -17509,6 +17529,10 @@ var init_snapshotsDiffer = __esm({
17509
17529
  jsonStatements.push(...jsonDropPoliciesStatements);
17510
17530
  jsonStatements.push(...jsonCreatePoliciesStatements);
17511
17531
  jsonStatements.push(...jsonAlterPoliciesStatements);
17532
+ jsonStatements.push(...jsonRenameIndPoliciesStatements);
17533
+ jsonStatements.push(...jsonDropIndPoliciesStatements);
17534
+ jsonStatements.push(...jsonCreateIndPoliciesStatements);
17535
+ jsonStatements.push(...jsonAlterIndPoliciesStatements);
17512
17536
  jsonStatements.push(...createViews);
17513
17537
  jsonStatements.push(...dropEnums);
17514
17538
  jsonStatements.push(...dropSequences);
@@ -18901,7 +18925,7 @@ var init_outputs = __esm({
18901
18925
  });
18902
18926
 
18903
18927
  // src/cli/commands/migrate.ts
18904
- var import_hanji2, schemasResolver, tablesResolver, viewsResolver, mySqlViewsResolver, sqliteViewsResolver, sequencesResolver, roleResolver, policyResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedConflict, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT;
18928
+ var import_hanji2, schemasResolver, tablesResolver, viewsResolver, mySqlViewsResolver, sqliteViewsResolver, sequencesResolver, roleResolver, policyResolver, indPolicyResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedConflict, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT;
18905
18929
  var init_migrate = __esm({
18906
18930
  "src/cli/commands/migrate.ts"() {
18907
18931
  "use strict";
@@ -19044,6 +19068,18 @@ var init_migrate = __esm({
19044
19068
  renamed: result.renamed
19045
19069
  };
19046
19070
  };
19071
+ indPolicyResolver = async (input) => {
19072
+ const result = await promptNamedConflict(
19073
+ input.created,
19074
+ input.deleted,
19075
+ "policy"
19076
+ );
19077
+ return {
19078
+ created: result.created,
19079
+ deleted: result.deleted,
19080
+ renamed: result.renamed
19081
+ };
19082
+ };
19047
19083
  enumsResolver = async (input) => {
19048
19084
  try {
19049
19085
  const { created, deleted, moved, renamed } = await promptNamedWithSchemasConflict(
@@ -20359,13 +20395,46 @@ var init_mjs = __esm({
20359
20395
  }
20360
20396
  });
20361
20397
 
20398
+ // ../drizzle-orm/dist/entity.js
20399
+ function is(value, type) {
20400
+ if (!value || typeof value !== "object") {
20401
+ return false;
20402
+ }
20403
+ if (value instanceof type) {
20404
+ return true;
20405
+ }
20406
+ if (!Object.prototype.hasOwnProperty.call(type, entityKind)) {
20407
+ throw new Error(
20408
+ `Class "${type.name ?? "<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`
20409
+ );
20410
+ }
20411
+ let cls = Object.getPrototypeOf(value).constructor;
20412
+ if (cls) {
20413
+ while (cls) {
20414
+ if (entityKind in cls && cls[entityKind] === type[entityKind]) {
20415
+ return true;
20416
+ }
20417
+ cls = Object.getPrototypeOf(cls);
20418
+ }
20419
+ }
20420
+ return false;
20421
+ }
20422
+ var entityKind, hasOwnEntityKind;
20423
+ var init_entity = __esm({
20424
+ "../drizzle-orm/dist/entity.js"() {
20425
+ "use strict";
20426
+ entityKind = Symbol.for("drizzle:entityKind");
20427
+ hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
20428
+ }
20429
+ });
20430
+
20362
20431
  // ../drizzle-orm/dist/column.js
20363
- var _a3, Column2;
20432
+ var _a, Column2;
20364
20433
  var init_column = __esm({
20365
20434
  "../drizzle-orm/dist/column.js"() {
20366
20435
  "use strict";
20367
20436
  init_entity();
20368
- _a3 = entityKind;
20437
+ _a = entityKind;
20369
20438
  Column2 = class {
20370
20439
  constructor(table4, config) {
20371
20440
  __publicField(this, "name");
@@ -20414,17 +20483,17 @@ var init_column = __esm({
20414
20483
  return this.config.generated !== void 0 && this.config.generated.type !== "byDefault";
20415
20484
  }
20416
20485
  };
20417
- __publicField(Column2, _a3, "Column");
20486
+ __publicField(Column2, _a, "Column");
20418
20487
  }
20419
20488
  });
20420
20489
 
20421
20490
  // ../drizzle-orm/dist/column-builder.js
20422
- var _a4, ColumnBuilder;
20491
+ var _a2, ColumnBuilder;
20423
20492
  var init_column_builder = __esm({
20424
20493
  "../drizzle-orm/dist/column-builder.js"() {
20425
20494
  "use strict";
20426
20495
  init_entity();
20427
- _a4 = entityKind;
20496
+ _a2 = entityKind;
20428
20497
  ColumnBuilder = class {
20429
20498
  constructor(name2, dataType, columnType) {
20430
20499
  __publicField(this, "config");
@@ -20526,18 +20595,27 @@ var init_column_builder = __esm({
20526
20595
  this.config.name = name2;
20527
20596
  }
20528
20597
  };
20529
- __publicField(ColumnBuilder, _a4, "ColumnBuilder");
20598
+ __publicField(ColumnBuilder, _a2, "ColumnBuilder");
20599
+ }
20600
+ });
20601
+
20602
+ // ../drizzle-orm/dist/table.utils.js
20603
+ var TableName;
20604
+ var init_table_utils = __esm({
20605
+ "../drizzle-orm/dist/table.utils.js"() {
20606
+ "use strict";
20607
+ TableName = Symbol.for("drizzle:Name");
20530
20608
  }
20531
20609
  });
20532
20610
 
20533
20611
  // ../drizzle-orm/dist/pg-core/foreign-keys.js
20534
- var _a5, ForeignKeyBuilder, _a6, ForeignKey;
20612
+ var _a3, ForeignKeyBuilder, _a4, ForeignKey;
20535
20613
  var init_foreign_keys = __esm({
20536
20614
  "../drizzle-orm/dist/pg-core/foreign-keys.js"() {
20537
20615
  "use strict";
20538
20616
  init_entity();
20539
20617
  init_table_utils();
20540
- _a5 = entityKind;
20618
+ _a3 = entityKind;
20541
20619
  ForeignKeyBuilder = class {
20542
20620
  constructor(config, actions) {
20543
20621
  /** @internal */
@@ -20568,8 +20646,8 @@ var init_foreign_keys = __esm({
20568
20646
  return new ForeignKey(table4, this);
20569
20647
  }
20570
20648
  };
20571
- __publicField(ForeignKeyBuilder, _a5, "PgForeignKeyBuilder");
20572
- _a6 = entityKind;
20649
+ __publicField(ForeignKeyBuilder, _a3, "PgForeignKeyBuilder");
20650
+ _a4 = entityKind;
20573
20651
  ForeignKey = class {
20574
20652
  constructor(table4, builder) {
20575
20653
  __publicField(this, "reference");
@@ -20593,7 +20671,7 @@ var init_foreign_keys = __esm({
20593
20671
  return name2 ?? `${chunks.join("_")}_fk`;
20594
20672
  }
20595
20673
  };
20596
- __publicField(ForeignKey, _a6, "PgForeignKey");
20674
+ __publicField(ForeignKey, _a4, "PgForeignKey");
20597
20675
  }
20598
20676
  });
20599
20677
 
@@ -20611,13 +20689,13 @@ var init_tracing_utils = __esm({
20611
20689
  function uniqueKeyName(table4, columns) {
20612
20690
  return `${table4[TableName]}_${columns.join("_")}_unique`;
20613
20691
  }
20614
- var _a7, UniqueConstraintBuilder, _a8, UniqueOnConstraintBuilder, _a9, UniqueConstraint;
20692
+ var _a5, UniqueConstraintBuilder, _a6, UniqueOnConstraintBuilder, _a7, UniqueConstraint;
20615
20693
  var init_unique_constraint = __esm({
20616
20694
  "../drizzle-orm/dist/pg-core/unique-constraint.js"() {
20617
20695
  "use strict";
20618
20696
  init_entity();
20619
20697
  init_table_utils();
20620
- _a7 = entityKind;
20698
+ _a5 = entityKind;
20621
20699
  UniqueConstraintBuilder = class {
20622
20700
  constructor(columns, name2) {
20623
20701
  /** @internal */
@@ -20636,8 +20714,8 @@ var init_unique_constraint = __esm({
20636
20714
  return new UniqueConstraint(table4, this.columns, this.nullsNotDistinctConfig, this.name);
20637
20715
  }
20638
20716
  };
20639
- __publicField(UniqueConstraintBuilder, _a7, "PgUniqueConstraintBuilder");
20640
- _a8 = entityKind;
20717
+ __publicField(UniqueConstraintBuilder, _a5, "PgUniqueConstraintBuilder");
20718
+ _a6 = entityKind;
20641
20719
  UniqueOnConstraintBuilder = class {
20642
20720
  constructor(name2) {
20643
20721
  /** @internal */
@@ -20648,8 +20726,8 @@ var init_unique_constraint = __esm({
20648
20726
  return new UniqueConstraintBuilder(columns, this.name);
20649
20727
  }
20650
20728
  };
20651
- __publicField(UniqueOnConstraintBuilder, _a8, "PgUniqueOnConstraintBuilder");
20652
- _a9 = entityKind;
20729
+ __publicField(UniqueOnConstraintBuilder, _a6, "PgUniqueOnConstraintBuilder");
20730
+ _a7 = entityKind;
20653
20731
  UniqueConstraint = class {
20654
20732
  constructor(table4, columns, nullsNotDistinct, name2) {
20655
20733
  __publicField(this, "columns");
@@ -20664,7 +20742,7 @@ var init_unique_constraint = __esm({
20664
20742
  return this.name;
20665
20743
  }
20666
20744
  };
20667
- __publicField(UniqueConstraint, _a9, "PgUniqueConstraint");
20745
+ __publicField(UniqueConstraint, _a7, "PgUniqueConstraint");
20668
20746
  }
20669
20747
  });
20670
20748
 
@@ -20750,7 +20828,7 @@ var init_array = __esm({
20750
20828
  });
20751
20829
 
20752
20830
  // ../drizzle-orm/dist/pg-core/columns/common.js
20753
- var _a10, _b2, PgColumnBuilder, _a11, _b3, PgColumn, _a12, _b4, ExtraConfigColumn, _a13, IndexedColumn, _a14, _b5, PgArrayBuilder, _a15, _b6, _PgArray, PgArray;
20831
+ var _a8, _b, PgColumnBuilder, _a9, _b2, PgColumn, _a10, _b3, ExtraConfigColumn, _a11, IndexedColumn, _a12, _b4, PgArrayBuilder, _a13, _b5, _PgArray, PgArray;
20754
20832
  var init_common2 = __esm({
20755
20833
  "../drizzle-orm/dist/pg-core/columns/common.js"() {
20756
20834
  "use strict";
@@ -20761,7 +20839,7 @@ var init_common2 = __esm({
20761
20839
  init_tracing_utils();
20762
20840
  init_unique_constraint();
20763
20841
  init_array();
20764
- PgColumnBuilder = class extends (_b2 = ColumnBuilder, _a10 = entityKind, _b2) {
20842
+ PgColumnBuilder = class extends (_b = ColumnBuilder, _a8 = entityKind, _b) {
20765
20843
  constructor() {
20766
20844
  super(...arguments);
20767
20845
  __publicField(this, "foreignKeyConfigs", []);
@@ -20814,8 +20892,8 @@ var init_common2 = __esm({
20814
20892
  return new ExtraConfigColumn(table4, this.config);
20815
20893
  }
20816
20894
  };
20817
- __publicField(PgColumnBuilder, _a10, "PgColumnBuilder");
20818
- PgColumn = class extends (_b3 = Column2, _a11 = entityKind, _b3) {
20895
+ __publicField(PgColumnBuilder, _a8, "PgColumnBuilder");
20896
+ PgColumn = class extends (_b2 = Column2, _a9 = entityKind, _b2) {
20819
20897
  constructor(table4, config) {
20820
20898
  if (!config.uniqueName) {
20821
20899
  config.uniqueName = uniqueKeyName(table4, [config.name]);
@@ -20824,8 +20902,8 @@ var init_common2 = __esm({
20824
20902
  this.table = table4;
20825
20903
  }
20826
20904
  };
20827
- __publicField(PgColumn, _a11, "PgColumn");
20828
- ExtraConfigColumn = class extends (_b4 = PgColumn, _a12 = entityKind, _b4) {
20905
+ __publicField(PgColumn, _a9, "PgColumn");
20906
+ ExtraConfigColumn = class extends (_b3 = PgColumn, _a10 = entityKind, _b3) {
20829
20907
  constructor() {
20830
20908
  super(...arguments);
20831
20909
  __publicField(this, "indexConfig", {
@@ -20892,8 +20970,8 @@ var init_common2 = __esm({
20892
20970
  return this;
20893
20971
  }
20894
20972
  };
20895
- __publicField(ExtraConfigColumn, _a12, "ExtraConfigColumn");
20896
- _a13 = entityKind;
20973
+ __publicField(ExtraConfigColumn, _a10, "ExtraConfigColumn");
20974
+ _a11 = entityKind;
20897
20975
  IndexedColumn = class {
20898
20976
  constructor(name2, keyAsName, type, indexConfig) {
20899
20977
  __publicField(this, "name");
@@ -20906,8 +20984,8 @@ var init_common2 = __esm({
20906
20984
  this.indexConfig = indexConfig;
20907
20985
  }
20908
20986
  };
20909
- __publicField(IndexedColumn, _a13, "IndexedColumn");
20910
- PgArrayBuilder = class extends (_b5 = PgColumnBuilder, _a14 = entityKind, _b5) {
20987
+ __publicField(IndexedColumn, _a11, "IndexedColumn");
20988
+ PgArrayBuilder = class extends (_b4 = PgColumnBuilder, _a12 = entityKind, _b4) {
20911
20989
  constructor(name2, baseBuilder, size) {
20912
20990
  super(name2, "array", "PgArray");
20913
20991
  this.config.baseBuilder = baseBuilder;
@@ -20923,8 +21001,8 @@ var init_common2 = __esm({
20923
21001
  );
20924
21002
  }
20925
21003
  };
20926
- __publicField(PgArrayBuilder, _a14, "PgArrayBuilder");
20927
- _PgArray = class _PgArray extends (_b6 = PgColumn, _a15 = entityKind, _b6) {
21004
+ __publicField(PgArrayBuilder, _a12, "PgArrayBuilder");
21005
+ _PgArray = class _PgArray extends (_b5 = PgColumn, _a13 = entityKind, _b5) {
20928
21006
  constructor(table4, config, baseColumn, range) {
20929
21007
  super(table4, config);
20930
21008
  __publicField(this, "size");
@@ -20950,7 +21028,7 @@ var init_common2 = __esm({
20950
21028
  return makePgArray(a);
20951
21029
  }
20952
21030
  };
20953
- __publicField(_PgArray, _a15, "PgArray");
21031
+ __publicField(_PgArray, _a13, "PgArray");
20954
21032
  PgArray = _PgArray;
20955
21033
  }
20956
21034
  });
@@ -20971,14 +21049,14 @@ function pgEnumWithSchema(enumName, values, schema4) {
20971
21049
  );
20972
21050
  return enumInstance;
20973
21051
  }
20974
- var isPgEnumSym, _a16, _b7, PgEnumColumnBuilder, _a17, _b8, PgEnumColumn;
21052
+ var isPgEnumSym, _a14, _b6, PgEnumColumnBuilder, _a15, _b7, PgEnumColumn;
20975
21053
  var init_enum = __esm({
20976
21054
  "../drizzle-orm/dist/pg-core/columns/enum.js"() {
20977
21055
  "use strict";
20978
21056
  init_entity();
20979
21057
  init_common2();
20980
21058
  isPgEnumSym = Symbol.for("drizzle:isPgEnum");
20981
- PgEnumColumnBuilder = class extends (_b7 = PgColumnBuilder, _a16 = entityKind, _b7) {
21059
+ PgEnumColumnBuilder = class extends (_b6 = PgColumnBuilder, _a14 = entityKind, _b6) {
20982
21060
  constructor(name2, enumInstance) {
20983
21061
  super(name2, "string", "PgEnumColumn");
20984
21062
  this.config.enum = enumInstance;
@@ -20991,8 +21069,8 @@ var init_enum = __esm({
20991
21069
  );
20992
21070
  }
20993
21071
  };
20994
- __publicField(PgEnumColumnBuilder, _a16, "PgEnumColumnBuilder");
20995
- PgEnumColumn = class extends (_b8 = PgColumn, _a17 = entityKind, _b8) {
21072
+ __publicField(PgEnumColumnBuilder, _a14, "PgEnumColumnBuilder");
21073
+ PgEnumColumn = class extends (_b7 = PgColumn, _a15 = entityKind, _b7) {
20996
21074
  constructor(table4, config) {
20997
21075
  super(table4, config);
20998
21076
  __publicField(this, "enum", this.config.enum);
@@ -21003,17 +21081,17 @@ var init_enum = __esm({
21003
21081
  return this.enum.enumName;
21004
21082
  }
21005
21083
  };
21006
- __publicField(PgEnumColumn, _a17, "PgEnumColumn");
21084
+ __publicField(PgEnumColumn, _a15, "PgEnumColumn");
21007
21085
  }
21008
21086
  });
21009
21087
 
21010
21088
  // ../drizzle-orm/dist/subquery.js
21011
- var _a18, Subquery, _a19, _b9, WithSubquery;
21089
+ var _a16, Subquery, _a17, _b8, WithSubquery;
21012
21090
  var init_subquery = __esm({
21013
21091
  "../drizzle-orm/dist/subquery.js"() {
21014
21092
  "use strict";
21015
21093
  init_entity();
21016
- _a18 = entityKind;
21094
+ _a16 = entityKind;
21017
21095
  Subquery = class {
21018
21096
  constructor(sql2, selection, alias, isWith = false) {
21019
21097
  this._ = {
@@ -21028,10 +21106,10 @@ var init_subquery = __esm({
21028
21106
  // return new SQL([this]);
21029
21107
  // }
21030
21108
  };
21031
- __publicField(Subquery, _a18, "Subquery");
21032
- WithSubquery = class extends (_b9 = Subquery, _a19 = entityKind, _b9) {
21109
+ __publicField(Subquery, _a16, "Subquery");
21110
+ WithSubquery = class extends (_b8 = Subquery, _a17 = entityKind, _b8) {
21033
21111
  };
21034
- __publicField(WithSubquery, _a19, "WithSubquery");
21112
+ __publicField(WithSubquery, _a17, "WithSubquery");
21035
21113
  }
21036
21114
  });
21037
21115
 
@@ -21094,6 +21172,80 @@ var init_view_common = __esm({
21094
21172
  }
21095
21173
  });
21096
21174
 
21175
+ // ../drizzle-orm/dist/table.js
21176
+ function isTable(table4) {
21177
+ return typeof table4 === "object" && table4 !== null && IsDrizzleTable in table4;
21178
+ }
21179
+ function getTableName(table4) {
21180
+ return table4[TableName];
21181
+ }
21182
+ function getTableUniqueName(table4) {
21183
+ return `${table4[Schema] ?? "public"}.${table4[TableName]}`;
21184
+ }
21185
+ var Schema, Columns, ExtraConfigColumns, OriginalName, BaseName, IsAlias, ExtraConfigBuilder, IsDrizzleTable, _a18, _b9, _c, _d, _e, _f, _g, _h, _i, _j, Table2;
21186
+ var init_table = __esm({
21187
+ "../drizzle-orm/dist/table.js"() {
21188
+ "use strict";
21189
+ init_entity();
21190
+ init_table_utils();
21191
+ Schema = Symbol.for("drizzle:Schema");
21192
+ Columns = Symbol.for("drizzle:Columns");
21193
+ ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
21194
+ OriginalName = Symbol.for("drizzle:OriginalName");
21195
+ BaseName = Symbol.for("drizzle:BaseName");
21196
+ IsAlias = Symbol.for("drizzle:IsAlias");
21197
+ ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
21198
+ IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
21199
+ _j = entityKind, _i = TableName, _h = OriginalName, _g = Schema, _f = Columns, _e = ExtraConfigColumns, _d = BaseName, _c = IsAlias, _b9 = IsDrizzleTable, _a18 = ExtraConfigBuilder;
21200
+ Table2 = class {
21201
+ constructor(name2, schema4, baseName) {
21202
+ /**
21203
+ * @internal
21204
+ * Can be changed if the table is aliased.
21205
+ */
21206
+ __publicField(this, _i);
21207
+ /**
21208
+ * @internal
21209
+ * Used to store the original name of the table, before any aliasing.
21210
+ */
21211
+ __publicField(this, _h);
21212
+ /** @internal */
21213
+ __publicField(this, _g);
21214
+ /** @internal */
21215
+ __publicField(this, _f);
21216
+ /** @internal */
21217
+ __publicField(this, _e);
21218
+ /**
21219
+ * @internal
21220
+ * Used to store the table name before the transformation via the `tableCreator` functions.
21221
+ */
21222
+ __publicField(this, _d);
21223
+ /** @internal */
21224
+ __publicField(this, _c, false);
21225
+ /** @internal */
21226
+ __publicField(this, _b9, true);
21227
+ /** @internal */
21228
+ __publicField(this, _a18);
21229
+ this[TableName] = this[OriginalName] = name2;
21230
+ this[Schema] = schema4;
21231
+ this[BaseName] = baseName;
21232
+ }
21233
+ };
21234
+ __publicField(Table2, _j, "Table");
21235
+ /** @internal */
21236
+ __publicField(Table2, "Symbol", {
21237
+ Name: TableName,
21238
+ Schema,
21239
+ OriginalName,
21240
+ Columns,
21241
+ ExtraConfigColumns,
21242
+ BaseName,
21243
+ IsAlias,
21244
+ ExtraConfigBuilder
21245
+ });
21246
+ }
21247
+ });
21248
+
21097
21249
  // ../drizzle-orm/dist/sql/sql.js
21098
21250
  function isSQLWrapper(value) {
21099
21251
  return value !== null && value !== void 0 && typeof value.getSQL === "function";
@@ -21151,7 +21303,7 @@ function fillPlaceholders(params, values) {
21151
21303
  return p;
21152
21304
  });
21153
21305
  }
21154
- var _a20, FakePrimitiveParam, _a21, StringChunk, _a22, _SQL, SQL, _a23, Name, noopDecoder, noopEncoder, noopMapper, _a24, Param, _a25, Placeholder, _a26, _b10, View3;
21306
+ var _a19, FakePrimitiveParam, _a20, StringChunk, _a21, _SQL, SQL, _a22, Name, noopDecoder, noopEncoder, noopMapper, _a23, Param, _a24, Placeholder, _a25, _b10, View3;
21155
21307
  var init_sql = __esm({
21156
21308
  "../drizzle-orm/dist/sql/sql.js"() {
21157
21309
  "use strict";
@@ -21162,11 +21314,11 @@ var init_sql = __esm({
21162
21314
  init_view_common();
21163
21315
  init_column();
21164
21316
  init_table();
21165
- _a20 = entityKind;
21317
+ _a19 = entityKind;
21166
21318
  FakePrimitiveParam = class {
21167
21319
  };
21168
- __publicField(FakePrimitiveParam, _a20, "FakePrimitiveParam");
21169
- _a21 = entityKind;
21320
+ __publicField(FakePrimitiveParam, _a19, "FakePrimitiveParam");
21321
+ _a20 = entityKind;
21170
21322
  StringChunk = class {
21171
21323
  constructor(value) {
21172
21324
  __publicField(this, "value");
@@ -21176,8 +21328,8 @@ var init_sql = __esm({
21176
21328
  return new SQL([this]);
21177
21329
  }
21178
21330
  };
21179
- __publicField(StringChunk, _a21, "StringChunk");
21180
- _a22 = entityKind;
21331
+ __publicField(StringChunk, _a20, "StringChunk");
21332
+ _a21 = entityKind;
21181
21333
  _SQL = class _SQL {
21182
21334
  constructor(queryChunks) {
21183
21335
  /** @internal */
@@ -21239,9 +21391,9 @@ var init_sql = __esm({
21239
21391
  inlineParams: inlineParams || chunk.shouldInlineParams
21240
21392
  });
21241
21393
  }
21242
- if (is(chunk, Table)) {
21243
- const schemaName = chunk[Table.Symbol.Schema];
21244
- const tableName = chunk[Table.Symbol.Name];
21394
+ if (is(chunk, Table2)) {
21395
+ const schemaName = chunk[Table2.Symbol.Schema];
21396
+ const tableName = chunk[Table2.Symbol.Name];
21245
21397
  return {
21246
21398
  sql: schemaName === void 0 ? escapeName(tableName) : escapeName(schemaName) + "." + escapeName(tableName),
21247
21399
  params: []
@@ -21252,7 +21404,7 @@ var init_sql = __esm({
21252
21404
  if (_config.invokeSource === "indexes") {
21253
21405
  return { sql: escapeName(columnName), params: [] };
21254
21406
  }
21255
- return { sql: escapeName(chunk.table[Table.Symbol.Name]) + "." + escapeName(columnName), params: [] };
21407
+ return { sql: escapeName(chunk.table[Table2.Symbol.Name]) + "." + escapeName(columnName), params: [] };
21256
21408
  }
21257
21409
  if (is(chunk, View3)) {
21258
21410
  const schemaName = chunk[ViewBaseConfig].schema;
@@ -21364,9 +21516,9 @@ var init_sql = __esm({
21364
21516
  return condition ? this : void 0;
21365
21517
  }
21366
21518
  };
21367
- __publicField(_SQL, _a22, "SQL");
21519
+ __publicField(_SQL, _a21, "SQL");
21368
21520
  SQL = _SQL;
21369
- _a23 = entityKind;
21521
+ _a22 = entityKind;
21370
21522
  Name = class {
21371
21523
  constructor(value) {
21372
21524
  __publicField(this, "brand");
@@ -21376,7 +21528,7 @@ var init_sql = __esm({
21376
21528
  return new SQL([this]);
21377
21529
  }
21378
21530
  };
21379
- __publicField(Name, _a23, "Name");
21531
+ __publicField(Name, _a22, "Name");
21380
21532
  noopDecoder = {
21381
21533
  mapFromDriverValue: (value) => value
21382
21534
  };
@@ -21387,7 +21539,7 @@ var init_sql = __esm({
21387
21539
  ...noopDecoder,
21388
21540
  ...noopEncoder
21389
21541
  };
21390
- _a24 = entityKind;
21542
+ _a23 = entityKind;
21391
21543
  Param = class {
21392
21544
  /**
21393
21545
  * @param value - Parameter value
@@ -21402,7 +21554,7 @@ var init_sql = __esm({
21402
21554
  return new SQL([this]);
21403
21555
  }
21404
21556
  };
21405
- __publicField(Param, _a24, "Param");
21557
+ __publicField(Param, _a23, "Param");
21406
21558
  ((sql2) => {
21407
21559
  function empty() {
21408
21560
  return new SQL([]);
@@ -21462,7 +21614,7 @@ var init_sql = __esm({
21462
21614
  let Aliased = _Aliased;
21463
21615
  SQL2.Aliased = Aliased;
21464
21616
  })(SQL || (SQL = {}));
21465
- _a25 = entityKind;
21617
+ _a24 = entityKind;
21466
21618
  Placeholder = class {
21467
21619
  constructor(name2) {
21468
21620
  this.name = name2;
@@ -21471,12 +21623,12 @@ var init_sql = __esm({
21471
21623
  return new SQL([this]);
21472
21624
  }
21473
21625
  };
21474
- __publicField(Placeholder, _a25, "Placeholder");
21475
- _b10 = entityKind, _a26 = ViewBaseConfig;
21626
+ __publicField(Placeholder, _a24, "Placeholder");
21627
+ _b10 = entityKind, _a25 = ViewBaseConfig;
21476
21628
  View3 = class {
21477
21629
  constructor({ name: name2, schema: schema4, selectedFields, query }) {
21478
21630
  /** @internal */
21479
- __publicField(this, _a26);
21631
+ __publicField(this, _a25);
21480
21632
  this[ViewBaseConfig] = {
21481
21633
  name: name2,
21482
21634
  originalName: name2,
@@ -21495,7 +21647,7 @@ var init_sql = __esm({
21495
21647
  Column2.prototype.getSQL = function() {
21496
21648
  return new SQL([this]);
21497
21649
  };
21498
- Table.prototype.getSQL = function() {
21650
+ Table2.prototype.getSQL = function() {
21499
21651
  return new SQL([this]);
21500
21652
  };
21501
21653
  Subquery.prototype.getSQL = function() {
@@ -21534,7 +21686,7 @@ function mapColumnsInSQLToAlias(query, alias) {
21534
21686
  return c;
21535
21687
  }));
21536
21688
  }
21537
- var _a27, ColumnAliasProxyHandler, _a28, TableAliasProxyHandler, _a29, RelationTableAliasProxyHandler;
21689
+ var _a26, ColumnAliasProxyHandler, _a27, TableAliasProxyHandler, _a28, RelationTableAliasProxyHandler;
21538
21690
  var init_alias = __esm({
21539
21691
  "../drizzle-orm/dist/alias.js"() {
21540
21692
  "use strict";
@@ -21543,7 +21695,7 @@ var init_alias = __esm({
21543
21695
  init_sql();
21544
21696
  init_table();
21545
21697
  init_view_common();
21546
- _a27 = entityKind;
21698
+ _a26 = entityKind;
21547
21699
  ColumnAliasProxyHandler = class {
21548
21700
  constructor(table4) {
21549
21701
  this.table = table4;
@@ -21555,21 +21707,21 @@ var init_alias = __esm({
21555
21707
  return columnObj[prop];
21556
21708
  }
21557
21709
  };
21558
- __publicField(ColumnAliasProxyHandler, _a27, "ColumnAliasProxyHandler");
21559
- _a28 = entityKind;
21710
+ __publicField(ColumnAliasProxyHandler, _a26, "ColumnAliasProxyHandler");
21711
+ _a27 = entityKind;
21560
21712
  TableAliasProxyHandler = class {
21561
21713
  constructor(alias, replaceOriginalName) {
21562
21714
  this.alias = alias;
21563
21715
  this.replaceOriginalName = replaceOriginalName;
21564
21716
  }
21565
21717
  get(target, prop) {
21566
- if (prop === Table.Symbol.IsAlias) {
21718
+ if (prop === Table2.Symbol.IsAlias) {
21567
21719
  return true;
21568
21720
  }
21569
- if (prop === Table.Symbol.Name) {
21721
+ if (prop === Table2.Symbol.Name) {
21570
21722
  return this.alias;
21571
21723
  }
21572
- if (this.replaceOriginalName && prop === Table.Symbol.OriginalName) {
21724
+ if (this.replaceOriginalName && prop === Table2.Symbol.OriginalName) {
21573
21725
  return this.alias;
21574
21726
  }
21575
21727
  if (prop === ViewBaseConfig) {
@@ -21579,8 +21731,8 @@ var init_alias = __esm({
21579
21731
  isAlias: true
21580
21732
  };
21581
21733
  }
21582
- if (prop === Table.Symbol.Columns) {
21583
- const columns = target[Table.Symbol.Columns];
21734
+ if (prop === Table2.Symbol.Columns) {
21735
+ const columns = target[Table2.Symbol.Columns];
21584
21736
  if (!columns) {
21585
21737
  return columns;
21586
21738
  }
@@ -21600,8 +21752,8 @@ var init_alias = __esm({
21600
21752
  return value;
21601
21753
  }
21602
21754
  };
21603
- __publicField(TableAliasProxyHandler, _a28, "TableAliasProxyHandler");
21604
- _a29 = entityKind;
21755
+ __publicField(TableAliasProxyHandler, _a27, "TableAliasProxyHandler");
21756
+ _a28 = entityKind;
21605
21757
  RelationTableAliasProxyHandler = class {
21606
21758
  constructor(alias) {
21607
21759
  this.alias = alias;
@@ -21613,36 +21765,36 @@ var init_alias = __esm({
21613
21765
  return target[prop];
21614
21766
  }
21615
21767
  };
21616
- __publicField(RelationTableAliasProxyHandler, _a29, "RelationTableAliasProxyHandler");
21768
+ __publicField(RelationTableAliasProxyHandler, _a28, "RelationTableAliasProxyHandler");
21617
21769
  }
21618
21770
  });
21619
21771
 
21620
21772
  // ../drizzle-orm/dist/errors.js
21621
- var _a30, _b11, DrizzleError, _a31, _b12, TransactionRollbackError;
21773
+ var _a29, _b11, DrizzleError, _a30, _b12, TransactionRollbackError;
21622
21774
  var init_errors = __esm({
21623
21775
  "../drizzle-orm/dist/errors.js"() {
21624
21776
  "use strict";
21625
21777
  init_entity();
21626
- DrizzleError = class extends (_b11 = Error, _a30 = entityKind, _b11) {
21778
+ DrizzleError = class extends (_b11 = Error, _a29 = entityKind, _b11) {
21627
21779
  constructor({ message, cause }) {
21628
21780
  super(message);
21629
21781
  this.name = "DrizzleError";
21630
21782
  this.cause = cause;
21631
21783
  }
21632
21784
  };
21633
- __publicField(DrizzleError, _a30, "DrizzleError");
21634
- TransactionRollbackError = class extends (_b12 = DrizzleError, _a31 = entityKind, _b12) {
21785
+ __publicField(DrizzleError, _a29, "DrizzleError");
21786
+ TransactionRollbackError = class extends (_b12 = DrizzleError, _a30 = entityKind, _b12) {
21635
21787
  constructor() {
21636
21788
  super({ message: "Rollback" });
21637
21789
  }
21638
21790
  };
21639
- __publicField(TransactionRollbackError, _a31, "TransactionRollbackError");
21791
+ __publicField(TransactionRollbackError, _a30, "TransactionRollbackError");
21640
21792
  }
21641
21793
  });
21642
21794
 
21643
21795
  // ../drizzle-orm/dist/sql/expressions/conditions.js
21644
21796
  function bindIfParam(value, column4) {
21645
- if (isDriverValueEncoder(column4) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value, Column2) && !is(value, Table) && !is(value, View3)) {
21797
+ if (isDriverValueEncoder(column4) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value, Column2) && !is(value, Table2) && !is(value, View3)) {
21646
21798
  return new Param(value, column4);
21647
21799
  }
21648
21800
  return value;
@@ -21827,19 +21979,19 @@ var init_expressions2 = __esm({
21827
21979
  });
21828
21980
 
21829
21981
  // ../drizzle-orm/dist/logger.js
21830
- var _a32, ConsoleLogWriter, _a33, DefaultLogger, _a34, NoopLogger;
21982
+ var _a31, ConsoleLogWriter, _a32, DefaultLogger, _a33, NoopLogger;
21831
21983
  var init_logger = __esm({
21832
21984
  "../drizzle-orm/dist/logger.js"() {
21833
21985
  "use strict";
21834
21986
  init_entity();
21835
- _a32 = entityKind;
21987
+ _a31 = entityKind;
21836
21988
  ConsoleLogWriter = class {
21837
21989
  write(message) {
21838
21990
  console.log(message);
21839
21991
  }
21840
21992
  };
21841
- __publicField(ConsoleLogWriter, _a32, "ConsoleLogWriter");
21842
- _a33 = entityKind;
21993
+ __publicField(ConsoleLogWriter, _a31, "ConsoleLogWriter");
21994
+ _a32 = entityKind;
21843
21995
  DefaultLogger = class {
21844
21996
  constructor(config) {
21845
21997
  __publicField(this, "writer");
@@ -21857,13 +22009,13 @@ var init_logger = __esm({
21857
22009
  this.writer.write(`Query: ${query}${paramsStr}`);
21858
22010
  }
21859
22011
  };
21860
- __publicField(DefaultLogger, _a33, "DefaultLogger");
21861
- _a34 = entityKind;
22012
+ __publicField(DefaultLogger, _a32, "DefaultLogger");
22013
+ _a33 = entityKind;
21862
22014
  NoopLogger = class {
21863
22015
  logQuery() {
21864
22016
  }
21865
22017
  };
21866
- __publicField(NoopLogger, _a34, "NoopLogger");
22018
+ __publicField(NoopLogger, _a33, "NoopLogger");
21867
22019
  }
21868
22020
  });
21869
22021
 
@@ -21875,15 +22027,15 @@ var init_operations = __esm({
21875
22027
  });
21876
22028
 
21877
22029
  // ../drizzle-orm/dist/query-promise.js
21878
- var _a35, _b13, QueryPromise;
22030
+ var _a34, _b13, QueryPromise;
21879
22031
  var init_query_promise = __esm({
21880
22032
  "../drizzle-orm/dist/query-promise.js"() {
21881
22033
  "use strict";
21882
22034
  init_entity();
21883
- _b13 = entityKind, _a35 = Symbol.toStringTag;
22035
+ _b13 = entityKind, _a34 = Symbol.toStringTag;
21884
22036
  QueryPromise = class {
21885
22037
  constructor() {
21886
- __publicField(this, _a35, "QueryPromise");
22038
+ __publicField(this, _a34, "QueryPromise");
21887
22039
  }
21888
22040
  catch(onRejected) {
21889
22041
  return this.then(void 0, onRejected);
@@ -21962,8 +22114,8 @@ function orderSelectedFields(fields, pathPrefix) {
21962
22114
  const newPath = pathPrefix ? [...pathPrefix, name2] : [name2];
21963
22115
  if (is(field, Column2) || is(field, SQL) || is(field, SQL.Aliased)) {
21964
22116
  result.push({ path: newPath, field });
21965
- } else if (is(field, Table)) {
21966
- result.push(...orderSelectedFields(field[Table.Symbol.Columns], newPath));
22117
+ } else if (is(field, Table2)) {
22118
+ result.push(...orderSelectedFields(field[Table2.Symbol.Columns], newPath));
21967
22119
  } else {
21968
22120
  result.push(...orderSelectedFields(field, newPath));
21969
22121
  }
@@ -21988,7 +22140,7 @@ function mapUpdateSet(table4, values) {
21988
22140
  if (is(value, SQL)) {
21989
22141
  return [key, value];
21990
22142
  } else {
21991
- return [key, new Param(value, table4[Table.Symbol.Columns][key])];
22143
+ return [key, new Param(value, table4[Table2.Symbol.Columns][key])];
21992
22144
  }
21993
22145
  });
21994
22146
  if (entries.length === 0) {
@@ -22010,10 +22162,10 @@ function applyMixins(baseClass, extendedClasses) {
22010
22162
  }
22011
22163
  }
22012
22164
  function getTableColumns(table4) {
22013
- return table4[Table.Symbol.Columns];
22165
+ return table4[Table2.Symbol.Columns];
22014
22166
  }
22015
22167
  function getTableLikeName(table4) {
22016
- return is(table4, Subquery) ? table4._.alias : is(table4, View3) ? table4[ViewBaseConfig].name : is(table4, SQL) ? void 0 : table4[Table.Symbol.IsAlias] ? table4[Table.Symbol.Name] : table4[Table.Symbol.BaseName];
22168
+ return is(table4, Subquery) ? table4._.alias : is(table4, View3) ? table4[ViewBaseConfig].name : is(table4, SQL) ? void 0 : table4[Table2.Symbol.IsAlias] ? table4[Table2.Symbol.Name] : table4[Table2.Symbol.BaseName];
22017
22169
  }
22018
22170
  function getColumnNameAndConfig(a, b) {
22019
22171
  return {
@@ -22057,7 +22209,7 @@ function isConfig(data) {
22057
22209
  }
22058
22210
  if ("client" in data) {
22059
22211
  const type = typeof data["client"];
22060
- if (type !== "object" && type !== "undefined")
22212
+ if (type !== "object" && type !== "function" && type !== "undefined")
22061
22213
  return false;
22062
22214
  return true;
22063
22215
  }
@@ -22078,13 +22230,13 @@ var init_utils2 = __esm({
22078
22230
  });
22079
22231
 
22080
22232
  // ../drizzle-orm/dist/pg-core/columns/int.common.js
22081
- var _a36, _b14, PgIntColumnBaseBuilder;
22233
+ var _a35, _b14, PgIntColumnBaseBuilder;
22082
22234
  var init_int_common = __esm({
22083
22235
  "../drizzle-orm/dist/pg-core/columns/int.common.js"() {
22084
22236
  "use strict";
22085
22237
  init_entity();
22086
22238
  init_common2();
22087
- PgIntColumnBaseBuilder = class extends (_b14 = PgColumnBuilder, _a36 = entityKind, _b14) {
22239
+ PgIntColumnBaseBuilder = class extends (_b14 = PgColumnBuilder, _a35 = entityKind, _b14) {
22088
22240
  generatedAlwaysAsIdentity(sequence) {
22089
22241
  if (sequence) {
22090
22242
  const { name: name2, ...options } = sequence;
@@ -22120,7 +22272,7 @@ var init_int_common = __esm({
22120
22272
  return this;
22121
22273
  }
22122
22274
  };
22123
- __publicField(PgIntColumnBaseBuilder, _a36, "PgIntColumnBaseBuilder");
22275
+ __publicField(PgIntColumnBaseBuilder, _a35, "PgIntColumnBaseBuilder");
22124
22276
  }
22125
22277
  });
22126
22278
 
@@ -22132,7 +22284,7 @@ function bigint(a, b) {
22132
22284
  }
22133
22285
  return new PgBigInt64Builder(name2);
22134
22286
  }
22135
- var _a37, _b15, PgBigInt53Builder, _a38, _b16, PgBigInt53, _a39, _b17, PgBigInt64Builder, _a40, _b18, PgBigInt64;
22287
+ var _a36, _b15, PgBigInt53Builder, _a37, _b16, PgBigInt53, _a38, _b17, PgBigInt64Builder, _a39, _b18, PgBigInt64;
22136
22288
  var init_bigint = __esm({
22137
22289
  "../drizzle-orm/dist/pg-core/columns/bigint.js"() {
22138
22290
  "use strict";
@@ -22140,7 +22292,7 @@ var init_bigint = __esm({
22140
22292
  init_utils2();
22141
22293
  init_common2();
22142
22294
  init_int_common();
22143
- PgBigInt53Builder = class extends (_b15 = PgIntColumnBaseBuilder, _a37 = entityKind, _b15) {
22295
+ PgBigInt53Builder = class extends (_b15 = PgIntColumnBaseBuilder, _a36 = entityKind, _b15) {
22144
22296
  constructor(name2) {
22145
22297
  super(name2, "number", "PgBigInt53");
22146
22298
  }
@@ -22149,8 +22301,8 @@ var init_bigint = __esm({
22149
22301
  return new PgBigInt53(table4, this.config);
22150
22302
  }
22151
22303
  };
22152
- __publicField(PgBigInt53Builder, _a37, "PgBigInt53Builder");
22153
- PgBigInt53 = class extends (_b16 = PgColumn, _a38 = entityKind, _b16) {
22304
+ __publicField(PgBigInt53Builder, _a36, "PgBigInt53Builder");
22305
+ PgBigInt53 = class extends (_b16 = PgColumn, _a37 = entityKind, _b16) {
22154
22306
  getSQLType() {
22155
22307
  return "bigint";
22156
22308
  }
@@ -22161,8 +22313,8 @@ var init_bigint = __esm({
22161
22313
  return Number(value);
22162
22314
  }
22163
22315
  };
22164
- __publicField(PgBigInt53, _a38, "PgBigInt53");
22165
- PgBigInt64Builder = class extends (_b17 = PgIntColumnBaseBuilder, _a39 = entityKind, _b17) {
22316
+ __publicField(PgBigInt53, _a37, "PgBigInt53");
22317
+ PgBigInt64Builder = class extends (_b17 = PgIntColumnBaseBuilder, _a38 = entityKind, _b17) {
22166
22318
  constructor(name2) {
22167
22319
  super(name2, "bigint", "PgBigInt64");
22168
22320
  }
@@ -22174,8 +22326,8 @@ var init_bigint = __esm({
22174
22326
  );
22175
22327
  }
22176
22328
  };
22177
- __publicField(PgBigInt64Builder, _a39, "PgBigInt64Builder");
22178
- PgBigInt64 = class extends (_b18 = PgColumn, _a40 = entityKind, _b18) {
22329
+ __publicField(PgBigInt64Builder, _a38, "PgBigInt64Builder");
22330
+ PgBigInt64 = class extends (_b18 = PgColumn, _a39 = entityKind, _b18) {
22179
22331
  getSQLType() {
22180
22332
  return "bigint";
22181
22333
  }
@@ -22184,7 +22336,7 @@ var init_bigint = __esm({
22184
22336
  return BigInt(value);
22185
22337
  }
22186
22338
  };
22187
- __publicField(PgBigInt64, _a40, "PgBigInt64");
22339
+ __publicField(PgBigInt64, _a39, "PgBigInt64");
22188
22340
  }
22189
22341
  });
22190
22342
 
@@ -22196,14 +22348,14 @@ function bigserial(a, b) {
22196
22348
  }
22197
22349
  return new PgBigSerial64Builder(name2);
22198
22350
  }
22199
- var _a41, _b19, PgBigSerial53Builder, _a42, _b20, PgBigSerial53, _a43, _b21, PgBigSerial64Builder, _a44, _b22, PgBigSerial64;
22351
+ var _a40, _b19, PgBigSerial53Builder, _a41, _b20, PgBigSerial53, _a42, _b21, PgBigSerial64Builder, _a43, _b22, PgBigSerial64;
22200
22352
  var init_bigserial = __esm({
22201
22353
  "../drizzle-orm/dist/pg-core/columns/bigserial.js"() {
22202
22354
  "use strict";
22203
22355
  init_entity();
22204
22356
  init_utils2();
22205
22357
  init_common2();
22206
- PgBigSerial53Builder = class extends (_b19 = PgColumnBuilder, _a41 = entityKind, _b19) {
22358
+ PgBigSerial53Builder = class extends (_b19 = PgColumnBuilder, _a40 = entityKind, _b19) {
22207
22359
  constructor(name2) {
22208
22360
  super(name2, "number", "PgBigSerial53");
22209
22361
  this.config.hasDefault = true;
@@ -22217,8 +22369,8 @@ var init_bigserial = __esm({
22217
22369
  );
22218
22370
  }
22219
22371
  };
22220
- __publicField(PgBigSerial53Builder, _a41, "PgBigSerial53Builder");
22221
- PgBigSerial53 = class extends (_b20 = PgColumn, _a42 = entityKind, _b20) {
22372
+ __publicField(PgBigSerial53Builder, _a40, "PgBigSerial53Builder");
22373
+ PgBigSerial53 = class extends (_b20 = PgColumn, _a41 = entityKind, _b20) {
22222
22374
  getSQLType() {
22223
22375
  return "bigserial";
22224
22376
  }
@@ -22229,8 +22381,8 @@ var init_bigserial = __esm({
22229
22381
  return Number(value);
22230
22382
  }
22231
22383
  };
22232
- __publicField(PgBigSerial53, _a42, "PgBigSerial53");
22233
- PgBigSerial64Builder = class extends (_b21 = PgColumnBuilder, _a43 = entityKind, _b21) {
22384
+ __publicField(PgBigSerial53, _a41, "PgBigSerial53");
22385
+ PgBigSerial64Builder = class extends (_b21 = PgColumnBuilder, _a42 = entityKind, _b21) {
22234
22386
  constructor(name2) {
22235
22387
  super(name2, "bigint", "PgBigSerial64");
22236
22388
  this.config.hasDefault = true;
@@ -22243,8 +22395,8 @@ var init_bigserial = __esm({
22243
22395
  );
22244
22396
  }
22245
22397
  };
22246
- __publicField(PgBigSerial64Builder, _a43, "PgBigSerial64Builder");
22247
- PgBigSerial64 = class extends (_b22 = PgColumn, _a44 = entityKind, _b22) {
22398
+ __publicField(PgBigSerial64Builder, _a42, "PgBigSerial64Builder");
22399
+ PgBigSerial64 = class extends (_b22 = PgColumn, _a43 = entityKind, _b22) {
22248
22400
  getSQLType() {
22249
22401
  return "bigserial";
22250
22402
  }
@@ -22253,7 +22405,7 @@ var init_bigserial = __esm({
22253
22405
  return BigInt(value);
22254
22406
  }
22255
22407
  };
22256
- __publicField(PgBigSerial64, _a44, "PgBigSerial64");
22408
+ __publicField(PgBigSerial64, _a43, "PgBigSerial64");
22257
22409
  }
22258
22410
  });
22259
22411
 
@@ -22261,13 +22413,13 @@ var init_bigserial = __esm({
22261
22413
  function boolean(name2) {
22262
22414
  return new PgBooleanBuilder(name2 ?? "");
22263
22415
  }
22264
- var _a45, _b23, PgBooleanBuilder, _a46, _b24, PgBoolean;
22416
+ var _a44, _b23, PgBooleanBuilder, _a45, _b24, PgBoolean;
22265
22417
  var init_boolean = __esm({
22266
22418
  "../drizzle-orm/dist/pg-core/columns/boolean.js"() {
22267
22419
  "use strict";
22268
22420
  init_entity();
22269
22421
  init_common2();
22270
- PgBooleanBuilder = class extends (_b23 = PgColumnBuilder, _a45 = entityKind, _b23) {
22422
+ PgBooleanBuilder = class extends (_b23 = PgColumnBuilder, _a44 = entityKind, _b23) {
22271
22423
  constructor(name2) {
22272
22424
  super(name2, "boolean", "PgBoolean");
22273
22425
  }
@@ -22276,13 +22428,13 @@ var init_boolean = __esm({
22276
22428
  return new PgBoolean(table4, this.config);
22277
22429
  }
22278
22430
  };
22279
- __publicField(PgBooleanBuilder, _a45, "PgBooleanBuilder");
22280
- PgBoolean = class extends (_b24 = PgColumn, _a46 = entityKind, _b24) {
22431
+ __publicField(PgBooleanBuilder, _a44, "PgBooleanBuilder");
22432
+ PgBoolean = class extends (_b24 = PgColumn, _a45 = entityKind, _b24) {
22281
22433
  getSQLType() {
22282
22434
  return "boolean";
22283
22435
  }
22284
22436
  };
22285
- __publicField(PgBoolean, _a46, "PgBoolean");
22437
+ __publicField(PgBoolean, _a45, "PgBoolean");
22286
22438
  }
22287
22439
  });
22288
22440
 
@@ -22291,14 +22443,14 @@ function char(a, b = {}) {
22291
22443
  const { name: name2, config } = getColumnNameAndConfig(a, b);
22292
22444
  return new PgCharBuilder(name2, config);
22293
22445
  }
22294
- var _a47, _b25, PgCharBuilder, _a48, _b26, PgChar;
22446
+ var _a46, _b25, PgCharBuilder, _a47, _b26, PgChar;
22295
22447
  var init_char = __esm({
22296
22448
  "../drizzle-orm/dist/pg-core/columns/char.js"() {
22297
22449
  "use strict";
22298
22450
  init_entity();
22299
22451
  init_utils2();
22300
22452
  init_common2();
22301
- PgCharBuilder = class extends (_b25 = PgColumnBuilder, _a47 = entityKind, _b25) {
22453
+ PgCharBuilder = class extends (_b25 = PgColumnBuilder, _a46 = entityKind, _b25) {
22302
22454
  constructor(name2, config) {
22303
22455
  super(name2, "string", "PgChar");
22304
22456
  this.config.length = config.length;
@@ -22309,8 +22461,8 @@ var init_char = __esm({
22309
22461
  return new PgChar(table4, this.config);
22310
22462
  }
22311
22463
  };
22312
- __publicField(PgCharBuilder, _a47, "PgCharBuilder");
22313
- PgChar = class extends (_b26 = PgColumn, _a48 = entityKind, _b26) {
22464
+ __publicField(PgCharBuilder, _a46, "PgCharBuilder");
22465
+ PgChar = class extends (_b26 = PgColumn, _a47 = entityKind, _b26) {
22314
22466
  constructor() {
22315
22467
  super(...arguments);
22316
22468
  __publicField(this, "length", this.config.length);
@@ -22320,7 +22472,7 @@ var init_char = __esm({
22320
22472
  return this.length === void 0 ? `char` : `char(${this.length})`;
22321
22473
  }
22322
22474
  };
22323
- __publicField(PgChar, _a48, "PgChar");
22475
+ __publicField(PgChar, _a47, "PgChar");
22324
22476
  }
22325
22477
  });
22326
22478
 
@@ -22328,13 +22480,13 @@ var init_char = __esm({
22328
22480
  function cidr(name2) {
22329
22481
  return new PgCidrBuilder(name2 ?? "");
22330
22482
  }
22331
- var _a49, _b27, PgCidrBuilder, _a50, _b28, PgCidr;
22483
+ var _a48, _b27, PgCidrBuilder, _a49, _b28, PgCidr;
22332
22484
  var init_cidr = __esm({
22333
22485
  "../drizzle-orm/dist/pg-core/columns/cidr.js"() {
22334
22486
  "use strict";
22335
22487
  init_entity();
22336
22488
  init_common2();
22337
- PgCidrBuilder = class extends (_b27 = PgColumnBuilder, _a49 = entityKind, _b27) {
22489
+ PgCidrBuilder = class extends (_b27 = PgColumnBuilder, _a48 = entityKind, _b27) {
22338
22490
  constructor(name2) {
22339
22491
  super(name2, "string", "PgCidr");
22340
22492
  }
@@ -22343,13 +22495,13 @@ var init_cidr = __esm({
22343
22495
  return new PgCidr(table4, this.config);
22344
22496
  }
22345
22497
  };
22346
- __publicField(PgCidrBuilder, _a49, "PgCidrBuilder");
22347
- PgCidr = class extends (_b28 = PgColumn, _a50 = entityKind, _b28) {
22498
+ __publicField(PgCidrBuilder, _a48, "PgCidrBuilder");
22499
+ PgCidr = class extends (_b28 = PgColumn, _a49 = entityKind, _b28) {
22348
22500
  getSQLType() {
22349
22501
  return "cidr";
22350
22502
  }
22351
22503
  };
22352
- __publicField(PgCidr, _a50, "PgCidr");
22504
+ __publicField(PgCidr, _a49, "PgCidr");
22353
22505
  }
22354
22506
  });
22355
22507
 
@@ -22360,14 +22512,14 @@ function customType(customTypeParams) {
22360
22512
  return new PgCustomColumnBuilder(name2, config, customTypeParams);
22361
22513
  };
22362
22514
  }
22363
- var _a51, _b29, PgCustomColumnBuilder, _a52, _b30, PgCustomColumn;
22515
+ var _a50, _b29, PgCustomColumnBuilder, _a51, _b30, PgCustomColumn;
22364
22516
  var init_custom = __esm({
22365
22517
  "../drizzle-orm/dist/pg-core/columns/custom.js"() {
22366
22518
  "use strict";
22367
22519
  init_entity();
22368
22520
  init_utils2();
22369
22521
  init_common2();
22370
- PgCustomColumnBuilder = class extends (_b29 = PgColumnBuilder, _a51 = entityKind, _b29) {
22522
+ PgCustomColumnBuilder = class extends (_b29 = PgColumnBuilder, _a50 = entityKind, _b29) {
22371
22523
  constructor(name2, fieldConfig, customTypeParams) {
22372
22524
  super(name2, "custom", "PgCustomColumn");
22373
22525
  this.config.fieldConfig = fieldConfig;
@@ -22381,8 +22533,8 @@ var init_custom = __esm({
22381
22533
  );
22382
22534
  }
22383
22535
  };
22384
- __publicField(PgCustomColumnBuilder, _a51, "PgCustomColumnBuilder");
22385
- PgCustomColumn = class extends (_b30 = PgColumn, _a52 = entityKind, _b30) {
22536
+ __publicField(PgCustomColumnBuilder, _a50, "PgCustomColumnBuilder");
22537
+ PgCustomColumn = class extends (_b30 = PgColumn, _a51 = entityKind, _b30) {
22386
22538
  constructor(table4, config) {
22387
22539
  super(table4, config);
22388
22540
  __publicField(this, "sqlName");
@@ -22402,24 +22554,24 @@ var init_custom = __esm({
22402
22554
  return typeof this.mapTo === "function" ? this.mapTo(value) : value;
22403
22555
  }
22404
22556
  };
22405
- __publicField(PgCustomColumn, _a52, "PgCustomColumn");
22557
+ __publicField(PgCustomColumn, _a51, "PgCustomColumn");
22406
22558
  }
22407
22559
  });
22408
22560
 
22409
22561
  // ../drizzle-orm/dist/pg-core/columns/date.common.js
22410
- var _a53, _b31, PgDateColumnBaseBuilder;
22562
+ var _a52, _b31, PgDateColumnBaseBuilder;
22411
22563
  var init_date_common = __esm({
22412
22564
  "../drizzle-orm/dist/pg-core/columns/date.common.js"() {
22413
22565
  "use strict";
22414
22566
  init_entity();
22415
22567
  init_sql();
22416
22568
  init_common2();
22417
- PgDateColumnBaseBuilder = class extends (_b31 = PgColumnBuilder, _a53 = entityKind, _b31) {
22569
+ PgDateColumnBaseBuilder = class extends (_b31 = PgColumnBuilder, _a52 = entityKind, _b31) {
22418
22570
  defaultNow() {
22419
22571
  return this.default(sql`now()`);
22420
22572
  }
22421
22573
  };
22422
- __publicField(PgDateColumnBaseBuilder, _a53, "PgDateColumnBaseBuilder");
22574
+ __publicField(PgDateColumnBaseBuilder, _a52, "PgDateColumnBaseBuilder");
22423
22575
  }
22424
22576
  });
22425
22577
 
@@ -22431,7 +22583,7 @@ function date(a, b) {
22431
22583
  }
22432
22584
  return new PgDateStringBuilder(name2);
22433
22585
  }
22434
- var _a54, _b32, PgDateBuilder, _a55, _b33, PgDate, _a56, _b34, PgDateStringBuilder, _a57, _b35, PgDateString;
22586
+ var _a53, _b32, PgDateBuilder, _a54, _b33, PgDate, _a55, _b34, PgDateStringBuilder, _a56, _b35, PgDateString;
22435
22587
  var init_date = __esm({
22436
22588
  "../drizzle-orm/dist/pg-core/columns/date.js"() {
22437
22589
  "use strict";
@@ -22439,7 +22591,7 @@ var init_date = __esm({
22439
22591
  init_utils2();
22440
22592
  init_common2();
22441
22593
  init_date_common();
22442
- PgDateBuilder = class extends (_b32 = PgDateColumnBaseBuilder, _a54 = entityKind, _b32) {
22594
+ PgDateBuilder = class extends (_b32 = PgDateColumnBaseBuilder, _a53 = entityKind, _b32) {
22443
22595
  constructor(name2) {
22444
22596
  super(name2, "date", "PgDate");
22445
22597
  }
@@ -22448,8 +22600,8 @@ var init_date = __esm({
22448
22600
  return new PgDate(table4, this.config);
22449
22601
  }
22450
22602
  };
22451
- __publicField(PgDateBuilder, _a54, "PgDateBuilder");
22452
- PgDate = class extends (_b33 = PgColumn, _a55 = entityKind, _b33) {
22603
+ __publicField(PgDateBuilder, _a53, "PgDateBuilder");
22604
+ PgDate = class extends (_b33 = PgColumn, _a54 = entityKind, _b33) {
22453
22605
  getSQLType() {
22454
22606
  return "date";
22455
22607
  }
@@ -22460,8 +22612,8 @@ var init_date = __esm({
22460
22612
  return value.toISOString();
22461
22613
  }
22462
22614
  };
22463
- __publicField(PgDate, _a55, "PgDate");
22464
- PgDateStringBuilder = class extends (_b34 = PgDateColumnBaseBuilder, _a56 = entityKind, _b34) {
22615
+ __publicField(PgDate, _a54, "PgDate");
22616
+ PgDateStringBuilder = class extends (_b34 = PgDateColumnBaseBuilder, _a55 = entityKind, _b34) {
22465
22617
  constructor(name2) {
22466
22618
  super(name2, "string", "PgDateString");
22467
22619
  }
@@ -22473,13 +22625,13 @@ var init_date = __esm({
22473
22625
  );
22474
22626
  }
22475
22627
  };
22476
- __publicField(PgDateStringBuilder, _a56, "PgDateStringBuilder");
22477
- PgDateString = class extends (_b35 = PgColumn, _a57 = entityKind, _b35) {
22628
+ __publicField(PgDateStringBuilder, _a55, "PgDateStringBuilder");
22629
+ PgDateString = class extends (_b35 = PgColumn, _a56 = entityKind, _b35) {
22478
22630
  getSQLType() {
22479
22631
  return "date";
22480
22632
  }
22481
22633
  };
22482
- __publicField(PgDateString, _a57, "PgDateString");
22634
+ __publicField(PgDateString, _a56, "PgDateString");
22483
22635
  }
22484
22636
  });
22485
22637
 
@@ -22487,13 +22639,13 @@ var init_date = __esm({
22487
22639
  function doublePrecision(name2) {
22488
22640
  return new PgDoublePrecisionBuilder(name2 ?? "");
22489
22641
  }
22490
- var _a58, _b36, PgDoublePrecisionBuilder, _a59, _b37, PgDoublePrecision;
22642
+ var _a57, _b36, PgDoublePrecisionBuilder, _a58, _b37, PgDoublePrecision;
22491
22643
  var init_double_precision = __esm({
22492
22644
  "../drizzle-orm/dist/pg-core/columns/double-precision.js"() {
22493
22645
  "use strict";
22494
22646
  init_entity();
22495
22647
  init_common2();
22496
- PgDoublePrecisionBuilder = class extends (_b36 = PgColumnBuilder, _a58 = entityKind, _b36) {
22648
+ PgDoublePrecisionBuilder = class extends (_b36 = PgColumnBuilder, _a57 = entityKind, _b36) {
22497
22649
  constructor(name2) {
22498
22650
  super(name2, "number", "PgDoublePrecision");
22499
22651
  }
@@ -22505,8 +22657,8 @@ var init_double_precision = __esm({
22505
22657
  );
22506
22658
  }
22507
22659
  };
22508
- __publicField(PgDoublePrecisionBuilder, _a58, "PgDoublePrecisionBuilder");
22509
- PgDoublePrecision = class extends (_b37 = PgColumn, _a59 = entityKind, _b37) {
22660
+ __publicField(PgDoublePrecisionBuilder, _a57, "PgDoublePrecisionBuilder");
22661
+ PgDoublePrecision = class extends (_b37 = PgColumn, _a58 = entityKind, _b37) {
22510
22662
  getSQLType() {
22511
22663
  return "double precision";
22512
22664
  }
@@ -22517,7 +22669,7 @@ var init_double_precision = __esm({
22517
22669
  return value;
22518
22670
  }
22519
22671
  };
22520
- __publicField(PgDoublePrecision, _a59, "PgDoublePrecision");
22672
+ __publicField(PgDoublePrecision, _a58, "PgDoublePrecision");
22521
22673
  }
22522
22674
  });
22523
22675
 
@@ -22525,13 +22677,13 @@ var init_double_precision = __esm({
22525
22677
  function inet(name2) {
22526
22678
  return new PgInetBuilder(name2 ?? "");
22527
22679
  }
22528
- var _a60, _b38, PgInetBuilder, _a61, _b39, PgInet;
22680
+ var _a59, _b38, PgInetBuilder, _a60, _b39, PgInet;
22529
22681
  var init_inet = __esm({
22530
22682
  "../drizzle-orm/dist/pg-core/columns/inet.js"() {
22531
22683
  "use strict";
22532
22684
  init_entity();
22533
22685
  init_common2();
22534
- PgInetBuilder = class extends (_b38 = PgColumnBuilder, _a60 = entityKind, _b38) {
22686
+ PgInetBuilder = class extends (_b38 = PgColumnBuilder, _a59 = entityKind, _b38) {
22535
22687
  constructor(name2) {
22536
22688
  super(name2, "string", "PgInet");
22537
22689
  }
@@ -22540,13 +22692,13 @@ var init_inet = __esm({
22540
22692
  return new PgInet(table4, this.config);
22541
22693
  }
22542
22694
  };
22543
- __publicField(PgInetBuilder, _a60, "PgInetBuilder");
22544
- PgInet = class extends (_b39 = PgColumn, _a61 = entityKind, _b39) {
22695
+ __publicField(PgInetBuilder, _a59, "PgInetBuilder");
22696
+ PgInet = class extends (_b39 = PgColumn, _a60 = entityKind, _b39) {
22545
22697
  getSQLType() {
22546
22698
  return "inet";
22547
22699
  }
22548
22700
  };
22549
- __publicField(PgInet, _a61, "PgInet");
22701
+ __publicField(PgInet, _a60, "PgInet");
22550
22702
  }
22551
22703
  });
22552
22704
 
@@ -22554,14 +22706,14 @@ var init_inet = __esm({
22554
22706
  function integer(name2) {
22555
22707
  return new PgIntegerBuilder(name2 ?? "");
22556
22708
  }
22557
- var _a62, _b40, PgIntegerBuilder, _a63, _b41, PgInteger;
22709
+ var _a61, _b40, PgIntegerBuilder, _a62, _b41, PgInteger;
22558
22710
  var init_integer = __esm({
22559
22711
  "../drizzle-orm/dist/pg-core/columns/integer.js"() {
22560
22712
  "use strict";
22561
22713
  init_entity();
22562
22714
  init_common2();
22563
22715
  init_int_common();
22564
- PgIntegerBuilder = class extends (_b40 = PgIntColumnBaseBuilder, _a62 = entityKind, _b40) {
22716
+ PgIntegerBuilder = class extends (_b40 = PgIntColumnBaseBuilder, _a61 = entityKind, _b40) {
22565
22717
  constructor(name2) {
22566
22718
  super(name2, "number", "PgInteger");
22567
22719
  }
@@ -22570,8 +22722,8 @@ var init_integer = __esm({
22570
22722
  return new PgInteger(table4, this.config);
22571
22723
  }
22572
22724
  };
22573
- __publicField(PgIntegerBuilder, _a62, "PgIntegerBuilder");
22574
- PgInteger = class extends (_b41 = PgColumn, _a63 = entityKind, _b41) {
22725
+ __publicField(PgIntegerBuilder, _a61, "PgIntegerBuilder");
22726
+ PgInteger = class extends (_b41 = PgColumn, _a62 = entityKind, _b41) {
22575
22727
  getSQLType() {
22576
22728
  return "integer";
22577
22729
  }
@@ -22582,7 +22734,7 @@ var init_integer = __esm({
22582
22734
  return value;
22583
22735
  }
22584
22736
  };
22585
- __publicField(PgInteger, _a63, "PgInteger");
22737
+ __publicField(PgInteger, _a62, "PgInteger");
22586
22738
  }
22587
22739
  });
22588
22740
 
@@ -22591,14 +22743,14 @@ function interval(a, b = {}) {
22591
22743
  const { name: name2, config } = getColumnNameAndConfig(a, b);
22592
22744
  return new PgIntervalBuilder(name2, config);
22593
22745
  }
22594
- var _a64, _b42, PgIntervalBuilder, _a65, _b43, PgInterval;
22746
+ var _a63, _b42, PgIntervalBuilder, _a64, _b43, PgInterval;
22595
22747
  var init_interval = __esm({
22596
22748
  "../drizzle-orm/dist/pg-core/columns/interval.js"() {
22597
22749
  "use strict";
22598
22750
  init_entity();
22599
22751
  init_utils2();
22600
22752
  init_common2();
22601
- PgIntervalBuilder = class extends (_b42 = PgColumnBuilder, _a64 = entityKind, _b42) {
22753
+ PgIntervalBuilder = class extends (_b42 = PgColumnBuilder, _a63 = entityKind, _b42) {
22602
22754
  constructor(name2, intervalConfig) {
22603
22755
  super(name2, "string", "PgInterval");
22604
22756
  this.config.intervalConfig = intervalConfig;
@@ -22608,8 +22760,8 @@ var init_interval = __esm({
22608
22760
  return new PgInterval(table4, this.config);
22609
22761
  }
22610
22762
  };
22611
- __publicField(PgIntervalBuilder, _a64, "PgIntervalBuilder");
22612
- PgInterval = class extends (_b43 = PgColumn, _a65 = entityKind, _b43) {
22763
+ __publicField(PgIntervalBuilder, _a63, "PgIntervalBuilder");
22764
+ PgInterval = class extends (_b43 = PgColumn, _a64 = entityKind, _b43) {
22613
22765
  constructor() {
22614
22766
  super(...arguments);
22615
22767
  __publicField(this, "fields", this.config.intervalConfig.fields);
@@ -22621,7 +22773,7 @@ var init_interval = __esm({
22621
22773
  return `interval${fields}${precision}`;
22622
22774
  }
22623
22775
  };
22624
- __publicField(PgInterval, _a65, "PgInterval");
22776
+ __publicField(PgInterval, _a64, "PgInterval");
22625
22777
  }
22626
22778
  });
22627
22779
 
@@ -22629,13 +22781,13 @@ var init_interval = __esm({
22629
22781
  function json(name2) {
22630
22782
  return new PgJsonBuilder(name2 ?? "");
22631
22783
  }
22632
- var _a66, _b44, PgJsonBuilder, _a67, _b45, PgJson;
22784
+ var _a65, _b44, PgJsonBuilder, _a66, _b45, PgJson;
22633
22785
  var init_json = __esm({
22634
22786
  "../drizzle-orm/dist/pg-core/columns/json.js"() {
22635
22787
  "use strict";
22636
22788
  init_entity();
22637
22789
  init_common2();
22638
- PgJsonBuilder = class extends (_b44 = PgColumnBuilder, _a66 = entityKind, _b44) {
22790
+ PgJsonBuilder = class extends (_b44 = PgColumnBuilder, _a65 = entityKind, _b44) {
22639
22791
  constructor(name2) {
22640
22792
  super(name2, "json", "PgJson");
22641
22793
  }
@@ -22644,8 +22796,8 @@ var init_json = __esm({
22644
22796
  return new PgJson(table4, this.config);
22645
22797
  }
22646
22798
  };
22647
- __publicField(PgJsonBuilder, _a66, "PgJsonBuilder");
22648
- PgJson = class extends (_b45 = PgColumn, _a67 = entityKind, _b45) {
22799
+ __publicField(PgJsonBuilder, _a65, "PgJsonBuilder");
22800
+ PgJson = class extends (_b45 = PgColumn, _a66 = entityKind, _b45) {
22649
22801
  constructor(table4, config) {
22650
22802
  super(table4, config);
22651
22803
  }
@@ -22666,7 +22818,7 @@ var init_json = __esm({
22666
22818
  return value;
22667
22819
  }
22668
22820
  };
22669
- __publicField(PgJson, _a67, "PgJson");
22821
+ __publicField(PgJson, _a66, "PgJson");
22670
22822
  }
22671
22823
  });
22672
22824
 
@@ -22674,13 +22826,13 @@ var init_json = __esm({
22674
22826
  function jsonb(name2) {
22675
22827
  return new PgJsonbBuilder(name2 ?? "");
22676
22828
  }
22677
- var _a68, _b46, PgJsonbBuilder, _a69, _b47, PgJsonb;
22829
+ var _a67, _b46, PgJsonbBuilder, _a68, _b47, PgJsonb;
22678
22830
  var init_jsonb = __esm({
22679
22831
  "../drizzle-orm/dist/pg-core/columns/jsonb.js"() {
22680
22832
  "use strict";
22681
22833
  init_entity();
22682
22834
  init_common2();
22683
- PgJsonbBuilder = class extends (_b46 = PgColumnBuilder, _a68 = entityKind, _b46) {
22835
+ PgJsonbBuilder = class extends (_b46 = PgColumnBuilder, _a67 = entityKind, _b46) {
22684
22836
  constructor(name2) {
22685
22837
  super(name2, "json", "PgJsonb");
22686
22838
  }
@@ -22689,8 +22841,8 @@ var init_jsonb = __esm({
22689
22841
  return new PgJsonb(table4, this.config);
22690
22842
  }
22691
22843
  };
22692
- __publicField(PgJsonbBuilder, _a68, "PgJsonbBuilder");
22693
- PgJsonb = class extends (_b47 = PgColumn, _a69 = entityKind, _b47) {
22844
+ __publicField(PgJsonbBuilder, _a67, "PgJsonbBuilder");
22845
+ PgJsonb = class extends (_b47 = PgColumn, _a68 = entityKind, _b47) {
22694
22846
  constructor(table4, config) {
22695
22847
  super(table4, config);
22696
22848
  }
@@ -22711,7 +22863,7 @@ var init_jsonb = __esm({
22711
22863
  return value;
22712
22864
  }
22713
22865
  };
22714
- __publicField(PgJsonb, _a69, "PgJsonb");
22866
+ __publicField(PgJsonb, _a68, "PgJsonb");
22715
22867
  }
22716
22868
  });
22717
22869
 
@@ -22723,14 +22875,14 @@ function line(a, b) {
22723
22875
  }
22724
22876
  return new PgLineABCBuilder(name2);
22725
22877
  }
22726
- var _a70, _b48, PgLineBuilder, _a71, _b49, PgLineTuple, _a72, _b50, PgLineABCBuilder, _a73, _b51, PgLineABC;
22878
+ var _a69, _b48, PgLineBuilder, _a70, _b49, PgLineTuple, _a71, _b50, PgLineABCBuilder, _a72, _b51, PgLineABC;
22727
22879
  var init_line = __esm({
22728
22880
  "../drizzle-orm/dist/pg-core/columns/line.js"() {
22729
22881
  "use strict";
22730
22882
  init_entity();
22731
22883
  init_utils2();
22732
22884
  init_common2();
22733
- PgLineBuilder = class extends (_b48 = PgColumnBuilder, _a70 = entityKind, _b48) {
22885
+ PgLineBuilder = class extends (_b48 = PgColumnBuilder, _a69 = entityKind, _b48) {
22734
22886
  constructor(name2) {
22735
22887
  super(name2, "array", "PgLine");
22736
22888
  }
@@ -22742,8 +22894,8 @@ var init_line = __esm({
22742
22894
  );
22743
22895
  }
22744
22896
  };
22745
- __publicField(PgLineBuilder, _a70, "PgLineBuilder");
22746
- PgLineTuple = class extends (_b49 = PgColumn, _a71 = entityKind, _b49) {
22897
+ __publicField(PgLineBuilder, _a69, "PgLineBuilder");
22898
+ PgLineTuple = class extends (_b49 = PgColumn, _a70 = entityKind, _b49) {
22747
22899
  getSQLType() {
22748
22900
  return "line";
22749
22901
  }
@@ -22755,8 +22907,8 @@ var init_line = __esm({
22755
22907
  return `{${value[0]},${value[1]},${value[2]}}`;
22756
22908
  }
22757
22909
  };
22758
- __publicField(PgLineTuple, _a71, "PgLine");
22759
- PgLineABCBuilder = class extends (_b50 = PgColumnBuilder, _a72 = entityKind, _b50) {
22910
+ __publicField(PgLineTuple, _a70, "PgLine");
22911
+ PgLineABCBuilder = class extends (_b50 = PgColumnBuilder, _a71 = entityKind, _b50) {
22760
22912
  constructor(name2) {
22761
22913
  super(name2, "json", "PgLineABC");
22762
22914
  }
@@ -22768,8 +22920,8 @@ var init_line = __esm({
22768
22920
  );
22769
22921
  }
22770
22922
  };
22771
- __publicField(PgLineABCBuilder, _a72, "PgLineABCBuilder");
22772
- PgLineABC = class extends (_b51 = PgColumn, _a73 = entityKind, _b51) {
22923
+ __publicField(PgLineABCBuilder, _a71, "PgLineABCBuilder");
22924
+ PgLineABC = class extends (_b51 = PgColumn, _a72 = entityKind, _b51) {
22773
22925
  getSQLType() {
22774
22926
  return "line";
22775
22927
  }
@@ -22781,7 +22933,7 @@ var init_line = __esm({
22781
22933
  return `{${value.a},${value.b},${value.c}}`;
22782
22934
  }
22783
22935
  };
22784
- __publicField(PgLineABC, _a73, "PgLineABC");
22936
+ __publicField(PgLineABC, _a72, "PgLineABC");
22785
22937
  }
22786
22938
  });
22787
22939
 
@@ -22789,13 +22941,13 @@ var init_line = __esm({
22789
22941
  function macaddr(name2) {
22790
22942
  return new PgMacaddrBuilder(name2 ?? "");
22791
22943
  }
22792
- var _a74, _b52, PgMacaddrBuilder, _a75, _b53, PgMacaddr;
22944
+ var _a73, _b52, PgMacaddrBuilder, _a74, _b53, PgMacaddr;
22793
22945
  var init_macaddr = __esm({
22794
22946
  "../drizzle-orm/dist/pg-core/columns/macaddr.js"() {
22795
22947
  "use strict";
22796
22948
  init_entity();
22797
22949
  init_common2();
22798
- PgMacaddrBuilder = class extends (_b52 = PgColumnBuilder, _a74 = entityKind, _b52) {
22950
+ PgMacaddrBuilder = class extends (_b52 = PgColumnBuilder, _a73 = entityKind, _b52) {
22799
22951
  constructor(name2) {
22800
22952
  super(name2, "string", "PgMacaddr");
22801
22953
  }
@@ -22804,13 +22956,13 @@ var init_macaddr = __esm({
22804
22956
  return new PgMacaddr(table4, this.config);
22805
22957
  }
22806
22958
  };
22807
- __publicField(PgMacaddrBuilder, _a74, "PgMacaddrBuilder");
22808
- PgMacaddr = class extends (_b53 = PgColumn, _a75 = entityKind, _b53) {
22959
+ __publicField(PgMacaddrBuilder, _a73, "PgMacaddrBuilder");
22960
+ PgMacaddr = class extends (_b53 = PgColumn, _a74 = entityKind, _b53) {
22809
22961
  getSQLType() {
22810
22962
  return "macaddr";
22811
22963
  }
22812
22964
  };
22813
- __publicField(PgMacaddr, _a75, "PgMacaddr");
22965
+ __publicField(PgMacaddr, _a74, "PgMacaddr");
22814
22966
  }
22815
22967
  });
22816
22968
 
@@ -22818,13 +22970,13 @@ var init_macaddr = __esm({
22818
22970
  function macaddr8(name2) {
22819
22971
  return new PgMacaddr8Builder(name2 ?? "");
22820
22972
  }
22821
- var _a76, _b54, PgMacaddr8Builder, _a77, _b55, PgMacaddr8;
22973
+ var _a75, _b54, PgMacaddr8Builder, _a76, _b55, PgMacaddr8;
22822
22974
  var init_macaddr8 = __esm({
22823
22975
  "../drizzle-orm/dist/pg-core/columns/macaddr8.js"() {
22824
22976
  "use strict";
22825
22977
  init_entity();
22826
22978
  init_common2();
22827
- PgMacaddr8Builder = class extends (_b54 = PgColumnBuilder, _a76 = entityKind, _b54) {
22979
+ PgMacaddr8Builder = class extends (_b54 = PgColumnBuilder, _a75 = entityKind, _b54) {
22828
22980
  constructor(name2) {
22829
22981
  super(name2, "string", "PgMacaddr8");
22830
22982
  }
@@ -22833,13 +22985,13 @@ var init_macaddr8 = __esm({
22833
22985
  return new PgMacaddr8(table4, this.config);
22834
22986
  }
22835
22987
  };
22836
- __publicField(PgMacaddr8Builder, _a76, "PgMacaddr8Builder");
22837
- PgMacaddr8 = class extends (_b55 = PgColumn, _a77 = entityKind, _b55) {
22988
+ __publicField(PgMacaddr8Builder, _a75, "PgMacaddr8Builder");
22989
+ PgMacaddr8 = class extends (_b55 = PgColumn, _a76 = entityKind, _b55) {
22838
22990
  getSQLType() {
22839
22991
  return "macaddr8";
22840
22992
  }
22841
22993
  };
22842
- __publicField(PgMacaddr8, _a77, "PgMacaddr8");
22994
+ __publicField(PgMacaddr8, _a76, "PgMacaddr8");
22843
22995
  }
22844
22996
  });
22845
22997
 
@@ -22848,14 +23000,14 @@ function numeric(a, b) {
22848
23000
  const { name: name2, config } = getColumnNameAndConfig(a, b);
22849
23001
  return new PgNumericBuilder(name2, config?.precision, config?.scale);
22850
23002
  }
22851
- var _a78, _b56, PgNumericBuilder, _a79, _b57, PgNumeric;
23003
+ var _a77, _b56, PgNumericBuilder, _a78, _b57, PgNumeric;
22852
23004
  var init_numeric = __esm({
22853
23005
  "../drizzle-orm/dist/pg-core/columns/numeric.js"() {
22854
23006
  "use strict";
22855
23007
  init_entity();
22856
23008
  init_utils2();
22857
23009
  init_common2();
22858
- PgNumericBuilder = class extends (_b56 = PgColumnBuilder, _a78 = entityKind, _b56) {
23010
+ PgNumericBuilder = class extends (_b56 = PgColumnBuilder, _a77 = entityKind, _b56) {
22859
23011
  constructor(name2, precision, scale) {
22860
23012
  super(name2, "string", "PgNumeric");
22861
23013
  this.config.precision = precision;
@@ -22866,8 +23018,8 @@ var init_numeric = __esm({
22866
23018
  return new PgNumeric(table4, this.config);
22867
23019
  }
22868
23020
  };
22869
- __publicField(PgNumericBuilder, _a78, "PgNumericBuilder");
22870
- PgNumeric = class extends (_b57 = PgColumn, _a79 = entityKind, _b57) {
23021
+ __publicField(PgNumericBuilder, _a77, "PgNumericBuilder");
23022
+ PgNumeric = class extends (_b57 = PgColumn, _a78 = entityKind, _b57) {
22871
23023
  constructor(table4, config) {
22872
23024
  super(table4, config);
22873
23025
  __publicField(this, "precision");
@@ -22885,7 +23037,7 @@ var init_numeric = __esm({
22885
23037
  }
22886
23038
  }
22887
23039
  };
22888
- __publicField(PgNumeric, _a79, "PgNumeric");
23040
+ __publicField(PgNumeric, _a78, "PgNumeric");
22889
23041
  }
22890
23042
  });
22891
23043
 
@@ -22897,14 +23049,14 @@ function point(a, b) {
22897
23049
  }
22898
23050
  return new PgPointObjectBuilder(name2);
22899
23051
  }
22900
- var _a80, _b58, PgPointTupleBuilder, _a81, _b59, PgPointTuple, _a82, _b60, PgPointObjectBuilder, _a83, _b61, PgPointObject;
23052
+ var _a79, _b58, PgPointTupleBuilder, _a80, _b59, PgPointTuple, _a81, _b60, PgPointObjectBuilder, _a82, _b61, PgPointObject;
22901
23053
  var init_point = __esm({
22902
23054
  "../drizzle-orm/dist/pg-core/columns/point.js"() {
22903
23055
  "use strict";
22904
23056
  init_entity();
22905
23057
  init_utils2();
22906
23058
  init_common2();
22907
- PgPointTupleBuilder = class extends (_b58 = PgColumnBuilder, _a80 = entityKind, _b58) {
23059
+ PgPointTupleBuilder = class extends (_b58 = PgColumnBuilder, _a79 = entityKind, _b58) {
22908
23060
  constructor(name2) {
22909
23061
  super(name2, "array", "PgPointTuple");
22910
23062
  }
@@ -22916,8 +23068,8 @@ var init_point = __esm({
22916
23068
  );
22917
23069
  }
22918
23070
  };
22919
- __publicField(PgPointTupleBuilder, _a80, "PgPointTupleBuilder");
22920
- PgPointTuple = class extends (_b59 = PgColumn, _a81 = entityKind, _b59) {
23071
+ __publicField(PgPointTupleBuilder, _a79, "PgPointTupleBuilder");
23072
+ PgPointTuple = class extends (_b59 = PgColumn, _a80 = entityKind, _b59) {
22921
23073
  getSQLType() {
22922
23074
  return "point";
22923
23075
  }
@@ -22932,8 +23084,8 @@ var init_point = __esm({
22932
23084
  return `(${value[0]},${value[1]})`;
22933
23085
  }
22934
23086
  };
22935
- __publicField(PgPointTuple, _a81, "PgPointTuple");
22936
- PgPointObjectBuilder = class extends (_b60 = PgColumnBuilder, _a82 = entityKind, _b60) {
23087
+ __publicField(PgPointTuple, _a80, "PgPointTuple");
23088
+ PgPointObjectBuilder = class extends (_b60 = PgColumnBuilder, _a81 = entityKind, _b60) {
22937
23089
  constructor(name2) {
22938
23090
  super(name2, "json", "PgPointObject");
22939
23091
  }
@@ -22945,8 +23097,8 @@ var init_point = __esm({
22945
23097
  );
22946
23098
  }
22947
23099
  };
22948
- __publicField(PgPointObjectBuilder, _a82, "PgPointObjectBuilder");
22949
- PgPointObject = class extends (_b61 = PgColumn, _a83 = entityKind, _b61) {
23100
+ __publicField(PgPointObjectBuilder, _a81, "PgPointObjectBuilder");
23101
+ PgPointObject = class extends (_b61 = PgColumn, _a82 = entityKind, _b61) {
22950
23102
  getSQLType() {
22951
23103
  return "point";
22952
23104
  }
@@ -22961,7 +23113,7 @@ var init_point = __esm({
22961
23113
  return `(${value.x},${value.y})`;
22962
23114
  }
22963
23115
  };
22964
- __publicField(PgPointObject, _a83, "PgPointObject");
23116
+ __publicField(PgPointObject, _a82, "PgPointObject");
22965
23117
  }
22966
23118
  });
22967
23119
 
@@ -23017,7 +23169,7 @@ function geometry(a, b) {
23017
23169
  }
23018
23170
  return new PgGeometryObjectBuilder(name2);
23019
23171
  }
23020
- var _a84, _b62, PgGeometryBuilder, _a85, _b63, PgGeometry, _a86, _b64, PgGeometryObjectBuilder, _a87, _b65, PgGeometryObject;
23172
+ var _a83, _b62, PgGeometryBuilder, _a84, _b63, PgGeometry, _a85, _b64, PgGeometryObjectBuilder, _a86, _b65, PgGeometryObject;
23021
23173
  var init_geometry = __esm({
23022
23174
  "../drizzle-orm/dist/pg-core/columns/postgis_extension/geometry.js"() {
23023
23175
  "use strict";
@@ -23025,7 +23177,7 @@ var init_geometry = __esm({
23025
23177
  init_utils2();
23026
23178
  init_common2();
23027
23179
  init_utils3();
23028
- PgGeometryBuilder = class extends (_b62 = PgColumnBuilder, _a84 = entityKind, _b62) {
23180
+ PgGeometryBuilder = class extends (_b62 = PgColumnBuilder, _a83 = entityKind, _b62) {
23029
23181
  constructor(name2) {
23030
23182
  super(name2, "array", "PgGeometry");
23031
23183
  }
@@ -23037,8 +23189,8 @@ var init_geometry = __esm({
23037
23189
  );
23038
23190
  }
23039
23191
  };
23040
- __publicField(PgGeometryBuilder, _a84, "PgGeometryBuilder");
23041
- PgGeometry = class extends (_b63 = PgColumn, _a85 = entityKind, _b63) {
23192
+ __publicField(PgGeometryBuilder, _a83, "PgGeometryBuilder");
23193
+ PgGeometry = class extends (_b63 = PgColumn, _a84 = entityKind, _b63) {
23042
23194
  getSQLType() {
23043
23195
  return "geometry(point)";
23044
23196
  }
@@ -23049,8 +23201,8 @@ var init_geometry = __esm({
23049
23201
  return `point(${value[0]} ${value[1]})`;
23050
23202
  }
23051
23203
  };
23052
- __publicField(PgGeometry, _a85, "PgGeometry");
23053
- PgGeometryObjectBuilder = class extends (_b64 = PgColumnBuilder, _a86 = entityKind, _b64) {
23204
+ __publicField(PgGeometry, _a84, "PgGeometry");
23205
+ PgGeometryObjectBuilder = class extends (_b64 = PgColumnBuilder, _a85 = entityKind, _b64) {
23054
23206
  constructor(name2) {
23055
23207
  super(name2, "json", "PgGeometryObject");
23056
23208
  }
@@ -23062,8 +23214,8 @@ var init_geometry = __esm({
23062
23214
  );
23063
23215
  }
23064
23216
  };
23065
- __publicField(PgGeometryObjectBuilder, _a86, "PgGeometryObjectBuilder");
23066
- PgGeometryObject = class extends (_b65 = PgColumn, _a87 = entityKind, _b65) {
23217
+ __publicField(PgGeometryObjectBuilder, _a85, "PgGeometryObjectBuilder");
23218
+ PgGeometryObject = class extends (_b65 = PgColumn, _a86 = entityKind, _b65) {
23067
23219
  getSQLType() {
23068
23220
  return "geometry(point)";
23069
23221
  }
@@ -23075,7 +23227,7 @@ var init_geometry = __esm({
23075
23227
  return `point(${value.x} ${value.y})`;
23076
23228
  }
23077
23229
  };
23078
- __publicField(PgGeometryObject, _a87, "PgGeometryObject");
23230
+ __publicField(PgGeometryObject, _a86, "PgGeometryObject");
23079
23231
  }
23080
23232
  });
23081
23233
 
@@ -23083,13 +23235,13 @@ var init_geometry = __esm({
23083
23235
  function real(name2) {
23084
23236
  return new PgRealBuilder(name2 ?? "");
23085
23237
  }
23086
- var _a88, _b66, PgRealBuilder, _a89, _b67, PgReal;
23238
+ var _a87, _b66, PgRealBuilder, _a88, _b67, PgReal;
23087
23239
  var init_real = __esm({
23088
23240
  "../drizzle-orm/dist/pg-core/columns/real.js"() {
23089
23241
  "use strict";
23090
23242
  init_entity();
23091
23243
  init_common2();
23092
- PgRealBuilder = class extends (_b66 = PgColumnBuilder, _a88 = entityKind, _b66) {
23244
+ PgRealBuilder = class extends (_b66 = PgColumnBuilder, _a87 = entityKind, _b66) {
23093
23245
  constructor(name2, length) {
23094
23246
  super(name2, "number", "PgReal");
23095
23247
  this.config.length = length;
@@ -23099,8 +23251,8 @@ var init_real = __esm({
23099
23251
  return new PgReal(table4, this.config);
23100
23252
  }
23101
23253
  };
23102
- __publicField(PgRealBuilder, _a88, "PgRealBuilder");
23103
- PgReal = class extends (_b67 = PgColumn, _a89 = entityKind, _b67) {
23254
+ __publicField(PgRealBuilder, _a87, "PgRealBuilder");
23255
+ PgReal = class extends (_b67 = PgColumn, _a88 = entityKind, _b67) {
23104
23256
  constructor(table4, config) {
23105
23257
  super(table4, config);
23106
23258
  __publicField(this, "mapFromDriverValue", (value) => {
@@ -23114,7 +23266,7 @@ var init_real = __esm({
23114
23266
  return "real";
23115
23267
  }
23116
23268
  };
23117
- __publicField(PgReal, _a89, "PgReal");
23269
+ __publicField(PgReal, _a88, "PgReal");
23118
23270
  }
23119
23271
  });
23120
23272
 
@@ -23122,13 +23274,13 @@ var init_real = __esm({
23122
23274
  function serial(name2) {
23123
23275
  return new PgSerialBuilder(name2 ?? "");
23124
23276
  }
23125
- var _a90, _b68, PgSerialBuilder, _a91, _b69, PgSerial;
23277
+ var _a89, _b68, PgSerialBuilder, _a90, _b69, PgSerial;
23126
23278
  var init_serial = __esm({
23127
23279
  "../drizzle-orm/dist/pg-core/columns/serial.js"() {
23128
23280
  "use strict";
23129
23281
  init_entity();
23130
23282
  init_common2();
23131
- PgSerialBuilder = class extends (_b68 = PgColumnBuilder, _a90 = entityKind, _b68) {
23283
+ PgSerialBuilder = class extends (_b68 = PgColumnBuilder, _a89 = entityKind, _b68) {
23132
23284
  constructor(name2) {
23133
23285
  super(name2, "number", "PgSerial");
23134
23286
  this.config.hasDefault = true;
@@ -23139,13 +23291,13 @@ var init_serial = __esm({
23139
23291
  return new PgSerial(table4, this.config);
23140
23292
  }
23141
23293
  };
23142
- __publicField(PgSerialBuilder, _a90, "PgSerialBuilder");
23143
- PgSerial = class extends (_b69 = PgColumn, _a91 = entityKind, _b69) {
23294
+ __publicField(PgSerialBuilder, _a89, "PgSerialBuilder");
23295
+ PgSerial = class extends (_b69 = PgColumn, _a90 = entityKind, _b69) {
23144
23296
  getSQLType() {
23145
23297
  return "serial";
23146
23298
  }
23147
23299
  };
23148
- __publicField(PgSerial, _a91, "PgSerial");
23300
+ __publicField(PgSerial, _a90, "PgSerial");
23149
23301
  }
23150
23302
  });
23151
23303
 
@@ -23153,14 +23305,14 @@ var init_serial = __esm({
23153
23305
  function smallint(name2) {
23154
23306
  return new PgSmallIntBuilder(name2 ?? "");
23155
23307
  }
23156
- var _a92, _b70, PgSmallIntBuilder, _a93, _b71, PgSmallInt;
23308
+ var _a91, _b70, PgSmallIntBuilder, _a92, _b71, PgSmallInt;
23157
23309
  var init_smallint = __esm({
23158
23310
  "../drizzle-orm/dist/pg-core/columns/smallint.js"() {
23159
23311
  "use strict";
23160
23312
  init_entity();
23161
23313
  init_common2();
23162
23314
  init_int_common();
23163
- PgSmallIntBuilder = class extends (_b70 = PgIntColumnBaseBuilder, _a92 = entityKind, _b70) {
23315
+ PgSmallIntBuilder = class extends (_b70 = PgIntColumnBaseBuilder, _a91 = entityKind, _b70) {
23164
23316
  constructor(name2) {
23165
23317
  super(name2, "number", "PgSmallInt");
23166
23318
  }
@@ -23169,8 +23321,8 @@ var init_smallint = __esm({
23169
23321
  return new PgSmallInt(table4, this.config);
23170
23322
  }
23171
23323
  };
23172
- __publicField(PgSmallIntBuilder, _a92, "PgSmallIntBuilder");
23173
- PgSmallInt = class extends (_b71 = PgColumn, _a93 = entityKind, _b71) {
23324
+ __publicField(PgSmallIntBuilder, _a91, "PgSmallIntBuilder");
23325
+ PgSmallInt = class extends (_b71 = PgColumn, _a92 = entityKind, _b71) {
23174
23326
  constructor() {
23175
23327
  super(...arguments);
23176
23328
  __publicField(this, "mapFromDriverValue", (value) => {
@@ -23184,7 +23336,7 @@ var init_smallint = __esm({
23184
23336
  return "smallint";
23185
23337
  }
23186
23338
  };
23187
- __publicField(PgSmallInt, _a93, "PgSmallInt");
23339
+ __publicField(PgSmallInt, _a92, "PgSmallInt");
23188
23340
  }
23189
23341
  });
23190
23342
 
@@ -23192,13 +23344,13 @@ var init_smallint = __esm({
23192
23344
  function smallserial(name2) {
23193
23345
  return new PgSmallSerialBuilder(name2 ?? "");
23194
23346
  }
23195
- var _a94, _b72, PgSmallSerialBuilder, _a95, _b73, PgSmallSerial;
23347
+ var _a93, _b72, PgSmallSerialBuilder, _a94, _b73, PgSmallSerial;
23196
23348
  var init_smallserial = __esm({
23197
23349
  "../drizzle-orm/dist/pg-core/columns/smallserial.js"() {
23198
23350
  "use strict";
23199
23351
  init_entity();
23200
23352
  init_common2();
23201
- PgSmallSerialBuilder = class extends (_b72 = PgColumnBuilder, _a94 = entityKind, _b72) {
23353
+ PgSmallSerialBuilder = class extends (_b72 = PgColumnBuilder, _a93 = entityKind, _b72) {
23202
23354
  constructor(name2) {
23203
23355
  super(name2, "number", "PgSmallSerial");
23204
23356
  this.config.hasDefault = true;
@@ -23212,13 +23364,13 @@ var init_smallserial = __esm({
23212
23364
  );
23213
23365
  }
23214
23366
  };
23215
- __publicField(PgSmallSerialBuilder, _a94, "PgSmallSerialBuilder");
23216
- PgSmallSerial = class extends (_b73 = PgColumn, _a95 = entityKind, _b73) {
23367
+ __publicField(PgSmallSerialBuilder, _a93, "PgSmallSerialBuilder");
23368
+ PgSmallSerial = class extends (_b73 = PgColumn, _a94 = entityKind, _b73) {
23217
23369
  getSQLType() {
23218
23370
  return "smallserial";
23219
23371
  }
23220
23372
  };
23221
- __publicField(PgSmallSerial, _a95, "PgSmallSerial");
23373
+ __publicField(PgSmallSerial, _a94, "PgSmallSerial");
23222
23374
  }
23223
23375
  });
23224
23376
 
@@ -23227,14 +23379,14 @@ function text(a, b = {}) {
23227
23379
  const { name: name2, config } = getColumnNameAndConfig(a, b);
23228
23380
  return new PgTextBuilder(name2, config);
23229
23381
  }
23230
- var _a96, _b74, PgTextBuilder, _a97, _b75, PgText;
23382
+ var _a95, _b74, PgTextBuilder, _a96, _b75, PgText;
23231
23383
  var init_text = __esm({
23232
23384
  "../drizzle-orm/dist/pg-core/columns/text.js"() {
23233
23385
  "use strict";
23234
23386
  init_entity();
23235
23387
  init_utils2();
23236
23388
  init_common2();
23237
- PgTextBuilder = class extends (_b74 = PgColumnBuilder, _a96 = entityKind, _b74) {
23389
+ PgTextBuilder = class extends (_b74 = PgColumnBuilder, _a95 = entityKind, _b74) {
23238
23390
  constructor(name2, config) {
23239
23391
  super(name2, "string", "PgText");
23240
23392
  this.config.enumValues = config.enum;
@@ -23244,8 +23396,8 @@ var init_text = __esm({
23244
23396
  return new PgText(table4, this.config);
23245
23397
  }
23246
23398
  };
23247
- __publicField(PgTextBuilder, _a96, "PgTextBuilder");
23248
- PgText = class extends (_b75 = PgColumn, _a97 = entityKind, _b75) {
23399
+ __publicField(PgTextBuilder, _a95, "PgTextBuilder");
23400
+ PgText = class extends (_b75 = PgColumn, _a96 = entityKind, _b75) {
23249
23401
  constructor() {
23250
23402
  super(...arguments);
23251
23403
  __publicField(this, "enumValues", this.config.enumValues);
@@ -23254,7 +23406,7 @@ var init_text = __esm({
23254
23406
  return "text";
23255
23407
  }
23256
23408
  };
23257
- __publicField(PgText, _a97, "PgText");
23409
+ __publicField(PgText, _a96, "PgText");
23258
23410
  }
23259
23411
  });
23260
23412
 
@@ -23263,7 +23415,7 @@ function time(a, b = {}) {
23263
23415
  const { name: name2, config } = getColumnNameAndConfig(a, b);
23264
23416
  return new PgTimeBuilder(name2, config.withTimezone ?? false, config.precision);
23265
23417
  }
23266
- var _a98, _b76, PgTimeBuilder, _a99, _b77, PgTime;
23418
+ var _a97, _b76, PgTimeBuilder, _a98, _b77, PgTime;
23267
23419
  var init_time = __esm({
23268
23420
  "../drizzle-orm/dist/pg-core/columns/time.js"() {
23269
23421
  "use strict";
@@ -23271,7 +23423,7 @@ var init_time = __esm({
23271
23423
  init_utils2();
23272
23424
  init_common2();
23273
23425
  init_date_common();
23274
- PgTimeBuilder = class extends (_b76 = PgDateColumnBaseBuilder, _a98 = entityKind, _b76) {
23426
+ PgTimeBuilder = class extends (_b76 = PgDateColumnBaseBuilder, _a97 = entityKind, _b76) {
23275
23427
  constructor(name2, withTimezone, precision) {
23276
23428
  super(name2, "string", "PgTime");
23277
23429
  this.withTimezone = withTimezone;
@@ -23284,8 +23436,8 @@ var init_time = __esm({
23284
23436
  return new PgTime(table4, this.config);
23285
23437
  }
23286
23438
  };
23287
- __publicField(PgTimeBuilder, _a98, "PgTimeBuilder");
23288
- PgTime = class extends (_b77 = PgColumn, _a99 = entityKind, _b77) {
23439
+ __publicField(PgTimeBuilder, _a97, "PgTimeBuilder");
23440
+ PgTime = class extends (_b77 = PgColumn, _a98 = entityKind, _b77) {
23289
23441
  constructor(table4, config) {
23290
23442
  super(table4, config);
23291
23443
  __publicField(this, "withTimezone");
@@ -23298,7 +23450,7 @@ var init_time = __esm({
23298
23450
  return `time${precision}${this.withTimezone ? " with time zone" : ""}`;
23299
23451
  }
23300
23452
  };
23301
- __publicField(PgTime, _a99, "PgTime");
23453
+ __publicField(PgTime, _a98, "PgTime");
23302
23454
  }
23303
23455
  });
23304
23456
 
@@ -23310,7 +23462,7 @@ function timestamp(a, b = {}) {
23310
23462
  }
23311
23463
  return new PgTimestampBuilder(name2, config?.withTimezone ?? false, config?.precision);
23312
23464
  }
23313
- var _a100, _b78, PgTimestampBuilder, _a101, _b79, PgTimestamp, _a102, _b80, PgTimestampStringBuilder, _a103, _b81, PgTimestampString;
23465
+ var _a99, _b78, PgTimestampBuilder, _a100, _b79, PgTimestamp, _a101, _b80, PgTimestampStringBuilder, _a102, _b81, PgTimestampString;
23314
23466
  var init_timestamp = __esm({
23315
23467
  "../drizzle-orm/dist/pg-core/columns/timestamp.js"() {
23316
23468
  "use strict";
@@ -23318,7 +23470,7 @@ var init_timestamp = __esm({
23318
23470
  init_utils2();
23319
23471
  init_common2();
23320
23472
  init_date_common();
23321
- PgTimestampBuilder = class extends (_b78 = PgDateColumnBaseBuilder, _a100 = entityKind, _b78) {
23473
+ PgTimestampBuilder = class extends (_b78 = PgDateColumnBaseBuilder, _a99 = entityKind, _b78) {
23322
23474
  constructor(name2, withTimezone, precision) {
23323
23475
  super(name2, "date", "PgTimestamp");
23324
23476
  this.config.withTimezone = withTimezone;
@@ -23329,8 +23481,8 @@ var init_timestamp = __esm({
23329
23481
  return new PgTimestamp(table4, this.config);
23330
23482
  }
23331
23483
  };
23332
- __publicField(PgTimestampBuilder, _a100, "PgTimestampBuilder");
23333
- PgTimestamp = class extends (_b79 = PgColumn, _a101 = entityKind, _b79) {
23484
+ __publicField(PgTimestampBuilder, _a99, "PgTimestampBuilder");
23485
+ PgTimestamp = class extends (_b79 = PgColumn, _a100 = entityKind, _b79) {
23334
23486
  constructor(table4, config) {
23335
23487
  super(table4, config);
23336
23488
  __publicField(this, "withTimezone");
@@ -23349,8 +23501,8 @@ var init_timestamp = __esm({
23349
23501
  return `timestamp${precision}${this.withTimezone ? " with time zone" : ""}`;
23350
23502
  }
23351
23503
  };
23352
- __publicField(PgTimestamp, _a101, "PgTimestamp");
23353
- PgTimestampStringBuilder = class extends (_b80 = PgDateColumnBaseBuilder, _a102 = entityKind, _b80) {
23504
+ __publicField(PgTimestamp, _a100, "PgTimestamp");
23505
+ PgTimestampStringBuilder = class extends (_b80 = PgDateColumnBaseBuilder, _a101 = entityKind, _b80) {
23354
23506
  constructor(name2, withTimezone, precision) {
23355
23507
  super(name2, "string", "PgTimestampString");
23356
23508
  this.config.withTimezone = withTimezone;
@@ -23364,8 +23516,8 @@ var init_timestamp = __esm({
23364
23516
  );
23365
23517
  }
23366
23518
  };
23367
- __publicField(PgTimestampStringBuilder, _a102, "PgTimestampStringBuilder");
23368
- PgTimestampString = class extends (_b81 = PgColumn, _a103 = entityKind, _b81) {
23519
+ __publicField(PgTimestampStringBuilder, _a101, "PgTimestampStringBuilder");
23520
+ PgTimestampString = class extends (_b81 = PgColumn, _a102 = entityKind, _b81) {
23369
23521
  constructor(table4, config) {
23370
23522
  super(table4, config);
23371
23523
  __publicField(this, "withTimezone");
@@ -23378,7 +23530,7 @@ var init_timestamp = __esm({
23378
23530
  return `timestamp${precision}${this.withTimezone ? " with time zone" : ""}`;
23379
23531
  }
23380
23532
  };
23381
- __publicField(PgTimestampString, _a103, "PgTimestampString");
23533
+ __publicField(PgTimestampString, _a102, "PgTimestampString");
23382
23534
  }
23383
23535
  });
23384
23536
 
@@ -23386,14 +23538,14 @@ var init_timestamp = __esm({
23386
23538
  function uuid(name2) {
23387
23539
  return new PgUUIDBuilder(name2 ?? "");
23388
23540
  }
23389
- var _a104, _b82, PgUUIDBuilder, _a105, _b83, PgUUID;
23541
+ var _a103, _b82, PgUUIDBuilder, _a104, _b83, PgUUID;
23390
23542
  var init_uuid = __esm({
23391
23543
  "../drizzle-orm/dist/pg-core/columns/uuid.js"() {
23392
23544
  "use strict";
23393
23545
  init_entity();
23394
23546
  init_sql();
23395
23547
  init_common2();
23396
- PgUUIDBuilder = class extends (_b82 = PgColumnBuilder, _a104 = entityKind, _b82) {
23548
+ PgUUIDBuilder = class extends (_b82 = PgColumnBuilder, _a103 = entityKind, _b82) {
23397
23549
  constructor(name2) {
23398
23550
  super(name2, "string", "PgUUID");
23399
23551
  }
@@ -23408,13 +23560,13 @@ var init_uuid = __esm({
23408
23560
  return new PgUUID(table4, this.config);
23409
23561
  }
23410
23562
  };
23411
- __publicField(PgUUIDBuilder, _a104, "PgUUIDBuilder");
23412
- PgUUID = class extends (_b83 = PgColumn, _a105 = entityKind, _b83) {
23563
+ __publicField(PgUUIDBuilder, _a103, "PgUUIDBuilder");
23564
+ PgUUID = class extends (_b83 = PgColumn, _a104 = entityKind, _b83) {
23413
23565
  getSQLType() {
23414
23566
  return "uuid";
23415
23567
  }
23416
23568
  };
23417
- __publicField(PgUUID, _a105, "PgUUID");
23569
+ __publicField(PgUUID, _a104, "PgUUID");
23418
23570
  }
23419
23571
  });
23420
23572
 
@@ -23423,14 +23575,14 @@ function varchar(a, b = {}) {
23423
23575
  const { name: name2, config } = getColumnNameAndConfig(a, b);
23424
23576
  return new PgVarcharBuilder(name2, config);
23425
23577
  }
23426
- var _a106, _b84, PgVarcharBuilder, _a107, _b85, PgVarchar;
23578
+ var _a105, _b84, PgVarcharBuilder, _a106, _b85, PgVarchar;
23427
23579
  var init_varchar = __esm({
23428
23580
  "../drizzle-orm/dist/pg-core/columns/varchar.js"() {
23429
23581
  "use strict";
23430
23582
  init_entity();
23431
23583
  init_utils2();
23432
23584
  init_common2();
23433
- PgVarcharBuilder = class extends (_b84 = PgColumnBuilder, _a106 = entityKind, _b84) {
23585
+ PgVarcharBuilder = class extends (_b84 = PgColumnBuilder, _a105 = entityKind, _b84) {
23434
23586
  constructor(name2, config) {
23435
23587
  super(name2, "string", "PgVarchar");
23436
23588
  this.config.length = config.length;
@@ -23441,8 +23593,8 @@ var init_varchar = __esm({
23441
23593
  return new PgVarchar(table4, this.config);
23442
23594
  }
23443
23595
  };
23444
- __publicField(PgVarcharBuilder, _a106, "PgVarcharBuilder");
23445
- PgVarchar = class extends (_b85 = PgColumn, _a107 = entityKind, _b85) {
23596
+ __publicField(PgVarcharBuilder, _a105, "PgVarcharBuilder");
23597
+ PgVarchar = class extends (_b85 = PgColumn, _a106 = entityKind, _b85) {
23446
23598
  constructor() {
23447
23599
  super(...arguments);
23448
23600
  __publicField(this, "length", this.config.length);
@@ -23452,7 +23604,7 @@ var init_varchar = __esm({
23452
23604
  return this.length === void 0 ? `varchar` : `varchar(${this.length})`;
23453
23605
  }
23454
23606
  };
23455
- __publicField(PgVarchar, _a107, "PgVarchar");
23607
+ __publicField(PgVarchar, _a106, "PgVarchar");
23456
23608
  }
23457
23609
  });
23458
23610
 
@@ -23461,14 +23613,14 @@ function bit(a, b) {
23461
23613
  const { name: name2, config } = getColumnNameAndConfig(a, b);
23462
23614
  return new PgBinaryVectorBuilder(name2, config);
23463
23615
  }
23464
- var _a108, _b86, PgBinaryVectorBuilder, _a109, _b87, PgBinaryVector;
23616
+ var _a107, _b86, PgBinaryVectorBuilder, _a108, _b87, PgBinaryVector;
23465
23617
  var init_bit = __esm({
23466
23618
  "../drizzle-orm/dist/pg-core/columns/vector_extension/bit.js"() {
23467
23619
  "use strict";
23468
23620
  init_entity();
23469
23621
  init_utils2();
23470
23622
  init_common2();
23471
- PgBinaryVectorBuilder = class extends (_b86 = PgColumnBuilder, _a108 = entityKind, _b86) {
23623
+ PgBinaryVectorBuilder = class extends (_b86 = PgColumnBuilder, _a107 = entityKind, _b86) {
23472
23624
  constructor(name2, config) {
23473
23625
  super(name2, "string", "PgBinaryVector");
23474
23626
  this.config.dimensions = config.dimensions;
@@ -23481,8 +23633,8 @@ var init_bit = __esm({
23481
23633
  );
23482
23634
  }
23483
23635
  };
23484
- __publicField(PgBinaryVectorBuilder, _a108, "PgBinaryVectorBuilder");
23485
- PgBinaryVector = class extends (_b87 = PgColumn, _a109 = entityKind, _b87) {
23636
+ __publicField(PgBinaryVectorBuilder, _a107, "PgBinaryVectorBuilder");
23637
+ PgBinaryVector = class extends (_b87 = PgColumn, _a108 = entityKind, _b87) {
23486
23638
  constructor() {
23487
23639
  super(...arguments);
23488
23640
  __publicField(this, "dimensions", this.config.dimensions);
@@ -23491,7 +23643,7 @@ var init_bit = __esm({
23491
23643
  return `bit(${this.dimensions})`;
23492
23644
  }
23493
23645
  };
23494
- __publicField(PgBinaryVector, _a109, "PgBinaryVector");
23646
+ __publicField(PgBinaryVector, _a108, "PgBinaryVector");
23495
23647
  }
23496
23648
  });
23497
23649
 
@@ -23500,14 +23652,14 @@ function halfvec(a, b) {
23500
23652
  const { name: name2, config } = getColumnNameAndConfig(a, b);
23501
23653
  return new PgHalfVectorBuilder(name2, config);
23502
23654
  }
23503
- var _a110, _b88, PgHalfVectorBuilder, _a111, _b89, PgHalfVector;
23655
+ var _a109, _b88, PgHalfVectorBuilder, _a110, _b89, PgHalfVector;
23504
23656
  var init_halfvec = __esm({
23505
23657
  "../drizzle-orm/dist/pg-core/columns/vector_extension/halfvec.js"() {
23506
23658
  "use strict";
23507
23659
  init_entity();
23508
23660
  init_utils2();
23509
23661
  init_common2();
23510
- PgHalfVectorBuilder = class extends (_b88 = PgColumnBuilder, _a110 = entityKind, _b88) {
23662
+ PgHalfVectorBuilder = class extends (_b88 = PgColumnBuilder, _a109 = entityKind, _b88) {
23511
23663
  constructor(name2, config) {
23512
23664
  super(name2, "array", "PgHalfVector");
23513
23665
  this.config.dimensions = config.dimensions;
@@ -23520,8 +23672,8 @@ var init_halfvec = __esm({
23520
23672
  );
23521
23673
  }
23522
23674
  };
23523
- __publicField(PgHalfVectorBuilder, _a110, "PgHalfVectorBuilder");
23524
- PgHalfVector = class extends (_b89 = PgColumn, _a111 = entityKind, _b89) {
23675
+ __publicField(PgHalfVectorBuilder, _a109, "PgHalfVectorBuilder");
23676
+ PgHalfVector = class extends (_b89 = PgColumn, _a110 = entityKind, _b89) {
23525
23677
  constructor() {
23526
23678
  super(...arguments);
23527
23679
  __publicField(this, "dimensions", this.config.dimensions);
@@ -23536,7 +23688,7 @@ var init_halfvec = __esm({
23536
23688
  return value.slice(1, -1).split(",").map((v) => Number.parseFloat(v));
23537
23689
  }
23538
23690
  };
23539
- __publicField(PgHalfVector, _a111, "PgHalfVector");
23691
+ __publicField(PgHalfVector, _a110, "PgHalfVector");
23540
23692
  }
23541
23693
  });
23542
23694
 
@@ -23545,14 +23697,14 @@ function sparsevec(a, b) {
23545
23697
  const { name: name2, config } = getColumnNameAndConfig(a, b);
23546
23698
  return new PgSparseVectorBuilder(name2, config);
23547
23699
  }
23548
- var _a112, _b90, PgSparseVectorBuilder, _a113, _b91, PgSparseVector;
23700
+ var _a111, _b90, PgSparseVectorBuilder, _a112, _b91, PgSparseVector;
23549
23701
  var init_sparsevec = __esm({
23550
23702
  "../drizzle-orm/dist/pg-core/columns/vector_extension/sparsevec.js"() {
23551
23703
  "use strict";
23552
23704
  init_entity();
23553
23705
  init_utils2();
23554
23706
  init_common2();
23555
- PgSparseVectorBuilder = class extends (_b90 = PgColumnBuilder, _a112 = entityKind, _b90) {
23707
+ PgSparseVectorBuilder = class extends (_b90 = PgColumnBuilder, _a111 = entityKind, _b90) {
23556
23708
  constructor(name2, config) {
23557
23709
  super(name2, "string", "PgSparseVector");
23558
23710
  this.config.dimensions = config.dimensions;
@@ -23565,8 +23717,8 @@ var init_sparsevec = __esm({
23565
23717
  );
23566
23718
  }
23567
23719
  };
23568
- __publicField(PgSparseVectorBuilder, _a112, "PgSparseVectorBuilder");
23569
- PgSparseVector = class extends (_b91 = PgColumn, _a113 = entityKind, _b91) {
23720
+ __publicField(PgSparseVectorBuilder, _a111, "PgSparseVectorBuilder");
23721
+ PgSparseVector = class extends (_b91 = PgColumn, _a112 = entityKind, _b91) {
23570
23722
  constructor() {
23571
23723
  super(...arguments);
23572
23724
  __publicField(this, "dimensions", this.config.dimensions);
@@ -23575,7 +23727,7 @@ var init_sparsevec = __esm({
23575
23727
  return `sparsevec(${this.dimensions})`;
23576
23728
  }
23577
23729
  };
23578
- __publicField(PgSparseVector, _a113, "PgSparseVector");
23730
+ __publicField(PgSparseVector, _a112, "PgSparseVector");
23579
23731
  }
23580
23732
  });
23581
23733
 
@@ -23584,14 +23736,14 @@ function vector(a, b) {
23584
23736
  const { name: name2, config } = getColumnNameAndConfig(a, b);
23585
23737
  return new PgVectorBuilder(name2, config);
23586
23738
  }
23587
- var _a114, _b92, PgVectorBuilder, _a115, _b93, PgVector;
23739
+ var _a113, _b92, PgVectorBuilder, _a114, _b93, PgVector;
23588
23740
  var init_vector2 = __esm({
23589
23741
  "../drizzle-orm/dist/pg-core/columns/vector_extension/vector.js"() {
23590
23742
  "use strict";
23591
23743
  init_entity();
23592
23744
  init_utils2();
23593
23745
  init_common2();
23594
- PgVectorBuilder = class extends (_b92 = PgColumnBuilder, _a114 = entityKind, _b92) {
23746
+ PgVectorBuilder = class extends (_b92 = PgColumnBuilder, _a113 = entityKind, _b92) {
23595
23747
  constructor(name2, config) {
23596
23748
  super(name2, "array", "PgVector");
23597
23749
  this.config.dimensions = config.dimensions;
@@ -23601,8 +23753,8 @@ var init_vector2 = __esm({
23601
23753
  return new PgVector(table4, this.config);
23602
23754
  }
23603
23755
  };
23604
- __publicField(PgVectorBuilder, _a114, "PgVectorBuilder");
23605
- PgVector = class extends (_b93 = PgColumn, _a115 = entityKind, _b93) {
23756
+ __publicField(PgVectorBuilder, _a113, "PgVectorBuilder");
23757
+ PgVector = class extends (_b93 = PgColumn, _a114 = entityKind, _b93) {
23606
23758
  constructor() {
23607
23759
  super(...arguments);
23608
23760
  __publicField(this, "dimensions", this.config.dimensions);
@@ -23617,7 +23769,7 @@ var init_vector2 = __esm({
23617
23769
  return value.slice(1, -1).split(",").map((v) => Number.parseFloat(v));
23618
23770
  }
23619
23771
  };
23620
- __publicField(PgVector, _a115, "PgVector");
23772
+ __publicField(PgVector, _a114, "PgVector");
23621
23773
  }
23622
23774
  });
23623
23775
 
@@ -23718,8 +23870,8 @@ function pgTableWithSchema(name2, columns, extraConfig, schema4, baseName = name
23718
23870
  })
23719
23871
  );
23720
23872
  const table4 = Object.assign(rawTable, builtColumns);
23721
- table4[Table.Symbol.Columns] = builtColumns;
23722
- table4[Table.Symbol.ExtraConfigColumns] = builtColumnsForExtraConfig;
23873
+ table4[Table2.Symbol.Columns] = builtColumns;
23874
+ table4[Table2.Symbol.ExtraConfigColumns] = builtColumnsForExtraConfig;
23723
23875
  if (extraConfig) {
23724
23876
  table4[PgTable.Symbol.ExtraConfigBuilder] = extraConfig;
23725
23877
  }
@@ -23730,7 +23882,7 @@ function pgTableWithSchema(name2, columns, extraConfig, schema4, baseName = name
23730
23882
  }
23731
23883
  });
23732
23884
  }
23733
- var InlineForeignKeys, EnableRLS, _a116, _b94, _c2, _d2, _e2, PgTable, pgTable;
23885
+ var InlineForeignKeys, EnableRLS, _a115, _b94, _c2, _d2, _e2, PgTable, pgTable;
23734
23886
  var init_table2 = __esm({
23735
23887
  "../drizzle-orm/dist/pg-core/table.js"() {
23736
23888
  "use strict";
@@ -23739,7 +23891,7 @@ var init_table2 = __esm({
23739
23891
  init_all();
23740
23892
  InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys");
23741
23893
  EnableRLS = Symbol.for("drizzle:EnableRLS");
23742
- PgTable = class extends (_e2 = Table, _d2 = entityKind, _c2 = InlineForeignKeys, _b94 = EnableRLS, _a116 = Table.Symbol.ExtraConfigBuilder, _e2) {
23894
+ PgTable = class extends (_e2 = Table2, _d2 = entityKind, _c2 = InlineForeignKeys, _b94 = EnableRLS, _a115 = Table2.Symbol.ExtraConfigBuilder, _e2) {
23743
23895
  constructor() {
23744
23896
  super(...arguments);
23745
23897
  /**@internal */
@@ -23747,12 +23899,12 @@ var init_table2 = __esm({
23747
23899
  /** @internal */
23748
23900
  __publicField(this, _b94, false);
23749
23901
  /** @internal */
23750
- __publicField(this, _a116);
23902
+ __publicField(this, _a115);
23751
23903
  }
23752
23904
  };
23753
23905
  __publicField(PgTable, _d2, "PgTable");
23754
23906
  /** @internal */
23755
- __publicField(PgTable, "Symbol", Object.assign({}, Table.Symbol, {
23907
+ __publicField(PgTable, "Symbol", Object.assign({}, Table2.Symbol, {
23756
23908
  InlineForeignKeys,
23757
23909
  EnableRLS
23758
23910
  }));
@@ -23763,13 +23915,13 @@ var init_table2 = __esm({
23763
23915
  });
23764
23916
 
23765
23917
  // ../drizzle-orm/dist/pg-core/primary-keys.js
23766
- var _a117, PrimaryKeyBuilder, _a118, PrimaryKey;
23918
+ var _a116, PrimaryKeyBuilder, _a117, PrimaryKey;
23767
23919
  var init_primary_keys = __esm({
23768
23920
  "../drizzle-orm/dist/pg-core/primary-keys.js"() {
23769
23921
  "use strict";
23770
23922
  init_entity();
23771
23923
  init_table2();
23772
- _a117 = entityKind;
23924
+ _a116 = entityKind;
23773
23925
  PrimaryKeyBuilder = class {
23774
23926
  constructor(columns, name2) {
23775
23927
  /** @internal */
@@ -23784,8 +23936,8 @@ var init_primary_keys = __esm({
23784
23936
  return new PrimaryKey(table4, this.columns, this.name);
23785
23937
  }
23786
23938
  };
23787
- __publicField(PrimaryKeyBuilder, _a117, "PgPrimaryKeyBuilder");
23788
- _a118 = entityKind;
23939
+ __publicField(PrimaryKeyBuilder, _a116, "PgPrimaryKeyBuilder");
23940
+ _a117 = entityKind;
23789
23941
  PrimaryKey = class {
23790
23942
  constructor(table4, columns, name2) {
23791
23943
  __publicField(this, "columns");
@@ -23798,7 +23950,7 @@ var init_primary_keys = __esm({
23798
23950
  return this.name ?? `${this.table[PgTable.Symbol.Name]}_${this.columns.map((column4) => column4.name).join("_")}_pk`;
23799
23951
  }
23800
23952
  };
23801
- __publicField(PrimaryKey, _a118, "PgPrimaryKey");
23953
+ __publicField(PrimaryKey, _a117, "PgPrimaryKey");
23802
23954
  }
23803
23955
  });
23804
23956
 
@@ -23837,33 +23989,33 @@ function getOrderByOperators() {
23837
23989
  };
23838
23990
  }
23839
23991
  function extractTablesRelationalConfig(schema4, configHelpers) {
23840
- if (Object.keys(schema4).length === 1 && "default" in schema4 && !is(schema4["default"], Table)) {
23992
+ if (Object.keys(schema4).length === 1 && "default" in schema4 && !is(schema4["default"], Table2)) {
23841
23993
  schema4 = schema4["default"];
23842
23994
  }
23843
23995
  const tableNamesMap = {};
23844
23996
  const relationsBuffer = {};
23845
23997
  const tablesConfig = {};
23846
23998
  for (const [key, value] of Object.entries(schema4)) {
23847
- if (is(value, Table)) {
23999
+ if (is(value, Table2)) {
23848
24000
  const dbName = getTableUniqueName(value);
23849
24001
  const bufferedRelations = relationsBuffer[dbName];
23850
24002
  tableNamesMap[dbName] = key;
23851
24003
  tablesConfig[key] = {
23852
24004
  tsName: key,
23853
- dbName: value[Table.Symbol.Name],
23854
- schema: value[Table.Symbol.Schema],
23855
- columns: value[Table.Symbol.Columns],
24005
+ dbName: value[Table2.Symbol.Name],
24006
+ schema: value[Table2.Symbol.Schema],
24007
+ columns: value[Table2.Symbol.Columns],
23856
24008
  relations: bufferedRelations?.relations ?? {},
23857
24009
  primaryKey: bufferedRelations?.primaryKey ?? []
23858
24010
  };
23859
24011
  for (const column4 of Object.values(
23860
- value[Table.Symbol.Columns]
24012
+ value[Table2.Symbol.Columns]
23861
24013
  )) {
23862
24014
  if (column4.primary) {
23863
24015
  tablesConfig[key].primaryKey.push(column4);
23864
24016
  }
23865
24017
  }
23866
- const extraConfig = value[Table.Symbol.ExtraConfigBuilder]?.(value[Table.Symbol.ExtraConfigColumns]);
24018
+ const extraConfig = value[Table2.Symbol.ExtraConfigBuilder]?.(value[Table2.Symbol.ExtraConfigColumns]);
23867
24019
  if (extraConfig) {
23868
24020
  for (const configEntry of Object.values(extraConfig)) {
23869
24021
  if (is(configEntry, PrimaryKeyBuilder)) {
@@ -23935,7 +24087,7 @@ function normalizeRelation(schema4, tableNamesMap, relation) {
23935
24087
  const referencedTableTsName = tableNamesMap[getTableUniqueName(relation.referencedTable)];
23936
24088
  if (!referencedTableTsName) {
23937
24089
  throw new Error(
23938
- `Table "${relation.referencedTable[Table.Symbol.Name]}" not found in schema`
24090
+ `Table "${relation.referencedTable[Table2.Symbol.Name]}" not found in schema`
23939
24091
  );
23940
24092
  }
23941
24093
  const referencedTableConfig = schema4[referencedTableTsName];
@@ -23946,7 +24098,7 @@ function normalizeRelation(schema4, tableNamesMap, relation) {
23946
24098
  const sourceTableTsName = tableNamesMap[getTableUniqueName(sourceTable)];
23947
24099
  if (!sourceTableTsName) {
23948
24100
  throw new Error(
23949
- `Table "${sourceTable[Table.Symbol.Name]}" not found in schema`
24101
+ `Table "${sourceTable[Table2.Symbol.Name]}" not found in schema`
23950
24102
  );
23951
24103
  }
23952
24104
  const reverseRelations = [];
@@ -23961,7 +24113,7 @@ function normalizeRelation(schema4, tableNamesMap, relation) {
23961
24113
  throw relation.relationName ? new Error(
23962
24114
  `There are multiple relations with name "${relation.relationName}" in table "${referencedTableTsName}"`
23963
24115
  ) : new Error(
23964
- `There are multiple relations between "${referencedTableTsName}" and "${relation.sourceTable[Table.Symbol.Name]}". Please specify relation name`
24116
+ `There are multiple relations between "${referencedTableTsName}" and "${relation.sourceTable[Table2.Symbol.Name]}". Please specify relation name`
23965
24117
  );
23966
24118
  }
23967
24119
  if (reverseRelations[0] && is(reverseRelations[0], One) && reverseRelations[0].config) {
@@ -24021,7 +24173,7 @@ function mapRelationalRow(tablesConfig, tableConfig, row, buildQueryResultSelect
24021
24173
  }
24022
24174
  return result;
24023
24175
  }
24024
- var _a119, Relation, _a120, Relations, _a121, _b95, _One, One, _a122, _b96, _Many, Many;
24176
+ var _a118, Relation, _a119, Relations, _a120, _b95, _One, One, _a121, _b96, _Many, Many;
24025
24177
  var init_relations = __esm({
24026
24178
  "../drizzle-orm/dist/relations.js"() {
24027
24179
  "use strict";
@@ -24031,7 +24183,7 @@ var init_relations = __esm({
24031
24183
  init_primary_keys();
24032
24184
  init_expressions();
24033
24185
  init_sql();
24034
- _a119 = entityKind;
24186
+ _a118 = entityKind;
24035
24187
  Relation = class {
24036
24188
  constructor(sourceTable, referencedTable, relationName) {
24037
24189
  __publicField(this, "referencedTableName");
@@ -24039,19 +24191,19 @@ var init_relations = __esm({
24039
24191
  this.sourceTable = sourceTable;
24040
24192
  this.referencedTable = referencedTable;
24041
24193
  this.relationName = relationName;
24042
- this.referencedTableName = referencedTable[Table.Symbol.Name];
24194
+ this.referencedTableName = referencedTable[Table2.Symbol.Name];
24043
24195
  }
24044
24196
  };
24045
- __publicField(Relation, _a119, "Relation");
24046
- _a120 = entityKind;
24197
+ __publicField(Relation, _a118, "Relation");
24198
+ _a119 = entityKind;
24047
24199
  Relations = class {
24048
24200
  constructor(table4, config) {
24049
24201
  this.table = table4;
24050
24202
  this.config = config;
24051
24203
  }
24052
24204
  };
24053
- __publicField(Relations, _a120, "Relations");
24054
- _One = class _One extends (_b95 = Relation, _a121 = entityKind, _b95) {
24205
+ __publicField(Relations, _a119, "Relations");
24206
+ _One = class _One extends (_b95 = Relation, _a120 = entityKind, _b95) {
24055
24207
  constructor(sourceTable, referencedTable, config, isNullable) {
24056
24208
  super(sourceTable, referencedTable, config?.relationName);
24057
24209
  this.config = config;
@@ -24068,9 +24220,9 @@ var init_relations = __esm({
24068
24220
  return relation;
24069
24221
  }
24070
24222
  };
24071
- __publicField(_One, _a121, "One");
24223
+ __publicField(_One, _a120, "One");
24072
24224
  One = _One;
24073
- _Many = class _Many extends (_b96 = Relation, _a122 = entityKind, _b96) {
24225
+ _Many = class _Many extends (_b96 = Relation, _a121 = entityKind, _b96) {
24074
24226
  constructor(sourceTable, referencedTable, config) {
24075
24227
  super(sourceTable, referencedTable, config?.relationName);
24076
24228
  this.config = config;
@@ -24085,7 +24237,7 @@ var init_relations = __esm({
24085
24237
  return relation;
24086
24238
  }
24087
24239
  };
24088
- __publicField(_Many, _a122, "Many");
24240
+ __publicField(_Many, _a121, "Many");
24089
24241
  Many = _Many;
24090
24242
  }
24091
24243
  });
@@ -24220,7 +24372,7 @@ __export(dist_exports, {
24220
24372
  Schema: () => Schema,
24221
24373
  StringChunk: () => StringChunk,
24222
24374
  Subquery: () => Subquery,
24223
- Table: () => Table,
24375
+ Table: () => Table2,
24224
24376
  TableAliasProxyHandler: () => TableAliasProxyHandler,
24225
24377
  TransactionRollbackError: () => TransactionRollbackError,
24226
24378
  View: () => View3,
@@ -24336,12 +24488,12 @@ var init_alias2 = __esm({
24336
24488
  });
24337
24489
 
24338
24490
  // ../drizzle-orm/dist/pg-core/checks.js
24339
- var _a123, CheckBuilder, _a124, Check;
24491
+ var _a122, CheckBuilder, _a123, Check;
24340
24492
  var init_checks = __esm({
24341
24493
  "../drizzle-orm/dist/pg-core/checks.js"() {
24342
24494
  "use strict";
24343
24495
  init_entity();
24344
- _a123 = entityKind;
24496
+ _a122 = entityKind;
24345
24497
  CheckBuilder = class {
24346
24498
  constructor(name2, value) {
24347
24499
  __publicField(this, "brand");
@@ -24353,8 +24505,8 @@ var init_checks = __esm({
24353
24505
  return new Check(table4, this);
24354
24506
  }
24355
24507
  };
24356
- __publicField(CheckBuilder, _a123, "PgCheckBuilder");
24357
- _a124 = entityKind;
24508
+ __publicField(CheckBuilder, _a122, "PgCheckBuilder");
24509
+ _a123 = entityKind;
24358
24510
  Check = class {
24359
24511
  constructor(table4, builder) {
24360
24512
  __publicField(this, "name");
@@ -24364,7 +24516,7 @@ var init_checks = __esm({
24364
24516
  this.value = builder.value;
24365
24517
  }
24366
24518
  };
24367
- __publicField(Check, _a124, "PgCheck");
24519
+ __publicField(Check, _a123, "PgCheck");
24368
24520
  }
24369
24521
  });
24370
24522
 
@@ -24411,7 +24563,7 @@ var init_columns = __esm({
24411
24563
  });
24412
24564
 
24413
24565
  // ../drizzle-orm/dist/pg-core/query-builders/delete.js
24414
- var _a125, _b97, PgDeleteBase;
24566
+ var _a124, _b97, PgDeleteBase;
24415
24567
  var init_delete = __esm({
24416
24568
  "../drizzle-orm/dist/pg-core/query-builders/delete.js"() {
24417
24569
  "use strict";
@@ -24420,7 +24572,7 @@ var init_delete = __esm({
24420
24572
  init_table();
24421
24573
  init_tracing();
24422
24574
  init_utils2();
24423
- PgDeleteBase = class extends (_b97 = QueryPromise, _a125 = entityKind, _b97) {
24575
+ PgDeleteBase = class extends (_b97 = QueryPromise, _a124 = entityKind, _b97) {
24424
24576
  constructor(table4, session, dialect4, withList) {
24425
24577
  super();
24426
24578
  __publicField(this, "config");
@@ -24466,7 +24618,7 @@ var init_delete = __esm({
24466
24618
  this.config.where = where;
24467
24619
  return this;
24468
24620
  }
24469
- returning(fields = this.config.table[Table.Symbol.Columns]) {
24621
+ returning(fields = this.config.table[Table2.Symbol.Columns]) {
24470
24622
  this.config.returning = orderSelectedFields(fields);
24471
24623
  return this;
24472
24624
  }
@@ -24491,12 +24643,12 @@ var init_delete = __esm({
24491
24643
  return this;
24492
24644
  }
24493
24645
  };
24494
- __publicField(PgDeleteBase, _a125, "PgDelete");
24646
+ __publicField(PgDeleteBase, _a124, "PgDelete");
24495
24647
  }
24496
24648
  });
24497
24649
 
24498
24650
  // ../drizzle-orm/dist/pg-core/query-builders/insert.js
24499
- var _a126, PgInsertBuilder, _a127, _b98, PgInsertBase;
24651
+ var _a125, PgInsertBuilder, _a126, _b98, PgInsertBase;
24500
24652
  var init_insert = __esm({
24501
24653
  "../drizzle-orm/dist/pg-core/query-builders/insert.js"() {
24502
24654
  "use strict";
@@ -24506,7 +24658,7 @@ var init_insert = __esm({
24506
24658
  init_table();
24507
24659
  init_tracing();
24508
24660
  init_utils2();
24509
- _a126 = entityKind;
24661
+ _a125 = entityKind;
24510
24662
  PgInsertBuilder = class {
24511
24663
  constructor(table4, session, dialect4, withList) {
24512
24664
  this.table = table4;
@@ -24521,7 +24673,7 @@ var init_insert = __esm({
24521
24673
  }
24522
24674
  const mappedValues = values.map((entry) => {
24523
24675
  const result = {};
24524
- const cols = this.table[Table.Symbol.Columns];
24676
+ const cols = this.table[Table2.Symbol.Columns];
24525
24677
  for (const colKey of Object.keys(entry)) {
24526
24678
  const colValue = entry[colKey];
24527
24679
  result[colKey] = is(colValue, SQL) ? colValue : new Param(colValue, cols[colKey]);
@@ -24531,8 +24683,8 @@ var init_insert = __esm({
24531
24683
  return new PgInsertBase(this.table, mappedValues, this.session, this.dialect, this.withList);
24532
24684
  }
24533
24685
  };
24534
- __publicField(PgInsertBuilder, _a126, "PgInsertBuilder");
24535
- PgInsertBase = class extends (_b98 = QueryPromise, _a127 = entityKind, _b98) {
24686
+ __publicField(PgInsertBuilder, _a125, "PgInsertBuilder");
24687
+ PgInsertBase = class extends (_b98 = QueryPromise, _a126 = entityKind, _b98) {
24536
24688
  constructor(table4, values, session, dialect4, withList) {
24537
24689
  super();
24538
24690
  __publicField(this, "config");
@@ -24545,7 +24697,7 @@ var init_insert = __esm({
24545
24697
  this.dialect = dialect4;
24546
24698
  this.config = { table: table4, values, withList };
24547
24699
  }
24548
- returning(fields = this.config.table[Table.Symbol.Columns]) {
24700
+ returning(fields = this.config.table[Table2.Symbol.Columns]) {
24549
24701
  this.config.returning = orderSelectedFields(fields);
24550
24702
  return this;
24551
24703
  }
@@ -24647,7 +24799,69 @@ var init_insert = __esm({
24647
24799
  return this;
24648
24800
  }
24649
24801
  };
24650
- __publicField(PgInsertBase, _a127, "PgInsert");
24802
+ __publicField(PgInsertBase, _a126, "PgInsert");
24803
+ }
24804
+ });
24805
+
24806
+ // ../drizzle-orm/dist/casing.js
24807
+ function toSnakeCase(input) {
24808
+ const words = input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? [];
24809
+ return words.map((word) => word.toLowerCase()).join("_");
24810
+ }
24811
+ function toCamelCase(input) {
24812
+ const words = input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? [];
24813
+ return words.reduce((acc, word, i) => {
24814
+ const formattedWord = i === 0 ? word.toLowerCase() : `${word[0].toUpperCase()}${word.slice(1)}`;
24815
+ return acc + formattedWord;
24816
+ }, "");
24817
+ }
24818
+ function noopCase(input) {
24819
+ return input;
24820
+ }
24821
+ var _a127, CasingCache;
24822
+ var init_casing = __esm({
24823
+ "../drizzle-orm/dist/casing.js"() {
24824
+ "use strict";
24825
+ init_entity();
24826
+ init_table();
24827
+ _a127 = entityKind;
24828
+ CasingCache = class {
24829
+ constructor(casing2) {
24830
+ /** @internal */
24831
+ __publicField(this, "cache", {});
24832
+ __publicField(this, "cachedTables", {});
24833
+ __publicField(this, "convert");
24834
+ this.convert = casing2 === "snake_case" ? toSnakeCase : casing2 === "camelCase" ? toCamelCase : noopCase;
24835
+ }
24836
+ getColumnCasing(column4) {
24837
+ if (!column4.keyAsName)
24838
+ return column4.name;
24839
+ const schema4 = column4.table[Table2.Symbol.Schema] ?? "public";
24840
+ const tableName = column4.table[Table2.Symbol.OriginalName];
24841
+ const key = `${schema4}.${tableName}.${column4.name}`;
24842
+ if (!this.cache[key]) {
24843
+ this.cacheTable(column4.table);
24844
+ }
24845
+ return this.cache[key];
24846
+ }
24847
+ cacheTable(table4) {
24848
+ const schema4 = table4[Table2.Symbol.Schema] ?? "public";
24849
+ const tableName = table4[Table2.Symbol.OriginalName];
24850
+ const tableKey2 = `${schema4}.${tableName}`;
24851
+ if (!this.cachedTables[tableKey2]) {
24852
+ for (const column4 of Object.values(table4[Table2.Symbol.Columns])) {
24853
+ const columnKey = `${tableKey2}.${column4.name}`;
24854
+ this.cache[columnKey] = this.convert(column4.name);
24855
+ }
24856
+ this.cachedTables[tableKey2] = true;
24857
+ }
24858
+ }
24859
+ clearCache() {
24860
+ this.cache = {};
24861
+ this.cachedTables = {};
24862
+ }
24863
+ };
24864
+ __publicField(CasingCache, _a127, "CasingCache");
24651
24865
  }
24652
24866
  });
24653
24867
 
@@ -24749,7 +24963,7 @@ var init_dialect = __esm({
24749
24963
  return sql`${withSql}delete from ${table4}${whereSql}${returningSql}`;
24750
24964
  }
24751
24965
  buildUpdateSet(table4, set) {
24752
- const tableColumns = table4[Table.Symbol.Columns];
24966
+ const tableColumns = table4[Table2.Symbol.Columns];
24753
24967
  const columnNames = Object.keys(tableColumns).filter(
24754
24968
  (colName) => set[colName] !== void 0 || tableColumns[colName]?.onUpdateFn !== void 0
24755
24969
  );
@@ -24840,7 +25054,7 @@ var init_dialect = __esm({
24840
25054
  const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
24841
25055
  for (const f of fieldsList) {
24842
25056
  if (is(f.field, Column2) && getTableName(f.field.table) !== (is(table4, Subquery) ? table4._.alias : is(table4, PgViewBase) ? table4[ViewBaseConfig].name : is(table4, SQL) ? void 0 : getTableName(table4)) && !((table22) => joins?.some(
24843
- ({ alias }) => alias === (table22[Table.Symbol.IsAlias] ? getTableName(table22) : table22[Table.Symbol.BaseName])
25057
+ ({ alias }) => alias === (table22[Table2.Symbol.IsAlias] ? getTableName(table22) : table22[Table2.Symbol.BaseName])
24844
25058
  ))(f.field.table)) {
24845
25059
  const tableName = getTableName(f.field.table);
24846
25060
  throw new Error(
@@ -24856,12 +25070,12 @@ var init_dialect = __esm({
24856
25070
  }
24857
25071
  const selection = this.buildSelection(fieldsList, { isSingleTable });
24858
25072
  const tableSql = (() => {
24859
- if (is(table4, Table) && table4[Table.Symbol.OriginalName] !== table4[Table.Symbol.Name]) {
24860
- let fullName = sql`${sql.identifier(table4[Table.Symbol.OriginalName])}`;
24861
- if (table4[Table.Symbol.Schema]) {
24862
- fullName = sql`${sql.identifier(table4[Table.Symbol.Schema])}.${fullName}`;
25073
+ if (is(table4, Table2) && table4[Table2.Symbol.OriginalName] !== table4[Table2.Symbol.Name]) {
25074
+ let fullName = sql`${sql.identifier(table4[Table2.Symbol.OriginalName])}`;
25075
+ if (table4[Table2.Symbol.Schema]) {
25076
+ fullName = sql`${sql.identifier(table4[Table2.Symbol.Schema])}.${fullName}`;
24863
25077
  }
24864
- return sql`${fullName} ${sql.identifier(table4[Table.Symbol.Name])}`;
25078
+ return sql`${fullName} ${sql.identifier(table4[Table2.Symbol.Name])}`;
24865
25079
  }
24866
25080
  return table4;
24867
25081
  })();
@@ -24982,7 +25196,7 @@ var init_dialect = __esm({
24982
25196
  }
24983
25197
  buildInsertQuery({ table: table4, values, onConflict, returning, withList }) {
24984
25198
  const valuesSqlList = [];
24985
- const columns = table4[Table.Symbol.Columns];
25199
+ const columns = table4[Table2.Symbol.Columns];
24986
25200
  const colEntries = Object.entries(columns).filter(([_2, col]) => !col.shouldDisableInsert());
24987
25201
  const insertOrder = colEntries.map(
24988
25202
  ([, column4]) => sql.identifier(this.casing.getColumnCasing(column4))
@@ -26277,7 +26491,7 @@ var init_select2 = __esm({
26277
26491
  };
26278
26492
  }
26279
26493
  if (typeof tableName === "string" && !is(table4, SQL)) {
26280
- const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View3) ? table4[ViewBaseConfig].selectedFields : table4[Table.Symbol.Columns];
26494
+ const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View3) ? table4[ViewBaseConfig].selectedFields : table4[Table2.Symbol.Columns];
26281
26495
  this.config.fields[tableName] = selection;
26282
26496
  }
26283
26497
  }
@@ -26827,7 +27041,7 @@ var init_update = __esm({
26827
27041
  this.config.where = where;
26828
27042
  return this;
26829
27043
  }
26830
- returning(fields = this.config.table[Table.Symbol.Columns]) {
27044
+ returning(fields = this.config.table[Table2.Symbol.Columns]) {
26831
27045
  this.config.returning = orderSelectedFields(fields);
26832
27046
  return this;
26833
27047
  }
@@ -27496,6 +27710,8 @@ var init_policies = __esm({
27496
27710
  __publicField(this, "to");
27497
27711
  __publicField(this, "using");
27498
27712
  __publicField(this, "withCheck");
27713
+ /** @internal */
27714
+ __publicField(this, "_linkedTable");
27499
27715
  this.name = name2;
27500
27716
  if (config) {
27501
27717
  this.as = config.as;
@@ -27505,6 +27721,10 @@ var init_policies = __esm({
27505
27721
  this.withCheck = config.withCheck;
27506
27722
  }
27507
27723
  }
27724
+ link(table4) {
27725
+ this._linkedTable = table4;
27726
+ return this;
27727
+ }
27508
27728
  };
27509
27729
  __publicField(PgPolicy, _a147, "PgPolicy");
27510
27730
  }
@@ -27975,19 +28195,19 @@ var init_subquery2 = __esm({
27975
28195
 
27976
28196
  // ../drizzle-orm/dist/pg-core/utils.js
27977
28197
  function getTableConfig(table4) {
27978
- const columns = Object.values(table4[Table.Symbol.Columns]);
28198
+ const columns = Object.values(table4[Table2.Symbol.Columns]);
27979
28199
  const indexes = [];
27980
28200
  const checks = [];
27981
28201
  const primaryKeys = [];
27982
28202
  const foreignKeys = Object.values(table4[PgTable.Symbol.InlineForeignKeys]);
27983
28203
  const uniqueConstraints = [];
27984
- const name2 = table4[Table.Symbol.Name];
27985
- const schema4 = table4[Table.Symbol.Schema];
28204
+ const name2 = table4[Table2.Symbol.Name];
28205
+ const schema4 = table4[Table2.Symbol.Schema];
27986
28206
  const policies = [];
27987
28207
  const enableRLS = table4[PgTable.Symbol.EnableRLS];
27988
28208
  const extraConfigBuilder = table4[PgTable.Symbol.ExtraConfigBuilder];
27989
28209
  if (extraConfigBuilder !== void 0) {
27990
- const extraConfig = extraConfigBuilder(table4[Table.Symbol.ExtraConfigColumns]);
28210
+ const extraConfig = extraConfigBuilder(table4[Table2.Symbol.ExtraConfigColumns]);
27991
28211
  const extraValues = Array.isArray(extraConfig) ? extraConfig.flat(1) : Object.values(extraConfig);
27992
28212
  for (const builder of extraValues) {
27993
28213
  if (is(builder, IndexBuilder)) {
@@ -28084,6 +28304,33 @@ var init_pg_core = __esm({
28084
28304
  }
28085
28305
  });
28086
28306
 
28307
+ // src/serializer/utils.ts
28308
+ function getColumnCasing(column4, casing2) {
28309
+ if (!column4.name) return "";
28310
+ return !column4.keyAsName || casing2 === void 0 ? column4.name : casing2 === "camelCase" ? toCamelCase(column4.name) : toSnakeCase(column4.name);
28311
+ }
28312
+ var sqlToStr;
28313
+ var init_utils6 = __esm({
28314
+ "src/serializer/utils.ts"() {
28315
+ "use strict";
28316
+ init_casing();
28317
+ sqlToStr = (sql2, casing2) => {
28318
+ return sql2.toQuery({
28319
+ escapeName: () => {
28320
+ throw new Error("we don't support params for `sql` default values");
28321
+ },
28322
+ escapeParam: () => {
28323
+ throw new Error("we don't support params for `sql` default values");
28324
+ },
28325
+ escapeString: () => {
28326
+ throw new Error("we don't support params for `sql` default values");
28327
+ },
28328
+ casing: new CasingCache(casing2)
28329
+ }).sql;
28330
+ };
28331
+ }
28332
+ });
28333
+
28087
28334
  // src/serializer/pgSerializer.ts
28088
28335
  function stringFromIdentityProperty(field) {
28089
28336
  return typeof field === "string" ? field : typeof field === "undefined" ? void 0 : String(field);
@@ -28162,20 +28409,20 @@ var init_pgSerializer = __esm({
28162
28409
  init_source();
28163
28410
  init_dist();
28164
28411
  init_pg_core();
28165
- init_pg_core();
28166
28412
  init_vector();
28167
28413
  init_outputs();
28168
28414
  init_utils();
28169
- init_serializer();
28415
+ init_utils6();
28170
28416
  indexName = (tableName, columns) => {
28171
28417
  return `${tableName}_${columns.join("_")}_index`;
28172
28418
  };
28173
- generatePgSnapshot = (tables, enums, schemas, sequences, roles, views, matViews, casing2, schemaFilter) => {
28419
+ generatePgSnapshot = (tables, enums, schemas, sequences, roles, policies, views, matViews, casing2, schemaFilter) => {
28174
28420
  const dialect4 = new PgDialect({ casing: casing2 });
28175
28421
  const result = {};
28176
28422
  const resultViews = {};
28177
28423
  const sequencesToReturn = {};
28178
28424
  const rolesToReturn = {};
28425
+ const policiesToReturn = {};
28179
28426
  const indexesInSchema = {};
28180
28427
  for (const table4 of tables) {
28181
28428
  const checksInTable = {};
@@ -28188,7 +28435,7 @@ var init_pgSerializer = __esm({
28188
28435
  schema: schema4,
28189
28436
  primaryKeys,
28190
28437
  uniqueConstraints,
28191
- policies,
28438
+ policies: policies2,
28192
28439
  enableRLS
28193
28440
  } = getTableConfig(table4);
28194
28441
  if (schemaFilter && !schemaFilter.includes(schema4 ?? "public")) {
@@ -28448,17 +28695,17 @@ ${withStyle.errorWarning(
28448
28695
  with: value.config.with ?? {}
28449
28696
  };
28450
28697
  });
28451
- policies.forEach((policy2) => {
28698
+ policies2.forEach((policy4) => {
28452
28699
  const mappedTo = [];
28453
- if (!policy2.to) {
28700
+ if (!policy4.to) {
28454
28701
  mappedTo.push("public");
28455
28702
  } 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) => {
28703
+ if (policy4.to && typeof policy4.to === "string") {
28704
+ mappedTo.push(policy4.to);
28705
+ } else if (policy4.to && is(policy4.to, PgRole)) {
28706
+ mappedTo.push(policy4.to.name);
28707
+ } else if (policy4.to && Array.isArray(policy4.to)) {
28708
+ policy4.to.forEach((it) => {
28462
28709
  if (typeof it === "string") {
28463
28710
  mappedTo.push(it);
28464
28711
  } else if (is(it, PgRole)) {
@@ -28467,13 +28714,24 @@ ${withStyle.errorWarning(
28467
28714
  });
28468
28715
  }
28469
28716
  }
28470
- policiesObject[policy2.name] = {
28471
- name: policy2.name,
28472
- as: policy2.as?.toUpperCase() ?? "PERMISSIVE",
28473
- for: policy2.for?.toUpperCase() ?? "ALL",
28717
+ if (policiesObject[policy4.name] !== void 0) {
28718
+ console.log(
28719
+ `
28720
+ ${withStyle.errorWarning(
28721
+ `We've found duplicated policy name across ${source_default.underline.blue(tableKey2)} table. Please rename one of the policies with ${source_default.underline.blue(
28722
+ policy4.name
28723
+ )} name`
28724
+ )}`
28725
+ );
28726
+ process.exit(1);
28727
+ }
28728
+ policiesObject[policy4.name] = {
28729
+ name: policy4.name,
28730
+ as: policy4.as?.toUpperCase() ?? "PERMISSIVE",
28731
+ for: policy4.for?.toUpperCase() ?? "ALL",
28474
28732
  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
28733
+ using: is(policy4.using, SQL) ? dialect4.sqlToQuery(policy4.using).sql : void 0,
28734
+ withCheck: is(policy4.withCheck, SQL) ? dialect4.sqlToQuery(policy4.withCheck).sql : void 0
28477
28735
  };
28478
28736
  });
28479
28737
  checks.forEach((check) => {
@@ -28517,6 +28775,64 @@ ${withStyle.errorWarning(
28517
28775
  isRLSEnabled: enableRLS
28518
28776
  };
28519
28777
  }
28778
+ for (const policy4 of policies) {
28779
+ if (!policy4._linkedTable) {
28780
+ console.log(
28781
+ `
28782
+ ${withStyle.errorWarning(
28783
+ `"Policy ${policy4.name} was skipped because it was not linked to any table. You should either include the policy in a table or use .link() on the policy to link it to any table you have. For more information, please check:`
28784
+ )}`
28785
+ );
28786
+ continue;
28787
+ }
28788
+ const tableConfig = getTableConfig(policy4._linkedTable);
28789
+ const tableKey2 = `${tableConfig.schema ?? "public"}.${tableConfig.name}`;
28790
+ const mappedTo = [];
28791
+ if (!policy4.to) {
28792
+ mappedTo.push("public");
28793
+ } else {
28794
+ if (policy4.to && typeof policy4.to === "string") {
28795
+ mappedTo.push(policy4.to);
28796
+ } else if (policy4.to && is(policy4.to, PgRole)) {
28797
+ mappedTo.push(policy4.to.name);
28798
+ } else if (policy4.to && Array.isArray(policy4.to)) {
28799
+ policy4.to.forEach((it) => {
28800
+ if (typeof it === "string") {
28801
+ mappedTo.push(it);
28802
+ } else if (is(it, PgRole)) {
28803
+ mappedTo.push(it.name);
28804
+ }
28805
+ });
28806
+ }
28807
+ }
28808
+ if (result[tableKey2]?.policies[policy4.name] !== void 0 || policiesToReturn[policy4.name] !== void 0) {
28809
+ console.log(
28810
+ `
28811
+ ${withStyle.errorWarning(
28812
+ `We've found duplicated policy name across ${source_default.underline.blue(tableKey2)} table. Please rename one of the policies with ${source_default.underline.blue(
28813
+ policy4.name
28814
+ )} name`
28815
+ )}`
28816
+ );
28817
+ process.exit(1);
28818
+ }
28819
+ const mappedPolicy = {
28820
+ name: policy4.name,
28821
+ as: policy4.as?.toUpperCase() ?? "PERMISSIVE",
28822
+ for: policy4.for?.toUpperCase() ?? "ALL",
28823
+ to: mappedTo.sort(),
28824
+ using: is(policy4.using, SQL) ? dialect4.sqlToQuery(policy4.using).sql : void 0,
28825
+ withCheck: is(policy4.withCheck, SQL) ? dialect4.sqlToQuery(policy4.withCheck).sql : void 0
28826
+ };
28827
+ if (result[tableKey2]) {
28828
+ result[tableKey2].policies[policy4.name] = mappedPolicy;
28829
+ } else {
28830
+ policiesToReturn[policy4.name] = {
28831
+ ...mappedPolicy,
28832
+ on: `"${tableConfig.schema ?? "public"}"."${tableConfig.name}"`
28833
+ };
28834
+ }
28835
+ }
28520
28836
  for (const sequence of sequences) {
28521
28837
  const name2 = sequence.seqName;
28522
28838
  if (typeof sequencesToReturn[`${sequence.schema ?? "public"}.${name2}`] === "undefined") {
@@ -28705,6 +29021,7 @@ ${withStyle.errorWarning(
28705
29021
  schemas: schemasObject,
28706
29022
  sequences: sequencesToReturn,
28707
29023
  roles: rolesToReturn,
29024
+ policies: policiesToReturn,
28708
29025
  views: resultViews,
28709
29026
  _meta: {
28710
29027
  schemas: {},
@@ -28854,7 +29171,7 @@ WHERE
28854
29171
  for (const dbPolicy of allPolicies) {
28855
29172
  const { tablename, schemaname, to, withCheck, using, ...rest } = dbPolicy;
28856
29173
  const tableForPolicy = policiesByTable[`${schemaname}.${tablename}`];
28857
- const parsedTo = to;
29174
+ const parsedTo = typeof to === "string" ? to.slice(1, -1).split(",") : to;
28858
29175
  const parsedWithCheck = withCheck === null ? void 0 : withCheck;
28859
29176
  const parsedUsing = using === null ? void 0 : using;
28860
29177
  if (tableForPolicy) {
@@ -29456,6 +29773,7 @@ WHERE
29456
29773
  schemas: schemasObject,
29457
29774
  sequences: sequencesToReturn,
29458
29775
  roles: rolesToReturn,
29776
+ policies: {},
29459
29777
  views,
29460
29778
  _meta: {
29461
29779
  schemas: {},
@@ -30313,8 +30631,8 @@ function sqliteTableBase(name2, columns, extraConfig, schema4, baseName = name2)
30313
30631
  })
30314
30632
  );
30315
30633
  const table4 = Object.assign(rawTable, builtColumns);
30316
- table4[Table.Symbol.Columns] = builtColumns;
30317
- table4[Table.Symbol.ExtraConfigColumns] = builtColumns;
30634
+ table4[Table2.Symbol.Columns] = builtColumns;
30635
+ table4[Table2.Symbol.ExtraConfigColumns] = builtColumns;
30318
30636
  if (extraConfig) {
30319
30637
  table4[SQLiteTable.Symbol.ExtraConfigBuilder] = extraConfig;
30320
30638
  }
@@ -30328,7 +30646,7 @@ var init_table3 = __esm({
30328
30646
  init_table();
30329
30647
  init_all2();
30330
30648
  InlineForeignKeys2 = Symbol.for("drizzle:SQLiteInlineForeignKeys");
30331
- SQLiteTable = class extends (_e3 = Table, _d3 = entityKind, _c6 = Table.Symbol.Columns, _b140 = InlineForeignKeys2, _a195 = Table.Symbol.ExtraConfigBuilder, _e3) {
30649
+ SQLiteTable = class extends (_e3 = Table2, _d3 = entityKind, _c6 = Table2.Symbol.Columns, _b140 = InlineForeignKeys2, _a195 = Table2.Symbol.ExtraConfigBuilder, _e3) {
30332
30650
  constructor() {
30333
30651
  super(...arguments);
30334
30652
  /** @internal */
@@ -30341,7 +30659,7 @@ var init_table3 = __esm({
30341
30659
  };
30342
30660
  __publicField(SQLiteTable, _d3, "SQLiteTable");
30343
30661
  /** @internal */
30344
- __publicField(SQLiteTable, "Symbol", Object.assign({}, Table.Symbol, {
30662
+ __publicField(SQLiteTable, "Symbol", Object.assign({}, Table2.Symbol, {
30345
30663
  InlineForeignKeys: InlineForeignKeys2
30346
30664
  }));
30347
30665
  sqliteTable = (name2, columns, extraConfig) => {
@@ -30420,7 +30738,7 @@ var init_delete2 = __esm({
30420
30738
  if (typeof columns[0] === "function") {
30421
30739
  const orderBy = columns[0](
30422
30740
  new Proxy(
30423
- this.config.table[Table.Symbol.Columns],
30741
+ this.config.table[Table2.Symbol.Columns],
30424
30742
  new SelectionProxyHandler({ sqlAliasedBehavior: "alias", sqlBehavior: "sql" })
30425
30743
  )
30426
30744
  );
@@ -30497,7 +30815,7 @@ var init_insert2 = __esm({
30497
30815
  }
30498
30816
  const mappedValues = values.map((entry) => {
30499
30817
  const result = {};
30500
- const cols = this.table[Table.Symbol.Columns];
30818
+ const cols = this.table[Table2.Symbol.Columns];
30501
30819
  for (const colKey of Object.keys(entry)) {
30502
30820
  const colValue = entry[colKey];
30503
30821
  result[colKey] = is(colValue, SQL) ? colValue : new Param(colValue, cols[colKey]);
@@ -30710,7 +31028,7 @@ var init_dialect2 = __esm({
30710
31028
  return sql`${withSql}delete from ${table4}${whereSql}${returningSql}${orderBySql}${limitSql}`;
30711
31029
  }
30712
31030
  buildUpdateSet(table4, set) {
30713
- const tableColumns = table4[Table.Symbol.Columns];
31031
+ const tableColumns = table4[Table2.Symbol.Columns];
30714
31032
  const columnNames = Object.keys(tableColumns).filter(
30715
31033
  (colName) => set[colName] !== void 0 || tableColumns[colName]?.onUpdateFn !== void 0
30716
31034
  );
@@ -30771,7 +31089,7 @@ var init_dialect2 = __esm({
30771
31089
  chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
30772
31090
  }
30773
31091
  } else if (is(field, Column2)) {
30774
- const tableName = field.table[Table.Symbol.Name];
31092
+ const tableName = field.table[Table2.Symbol.Name];
30775
31093
  if (isSingleTable) {
30776
31094
  chunk.push(sql.identifier(this.casing.getColumnCasing(field)));
30777
31095
  } else {
@@ -30818,7 +31136,7 @@ var init_dialect2 = __esm({
30818
31136
  const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
30819
31137
  for (const f of fieldsList) {
30820
31138
  if (is(f.field, Column2) && getTableName(f.field.table) !== (is(table4, Subquery) ? table4._.alias : is(table4, SQLiteViewBase) ? table4[ViewBaseConfig].name : is(table4, SQL) ? void 0 : getTableName(table4)) && !((table22) => joins?.some(
30821
- ({ alias }) => alias === (table22[Table.Symbol.IsAlias] ? getTableName(table22) : table22[Table.Symbol.BaseName])
31139
+ ({ alias }) => alias === (table22[Table2.Symbol.IsAlias] ? getTableName(table22) : table22[Table2.Symbol.BaseName])
30822
31140
  ))(f.field.table)) {
30823
31141
  const tableName = getTableName(f.field.table);
30824
31142
  throw new Error(
@@ -30831,8 +31149,8 @@ var init_dialect2 = __esm({
30831
31149
  const distinctSql = distinct ? sql` distinct` : void 0;
30832
31150
  const selection = this.buildSelection(fieldsList, { isSingleTable });
30833
31151
  const tableSql = (() => {
30834
- if (is(table4, Table) && table4[Table.Symbol.OriginalName] !== table4[Table.Symbol.Name]) {
30835
- return sql`${sql.identifier(table4[Table.Symbol.OriginalName])} ${sql.identifier(table4[Table.Symbol.Name])}`;
31152
+ if (is(table4, Table2) && table4[Table2.Symbol.OriginalName] !== table4[Table2.Symbol.Name]) {
31153
+ return sql`${sql.identifier(table4[Table2.Symbol.OriginalName])} ${sql.identifier(table4[Table2.Symbol.Name])}`;
30836
31154
  }
30837
31155
  return table4;
30838
31156
  })();
@@ -30929,7 +31247,7 @@ var init_dialect2 = __esm({
30929
31247
  }
30930
31248
  buildInsertQuery({ table: table4, values, onConflict, returning, withList }) {
30931
31249
  const valuesSqlList = [];
30932
- const columns = table4[Table.Symbol.Columns];
31250
+ const columns = table4[Table2.Symbol.Columns];
30933
31251
  const colEntries = Object.entries(columns).filter(
30934
31252
  ([_2, col]) => !col.shouldDisableInsert()
30935
31253
  );
@@ -31594,7 +31912,7 @@ var init_select3 = __esm({
31594
31912
  };
31595
31913
  }
31596
31914
  if (typeof tableName === "string" && !is(table4, SQL)) {
31597
- const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View3) ? table4[ViewBaseConfig].selectedFields : table4[Table.Symbol.Columns];
31915
+ const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View3) ? table4[ViewBaseConfig].selectedFields : table4[Table2.Symbol.Columns];
31598
31916
  this.config.fields[tableName] = selection;
31599
31917
  }
31600
31918
  }
@@ -32071,7 +32389,7 @@ var init_update2 = __esm({
32071
32389
  if (typeof columns[0] === "function") {
32072
32390
  const orderBy = columns[0](
32073
32391
  new Proxy(
32074
- this.config.table[Table.Symbol.Columns],
32392
+ this.config.table[Table2.Symbol.Columns],
32075
32393
  new SelectionProxyHandler({ sqlAliasedBehavior: "alias", sqlBehavior: "sql" })
32076
32394
  )
32077
32395
  );
@@ -32910,7 +33228,7 @@ function getTableConfig2(table4) {
32910
33228
  const primaryKeys = [];
32911
33229
  const uniqueConstraints = [];
32912
33230
  const foreignKeys = Object.values(table4[SQLiteTable.Symbol.InlineForeignKeys]);
32913
- const name2 = table4[Table.Symbol.Name];
33231
+ const name2 = table4[Table2.Symbol.Name];
32914
33232
  const extraConfigBuilder = table4[SQLiteTable.Symbol.ExtraConfigBuilder];
32915
33233
  if (extraConfigBuilder !== void 0) {
32916
33234
  const extraConfig = extraConfigBuilder(table4[SQLiteTable.Symbol.Columns]);
@@ -32944,7 +33262,7 @@ function getViewConfig2(view4) {
32944
33262
  // ...view[SQLiteViewConfig],
32945
33263
  };
32946
33264
  }
32947
- var init_utils6 = __esm({
33265
+ var init_utils7 = __esm({
32948
33266
  "../drizzle-orm/dist/sqlite-core/utils.js"() {
32949
33267
  "use strict";
32950
33268
  init_entity();
@@ -33075,7 +33393,7 @@ var init_sqlite_core = __esm({
33075
33393
  init_subquery3();
33076
33394
  init_table3();
33077
33395
  init_unique_constraint2();
33078
- init_utils6();
33396
+ init_utils7();
33079
33397
  init_view2();
33080
33398
  }
33081
33399
  });
@@ -33150,8 +33468,7 @@ var init_sqliteSerializer = __esm({
33150
33468
  init_dist();
33151
33469
  init_sqlite_core();
33152
33470
  init_outputs();
33153
- init_utils();
33154
- init_serializer();
33471
+ init_utils6();
33155
33472
  generateSqliteSnapshot = (tables, views, casing2) => {
33156
33473
  const dialect4 = new SQLiteSyncDialect({ casing: casing2 });
33157
33474
  const result = {};
@@ -35241,7 +35558,7 @@ var init_delete3 = __esm({
35241
35558
  if (typeof columns[0] === "function") {
35242
35559
  const orderBy = columns[0](
35243
35560
  new Proxy(
35244
- this.config.table[Table.Symbol.Columns],
35561
+ this.config.table[Table2.Symbol.Columns],
35245
35562
  new SelectionProxyHandler({ sqlAliasedBehavior: "alias", sqlBehavior: "sql" })
35246
35563
  )
35247
35564
  );
@@ -35308,7 +35625,7 @@ var init_insert3 = __esm({
35308
35625
  }
35309
35626
  const mappedValues = values.map((entry) => {
35310
35627
  const result = {};
35311
- const cols = this.table[Table.Symbol.Columns];
35628
+ const cols = this.table[Table2.Symbol.Columns];
35312
35629
  for (const colKey of Object.keys(entry)) {
35313
35630
  const colValue = entry[colKey];
35314
35631
  result[colKey] = is(colValue, SQL) ? colValue : new Param(colValue, cols[colKey]);
@@ -35370,12 +35687,12 @@ var init_insert3 = __esm({
35370
35687
  }
35371
35688
  $returningId() {
35372
35689
  const returning = [];
35373
- for (const [key, value] of Object.entries(this.config.table[Table.Symbol.Columns])) {
35690
+ for (const [key, value] of Object.entries(this.config.table[Table2.Symbol.Columns])) {
35374
35691
  if (value.primary) {
35375
35692
  returning.push({ field: value, path: [key] });
35376
35693
  }
35377
35694
  }
35378
- this.config.returning = orderSelectedFields(this.config.table[Table.Symbol.Columns]);
35695
+ this.config.returning = orderSelectedFields(this.config.table[Table2.Symbol.Columns]);
35379
35696
  return this;
35380
35697
  }
35381
35698
  /** @internal */
@@ -35477,8 +35794,8 @@ function mysqlTableWithSchema(name2, columns, extraConfig, schema4, baseName = n
35477
35794
  })
35478
35795
  );
35479
35796
  const table4 = Object.assign(rawTable, builtColumns);
35480
- table4[Table.Symbol.Columns] = builtColumns;
35481
- table4[Table.Symbol.ExtraConfigColumns] = builtColumns;
35797
+ table4[Table2.Symbol.Columns] = builtColumns;
35798
+ table4[Table2.Symbol.ExtraConfigColumns] = builtColumns;
35482
35799
  if (extraConfig) {
35483
35800
  table4[MySqlTable.Symbol.ExtraConfigBuilder] = extraConfig;
35484
35801
  }
@@ -35492,7 +35809,7 @@ var init_table4 = __esm({
35492
35809
  init_table();
35493
35810
  init_all3();
35494
35811
  InlineForeignKeys3 = Symbol.for("drizzle:MySqlInlineForeignKeys");
35495
- MySqlTable = class extends (_e4 = Table, _d4 = entityKind, _c9 = Table.Symbol.Columns, _b223 = InlineForeignKeys3, _a301 = Table.Symbol.ExtraConfigBuilder, _e4) {
35812
+ MySqlTable = class extends (_e4 = Table2, _d4 = entityKind, _c9 = Table2.Symbol.Columns, _b223 = InlineForeignKeys3, _a301 = Table2.Symbol.ExtraConfigBuilder, _e4) {
35496
35813
  constructor() {
35497
35814
  super(...arguments);
35498
35815
  /** @internal */
@@ -35505,7 +35822,7 @@ var init_table4 = __esm({
35505
35822
  };
35506
35823
  __publicField(MySqlTable, _d4, "MySqlTable");
35507
35824
  /** @internal */
35508
- __publicField(MySqlTable, "Symbol", Object.assign({}, Table.Symbol, {
35825
+ __publicField(MySqlTable, "Symbol", Object.assign({}, Table2.Symbol, {
35509
35826
  InlineForeignKeys: InlineForeignKeys3
35510
35827
  }));
35511
35828
  mysqlTable = (name2, columns, extraConfig) => {
@@ -35612,7 +35929,7 @@ var init_dialect3 = __esm({
35612
35929
  return sql`${withSql}delete from ${table4}${whereSql}${orderBySql}${limitSql}${returningSql}`;
35613
35930
  }
35614
35931
  buildUpdateSet(table4, set) {
35615
- const tableColumns = table4[Table.Symbol.Columns];
35932
+ const tableColumns = table4[Table2.Symbol.Columns];
35616
35933
  const columnNames = Object.keys(tableColumns).filter(
35617
35934
  (colName) => set[colName] !== void 0 || tableColumns[colName]?.onUpdateFn !== void 0
35618
35935
  );
@@ -35711,7 +36028,7 @@ var init_dialect3 = __esm({
35711
36028
  const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
35712
36029
  for (const f of fieldsList) {
35713
36030
  if (is(f.field, Column2) && getTableName(f.field.table) !== (is(table4, Subquery) ? table4._.alias : is(table4, MySqlViewBase) ? table4[ViewBaseConfig].name : is(table4, SQL) ? void 0 : getTableName(table4)) && !((table22) => joins?.some(
35714
- ({ alias }) => alias === (table22[Table.Symbol.IsAlias] ? getTableName(table22) : table22[Table.Symbol.BaseName])
36031
+ ({ alias }) => alias === (table22[Table2.Symbol.IsAlias] ? getTableName(table22) : table22[Table2.Symbol.BaseName])
35715
36032
  ))(f.field.table)) {
35716
36033
  const tableName = getTableName(f.field.table);
35717
36034
  throw new Error(
@@ -35724,8 +36041,8 @@ var init_dialect3 = __esm({
35724
36041
  const distinctSql = distinct ? sql` distinct` : void 0;
35725
36042
  const selection = this.buildSelection(fieldsList, { isSingleTable });
35726
36043
  const tableSql = (() => {
35727
- if (is(table4, Table) && table4[Table.Symbol.OriginalName] !== table4[Table.Symbol.Name]) {
35728
- return sql`${sql.identifier(table4[Table.Symbol.OriginalName])} ${sql.identifier(table4[Table.Symbol.Name])}`;
36044
+ if (is(table4, Table2) && table4[Table2.Symbol.OriginalName] !== table4[Table2.Symbol.Name]) {
36045
+ return sql`${sql.identifier(table4[Table2.Symbol.OriginalName])} ${sql.identifier(table4[Table2.Symbol.Name])}`;
35729
36046
  }
35730
36047
  return table4;
35731
36048
  })();
@@ -35832,7 +36149,7 @@ var init_dialect3 = __esm({
35832
36149
  }
35833
36150
  buildInsertQuery({ table: table4, values, ignore, onConflict }) {
35834
36151
  const valuesSqlList = [];
35835
- const columns = table4[Table.Symbol.Columns];
36152
+ const columns = table4[Table2.Symbol.Columns];
35836
36153
  const colEntries = Object.entries(columns).filter(
35837
36154
  ([_2, col]) => !col.shouldDisableInsert()
35838
36155
  );
@@ -36755,7 +37072,7 @@ var init_select4 = __esm({
36755
37072
  };
36756
37073
  }
36757
37074
  if (typeof tableName === "string" && !is(table4, SQL)) {
36758
- const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View3) ? table4[ViewBaseConfig].selectedFields : table4[Table.Symbol.Columns];
37075
+ const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View3) ? table4[ViewBaseConfig].selectedFields : table4[Table2.Symbol.Columns];
36759
37076
  this.config.fields[tableName] = selection;
36760
37077
  }
36761
37078
  }
@@ -37226,7 +37543,7 @@ var init_update3 = __esm({
37226
37543
  if (typeof columns[0] === "function") {
37227
37544
  const orderBy = columns[0](
37228
37545
  new Proxy(
37229
- this.config.table[Table.Symbol.Columns],
37546
+ this.config.table[Table2.Symbol.Columns],
37230
37547
  new SelectionProxyHandler({ sqlAliasedBehavior: "alias", sqlBehavior: "sql" })
37231
37548
  )
37232
37549
  );
@@ -37959,9 +38276,9 @@ function getTableConfig3(table4) {
37959
38276
  const primaryKeys = [];
37960
38277
  const uniqueConstraints = [];
37961
38278
  const foreignKeys = Object.values(table4[MySqlTable.Symbol.InlineForeignKeys]);
37962
- const name2 = table4[Table.Symbol.Name];
37963
- const schema4 = table4[Table.Symbol.Schema];
37964
- const baseName = table4[Table.Symbol.BaseName];
38279
+ const name2 = table4[Table2.Symbol.Name];
38280
+ const schema4 = table4[Table2.Symbol.Schema];
38281
+ const baseName = table4[Table2.Symbol.BaseName];
37965
38282
  const extraConfigBuilder = table4[MySqlTable.Symbol.ExtraConfigBuilder];
37966
38283
  if (extraConfigBuilder !== void 0) {
37967
38284
  const extraConfig = extraConfigBuilder(table4[MySqlTable.Symbol.Columns]);
@@ -37997,7 +38314,7 @@ function getViewConfig3(view4) {
37997
38314
  ...view4[MySqlViewConfig]
37998
38315
  };
37999
38316
  }
38000
- var init_utils7 = __esm({
38317
+ var init_utils8 = __esm({
38001
38318
  "../drizzle-orm/dist/mysql-core/utils.js"() {
38002
38319
  "use strict";
38003
38320
  init_entity();
@@ -38031,7 +38348,7 @@ var init_mysql_core = __esm({
38031
38348
  init_subquery4();
38032
38349
  init_table4();
38033
38350
  init_unique_constraint3();
38034
- init_utils7();
38351
+ init_utils8();
38035
38352
  init_view_common3();
38036
38353
  init_view3();
38037
38354
  }
@@ -38061,13 +38378,9 @@ var init_mysqlSerializer = __esm({
38061
38378
  "use strict";
38062
38379
  init_source();
38063
38380
  init_dist();
38064
- init_dist();
38065
- init_mysql_core();
38066
- init_mysql_core();
38067
38381
  init_mysql_core();
38068
38382
  init_outputs();
38069
- init_utils();
38070
- init_serializer();
38383
+ init_utils6();
38071
38384
  generateMySqlSnapshot = (tables, views, casing2) => {
38072
38385
  const dialect4 = new MySqlDialect({ casing: casing2 });
38073
38386
  const result = {};
@@ -38815,7 +39128,14 @@ var init_cli = __esm({
38815
39128
  schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
38816
39129
  extensionsFilters: literalType("postgis").array().optional(),
38817
39130
  verbose: booleanType().optional(),
38818
- strict: booleanType().optional()
39131
+ strict: booleanType().optional(),
39132
+ entities: objectType({
39133
+ roles: booleanType().or(objectType({
39134
+ provider: stringType().optional(),
39135
+ include: stringType().array().optional(),
39136
+ exclude: stringType().array().optional()
39137
+ })).optional().default(false)
39138
+ }).optional()
38819
39139
  }).passthrough();
38820
39140
  pullParams = objectType({
38821
39141
  config: stringType().optional(),
@@ -39026,7 +39346,7 @@ var init_es5 = __esm({
39026
39346
 
39027
39347
  // src/cli/commands/utils.ts
39028
39348
  var import_hanji7, assertES5, safeRegister, migrateConfig;
39029
- var init_utils8 = __esm({
39349
+ var init_utils9 = __esm({
39030
39350
  "src/cli/commands/utils.ts"() {
39031
39351
  "use strict";
39032
39352
  import_hanji7 = __toESM(require_hanji());
@@ -39095,13 +39415,14 @@ var init_pgImports = __esm({
39095
39415
  "use strict";
39096
39416
  init_dist();
39097
39417
  init_pg_core();
39098
- init_utils8();
39418
+ init_utils9();
39099
39419
  prepareFromExports = (exports) => {
39100
39420
  const tables = [];
39101
39421
  const enums = [];
39102
39422
  const schemas = [];
39103
39423
  const sequences = [];
39104
39424
  const roles = [];
39425
+ const policies = [];
39105
39426
  const views = [];
39106
39427
  const matViews = [];
39107
39428
  const i0values = Object.values(exports);
@@ -39128,8 +39449,11 @@ var init_pgImports = __esm({
39128
39449
  if (is(t, PgRole)) {
39129
39450
  roles.push(t);
39130
39451
  }
39452
+ if (is(t, PgPolicy)) {
39453
+ policies.push(t);
39454
+ }
39131
39455
  });
39132
- return { tables, enums, schemas, sequences, views, matViews, roles };
39456
+ return { tables, enums, schemas, sequences, views, matViews, roles, policies };
39133
39457
  };
39134
39458
  }
39135
39459
  });
@@ -39146,7 +39470,7 @@ var init_sqliteImports = __esm({
39146
39470
  "use strict";
39147
39471
  init_dist();
39148
39472
  init_sqlite_core();
39149
- init_utils8();
39473
+ init_utils9();
39150
39474
  prepareFromExports2 = (exports) => {
39151
39475
  const tables = [];
39152
39476
  const views = [];
@@ -39190,7 +39514,7 @@ var init_mysqlImports = __esm({
39190
39514
  "use strict";
39191
39515
  init_dist();
39192
39516
  init_mysql_core();
39193
- init_utils8();
39517
+ init_utils9();
39194
39518
  prepareFromExports3 = (exports) => {
39195
39519
  const tables = [];
39196
39520
  const views = [];
@@ -39535,7 +39859,7 @@ init_mjs();
39535
39859
  init_global();
39536
39860
  init_pgSerializer();
39537
39861
  init_views();
39538
- var pgPushIntrospect = async (db, filters, schemaFilters, entities = { roles: true }) => {
39862
+ var pgPushIntrospect = async (db, filters, schemaFilters, entities) => {
39539
39863
  const matchers = filters.map((it) => {
39540
39864
  return new Minimatch(it);
39541
39865
  });
@@ -39801,7 +40125,7 @@ var updateUpToV7 = (json3) => {
39801
40125
  return [idx[0], { columns: mappedColumns, with: {}, ...rest }];
39802
40126
  })
39803
40127
  );
39804
- return [it[0], { ...table4, indexes: mappedIndexes }];
40128
+ return [it[0], { ...table4, indexes: mappedIndexes, policies: {}, isRLSEnabled: false, checkConstraints: {} }];
39805
40129
  })
39806
40130
  );
39807
40131
  return {
@@ -39809,7 +40133,10 @@ var updateUpToV7 = (json3) => {
39809
40133
  version: "7",
39810
40134
  dialect: "postgresql",
39811
40135
  sequences: {},
39812
- tables
40136
+ tables,
40137
+ policies: {},
40138
+ views: {},
40139
+ roles: {}
39813
40140
  };
39814
40141
  };
39815
40142
 
@@ -39984,6 +40311,7 @@ var generateDrizzleJson = (imports, prevId, schemaFilters, casing2) => {
39984
40311
  prepared.schemas,
39985
40312
  prepared.sequences,
39986
40313
  prepared.roles,
40314
+ prepared.policies,
39987
40315
  prepared.views,
39988
40316
  prepared.matViews,
39989
40317
  casing2,
@@ -40008,6 +40336,7 @@ var generateMigration = async (prev, cur) => {
40008
40336
  enumsResolver,
40009
40337
  sequencesResolver,
40010
40338
  policyResolver,
40339
+ indPolicyResolver,
40011
40340
  roleResolver,
40012
40341
  tablesResolver,
40013
40342
  columnsResolver,
@@ -40030,7 +40359,8 @@ var pushSchema = async (imports, drizzleInstance, schemaFilters) => {
40030
40359
  const { schema: prev } = await pgPushIntrospect(
40031
40360
  db,
40032
40361
  [],
40033
- schemaFilters ?? ["public"]
40362
+ schemaFilters ?? ["public"],
40363
+ void 0
40034
40364
  );
40035
40365
  const validatedPrev = pgSchema.parse(prev);
40036
40366
  const validatedCur = pgSchema.parse(cur);
@@ -40043,6 +40373,7 @@ var pushSchema = async (imports, drizzleInstance, schemaFilters) => {
40043
40373
  enumsResolver,
40044
40374
  sequencesResolver,
40045
40375
  policyResolver,
40376
+ indPolicyResolver,
40046
40377
  roleResolver,
40047
40378
  tablesResolver,
40048
40379
  columnsResolver,