drizzle-pg-extras 0.5.0 → 0.6.0

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/README.md CHANGED
@@ -68,7 +68,7 @@ The first `generate` writes a migration. The next one writes nothing until a def
68
68
  npm install drizzle-pg-extras
69
69
  ```
70
70
 
71
- Peer dependency: `drizzle-orm` `>=0.36.4`. `drizzle-kit` `>=0.31.0` is optional and only needed to apply migrations. Node.js 18 or newer.
71
+ Peer dependency: `drizzle-orm` `>=0.36.4`, including 1.0 (tested with 0.45 and `1.0.0-rc.5`). `drizzle-kit` `>=0.31.0` or 1.0 is optional and only needed to apply migrations. Node.js 18 or newer.
72
72
 
73
73
  Put the definitions in the same files your `drizzle.config.ts` `schema` already points at, and export them. The CLI reads that config (dialect, schema, `out`, `casing`, `breakpoints`, `migrations.prefix`).
74
74
 
@@ -105,7 +105,17 @@ Up SQL is split on `--> statement-breakpoint`, which is what `drizzle-kit migrat
105
105
 
106
106
  Down SQL is the reverse diff: restore the previous function body, drop a trigger that was added, `COMMENT … IS NULL` for a comment that was removed. `drizzle-kit migrate` does not run `.down.sql`, and applying it does not delete the row in `__drizzle_migrations`. To roll back, run the down file yourself, then remove that journal entry and the matching migration row if kit's history should forget it too.
107
107
 
108
- If the migrations folder is already the v1 shape (timestamp directories that each contain `migration.sql`), `generate` writes another directory with `migration.sql`, `down.sql`, and a copied `snapshot.json`. That path is best-effort. rc.5 stores later snapshots as deltas; copying a delta forward can confuse the next `drizzle-kit generate`. The layout covered by the tests is the 0.31 journal.
108
+ With drizzle-kit 1.0, migrations are one folder each (a timestamp directory with `migration.sql`). `generate` writes the same shape: a new directory with `migration.sql`, `down.sql`, and a `snapshot.json` that is an empty diff chained to the previous snapshot (`type: "diff"`, `prevIds` pointing at it), which is what `drizzle-kit generate --custom` writes. The directory always sorts after the last one, so kit never sees two base snapshots. An empty migrations folder gets the layout of the drizzle-kit installed in your project. Both layouts are covered by the test suite, against drizzle-kit 0.31 and 1.0.0-rc.5, including `drizzle-kit migrate` on Postgres.
109
+
110
+ ```
111
+ drizzle/
112
+ 20261118090000_users/ written by drizzle-kit generate
113
+ 20261118090100_pg_extras/
114
+ migration.sql applied by drizzle-kit migrate
115
+ down.sql not applied by drizzle-kit
116
+ snapshot.json empty diff, prevIds -> the users snapshot
117
+ _pg-extras.json full extras snapshot, commit this
118
+ ```
109
119
 
110
120
  ## Programmatic API
111
121
 
@@ -402,9 +412,9 @@ The supported path is `drizzle-kit generate`, then `drizzle-pg-extras generate`,
402
412
 
403
413
  | | |
404
414
  | --- | --- |
405
- | drizzle-orm | `>=0.36.4`. Tested with 0.45.3. Drizzle 0.45 and v1.0.0-rc.5 still do not generate functions, triggers, comments, extensions, partitions, or hypertables. |
415
+ | drizzle-orm | `>=0.36.4` and 1.0. Tested with 0.45.3 and 1.0.0-rc.5. Drizzle 0.45 and v1.0.0-rc.5 still do not generate functions, triggers, comments, extensions, partitions, or hypertables. |
406
416
  | drizzle-kit | `>=0.31.0` journal format. Tested with 0.31.11: `migrate` applies the file, and the next `generate` reports no schema changes. |
407
- | drizzle-kit 1.0 rc | Writes a v1 folder when one is already present. Delta snapshots in rc.5 are not rewritten; treat that layout as untested beyond the file names. |
417
+ | drizzle-kit 1.0 rc | Writes the folder-per-migration layout with an empty diff snapshot, tested through `drizzle-kit generate`, `check` and `migrate` on 1.0.0-rc.5. A drizzle-kit 0.x journal folder still gets journal entries; upgrade it with `drizzle-kit up` before moving to 1.0. |
408
418
  | PostgreSQL | 14 or newer (`CREATE OR REPLACE TRIGGER`). Tested on 16. |
409
419
  | TimescaleDB | Hypertables, compression settings, retention policies, and compression policies. Tested with TimescaleDB 2.32 on PostgreSQL 16. CI uses `timescale/timescaledb:latest-pg16`. |
410
420
  | Node.js | 18 or newer. ESM and CJS builds. |
package/dist/cli.js CHANGED
@@ -748,13 +748,47 @@ function orderFragment(order) {
748
748
  }
749
749
 
750
750
  // src/snapshot.ts
751
- import { Column as Column2, SQL as SQL2, getTableColumns as getTableColumns2, is as is3 } from "drizzle-orm";
752
- import { CasingCache as CasingCache2, toCamelCase, toSnakeCase } from "drizzle-orm/casing";
751
+ import { Column as Column2, SQL as SQL2, getTableColumns as getTableColumns2, is as is4 } from "drizzle-orm";
752
+ import { toCamelCase as toCamelCase3, toSnakeCase as toSnakeCase3 } from "drizzle-orm/casing";
753
+
754
+ // src/compat.ts
755
+ import { is } from "drizzle-orm";
756
+ import * as casingModule from "drizzle-orm/casing";
757
+ import * as pgCore from "drizzle-orm/pg-core";
758
+ var toSnakeCase2 = casingModule.toSnakeCase;
759
+ var toCamelCase2 = casingModule.toCamelCase;
760
+ function columnDbName(column, casing) {
761
+ if (!column.keyAsName || !casing) return column.name;
762
+ return casing === "snake_case" ? toSnakeCase2(column.name) : toCamelCase2(column.name);
763
+ }
764
+ var ColumnCasing = class {
765
+ constructor(casing) {
766
+ this.casing = casing;
767
+ }
768
+ casing;
769
+ getColumnCasing(column) {
770
+ return columnDbName(column, this.casing);
771
+ }
772
+ };
773
+ function columnTable(column) {
774
+ return column.table;
775
+ }
776
+ var PgArrayClass = pgCore["PgArray"];
777
+ function unwrapArrayColumn(column) {
778
+ let current = column;
779
+ if (!PgArrayClass) return current;
780
+ while (is(current, PgArrayClass)) current = current.baseColumn;
781
+ return current;
782
+ }
783
+ function dialectConfig(casing) {
784
+ return casing ? { casing } : void 0;
785
+ }
786
+
787
+ // src/snapshot.ts
753
788
  import {
754
789
  CheckBuilder as CheckBuilder2,
755
790
  ForeignKeyBuilder as ForeignKeyBuilder2,
756
791
  IndexBuilder as IndexBuilder2,
757
- PgArray,
758
792
  PgEnumColumn,
759
793
  PgEnumObjectColumn,
760
794
  PgTable as PgTable2,
@@ -772,16 +806,16 @@ import {
772
806
  Column,
773
807
  ColumnBuilder,
774
808
  getTableColumns,
775
- is as is2,
809
+ is as is3,
776
810
  sql,
777
811
  Table
778
812
  } from "drizzle-orm";
779
- import { CasingCache } from "drizzle-orm/casing";
780
813
  import {
781
814
  CheckBuilder,
782
815
  ForeignKeyBuilder,
783
816
  IndexBuilder,
784
817
  IndexBuilderOn,
818
+ PgColumnBuilder,
785
819
  ManualMaterializedViewBuilder,
786
820
  ManualViewBuilder,
787
821
  MaterializedViewBuilder,
@@ -799,20 +833,20 @@ import {
799
833
  } from "drizzle-orm/pg-core";
800
834
 
801
835
  // src/render-sql.ts
802
- import { is, SQL } from "drizzle-orm";
836
+ import { is as is2, SQL } from "drizzle-orm";
803
837
  import { PgDialect } from "drizzle-orm/pg-core";
804
838
  var dialects = /* @__PURE__ */ new Map();
805
839
  function dialectFor(casing) {
806
840
  const key = casing ?? "";
807
841
  let dialect = dialects.get(key);
808
842
  if (!dialect) {
809
- dialect = new PgDialect(casing ? { casing } : void 0);
843
+ dialect = new PgDialect(dialectConfig(casing));
810
844
  dialects.set(key, dialect);
811
845
  }
812
846
  return dialect;
813
847
  }
814
848
  function isSqlFragment(value) {
815
- return is(value, SQL);
849
+ return is2(value, SQL);
816
850
  }
817
851
  function renderSql(query, casing) {
818
852
  return dialectFor(casing).sqlToQuery(query.inlineParams()).sql;
@@ -840,7 +874,7 @@ function triggerError(label, message) {
840
874
  throw new PgExtrasError(`pgTrigger("${label}"): ${message}`);
841
875
  }
842
876
  function relationIdentity(relation2) {
843
- if (is2(relation2, PgTable)) {
877
+ if (is3(relation2, PgTable)) {
844
878
  const config = getTableConfig(relation2);
845
879
  return { schema: schemaName(config.schema), name: config.name, kind: "table" };
846
880
  }
@@ -858,11 +892,11 @@ function relationIdentity(relation2) {
858
892
  return { schema: schemaName(relation2.schema), name: relation2.name, kind: "name" };
859
893
  }
860
894
  function relationColumnEntries(relation2) {
861
- if (is2(relation2, PgTable)) return Object.entries(getTableColumns(relation2));
895
+ if (is3(relation2, PgTable)) return Object.entries(getTableColumns(relation2));
862
896
  const config = isPgMaterializedView(relation2) ? getMaterializedViewConfig(relation2) : getViewConfig(relation2);
863
897
  const entries = [];
864
898
  for (const [key, field] of Object.entries(config.selectedFields ?? {})) {
865
- if (is2(field, Column)) entries.push([key, field]);
899
+ if (is3(field, Column)) entries.push([key, field]);
866
900
  }
867
901
  return entries;
868
902
  }
@@ -880,7 +914,7 @@ function renderWhenInput(label, table, when, casing) {
880
914
  if (!when) return null;
881
915
  let value;
882
916
  if (typeof when === "function") {
883
- if (!is2(table, PgTable) && !isPgView(table) && !isPgMaterializedView(table)) {
917
+ if (!is3(table, PgTable) && !isPgView(table) && !isPgMaterializedView(table)) {
884
918
  triggerError(label, "WHEN callback needs a Drizzle table or view so NEW and OLD can be typed");
885
919
  }
886
920
  const entries = relationColumnEntries(table);
@@ -895,7 +929,7 @@ function renderWhenInput(label, table, when, casing) {
895
929
  return text.length === 0 ? null : text;
896
930
  }
897
931
  function rowProxy(columns, alias, casing) {
898
- const cache = new CasingCache(casing);
932
+ const cache = new ColumnCasing(casing);
899
933
  const refs = {};
900
934
  for (const [key, column] of columns) {
901
935
  refs[key] = sql.raw(`${alias}.${quoteIdent(cache.getColumnCasing(column))}`);
@@ -987,7 +1021,7 @@ function assertColumnOfTable(table, column) {
987
1021
  }
988
1022
  }
989
1023
  function tableIdentity(table) {
990
- if (is2(table, PgTable)) {
1024
+ if (is3(table, PgTable)) {
991
1025
  const config = getTableConfig(table);
992
1026
  return { schema: config.schema && config.schema.length > 0 ? config.schema : "public", name: config.name };
993
1027
  }
@@ -1021,7 +1055,7 @@ function functionSignature(schema, name, argTypes) {
1021
1055
  }
1022
1056
  function snapshotExtras(extras, options) {
1023
1057
  const casing = options?.casing;
1024
- const cache = new CasingCache2(casing);
1058
+ const cache = new ColumnCasing(casing);
1025
1059
  const nameOf = (column) => cache.getColumnCasing(column);
1026
1060
  const functions = [];
1027
1061
  const fnByObject = /* @__PURE__ */ new Map();
@@ -1323,11 +1357,11 @@ function harvest(table, nameOf) {
1323
1357
  }
1324
1358
  function snapshotComment(comment, nameOf, casing, fnByObject, triggerByObject, extras) {
1325
1359
  const target = comment.target;
1326
- if (is3(target, PgTable2)) {
1360
+ if (is4(target, PgTable2)) {
1327
1361
  const identity = tableIdentity(target);
1328
1362
  return tableComment(identity.schema, identity.name, comment.text);
1329
1363
  }
1330
- if (is3(target, Column2)) {
1364
+ if (is4(target, Column2)) {
1331
1365
  return columnCommentFrom(target, comment.text, nameOf, extras);
1332
1366
  }
1333
1367
  if (isPgEnum2(target)) {
@@ -1614,10 +1648,11 @@ function commentLabel(comment) {
1614
1648
  return `${comment.kind} ${comment.schema}.${comment.name}`;
1615
1649
  }
1616
1650
  function columnCommentFrom(column, text, nameOf, extras) {
1617
- if (!column.table || !is3(column.table, PgTable2)) {
1651
+ const owner = columnTable(column);
1652
+ if (!owner || !is4(owner, PgTable2)) {
1618
1653
  throw new PgExtrasError(`commentOn() column "${column.name}" is not attached to a Postgres table or view`);
1619
1654
  }
1620
- const identity = tableIdentity(column.table);
1655
+ const identity = tableIdentity(owner);
1621
1656
  const dbName = nameOf(column);
1622
1657
  const knownTable = extras.tables.find((table) => {
1623
1658
  const id = tableIdentity(table);
@@ -1632,7 +1667,7 @@ function columnCommentFrom(column, text, nameOf, extras) {
1632
1667
  const viewId = viewIdentity(view);
1633
1668
  return columnComment(viewId.schema, viewId.name, dbName, text);
1634
1669
  }
1635
- assertColumnOfTable(column.table, column);
1670
+ assertColumnOfTable(owner, column);
1636
1671
  return columnComment(identity.schema, identity.name, dbName, text);
1637
1672
  }
1638
1673
  var ExtraConfigBuilder = /* @__PURE__ */ Symbol.for("drizzle:ExtraConfigBuilder");
@@ -1656,7 +1691,7 @@ function harvestRelations(table, nameOf, casing) {
1656
1691
  "Return the index or constraint from the table extra config wrapped with withComment(). commentOn() is for tables, columns, enums, views, functions, triggers, and extensions."
1657
1692
  );
1658
1693
  }
1659
- if (is3(value, IndexBuilder2)) {
1694
+ if (is4(value, IndexBuilder2)) {
1660
1695
  const built = value.build(table);
1661
1696
  const text = readComment(value);
1662
1697
  let name;
@@ -1670,14 +1705,14 @@ function harvestRelations(table, nameOf, casing) {
1670
1705
  if (text) comments.push(indexComment(identity.schema, name, text));
1671
1706
  continue;
1672
1707
  }
1673
- if (is3(value, CheckBuilder2)) {
1708
+ if (is4(value, CheckBuilder2)) {
1674
1709
  const name = value.name;
1675
1710
  constraints.push({ schema: identity.schema, table: identity.name, name });
1676
1711
  const text = readComment(value);
1677
1712
  if (text) comments.push(constraintComment(identity.schema, identity.name, name, text));
1678
1713
  continue;
1679
1714
  }
1680
- if (is3(value, UniqueConstraintBuilder2)) {
1715
+ if (is4(value, UniqueConstraintBuilder2)) {
1681
1716
  const built = buildOf(value, table);
1682
1717
  const name = constraintName(built);
1683
1718
  constraints.push({ schema: identity.schema, table: identity.name, name });
@@ -1685,7 +1720,7 @@ function harvestRelations(table, nameOf, casing) {
1685
1720
  if (text) comments.push(constraintComment(identity.schema, identity.name, name, text));
1686
1721
  continue;
1687
1722
  }
1688
- if (is3(value, ForeignKeyBuilder2)) {
1723
+ if (is4(value, ForeignKeyBuilder2)) {
1689
1724
  const built = buildOf(value, table);
1690
1725
  const name = applyCasing(built.getName(), [...built.reference().columns, ...built.reference().foreignColumns], nameOf, casing);
1691
1726
  constraints.push({ schema: identity.schema, table: identity.name, name });
@@ -1693,7 +1728,7 @@ function harvestRelations(table, nameOf, casing) {
1693
1728
  if (text) comments.push(constraintComment(identity.schema, identity.name, name, text));
1694
1729
  continue;
1695
1730
  }
1696
- if (is3(value, PrimaryKeyBuilder2)) {
1731
+ if (is4(value, PrimaryKeyBuilder2)) {
1697
1732
  const built = buildOf(value, table);
1698
1733
  const name = applyCasing(built.getName(), built.columns, nameOf, casing);
1699
1734
  constraints.push({ schema: identity.schema, table: identity.name, name });
@@ -1724,7 +1759,7 @@ function resolveIndexName(index, tableName, casing) {
1724
1759
  if (index.config.name && index.config.name.length > 0) return index.config.name;
1725
1760
  const columns = [];
1726
1761
  for (const column of index.config.columns) {
1727
- if (is3(column, SQL2)) {
1762
+ if (is4(column, SQL2)) {
1728
1763
  throw new PgExtrasError(
1729
1764
  `index comment on "${tableName}" needs an index name. Drizzle names indexes made of columns only; name an index whose key is a SQL expression.`
1730
1765
  );
@@ -1739,7 +1774,7 @@ function resolveIndexName(index, tableName, casing) {
1739
1774
  }
1740
1775
  function casedIndexColumn(name, keyAsName, casing) {
1741
1776
  if (!keyAsName || !casing) return name;
1742
- return casing === "camelCase" ? toCamelCase(name) : toSnakeCase(name);
1777
+ return casing === "camelCase" ? toCamelCase3(name) : toSnakeCase3(name);
1743
1778
  }
1744
1779
  function harvestView(view, nameOf) {
1745
1780
  const identity = viewIdentity(view);
@@ -1758,7 +1793,7 @@ function viewIdentity(view) {
1758
1793
  const config = materialized ? getMaterializedViewConfig2(view) : getViewConfig2(view);
1759
1794
  const columns = [];
1760
1795
  for (const field of Object.values(config.selectedFields ?? {})) {
1761
- if (is3(field, Column2)) columns.push(field);
1796
+ if (is4(field, Column2)) columns.push(field);
1762
1797
  }
1763
1798
  return {
1764
1799
  schema: config.schema && config.schema.length > 0 ? config.schema : "public",
@@ -1785,8 +1820,8 @@ function enumObjectsIn(extras) {
1785
1820
  }
1786
1821
  function enumFromColumn(column) {
1787
1822
  let current = column;
1788
- while (is3(current, PgArray)) current = current.baseColumn;
1789
- if (is3(current, PgEnumColumn) || is3(current, PgEnumObjectColumn)) return current.enum;
1823
+ current = unwrapArrayColumn(current);
1824
+ if (is4(current, PgEnumColumn) || is4(current, PgEnumObjectColumn)) return current.enum;
1790
1825
  return null;
1791
1826
  }
1792
1827
  function enumIdentity(value) {
@@ -2453,6 +2488,7 @@ function viewColumnGone(from, to, schema, relation2, column) {
2453
2488
  }
2454
2489
 
2455
2490
  // src/journal.ts
2491
+ import { createRequire } from "module";
2456
2492
  import { randomUUID } from "crypto";
2457
2493
  import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "fs";
2458
2494
  import path from "path";
@@ -2503,7 +2539,27 @@ function detectLayout(out) {
2503
2539
  `migrations folder ${out} has both meta/_journal.json and v1 migration folders. Keep one layout.`
2504
2540
  );
2505
2541
  }
2506
- return v1.length > 0 ? "v1" : "journal";
2542
+ if (v1.length > 0) return "v1";
2543
+ if (journal) return "journal";
2544
+ return installedKitMajor() >= 1 ? "v1" : "journal";
2545
+ }
2546
+ function installedKitMajor() {
2547
+ for (const name of ["drizzle-kit", "drizzle-orm"]) {
2548
+ try {
2549
+ const require2 = createRequire(path.join(process.cwd(), "noop.js"));
2550
+ let dir = path.dirname(require2.resolve(name));
2551
+ for (let i = 0; i < 6; i += 1) {
2552
+ const pkgPath = path.join(dir, "package.json");
2553
+ if (existsSync(pkgPath)) {
2554
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
2555
+ if (pkg.name === name && pkg.version) return Number.parseInt(pkg.version, 10);
2556
+ }
2557
+ dir = path.dirname(dir);
2558
+ }
2559
+ } catch {
2560
+ }
2561
+ }
2562
+ return 0;
2507
2563
  }
2508
2564
  function writeJournal(out, input) {
2509
2565
  const prefixMode = input.prefix ?? "index";
@@ -2543,9 +2599,11 @@ function writeV1(out, input) {
2543
2599
  const folders = readdirSync(out, { withFileTypes: true }).filter((entry2) => entry2.isDirectory() && /^\d{14}_/.test(entry2.name)).map((entry2) => entry2.name).sort();
2544
2600
  const suffix = sanitizeMigrationName(input.name);
2545
2601
  let stamp = utcStamp(/* @__PURE__ */ new Date());
2602
+ const lastStamp = folders.length > 0 ? folders[folders.length - 1].slice(0, 14) : null;
2603
+ if (lastStamp && stamp <= lastStamp) stamp = bumpStamp(lastStamp);
2546
2604
  let folder = `${stamp}_${suffix}`;
2547
2605
  while (existsSync(path.join(out, folder))) {
2548
- stamp = String(Number(stamp) + 1);
2606
+ stamp = bumpStamp(stamp);
2549
2607
  folder = `${stamp}_${suffix}`;
2550
2608
  }
2551
2609
  const dir = path.join(out, folder);
@@ -2559,8 +2617,20 @@ function writeV1(out, input) {
2559
2617
  const parsed = JSON.parse(readFileSync(previous, "utf8"));
2560
2618
  let next = parsed;
2561
2619
  if (typeof parsed.id === "string") {
2562
- const { id, prevId: _previous, ...rest } = parsed;
2563
- next = { id: randomUUID(), prevId: id, ...rest };
2620
+ if (parsed.type === "base" || parsed.type === "diff") {
2621
+ next = {
2622
+ type: "diff",
2623
+ version: parsed.version,
2624
+ dialect: parsed.dialect,
2625
+ id: randomUUID(),
2626
+ prevIds: [parsed.id],
2627
+ footprints: [],
2628
+ deltas: []
2629
+ };
2630
+ } else {
2631
+ const { id, prevId: _previous, ...rest } = parsed;
2632
+ next = { id: randomUUID(), prevId: id, ...rest };
2633
+ }
2564
2634
  }
2565
2635
  writeFileSync(path.join(dir, "snapshot.json"), `${JSON.stringify(next, null, 2)}
2566
2636
  `);
@@ -2618,9 +2688,20 @@ function utcStamp(date) {
2618
2688
  const pad = (value) => String(value).padStart(2, "0");
2619
2689
  return `${date.getUTCFullYear()}${pad(date.getUTCMonth() + 1)}${pad(date.getUTCDate())}${pad(date.getUTCHours())}${pad(date.getUTCMinutes())}${pad(date.getUTCSeconds())}`;
2620
2690
  }
2691
+ function bumpStamp(stamp) {
2692
+ const at = Date.UTC(
2693
+ Number(stamp.slice(0, 4)),
2694
+ Number(stamp.slice(4, 6)) - 1,
2695
+ Number(stamp.slice(6, 8)),
2696
+ Number(stamp.slice(8, 10)),
2697
+ Number(stamp.slice(10, 12)),
2698
+ Number(stamp.slice(12, 14))
2699
+ );
2700
+ return utcStamp(new Date(at + 1e3));
2701
+ }
2621
2702
 
2622
2703
  // src/version.ts
2623
- var VERSION = "0.5.0";
2704
+ var VERSION = "0.6.0";
2624
2705
 
2625
2706
  // src/generate.ts
2626
2707
  var UP_HEADER = `-- Generated by drizzle-pg-extras ${VERSION}. Review before applying.`;
@@ -2668,7 +2749,7 @@ import { existsSync as existsSync2, readdirSync as readdirSync2, statSync } from
2668
2749
  import path2 from "path";
2669
2750
 
2670
2751
  // src/collect.ts
2671
- import { is as is4 } from "drizzle-orm";
2752
+ import { is as is5 } from "drizzle-orm";
2672
2753
  import { PgTable as PgTable3, isPgEnum as isPgEnum3, isPgMaterializedView as isPgMaterializedView3, isPgView as isPgView3 } from "drizzle-orm/pg-core";
2673
2754
  function collectExtras(modules) {
2674
2755
  const extras = {
@@ -2724,7 +2805,7 @@ function walk(value, extras, seen) {
2724
2805
  if (kind === "partitionedTable") {
2725
2806
  const partitioned = value;
2726
2807
  extras.partitionedTables.push(partitioned);
2727
- if (is4(partitioned.table, PgTable3)) walk(partitioned.table, extras, seen);
2808
+ if (is5(partitioned.table, PgTable3)) walk(partitioned.table, extras, seen);
2728
2809
  return;
2729
2810
  }
2730
2811
  if (kind === "partition") {
@@ -2738,14 +2819,14 @@ function walk(value, extras, seen) {
2738
2819
  if (kind === "hypertable") {
2739
2820
  const hypertable = value;
2740
2821
  extras.hypertables.push(hypertable);
2741
- if (is4(hypertable.table, PgTable3)) walk(hypertable.table, extras, seen);
2822
+ if (is5(hypertable.table, PgTable3)) walk(hypertable.table, extras, seen);
2742
2823
  return;
2743
2824
  }
2744
2825
  if (isPgView3(value) || isPgMaterializedView3(value)) {
2745
2826
  pushView(extras, value);
2746
2827
  return;
2747
2828
  }
2748
- if (is4(value, PgTable3)) {
2829
+ if (is5(value, PgTable3)) {
2749
2830
  if (!extras.tables.includes(value)) extras.tables.push(value);
2750
2831
  return;
2751
2832
  }