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.js CHANGED
@@ -549,184 +549,6 @@ var init_source = __esm({
549
549
  }
550
550
  });
551
551
 
552
- // ../drizzle-orm/dist/entity.js
553
- function is(value, type) {
554
- if (!value || typeof value !== "object") {
555
- return false;
556
- }
557
- if (value instanceof type) {
558
- return true;
559
- }
560
- if (!Object.prototype.hasOwnProperty.call(type, entityKind)) {
561
- throw new Error(
562
- `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.`
563
- );
564
- }
565
- let cls = Object.getPrototypeOf(value).constructor;
566
- if (cls) {
567
- while (cls) {
568
- if (entityKind in cls && cls[entityKind] === type[entityKind]) {
569
- return true;
570
- }
571
- cls = Object.getPrototypeOf(cls);
572
- }
573
- }
574
- return false;
575
- }
576
- var entityKind, hasOwnEntityKind;
577
- var init_entity = __esm({
578
- "../drizzle-orm/dist/entity.js"() {
579
- "use strict";
580
- entityKind = Symbol.for("drizzle:entityKind");
581
- hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
582
- }
583
- });
584
-
585
- // ../drizzle-orm/dist/table.utils.js
586
- var TableName;
587
- var init_table_utils = __esm({
588
- "../drizzle-orm/dist/table.utils.js"() {
589
- "use strict";
590
- TableName = Symbol.for("drizzle:Name");
591
- }
592
- });
593
-
594
- // ../drizzle-orm/dist/table.js
595
- function isTable(table4) {
596
- return typeof table4 === "object" && table4 !== null && IsDrizzleTable in table4;
597
- }
598
- function getTableName(table4) {
599
- return table4[TableName];
600
- }
601
- function getTableUniqueName(table4) {
602
- return `${table4[Schema] ?? "public"}.${table4[TableName]}`;
603
- }
604
- var Schema, Columns, ExtraConfigColumns, OriginalName, BaseName, IsAlias, ExtraConfigBuilder, IsDrizzleTable, _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, Table;
605
- var init_table = __esm({
606
- "../drizzle-orm/dist/table.js"() {
607
- "use strict";
608
- init_entity();
609
- init_table_utils();
610
- Schema = Symbol.for("drizzle:Schema");
611
- Columns = Symbol.for("drizzle:Columns");
612
- ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
613
- OriginalName = Symbol.for("drizzle:OriginalName");
614
- BaseName = Symbol.for("drizzle:BaseName");
615
- IsAlias = Symbol.for("drizzle:IsAlias");
616
- ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
617
- IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
618
- _j = entityKind, _i = TableName, _h = OriginalName, _g = Schema, _f = Columns, _e = ExtraConfigColumns, _d = BaseName, _c = IsAlias, _b = IsDrizzleTable, _a = ExtraConfigBuilder;
619
- Table = class {
620
- constructor(name2, schema4, baseName) {
621
- /**
622
- * @internal
623
- * Can be changed if the table is aliased.
624
- */
625
- __publicField(this, _i);
626
- /**
627
- * @internal
628
- * Used to store the original name of the table, before any aliasing.
629
- */
630
- __publicField(this, _h);
631
- /** @internal */
632
- __publicField(this, _g);
633
- /** @internal */
634
- __publicField(this, _f);
635
- /** @internal */
636
- __publicField(this, _e);
637
- /**
638
- * @internal
639
- * Used to store the table name before the transformation via the `tableCreator` functions.
640
- */
641
- __publicField(this, _d);
642
- /** @internal */
643
- __publicField(this, _c, false);
644
- /** @internal */
645
- __publicField(this, _b, true);
646
- /** @internal */
647
- __publicField(this, _a);
648
- this[TableName] = this[OriginalName] = name2;
649
- this[Schema] = schema4;
650
- this[BaseName] = baseName;
651
- }
652
- };
653
- __publicField(Table, _j, "Table");
654
- /** @internal */
655
- __publicField(Table, "Symbol", {
656
- Name: TableName,
657
- Schema,
658
- OriginalName,
659
- Columns,
660
- ExtraConfigColumns,
661
- BaseName,
662
- IsAlias,
663
- ExtraConfigBuilder
664
- });
665
- }
666
- });
667
-
668
- // ../drizzle-orm/dist/casing.js
669
- function toSnakeCase(input) {
670
- const words = input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? [];
671
- return words.map((word) => word.toLowerCase()).join("_");
672
- }
673
- function toCamelCase(input) {
674
- const words = input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? [];
675
- return words.reduce((acc, word, i) => {
676
- const formattedWord = i === 0 ? word.toLowerCase() : `${word[0].toUpperCase()}${word.slice(1)}`;
677
- return acc + formattedWord;
678
- }, "");
679
- }
680
- function noopCase(input) {
681
- return input;
682
- }
683
- var _a2, CasingCache;
684
- var init_casing = __esm({
685
- "../drizzle-orm/dist/casing.js"() {
686
- "use strict";
687
- init_entity();
688
- init_table();
689
- _a2 = entityKind;
690
- CasingCache = class {
691
- constructor(casing2) {
692
- /** @internal */
693
- __publicField(this, "cache", {});
694
- __publicField(this, "cachedTables", {});
695
- __publicField(this, "convert");
696
- this.convert = casing2 === "snake_case" ? toSnakeCase : casing2 === "camelCase" ? toCamelCase : noopCase;
697
- }
698
- getColumnCasing(column4) {
699
- if (!column4.keyAsName)
700
- return column4.name;
701
- const schema4 = column4.table[Table.Symbol.Schema] ?? "public";
702
- const tableName = column4.table[Table.Symbol.OriginalName];
703
- const key = `${schema4}.${tableName}.${column4.name}`;
704
- if (!this.cache[key]) {
705
- this.cacheTable(column4.table);
706
- }
707
- return this.cache[key];
708
- }
709
- cacheTable(table4) {
710
- const schema4 = table4[Table.Symbol.Schema] ?? "public";
711
- const tableName = table4[Table.Symbol.OriginalName];
712
- const tableKey2 = `${schema4}.${tableName}`;
713
- if (!this.cachedTables[tableKey2]) {
714
- for (const column4 of Object.values(table4[Table.Symbol.Columns])) {
715
- const columnKey = `${tableKey2}.${column4.name}`;
716
- this.cache[columnKey] = this.convert(column4.name);
717
- }
718
- this.cachedTables[tableKey2] = true;
719
- }
720
- }
721
- clearCache() {
722
- this.cache = {};
723
- this.cachedTables = {};
724
- }
725
- };
726
- __publicField(CasingCache, _a2, "CasingCache");
727
- }
728
- });
729
-
730
552
  // ../node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/old.js
731
553
  var require_old = __commonJS({
732
554
  "../node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/old.js"(exports2) {
@@ -7722,7 +7544,7 @@ var init_vector = __esm({
7722
7544
  });
7723
7545
 
7724
7546
  // src/serializer/pgSchema.ts
7725
- var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn, index2, indexV4, indexV5, indexV6, fk2, sequenceSchema, roleSchema, sequenceSquashed, columnV7, column2, checkConstraint2, columnSquashed, tableV32, compositePK2, uniqueConstraint2, policy, viewWithOption, matViewWithOption, mergedViewWithOption, view2, tableV42, tableV5, tableV6, tableV7, table2, schemaHash2, kitInternals2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaInternalV6, pgSchemaExternal, pgSchemaInternalV7, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashedV6, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchemaV6, pgSchemaV7, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg;
7547
+ 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;
7726
7548
  var init_pgSchema = __esm({
7727
7549
  "src/serializer/pgSchema.ts"() {
7728
7550
  "use strict";
@@ -7933,7 +7755,12 @@ var init_pgSchema = __esm({
7933
7755
  for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
7934
7756
  to: stringType().array().optional(),
7935
7757
  using: stringType().optional(),
7936
- withCheck: stringType().optional()
7758
+ withCheck: stringType().optional(),
7759
+ on: stringType().optional()
7760
+ }).strict();
7761
+ policySquashed = objectType({
7762
+ name: stringType(),
7763
+ values: stringType()
7937
7764
  }).strict();
7938
7765
  viewWithOption = objectType({
7939
7766
  checkOption: enumType(["local", "cascaded"]).optional(),
@@ -8113,6 +7940,7 @@ var init_pgSchema = __esm({
8113
7940
  views: recordType(stringType(), view2).default({}),
8114
7941
  sequences: recordType(stringType(), sequenceSchema).default({}),
8115
7942
  roles: recordType(stringType(), roleSchema).default({}),
7943
+ policies: recordType(stringType(), policy).default({}),
8116
7944
  _meta: objectType({
8117
7945
  schemas: recordType(stringType(), stringType()),
8118
7946
  tables: recordType(stringType(), stringType()),
@@ -8161,7 +7989,8 @@ var init_pgSchema = __esm({
8161
7989
  schemas: recordType(stringType(), stringType()),
8162
7990
  views: recordType(stringType(), view2),
8163
7991
  sequences: recordType(stringType(), sequenceSquashed),
8164
- roles: recordType(stringType(), roleSchema).default({})
7992
+ roles: recordType(stringType(), roleSchema).default({}),
7993
+ policies: recordType(stringType(), policySquashed).default({})
8165
7994
  }).strict();
8166
7995
  pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
8167
7996
  pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
@@ -8244,22 +8073,23 @@ var init_pgSchema = __esm({
8244
8073
  squashFK: (fk4) => {
8245
8074
  return `${fk4.name};${fk4.tableFrom};${fk4.columnsFrom.join(",")};${fk4.tableTo};${fk4.columnsTo.join(",")};${fk4.onUpdate ?? ""};${fk4.onDelete ?? ""};${fk4.schemaTo || "public"}`;
8246
8075
  },
8247
- squashPolicy: (policy2) => {
8248
- return `${policy2.name}--${policy2.as}--${policy2.for}--${policy2.to?.join(",")}--${policy2.using}--${policy2.withCheck}`;
8076
+ squashPolicy: (policy4) => {
8077
+ return `${policy4.name}--${policy4.as}--${policy4.for}--${policy4.to?.join(",")}--${policy4.using}--${policy4.withCheck}--${policy4.on}`;
8249
8078
  },
8250
- unsquashPolicy: (policy2) => {
8251
- const splitted = policy2.split("--");
8079
+ unsquashPolicy: (policy4) => {
8080
+ const splitted = policy4.split("--");
8252
8081
  return {
8253
8082
  name: splitted[0],
8254
8083
  as: splitted[1],
8255
8084
  for: splitted[2],
8256
8085
  to: splitted[3].split(","),
8257
8086
  using: splitted[4] !== "undefined" ? splitted[4] : void 0,
8258
- withCheck: splitted[5] !== "undefined" ? splitted[5] : void 0
8087
+ withCheck: splitted[5] !== "undefined" ? splitted[5] : void 0,
8088
+ on: splitted[6] !== "undefined" ? splitted[6] : void 0
8259
8089
  };
8260
8090
  },
8261
- squashPolicyPush: (policy2) => {
8262
- return `${policy2.name}--${policy2.as}--${policy2.for}--${policy2.to?.join(",")}`;
8091
+ squashPolicyPush: (policy4) => {
8092
+ return `${policy4.name}--${policy4.as}--${policy4.for}--${policy4.to?.join(",")}--${policy4.on}`;
8263
8093
  },
8264
8094
  squashPK: (pk) => {
8265
8095
  return `${pk.columns.join(",")};${pk.name}`;
@@ -8373,8 +8203,8 @@ var init_pgSchema = __esm({
8373
8203
  return PgSquasher.squashUnique(unq);
8374
8204
  }
8375
8205
  );
8376
- const squashedPolicies = mapValues(it[1].policies, (policy2) => {
8377
- return action === "push" ? PgSquasher.squashPolicyPush(policy2) : PgSquasher.squashPolicy(policy2);
8206
+ const squashedPolicies = mapValues(it[1].policies, (policy4) => {
8207
+ return action === "push" ? PgSquasher.squashPolicyPush(policy4) : PgSquasher.squashPolicy(policy4);
8378
8208
  });
8379
8209
  const squashedChecksContraints = mapValues(
8380
8210
  it[1].checkConstraints,
@@ -8411,6 +8241,17 @@ var init_pgSchema = __esm({
8411
8241
  ];
8412
8242
  })
8413
8243
  );
8244
+ const mappedPolicies = Object.fromEntries(
8245
+ Object.entries(json3.policies).map((it) => {
8246
+ return [
8247
+ it[0],
8248
+ {
8249
+ name: it[1].name,
8250
+ values: action === "push" ? PgSquasher.squashPolicyPush(it[1]) : PgSquasher.squashPolicy(it[1])
8251
+ }
8252
+ ];
8253
+ })
8254
+ );
8414
8255
  return {
8415
8256
  version: "7",
8416
8257
  dialect: json3.dialect,
@@ -8418,6 +8259,7 @@ var init_pgSchema = __esm({
8418
8259
  enums: json3.enums,
8419
8260
  schemas: json3.schemas,
8420
8261
  views: json3.views,
8262
+ policies: mappedPolicies,
8421
8263
  sequences: mappedSequences,
8422
8264
  roles: json3.roles
8423
8265
  };
@@ -8430,6 +8272,8 @@ var init_pgSchema = __esm({
8430
8272
  tables: {},
8431
8273
  enums: {},
8432
8274
  schemas: {},
8275
+ policies: {},
8276
+ roles: {},
8433
8277
  sequences: {},
8434
8278
  _meta: {
8435
8279
  schemas: {},
@@ -8748,15 +8592,10 @@ function findAddedAndRemoved(columnNames1, columnNames2) {
8748
8592
  const removedColumns = columnNames1.filter((it) => !set2.has(it));
8749
8593
  return { addedColumns, removedColumns };
8750
8594
  }
8751
- function getColumnCasing(column4, casing2) {
8752
- if (!column4.name) return "";
8753
- return !column4.keyAsName || casing2 === void 0 ? column4.name : casing2 === "camelCase" ? toCamelCase(column4.name) : toSnakeCase(column4.name);
8754
- }
8755
8595
  var copy, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey;
8756
8596
  var init_utils = __esm({
8757
8597
  "src/utils.ts"() {
8758
8598
  "use strict";
8759
- init_casing();
8760
8599
  init_views();
8761
8600
  init_global();
8762
8601
  init_mysqlSchema();
@@ -9048,27 +8887,12 @@ Is ${source_default.bold.blue(
9048
8887
  });
9049
8888
 
9050
8889
  // src/serializer/index.ts
9051
- var glob, sqlToStr;
8890
+ var glob;
9052
8891
  var init_serializer = __esm({
9053
8892
  "src/serializer/index.ts"() {
9054
8893
  "use strict";
9055
- init_casing();
9056
8894
  glob = __toESM(require_glob());
9057
8895
  init_views();
9058
- sqlToStr = (sql2, casing2) => {
9059
- return sql2.toQuery({
9060
- escapeName: () => {
9061
- throw new Error("we don't support params for `sql` default values");
9062
- },
9063
- escapeParam: () => {
9064
- throw new Error("we don't support params for `sql` default values");
9065
- },
9066
- escapeString: () => {
9067
- throw new Error("we don't support params for `sql` default values");
9068
- },
9069
- casing: new CasingCache(casing2)
9070
- }).sql;
9071
- };
9072
8896
  }
9073
8897
  });
9074
8898
 
@@ -11426,6 +11250,14 @@ function diffSchemasOrTables(left, right) {
11426
11250
  const deleted = result.filter((it) => it[0].endsWith("__deleted")).map((it) => it[1]);
11427
11251
  return { added, deleted };
11428
11252
  }
11253
+ function diffIndPolicies(left, right) {
11254
+ left = JSON.parse(JSON.stringify(left));
11255
+ right = JSON.parse(JSON.stringify(right));
11256
+ const result = Object.entries((0, import_json_diff.diff)(left, right) ?? {});
11257
+ const added = result.filter((it) => it[0].endsWith("__added")).map((it) => it[1]);
11258
+ const deleted = result.filter((it) => it[0].endsWith("__deleted")).map((it) => it[1]);
11259
+ return { added, deleted };
11260
+ }
11429
11261
  function diffColumns(left, right) {
11430
11262
  left = JSON.parse(JSON.stringify(left));
11431
11263
  right = JSON.parse(JSON.stringify(right));
@@ -11498,6 +11330,7 @@ function applyJsonDiff(json1, json22) {
11498
11330
  difference.enums = difference.enums || {};
11499
11331
  difference.sequences = difference.sequences || {};
11500
11332
  difference.roles = difference.roles || {};
11333
+ difference.policies = difference.policies || {};
11501
11334
  difference.views = difference.views || {};
11502
11335
  const schemaKeys = Object.keys(difference.schemas);
11503
11336
  for (let key of schemaKeys) {
@@ -11558,6 +11391,10 @@ function applyJsonDiff(json1, json22) {
11558
11391
  const alteredRoles = rolesEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted"))).map((it) => {
11559
11392
  return json22.roles[it[0]];
11560
11393
  });
11394
+ const policiesEntries = Object.entries(difference.policies);
11395
+ const alteredPolicies = policiesEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted"))).map((it) => {
11396
+ return json22.policies[it[0]];
11397
+ });
11561
11398
  const viewsEntries = Object.entries(difference.views);
11562
11399
  const alteredViews = viewsEntries.filter((it) => !(it[0].includes("__added") || it[0].includes("__deleted"))).map(
11563
11400
  ([nameWithSchema, view4]) => {
@@ -11632,7 +11469,8 @@ function applyJsonDiff(json1, json22) {
11632
11469
  alteredEnums,
11633
11470
  alteredSequences,
11634
11471
  alteredRoles,
11635
- alteredViews
11472
+ alteredViews,
11473
+ alteredPolicies
11636
11474
  };
11637
11475
  }
11638
11476
  var import_json_diff, mapArraysDiff, findAlternationsInTable, alternationsInColumn;
@@ -12089,7 +11927,7 @@ function fromJson(statements, dialect4, action, json22) {
12089
11927
  }).filter((it) => it !== "");
12090
11928
  return result;
12091
11929
  }
12092
- var pgNativeTypes, isPgNativeType, Convertor, PgCreateRoleConvertor, PgDropRoleConvertor, PgRenameRoleConvertor, PgAlterRoleConvertor, PgCreatePolicyConvertor, PgDropPolicyConvertor, PgRenamePolicyConvertor, PgAlterPolicyConvertor, PgEnableRlsConvertor, PgDisableRlsConvertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SQLiteCreateTableConvertor, PgCreateViewConvertor, MySqlCreateViewConvertor, SqliteCreateViewConvertor, PgDropViewConvertor, MySqlDropViewConvertor, SqliteDropViewConvertor, MySqlAlterViewConvertor, PgRenameViewConvertor, MySqlRenameViewConvertor, PgAlterViewSchemaConvertor, PgAlterViewAddWithOptionConvertor, PgAlterViewDropWithOptionConvertor, PgAlterViewAlterTablespaceConvertor, PgAlterViewAlterUsingConvertor, PgAlterTableAlterColumnSetGenerated, PgAlterTableAlterColumnDropGenerated, PgAlterTableAlterColumnAlterGenerated, PgAlterTableAddUniqueConstraintConvertor, PgAlterTableDropUniqueConstraintConvertor, PgAlterTableAddCheckConstraintConvertor, PgAlterTableDeleteCheckConstraintConvertor, MySQLAlterTableAddUniqueConstraintConvertor, MySQLAlterTableDropUniqueConstraintConvertor, MySqlAlterTableAddCheckConstraintConvertor, MySqlAlterTableDeleteCheckConstraintConvertor, CreatePgSequenceConvertor, DropPgSequenceConvertor, RenamePgSequenceConvertor, MovePgSequenceConvertor, AlterPgSequenceConvertor, CreateTypeEnumConvertor, DropTypeEnumConvertor, AlterTypeAddValueConvertor, AlterTypeSetSchemaConvertor, AlterRenameTypeConvertor, AlterTypeDropValueConvertor, PgDropTableConvertor, MySQLDropTableConvertor, SQLiteDropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, PgAlterTableAlterColumnDropGeneratedConvertor, PgAlterTableAlterColumnSetExpressionConvertor, PgAlterTableAlterColumnAlterrGeneratedConvertor, SqliteAlterTableAlterColumnDropGeneratedConvertor, SqliteAlterTableAlterColumnSetExpressionConvertor, SqliteAlterTableAlterColumnAlterGeneratedConvertor, MySqlAlterTableAlterColumnAlterrGeneratedConvertor, MySqlAlterTableAddPk, MySqlAlterTableDropPk, LibSQLModifyColumn, MySqlModifyColumn, PgAlterTableCreateCompositePrimaryKeyConvertor, PgAlterTableDeleteCompositePrimaryKeyConvertor, PgAlterTableAlterCompositePrimaryKeyConvertor, MySqlAlterTableCreateCompositePrimaryKeyConvertor, MySqlAlterTableDeleteCompositePrimaryKeyConvertor, MySqlAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetPrimaryKeyConvertor, PgAlterTableAlterColumnDropPrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, PgAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, LibSQLCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MySqlDropIndexConvertor, SQLiteRecreateTableConvertor, LibSQLRecreateTableConvertor, convertors;
11930
+ 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;
12093
11931
  var init_sqlgenerator = __esm({
12094
11932
  "src/sqlgenerator.ts"() {
12095
11933
  "use strict";
@@ -12182,14 +12020,14 @@ var init_sqlgenerator = __esm({
12182
12020
  return statement.type === "create_policy" && dialect4 === "postgresql";
12183
12021
  }
12184
12022
  convert(statement) {
12185
- const policy2 = statement.data;
12023
+ const policy4 = statement.data;
12186
12024
  const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12187
- const usingPart = policy2.using ? ` USING (${policy2.using})` : "";
12188
- const withCheckPart = policy2.withCheck ? ` WITH CHECK (${policy2.withCheck})` : "";
12189
- const policyToPart = policy2.to?.map(
12025
+ const usingPart = policy4.using ? ` USING (${policy4.using})` : "";
12026
+ const withCheckPart = policy4.withCheck ? ` WITH CHECK (${policy4.withCheck})` : "";
12027
+ const policyToPart = policy4.to?.map(
12190
12028
  (v) => ["current_user", "current_role", "session_user", "public"].includes(v) ? v : `"${v}"`
12191
12029
  ).join(", ");
12192
- return `CREATE POLICY "${policy2.name}" ON ${tableNameWithSchema} AS ${policy2.as?.toUpperCase()} FOR ${policy2.for?.toUpperCase()} TO ${policyToPart}${usingPart}${withCheckPart};`;
12030
+ return `CREATE POLICY "${policy4.name}" ON ${tableNameWithSchema} AS ${policy4.as?.toUpperCase()} FOR ${policy4.for?.toUpperCase()} TO ${policyToPart}${usingPart}${withCheckPart};`;
12193
12031
  }
12194
12032
  };
12195
12033
  PgDropPolicyConvertor = class extends Convertor {
@@ -12197,9 +12035,9 @@ var init_sqlgenerator = __esm({
12197
12035
  return statement.type === "drop_policy" && dialect4 === "postgresql";
12198
12036
  }
12199
12037
  convert(statement) {
12200
- const policy2 = statement.data;
12038
+ const policy4 = statement.data;
12201
12039
  const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
12202
- return `DROP POLICY "${policy2.name}" ON ${tableNameWithSchema} CASCADE;`;
12040
+ return `DROP POLICY "${policy4.name}" ON ${tableNameWithSchema} CASCADE;`;
12203
12041
  }
12204
12042
  };
12205
12043
  PgRenamePolicyConvertor = class extends Convertor {
@@ -12224,6 +12062,49 @@ var init_sqlgenerator = __esm({
12224
12062
  return `ALTER POLICY "${oldPolicy.name}" ON ${tableNameWithSchema} TO ${newPolicy.to}${usingPart}${withCheckPart};`;
12225
12063
  }
12226
12064
  };
12065
+ PgCreateIndPolicyConvertor = class extends Convertor {
12066
+ can(statement, dialect4) {
12067
+ return statement.type === "create_ind_policy" && dialect4 === "postgresql";
12068
+ }
12069
+ convert(statement) {
12070
+ const policy4 = statement.data;
12071
+ const usingPart = policy4.using ? ` USING (${policy4.using})` : "";
12072
+ const withCheckPart = policy4.withCheck ? ` WITH CHECK (${policy4.withCheck})` : "";
12073
+ const policyToPart = policy4.to?.map(
12074
+ (v) => ["current_user", "current_role", "session_user", "public"].includes(v) ? v : `"${v}"`
12075
+ ).join(", ");
12076
+ return `CREATE POLICY "${policy4.name}" ON ${policy4.on} AS ${policy4.as?.toUpperCase()} FOR ${policy4.for?.toUpperCase()} TO ${policyToPart}${usingPart}${withCheckPart};`;
12077
+ }
12078
+ };
12079
+ PgDropIndPolicyConvertor = class extends Convertor {
12080
+ can(statement, dialect4) {
12081
+ return statement.type === "drop_ind_policy" && dialect4 === "postgresql";
12082
+ }
12083
+ convert(statement) {
12084
+ const policy4 = statement.data;
12085
+ return `DROP POLICY "${policy4.name}" ON ${policy4.on} CASCADE;`;
12086
+ }
12087
+ };
12088
+ PgRenameIndPolicyConvertor = class extends Convertor {
12089
+ can(statement, dialect4) {
12090
+ return statement.type === "rename_ind_policy" && dialect4 === "postgresql";
12091
+ }
12092
+ convert(statement) {
12093
+ return `ALTER POLICY "${statement.oldName}" ON ${statement.tableKey} RENAME TO "${statement.newName}";`;
12094
+ }
12095
+ };
12096
+ PgAlterIndPolicyConvertor = class extends Convertor {
12097
+ can(statement, dialect4) {
12098
+ return statement.type === "alter_ind_policy" && dialect4 === "postgresql";
12099
+ }
12100
+ convert(statement) {
12101
+ const newPolicy = statement.newData;
12102
+ const oldPolicy = statement.oldData;
12103
+ const usingPart = newPolicy.using ? ` USING (${newPolicy.using})` : oldPolicy.using ? ` USING (${oldPolicy.using})` : "";
12104
+ const withCheckPart = newPolicy.withCheck ? ` WITH CHECK (${newPolicy.withCheck})` : oldPolicy.withCheck ? ` WITH CHECK (${oldPolicy.withCheck})` : "";
12105
+ return `ALTER POLICY "${oldPolicy.name}" ON ${oldPolicy.on} TO ${newPolicy.to}${usingPart}${withCheckPart};`;
12106
+ }
12107
+ };
12227
12108
  PgEnableRlsConvertor = class extends Convertor {
12228
12109
  can(statement, dialect4) {
12229
12110
  return statement.type === "enable_rls" && dialect4 === "postgresql";
@@ -14115,6 +13996,10 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
14115
13996
  convertors.push(new PgCreatePolicyConvertor());
14116
13997
  convertors.push(new PgDropPolicyConvertor());
14117
13998
  convertors.push(new PgRenamePolicyConvertor());
13999
+ convertors.push(new PgAlterIndPolicyConvertor());
14000
+ convertors.push(new PgCreateIndPolicyConvertor());
14001
+ convertors.push(new PgDropIndPolicyConvertor());
14002
+ convertors.push(new PgRenameIndPolicyConvertor());
14118
14003
  convertors.push(new PgEnableRlsConvertor());
14119
14004
  convertors.push(new PgDisableRlsConvertor());
14120
14005
  convertors.push(new PgDropRoleConvertor());
@@ -14420,7 +14305,7 @@ var init_sqlitePushUtils = __esm({
14420
14305
  });
14421
14306
 
14422
14307
  // src/jsonStatements.ts
14423
- var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumValues, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson, prepareCreateRoleJson, prepareAlterRoleJson, prepareDropRoleJson, prepareRenameRoleJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, prepareRenamePolicyJsons, prepareCreatePolicyJsons, prepareDropPolicyJsons, prepareAlterPolicyJson, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareLibSQLCreateReferencesJson, prepareDropReferencesJson, prepareLibSQLDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCheckConstraint, prepareDeleteCheckConstraint, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql, preparePgCreateViewJson, prepareMySqlCreateViewJson, prepareSqliteCreateViewJson, prepareDropViewJson, prepareRenameViewJson, preparePgAlterViewAlterSchemaJson, preparePgAlterViewAddWithOptionJson, preparePgAlterViewDropWithOptionJson, preparePgAlterViewAlterTablespaceJson, preparePgAlterViewAlterUsingJson, prepareMySqlAlterView;
14308
+ 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;
14424
14309
  var init_jsonStatements = __esm({
14425
14310
  "src/jsonStatements.ts"() {
14426
14311
  "use strict";
@@ -15545,6 +15430,16 @@ var init_jsonStatements = __esm({
15545
15430
  };
15546
15431
  });
15547
15432
  };
15433
+ prepareRenameIndPolicyJsons = (renames) => {
15434
+ return renames.map((it) => {
15435
+ return {
15436
+ type: "rename_ind_policy",
15437
+ tableKey: it.from.on,
15438
+ oldName: it.from.name,
15439
+ newName: it.to.name
15440
+ };
15441
+ });
15442
+ };
15548
15443
  prepareCreatePolicyJsons = (tableName, schema4, policies) => {
15549
15444
  return policies.map((it) => {
15550
15445
  return {
@@ -15555,6 +15450,15 @@ var init_jsonStatements = __esm({
15555
15450
  };
15556
15451
  });
15557
15452
  };
15453
+ prepareCreateIndPolicyJsons = (policies) => {
15454
+ return policies.map((it) => {
15455
+ return {
15456
+ type: "create_ind_policy",
15457
+ tableName: it.on,
15458
+ data: it
15459
+ };
15460
+ });
15461
+ };
15558
15462
  prepareDropPolicyJsons = (tableName, schema4, policies) => {
15559
15463
  return policies.map((it) => {
15560
15464
  return {
@@ -15565,6 +15469,15 @@ var init_jsonStatements = __esm({
15565
15469
  };
15566
15470
  });
15567
15471
  };
15472
+ prepareDropIndPolicyJsons = (policies) => {
15473
+ return policies.map((it) => {
15474
+ return {
15475
+ type: "drop_ind_policy",
15476
+ tableName: it.on,
15477
+ data: it
15478
+ };
15479
+ });
15480
+ };
15568
15481
  prepareAlterPolicyJson = (tableName, schema4, oldPolicy, newPolicy) => {
15569
15482
  return {
15570
15483
  type: "alter_policy",
@@ -15574,6 +15487,13 @@ var init_jsonStatements = __esm({
15574
15487
  schema: schema4
15575
15488
  };
15576
15489
  };
15490
+ prepareAlterIndPolicyJson = (oldPolicy, newPolicy) => {
15491
+ return {
15492
+ type: "alter_ind_policy",
15493
+ oldData: oldPolicy,
15494
+ newData: newPolicy
15495
+ };
15496
+ };
15577
15497
  preparePgCreateIndexesJson = (tableName, schema4, indexes, fullSchema, action) => {
15578
15498
  if (action === "push") {
15579
15499
  return Object.values(indexes).map((indexData) => {
@@ -16515,6 +16435,7 @@ var init_snapshotsDiffer = __esm({
16515
16435
  alteredEnums: changedEnumSchema.array(),
16516
16436
  alteredSequences: sequenceSquashed.array(),
16517
16437
  alteredRoles: roleSchema.array(),
16438
+ alteredPolicies: policySquashed.array(),
16518
16439
  alteredViews: alteredPgViewSchema.array()
16519
16440
  }).strict();
16520
16441
  diffResultSchemeMysql = objectType({
@@ -16572,7 +16493,7 @@ var init_snapshotsDiffer = __esm({
16572
16493
  }
16573
16494
  return column4;
16574
16495
  };
16575
- applyPgSnapshotsDiff = async (json1, json22, schemasResolver2, enumsResolver2, sequencesResolver2, policyResolver2, roleResolver2, tablesResolver2, columnsResolver2, viewsResolver2, prevFull, curFull, action) => {
16496
+ applyPgSnapshotsDiff = async (json1, json22, schemasResolver2, enumsResolver2, sequencesResolver2, policyResolver2, indPolicyResolver2, roleResolver2, tablesResolver2, columnsResolver2, viewsResolver2, prevFull, curFull, action) => {
16576
16497
  const schemasDiff = diffSchemasOrTables(json1.schemas, json22.schemas);
16577
16498
  const {
16578
16499
  created: createdSchemas,
@@ -16789,24 +16710,24 @@ var init_snapshotsDiffer = __esm({
16789
16710
  const columnCreates = [];
16790
16711
  const columnDeletes = [];
16791
16712
  for (let entry of Object.values(res)) {
16792
- const { renamed, created, deleted } = await columnsResolver2({
16713
+ const { renamed, created: created2, deleted: deleted2 } = await columnsResolver2({
16793
16714
  tableName: entry.name,
16794
16715
  schema: entry.schema,
16795
16716
  deleted: entry.columns.deleted,
16796
16717
  created: entry.columns.added
16797
16718
  });
16798
- if (created.length > 0) {
16719
+ if (created2.length > 0) {
16799
16720
  columnCreates.push({
16800
16721
  table: entry.name,
16801
16722
  schema: entry.schema,
16802
- columns: created
16723
+ columns: created2
16803
16724
  });
16804
16725
  }
16805
- if (deleted.length > 0) {
16726
+ if (deleted2.length > 0) {
16806
16727
  columnDeletes.push({
16807
16728
  table: entry.name,
16808
16729
  schema: entry.schema,
16809
- columns: deleted
16730
+ columns: deleted2
16810
16731
  });
16811
16732
  }
16812
16733
  if (renamed.length > 0) {
@@ -16846,24 +16767,24 @@ var init_snapshotsDiffer = __esm({
16846
16767
  const policyCreates = [];
16847
16768
  const policyDeletes = [];
16848
16769
  for (let entry of Object.values(policyRes)) {
16849
- const { renamed, created, deleted } = await policyResolver2({
16770
+ const { renamed, created: created2, deleted: deleted2 } = await policyResolver2({
16850
16771
  tableName: entry.name,
16851
16772
  schema: entry.schema,
16852
16773
  deleted: entry.policies.deleted.map(PgSquasher.unsquashPolicy),
16853
16774
  created: entry.policies.added.map(PgSquasher.unsquashPolicy)
16854
16775
  });
16855
- if (created.length > 0) {
16776
+ if (created2.length > 0) {
16856
16777
  policyCreates.push({
16857
16778
  table: entry.name,
16858
16779
  schema: entry.schema,
16859
- columns: created
16780
+ columns: created2
16860
16781
  });
16861
16782
  }
16862
- if (deleted.length > 0) {
16783
+ if (deleted2.length > 0) {
16863
16784
  policyDeletes.push({
16864
16785
  table: entry.name,
16865
16786
  schema: entry.schema,
16866
- columns: deleted
16787
+ columns: deleted2
16867
16788
  });
16868
16789
  }
16869
16790
  if (renamed.length > 0) {
@@ -16887,12 +16808,12 @@ var init_snapshotsDiffer = __esm({
16887
16808
  (tableKey2, tableValue) => {
16888
16809
  const patchedPolicies = mapKeys(
16889
16810
  tableValue.policies,
16890
- (policyKey, policy2) => {
16811
+ (policyKey, policy4) => {
16891
16812
  const rens = policyRenamesDict[`${tableValue.schema || "public"}.${tableValue.name}`] || [];
16892
16813
  const newName = columnChangeFor(policyKey, rens);
16893
- const unsquashedPolicy = PgSquasher.unsquashPolicy(policy2);
16814
+ const unsquashedPolicy = PgSquasher.unsquashPolicy(policy4);
16894
16815
  unsquashedPolicy.name = newName;
16895
- policy2 = PgSquasher.squashPolicy(unsquashedPolicy);
16816
+ policy4 = PgSquasher.squashPolicy(unsquashedPolicy);
16896
16817
  return newName;
16897
16818
  }
16898
16819
  );
@@ -16900,7 +16821,46 @@ var init_snapshotsDiffer = __esm({
16900
16821
  return [tableKey2, tableValue];
16901
16822
  }
16902
16823
  );
16903
- const viewsDiff = diffSchemasOrTables(policyPatchedSnap1.views, json22.views);
16824
+ const indPolicyRes = diffIndPolicies(policyPatchedSnap1.policies, json22.policies);
16825
+ const indPolicyCreates = [];
16826
+ const indPolicyDeletes = [];
16827
+ const { renamed: indPolicyRenames, created, deleted } = await indPolicyResolver2({
16828
+ deleted: indPolicyRes.deleted.map((t) => PgSquasher.unsquashPolicy(t.values)),
16829
+ created: indPolicyRes.added.map((t) => PgSquasher.unsquashPolicy(t.values))
16830
+ });
16831
+ if (created.length > 0) {
16832
+ indPolicyCreates.push({
16833
+ policies: created
16834
+ });
16835
+ }
16836
+ if (deleted.length > 0) {
16837
+ indPolicyDeletes.push({
16838
+ policies: deleted
16839
+ });
16840
+ }
16841
+ const indPolicyRenamesDict = indPolicyRenames.reduce(
16842
+ (acc, it) => {
16843
+ acc[it.from.name] = {
16844
+ nameFrom: it.from.name,
16845
+ nameTo: it.to.name
16846
+ };
16847
+ return acc;
16848
+ },
16849
+ {}
16850
+ );
16851
+ const indPolicyPatchedSnap1 = copy(policyPatchedSnap1);
16852
+ indPolicyPatchedSnap1.policies = mapEntries(
16853
+ indPolicyPatchedSnap1.policies,
16854
+ (policyKey, policyValue) => {
16855
+ const key = policyKey;
16856
+ const change = indPolicyRenamesDict[key];
16857
+ if (change) {
16858
+ policyValue.name = change.nameTo;
16859
+ }
16860
+ return [policyKey, policyValue];
16861
+ }
16862
+ );
16863
+ const viewsDiff = diffSchemasOrTables(indPolicyPatchedSnap1.views, json22.views);
16904
16864
  const {
16905
16865
  created: createdViews,
16906
16866
  deleted: deletedViews,
@@ -17041,16 +17001,16 @@ var init_snapshotsDiffer = __esm({
17041
17001
  );
17042
17002
  if (it.alteredUniqueConstraints) {
17043
17003
  const added = {};
17044
- const deleted = {};
17004
+ const deleted2 = {};
17045
17005
  for (const k of Object.keys(it.alteredUniqueConstraints)) {
17046
17006
  added[k] = it.alteredUniqueConstraints[k].__new;
17047
- deleted[k] = it.alteredUniqueConstraints[k].__old;
17007
+ deleted2[k] = it.alteredUniqueConstraints[k].__old;
17048
17008
  }
17049
17009
  addedUniqueConstraints.push(
17050
17010
  ...prepareAddUniqueConstraintPg(it.name, it.schema, added)
17051
17011
  );
17052
17012
  deletedUniqueConstraints.push(
17053
- ...prepareDeleteUniqueConstraintPg(it.name, it.schema, deleted)
17013
+ ...prepareDeleteUniqueConstraintPg(it.name, it.schema, deleted2)
17054
17014
  );
17055
17015
  }
17056
17016
  createCheckConstraints = prepareAddCheckConstraint(it.name, it.schema, it.addedCheckConstraints);
@@ -17061,13 +17021,13 @@ var init_snapshotsDiffer = __esm({
17061
17021
  );
17062
17022
  if (it.alteredCheckConstraints && action !== "push") {
17063
17023
  const added = {};
17064
- const deleted = {};
17024
+ const deleted2 = {};
17065
17025
  for (const k of Object.keys(it.alteredCheckConstraints)) {
17066
17026
  added[k] = it.alteredCheckConstraints[k].__new;
17067
- deleted[k] = it.alteredCheckConstraints[k].__old;
17027
+ deleted2[k] = it.alteredCheckConstraints[k].__old;
17068
17028
  }
17069
17029
  createCheckConstraints.push(...prepareAddCheckConstraint(it.name, it.schema, added));
17070
- deleteCheckConstraints.push(...prepareDeleteCheckConstraint(it.name, it.schema, deleted));
17030
+ deleteCheckConstraints.push(...prepareDeleteCheckConstraint(it.name, it.schema, deleted2));
17071
17031
  }
17072
17032
  jsonCreatedCheckConstraints.push(...createCheckConstraints);
17073
17033
  jsonDeletedCheckConstraints.push(...deleteCheckConstraints);
@@ -17115,8 +17075,68 @@ var init_snapshotsDiffer = __esm({
17115
17075
  const jsonDropPoliciesStatements = [];
17116
17076
  const jsonAlterPoliciesStatements = [];
17117
17077
  const jsonRenamePoliciesStatements = [];
17078
+ const jsonRenameIndPoliciesStatements = [];
17079
+ const jsonCreateIndPoliciesStatements = [];
17080
+ const jsonDropIndPoliciesStatements = [];
17081
+ const jsonAlterIndPoliciesStatements = [];
17118
17082
  const jsonEnableRLSStatements = [];
17119
17083
  const jsonDisableRLSStatements = [];
17084
+ for (let it of indPolicyRenames) {
17085
+ jsonRenameIndPoliciesStatements.push(
17086
+ ...prepareRenameIndPolicyJsons([it])
17087
+ );
17088
+ }
17089
+ for (const it of indPolicyCreates) {
17090
+ jsonCreateIndPoliciesStatements.push(
17091
+ ...prepareCreateIndPolicyJsons(
17092
+ it.policies
17093
+ )
17094
+ );
17095
+ }
17096
+ for (const it of indPolicyDeletes) {
17097
+ jsonDropIndPoliciesStatements.push(
17098
+ ...prepareDropIndPolicyJsons(
17099
+ it.policies
17100
+ )
17101
+ );
17102
+ }
17103
+ typedResult.alteredPolicies.forEach(({ values }) => {
17104
+ const policy4 = PgSquasher.unsquashPolicy(values);
17105
+ const newPolicy = PgSquasher.unsquashPolicy(json22.policies[policy4.name].values);
17106
+ const oldPolicy = PgSquasher.unsquashPolicy(json1.policies[policy4.name].values);
17107
+ if (newPolicy.as !== oldPolicy.as) {
17108
+ jsonDropIndPoliciesStatements.push(
17109
+ ...prepareDropIndPolicyJsons(
17110
+ [oldPolicy]
17111
+ )
17112
+ );
17113
+ jsonCreateIndPoliciesStatements.push(
17114
+ ...prepareCreateIndPolicyJsons(
17115
+ [newPolicy]
17116
+ )
17117
+ );
17118
+ return;
17119
+ }
17120
+ if (newPolicy.for !== oldPolicy.for) {
17121
+ jsonDropIndPoliciesStatements.push(
17122
+ ...prepareDropIndPolicyJsons(
17123
+ [oldPolicy]
17124
+ )
17125
+ );
17126
+ jsonCreateIndPoliciesStatements.push(
17127
+ ...prepareCreateIndPolicyJsons(
17128
+ [newPolicy]
17129
+ )
17130
+ );
17131
+ return;
17132
+ }
17133
+ jsonAlterIndPoliciesStatements.push(
17134
+ prepareAlterIndPolicyJson(
17135
+ oldPolicy,
17136
+ newPolicy
17137
+ )
17138
+ );
17139
+ });
17120
17140
  for (let it of policyRenames) {
17121
17141
  jsonRenamePoliciesStatements.push(
17122
17142
  ...prepareRenamePolicyJsons(it.table, it.schema, it.renames)
@@ -17504,6 +17524,10 @@ var init_snapshotsDiffer = __esm({
17504
17524
  jsonStatements.push(...jsonDropPoliciesStatements);
17505
17525
  jsonStatements.push(...jsonCreatePoliciesStatements);
17506
17526
  jsonStatements.push(...jsonAlterPoliciesStatements);
17527
+ jsonStatements.push(...jsonRenameIndPoliciesStatements);
17528
+ jsonStatements.push(...jsonDropIndPoliciesStatements);
17529
+ jsonStatements.push(...jsonCreateIndPoliciesStatements);
17530
+ jsonStatements.push(...jsonAlterIndPoliciesStatements);
17507
17531
  jsonStatements.push(...createViews);
17508
17532
  jsonStatements.push(...dropEnums);
17509
17533
  jsonStatements.push(...dropSequences);
@@ -18896,7 +18920,7 @@ var init_outputs = __esm({
18896
18920
  });
18897
18921
 
18898
18922
  // src/cli/commands/migrate.ts
18899
- var import_hanji2, schemasResolver, tablesResolver, viewsResolver, mySqlViewsResolver, sqliteViewsResolver, sequencesResolver, roleResolver, policyResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedConflict, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT;
18923
+ var import_hanji2, schemasResolver, tablesResolver, viewsResolver, mySqlViewsResolver, sqliteViewsResolver, sequencesResolver, roleResolver, policyResolver, indPolicyResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedConflict, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT;
18900
18924
  var init_migrate = __esm({
18901
18925
  "src/cli/commands/migrate.ts"() {
18902
18926
  "use strict";
@@ -19039,6 +19063,18 @@ var init_migrate = __esm({
19039
19063
  renamed: result.renamed
19040
19064
  };
19041
19065
  };
19066
+ indPolicyResolver = async (input) => {
19067
+ const result = await promptNamedConflict(
19068
+ input.created,
19069
+ input.deleted,
19070
+ "policy"
19071
+ );
19072
+ return {
19073
+ created: result.created,
19074
+ deleted: result.deleted,
19075
+ renamed: result.renamed
19076
+ };
19077
+ };
19042
19078
  enumsResolver = async (input) => {
19043
19079
  try {
19044
19080
  const { created, deleted, moved, renamed } = await promptNamedWithSchemasConflict(
@@ -20354,13 +20390,46 @@ var init_mjs = __esm({
20354
20390
  }
20355
20391
  });
20356
20392
 
20393
+ // ../drizzle-orm/dist/entity.js
20394
+ function is(value, type) {
20395
+ if (!value || typeof value !== "object") {
20396
+ return false;
20397
+ }
20398
+ if (value instanceof type) {
20399
+ return true;
20400
+ }
20401
+ if (!Object.prototype.hasOwnProperty.call(type, entityKind)) {
20402
+ throw new Error(
20403
+ `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.`
20404
+ );
20405
+ }
20406
+ let cls = Object.getPrototypeOf(value).constructor;
20407
+ if (cls) {
20408
+ while (cls) {
20409
+ if (entityKind in cls && cls[entityKind] === type[entityKind]) {
20410
+ return true;
20411
+ }
20412
+ cls = Object.getPrototypeOf(cls);
20413
+ }
20414
+ }
20415
+ return false;
20416
+ }
20417
+ var entityKind, hasOwnEntityKind;
20418
+ var init_entity = __esm({
20419
+ "../drizzle-orm/dist/entity.js"() {
20420
+ "use strict";
20421
+ entityKind = Symbol.for("drizzle:entityKind");
20422
+ hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
20423
+ }
20424
+ });
20425
+
20357
20426
  // ../drizzle-orm/dist/column.js
20358
- var _a3, Column2;
20427
+ var _a, Column2;
20359
20428
  var init_column = __esm({
20360
20429
  "../drizzle-orm/dist/column.js"() {
20361
20430
  "use strict";
20362
20431
  init_entity();
20363
- _a3 = entityKind;
20432
+ _a = entityKind;
20364
20433
  Column2 = class {
20365
20434
  constructor(table4, config) {
20366
20435
  __publicField(this, "name");
@@ -20409,17 +20478,17 @@ var init_column = __esm({
20409
20478
  return this.config.generated !== void 0 && this.config.generated.type !== "byDefault";
20410
20479
  }
20411
20480
  };
20412
- __publicField(Column2, _a3, "Column");
20481
+ __publicField(Column2, _a, "Column");
20413
20482
  }
20414
20483
  });
20415
20484
 
20416
20485
  // ../drizzle-orm/dist/column-builder.js
20417
- var _a4, ColumnBuilder;
20486
+ var _a2, ColumnBuilder;
20418
20487
  var init_column_builder = __esm({
20419
20488
  "../drizzle-orm/dist/column-builder.js"() {
20420
20489
  "use strict";
20421
20490
  init_entity();
20422
- _a4 = entityKind;
20491
+ _a2 = entityKind;
20423
20492
  ColumnBuilder = class {
20424
20493
  constructor(name2, dataType, columnType) {
20425
20494
  __publicField(this, "config");
@@ -20521,18 +20590,27 @@ var init_column_builder = __esm({
20521
20590
  this.config.name = name2;
20522
20591
  }
20523
20592
  };
20524
- __publicField(ColumnBuilder, _a4, "ColumnBuilder");
20593
+ __publicField(ColumnBuilder, _a2, "ColumnBuilder");
20594
+ }
20595
+ });
20596
+
20597
+ // ../drizzle-orm/dist/table.utils.js
20598
+ var TableName;
20599
+ var init_table_utils = __esm({
20600
+ "../drizzle-orm/dist/table.utils.js"() {
20601
+ "use strict";
20602
+ TableName = Symbol.for("drizzle:Name");
20525
20603
  }
20526
20604
  });
20527
20605
 
20528
20606
  // ../drizzle-orm/dist/pg-core/foreign-keys.js
20529
- var _a5, ForeignKeyBuilder, _a6, ForeignKey;
20607
+ var _a3, ForeignKeyBuilder, _a4, ForeignKey;
20530
20608
  var init_foreign_keys = __esm({
20531
20609
  "../drizzle-orm/dist/pg-core/foreign-keys.js"() {
20532
20610
  "use strict";
20533
20611
  init_entity();
20534
20612
  init_table_utils();
20535
- _a5 = entityKind;
20613
+ _a3 = entityKind;
20536
20614
  ForeignKeyBuilder = class {
20537
20615
  constructor(config, actions) {
20538
20616
  /** @internal */
@@ -20563,8 +20641,8 @@ var init_foreign_keys = __esm({
20563
20641
  return new ForeignKey(table4, this);
20564
20642
  }
20565
20643
  };
20566
- __publicField(ForeignKeyBuilder, _a5, "PgForeignKeyBuilder");
20567
- _a6 = entityKind;
20644
+ __publicField(ForeignKeyBuilder, _a3, "PgForeignKeyBuilder");
20645
+ _a4 = entityKind;
20568
20646
  ForeignKey = class {
20569
20647
  constructor(table4, builder) {
20570
20648
  __publicField(this, "reference");
@@ -20588,7 +20666,7 @@ var init_foreign_keys = __esm({
20588
20666
  return name2 ?? `${chunks.join("_")}_fk`;
20589
20667
  }
20590
20668
  };
20591
- __publicField(ForeignKey, _a6, "PgForeignKey");
20669
+ __publicField(ForeignKey, _a4, "PgForeignKey");
20592
20670
  }
20593
20671
  });
20594
20672
 
@@ -20606,13 +20684,13 @@ var init_tracing_utils = __esm({
20606
20684
  function uniqueKeyName(table4, columns) {
20607
20685
  return `${table4[TableName]}_${columns.join("_")}_unique`;
20608
20686
  }
20609
- var _a7, UniqueConstraintBuilder, _a8, UniqueOnConstraintBuilder, _a9, UniqueConstraint;
20687
+ var _a5, UniqueConstraintBuilder, _a6, UniqueOnConstraintBuilder, _a7, UniqueConstraint;
20610
20688
  var init_unique_constraint = __esm({
20611
20689
  "../drizzle-orm/dist/pg-core/unique-constraint.js"() {
20612
20690
  "use strict";
20613
20691
  init_entity();
20614
20692
  init_table_utils();
20615
- _a7 = entityKind;
20693
+ _a5 = entityKind;
20616
20694
  UniqueConstraintBuilder = class {
20617
20695
  constructor(columns, name2) {
20618
20696
  /** @internal */
@@ -20631,8 +20709,8 @@ var init_unique_constraint = __esm({
20631
20709
  return new UniqueConstraint(table4, this.columns, this.nullsNotDistinctConfig, this.name);
20632
20710
  }
20633
20711
  };
20634
- __publicField(UniqueConstraintBuilder, _a7, "PgUniqueConstraintBuilder");
20635
- _a8 = entityKind;
20712
+ __publicField(UniqueConstraintBuilder, _a5, "PgUniqueConstraintBuilder");
20713
+ _a6 = entityKind;
20636
20714
  UniqueOnConstraintBuilder = class {
20637
20715
  constructor(name2) {
20638
20716
  /** @internal */
@@ -20643,8 +20721,8 @@ var init_unique_constraint = __esm({
20643
20721
  return new UniqueConstraintBuilder(columns, this.name);
20644
20722
  }
20645
20723
  };
20646
- __publicField(UniqueOnConstraintBuilder, _a8, "PgUniqueOnConstraintBuilder");
20647
- _a9 = entityKind;
20724
+ __publicField(UniqueOnConstraintBuilder, _a6, "PgUniqueOnConstraintBuilder");
20725
+ _a7 = entityKind;
20648
20726
  UniqueConstraint = class {
20649
20727
  constructor(table4, columns, nullsNotDistinct, name2) {
20650
20728
  __publicField(this, "columns");
@@ -20659,7 +20737,7 @@ var init_unique_constraint = __esm({
20659
20737
  return this.name;
20660
20738
  }
20661
20739
  };
20662
- __publicField(UniqueConstraint, _a9, "PgUniqueConstraint");
20740
+ __publicField(UniqueConstraint, _a7, "PgUniqueConstraint");
20663
20741
  }
20664
20742
  });
20665
20743
 
@@ -20745,7 +20823,7 @@ var init_array = __esm({
20745
20823
  });
20746
20824
 
20747
20825
  // ../drizzle-orm/dist/pg-core/columns/common.js
20748
- var _a10, _b2, PgColumnBuilder, _a11, _b3, PgColumn, _a12, _b4, ExtraConfigColumn, _a13, IndexedColumn, _a14, _b5, PgArrayBuilder, _a15, _b6, _PgArray, PgArray;
20826
+ var _a8, _b, PgColumnBuilder, _a9, _b2, PgColumn, _a10, _b3, ExtraConfigColumn, _a11, IndexedColumn, _a12, _b4, PgArrayBuilder, _a13, _b5, _PgArray, PgArray;
20749
20827
  var init_common2 = __esm({
20750
20828
  "../drizzle-orm/dist/pg-core/columns/common.js"() {
20751
20829
  "use strict";
@@ -20756,7 +20834,7 @@ var init_common2 = __esm({
20756
20834
  init_tracing_utils();
20757
20835
  init_unique_constraint();
20758
20836
  init_array();
20759
- PgColumnBuilder = class extends (_b2 = ColumnBuilder, _a10 = entityKind, _b2) {
20837
+ PgColumnBuilder = class extends (_b = ColumnBuilder, _a8 = entityKind, _b) {
20760
20838
  constructor() {
20761
20839
  super(...arguments);
20762
20840
  __publicField(this, "foreignKeyConfigs", []);
@@ -20809,8 +20887,8 @@ var init_common2 = __esm({
20809
20887
  return new ExtraConfigColumn(table4, this.config);
20810
20888
  }
20811
20889
  };
20812
- __publicField(PgColumnBuilder, _a10, "PgColumnBuilder");
20813
- PgColumn = class extends (_b3 = Column2, _a11 = entityKind, _b3) {
20890
+ __publicField(PgColumnBuilder, _a8, "PgColumnBuilder");
20891
+ PgColumn = class extends (_b2 = Column2, _a9 = entityKind, _b2) {
20814
20892
  constructor(table4, config) {
20815
20893
  if (!config.uniqueName) {
20816
20894
  config.uniqueName = uniqueKeyName(table4, [config.name]);
@@ -20819,8 +20897,8 @@ var init_common2 = __esm({
20819
20897
  this.table = table4;
20820
20898
  }
20821
20899
  };
20822
- __publicField(PgColumn, _a11, "PgColumn");
20823
- ExtraConfigColumn = class extends (_b4 = PgColumn, _a12 = entityKind, _b4) {
20900
+ __publicField(PgColumn, _a9, "PgColumn");
20901
+ ExtraConfigColumn = class extends (_b3 = PgColumn, _a10 = entityKind, _b3) {
20824
20902
  constructor() {
20825
20903
  super(...arguments);
20826
20904
  __publicField(this, "indexConfig", {
@@ -20887,8 +20965,8 @@ var init_common2 = __esm({
20887
20965
  return this;
20888
20966
  }
20889
20967
  };
20890
- __publicField(ExtraConfigColumn, _a12, "ExtraConfigColumn");
20891
- _a13 = entityKind;
20968
+ __publicField(ExtraConfigColumn, _a10, "ExtraConfigColumn");
20969
+ _a11 = entityKind;
20892
20970
  IndexedColumn = class {
20893
20971
  constructor(name2, keyAsName, type, indexConfig) {
20894
20972
  __publicField(this, "name");
@@ -20901,8 +20979,8 @@ var init_common2 = __esm({
20901
20979
  this.indexConfig = indexConfig;
20902
20980
  }
20903
20981
  };
20904
- __publicField(IndexedColumn, _a13, "IndexedColumn");
20905
- PgArrayBuilder = class extends (_b5 = PgColumnBuilder, _a14 = entityKind, _b5) {
20982
+ __publicField(IndexedColumn, _a11, "IndexedColumn");
20983
+ PgArrayBuilder = class extends (_b4 = PgColumnBuilder, _a12 = entityKind, _b4) {
20906
20984
  constructor(name2, baseBuilder, size) {
20907
20985
  super(name2, "array", "PgArray");
20908
20986
  this.config.baseBuilder = baseBuilder;
@@ -20918,8 +20996,8 @@ var init_common2 = __esm({
20918
20996
  );
20919
20997
  }
20920
20998
  };
20921
- __publicField(PgArrayBuilder, _a14, "PgArrayBuilder");
20922
- _PgArray = class _PgArray extends (_b6 = PgColumn, _a15 = entityKind, _b6) {
20999
+ __publicField(PgArrayBuilder, _a12, "PgArrayBuilder");
21000
+ _PgArray = class _PgArray extends (_b5 = PgColumn, _a13 = entityKind, _b5) {
20923
21001
  constructor(table4, config, baseColumn, range) {
20924
21002
  super(table4, config);
20925
21003
  __publicField(this, "size");
@@ -20945,7 +21023,7 @@ var init_common2 = __esm({
20945
21023
  return makePgArray(a);
20946
21024
  }
20947
21025
  };
20948
- __publicField(_PgArray, _a15, "PgArray");
21026
+ __publicField(_PgArray, _a13, "PgArray");
20949
21027
  PgArray = _PgArray;
20950
21028
  }
20951
21029
  });
@@ -20966,14 +21044,14 @@ function pgEnumWithSchema(enumName, values, schema4) {
20966
21044
  );
20967
21045
  return enumInstance;
20968
21046
  }
20969
- var isPgEnumSym, _a16, _b7, PgEnumColumnBuilder, _a17, _b8, PgEnumColumn;
21047
+ var isPgEnumSym, _a14, _b6, PgEnumColumnBuilder, _a15, _b7, PgEnumColumn;
20970
21048
  var init_enum = __esm({
20971
21049
  "../drizzle-orm/dist/pg-core/columns/enum.js"() {
20972
21050
  "use strict";
20973
21051
  init_entity();
20974
21052
  init_common2();
20975
21053
  isPgEnumSym = Symbol.for("drizzle:isPgEnum");
20976
- PgEnumColumnBuilder = class extends (_b7 = PgColumnBuilder, _a16 = entityKind, _b7) {
21054
+ PgEnumColumnBuilder = class extends (_b6 = PgColumnBuilder, _a14 = entityKind, _b6) {
20977
21055
  constructor(name2, enumInstance) {
20978
21056
  super(name2, "string", "PgEnumColumn");
20979
21057
  this.config.enum = enumInstance;
@@ -20986,8 +21064,8 @@ var init_enum = __esm({
20986
21064
  );
20987
21065
  }
20988
21066
  };
20989
- __publicField(PgEnumColumnBuilder, _a16, "PgEnumColumnBuilder");
20990
- PgEnumColumn = class extends (_b8 = PgColumn, _a17 = entityKind, _b8) {
21067
+ __publicField(PgEnumColumnBuilder, _a14, "PgEnumColumnBuilder");
21068
+ PgEnumColumn = class extends (_b7 = PgColumn, _a15 = entityKind, _b7) {
20991
21069
  constructor(table4, config) {
20992
21070
  super(table4, config);
20993
21071
  __publicField(this, "enum", this.config.enum);
@@ -20998,17 +21076,17 @@ var init_enum = __esm({
20998
21076
  return this.enum.enumName;
20999
21077
  }
21000
21078
  };
21001
- __publicField(PgEnumColumn, _a17, "PgEnumColumn");
21079
+ __publicField(PgEnumColumn, _a15, "PgEnumColumn");
21002
21080
  }
21003
21081
  });
21004
21082
 
21005
21083
  // ../drizzle-orm/dist/subquery.js
21006
- var _a18, Subquery, _a19, _b9, WithSubquery;
21084
+ var _a16, Subquery, _a17, _b8, WithSubquery;
21007
21085
  var init_subquery = __esm({
21008
21086
  "../drizzle-orm/dist/subquery.js"() {
21009
21087
  "use strict";
21010
21088
  init_entity();
21011
- _a18 = entityKind;
21089
+ _a16 = entityKind;
21012
21090
  Subquery = class {
21013
21091
  constructor(sql2, selection, alias, isWith = false) {
21014
21092
  this._ = {
@@ -21023,10 +21101,10 @@ var init_subquery = __esm({
21023
21101
  // return new SQL([this]);
21024
21102
  // }
21025
21103
  };
21026
- __publicField(Subquery, _a18, "Subquery");
21027
- WithSubquery = class extends (_b9 = Subquery, _a19 = entityKind, _b9) {
21104
+ __publicField(Subquery, _a16, "Subquery");
21105
+ WithSubquery = class extends (_b8 = Subquery, _a17 = entityKind, _b8) {
21028
21106
  };
21029
- __publicField(WithSubquery, _a19, "WithSubquery");
21107
+ __publicField(WithSubquery, _a17, "WithSubquery");
21030
21108
  }
21031
21109
  });
21032
21110
 
@@ -21089,6 +21167,80 @@ var init_view_common = __esm({
21089
21167
  }
21090
21168
  });
21091
21169
 
21170
+ // ../drizzle-orm/dist/table.js
21171
+ function isTable(table4) {
21172
+ return typeof table4 === "object" && table4 !== null && IsDrizzleTable in table4;
21173
+ }
21174
+ function getTableName(table4) {
21175
+ return table4[TableName];
21176
+ }
21177
+ function getTableUniqueName(table4) {
21178
+ return `${table4[Schema] ?? "public"}.${table4[TableName]}`;
21179
+ }
21180
+ var Schema, Columns, ExtraConfigColumns, OriginalName, BaseName, IsAlias, ExtraConfigBuilder, IsDrizzleTable, _a18, _b9, _c, _d, _e, _f, _g, _h, _i, _j, Table2;
21181
+ var init_table = __esm({
21182
+ "../drizzle-orm/dist/table.js"() {
21183
+ "use strict";
21184
+ init_entity();
21185
+ init_table_utils();
21186
+ Schema = Symbol.for("drizzle:Schema");
21187
+ Columns = Symbol.for("drizzle:Columns");
21188
+ ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
21189
+ OriginalName = Symbol.for("drizzle:OriginalName");
21190
+ BaseName = Symbol.for("drizzle:BaseName");
21191
+ IsAlias = Symbol.for("drizzle:IsAlias");
21192
+ ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
21193
+ IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
21194
+ _j = entityKind, _i = TableName, _h = OriginalName, _g = Schema, _f = Columns, _e = ExtraConfigColumns, _d = BaseName, _c = IsAlias, _b9 = IsDrizzleTable, _a18 = ExtraConfigBuilder;
21195
+ Table2 = class {
21196
+ constructor(name2, schema4, baseName) {
21197
+ /**
21198
+ * @internal
21199
+ * Can be changed if the table is aliased.
21200
+ */
21201
+ __publicField(this, _i);
21202
+ /**
21203
+ * @internal
21204
+ * Used to store the original name of the table, before any aliasing.
21205
+ */
21206
+ __publicField(this, _h);
21207
+ /** @internal */
21208
+ __publicField(this, _g);
21209
+ /** @internal */
21210
+ __publicField(this, _f);
21211
+ /** @internal */
21212
+ __publicField(this, _e);
21213
+ /**
21214
+ * @internal
21215
+ * Used to store the table name before the transformation via the `tableCreator` functions.
21216
+ */
21217
+ __publicField(this, _d);
21218
+ /** @internal */
21219
+ __publicField(this, _c, false);
21220
+ /** @internal */
21221
+ __publicField(this, _b9, true);
21222
+ /** @internal */
21223
+ __publicField(this, _a18);
21224
+ this[TableName] = this[OriginalName] = name2;
21225
+ this[Schema] = schema4;
21226
+ this[BaseName] = baseName;
21227
+ }
21228
+ };
21229
+ __publicField(Table2, _j, "Table");
21230
+ /** @internal */
21231
+ __publicField(Table2, "Symbol", {
21232
+ Name: TableName,
21233
+ Schema,
21234
+ OriginalName,
21235
+ Columns,
21236
+ ExtraConfigColumns,
21237
+ BaseName,
21238
+ IsAlias,
21239
+ ExtraConfigBuilder
21240
+ });
21241
+ }
21242
+ });
21243
+
21092
21244
  // ../drizzle-orm/dist/sql/sql.js
21093
21245
  function isSQLWrapper(value) {
21094
21246
  return value !== null && value !== void 0 && typeof value.getSQL === "function";
@@ -21146,7 +21298,7 @@ function fillPlaceholders(params, values) {
21146
21298
  return p;
21147
21299
  });
21148
21300
  }
21149
- var _a20, FakePrimitiveParam, _a21, StringChunk, _a22, _SQL, SQL, _a23, Name, noopDecoder, noopEncoder, noopMapper, _a24, Param, _a25, Placeholder, _a26, _b10, View3;
21301
+ var _a19, FakePrimitiveParam, _a20, StringChunk, _a21, _SQL, SQL, _a22, Name, noopDecoder, noopEncoder, noopMapper, _a23, Param, _a24, Placeholder, _a25, _b10, View3;
21150
21302
  var init_sql = __esm({
21151
21303
  "../drizzle-orm/dist/sql/sql.js"() {
21152
21304
  "use strict";
@@ -21157,11 +21309,11 @@ var init_sql = __esm({
21157
21309
  init_view_common();
21158
21310
  init_column();
21159
21311
  init_table();
21160
- _a20 = entityKind;
21312
+ _a19 = entityKind;
21161
21313
  FakePrimitiveParam = class {
21162
21314
  };
21163
- __publicField(FakePrimitiveParam, _a20, "FakePrimitiveParam");
21164
- _a21 = entityKind;
21315
+ __publicField(FakePrimitiveParam, _a19, "FakePrimitiveParam");
21316
+ _a20 = entityKind;
21165
21317
  StringChunk = class {
21166
21318
  constructor(value) {
21167
21319
  __publicField(this, "value");
@@ -21171,8 +21323,8 @@ var init_sql = __esm({
21171
21323
  return new SQL([this]);
21172
21324
  }
21173
21325
  };
21174
- __publicField(StringChunk, _a21, "StringChunk");
21175
- _a22 = entityKind;
21326
+ __publicField(StringChunk, _a20, "StringChunk");
21327
+ _a21 = entityKind;
21176
21328
  _SQL = class _SQL {
21177
21329
  constructor(queryChunks) {
21178
21330
  /** @internal */
@@ -21234,9 +21386,9 @@ var init_sql = __esm({
21234
21386
  inlineParams: inlineParams || chunk.shouldInlineParams
21235
21387
  });
21236
21388
  }
21237
- if (is(chunk, Table)) {
21238
- const schemaName = chunk[Table.Symbol.Schema];
21239
- const tableName = chunk[Table.Symbol.Name];
21389
+ if (is(chunk, Table2)) {
21390
+ const schemaName = chunk[Table2.Symbol.Schema];
21391
+ const tableName = chunk[Table2.Symbol.Name];
21240
21392
  return {
21241
21393
  sql: schemaName === void 0 ? escapeName(tableName) : escapeName(schemaName) + "." + escapeName(tableName),
21242
21394
  params: []
@@ -21247,7 +21399,7 @@ var init_sql = __esm({
21247
21399
  if (_config.invokeSource === "indexes") {
21248
21400
  return { sql: escapeName(columnName), params: [] };
21249
21401
  }
21250
- return { sql: escapeName(chunk.table[Table.Symbol.Name]) + "." + escapeName(columnName), params: [] };
21402
+ return { sql: escapeName(chunk.table[Table2.Symbol.Name]) + "." + escapeName(columnName), params: [] };
21251
21403
  }
21252
21404
  if (is(chunk, View3)) {
21253
21405
  const schemaName = chunk[ViewBaseConfig].schema;
@@ -21359,9 +21511,9 @@ var init_sql = __esm({
21359
21511
  return condition ? this : void 0;
21360
21512
  }
21361
21513
  };
21362
- __publicField(_SQL, _a22, "SQL");
21514
+ __publicField(_SQL, _a21, "SQL");
21363
21515
  SQL = _SQL;
21364
- _a23 = entityKind;
21516
+ _a22 = entityKind;
21365
21517
  Name = class {
21366
21518
  constructor(value) {
21367
21519
  __publicField(this, "brand");
@@ -21371,7 +21523,7 @@ var init_sql = __esm({
21371
21523
  return new SQL([this]);
21372
21524
  }
21373
21525
  };
21374
- __publicField(Name, _a23, "Name");
21526
+ __publicField(Name, _a22, "Name");
21375
21527
  noopDecoder = {
21376
21528
  mapFromDriverValue: (value) => value
21377
21529
  };
@@ -21382,7 +21534,7 @@ var init_sql = __esm({
21382
21534
  ...noopDecoder,
21383
21535
  ...noopEncoder
21384
21536
  };
21385
- _a24 = entityKind;
21537
+ _a23 = entityKind;
21386
21538
  Param = class {
21387
21539
  /**
21388
21540
  * @param value - Parameter value
@@ -21397,7 +21549,7 @@ var init_sql = __esm({
21397
21549
  return new SQL([this]);
21398
21550
  }
21399
21551
  };
21400
- __publicField(Param, _a24, "Param");
21552
+ __publicField(Param, _a23, "Param");
21401
21553
  ((sql2) => {
21402
21554
  function empty() {
21403
21555
  return new SQL([]);
@@ -21457,7 +21609,7 @@ var init_sql = __esm({
21457
21609
  let Aliased = _Aliased;
21458
21610
  SQL2.Aliased = Aliased;
21459
21611
  })(SQL || (SQL = {}));
21460
- _a25 = entityKind;
21612
+ _a24 = entityKind;
21461
21613
  Placeholder = class {
21462
21614
  constructor(name2) {
21463
21615
  this.name = name2;
@@ -21466,12 +21618,12 @@ var init_sql = __esm({
21466
21618
  return new SQL([this]);
21467
21619
  }
21468
21620
  };
21469
- __publicField(Placeholder, _a25, "Placeholder");
21470
- _b10 = entityKind, _a26 = ViewBaseConfig;
21621
+ __publicField(Placeholder, _a24, "Placeholder");
21622
+ _b10 = entityKind, _a25 = ViewBaseConfig;
21471
21623
  View3 = class {
21472
21624
  constructor({ name: name2, schema: schema4, selectedFields, query }) {
21473
21625
  /** @internal */
21474
- __publicField(this, _a26);
21626
+ __publicField(this, _a25);
21475
21627
  this[ViewBaseConfig] = {
21476
21628
  name: name2,
21477
21629
  originalName: name2,
@@ -21490,7 +21642,7 @@ var init_sql = __esm({
21490
21642
  Column2.prototype.getSQL = function() {
21491
21643
  return new SQL([this]);
21492
21644
  };
21493
- Table.prototype.getSQL = function() {
21645
+ Table2.prototype.getSQL = function() {
21494
21646
  return new SQL([this]);
21495
21647
  };
21496
21648
  Subquery.prototype.getSQL = function() {
@@ -21529,7 +21681,7 @@ function mapColumnsInSQLToAlias(query, alias) {
21529
21681
  return c;
21530
21682
  }));
21531
21683
  }
21532
- var _a27, ColumnAliasProxyHandler, _a28, TableAliasProxyHandler, _a29, RelationTableAliasProxyHandler;
21684
+ var _a26, ColumnAliasProxyHandler, _a27, TableAliasProxyHandler, _a28, RelationTableAliasProxyHandler;
21533
21685
  var init_alias = __esm({
21534
21686
  "../drizzle-orm/dist/alias.js"() {
21535
21687
  "use strict";
@@ -21538,7 +21690,7 @@ var init_alias = __esm({
21538
21690
  init_sql();
21539
21691
  init_table();
21540
21692
  init_view_common();
21541
- _a27 = entityKind;
21693
+ _a26 = entityKind;
21542
21694
  ColumnAliasProxyHandler = class {
21543
21695
  constructor(table4) {
21544
21696
  this.table = table4;
@@ -21550,21 +21702,21 @@ var init_alias = __esm({
21550
21702
  return columnObj[prop];
21551
21703
  }
21552
21704
  };
21553
- __publicField(ColumnAliasProxyHandler, _a27, "ColumnAliasProxyHandler");
21554
- _a28 = entityKind;
21705
+ __publicField(ColumnAliasProxyHandler, _a26, "ColumnAliasProxyHandler");
21706
+ _a27 = entityKind;
21555
21707
  TableAliasProxyHandler = class {
21556
21708
  constructor(alias, replaceOriginalName) {
21557
21709
  this.alias = alias;
21558
21710
  this.replaceOriginalName = replaceOriginalName;
21559
21711
  }
21560
21712
  get(target, prop) {
21561
- if (prop === Table.Symbol.IsAlias) {
21713
+ if (prop === Table2.Symbol.IsAlias) {
21562
21714
  return true;
21563
21715
  }
21564
- if (prop === Table.Symbol.Name) {
21716
+ if (prop === Table2.Symbol.Name) {
21565
21717
  return this.alias;
21566
21718
  }
21567
- if (this.replaceOriginalName && prop === Table.Symbol.OriginalName) {
21719
+ if (this.replaceOriginalName && prop === Table2.Symbol.OriginalName) {
21568
21720
  return this.alias;
21569
21721
  }
21570
21722
  if (prop === ViewBaseConfig) {
@@ -21574,8 +21726,8 @@ var init_alias = __esm({
21574
21726
  isAlias: true
21575
21727
  };
21576
21728
  }
21577
- if (prop === Table.Symbol.Columns) {
21578
- const columns = target[Table.Symbol.Columns];
21729
+ if (prop === Table2.Symbol.Columns) {
21730
+ const columns = target[Table2.Symbol.Columns];
21579
21731
  if (!columns) {
21580
21732
  return columns;
21581
21733
  }
@@ -21595,8 +21747,8 @@ var init_alias = __esm({
21595
21747
  return value;
21596
21748
  }
21597
21749
  };
21598
- __publicField(TableAliasProxyHandler, _a28, "TableAliasProxyHandler");
21599
- _a29 = entityKind;
21750
+ __publicField(TableAliasProxyHandler, _a27, "TableAliasProxyHandler");
21751
+ _a28 = entityKind;
21600
21752
  RelationTableAliasProxyHandler = class {
21601
21753
  constructor(alias) {
21602
21754
  this.alias = alias;
@@ -21608,36 +21760,36 @@ var init_alias = __esm({
21608
21760
  return target[prop];
21609
21761
  }
21610
21762
  };
21611
- __publicField(RelationTableAliasProxyHandler, _a29, "RelationTableAliasProxyHandler");
21763
+ __publicField(RelationTableAliasProxyHandler, _a28, "RelationTableAliasProxyHandler");
21612
21764
  }
21613
21765
  });
21614
21766
 
21615
21767
  // ../drizzle-orm/dist/errors.js
21616
- var _a30, _b11, DrizzleError, _a31, _b12, TransactionRollbackError;
21768
+ var _a29, _b11, DrizzleError, _a30, _b12, TransactionRollbackError;
21617
21769
  var init_errors = __esm({
21618
21770
  "../drizzle-orm/dist/errors.js"() {
21619
21771
  "use strict";
21620
21772
  init_entity();
21621
- DrizzleError = class extends (_b11 = Error, _a30 = entityKind, _b11) {
21773
+ DrizzleError = class extends (_b11 = Error, _a29 = entityKind, _b11) {
21622
21774
  constructor({ message, cause }) {
21623
21775
  super(message);
21624
21776
  this.name = "DrizzleError";
21625
21777
  this.cause = cause;
21626
21778
  }
21627
21779
  };
21628
- __publicField(DrizzleError, _a30, "DrizzleError");
21629
- TransactionRollbackError = class extends (_b12 = DrizzleError, _a31 = entityKind, _b12) {
21780
+ __publicField(DrizzleError, _a29, "DrizzleError");
21781
+ TransactionRollbackError = class extends (_b12 = DrizzleError, _a30 = entityKind, _b12) {
21630
21782
  constructor() {
21631
21783
  super({ message: "Rollback" });
21632
21784
  }
21633
21785
  };
21634
- __publicField(TransactionRollbackError, _a31, "TransactionRollbackError");
21786
+ __publicField(TransactionRollbackError, _a30, "TransactionRollbackError");
21635
21787
  }
21636
21788
  });
21637
21789
 
21638
21790
  // ../drizzle-orm/dist/sql/expressions/conditions.js
21639
21791
  function bindIfParam(value, column4) {
21640
- if (isDriverValueEncoder(column4) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value, Column2) && !is(value, Table) && !is(value, View3)) {
21792
+ if (isDriverValueEncoder(column4) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value, Column2) && !is(value, Table2) && !is(value, View3)) {
21641
21793
  return new Param(value, column4);
21642
21794
  }
21643
21795
  return value;
@@ -21822,19 +21974,19 @@ var init_expressions2 = __esm({
21822
21974
  });
21823
21975
 
21824
21976
  // ../drizzle-orm/dist/logger.js
21825
- var _a32, ConsoleLogWriter, _a33, DefaultLogger, _a34, NoopLogger;
21977
+ var _a31, ConsoleLogWriter, _a32, DefaultLogger, _a33, NoopLogger;
21826
21978
  var init_logger = __esm({
21827
21979
  "../drizzle-orm/dist/logger.js"() {
21828
21980
  "use strict";
21829
21981
  init_entity();
21830
- _a32 = entityKind;
21982
+ _a31 = entityKind;
21831
21983
  ConsoleLogWriter = class {
21832
21984
  write(message) {
21833
21985
  console.log(message);
21834
21986
  }
21835
21987
  };
21836
- __publicField(ConsoleLogWriter, _a32, "ConsoleLogWriter");
21837
- _a33 = entityKind;
21988
+ __publicField(ConsoleLogWriter, _a31, "ConsoleLogWriter");
21989
+ _a32 = entityKind;
21838
21990
  DefaultLogger = class {
21839
21991
  constructor(config) {
21840
21992
  __publicField(this, "writer");
@@ -21852,13 +22004,13 @@ var init_logger = __esm({
21852
22004
  this.writer.write(`Query: ${query}${paramsStr}`);
21853
22005
  }
21854
22006
  };
21855
- __publicField(DefaultLogger, _a33, "DefaultLogger");
21856
- _a34 = entityKind;
22007
+ __publicField(DefaultLogger, _a32, "DefaultLogger");
22008
+ _a33 = entityKind;
21857
22009
  NoopLogger = class {
21858
22010
  logQuery() {
21859
22011
  }
21860
22012
  };
21861
- __publicField(NoopLogger, _a34, "NoopLogger");
22013
+ __publicField(NoopLogger, _a33, "NoopLogger");
21862
22014
  }
21863
22015
  });
21864
22016
 
@@ -21870,15 +22022,15 @@ var init_operations = __esm({
21870
22022
  });
21871
22023
 
21872
22024
  // ../drizzle-orm/dist/query-promise.js
21873
- var _a35, _b13, QueryPromise;
22025
+ var _a34, _b13, QueryPromise;
21874
22026
  var init_query_promise = __esm({
21875
22027
  "../drizzle-orm/dist/query-promise.js"() {
21876
22028
  "use strict";
21877
22029
  init_entity();
21878
- _b13 = entityKind, _a35 = Symbol.toStringTag;
22030
+ _b13 = entityKind, _a34 = Symbol.toStringTag;
21879
22031
  QueryPromise = class {
21880
22032
  constructor() {
21881
- __publicField(this, _a35, "QueryPromise");
22033
+ __publicField(this, _a34, "QueryPromise");
21882
22034
  }
21883
22035
  catch(onRejected) {
21884
22036
  return this.then(void 0, onRejected);
@@ -21957,8 +22109,8 @@ function orderSelectedFields(fields, pathPrefix) {
21957
22109
  const newPath = pathPrefix ? [...pathPrefix, name2] : [name2];
21958
22110
  if (is(field, Column2) || is(field, SQL) || is(field, SQL.Aliased)) {
21959
22111
  result.push({ path: newPath, field });
21960
- } else if (is(field, Table)) {
21961
- result.push(...orderSelectedFields(field[Table.Symbol.Columns], newPath));
22112
+ } else if (is(field, Table2)) {
22113
+ result.push(...orderSelectedFields(field[Table2.Symbol.Columns], newPath));
21962
22114
  } else {
21963
22115
  result.push(...orderSelectedFields(field, newPath));
21964
22116
  }
@@ -21983,7 +22135,7 @@ function mapUpdateSet(table4, values) {
21983
22135
  if (is(value, SQL)) {
21984
22136
  return [key, value];
21985
22137
  } else {
21986
- return [key, new Param(value, table4[Table.Symbol.Columns][key])];
22138
+ return [key, new Param(value, table4[Table2.Symbol.Columns][key])];
21987
22139
  }
21988
22140
  });
21989
22141
  if (entries.length === 0) {
@@ -22005,10 +22157,10 @@ function applyMixins(baseClass, extendedClasses) {
22005
22157
  }
22006
22158
  }
22007
22159
  function getTableColumns(table4) {
22008
- return table4[Table.Symbol.Columns];
22160
+ return table4[Table2.Symbol.Columns];
22009
22161
  }
22010
22162
  function getTableLikeName(table4) {
22011
- 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];
22163
+ 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];
22012
22164
  }
22013
22165
  function getColumnNameAndConfig(a, b) {
22014
22166
  return {
@@ -22052,7 +22204,7 @@ function isConfig(data) {
22052
22204
  }
22053
22205
  if ("client" in data) {
22054
22206
  const type = typeof data["client"];
22055
- if (type !== "object" && type !== "undefined")
22207
+ if (type !== "object" && type !== "function" && type !== "undefined")
22056
22208
  return false;
22057
22209
  return true;
22058
22210
  }
@@ -22073,13 +22225,13 @@ var init_utils2 = __esm({
22073
22225
  });
22074
22226
 
22075
22227
  // ../drizzle-orm/dist/pg-core/columns/int.common.js
22076
- var _a36, _b14, PgIntColumnBaseBuilder;
22228
+ var _a35, _b14, PgIntColumnBaseBuilder;
22077
22229
  var init_int_common = __esm({
22078
22230
  "../drizzle-orm/dist/pg-core/columns/int.common.js"() {
22079
22231
  "use strict";
22080
22232
  init_entity();
22081
22233
  init_common2();
22082
- PgIntColumnBaseBuilder = class extends (_b14 = PgColumnBuilder, _a36 = entityKind, _b14) {
22234
+ PgIntColumnBaseBuilder = class extends (_b14 = PgColumnBuilder, _a35 = entityKind, _b14) {
22083
22235
  generatedAlwaysAsIdentity(sequence) {
22084
22236
  if (sequence) {
22085
22237
  const { name: name2, ...options } = sequence;
@@ -22115,7 +22267,7 @@ var init_int_common = __esm({
22115
22267
  return this;
22116
22268
  }
22117
22269
  };
22118
- __publicField(PgIntColumnBaseBuilder, _a36, "PgIntColumnBaseBuilder");
22270
+ __publicField(PgIntColumnBaseBuilder, _a35, "PgIntColumnBaseBuilder");
22119
22271
  }
22120
22272
  });
22121
22273
 
@@ -22127,7 +22279,7 @@ function bigint(a, b) {
22127
22279
  }
22128
22280
  return new PgBigInt64Builder(name2);
22129
22281
  }
22130
- var _a37, _b15, PgBigInt53Builder, _a38, _b16, PgBigInt53, _a39, _b17, PgBigInt64Builder, _a40, _b18, PgBigInt64;
22282
+ var _a36, _b15, PgBigInt53Builder, _a37, _b16, PgBigInt53, _a38, _b17, PgBigInt64Builder, _a39, _b18, PgBigInt64;
22131
22283
  var init_bigint = __esm({
22132
22284
  "../drizzle-orm/dist/pg-core/columns/bigint.js"() {
22133
22285
  "use strict";
@@ -22135,7 +22287,7 @@ var init_bigint = __esm({
22135
22287
  init_utils2();
22136
22288
  init_common2();
22137
22289
  init_int_common();
22138
- PgBigInt53Builder = class extends (_b15 = PgIntColumnBaseBuilder, _a37 = entityKind, _b15) {
22290
+ PgBigInt53Builder = class extends (_b15 = PgIntColumnBaseBuilder, _a36 = entityKind, _b15) {
22139
22291
  constructor(name2) {
22140
22292
  super(name2, "number", "PgBigInt53");
22141
22293
  }
@@ -22144,8 +22296,8 @@ var init_bigint = __esm({
22144
22296
  return new PgBigInt53(table4, this.config);
22145
22297
  }
22146
22298
  };
22147
- __publicField(PgBigInt53Builder, _a37, "PgBigInt53Builder");
22148
- PgBigInt53 = class extends (_b16 = PgColumn, _a38 = entityKind, _b16) {
22299
+ __publicField(PgBigInt53Builder, _a36, "PgBigInt53Builder");
22300
+ PgBigInt53 = class extends (_b16 = PgColumn, _a37 = entityKind, _b16) {
22149
22301
  getSQLType() {
22150
22302
  return "bigint";
22151
22303
  }
@@ -22156,8 +22308,8 @@ var init_bigint = __esm({
22156
22308
  return Number(value);
22157
22309
  }
22158
22310
  };
22159
- __publicField(PgBigInt53, _a38, "PgBigInt53");
22160
- PgBigInt64Builder = class extends (_b17 = PgIntColumnBaseBuilder, _a39 = entityKind, _b17) {
22311
+ __publicField(PgBigInt53, _a37, "PgBigInt53");
22312
+ PgBigInt64Builder = class extends (_b17 = PgIntColumnBaseBuilder, _a38 = entityKind, _b17) {
22161
22313
  constructor(name2) {
22162
22314
  super(name2, "bigint", "PgBigInt64");
22163
22315
  }
@@ -22169,8 +22321,8 @@ var init_bigint = __esm({
22169
22321
  );
22170
22322
  }
22171
22323
  };
22172
- __publicField(PgBigInt64Builder, _a39, "PgBigInt64Builder");
22173
- PgBigInt64 = class extends (_b18 = PgColumn, _a40 = entityKind, _b18) {
22324
+ __publicField(PgBigInt64Builder, _a38, "PgBigInt64Builder");
22325
+ PgBigInt64 = class extends (_b18 = PgColumn, _a39 = entityKind, _b18) {
22174
22326
  getSQLType() {
22175
22327
  return "bigint";
22176
22328
  }
@@ -22179,7 +22331,7 @@ var init_bigint = __esm({
22179
22331
  return BigInt(value);
22180
22332
  }
22181
22333
  };
22182
- __publicField(PgBigInt64, _a40, "PgBigInt64");
22334
+ __publicField(PgBigInt64, _a39, "PgBigInt64");
22183
22335
  }
22184
22336
  });
22185
22337
 
@@ -22191,14 +22343,14 @@ function bigserial(a, b) {
22191
22343
  }
22192
22344
  return new PgBigSerial64Builder(name2);
22193
22345
  }
22194
- var _a41, _b19, PgBigSerial53Builder, _a42, _b20, PgBigSerial53, _a43, _b21, PgBigSerial64Builder, _a44, _b22, PgBigSerial64;
22346
+ var _a40, _b19, PgBigSerial53Builder, _a41, _b20, PgBigSerial53, _a42, _b21, PgBigSerial64Builder, _a43, _b22, PgBigSerial64;
22195
22347
  var init_bigserial = __esm({
22196
22348
  "../drizzle-orm/dist/pg-core/columns/bigserial.js"() {
22197
22349
  "use strict";
22198
22350
  init_entity();
22199
22351
  init_utils2();
22200
22352
  init_common2();
22201
- PgBigSerial53Builder = class extends (_b19 = PgColumnBuilder, _a41 = entityKind, _b19) {
22353
+ PgBigSerial53Builder = class extends (_b19 = PgColumnBuilder, _a40 = entityKind, _b19) {
22202
22354
  constructor(name2) {
22203
22355
  super(name2, "number", "PgBigSerial53");
22204
22356
  this.config.hasDefault = true;
@@ -22212,8 +22364,8 @@ var init_bigserial = __esm({
22212
22364
  );
22213
22365
  }
22214
22366
  };
22215
- __publicField(PgBigSerial53Builder, _a41, "PgBigSerial53Builder");
22216
- PgBigSerial53 = class extends (_b20 = PgColumn, _a42 = entityKind, _b20) {
22367
+ __publicField(PgBigSerial53Builder, _a40, "PgBigSerial53Builder");
22368
+ PgBigSerial53 = class extends (_b20 = PgColumn, _a41 = entityKind, _b20) {
22217
22369
  getSQLType() {
22218
22370
  return "bigserial";
22219
22371
  }
@@ -22224,8 +22376,8 @@ var init_bigserial = __esm({
22224
22376
  return Number(value);
22225
22377
  }
22226
22378
  };
22227
- __publicField(PgBigSerial53, _a42, "PgBigSerial53");
22228
- PgBigSerial64Builder = class extends (_b21 = PgColumnBuilder, _a43 = entityKind, _b21) {
22379
+ __publicField(PgBigSerial53, _a41, "PgBigSerial53");
22380
+ PgBigSerial64Builder = class extends (_b21 = PgColumnBuilder, _a42 = entityKind, _b21) {
22229
22381
  constructor(name2) {
22230
22382
  super(name2, "bigint", "PgBigSerial64");
22231
22383
  this.config.hasDefault = true;
@@ -22238,8 +22390,8 @@ var init_bigserial = __esm({
22238
22390
  );
22239
22391
  }
22240
22392
  };
22241
- __publicField(PgBigSerial64Builder, _a43, "PgBigSerial64Builder");
22242
- PgBigSerial64 = class extends (_b22 = PgColumn, _a44 = entityKind, _b22) {
22393
+ __publicField(PgBigSerial64Builder, _a42, "PgBigSerial64Builder");
22394
+ PgBigSerial64 = class extends (_b22 = PgColumn, _a43 = entityKind, _b22) {
22243
22395
  getSQLType() {
22244
22396
  return "bigserial";
22245
22397
  }
@@ -22248,7 +22400,7 @@ var init_bigserial = __esm({
22248
22400
  return BigInt(value);
22249
22401
  }
22250
22402
  };
22251
- __publicField(PgBigSerial64, _a44, "PgBigSerial64");
22403
+ __publicField(PgBigSerial64, _a43, "PgBigSerial64");
22252
22404
  }
22253
22405
  });
22254
22406
 
@@ -22256,13 +22408,13 @@ var init_bigserial = __esm({
22256
22408
  function boolean(name2) {
22257
22409
  return new PgBooleanBuilder(name2 ?? "");
22258
22410
  }
22259
- var _a45, _b23, PgBooleanBuilder, _a46, _b24, PgBoolean;
22411
+ var _a44, _b23, PgBooleanBuilder, _a45, _b24, PgBoolean;
22260
22412
  var init_boolean = __esm({
22261
22413
  "../drizzle-orm/dist/pg-core/columns/boolean.js"() {
22262
22414
  "use strict";
22263
22415
  init_entity();
22264
22416
  init_common2();
22265
- PgBooleanBuilder = class extends (_b23 = PgColumnBuilder, _a45 = entityKind, _b23) {
22417
+ PgBooleanBuilder = class extends (_b23 = PgColumnBuilder, _a44 = entityKind, _b23) {
22266
22418
  constructor(name2) {
22267
22419
  super(name2, "boolean", "PgBoolean");
22268
22420
  }
@@ -22271,13 +22423,13 @@ var init_boolean = __esm({
22271
22423
  return new PgBoolean(table4, this.config);
22272
22424
  }
22273
22425
  };
22274
- __publicField(PgBooleanBuilder, _a45, "PgBooleanBuilder");
22275
- PgBoolean = class extends (_b24 = PgColumn, _a46 = entityKind, _b24) {
22426
+ __publicField(PgBooleanBuilder, _a44, "PgBooleanBuilder");
22427
+ PgBoolean = class extends (_b24 = PgColumn, _a45 = entityKind, _b24) {
22276
22428
  getSQLType() {
22277
22429
  return "boolean";
22278
22430
  }
22279
22431
  };
22280
- __publicField(PgBoolean, _a46, "PgBoolean");
22432
+ __publicField(PgBoolean, _a45, "PgBoolean");
22281
22433
  }
22282
22434
  });
22283
22435
 
@@ -22286,14 +22438,14 @@ function char(a, b = {}) {
22286
22438
  const { name: name2, config } = getColumnNameAndConfig(a, b);
22287
22439
  return new PgCharBuilder(name2, config);
22288
22440
  }
22289
- var _a47, _b25, PgCharBuilder, _a48, _b26, PgChar;
22441
+ var _a46, _b25, PgCharBuilder, _a47, _b26, PgChar;
22290
22442
  var init_char = __esm({
22291
22443
  "../drizzle-orm/dist/pg-core/columns/char.js"() {
22292
22444
  "use strict";
22293
22445
  init_entity();
22294
22446
  init_utils2();
22295
22447
  init_common2();
22296
- PgCharBuilder = class extends (_b25 = PgColumnBuilder, _a47 = entityKind, _b25) {
22448
+ PgCharBuilder = class extends (_b25 = PgColumnBuilder, _a46 = entityKind, _b25) {
22297
22449
  constructor(name2, config) {
22298
22450
  super(name2, "string", "PgChar");
22299
22451
  this.config.length = config.length;
@@ -22304,8 +22456,8 @@ var init_char = __esm({
22304
22456
  return new PgChar(table4, this.config);
22305
22457
  }
22306
22458
  };
22307
- __publicField(PgCharBuilder, _a47, "PgCharBuilder");
22308
- PgChar = class extends (_b26 = PgColumn, _a48 = entityKind, _b26) {
22459
+ __publicField(PgCharBuilder, _a46, "PgCharBuilder");
22460
+ PgChar = class extends (_b26 = PgColumn, _a47 = entityKind, _b26) {
22309
22461
  constructor() {
22310
22462
  super(...arguments);
22311
22463
  __publicField(this, "length", this.config.length);
@@ -22315,7 +22467,7 @@ var init_char = __esm({
22315
22467
  return this.length === void 0 ? `char` : `char(${this.length})`;
22316
22468
  }
22317
22469
  };
22318
- __publicField(PgChar, _a48, "PgChar");
22470
+ __publicField(PgChar, _a47, "PgChar");
22319
22471
  }
22320
22472
  });
22321
22473
 
@@ -22323,13 +22475,13 @@ var init_char = __esm({
22323
22475
  function cidr(name2) {
22324
22476
  return new PgCidrBuilder(name2 ?? "");
22325
22477
  }
22326
- var _a49, _b27, PgCidrBuilder, _a50, _b28, PgCidr;
22478
+ var _a48, _b27, PgCidrBuilder, _a49, _b28, PgCidr;
22327
22479
  var init_cidr = __esm({
22328
22480
  "../drizzle-orm/dist/pg-core/columns/cidr.js"() {
22329
22481
  "use strict";
22330
22482
  init_entity();
22331
22483
  init_common2();
22332
- PgCidrBuilder = class extends (_b27 = PgColumnBuilder, _a49 = entityKind, _b27) {
22484
+ PgCidrBuilder = class extends (_b27 = PgColumnBuilder, _a48 = entityKind, _b27) {
22333
22485
  constructor(name2) {
22334
22486
  super(name2, "string", "PgCidr");
22335
22487
  }
@@ -22338,13 +22490,13 @@ var init_cidr = __esm({
22338
22490
  return new PgCidr(table4, this.config);
22339
22491
  }
22340
22492
  };
22341
- __publicField(PgCidrBuilder, _a49, "PgCidrBuilder");
22342
- PgCidr = class extends (_b28 = PgColumn, _a50 = entityKind, _b28) {
22493
+ __publicField(PgCidrBuilder, _a48, "PgCidrBuilder");
22494
+ PgCidr = class extends (_b28 = PgColumn, _a49 = entityKind, _b28) {
22343
22495
  getSQLType() {
22344
22496
  return "cidr";
22345
22497
  }
22346
22498
  };
22347
- __publicField(PgCidr, _a50, "PgCidr");
22499
+ __publicField(PgCidr, _a49, "PgCidr");
22348
22500
  }
22349
22501
  });
22350
22502
 
@@ -22355,14 +22507,14 @@ function customType(customTypeParams) {
22355
22507
  return new PgCustomColumnBuilder(name2, config, customTypeParams);
22356
22508
  };
22357
22509
  }
22358
- var _a51, _b29, PgCustomColumnBuilder, _a52, _b30, PgCustomColumn;
22510
+ var _a50, _b29, PgCustomColumnBuilder, _a51, _b30, PgCustomColumn;
22359
22511
  var init_custom = __esm({
22360
22512
  "../drizzle-orm/dist/pg-core/columns/custom.js"() {
22361
22513
  "use strict";
22362
22514
  init_entity();
22363
22515
  init_utils2();
22364
22516
  init_common2();
22365
- PgCustomColumnBuilder = class extends (_b29 = PgColumnBuilder, _a51 = entityKind, _b29) {
22517
+ PgCustomColumnBuilder = class extends (_b29 = PgColumnBuilder, _a50 = entityKind, _b29) {
22366
22518
  constructor(name2, fieldConfig, customTypeParams) {
22367
22519
  super(name2, "custom", "PgCustomColumn");
22368
22520
  this.config.fieldConfig = fieldConfig;
@@ -22376,8 +22528,8 @@ var init_custom = __esm({
22376
22528
  );
22377
22529
  }
22378
22530
  };
22379
- __publicField(PgCustomColumnBuilder, _a51, "PgCustomColumnBuilder");
22380
- PgCustomColumn = class extends (_b30 = PgColumn, _a52 = entityKind, _b30) {
22531
+ __publicField(PgCustomColumnBuilder, _a50, "PgCustomColumnBuilder");
22532
+ PgCustomColumn = class extends (_b30 = PgColumn, _a51 = entityKind, _b30) {
22381
22533
  constructor(table4, config) {
22382
22534
  super(table4, config);
22383
22535
  __publicField(this, "sqlName");
@@ -22397,24 +22549,24 @@ var init_custom = __esm({
22397
22549
  return typeof this.mapTo === "function" ? this.mapTo(value) : value;
22398
22550
  }
22399
22551
  };
22400
- __publicField(PgCustomColumn, _a52, "PgCustomColumn");
22552
+ __publicField(PgCustomColumn, _a51, "PgCustomColumn");
22401
22553
  }
22402
22554
  });
22403
22555
 
22404
22556
  // ../drizzle-orm/dist/pg-core/columns/date.common.js
22405
- var _a53, _b31, PgDateColumnBaseBuilder;
22557
+ var _a52, _b31, PgDateColumnBaseBuilder;
22406
22558
  var init_date_common = __esm({
22407
22559
  "../drizzle-orm/dist/pg-core/columns/date.common.js"() {
22408
22560
  "use strict";
22409
22561
  init_entity();
22410
22562
  init_sql();
22411
22563
  init_common2();
22412
- PgDateColumnBaseBuilder = class extends (_b31 = PgColumnBuilder, _a53 = entityKind, _b31) {
22564
+ PgDateColumnBaseBuilder = class extends (_b31 = PgColumnBuilder, _a52 = entityKind, _b31) {
22413
22565
  defaultNow() {
22414
22566
  return this.default(sql`now()`);
22415
22567
  }
22416
22568
  };
22417
- __publicField(PgDateColumnBaseBuilder, _a53, "PgDateColumnBaseBuilder");
22569
+ __publicField(PgDateColumnBaseBuilder, _a52, "PgDateColumnBaseBuilder");
22418
22570
  }
22419
22571
  });
22420
22572
 
@@ -22426,7 +22578,7 @@ function date(a, b) {
22426
22578
  }
22427
22579
  return new PgDateStringBuilder(name2);
22428
22580
  }
22429
- var _a54, _b32, PgDateBuilder, _a55, _b33, PgDate, _a56, _b34, PgDateStringBuilder, _a57, _b35, PgDateString;
22581
+ var _a53, _b32, PgDateBuilder, _a54, _b33, PgDate, _a55, _b34, PgDateStringBuilder, _a56, _b35, PgDateString;
22430
22582
  var init_date = __esm({
22431
22583
  "../drizzle-orm/dist/pg-core/columns/date.js"() {
22432
22584
  "use strict";
@@ -22434,7 +22586,7 @@ var init_date = __esm({
22434
22586
  init_utils2();
22435
22587
  init_common2();
22436
22588
  init_date_common();
22437
- PgDateBuilder = class extends (_b32 = PgDateColumnBaseBuilder, _a54 = entityKind, _b32) {
22589
+ PgDateBuilder = class extends (_b32 = PgDateColumnBaseBuilder, _a53 = entityKind, _b32) {
22438
22590
  constructor(name2) {
22439
22591
  super(name2, "date", "PgDate");
22440
22592
  }
@@ -22443,8 +22595,8 @@ var init_date = __esm({
22443
22595
  return new PgDate(table4, this.config);
22444
22596
  }
22445
22597
  };
22446
- __publicField(PgDateBuilder, _a54, "PgDateBuilder");
22447
- PgDate = class extends (_b33 = PgColumn, _a55 = entityKind, _b33) {
22598
+ __publicField(PgDateBuilder, _a53, "PgDateBuilder");
22599
+ PgDate = class extends (_b33 = PgColumn, _a54 = entityKind, _b33) {
22448
22600
  getSQLType() {
22449
22601
  return "date";
22450
22602
  }
@@ -22455,8 +22607,8 @@ var init_date = __esm({
22455
22607
  return value.toISOString();
22456
22608
  }
22457
22609
  };
22458
- __publicField(PgDate, _a55, "PgDate");
22459
- PgDateStringBuilder = class extends (_b34 = PgDateColumnBaseBuilder, _a56 = entityKind, _b34) {
22610
+ __publicField(PgDate, _a54, "PgDate");
22611
+ PgDateStringBuilder = class extends (_b34 = PgDateColumnBaseBuilder, _a55 = entityKind, _b34) {
22460
22612
  constructor(name2) {
22461
22613
  super(name2, "string", "PgDateString");
22462
22614
  }
@@ -22468,13 +22620,13 @@ var init_date = __esm({
22468
22620
  );
22469
22621
  }
22470
22622
  };
22471
- __publicField(PgDateStringBuilder, _a56, "PgDateStringBuilder");
22472
- PgDateString = class extends (_b35 = PgColumn, _a57 = entityKind, _b35) {
22623
+ __publicField(PgDateStringBuilder, _a55, "PgDateStringBuilder");
22624
+ PgDateString = class extends (_b35 = PgColumn, _a56 = entityKind, _b35) {
22473
22625
  getSQLType() {
22474
22626
  return "date";
22475
22627
  }
22476
22628
  };
22477
- __publicField(PgDateString, _a57, "PgDateString");
22629
+ __publicField(PgDateString, _a56, "PgDateString");
22478
22630
  }
22479
22631
  });
22480
22632
 
@@ -22482,13 +22634,13 @@ var init_date = __esm({
22482
22634
  function doublePrecision(name2) {
22483
22635
  return new PgDoublePrecisionBuilder(name2 ?? "");
22484
22636
  }
22485
- var _a58, _b36, PgDoublePrecisionBuilder, _a59, _b37, PgDoublePrecision;
22637
+ var _a57, _b36, PgDoublePrecisionBuilder, _a58, _b37, PgDoublePrecision;
22486
22638
  var init_double_precision = __esm({
22487
22639
  "../drizzle-orm/dist/pg-core/columns/double-precision.js"() {
22488
22640
  "use strict";
22489
22641
  init_entity();
22490
22642
  init_common2();
22491
- PgDoublePrecisionBuilder = class extends (_b36 = PgColumnBuilder, _a58 = entityKind, _b36) {
22643
+ PgDoublePrecisionBuilder = class extends (_b36 = PgColumnBuilder, _a57 = entityKind, _b36) {
22492
22644
  constructor(name2) {
22493
22645
  super(name2, "number", "PgDoublePrecision");
22494
22646
  }
@@ -22500,8 +22652,8 @@ var init_double_precision = __esm({
22500
22652
  );
22501
22653
  }
22502
22654
  };
22503
- __publicField(PgDoublePrecisionBuilder, _a58, "PgDoublePrecisionBuilder");
22504
- PgDoublePrecision = class extends (_b37 = PgColumn, _a59 = entityKind, _b37) {
22655
+ __publicField(PgDoublePrecisionBuilder, _a57, "PgDoublePrecisionBuilder");
22656
+ PgDoublePrecision = class extends (_b37 = PgColumn, _a58 = entityKind, _b37) {
22505
22657
  getSQLType() {
22506
22658
  return "double precision";
22507
22659
  }
@@ -22512,7 +22664,7 @@ var init_double_precision = __esm({
22512
22664
  return value;
22513
22665
  }
22514
22666
  };
22515
- __publicField(PgDoublePrecision, _a59, "PgDoublePrecision");
22667
+ __publicField(PgDoublePrecision, _a58, "PgDoublePrecision");
22516
22668
  }
22517
22669
  });
22518
22670
 
@@ -22520,13 +22672,13 @@ var init_double_precision = __esm({
22520
22672
  function inet(name2) {
22521
22673
  return new PgInetBuilder(name2 ?? "");
22522
22674
  }
22523
- var _a60, _b38, PgInetBuilder, _a61, _b39, PgInet;
22675
+ var _a59, _b38, PgInetBuilder, _a60, _b39, PgInet;
22524
22676
  var init_inet = __esm({
22525
22677
  "../drizzle-orm/dist/pg-core/columns/inet.js"() {
22526
22678
  "use strict";
22527
22679
  init_entity();
22528
22680
  init_common2();
22529
- PgInetBuilder = class extends (_b38 = PgColumnBuilder, _a60 = entityKind, _b38) {
22681
+ PgInetBuilder = class extends (_b38 = PgColumnBuilder, _a59 = entityKind, _b38) {
22530
22682
  constructor(name2) {
22531
22683
  super(name2, "string", "PgInet");
22532
22684
  }
@@ -22535,13 +22687,13 @@ var init_inet = __esm({
22535
22687
  return new PgInet(table4, this.config);
22536
22688
  }
22537
22689
  };
22538
- __publicField(PgInetBuilder, _a60, "PgInetBuilder");
22539
- PgInet = class extends (_b39 = PgColumn, _a61 = entityKind, _b39) {
22690
+ __publicField(PgInetBuilder, _a59, "PgInetBuilder");
22691
+ PgInet = class extends (_b39 = PgColumn, _a60 = entityKind, _b39) {
22540
22692
  getSQLType() {
22541
22693
  return "inet";
22542
22694
  }
22543
22695
  };
22544
- __publicField(PgInet, _a61, "PgInet");
22696
+ __publicField(PgInet, _a60, "PgInet");
22545
22697
  }
22546
22698
  });
22547
22699
 
@@ -22549,14 +22701,14 @@ var init_inet = __esm({
22549
22701
  function integer(name2) {
22550
22702
  return new PgIntegerBuilder(name2 ?? "");
22551
22703
  }
22552
- var _a62, _b40, PgIntegerBuilder, _a63, _b41, PgInteger;
22704
+ var _a61, _b40, PgIntegerBuilder, _a62, _b41, PgInteger;
22553
22705
  var init_integer = __esm({
22554
22706
  "../drizzle-orm/dist/pg-core/columns/integer.js"() {
22555
22707
  "use strict";
22556
22708
  init_entity();
22557
22709
  init_common2();
22558
22710
  init_int_common();
22559
- PgIntegerBuilder = class extends (_b40 = PgIntColumnBaseBuilder, _a62 = entityKind, _b40) {
22711
+ PgIntegerBuilder = class extends (_b40 = PgIntColumnBaseBuilder, _a61 = entityKind, _b40) {
22560
22712
  constructor(name2) {
22561
22713
  super(name2, "number", "PgInteger");
22562
22714
  }
@@ -22565,8 +22717,8 @@ var init_integer = __esm({
22565
22717
  return new PgInteger(table4, this.config);
22566
22718
  }
22567
22719
  };
22568
- __publicField(PgIntegerBuilder, _a62, "PgIntegerBuilder");
22569
- PgInteger = class extends (_b41 = PgColumn, _a63 = entityKind, _b41) {
22720
+ __publicField(PgIntegerBuilder, _a61, "PgIntegerBuilder");
22721
+ PgInteger = class extends (_b41 = PgColumn, _a62 = entityKind, _b41) {
22570
22722
  getSQLType() {
22571
22723
  return "integer";
22572
22724
  }
@@ -22577,7 +22729,7 @@ var init_integer = __esm({
22577
22729
  return value;
22578
22730
  }
22579
22731
  };
22580
- __publicField(PgInteger, _a63, "PgInteger");
22732
+ __publicField(PgInteger, _a62, "PgInteger");
22581
22733
  }
22582
22734
  });
22583
22735
 
@@ -22586,14 +22738,14 @@ function interval(a, b = {}) {
22586
22738
  const { name: name2, config } = getColumnNameAndConfig(a, b);
22587
22739
  return new PgIntervalBuilder(name2, config);
22588
22740
  }
22589
- var _a64, _b42, PgIntervalBuilder, _a65, _b43, PgInterval;
22741
+ var _a63, _b42, PgIntervalBuilder, _a64, _b43, PgInterval;
22590
22742
  var init_interval = __esm({
22591
22743
  "../drizzle-orm/dist/pg-core/columns/interval.js"() {
22592
22744
  "use strict";
22593
22745
  init_entity();
22594
22746
  init_utils2();
22595
22747
  init_common2();
22596
- PgIntervalBuilder = class extends (_b42 = PgColumnBuilder, _a64 = entityKind, _b42) {
22748
+ PgIntervalBuilder = class extends (_b42 = PgColumnBuilder, _a63 = entityKind, _b42) {
22597
22749
  constructor(name2, intervalConfig) {
22598
22750
  super(name2, "string", "PgInterval");
22599
22751
  this.config.intervalConfig = intervalConfig;
@@ -22603,8 +22755,8 @@ var init_interval = __esm({
22603
22755
  return new PgInterval(table4, this.config);
22604
22756
  }
22605
22757
  };
22606
- __publicField(PgIntervalBuilder, _a64, "PgIntervalBuilder");
22607
- PgInterval = class extends (_b43 = PgColumn, _a65 = entityKind, _b43) {
22758
+ __publicField(PgIntervalBuilder, _a63, "PgIntervalBuilder");
22759
+ PgInterval = class extends (_b43 = PgColumn, _a64 = entityKind, _b43) {
22608
22760
  constructor() {
22609
22761
  super(...arguments);
22610
22762
  __publicField(this, "fields", this.config.intervalConfig.fields);
@@ -22616,7 +22768,7 @@ var init_interval = __esm({
22616
22768
  return `interval${fields}${precision}`;
22617
22769
  }
22618
22770
  };
22619
- __publicField(PgInterval, _a65, "PgInterval");
22771
+ __publicField(PgInterval, _a64, "PgInterval");
22620
22772
  }
22621
22773
  });
22622
22774
 
@@ -22624,13 +22776,13 @@ var init_interval = __esm({
22624
22776
  function json(name2) {
22625
22777
  return new PgJsonBuilder(name2 ?? "");
22626
22778
  }
22627
- var _a66, _b44, PgJsonBuilder, _a67, _b45, PgJson;
22779
+ var _a65, _b44, PgJsonBuilder, _a66, _b45, PgJson;
22628
22780
  var init_json = __esm({
22629
22781
  "../drizzle-orm/dist/pg-core/columns/json.js"() {
22630
22782
  "use strict";
22631
22783
  init_entity();
22632
22784
  init_common2();
22633
- PgJsonBuilder = class extends (_b44 = PgColumnBuilder, _a66 = entityKind, _b44) {
22785
+ PgJsonBuilder = class extends (_b44 = PgColumnBuilder, _a65 = entityKind, _b44) {
22634
22786
  constructor(name2) {
22635
22787
  super(name2, "json", "PgJson");
22636
22788
  }
@@ -22639,8 +22791,8 @@ var init_json = __esm({
22639
22791
  return new PgJson(table4, this.config);
22640
22792
  }
22641
22793
  };
22642
- __publicField(PgJsonBuilder, _a66, "PgJsonBuilder");
22643
- PgJson = class extends (_b45 = PgColumn, _a67 = entityKind, _b45) {
22794
+ __publicField(PgJsonBuilder, _a65, "PgJsonBuilder");
22795
+ PgJson = class extends (_b45 = PgColumn, _a66 = entityKind, _b45) {
22644
22796
  constructor(table4, config) {
22645
22797
  super(table4, config);
22646
22798
  }
@@ -22661,7 +22813,7 @@ var init_json = __esm({
22661
22813
  return value;
22662
22814
  }
22663
22815
  };
22664
- __publicField(PgJson, _a67, "PgJson");
22816
+ __publicField(PgJson, _a66, "PgJson");
22665
22817
  }
22666
22818
  });
22667
22819
 
@@ -22669,13 +22821,13 @@ var init_json = __esm({
22669
22821
  function jsonb(name2) {
22670
22822
  return new PgJsonbBuilder(name2 ?? "");
22671
22823
  }
22672
- var _a68, _b46, PgJsonbBuilder, _a69, _b47, PgJsonb;
22824
+ var _a67, _b46, PgJsonbBuilder, _a68, _b47, PgJsonb;
22673
22825
  var init_jsonb = __esm({
22674
22826
  "../drizzle-orm/dist/pg-core/columns/jsonb.js"() {
22675
22827
  "use strict";
22676
22828
  init_entity();
22677
22829
  init_common2();
22678
- PgJsonbBuilder = class extends (_b46 = PgColumnBuilder, _a68 = entityKind, _b46) {
22830
+ PgJsonbBuilder = class extends (_b46 = PgColumnBuilder, _a67 = entityKind, _b46) {
22679
22831
  constructor(name2) {
22680
22832
  super(name2, "json", "PgJsonb");
22681
22833
  }
@@ -22684,8 +22836,8 @@ var init_jsonb = __esm({
22684
22836
  return new PgJsonb(table4, this.config);
22685
22837
  }
22686
22838
  };
22687
- __publicField(PgJsonbBuilder, _a68, "PgJsonbBuilder");
22688
- PgJsonb = class extends (_b47 = PgColumn, _a69 = entityKind, _b47) {
22839
+ __publicField(PgJsonbBuilder, _a67, "PgJsonbBuilder");
22840
+ PgJsonb = class extends (_b47 = PgColumn, _a68 = entityKind, _b47) {
22689
22841
  constructor(table4, config) {
22690
22842
  super(table4, config);
22691
22843
  }
@@ -22706,7 +22858,7 @@ var init_jsonb = __esm({
22706
22858
  return value;
22707
22859
  }
22708
22860
  };
22709
- __publicField(PgJsonb, _a69, "PgJsonb");
22861
+ __publicField(PgJsonb, _a68, "PgJsonb");
22710
22862
  }
22711
22863
  });
22712
22864
 
@@ -22718,14 +22870,14 @@ function line(a, b) {
22718
22870
  }
22719
22871
  return new PgLineABCBuilder(name2);
22720
22872
  }
22721
- var _a70, _b48, PgLineBuilder, _a71, _b49, PgLineTuple, _a72, _b50, PgLineABCBuilder, _a73, _b51, PgLineABC;
22873
+ var _a69, _b48, PgLineBuilder, _a70, _b49, PgLineTuple, _a71, _b50, PgLineABCBuilder, _a72, _b51, PgLineABC;
22722
22874
  var init_line = __esm({
22723
22875
  "../drizzle-orm/dist/pg-core/columns/line.js"() {
22724
22876
  "use strict";
22725
22877
  init_entity();
22726
22878
  init_utils2();
22727
22879
  init_common2();
22728
- PgLineBuilder = class extends (_b48 = PgColumnBuilder, _a70 = entityKind, _b48) {
22880
+ PgLineBuilder = class extends (_b48 = PgColumnBuilder, _a69 = entityKind, _b48) {
22729
22881
  constructor(name2) {
22730
22882
  super(name2, "array", "PgLine");
22731
22883
  }
@@ -22737,8 +22889,8 @@ var init_line = __esm({
22737
22889
  );
22738
22890
  }
22739
22891
  };
22740
- __publicField(PgLineBuilder, _a70, "PgLineBuilder");
22741
- PgLineTuple = class extends (_b49 = PgColumn, _a71 = entityKind, _b49) {
22892
+ __publicField(PgLineBuilder, _a69, "PgLineBuilder");
22893
+ PgLineTuple = class extends (_b49 = PgColumn, _a70 = entityKind, _b49) {
22742
22894
  getSQLType() {
22743
22895
  return "line";
22744
22896
  }
@@ -22750,8 +22902,8 @@ var init_line = __esm({
22750
22902
  return `{${value[0]},${value[1]},${value[2]}}`;
22751
22903
  }
22752
22904
  };
22753
- __publicField(PgLineTuple, _a71, "PgLine");
22754
- PgLineABCBuilder = class extends (_b50 = PgColumnBuilder, _a72 = entityKind, _b50) {
22905
+ __publicField(PgLineTuple, _a70, "PgLine");
22906
+ PgLineABCBuilder = class extends (_b50 = PgColumnBuilder, _a71 = entityKind, _b50) {
22755
22907
  constructor(name2) {
22756
22908
  super(name2, "json", "PgLineABC");
22757
22909
  }
@@ -22763,8 +22915,8 @@ var init_line = __esm({
22763
22915
  );
22764
22916
  }
22765
22917
  };
22766
- __publicField(PgLineABCBuilder, _a72, "PgLineABCBuilder");
22767
- PgLineABC = class extends (_b51 = PgColumn, _a73 = entityKind, _b51) {
22918
+ __publicField(PgLineABCBuilder, _a71, "PgLineABCBuilder");
22919
+ PgLineABC = class extends (_b51 = PgColumn, _a72 = entityKind, _b51) {
22768
22920
  getSQLType() {
22769
22921
  return "line";
22770
22922
  }
@@ -22776,7 +22928,7 @@ var init_line = __esm({
22776
22928
  return `{${value.a},${value.b},${value.c}}`;
22777
22929
  }
22778
22930
  };
22779
- __publicField(PgLineABC, _a73, "PgLineABC");
22931
+ __publicField(PgLineABC, _a72, "PgLineABC");
22780
22932
  }
22781
22933
  });
22782
22934
 
@@ -22784,13 +22936,13 @@ var init_line = __esm({
22784
22936
  function macaddr(name2) {
22785
22937
  return new PgMacaddrBuilder(name2 ?? "");
22786
22938
  }
22787
- var _a74, _b52, PgMacaddrBuilder, _a75, _b53, PgMacaddr;
22939
+ var _a73, _b52, PgMacaddrBuilder, _a74, _b53, PgMacaddr;
22788
22940
  var init_macaddr = __esm({
22789
22941
  "../drizzle-orm/dist/pg-core/columns/macaddr.js"() {
22790
22942
  "use strict";
22791
22943
  init_entity();
22792
22944
  init_common2();
22793
- PgMacaddrBuilder = class extends (_b52 = PgColumnBuilder, _a74 = entityKind, _b52) {
22945
+ PgMacaddrBuilder = class extends (_b52 = PgColumnBuilder, _a73 = entityKind, _b52) {
22794
22946
  constructor(name2) {
22795
22947
  super(name2, "string", "PgMacaddr");
22796
22948
  }
@@ -22799,13 +22951,13 @@ var init_macaddr = __esm({
22799
22951
  return new PgMacaddr(table4, this.config);
22800
22952
  }
22801
22953
  };
22802
- __publicField(PgMacaddrBuilder, _a74, "PgMacaddrBuilder");
22803
- PgMacaddr = class extends (_b53 = PgColumn, _a75 = entityKind, _b53) {
22954
+ __publicField(PgMacaddrBuilder, _a73, "PgMacaddrBuilder");
22955
+ PgMacaddr = class extends (_b53 = PgColumn, _a74 = entityKind, _b53) {
22804
22956
  getSQLType() {
22805
22957
  return "macaddr";
22806
22958
  }
22807
22959
  };
22808
- __publicField(PgMacaddr, _a75, "PgMacaddr");
22960
+ __publicField(PgMacaddr, _a74, "PgMacaddr");
22809
22961
  }
22810
22962
  });
22811
22963
 
@@ -22813,13 +22965,13 @@ var init_macaddr = __esm({
22813
22965
  function macaddr8(name2) {
22814
22966
  return new PgMacaddr8Builder(name2 ?? "");
22815
22967
  }
22816
- var _a76, _b54, PgMacaddr8Builder, _a77, _b55, PgMacaddr8;
22968
+ var _a75, _b54, PgMacaddr8Builder, _a76, _b55, PgMacaddr8;
22817
22969
  var init_macaddr8 = __esm({
22818
22970
  "../drizzle-orm/dist/pg-core/columns/macaddr8.js"() {
22819
22971
  "use strict";
22820
22972
  init_entity();
22821
22973
  init_common2();
22822
- PgMacaddr8Builder = class extends (_b54 = PgColumnBuilder, _a76 = entityKind, _b54) {
22974
+ PgMacaddr8Builder = class extends (_b54 = PgColumnBuilder, _a75 = entityKind, _b54) {
22823
22975
  constructor(name2) {
22824
22976
  super(name2, "string", "PgMacaddr8");
22825
22977
  }
@@ -22828,13 +22980,13 @@ var init_macaddr8 = __esm({
22828
22980
  return new PgMacaddr8(table4, this.config);
22829
22981
  }
22830
22982
  };
22831
- __publicField(PgMacaddr8Builder, _a76, "PgMacaddr8Builder");
22832
- PgMacaddr8 = class extends (_b55 = PgColumn, _a77 = entityKind, _b55) {
22983
+ __publicField(PgMacaddr8Builder, _a75, "PgMacaddr8Builder");
22984
+ PgMacaddr8 = class extends (_b55 = PgColumn, _a76 = entityKind, _b55) {
22833
22985
  getSQLType() {
22834
22986
  return "macaddr8";
22835
22987
  }
22836
22988
  };
22837
- __publicField(PgMacaddr8, _a77, "PgMacaddr8");
22989
+ __publicField(PgMacaddr8, _a76, "PgMacaddr8");
22838
22990
  }
22839
22991
  });
22840
22992
 
@@ -22843,14 +22995,14 @@ function numeric(a, b) {
22843
22995
  const { name: name2, config } = getColumnNameAndConfig(a, b);
22844
22996
  return new PgNumericBuilder(name2, config?.precision, config?.scale);
22845
22997
  }
22846
- var _a78, _b56, PgNumericBuilder, _a79, _b57, PgNumeric;
22998
+ var _a77, _b56, PgNumericBuilder, _a78, _b57, PgNumeric;
22847
22999
  var init_numeric = __esm({
22848
23000
  "../drizzle-orm/dist/pg-core/columns/numeric.js"() {
22849
23001
  "use strict";
22850
23002
  init_entity();
22851
23003
  init_utils2();
22852
23004
  init_common2();
22853
- PgNumericBuilder = class extends (_b56 = PgColumnBuilder, _a78 = entityKind, _b56) {
23005
+ PgNumericBuilder = class extends (_b56 = PgColumnBuilder, _a77 = entityKind, _b56) {
22854
23006
  constructor(name2, precision, scale) {
22855
23007
  super(name2, "string", "PgNumeric");
22856
23008
  this.config.precision = precision;
@@ -22861,8 +23013,8 @@ var init_numeric = __esm({
22861
23013
  return new PgNumeric(table4, this.config);
22862
23014
  }
22863
23015
  };
22864
- __publicField(PgNumericBuilder, _a78, "PgNumericBuilder");
22865
- PgNumeric = class extends (_b57 = PgColumn, _a79 = entityKind, _b57) {
23016
+ __publicField(PgNumericBuilder, _a77, "PgNumericBuilder");
23017
+ PgNumeric = class extends (_b57 = PgColumn, _a78 = entityKind, _b57) {
22866
23018
  constructor(table4, config) {
22867
23019
  super(table4, config);
22868
23020
  __publicField(this, "precision");
@@ -22880,7 +23032,7 @@ var init_numeric = __esm({
22880
23032
  }
22881
23033
  }
22882
23034
  };
22883
- __publicField(PgNumeric, _a79, "PgNumeric");
23035
+ __publicField(PgNumeric, _a78, "PgNumeric");
22884
23036
  }
22885
23037
  });
22886
23038
 
@@ -22892,14 +23044,14 @@ function point(a, b) {
22892
23044
  }
22893
23045
  return new PgPointObjectBuilder(name2);
22894
23046
  }
22895
- var _a80, _b58, PgPointTupleBuilder, _a81, _b59, PgPointTuple, _a82, _b60, PgPointObjectBuilder, _a83, _b61, PgPointObject;
23047
+ var _a79, _b58, PgPointTupleBuilder, _a80, _b59, PgPointTuple, _a81, _b60, PgPointObjectBuilder, _a82, _b61, PgPointObject;
22896
23048
  var init_point = __esm({
22897
23049
  "../drizzle-orm/dist/pg-core/columns/point.js"() {
22898
23050
  "use strict";
22899
23051
  init_entity();
22900
23052
  init_utils2();
22901
23053
  init_common2();
22902
- PgPointTupleBuilder = class extends (_b58 = PgColumnBuilder, _a80 = entityKind, _b58) {
23054
+ PgPointTupleBuilder = class extends (_b58 = PgColumnBuilder, _a79 = entityKind, _b58) {
22903
23055
  constructor(name2) {
22904
23056
  super(name2, "array", "PgPointTuple");
22905
23057
  }
@@ -22911,8 +23063,8 @@ var init_point = __esm({
22911
23063
  );
22912
23064
  }
22913
23065
  };
22914
- __publicField(PgPointTupleBuilder, _a80, "PgPointTupleBuilder");
22915
- PgPointTuple = class extends (_b59 = PgColumn, _a81 = entityKind, _b59) {
23066
+ __publicField(PgPointTupleBuilder, _a79, "PgPointTupleBuilder");
23067
+ PgPointTuple = class extends (_b59 = PgColumn, _a80 = entityKind, _b59) {
22916
23068
  getSQLType() {
22917
23069
  return "point";
22918
23070
  }
@@ -22927,8 +23079,8 @@ var init_point = __esm({
22927
23079
  return `(${value[0]},${value[1]})`;
22928
23080
  }
22929
23081
  };
22930
- __publicField(PgPointTuple, _a81, "PgPointTuple");
22931
- PgPointObjectBuilder = class extends (_b60 = PgColumnBuilder, _a82 = entityKind, _b60) {
23082
+ __publicField(PgPointTuple, _a80, "PgPointTuple");
23083
+ PgPointObjectBuilder = class extends (_b60 = PgColumnBuilder, _a81 = entityKind, _b60) {
22932
23084
  constructor(name2) {
22933
23085
  super(name2, "json", "PgPointObject");
22934
23086
  }
@@ -22940,8 +23092,8 @@ var init_point = __esm({
22940
23092
  );
22941
23093
  }
22942
23094
  };
22943
- __publicField(PgPointObjectBuilder, _a82, "PgPointObjectBuilder");
22944
- PgPointObject = class extends (_b61 = PgColumn, _a83 = entityKind, _b61) {
23095
+ __publicField(PgPointObjectBuilder, _a81, "PgPointObjectBuilder");
23096
+ PgPointObject = class extends (_b61 = PgColumn, _a82 = entityKind, _b61) {
22945
23097
  getSQLType() {
22946
23098
  return "point";
22947
23099
  }
@@ -22956,7 +23108,7 @@ var init_point = __esm({
22956
23108
  return `(${value.x},${value.y})`;
22957
23109
  }
22958
23110
  };
22959
- __publicField(PgPointObject, _a83, "PgPointObject");
23111
+ __publicField(PgPointObject, _a82, "PgPointObject");
22960
23112
  }
22961
23113
  });
22962
23114
 
@@ -23012,7 +23164,7 @@ function geometry(a, b) {
23012
23164
  }
23013
23165
  return new PgGeometryObjectBuilder(name2);
23014
23166
  }
23015
- var _a84, _b62, PgGeometryBuilder, _a85, _b63, PgGeometry, _a86, _b64, PgGeometryObjectBuilder, _a87, _b65, PgGeometryObject;
23167
+ var _a83, _b62, PgGeometryBuilder, _a84, _b63, PgGeometry, _a85, _b64, PgGeometryObjectBuilder, _a86, _b65, PgGeometryObject;
23016
23168
  var init_geometry = __esm({
23017
23169
  "../drizzle-orm/dist/pg-core/columns/postgis_extension/geometry.js"() {
23018
23170
  "use strict";
@@ -23020,7 +23172,7 @@ var init_geometry = __esm({
23020
23172
  init_utils2();
23021
23173
  init_common2();
23022
23174
  init_utils3();
23023
- PgGeometryBuilder = class extends (_b62 = PgColumnBuilder, _a84 = entityKind, _b62) {
23175
+ PgGeometryBuilder = class extends (_b62 = PgColumnBuilder, _a83 = entityKind, _b62) {
23024
23176
  constructor(name2) {
23025
23177
  super(name2, "array", "PgGeometry");
23026
23178
  }
@@ -23032,8 +23184,8 @@ var init_geometry = __esm({
23032
23184
  );
23033
23185
  }
23034
23186
  };
23035
- __publicField(PgGeometryBuilder, _a84, "PgGeometryBuilder");
23036
- PgGeometry = class extends (_b63 = PgColumn, _a85 = entityKind, _b63) {
23187
+ __publicField(PgGeometryBuilder, _a83, "PgGeometryBuilder");
23188
+ PgGeometry = class extends (_b63 = PgColumn, _a84 = entityKind, _b63) {
23037
23189
  getSQLType() {
23038
23190
  return "geometry(point)";
23039
23191
  }
@@ -23044,8 +23196,8 @@ var init_geometry = __esm({
23044
23196
  return `point(${value[0]} ${value[1]})`;
23045
23197
  }
23046
23198
  };
23047
- __publicField(PgGeometry, _a85, "PgGeometry");
23048
- PgGeometryObjectBuilder = class extends (_b64 = PgColumnBuilder, _a86 = entityKind, _b64) {
23199
+ __publicField(PgGeometry, _a84, "PgGeometry");
23200
+ PgGeometryObjectBuilder = class extends (_b64 = PgColumnBuilder, _a85 = entityKind, _b64) {
23049
23201
  constructor(name2) {
23050
23202
  super(name2, "json", "PgGeometryObject");
23051
23203
  }
@@ -23057,8 +23209,8 @@ var init_geometry = __esm({
23057
23209
  );
23058
23210
  }
23059
23211
  };
23060
- __publicField(PgGeometryObjectBuilder, _a86, "PgGeometryObjectBuilder");
23061
- PgGeometryObject = class extends (_b65 = PgColumn, _a87 = entityKind, _b65) {
23212
+ __publicField(PgGeometryObjectBuilder, _a85, "PgGeometryObjectBuilder");
23213
+ PgGeometryObject = class extends (_b65 = PgColumn, _a86 = entityKind, _b65) {
23062
23214
  getSQLType() {
23063
23215
  return "geometry(point)";
23064
23216
  }
@@ -23070,7 +23222,7 @@ var init_geometry = __esm({
23070
23222
  return `point(${value.x} ${value.y})`;
23071
23223
  }
23072
23224
  };
23073
- __publicField(PgGeometryObject, _a87, "PgGeometryObject");
23225
+ __publicField(PgGeometryObject, _a86, "PgGeometryObject");
23074
23226
  }
23075
23227
  });
23076
23228
 
@@ -23078,13 +23230,13 @@ var init_geometry = __esm({
23078
23230
  function real(name2) {
23079
23231
  return new PgRealBuilder(name2 ?? "");
23080
23232
  }
23081
- var _a88, _b66, PgRealBuilder, _a89, _b67, PgReal;
23233
+ var _a87, _b66, PgRealBuilder, _a88, _b67, PgReal;
23082
23234
  var init_real = __esm({
23083
23235
  "../drizzle-orm/dist/pg-core/columns/real.js"() {
23084
23236
  "use strict";
23085
23237
  init_entity();
23086
23238
  init_common2();
23087
- PgRealBuilder = class extends (_b66 = PgColumnBuilder, _a88 = entityKind, _b66) {
23239
+ PgRealBuilder = class extends (_b66 = PgColumnBuilder, _a87 = entityKind, _b66) {
23088
23240
  constructor(name2, length) {
23089
23241
  super(name2, "number", "PgReal");
23090
23242
  this.config.length = length;
@@ -23094,8 +23246,8 @@ var init_real = __esm({
23094
23246
  return new PgReal(table4, this.config);
23095
23247
  }
23096
23248
  };
23097
- __publicField(PgRealBuilder, _a88, "PgRealBuilder");
23098
- PgReal = class extends (_b67 = PgColumn, _a89 = entityKind, _b67) {
23249
+ __publicField(PgRealBuilder, _a87, "PgRealBuilder");
23250
+ PgReal = class extends (_b67 = PgColumn, _a88 = entityKind, _b67) {
23099
23251
  constructor(table4, config) {
23100
23252
  super(table4, config);
23101
23253
  __publicField(this, "mapFromDriverValue", (value) => {
@@ -23109,7 +23261,7 @@ var init_real = __esm({
23109
23261
  return "real";
23110
23262
  }
23111
23263
  };
23112
- __publicField(PgReal, _a89, "PgReal");
23264
+ __publicField(PgReal, _a88, "PgReal");
23113
23265
  }
23114
23266
  });
23115
23267
 
@@ -23117,13 +23269,13 @@ var init_real = __esm({
23117
23269
  function serial(name2) {
23118
23270
  return new PgSerialBuilder(name2 ?? "");
23119
23271
  }
23120
- var _a90, _b68, PgSerialBuilder, _a91, _b69, PgSerial;
23272
+ var _a89, _b68, PgSerialBuilder, _a90, _b69, PgSerial;
23121
23273
  var init_serial = __esm({
23122
23274
  "../drizzle-orm/dist/pg-core/columns/serial.js"() {
23123
23275
  "use strict";
23124
23276
  init_entity();
23125
23277
  init_common2();
23126
- PgSerialBuilder = class extends (_b68 = PgColumnBuilder, _a90 = entityKind, _b68) {
23278
+ PgSerialBuilder = class extends (_b68 = PgColumnBuilder, _a89 = entityKind, _b68) {
23127
23279
  constructor(name2) {
23128
23280
  super(name2, "number", "PgSerial");
23129
23281
  this.config.hasDefault = true;
@@ -23134,13 +23286,13 @@ var init_serial = __esm({
23134
23286
  return new PgSerial(table4, this.config);
23135
23287
  }
23136
23288
  };
23137
- __publicField(PgSerialBuilder, _a90, "PgSerialBuilder");
23138
- PgSerial = class extends (_b69 = PgColumn, _a91 = entityKind, _b69) {
23289
+ __publicField(PgSerialBuilder, _a89, "PgSerialBuilder");
23290
+ PgSerial = class extends (_b69 = PgColumn, _a90 = entityKind, _b69) {
23139
23291
  getSQLType() {
23140
23292
  return "serial";
23141
23293
  }
23142
23294
  };
23143
- __publicField(PgSerial, _a91, "PgSerial");
23295
+ __publicField(PgSerial, _a90, "PgSerial");
23144
23296
  }
23145
23297
  });
23146
23298
 
@@ -23148,14 +23300,14 @@ var init_serial = __esm({
23148
23300
  function smallint(name2) {
23149
23301
  return new PgSmallIntBuilder(name2 ?? "");
23150
23302
  }
23151
- var _a92, _b70, PgSmallIntBuilder, _a93, _b71, PgSmallInt;
23303
+ var _a91, _b70, PgSmallIntBuilder, _a92, _b71, PgSmallInt;
23152
23304
  var init_smallint = __esm({
23153
23305
  "../drizzle-orm/dist/pg-core/columns/smallint.js"() {
23154
23306
  "use strict";
23155
23307
  init_entity();
23156
23308
  init_common2();
23157
23309
  init_int_common();
23158
- PgSmallIntBuilder = class extends (_b70 = PgIntColumnBaseBuilder, _a92 = entityKind, _b70) {
23310
+ PgSmallIntBuilder = class extends (_b70 = PgIntColumnBaseBuilder, _a91 = entityKind, _b70) {
23159
23311
  constructor(name2) {
23160
23312
  super(name2, "number", "PgSmallInt");
23161
23313
  }
@@ -23164,8 +23316,8 @@ var init_smallint = __esm({
23164
23316
  return new PgSmallInt(table4, this.config);
23165
23317
  }
23166
23318
  };
23167
- __publicField(PgSmallIntBuilder, _a92, "PgSmallIntBuilder");
23168
- PgSmallInt = class extends (_b71 = PgColumn, _a93 = entityKind, _b71) {
23319
+ __publicField(PgSmallIntBuilder, _a91, "PgSmallIntBuilder");
23320
+ PgSmallInt = class extends (_b71 = PgColumn, _a92 = entityKind, _b71) {
23169
23321
  constructor() {
23170
23322
  super(...arguments);
23171
23323
  __publicField(this, "mapFromDriverValue", (value) => {
@@ -23179,7 +23331,7 @@ var init_smallint = __esm({
23179
23331
  return "smallint";
23180
23332
  }
23181
23333
  };
23182
- __publicField(PgSmallInt, _a93, "PgSmallInt");
23334
+ __publicField(PgSmallInt, _a92, "PgSmallInt");
23183
23335
  }
23184
23336
  });
23185
23337
 
@@ -23187,13 +23339,13 @@ var init_smallint = __esm({
23187
23339
  function smallserial(name2) {
23188
23340
  return new PgSmallSerialBuilder(name2 ?? "");
23189
23341
  }
23190
- var _a94, _b72, PgSmallSerialBuilder, _a95, _b73, PgSmallSerial;
23342
+ var _a93, _b72, PgSmallSerialBuilder, _a94, _b73, PgSmallSerial;
23191
23343
  var init_smallserial = __esm({
23192
23344
  "../drizzle-orm/dist/pg-core/columns/smallserial.js"() {
23193
23345
  "use strict";
23194
23346
  init_entity();
23195
23347
  init_common2();
23196
- PgSmallSerialBuilder = class extends (_b72 = PgColumnBuilder, _a94 = entityKind, _b72) {
23348
+ PgSmallSerialBuilder = class extends (_b72 = PgColumnBuilder, _a93 = entityKind, _b72) {
23197
23349
  constructor(name2) {
23198
23350
  super(name2, "number", "PgSmallSerial");
23199
23351
  this.config.hasDefault = true;
@@ -23207,13 +23359,13 @@ var init_smallserial = __esm({
23207
23359
  );
23208
23360
  }
23209
23361
  };
23210
- __publicField(PgSmallSerialBuilder, _a94, "PgSmallSerialBuilder");
23211
- PgSmallSerial = class extends (_b73 = PgColumn, _a95 = entityKind, _b73) {
23362
+ __publicField(PgSmallSerialBuilder, _a93, "PgSmallSerialBuilder");
23363
+ PgSmallSerial = class extends (_b73 = PgColumn, _a94 = entityKind, _b73) {
23212
23364
  getSQLType() {
23213
23365
  return "smallserial";
23214
23366
  }
23215
23367
  };
23216
- __publicField(PgSmallSerial, _a95, "PgSmallSerial");
23368
+ __publicField(PgSmallSerial, _a94, "PgSmallSerial");
23217
23369
  }
23218
23370
  });
23219
23371
 
@@ -23222,14 +23374,14 @@ function text(a, b = {}) {
23222
23374
  const { name: name2, config } = getColumnNameAndConfig(a, b);
23223
23375
  return new PgTextBuilder(name2, config);
23224
23376
  }
23225
- var _a96, _b74, PgTextBuilder, _a97, _b75, PgText;
23377
+ var _a95, _b74, PgTextBuilder, _a96, _b75, PgText;
23226
23378
  var init_text = __esm({
23227
23379
  "../drizzle-orm/dist/pg-core/columns/text.js"() {
23228
23380
  "use strict";
23229
23381
  init_entity();
23230
23382
  init_utils2();
23231
23383
  init_common2();
23232
- PgTextBuilder = class extends (_b74 = PgColumnBuilder, _a96 = entityKind, _b74) {
23384
+ PgTextBuilder = class extends (_b74 = PgColumnBuilder, _a95 = entityKind, _b74) {
23233
23385
  constructor(name2, config) {
23234
23386
  super(name2, "string", "PgText");
23235
23387
  this.config.enumValues = config.enum;
@@ -23239,8 +23391,8 @@ var init_text = __esm({
23239
23391
  return new PgText(table4, this.config);
23240
23392
  }
23241
23393
  };
23242
- __publicField(PgTextBuilder, _a96, "PgTextBuilder");
23243
- PgText = class extends (_b75 = PgColumn, _a97 = entityKind, _b75) {
23394
+ __publicField(PgTextBuilder, _a95, "PgTextBuilder");
23395
+ PgText = class extends (_b75 = PgColumn, _a96 = entityKind, _b75) {
23244
23396
  constructor() {
23245
23397
  super(...arguments);
23246
23398
  __publicField(this, "enumValues", this.config.enumValues);
@@ -23249,7 +23401,7 @@ var init_text = __esm({
23249
23401
  return "text";
23250
23402
  }
23251
23403
  };
23252
- __publicField(PgText, _a97, "PgText");
23404
+ __publicField(PgText, _a96, "PgText");
23253
23405
  }
23254
23406
  });
23255
23407
 
@@ -23258,7 +23410,7 @@ function time(a, b = {}) {
23258
23410
  const { name: name2, config } = getColumnNameAndConfig(a, b);
23259
23411
  return new PgTimeBuilder(name2, config.withTimezone ?? false, config.precision);
23260
23412
  }
23261
- var _a98, _b76, PgTimeBuilder, _a99, _b77, PgTime;
23413
+ var _a97, _b76, PgTimeBuilder, _a98, _b77, PgTime;
23262
23414
  var init_time = __esm({
23263
23415
  "../drizzle-orm/dist/pg-core/columns/time.js"() {
23264
23416
  "use strict";
@@ -23266,7 +23418,7 @@ var init_time = __esm({
23266
23418
  init_utils2();
23267
23419
  init_common2();
23268
23420
  init_date_common();
23269
- PgTimeBuilder = class extends (_b76 = PgDateColumnBaseBuilder, _a98 = entityKind, _b76) {
23421
+ PgTimeBuilder = class extends (_b76 = PgDateColumnBaseBuilder, _a97 = entityKind, _b76) {
23270
23422
  constructor(name2, withTimezone, precision) {
23271
23423
  super(name2, "string", "PgTime");
23272
23424
  this.withTimezone = withTimezone;
@@ -23279,8 +23431,8 @@ var init_time = __esm({
23279
23431
  return new PgTime(table4, this.config);
23280
23432
  }
23281
23433
  };
23282
- __publicField(PgTimeBuilder, _a98, "PgTimeBuilder");
23283
- PgTime = class extends (_b77 = PgColumn, _a99 = entityKind, _b77) {
23434
+ __publicField(PgTimeBuilder, _a97, "PgTimeBuilder");
23435
+ PgTime = class extends (_b77 = PgColumn, _a98 = entityKind, _b77) {
23284
23436
  constructor(table4, config) {
23285
23437
  super(table4, config);
23286
23438
  __publicField(this, "withTimezone");
@@ -23293,7 +23445,7 @@ var init_time = __esm({
23293
23445
  return `time${precision}${this.withTimezone ? " with time zone" : ""}`;
23294
23446
  }
23295
23447
  };
23296
- __publicField(PgTime, _a99, "PgTime");
23448
+ __publicField(PgTime, _a98, "PgTime");
23297
23449
  }
23298
23450
  });
23299
23451
 
@@ -23305,7 +23457,7 @@ function timestamp(a, b = {}) {
23305
23457
  }
23306
23458
  return new PgTimestampBuilder(name2, config?.withTimezone ?? false, config?.precision);
23307
23459
  }
23308
- var _a100, _b78, PgTimestampBuilder, _a101, _b79, PgTimestamp, _a102, _b80, PgTimestampStringBuilder, _a103, _b81, PgTimestampString;
23460
+ var _a99, _b78, PgTimestampBuilder, _a100, _b79, PgTimestamp, _a101, _b80, PgTimestampStringBuilder, _a102, _b81, PgTimestampString;
23309
23461
  var init_timestamp = __esm({
23310
23462
  "../drizzle-orm/dist/pg-core/columns/timestamp.js"() {
23311
23463
  "use strict";
@@ -23313,7 +23465,7 @@ var init_timestamp = __esm({
23313
23465
  init_utils2();
23314
23466
  init_common2();
23315
23467
  init_date_common();
23316
- PgTimestampBuilder = class extends (_b78 = PgDateColumnBaseBuilder, _a100 = entityKind, _b78) {
23468
+ PgTimestampBuilder = class extends (_b78 = PgDateColumnBaseBuilder, _a99 = entityKind, _b78) {
23317
23469
  constructor(name2, withTimezone, precision) {
23318
23470
  super(name2, "date", "PgTimestamp");
23319
23471
  this.config.withTimezone = withTimezone;
@@ -23324,8 +23476,8 @@ var init_timestamp = __esm({
23324
23476
  return new PgTimestamp(table4, this.config);
23325
23477
  }
23326
23478
  };
23327
- __publicField(PgTimestampBuilder, _a100, "PgTimestampBuilder");
23328
- PgTimestamp = class extends (_b79 = PgColumn, _a101 = entityKind, _b79) {
23479
+ __publicField(PgTimestampBuilder, _a99, "PgTimestampBuilder");
23480
+ PgTimestamp = class extends (_b79 = PgColumn, _a100 = entityKind, _b79) {
23329
23481
  constructor(table4, config) {
23330
23482
  super(table4, config);
23331
23483
  __publicField(this, "withTimezone");
@@ -23344,8 +23496,8 @@ var init_timestamp = __esm({
23344
23496
  return `timestamp${precision}${this.withTimezone ? " with time zone" : ""}`;
23345
23497
  }
23346
23498
  };
23347
- __publicField(PgTimestamp, _a101, "PgTimestamp");
23348
- PgTimestampStringBuilder = class extends (_b80 = PgDateColumnBaseBuilder, _a102 = entityKind, _b80) {
23499
+ __publicField(PgTimestamp, _a100, "PgTimestamp");
23500
+ PgTimestampStringBuilder = class extends (_b80 = PgDateColumnBaseBuilder, _a101 = entityKind, _b80) {
23349
23501
  constructor(name2, withTimezone, precision) {
23350
23502
  super(name2, "string", "PgTimestampString");
23351
23503
  this.config.withTimezone = withTimezone;
@@ -23359,8 +23511,8 @@ var init_timestamp = __esm({
23359
23511
  );
23360
23512
  }
23361
23513
  };
23362
- __publicField(PgTimestampStringBuilder, _a102, "PgTimestampStringBuilder");
23363
- PgTimestampString = class extends (_b81 = PgColumn, _a103 = entityKind, _b81) {
23514
+ __publicField(PgTimestampStringBuilder, _a101, "PgTimestampStringBuilder");
23515
+ PgTimestampString = class extends (_b81 = PgColumn, _a102 = entityKind, _b81) {
23364
23516
  constructor(table4, config) {
23365
23517
  super(table4, config);
23366
23518
  __publicField(this, "withTimezone");
@@ -23373,7 +23525,7 @@ var init_timestamp = __esm({
23373
23525
  return `timestamp${precision}${this.withTimezone ? " with time zone" : ""}`;
23374
23526
  }
23375
23527
  };
23376
- __publicField(PgTimestampString, _a103, "PgTimestampString");
23528
+ __publicField(PgTimestampString, _a102, "PgTimestampString");
23377
23529
  }
23378
23530
  });
23379
23531
 
@@ -23381,14 +23533,14 @@ var init_timestamp = __esm({
23381
23533
  function uuid(name2) {
23382
23534
  return new PgUUIDBuilder(name2 ?? "");
23383
23535
  }
23384
- var _a104, _b82, PgUUIDBuilder, _a105, _b83, PgUUID;
23536
+ var _a103, _b82, PgUUIDBuilder, _a104, _b83, PgUUID;
23385
23537
  var init_uuid = __esm({
23386
23538
  "../drizzle-orm/dist/pg-core/columns/uuid.js"() {
23387
23539
  "use strict";
23388
23540
  init_entity();
23389
23541
  init_sql();
23390
23542
  init_common2();
23391
- PgUUIDBuilder = class extends (_b82 = PgColumnBuilder, _a104 = entityKind, _b82) {
23543
+ PgUUIDBuilder = class extends (_b82 = PgColumnBuilder, _a103 = entityKind, _b82) {
23392
23544
  constructor(name2) {
23393
23545
  super(name2, "string", "PgUUID");
23394
23546
  }
@@ -23403,13 +23555,13 @@ var init_uuid = __esm({
23403
23555
  return new PgUUID(table4, this.config);
23404
23556
  }
23405
23557
  };
23406
- __publicField(PgUUIDBuilder, _a104, "PgUUIDBuilder");
23407
- PgUUID = class extends (_b83 = PgColumn, _a105 = entityKind, _b83) {
23558
+ __publicField(PgUUIDBuilder, _a103, "PgUUIDBuilder");
23559
+ PgUUID = class extends (_b83 = PgColumn, _a104 = entityKind, _b83) {
23408
23560
  getSQLType() {
23409
23561
  return "uuid";
23410
23562
  }
23411
23563
  };
23412
- __publicField(PgUUID, _a105, "PgUUID");
23564
+ __publicField(PgUUID, _a104, "PgUUID");
23413
23565
  }
23414
23566
  });
23415
23567
 
@@ -23418,14 +23570,14 @@ function varchar(a, b = {}) {
23418
23570
  const { name: name2, config } = getColumnNameAndConfig(a, b);
23419
23571
  return new PgVarcharBuilder(name2, config);
23420
23572
  }
23421
- var _a106, _b84, PgVarcharBuilder, _a107, _b85, PgVarchar;
23573
+ var _a105, _b84, PgVarcharBuilder, _a106, _b85, PgVarchar;
23422
23574
  var init_varchar = __esm({
23423
23575
  "../drizzle-orm/dist/pg-core/columns/varchar.js"() {
23424
23576
  "use strict";
23425
23577
  init_entity();
23426
23578
  init_utils2();
23427
23579
  init_common2();
23428
- PgVarcharBuilder = class extends (_b84 = PgColumnBuilder, _a106 = entityKind, _b84) {
23580
+ PgVarcharBuilder = class extends (_b84 = PgColumnBuilder, _a105 = entityKind, _b84) {
23429
23581
  constructor(name2, config) {
23430
23582
  super(name2, "string", "PgVarchar");
23431
23583
  this.config.length = config.length;
@@ -23436,8 +23588,8 @@ var init_varchar = __esm({
23436
23588
  return new PgVarchar(table4, this.config);
23437
23589
  }
23438
23590
  };
23439
- __publicField(PgVarcharBuilder, _a106, "PgVarcharBuilder");
23440
- PgVarchar = class extends (_b85 = PgColumn, _a107 = entityKind, _b85) {
23591
+ __publicField(PgVarcharBuilder, _a105, "PgVarcharBuilder");
23592
+ PgVarchar = class extends (_b85 = PgColumn, _a106 = entityKind, _b85) {
23441
23593
  constructor() {
23442
23594
  super(...arguments);
23443
23595
  __publicField(this, "length", this.config.length);
@@ -23447,7 +23599,7 @@ var init_varchar = __esm({
23447
23599
  return this.length === void 0 ? `varchar` : `varchar(${this.length})`;
23448
23600
  }
23449
23601
  };
23450
- __publicField(PgVarchar, _a107, "PgVarchar");
23602
+ __publicField(PgVarchar, _a106, "PgVarchar");
23451
23603
  }
23452
23604
  });
23453
23605
 
@@ -23456,14 +23608,14 @@ function bit(a, b) {
23456
23608
  const { name: name2, config } = getColumnNameAndConfig(a, b);
23457
23609
  return new PgBinaryVectorBuilder(name2, config);
23458
23610
  }
23459
- var _a108, _b86, PgBinaryVectorBuilder, _a109, _b87, PgBinaryVector;
23611
+ var _a107, _b86, PgBinaryVectorBuilder, _a108, _b87, PgBinaryVector;
23460
23612
  var init_bit = __esm({
23461
23613
  "../drizzle-orm/dist/pg-core/columns/vector_extension/bit.js"() {
23462
23614
  "use strict";
23463
23615
  init_entity();
23464
23616
  init_utils2();
23465
23617
  init_common2();
23466
- PgBinaryVectorBuilder = class extends (_b86 = PgColumnBuilder, _a108 = entityKind, _b86) {
23618
+ PgBinaryVectorBuilder = class extends (_b86 = PgColumnBuilder, _a107 = entityKind, _b86) {
23467
23619
  constructor(name2, config) {
23468
23620
  super(name2, "string", "PgBinaryVector");
23469
23621
  this.config.dimensions = config.dimensions;
@@ -23476,8 +23628,8 @@ var init_bit = __esm({
23476
23628
  );
23477
23629
  }
23478
23630
  };
23479
- __publicField(PgBinaryVectorBuilder, _a108, "PgBinaryVectorBuilder");
23480
- PgBinaryVector = class extends (_b87 = PgColumn, _a109 = entityKind, _b87) {
23631
+ __publicField(PgBinaryVectorBuilder, _a107, "PgBinaryVectorBuilder");
23632
+ PgBinaryVector = class extends (_b87 = PgColumn, _a108 = entityKind, _b87) {
23481
23633
  constructor() {
23482
23634
  super(...arguments);
23483
23635
  __publicField(this, "dimensions", this.config.dimensions);
@@ -23486,7 +23638,7 @@ var init_bit = __esm({
23486
23638
  return `bit(${this.dimensions})`;
23487
23639
  }
23488
23640
  };
23489
- __publicField(PgBinaryVector, _a109, "PgBinaryVector");
23641
+ __publicField(PgBinaryVector, _a108, "PgBinaryVector");
23490
23642
  }
23491
23643
  });
23492
23644
 
@@ -23495,14 +23647,14 @@ function halfvec(a, b) {
23495
23647
  const { name: name2, config } = getColumnNameAndConfig(a, b);
23496
23648
  return new PgHalfVectorBuilder(name2, config);
23497
23649
  }
23498
- var _a110, _b88, PgHalfVectorBuilder, _a111, _b89, PgHalfVector;
23650
+ var _a109, _b88, PgHalfVectorBuilder, _a110, _b89, PgHalfVector;
23499
23651
  var init_halfvec = __esm({
23500
23652
  "../drizzle-orm/dist/pg-core/columns/vector_extension/halfvec.js"() {
23501
23653
  "use strict";
23502
23654
  init_entity();
23503
23655
  init_utils2();
23504
23656
  init_common2();
23505
- PgHalfVectorBuilder = class extends (_b88 = PgColumnBuilder, _a110 = entityKind, _b88) {
23657
+ PgHalfVectorBuilder = class extends (_b88 = PgColumnBuilder, _a109 = entityKind, _b88) {
23506
23658
  constructor(name2, config) {
23507
23659
  super(name2, "array", "PgHalfVector");
23508
23660
  this.config.dimensions = config.dimensions;
@@ -23515,8 +23667,8 @@ var init_halfvec = __esm({
23515
23667
  );
23516
23668
  }
23517
23669
  };
23518
- __publicField(PgHalfVectorBuilder, _a110, "PgHalfVectorBuilder");
23519
- PgHalfVector = class extends (_b89 = PgColumn, _a111 = entityKind, _b89) {
23670
+ __publicField(PgHalfVectorBuilder, _a109, "PgHalfVectorBuilder");
23671
+ PgHalfVector = class extends (_b89 = PgColumn, _a110 = entityKind, _b89) {
23520
23672
  constructor() {
23521
23673
  super(...arguments);
23522
23674
  __publicField(this, "dimensions", this.config.dimensions);
@@ -23531,7 +23683,7 @@ var init_halfvec = __esm({
23531
23683
  return value.slice(1, -1).split(",").map((v) => Number.parseFloat(v));
23532
23684
  }
23533
23685
  };
23534
- __publicField(PgHalfVector, _a111, "PgHalfVector");
23686
+ __publicField(PgHalfVector, _a110, "PgHalfVector");
23535
23687
  }
23536
23688
  });
23537
23689
 
@@ -23540,14 +23692,14 @@ function sparsevec(a, b) {
23540
23692
  const { name: name2, config } = getColumnNameAndConfig(a, b);
23541
23693
  return new PgSparseVectorBuilder(name2, config);
23542
23694
  }
23543
- var _a112, _b90, PgSparseVectorBuilder, _a113, _b91, PgSparseVector;
23695
+ var _a111, _b90, PgSparseVectorBuilder, _a112, _b91, PgSparseVector;
23544
23696
  var init_sparsevec = __esm({
23545
23697
  "../drizzle-orm/dist/pg-core/columns/vector_extension/sparsevec.js"() {
23546
23698
  "use strict";
23547
23699
  init_entity();
23548
23700
  init_utils2();
23549
23701
  init_common2();
23550
- PgSparseVectorBuilder = class extends (_b90 = PgColumnBuilder, _a112 = entityKind, _b90) {
23702
+ PgSparseVectorBuilder = class extends (_b90 = PgColumnBuilder, _a111 = entityKind, _b90) {
23551
23703
  constructor(name2, config) {
23552
23704
  super(name2, "string", "PgSparseVector");
23553
23705
  this.config.dimensions = config.dimensions;
@@ -23560,8 +23712,8 @@ var init_sparsevec = __esm({
23560
23712
  );
23561
23713
  }
23562
23714
  };
23563
- __publicField(PgSparseVectorBuilder, _a112, "PgSparseVectorBuilder");
23564
- PgSparseVector = class extends (_b91 = PgColumn, _a113 = entityKind, _b91) {
23715
+ __publicField(PgSparseVectorBuilder, _a111, "PgSparseVectorBuilder");
23716
+ PgSparseVector = class extends (_b91 = PgColumn, _a112 = entityKind, _b91) {
23565
23717
  constructor() {
23566
23718
  super(...arguments);
23567
23719
  __publicField(this, "dimensions", this.config.dimensions);
@@ -23570,7 +23722,7 @@ var init_sparsevec = __esm({
23570
23722
  return `sparsevec(${this.dimensions})`;
23571
23723
  }
23572
23724
  };
23573
- __publicField(PgSparseVector, _a113, "PgSparseVector");
23725
+ __publicField(PgSparseVector, _a112, "PgSparseVector");
23574
23726
  }
23575
23727
  });
23576
23728
 
@@ -23579,14 +23731,14 @@ function vector(a, b) {
23579
23731
  const { name: name2, config } = getColumnNameAndConfig(a, b);
23580
23732
  return new PgVectorBuilder(name2, config);
23581
23733
  }
23582
- var _a114, _b92, PgVectorBuilder, _a115, _b93, PgVector;
23734
+ var _a113, _b92, PgVectorBuilder, _a114, _b93, PgVector;
23583
23735
  var init_vector2 = __esm({
23584
23736
  "../drizzle-orm/dist/pg-core/columns/vector_extension/vector.js"() {
23585
23737
  "use strict";
23586
23738
  init_entity();
23587
23739
  init_utils2();
23588
23740
  init_common2();
23589
- PgVectorBuilder = class extends (_b92 = PgColumnBuilder, _a114 = entityKind, _b92) {
23741
+ PgVectorBuilder = class extends (_b92 = PgColumnBuilder, _a113 = entityKind, _b92) {
23590
23742
  constructor(name2, config) {
23591
23743
  super(name2, "array", "PgVector");
23592
23744
  this.config.dimensions = config.dimensions;
@@ -23596,8 +23748,8 @@ var init_vector2 = __esm({
23596
23748
  return new PgVector(table4, this.config);
23597
23749
  }
23598
23750
  };
23599
- __publicField(PgVectorBuilder, _a114, "PgVectorBuilder");
23600
- PgVector = class extends (_b93 = PgColumn, _a115 = entityKind, _b93) {
23751
+ __publicField(PgVectorBuilder, _a113, "PgVectorBuilder");
23752
+ PgVector = class extends (_b93 = PgColumn, _a114 = entityKind, _b93) {
23601
23753
  constructor() {
23602
23754
  super(...arguments);
23603
23755
  __publicField(this, "dimensions", this.config.dimensions);
@@ -23612,7 +23764,7 @@ var init_vector2 = __esm({
23612
23764
  return value.slice(1, -1).split(",").map((v) => Number.parseFloat(v));
23613
23765
  }
23614
23766
  };
23615
- __publicField(PgVector, _a115, "PgVector");
23767
+ __publicField(PgVector, _a114, "PgVector");
23616
23768
  }
23617
23769
  });
23618
23770
 
@@ -23713,8 +23865,8 @@ function pgTableWithSchema(name2, columns, extraConfig, schema4, baseName = name
23713
23865
  })
23714
23866
  );
23715
23867
  const table4 = Object.assign(rawTable, builtColumns);
23716
- table4[Table.Symbol.Columns] = builtColumns;
23717
- table4[Table.Symbol.ExtraConfigColumns] = builtColumnsForExtraConfig;
23868
+ table4[Table2.Symbol.Columns] = builtColumns;
23869
+ table4[Table2.Symbol.ExtraConfigColumns] = builtColumnsForExtraConfig;
23718
23870
  if (extraConfig) {
23719
23871
  table4[PgTable.Symbol.ExtraConfigBuilder] = extraConfig;
23720
23872
  }
@@ -23725,7 +23877,7 @@ function pgTableWithSchema(name2, columns, extraConfig, schema4, baseName = name
23725
23877
  }
23726
23878
  });
23727
23879
  }
23728
- var InlineForeignKeys, EnableRLS, _a116, _b94, _c2, _d2, _e2, PgTable, pgTable;
23880
+ var InlineForeignKeys, EnableRLS, _a115, _b94, _c2, _d2, _e2, PgTable, pgTable;
23729
23881
  var init_table2 = __esm({
23730
23882
  "../drizzle-orm/dist/pg-core/table.js"() {
23731
23883
  "use strict";
@@ -23734,7 +23886,7 @@ var init_table2 = __esm({
23734
23886
  init_all();
23735
23887
  InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys");
23736
23888
  EnableRLS = Symbol.for("drizzle:EnableRLS");
23737
- PgTable = class extends (_e2 = Table, _d2 = entityKind, _c2 = InlineForeignKeys, _b94 = EnableRLS, _a116 = Table.Symbol.ExtraConfigBuilder, _e2) {
23889
+ PgTable = class extends (_e2 = Table2, _d2 = entityKind, _c2 = InlineForeignKeys, _b94 = EnableRLS, _a115 = Table2.Symbol.ExtraConfigBuilder, _e2) {
23738
23890
  constructor() {
23739
23891
  super(...arguments);
23740
23892
  /**@internal */
@@ -23742,12 +23894,12 @@ var init_table2 = __esm({
23742
23894
  /** @internal */
23743
23895
  __publicField(this, _b94, false);
23744
23896
  /** @internal */
23745
- __publicField(this, _a116);
23897
+ __publicField(this, _a115);
23746
23898
  }
23747
23899
  };
23748
23900
  __publicField(PgTable, _d2, "PgTable");
23749
23901
  /** @internal */
23750
- __publicField(PgTable, "Symbol", Object.assign({}, Table.Symbol, {
23902
+ __publicField(PgTable, "Symbol", Object.assign({}, Table2.Symbol, {
23751
23903
  InlineForeignKeys,
23752
23904
  EnableRLS
23753
23905
  }));
@@ -23758,13 +23910,13 @@ var init_table2 = __esm({
23758
23910
  });
23759
23911
 
23760
23912
  // ../drizzle-orm/dist/pg-core/primary-keys.js
23761
- var _a117, PrimaryKeyBuilder, _a118, PrimaryKey;
23913
+ var _a116, PrimaryKeyBuilder, _a117, PrimaryKey;
23762
23914
  var init_primary_keys = __esm({
23763
23915
  "../drizzle-orm/dist/pg-core/primary-keys.js"() {
23764
23916
  "use strict";
23765
23917
  init_entity();
23766
23918
  init_table2();
23767
- _a117 = entityKind;
23919
+ _a116 = entityKind;
23768
23920
  PrimaryKeyBuilder = class {
23769
23921
  constructor(columns, name2) {
23770
23922
  /** @internal */
@@ -23779,8 +23931,8 @@ var init_primary_keys = __esm({
23779
23931
  return new PrimaryKey(table4, this.columns, this.name);
23780
23932
  }
23781
23933
  };
23782
- __publicField(PrimaryKeyBuilder, _a117, "PgPrimaryKeyBuilder");
23783
- _a118 = entityKind;
23934
+ __publicField(PrimaryKeyBuilder, _a116, "PgPrimaryKeyBuilder");
23935
+ _a117 = entityKind;
23784
23936
  PrimaryKey = class {
23785
23937
  constructor(table4, columns, name2) {
23786
23938
  __publicField(this, "columns");
@@ -23793,7 +23945,7 @@ var init_primary_keys = __esm({
23793
23945
  return this.name ?? `${this.table[PgTable.Symbol.Name]}_${this.columns.map((column4) => column4.name).join("_")}_pk`;
23794
23946
  }
23795
23947
  };
23796
- __publicField(PrimaryKey, _a118, "PgPrimaryKey");
23948
+ __publicField(PrimaryKey, _a117, "PgPrimaryKey");
23797
23949
  }
23798
23950
  });
23799
23951
 
@@ -23832,33 +23984,33 @@ function getOrderByOperators() {
23832
23984
  };
23833
23985
  }
23834
23986
  function extractTablesRelationalConfig(schema4, configHelpers) {
23835
- if (Object.keys(schema4).length === 1 && "default" in schema4 && !is(schema4["default"], Table)) {
23987
+ if (Object.keys(schema4).length === 1 && "default" in schema4 && !is(schema4["default"], Table2)) {
23836
23988
  schema4 = schema4["default"];
23837
23989
  }
23838
23990
  const tableNamesMap = {};
23839
23991
  const relationsBuffer = {};
23840
23992
  const tablesConfig = {};
23841
23993
  for (const [key, value] of Object.entries(schema4)) {
23842
- if (is(value, Table)) {
23994
+ if (is(value, Table2)) {
23843
23995
  const dbName = getTableUniqueName(value);
23844
23996
  const bufferedRelations = relationsBuffer[dbName];
23845
23997
  tableNamesMap[dbName] = key;
23846
23998
  tablesConfig[key] = {
23847
23999
  tsName: key,
23848
- dbName: value[Table.Symbol.Name],
23849
- schema: value[Table.Symbol.Schema],
23850
- columns: value[Table.Symbol.Columns],
24000
+ dbName: value[Table2.Symbol.Name],
24001
+ schema: value[Table2.Symbol.Schema],
24002
+ columns: value[Table2.Symbol.Columns],
23851
24003
  relations: bufferedRelations?.relations ?? {},
23852
24004
  primaryKey: bufferedRelations?.primaryKey ?? []
23853
24005
  };
23854
24006
  for (const column4 of Object.values(
23855
- value[Table.Symbol.Columns]
24007
+ value[Table2.Symbol.Columns]
23856
24008
  )) {
23857
24009
  if (column4.primary) {
23858
24010
  tablesConfig[key].primaryKey.push(column4);
23859
24011
  }
23860
24012
  }
23861
- const extraConfig = value[Table.Symbol.ExtraConfigBuilder]?.(value[Table.Symbol.ExtraConfigColumns]);
24013
+ const extraConfig = value[Table2.Symbol.ExtraConfigBuilder]?.(value[Table2.Symbol.ExtraConfigColumns]);
23862
24014
  if (extraConfig) {
23863
24015
  for (const configEntry of Object.values(extraConfig)) {
23864
24016
  if (is(configEntry, PrimaryKeyBuilder)) {
@@ -23930,7 +24082,7 @@ function normalizeRelation(schema4, tableNamesMap, relation) {
23930
24082
  const referencedTableTsName = tableNamesMap[getTableUniqueName(relation.referencedTable)];
23931
24083
  if (!referencedTableTsName) {
23932
24084
  throw new Error(
23933
- `Table "${relation.referencedTable[Table.Symbol.Name]}" not found in schema`
24085
+ `Table "${relation.referencedTable[Table2.Symbol.Name]}" not found in schema`
23934
24086
  );
23935
24087
  }
23936
24088
  const referencedTableConfig = schema4[referencedTableTsName];
@@ -23941,7 +24093,7 @@ function normalizeRelation(schema4, tableNamesMap, relation) {
23941
24093
  const sourceTableTsName = tableNamesMap[getTableUniqueName(sourceTable)];
23942
24094
  if (!sourceTableTsName) {
23943
24095
  throw new Error(
23944
- `Table "${sourceTable[Table.Symbol.Name]}" not found in schema`
24096
+ `Table "${sourceTable[Table2.Symbol.Name]}" not found in schema`
23945
24097
  );
23946
24098
  }
23947
24099
  const reverseRelations = [];
@@ -23956,7 +24108,7 @@ function normalizeRelation(schema4, tableNamesMap, relation) {
23956
24108
  throw relation.relationName ? new Error(
23957
24109
  `There are multiple relations with name "${relation.relationName}" in table "${referencedTableTsName}"`
23958
24110
  ) : new Error(
23959
- `There are multiple relations between "${referencedTableTsName}" and "${relation.sourceTable[Table.Symbol.Name]}". Please specify relation name`
24111
+ `There are multiple relations between "${referencedTableTsName}" and "${relation.sourceTable[Table2.Symbol.Name]}". Please specify relation name`
23960
24112
  );
23961
24113
  }
23962
24114
  if (reverseRelations[0] && is(reverseRelations[0], One) && reverseRelations[0].config) {
@@ -24016,7 +24168,7 @@ function mapRelationalRow(tablesConfig, tableConfig, row, buildQueryResultSelect
24016
24168
  }
24017
24169
  return result;
24018
24170
  }
24019
- var _a119, Relation, _a120, Relations, _a121, _b95, _One, One, _a122, _b96, _Many, Many;
24171
+ var _a118, Relation, _a119, Relations, _a120, _b95, _One, One, _a121, _b96, _Many, Many;
24020
24172
  var init_relations = __esm({
24021
24173
  "../drizzle-orm/dist/relations.js"() {
24022
24174
  "use strict";
@@ -24026,7 +24178,7 @@ var init_relations = __esm({
24026
24178
  init_primary_keys();
24027
24179
  init_expressions();
24028
24180
  init_sql();
24029
- _a119 = entityKind;
24181
+ _a118 = entityKind;
24030
24182
  Relation = class {
24031
24183
  constructor(sourceTable, referencedTable, relationName) {
24032
24184
  __publicField(this, "referencedTableName");
@@ -24034,19 +24186,19 @@ var init_relations = __esm({
24034
24186
  this.sourceTable = sourceTable;
24035
24187
  this.referencedTable = referencedTable;
24036
24188
  this.relationName = relationName;
24037
- this.referencedTableName = referencedTable[Table.Symbol.Name];
24189
+ this.referencedTableName = referencedTable[Table2.Symbol.Name];
24038
24190
  }
24039
24191
  };
24040
- __publicField(Relation, _a119, "Relation");
24041
- _a120 = entityKind;
24192
+ __publicField(Relation, _a118, "Relation");
24193
+ _a119 = entityKind;
24042
24194
  Relations = class {
24043
24195
  constructor(table4, config) {
24044
24196
  this.table = table4;
24045
24197
  this.config = config;
24046
24198
  }
24047
24199
  };
24048
- __publicField(Relations, _a120, "Relations");
24049
- _One = class _One extends (_b95 = Relation, _a121 = entityKind, _b95) {
24200
+ __publicField(Relations, _a119, "Relations");
24201
+ _One = class _One extends (_b95 = Relation, _a120 = entityKind, _b95) {
24050
24202
  constructor(sourceTable, referencedTable, config, isNullable) {
24051
24203
  super(sourceTable, referencedTable, config?.relationName);
24052
24204
  this.config = config;
@@ -24063,9 +24215,9 @@ var init_relations = __esm({
24063
24215
  return relation;
24064
24216
  }
24065
24217
  };
24066
- __publicField(_One, _a121, "One");
24218
+ __publicField(_One, _a120, "One");
24067
24219
  One = _One;
24068
- _Many = class _Many extends (_b96 = Relation, _a122 = entityKind, _b96) {
24220
+ _Many = class _Many extends (_b96 = Relation, _a121 = entityKind, _b96) {
24069
24221
  constructor(sourceTable, referencedTable, config) {
24070
24222
  super(sourceTable, referencedTable, config?.relationName);
24071
24223
  this.config = config;
@@ -24080,7 +24232,7 @@ var init_relations = __esm({
24080
24232
  return relation;
24081
24233
  }
24082
24234
  };
24083
- __publicField(_Many, _a122, "Many");
24235
+ __publicField(_Many, _a121, "Many");
24084
24236
  Many = _Many;
24085
24237
  }
24086
24238
  });
@@ -24215,7 +24367,7 @@ __export(dist_exports, {
24215
24367
  Schema: () => Schema,
24216
24368
  StringChunk: () => StringChunk,
24217
24369
  Subquery: () => Subquery,
24218
- Table: () => Table,
24370
+ Table: () => Table2,
24219
24371
  TableAliasProxyHandler: () => TableAliasProxyHandler,
24220
24372
  TransactionRollbackError: () => TransactionRollbackError,
24221
24373
  View: () => View3,
@@ -24331,12 +24483,12 @@ var init_alias2 = __esm({
24331
24483
  });
24332
24484
 
24333
24485
  // ../drizzle-orm/dist/pg-core/checks.js
24334
- var _a123, CheckBuilder, _a124, Check;
24486
+ var _a122, CheckBuilder, _a123, Check;
24335
24487
  var init_checks = __esm({
24336
24488
  "../drizzle-orm/dist/pg-core/checks.js"() {
24337
24489
  "use strict";
24338
24490
  init_entity();
24339
- _a123 = entityKind;
24491
+ _a122 = entityKind;
24340
24492
  CheckBuilder = class {
24341
24493
  constructor(name2, value) {
24342
24494
  __publicField(this, "brand");
@@ -24348,8 +24500,8 @@ var init_checks = __esm({
24348
24500
  return new Check(table4, this);
24349
24501
  }
24350
24502
  };
24351
- __publicField(CheckBuilder, _a123, "PgCheckBuilder");
24352
- _a124 = entityKind;
24503
+ __publicField(CheckBuilder, _a122, "PgCheckBuilder");
24504
+ _a123 = entityKind;
24353
24505
  Check = class {
24354
24506
  constructor(table4, builder) {
24355
24507
  __publicField(this, "name");
@@ -24359,7 +24511,7 @@ var init_checks = __esm({
24359
24511
  this.value = builder.value;
24360
24512
  }
24361
24513
  };
24362
- __publicField(Check, _a124, "PgCheck");
24514
+ __publicField(Check, _a123, "PgCheck");
24363
24515
  }
24364
24516
  });
24365
24517
 
@@ -24406,7 +24558,7 @@ var init_columns = __esm({
24406
24558
  });
24407
24559
 
24408
24560
  // ../drizzle-orm/dist/pg-core/query-builders/delete.js
24409
- var _a125, _b97, PgDeleteBase;
24561
+ var _a124, _b97, PgDeleteBase;
24410
24562
  var init_delete = __esm({
24411
24563
  "../drizzle-orm/dist/pg-core/query-builders/delete.js"() {
24412
24564
  "use strict";
@@ -24415,7 +24567,7 @@ var init_delete = __esm({
24415
24567
  init_table();
24416
24568
  init_tracing();
24417
24569
  init_utils2();
24418
- PgDeleteBase = class extends (_b97 = QueryPromise, _a125 = entityKind, _b97) {
24570
+ PgDeleteBase = class extends (_b97 = QueryPromise, _a124 = entityKind, _b97) {
24419
24571
  constructor(table4, session, dialect4, withList) {
24420
24572
  super();
24421
24573
  __publicField(this, "config");
@@ -24461,7 +24613,7 @@ var init_delete = __esm({
24461
24613
  this.config.where = where;
24462
24614
  return this;
24463
24615
  }
24464
- returning(fields = this.config.table[Table.Symbol.Columns]) {
24616
+ returning(fields = this.config.table[Table2.Symbol.Columns]) {
24465
24617
  this.config.returning = orderSelectedFields(fields);
24466
24618
  return this;
24467
24619
  }
@@ -24486,12 +24638,12 @@ var init_delete = __esm({
24486
24638
  return this;
24487
24639
  }
24488
24640
  };
24489
- __publicField(PgDeleteBase, _a125, "PgDelete");
24641
+ __publicField(PgDeleteBase, _a124, "PgDelete");
24490
24642
  }
24491
24643
  });
24492
24644
 
24493
24645
  // ../drizzle-orm/dist/pg-core/query-builders/insert.js
24494
- var _a126, PgInsertBuilder, _a127, _b98, PgInsertBase;
24646
+ var _a125, PgInsertBuilder, _a126, _b98, PgInsertBase;
24495
24647
  var init_insert = __esm({
24496
24648
  "../drizzle-orm/dist/pg-core/query-builders/insert.js"() {
24497
24649
  "use strict";
@@ -24501,7 +24653,7 @@ var init_insert = __esm({
24501
24653
  init_table();
24502
24654
  init_tracing();
24503
24655
  init_utils2();
24504
- _a126 = entityKind;
24656
+ _a125 = entityKind;
24505
24657
  PgInsertBuilder = class {
24506
24658
  constructor(table4, session, dialect4, withList) {
24507
24659
  this.table = table4;
@@ -24516,7 +24668,7 @@ var init_insert = __esm({
24516
24668
  }
24517
24669
  const mappedValues = values.map((entry) => {
24518
24670
  const result = {};
24519
- const cols = this.table[Table.Symbol.Columns];
24671
+ const cols = this.table[Table2.Symbol.Columns];
24520
24672
  for (const colKey of Object.keys(entry)) {
24521
24673
  const colValue = entry[colKey];
24522
24674
  result[colKey] = is(colValue, SQL) ? colValue : new Param(colValue, cols[colKey]);
@@ -24526,8 +24678,8 @@ var init_insert = __esm({
24526
24678
  return new PgInsertBase(this.table, mappedValues, this.session, this.dialect, this.withList);
24527
24679
  }
24528
24680
  };
24529
- __publicField(PgInsertBuilder, _a126, "PgInsertBuilder");
24530
- PgInsertBase = class extends (_b98 = QueryPromise, _a127 = entityKind, _b98) {
24681
+ __publicField(PgInsertBuilder, _a125, "PgInsertBuilder");
24682
+ PgInsertBase = class extends (_b98 = QueryPromise, _a126 = entityKind, _b98) {
24531
24683
  constructor(table4, values, session, dialect4, withList) {
24532
24684
  super();
24533
24685
  __publicField(this, "config");
@@ -24540,7 +24692,7 @@ var init_insert = __esm({
24540
24692
  this.dialect = dialect4;
24541
24693
  this.config = { table: table4, values, withList };
24542
24694
  }
24543
- returning(fields = this.config.table[Table.Symbol.Columns]) {
24695
+ returning(fields = this.config.table[Table2.Symbol.Columns]) {
24544
24696
  this.config.returning = orderSelectedFields(fields);
24545
24697
  return this;
24546
24698
  }
@@ -24642,7 +24794,69 @@ var init_insert = __esm({
24642
24794
  return this;
24643
24795
  }
24644
24796
  };
24645
- __publicField(PgInsertBase, _a127, "PgInsert");
24797
+ __publicField(PgInsertBase, _a126, "PgInsert");
24798
+ }
24799
+ });
24800
+
24801
+ // ../drizzle-orm/dist/casing.js
24802
+ function toSnakeCase(input) {
24803
+ const words = input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? [];
24804
+ return words.map((word) => word.toLowerCase()).join("_");
24805
+ }
24806
+ function toCamelCase(input) {
24807
+ const words = input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? [];
24808
+ return words.reduce((acc, word, i) => {
24809
+ const formattedWord = i === 0 ? word.toLowerCase() : `${word[0].toUpperCase()}${word.slice(1)}`;
24810
+ return acc + formattedWord;
24811
+ }, "");
24812
+ }
24813
+ function noopCase(input) {
24814
+ return input;
24815
+ }
24816
+ var _a127, CasingCache;
24817
+ var init_casing = __esm({
24818
+ "../drizzle-orm/dist/casing.js"() {
24819
+ "use strict";
24820
+ init_entity();
24821
+ init_table();
24822
+ _a127 = entityKind;
24823
+ CasingCache = class {
24824
+ constructor(casing2) {
24825
+ /** @internal */
24826
+ __publicField(this, "cache", {});
24827
+ __publicField(this, "cachedTables", {});
24828
+ __publicField(this, "convert");
24829
+ this.convert = casing2 === "snake_case" ? toSnakeCase : casing2 === "camelCase" ? toCamelCase : noopCase;
24830
+ }
24831
+ getColumnCasing(column4) {
24832
+ if (!column4.keyAsName)
24833
+ return column4.name;
24834
+ const schema4 = column4.table[Table2.Symbol.Schema] ?? "public";
24835
+ const tableName = column4.table[Table2.Symbol.OriginalName];
24836
+ const key = `${schema4}.${tableName}.${column4.name}`;
24837
+ if (!this.cache[key]) {
24838
+ this.cacheTable(column4.table);
24839
+ }
24840
+ return this.cache[key];
24841
+ }
24842
+ cacheTable(table4) {
24843
+ const schema4 = table4[Table2.Symbol.Schema] ?? "public";
24844
+ const tableName = table4[Table2.Symbol.OriginalName];
24845
+ const tableKey2 = `${schema4}.${tableName}`;
24846
+ if (!this.cachedTables[tableKey2]) {
24847
+ for (const column4 of Object.values(table4[Table2.Symbol.Columns])) {
24848
+ const columnKey = `${tableKey2}.${column4.name}`;
24849
+ this.cache[columnKey] = this.convert(column4.name);
24850
+ }
24851
+ this.cachedTables[tableKey2] = true;
24852
+ }
24853
+ }
24854
+ clearCache() {
24855
+ this.cache = {};
24856
+ this.cachedTables = {};
24857
+ }
24858
+ };
24859
+ __publicField(CasingCache, _a127, "CasingCache");
24646
24860
  }
24647
24861
  });
24648
24862
 
@@ -24744,7 +24958,7 @@ var init_dialect = __esm({
24744
24958
  return sql`${withSql}delete from ${table4}${whereSql}${returningSql}`;
24745
24959
  }
24746
24960
  buildUpdateSet(table4, set) {
24747
- const tableColumns = table4[Table.Symbol.Columns];
24961
+ const tableColumns = table4[Table2.Symbol.Columns];
24748
24962
  const columnNames = Object.keys(tableColumns).filter(
24749
24963
  (colName) => set[colName] !== void 0 || tableColumns[colName]?.onUpdateFn !== void 0
24750
24964
  );
@@ -24835,7 +25049,7 @@ var init_dialect = __esm({
24835
25049
  const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
24836
25050
  for (const f of fieldsList) {
24837
25051
  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(
24838
- ({ alias }) => alias === (table22[Table.Symbol.IsAlias] ? getTableName(table22) : table22[Table.Symbol.BaseName])
25052
+ ({ alias }) => alias === (table22[Table2.Symbol.IsAlias] ? getTableName(table22) : table22[Table2.Symbol.BaseName])
24839
25053
  ))(f.field.table)) {
24840
25054
  const tableName = getTableName(f.field.table);
24841
25055
  throw new Error(
@@ -24851,12 +25065,12 @@ var init_dialect = __esm({
24851
25065
  }
24852
25066
  const selection = this.buildSelection(fieldsList, { isSingleTable });
24853
25067
  const tableSql = (() => {
24854
- if (is(table4, Table) && table4[Table.Symbol.OriginalName] !== table4[Table.Symbol.Name]) {
24855
- let fullName = sql`${sql.identifier(table4[Table.Symbol.OriginalName])}`;
24856
- if (table4[Table.Symbol.Schema]) {
24857
- fullName = sql`${sql.identifier(table4[Table.Symbol.Schema])}.${fullName}`;
25068
+ if (is(table4, Table2) && table4[Table2.Symbol.OriginalName] !== table4[Table2.Symbol.Name]) {
25069
+ let fullName = sql`${sql.identifier(table4[Table2.Symbol.OriginalName])}`;
25070
+ if (table4[Table2.Symbol.Schema]) {
25071
+ fullName = sql`${sql.identifier(table4[Table2.Symbol.Schema])}.${fullName}`;
24858
25072
  }
24859
- return sql`${fullName} ${sql.identifier(table4[Table.Symbol.Name])}`;
25073
+ return sql`${fullName} ${sql.identifier(table4[Table2.Symbol.Name])}`;
24860
25074
  }
24861
25075
  return table4;
24862
25076
  })();
@@ -24977,7 +25191,7 @@ var init_dialect = __esm({
24977
25191
  }
24978
25192
  buildInsertQuery({ table: table4, values, onConflict, returning, withList }) {
24979
25193
  const valuesSqlList = [];
24980
- const columns = table4[Table.Symbol.Columns];
25194
+ const columns = table4[Table2.Symbol.Columns];
24981
25195
  const colEntries = Object.entries(columns).filter(([_2, col]) => !col.shouldDisableInsert());
24982
25196
  const insertOrder = colEntries.map(
24983
25197
  ([, column4]) => sql.identifier(this.casing.getColumnCasing(column4))
@@ -26272,7 +26486,7 @@ var init_select2 = __esm({
26272
26486
  };
26273
26487
  }
26274
26488
  if (typeof tableName === "string" && !is(table4, SQL)) {
26275
- const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View3) ? table4[ViewBaseConfig].selectedFields : table4[Table.Symbol.Columns];
26489
+ const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View3) ? table4[ViewBaseConfig].selectedFields : table4[Table2.Symbol.Columns];
26276
26490
  this.config.fields[tableName] = selection;
26277
26491
  }
26278
26492
  }
@@ -26822,7 +27036,7 @@ var init_update = __esm({
26822
27036
  this.config.where = where;
26823
27037
  return this;
26824
27038
  }
26825
- returning(fields = this.config.table[Table.Symbol.Columns]) {
27039
+ returning(fields = this.config.table[Table2.Symbol.Columns]) {
26826
27040
  this.config.returning = orderSelectedFields(fields);
26827
27041
  return this;
26828
27042
  }
@@ -27491,6 +27705,8 @@ var init_policies = __esm({
27491
27705
  __publicField(this, "to");
27492
27706
  __publicField(this, "using");
27493
27707
  __publicField(this, "withCheck");
27708
+ /** @internal */
27709
+ __publicField(this, "_linkedTable");
27494
27710
  this.name = name2;
27495
27711
  if (config) {
27496
27712
  this.as = config.as;
@@ -27500,6 +27716,10 @@ var init_policies = __esm({
27500
27716
  this.withCheck = config.withCheck;
27501
27717
  }
27502
27718
  }
27719
+ link(table4) {
27720
+ this._linkedTable = table4;
27721
+ return this;
27722
+ }
27503
27723
  };
27504
27724
  __publicField(PgPolicy, _a147, "PgPolicy");
27505
27725
  }
@@ -27970,19 +28190,19 @@ var init_subquery2 = __esm({
27970
28190
 
27971
28191
  // ../drizzle-orm/dist/pg-core/utils.js
27972
28192
  function getTableConfig(table4) {
27973
- const columns = Object.values(table4[Table.Symbol.Columns]);
28193
+ const columns = Object.values(table4[Table2.Symbol.Columns]);
27974
28194
  const indexes = [];
27975
28195
  const checks = [];
27976
28196
  const primaryKeys = [];
27977
28197
  const foreignKeys = Object.values(table4[PgTable.Symbol.InlineForeignKeys]);
27978
28198
  const uniqueConstraints = [];
27979
- const name2 = table4[Table.Symbol.Name];
27980
- const schema4 = table4[Table.Symbol.Schema];
28199
+ const name2 = table4[Table2.Symbol.Name];
28200
+ const schema4 = table4[Table2.Symbol.Schema];
27981
28201
  const policies = [];
27982
28202
  const enableRLS = table4[PgTable.Symbol.EnableRLS];
27983
28203
  const extraConfigBuilder = table4[PgTable.Symbol.ExtraConfigBuilder];
27984
28204
  if (extraConfigBuilder !== void 0) {
27985
- const extraConfig = extraConfigBuilder(table4[Table.Symbol.ExtraConfigColumns]);
28205
+ const extraConfig = extraConfigBuilder(table4[Table2.Symbol.ExtraConfigColumns]);
27986
28206
  const extraValues = Array.isArray(extraConfig) ? extraConfig.flat(1) : Object.values(extraConfig);
27987
28207
  for (const builder of extraValues) {
27988
28208
  if (is(builder, IndexBuilder)) {
@@ -28079,6 +28299,33 @@ var init_pg_core = __esm({
28079
28299
  }
28080
28300
  });
28081
28301
 
28302
+ // src/serializer/utils.ts
28303
+ function getColumnCasing(column4, casing2) {
28304
+ if (!column4.name) return "";
28305
+ return !column4.keyAsName || casing2 === void 0 ? column4.name : casing2 === "camelCase" ? toCamelCase(column4.name) : toSnakeCase(column4.name);
28306
+ }
28307
+ var sqlToStr;
28308
+ var init_utils6 = __esm({
28309
+ "src/serializer/utils.ts"() {
28310
+ "use strict";
28311
+ init_casing();
28312
+ sqlToStr = (sql2, casing2) => {
28313
+ return sql2.toQuery({
28314
+ escapeName: () => {
28315
+ throw new Error("we don't support params for `sql` default values");
28316
+ },
28317
+ escapeParam: () => {
28318
+ throw new Error("we don't support params for `sql` default values");
28319
+ },
28320
+ escapeString: () => {
28321
+ throw new Error("we don't support params for `sql` default values");
28322
+ },
28323
+ casing: new CasingCache(casing2)
28324
+ }).sql;
28325
+ };
28326
+ }
28327
+ });
28328
+
28082
28329
  // src/serializer/pgSerializer.ts
28083
28330
  function stringFromIdentityProperty(field) {
28084
28331
  return typeof field === "string" ? field : typeof field === "undefined" ? void 0 : String(field);
@@ -28157,20 +28404,20 @@ var init_pgSerializer = __esm({
28157
28404
  init_source();
28158
28405
  init_dist();
28159
28406
  init_pg_core();
28160
- init_pg_core();
28161
28407
  init_vector();
28162
28408
  init_outputs();
28163
28409
  init_utils();
28164
- init_serializer();
28410
+ init_utils6();
28165
28411
  indexName = (tableName, columns) => {
28166
28412
  return `${tableName}_${columns.join("_")}_index`;
28167
28413
  };
28168
- generatePgSnapshot = (tables, enums, schemas, sequences, roles, views, matViews, casing2, schemaFilter) => {
28414
+ generatePgSnapshot = (tables, enums, schemas, sequences, roles, policies, views, matViews, casing2, schemaFilter) => {
28169
28415
  const dialect4 = new PgDialect({ casing: casing2 });
28170
28416
  const result = {};
28171
28417
  const resultViews = {};
28172
28418
  const sequencesToReturn = {};
28173
28419
  const rolesToReturn = {};
28420
+ const policiesToReturn = {};
28174
28421
  const indexesInSchema = {};
28175
28422
  for (const table4 of tables) {
28176
28423
  const checksInTable = {};
@@ -28183,7 +28430,7 @@ var init_pgSerializer = __esm({
28183
28430
  schema: schema4,
28184
28431
  primaryKeys,
28185
28432
  uniqueConstraints,
28186
- policies,
28433
+ policies: policies2,
28187
28434
  enableRLS
28188
28435
  } = getTableConfig(table4);
28189
28436
  if (schemaFilter && !schemaFilter.includes(schema4 ?? "public")) {
@@ -28443,17 +28690,17 @@ ${withStyle.errorWarning(
28443
28690
  with: value.config.with ?? {}
28444
28691
  };
28445
28692
  });
28446
- policies.forEach((policy2) => {
28693
+ policies2.forEach((policy4) => {
28447
28694
  const mappedTo = [];
28448
- if (!policy2.to) {
28695
+ if (!policy4.to) {
28449
28696
  mappedTo.push("public");
28450
28697
  } else {
28451
- if (policy2.to && typeof policy2.to === "string") {
28452
- mappedTo.push(policy2.to);
28453
- } else if (policy2.to && is(policy2.to, PgRole)) {
28454
- mappedTo.push(policy2.to.name);
28455
- } else if (policy2.to && Array.isArray(policy2.to)) {
28456
- policy2.to.forEach((it) => {
28698
+ if (policy4.to && typeof policy4.to === "string") {
28699
+ mappedTo.push(policy4.to);
28700
+ } else if (policy4.to && is(policy4.to, PgRole)) {
28701
+ mappedTo.push(policy4.to.name);
28702
+ } else if (policy4.to && Array.isArray(policy4.to)) {
28703
+ policy4.to.forEach((it) => {
28457
28704
  if (typeof it === "string") {
28458
28705
  mappedTo.push(it);
28459
28706
  } else if (is(it, PgRole)) {
@@ -28462,13 +28709,24 @@ ${withStyle.errorWarning(
28462
28709
  });
28463
28710
  }
28464
28711
  }
28465
- policiesObject[policy2.name] = {
28466
- name: policy2.name,
28467
- as: policy2.as?.toUpperCase() ?? "PERMISSIVE",
28468
- for: policy2.for?.toUpperCase() ?? "ALL",
28712
+ if (policiesObject[policy4.name] !== void 0) {
28713
+ console.log(
28714
+ `
28715
+ ${withStyle.errorWarning(
28716
+ `We've found duplicated policy name across ${source_default.underline.blue(tableKey2)} table. Please rename one of the policies with ${source_default.underline.blue(
28717
+ policy4.name
28718
+ )} name`
28719
+ )}`
28720
+ );
28721
+ process.exit(1);
28722
+ }
28723
+ policiesObject[policy4.name] = {
28724
+ name: policy4.name,
28725
+ as: policy4.as?.toUpperCase() ?? "PERMISSIVE",
28726
+ for: policy4.for?.toUpperCase() ?? "ALL",
28469
28727
  to: mappedTo.sort(),
28470
- using: is(policy2.using, SQL) ? dialect4.sqlToQuery(policy2.using).sql : void 0,
28471
- withCheck: is(policy2.withCheck, SQL) ? dialect4.sqlToQuery(policy2.withCheck).sql : void 0
28728
+ using: is(policy4.using, SQL) ? dialect4.sqlToQuery(policy4.using).sql : void 0,
28729
+ withCheck: is(policy4.withCheck, SQL) ? dialect4.sqlToQuery(policy4.withCheck).sql : void 0
28472
28730
  };
28473
28731
  });
28474
28732
  checks.forEach((check) => {
@@ -28512,6 +28770,64 @@ ${withStyle.errorWarning(
28512
28770
  isRLSEnabled: enableRLS
28513
28771
  };
28514
28772
  }
28773
+ for (const policy4 of policies) {
28774
+ if (!policy4._linkedTable) {
28775
+ console.log(
28776
+ `
28777
+ ${withStyle.errorWarning(
28778
+ `"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:`
28779
+ )}`
28780
+ );
28781
+ continue;
28782
+ }
28783
+ const tableConfig = getTableConfig(policy4._linkedTable);
28784
+ const tableKey2 = `${tableConfig.schema ?? "public"}.${tableConfig.name}`;
28785
+ const mappedTo = [];
28786
+ if (!policy4.to) {
28787
+ mappedTo.push("public");
28788
+ } else {
28789
+ if (policy4.to && typeof policy4.to === "string") {
28790
+ mappedTo.push(policy4.to);
28791
+ } else if (policy4.to && is(policy4.to, PgRole)) {
28792
+ mappedTo.push(policy4.to.name);
28793
+ } else if (policy4.to && Array.isArray(policy4.to)) {
28794
+ policy4.to.forEach((it) => {
28795
+ if (typeof it === "string") {
28796
+ mappedTo.push(it);
28797
+ } else if (is(it, PgRole)) {
28798
+ mappedTo.push(it.name);
28799
+ }
28800
+ });
28801
+ }
28802
+ }
28803
+ if (result[tableKey2]?.policies[policy4.name] !== void 0 || policiesToReturn[policy4.name] !== void 0) {
28804
+ console.log(
28805
+ `
28806
+ ${withStyle.errorWarning(
28807
+ `We've found duplicated policy name across ${source_default.underline.blue(tableKey2)} table. Please rename one of the policies with ${source_default.underline.blue(
28808
+ policy4.name
28809
+ )} name`
28810
+ )}`
28811
+ );
28812
+ process.exit(1);
28813
+ }
28814
+ const mappedPolicy = {
28815
+ name: policy4.name,
28816
+ as: policy4.as?.toUpperCase() ?? "PERMISSIVE",
28817
+ for: policy4.for?.toUpperCase() ?? "ALL",
28818
+ to: mappedTo.sort(),
28819
+ using: is(policy4.using, SQL) ? dialect4.sqlToQuery(policy4.using).sql : void 0,
28820
+ withCheck: is(policy4.withCheck, SQL) ? dialect4.sqlToQuery(policy4.withCheck).sql : void 0
28821
+ };
28822
+ if (result[tableKey2]) {
28823
+ result[tableKey2].policies[policy4.name] = mappedPolicy;
28824
+ } else {
28825
+ policiesToReturn[policy4.name] = {
28826
+ ...mappedPolicy,
28827
+ on: `"${tableConfig.schema ?? "public"}"."${tableConfig.name}"`
28828
+ };
28829
+ }
28830
+ }
28515
28831
  for (const sequence of sequences) {
28516
28832
  const name2 = sequence.seqName;
28517
28833
  if (typeof sequencesToReturn[`${sequence.schema ?? "public"}.${name2}`] === "undefined") {
@@ -28700,6 +29016,7 @@ ${withStyle.errorWarning(
28700
29016
  schemas: schemasObject,
28701
29017
  sequences: sequencesToReturn,
28702
29018
  roles: rolesToReturn,
29019
+ policies: policiesToReturn,
28703
29020
  views: resultViews,
28704
29021
  _meta: {
28705
29022
  schemas: {},
@@ -28849,7 +29166,7 @@ WHERE
28849
29166
  for (const dbPolicy of allPolicies) {
28850
29167
  const { tablename, schemaname, to, withCheck, using, ...rest } = dbPolicy;
28851
29168
  const tableForPolicy = policiesByTable[`${schemaname}.${tablename}`];
28852
- const parsedTo = to;
29169
+ const parsedTo = typeof to === "string" ? to.slice(1, -1).split(",") : to;
28853
29170
  const parsedWithCheck = withCheck === null ? void 0 : withCheck;
28854
29171
  const parsedUsing = using === null ? void 0 : using;
28855
29172
  if (tableForPolicy) {
@@ -29451,6 +29768,7 @@ WHERE
29451
29768
  schemas: schemasObject,
29452
29769
  sequences: sequencesToReturn,
29453
29770
  roles: rolesToReturn,
29771
+ policies: {},
29454
29772
  views,
29455
29773
  _meta: {
29456
29774
  schemas: {},
@@ -30308,8 +30626,8 @@ function sqliteTableBase(name2, columns, extraConfig, schema4, baseName = name2)
30308
30626
  })
30309
30627
  );
30310
30628
  const table4 = Object.assign(rawTable, builtColumns);
30311
- table4[Table.Symbol.Columns] = builtColumns;
30312
- table4[Table.Symbol.ExtraConfigColumns] = builtColumns;
30629
+ table4[Table2.Symbol.Columns] = builtColumns;
30630
+ table4[Table2.Symbol.ExtraConfigColumns] = builtColumns;
30313
30631
  if (extraConfig) {
30314
30632
  table4[SQLiteTable.Symbol.ExtraConfigBuilder] = extraConfig;
30315
30633
  }
@@ -30323,7 +30641,7 @@ var init_table3 = __esm({
30323
30641
  init_table();
30324
30642
  init_all2();
30325
30643
  InlineForeignKeys2 = Symbol.for("drizzle:SQLiteInlineForeignKeys");
30326
- SQLiteTable = class extends (_e3 = Table, _d3 = entityKind, _c6 = Table.Symbol.Columns, _b140 = InlineForeignKeys2, _a195 = Table.Symbol.ExtraConfigBuilder, _e3) {
30644
+ SQLiteTable = class extends (_e3 = Table2, _d3 = entityKind, _c6 = Table2.Symbol.Columns, _b140 = InlineForeignKeys2, _a195 = Table2.Symbol.ExtraConfigBuilder, _e3) {
30327
30645
  constructor() {
30328
30646
  super(...arguments);
30329
30647
  /** @internal */
@@ -30336,7 +30654,7 @@ var init_table3 = __esm({
30336
30654
  };
30337
30655
  __publicField(SQLiteTable, _d3, "SQLiteTable");
30338
30656
  /** @internal */
30339
- __publicField(SQLiteTable, "Symbol", Object.assign({}, Table.Symbol, {
30657
+ __publicField(SQLiteTable, "Symbol", Object.assign({}, Table2.Symbol, {
30340
30658
  InlineForeignKeys: InlineForeignKeys2
30341
30659
  }));
30342
30660
  sqliteTable = (name2, columns, extraConfig) => {
@@ -30415,7 +30733,7 @@ var init_delete2 = __esm({
30415
30733
  if (typeof columns[0] === "function") {
30416
30734
  const orderBy = columns[0](
30417
30735
  new Proxy(
30418
- this.config.table[Table.Symbol.Columns],
30736
+ this.config.table[Table2.Symbol.Columns],
30419
30737
  new SelectionProxyHandler({ sqlAliasedBehavior: "alias", sqlBehavior: "sql" })
30420
30738
  )
30421
30739
  );
@@ -30492,7 +30810,7 @@ var init_insert2 = __esm({
30492
30810
  }
30493
30811
  const mappedValues = values.map((entry) => {
30494
30812
  const result = {};
30495
- const cols = this.table[Table.Symbol.Columns];
30813
+ const cols = this.table[Table2.Symbol.Columns];
30496
30814
  for (const colKey of Object.keys(entry)) {
30497
30815
  const colValue = entry[colKey];
30498
30816
  result[colKey] = is(colValue, SQL) ? colValue : new Param(colValue, cols[colKey]);
@@ -30705,7 +31023,7 @@ var init_dialect2 = __esm({
30705
31023
  return sql`${withSql}delete from ${table4}${whereSql}${returningSql}${orderBySql}${limitSql}`;
30706
31024
  }
30707
31025
  buildUpdateSet(table4, set) {
30708
- const tableColumns = table4[Table.Symbol.Columns];
31026
+ const tableColumns = table4[Table2.Symbol.Columns];
30709
31027
  const columnNames = Object.keys(tableColumns).filter(
30710
31028
  (colName) => set[colName] !== void 0 || tableColumns[colName]?.onUpdateFn !== void 0
30711
31029
  );
@@ -30766,7 +31084,7 @@ var init_dialect2 = __esm({
30766
31084
  chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
30767
31085
  }
30768
31086
  } else if (is(field, Column2)) {
30769
- const tableName = field.table[Table.Symbol.Name];
31087
+ const tableName = field.table[Table2.Symbol.Name];
30770
31088
  if (isSingleTable) {
30771
31089
  chunk.push(sql.identifier(this.casing.getColumnCasing(field)));
30772
31090
  } else {
@@ -30813,7 +31131,7 @@ var init_dialect2 = __esm({
30813
31131
  const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
30814
31132
  for (const f of fieldsList) {
30815
31133
  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(
30816
- ({ alias }) => alias === (table22[Table.Symbol.IsAlias] ? getTableName(table22) : table22[Table.Symbol.BaseName])
31134
+ ({ alias }) => alias === (table22[Table2.Symbol.IsAlias] ? getTableName(table22) : table22[Table2.Symbol.BaseName])
30817
31135
  ))(f.field.table)) {
30818
31136
  const tableName = getTableName(f.field.table);
30819
31137
  throw new Error(
@@ -30826,8 +31144,8 @@ var init_dialect2 = __esm({
30826
31144
  const distinctSql = distinct ? sql` distinct` : void 0;
30827
31145
  const selection = this.buildSelection(fieldsList, { isSingleTable });
30828
31146
  const tableSql = (() => {
30829
- if (is(table4, Table) && table4[Table.Symbol.OriginalName] !== table4[Table.Symbol.Name]) {
30830
- return sql`${sql.identifier(table4[Table.Symbol.OriginalName])} ${sql.identifier(table4[Table.Symbol.Name])}`;
31147
+ if (is(table4, Table2) && table4[Table2.Symbol.OriginalName] !== table4[Table2.Symbol.Name]) {
31148
+ return sql`${sql.identifier(table4[Table2.Symbol.OriginalName])} ${sql.identifier(table4[Table2.Symbol.Name])}`;
30831
31149
  }
30832
31150
  return table4;
30833
31151
  })();
@@ -30924,7 +31242,7 @@ var init_dialect2 = __esm({
30924
31242
  }
30925
31243
  buildInsertQuery({ table: table4, values, onConflict, returning, withList }) {
30926
31244
  const valuesSqlList = [];
30927
- const columns = table4[Table.Symbol.Columns];
31245
+ const columns = table4[Table2.Symbol.Columns];
30928
31246
  const colEntries = Object.entries(columns).filter(
30929
31247
  ([_2, col]) => !col.shouldDisableInsert()
30930
31248
  );
@@ -31589,7 +31907,7 @@ var init_select3 = __esm({
31589
31907
  };
31590
31908
  }
31591
31909
  if (typeof tableName === "string" && !is(table4, SQL)) {
31592
- const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View3) ? table4[ViewBaseConfig].selectedFields : table4[Table.Symbol.Columns];
31910
+ const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View3) ? table4[ViewBaseConfig].selectedFields : table4[Table2.Symbol.Columns];
31593
31911
  this.config.fields[tableName] = selection;
31594
31912
  }
31595
31913
  }
@@ -32066,7 +32384,7 @@ var init_update2 = __esm({
32066
32384
  if (typeof columns[0] === "function") {
32067
32385
  const orderBy = columns[0](
32068
32386
  new Proxy(
32069
- this.config.table[Table.Symbol.Columns],
32387
+ this.config.table[Table2.Symbol.Columns],
32070
32388
  new SelectionProxyHandler({ sqlAliasedBehavior: "alias", sqlBehavior: "sql" })
32071
32389
  )
32072
32390
  );
@@ -32905,7 +33223,7 @@ function getTableConfig2(table4) {
32905
33223
  const primaryKeys = [];
32906
33224
  const uniqueConstraints = [];
32907
33225
  const foreignKeys = Object.values(table4[SQLiteTable.Symbol.InlineForeignKeys]);
32908
- const name2 = table4[Table.Symbol.Name];
33226
+ const name2 = table4[Table2.Symbol.Name];
32909
33227
  const extraConfigBuilder = table4[SQLiteTable.Symbol.ExtraConfigBuilder];
32910
33228
  if (extraConfigBuilder !== void 0) {
32911
33229
  const extraConfig = extraConfigBuilder(table4[SQLiteTable.Symbol.Columns]);
@@ -32939,7 +33257,7 @@ function getViewConfig2(view4) {
32939
33257
  // ...view[SQLiteViewConfig],
32940
33258
  };
32941
33259
  }
32942
- var init_utils6 = __esm({
33260
+ var init_utils7 = __esm({
32943
33261
  "../drizzle-orm/dist/sqlite-core/utils.js"() {
32944
33262
  "use strict";
32945
33263
  init_entity();
@@ -33070,7 +33388,7 @@ var init_sqlite_core = __esm({
33070
33388
  init_subquery3();
33071
33389
  init_table3();
33072
33390
  init_unique_constraint2();
33073
- init_utils6();
33391
+ init_utils7();
33074
33392
  init_view2();
33075
33393
  }
33076
33394
  });
@@ -33145,8 +33463,7 @@ var init_sqliteSerializer = __esm({
33145
33463
  init_dist();
33146
33464
  init_sqlite_core();
33147
33465
  init_outputs();
33148
- init_utils();
33149
- init_serializer();
33466
+ init_utils6();
33150
33467
  generateSqliteSnapshot = (tables, views, casing2) => {
33151
33468
  const dialect4 = new SQLiteSyncDialect({ casing: casing2 });
33152
33469
  const result = {};
@@ -35236,7 +35553,7 @@ var init_delete3 = __esm({
35236
35553
  if (typeof columns[0] === "function") {
35237
35554
  const orderBy = columns[0](
35238
35555
  new Proxy(
35239
- this.config.table[Table.Symbol.Columns],
35556
+ this.config.table[Table2.Symbol.Columns],
35240
35557
  new SelectionProxyHandler({ sqlAliasedBehavior: "alias", sqlBehavior: "sql" })
35241
35558
  )
35242
35559
  );
@@ -35303,7 +35620,7 @@ var init_insert3 = __esm({
35303
35620
  }
35304
35621
  const mappedValues = values.map((entry) => {
35305
35622
  const result = {};
35306
- const cols = this.table[Table.Symbol.Columns];
35623
+ const cols = this.table[Table2.Symbol.Columns];
35307
35624
  for (const colKey of Object.keys(entry)) {
35308
35625
  const colValue = entry[colKey];
35309
35626
  result[colKey] = is(colValue, SQL) ? colValue : new Param(colValue, cols[colKey]);
@@ -35365,12 +35682,12 @@ var init_insert3 = __esm({
35365
35682
  }
35366
35683
  $returningId() {
35367
35684
  const returning = [];
35368
- for (const [key, value] of Object.entries(this.config.table[Table.Symbol.Columns])) {
35685
+ for (const [key, value] of Object.entries(this.config.table[Table2.Symbol.Columns])) {
35369
35686
  if (value.primary) {
35370
35687
  returning.push({ field: value, path: [key] });
35371
35688
  }
35372
35689
  }
35373
- this.config.returning = orderSelectedFields(this.config.table[Table.Symbol.Columns]);
35690
+ this.config.returning = orderSelectedFields(this.config.table[Table2.Symbol.Columns]);
35374
35691
  return this;
35375
35692
  }
35376
35693
  /** @internal */
@@ -35472,8 +35789,8 @@ function mysqlTableWithSchema(name2, columns, extraConfig, schema4, baseName = n
35472
35789
  })
35473
35790
  );
35474
35791
  const table4 = Object.assign(rawTable, builtColumns);
35475
- table4[Table.Symbol.Columns] = builtColumns;
35476
- table4[Table.Symbol.ExtraConfigColumns] = builtColumns;
35792
+ table4[Table2.Symbol.Columns] = builtColumns;
35793
+ table4[Table2.Symbol.ExtraConfigColumns] = builtColumns;
35477
35794
  if (extraConfig) {
35478
35795
  table4[MySqlTable.Symbol.ExtraConfigBuilder] = extraConfig;
35479
35796
  }
@@ -35487,7 +35804,7 @@ var init_table4 = __esm({
35487
35804
  init_table();
35488
35805
  init_all3();
35489
35806
  InlineForeignKeys3 = Symbol.for("drizzle:MySqlInlineForeignKeys");
35490
- MySqlTable = class extends (_e4 = Table, _d4 = entityKind, _c9 = Table.Symbol.Columns, _b223 = InlineForeignKeys3, _a301 = Table.Symbol.ExtraConfigBuilder, _e4) {
35807
+ MySqlTable = class extends (_e4 = Table2, _d4 = entityKind, _c9 = Table2.Symbol.Columns, _b223 = InlineForeignKeys3, _a301 = Table2.Symbol.ExtraConfigBuilder, _e4) {
35491
35808
  constructor() {
35492
35809
  super(...arguments);
35493
35810
  /** @internal */
@@ -35500,7 +35817,7 @@ var init_table4 = __esm({
35500
35817
  };
35501
35818
  __publicField(MySqlTable, _d4, "MySqlTable");
35502
35819
  /** @internal */
35503
- __publicField(MySqlTable, "Symbol", Object.assign({}, Table.Symbol, {
35820
+ __publicField(MySqlTable, "Symbol", Object.assign({}, Table2.Symbol, {
35504
35821
  InlineForeignKeys: InlineForeignKeys3
35505
35822
  }));
35506
35823
  mysqlTable = (name2, columns, extraConfig) => {
@@ -35607,7 +35924,7 @@ var init_dialect3 = __esm({
35607
35924
  return sql`${withSql}delete from ${table4}${whereSql}${orderBySql}${limitSql}${returningSql}`;
35608
35925
  }
35609
35926
  buildUpdateSet(table4, set) {
35610
- const tableColumns = table4[Table.Symbol.Columns];
35927
+ const tableColumns = table4[Table2.Symbol.Columns];
35611
35928
  const columnNames = Object.keys(tableColumns).filter(
35612
35929
  (colName) => set[colName] !== void 0 || tableColumns[colName]?.onUpdateFn !== void 0
35613
35930
  );
@@ -35706,7 +36023,7 @@ var init_dialect3 = __esm({
35706
36023
  const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
35707
36024
  for (const f of fieldsList) {
35708
36025
  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(
35709
- ({ alias }) => alias === (table22[Table.Symbol.IsAlias] ? getTableName(table22) : table22[Table.Symbol.BaseName])
36026
+ ({ alias }) => alias === (table22[Table2.Symbol.IsAlias] ? getTableName(table22) : table22[Table2.Symbol.BaseName])
35710
36027
  ))(f.field.table)) {
35711
36028
  const tableName = getTableName(f.field.table);
35712
36029
  throw new Error(
@@ -35719,8 +36036,8 @@ var init_dialect3 = __esm({
35719
36036
  const distinctSql = distinct ? sql` distinct` : void 0;
35720
36037
  const selection = this.buildSelection(fieldsList, { isSingleTable });
35721
36038
  const tableSql = (() => {
35722
- if (is(table4, Table) && table4[Table.Symbol.OriginalName] !== table4[Table.Symbol.Name]) {
35723
- return sql`${sql.identifier(table4[Table.Symbol.OriginalName])} ${sql.identifier(table4[Table.Symbol.Name])}`;
36039
+ if (is(table4, Table2) && table4[Table2.Symbol.OriginalName] !== table4[Table2.Symbol.Name]) {
36040
+ return sql`${sql.identifier(table4[Table2.Symbol.OriginalName])} ${sql.identifier(table4[Table2.Symbol.Name])}`;
35724
36041
  }
35725
36042
  return table4;
35726
36043
  })();
@@ -35827,7 +36144,7 @@ var init_dialect3 = __esm({
35827
36144
  }
35828
36145
  buildInsertQuery({ table: table4, values, ignore, onConflict }) {
35829
36146
  const valuesSqlList = [];
35830
- const columns = table4[Table.Symbol.Columns];
36147
+ const columns = table4[Table2.Symbol.Columns];
35831
36148
  const colEntries = Object.entries(columns).filter(
35832
36149
  ([_2, col]) => !col.shouldDisableInsert()
35833
36150
  );
@@ -36750,7 +37067,7 @@ var init_select4 = __esm({
36750
37067
  };
36751
37068
  }
36752
37069
  if (typeof tableName === "string" && !is(table4, SQL)) {
36753
- const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View3) ? table4[ViewBaseConfig].selectedFields : table4[Table.Symbol.Columns];
37070
+ const selection = is(table4, Subquery) ? table4._.selectedFields : is(table4, View3) ? table4[ViewBaseConfig].selectedFields : table4[Table2.Symbol.Columns];
36754
37071
  this.config.fields[tableName] = selection;
36755
37072
  }
36756
37073
  }
@@ -37221,7 +37538,7 @@ var init_update3 = __esm({
37221
37538
  if (typeof columns[0] === "function") {
37222
37539
  const orderBy = columns[0](
37223
37540
  new Proxy(
37224
- this.config.table[Table.Symbol.Columns],
37541
+ this.config.table[Table2.Symbol.Columns],
37225
37542
  new SelectionProxyHandler({ sqlAliasedBehavior: "alias", sqlBehavior: "sql" })
37226
37543
  )
37227
37544
  );
@@ -37954,9 +38271,9 @@ function getTableConfig3(table4) {
37954
38271
  const primaryKeys = [];
37955
38272
  const uniqueConstraints = [];
37956
38273
  const foreignKeys = Object.values(table4[MySqlTable.Symbol.InlineForeignKeys]);
37957
- const name2 = table4[Table.Symbol.Name];
37958
- const schema4 = table4[Table.Symbol.Schema];
37959
- const baseName = table4[Table.Symbol.BaseName];
38274
+ const name2 = table4[Table2.Symbol.Name];
38275
+ const schema4 = table4[Table2.Symbol.Schema];
38276
+ const baseName = table4[Table2.Symbol.BaseName];
37960
38277
  const extraConfigBuilder = table4[MySqlTable.Symbol.ExtraConfigBuilder];
37961
38278
  if (extraConfigBuilder !== void 0) {
37962
38279
  const extraConfig = extraConfigBuilder(table4[MySqlTable.Symbol.Columns]);
@@ -37992,7 +38309,7 @@ function getViewConfig3(view4) {
37992
38309
  ...view4[MySqlViewConfig]
37993
38310
  };
37994
38311
  }
37995
- var init_utils7 = __esm({
38312
+ var init_utils8 = __esm({
37996
38313
  "../drizzle-orm/dist/mysql-core/utils.js"() {
37997
38314
  "use strict";
37998
38315
  init_entity();
@@ -38026,7 +38343,7 @@ var init_mysql_core = __esm({
38026
38343
  init_subquery4();
38027
38344
  init_table4();
38028
38345
  init_unique_constraint3();
38029
- init_utils7();
38346
+ init_utils8();
38030
38347
  init_view_common3();
38031
38348
  init_view3();
38032
38349
  }
@@ -38056,13 +38373,9 @@ var init_mysqlSerializer = __esm({
38056
38373
  "use strict";
38057
38374
  init_source();
38058
38375
  init_dist();
38059
- init_dist();
38060
- init_mysql_core();
38061
- init_mysql_core();
38062
38376
  init_mysql_core();
38063
38377
  init_outputs();
38064
- init_utils();
38065
- init_serializer();
38378
+ init_utils6();
38066
38379
  generateMySqlSnapshot = (tables, views, casing2) => {
38067
38380
  const dialect4 = new MySqlDialect({ casing: casing2 });
38068
38381
  const result = {};
@@ -38810,7 +39123,14 @@ var init_cli = __esm({
38810
39123
  schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
38811
39124
  extensionsFilters: literalType("postgis").array().optional(),
38812
39125
  verbose: booleanType().optional(),
38813
- strict: booleanType().optional()
39126
+ strict: booleanType().optional(),
39127
+ entities: objectType({
39128
+ roles: booleanType().or(objectType({
39129
+ provider: stringType().optional(),
39130
+ include: stringType().array().optional(),
39131
+ exclude: stringType().array().optional()
39132
+ })).optional().default(false)
39133
+ }).optional()
38814
39134
  }).passthrough();
38815
39135
  pullParams = objectType({
38816
39136
  config: stringType().optional(),
@@ -39021,7 +39341,7 @@ var init_es5 = __esm({
39021
39341
 
39022
39342
  // src/cli/commands/utils.ts
39023
39343
  var import_hanji7, assertES5, safeRegister, migrateConfig;
39024
- var init_utils8 = __esm({
39344
+ var init_utils9 = __esm({
39025
39345
  "src/cli/commands/utils.ts"() {
39026
39346
  "use strict";
39027
39347
  import_hanji7 = __toESM(require_hanji());
@@ -39090,13 +39410,14 @@ var init_pgImports = __esm({
39090
39410
  "use strict";
39091
39411
  init_dist();
39092
39412
  init_pg_core();
39093
- init_utils8();
39413
+ init_utils9();
39094
39414
  prepareFromExports = (exports2) => {
39095
39415
  const tables = [];
39096
39416
  const enums = [];
39097
39417
  const schemas = [];
39098
39418
  const sequences = [];
39099
39419
  const roles = [];
39420
+ const policies = [];
39100
39421
  const views = [];
39101
39422
  const matViews = [];
39102
39423
  const i0values = Object.values(exports2);
@@ -39123,8 +39444,11 @@ var init_pgImports = __esm({
39123
39444
  if (is(t, PgRole)) {
39124
39445
  roles.push(t);
39125
39446
  }
39447
+ if (is(t, PgPolicy)) {
39448
+ policies.push(t);
39449
+ }
39126
39450
  });
39127
- return { tables, enums, schemas, sequences, views, matViews, roles };
39451
+ return { tables, enums, schemas, sequences, views, matViews, roles, policies };
39128
39452
  };
39129
39453
  }
39130
39454
  });
@@ -39141,7 +39465,7 @@ var init_sqliteImports = __esm({
39141
39465
  "use strict";
39142
39466
  init_dist();
39143
39467
  init_sqlite_core();
39144
- init_utils8();
39468
+ init_utils9();
39145
39469
  prepareFromExports2 = (exports2) => {
39146
39470
  const tables = [];
39147
39471
  const views = [];
@@ -39185,7 +39509,7 @@ var init_mysqlImports = __esm({
39185
39509
  "use strict";
39186
39510
  init_dist();
39187
39511
  init_mysql_core();
39188
- init_utils8();
39512
+ init_utils9();
39189
39513
  prepareFromExports3 = (exports2) => {
39190
39514
  const tables = [];
39191
39515
  const views = [];
@@ -39544,7 +39868,7 @@ init_mjs();
39544
39868
  init_global();
39545
39869
  init_pgSerializer();
39546
39870
  init_views();
39547
- var pgPushIntrospect = async (db, filters, schemaFilters, entities = { roles: true }) => {
39871
+ var pgPushIntrospect = async (db, filters, schemaFilters, entities) => {
39548
39872
  const matchers = filters.map((it) => {
39549
39873
  return new Minimatch(it);
39550
39874
  });
@@ -39810,7 +40134,7 @@ var updateUpToV7 = (json3) => {
39810
40134
  return [idx[0], { columns: mappedColumns, with: {}, ...rest }];
39811
40135
  })
39812
40136
  );
39813
- return [it[0], { ...table4, indexes: mappedIndexes }];
40137
+ return [it[0], { ...table4, indexes: mappedIndexes, policies: {}, isRLSEnabled: false, checkConstraints: {} }];
39814
40138
  })
39815
40139
  );
39816
40140
  return {
@@ -39818,7 +40142,10 @@ var updateUpToV7 = (json3) => {
39818
40142
  version: "7",
39819
40143
  dialect: "postgresql",
39820
40144
  sequences: {},
39821
- tables
40145
+ tables,
40146
+ policies: {},
40147
+ views: {},
40148
+ roles: {}
39822
40149
  };
39823
40150
  };
39824
40151
 
@@ -39993,6 +40320,7 @@ var generateDrizzleJson = (imports, prevId, schemaFilters, casing2) => {
39993
40320
  prepared.schemas,
39994
40321
  prepared.sequences,
39995
40322
  prepared.roles,
40323
+ prepared.policies,
39996
40324
  prepared.views,
39997
40325
  prepared.matViews,
39998
40326
  casing2,
@@ -40017,6 +40345,7 @@ var generateMigration = async (prev, cur) => {
40017
40345
  enumsResolver,
40018
40346
  sequencesResolver,
40019
40347
  policyResolver,
40348
+ indPolicyResolver,
40020
40349
  roleResolver,
40021
40350
  tablesResolver,
40022
40351
  columnsResolver,
@@ -40039,7 +40368,8 @@ var pushSchema = async (imports, drizzleInstance, schemaFilters) => {
40039
40368
  const { schema: prev } = await pgPushIntrospect(
40040
40369
  db,
40041
40370
  [],
40042
- schemaFilters ?? ["public"]
40371
+ schemaFilters ?? ["public"],
40372
+ void 0
40043
40373
  );
40044
40374
  const validatedPrev = pgSchema.parse(prev);
40045
40375
  const validatedCur = pgSchema.parse(cur);
@@ -40052,6 +40382,7 @@ var pushSchema = async (imports, drizzleInstance, schemaFilters) => {
40052
40382
  enumsResolver,
40053
40383
  sequencesResolver,
40054
40384
  policyResolver,
40385
+ indPolicyResolver,
40055
40386
  roleResolver,
40056
40387
  tablesResolver,
40057
40388
  columnsResolver,