Skip to content

Conversation

@sweatybridge
Copy link
Contributor

@sweatybridge sweatybridge commented Aug 13, 2025

The function get_dependency_by_signature may return undefined if none of the things match the given signature.

Filter out those undefined dependencies so that migra doesn't crash out completely.

Steps to reproduce

The simplest repro is to create the following view on supabase.

CREATE OR REPLACE VIEW "public"."users" AS
 SELECT * FROM "auth"."users" "o"
  WHERE ("o"."id" = "auth"."uid"());

Then run migra on the same database.

import { createClient } from "@pgkit/client";
import { Migration } from "@pgkit/migra";

const dbURL = "postgres://..."
const clientBase = createClient(dbURL);
const clientHead = createClient(dbURL);

const m = await Migration.create(clientBase, clientHead, {});
m.add_all_changes(true);
console.log(m.sql);

@vercel
Copy link

vercel bot commented Aug 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Project Deployment Preview Comments Updated (UTC)
pgkit Ready Preview Comment Aug 13, 2025 8:09pm

@sweatybridge
Copy link
Contributor Author

@mmkal any idea why the formatting of test snapshot might be inconsistent between test runs?

@sweatybridge
Copy link
Contributor Author

@mmkal could you help me rerun the failing test? It's passing locally for me

 RUN  v1.2.2 /Users/qiao/work/pgkit/packages/typegen

 ✓ test/cte.test.ts (7) 2580ms
 ✓ test/view.test.ts (2) 1835ms
 ✓ test/ambiguous-tables.test.ts (1) 1216ms
 ✓ test/watch.test.ts (2) 4645ms
 ✓ test/limitations.test.ts (8) 1992ms
 ✓ test/options.test.ts (6) 5855ms
 ✓ test/ugly.test.ts (3) 1331ms
 ✓ test/deletes.test.ts (2) 1001ms
 ✓ test/inline-tag-modification.test.ts (4) 2092ms
 ✓ test/ignore.test.ts (2) 700ms
 ✓ test/primitives.test.ts (1) 1939ms
 ✓ test/pg-enum.test.ts (1) 659ms
 ✓ test/types.test.ts (1) 549ms
 ✓ test/hand-holding.test.ts (1) 895ms
 ✓ test/util.test.ts (5)
 ✓ test/type-mappings.test.ts (1) 798ms
 ✓ test/subquery.test.ts (1) 929ms
 ✓ test/left-join.test.ts (1) 1197ms
 ✓ test/type-parsers.test.ts (1) 634ms
 ✓ test/property-access-tag.test.ts (1) 747ms
 ✓ test/example.test.ts (1) 711ms
 ✓ test/nullability.test.ts (7)
 ✓ test/pgsql-ast-parser.test.ts (1)
 ✓ test/branding.test.ts (1) 481ms
 ✓ test/locking.test.ts (1) 568ms
 ✓ test/function.test.ts (1) 568ms
 ✓ test/defaults.test.ts (1)

 Test Files  27 passed (27)
      Tests  62 passed | 2 skipped (64)
   Start at  19:08:07
   Duration  8.72s (transform 1.45s, setup 2ms, collect 19.67s, tests 33.94s, environment 3ms, prepare 1.36s)

@sweatybridge
Copy link
Contributor Author

@mmkal sorry to bother you again. Is it ok to merge and release this? It will help resolve a lot of our bug reports.

@mmkal mmkal merged commit 6892562 into mmkal:main Aug 30, 2025
4 of 5 checks passed
@sweatybridge
Copy link
Contributor Author

Thanks for the merge and hope it to see a patch release soon!

@mmkal
Copy link
Owner

mmkal commented Sep 3, 2025

Oh sorry forgot to do a GitHub release but 0.6.1 on npm should have it

@sweatybridge
Copy link
Contributor Author

Amazing. Thanks for the update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants