Commit 37cb113
fix(db): stop /feed.xml crashing on "cannot infer relation posts.tags"
The schema barrel re-exports four tables under camelCase aliases for app
ergonomics (post_votes as postVotes, etc.). Passing the whole module
namespace to drizzle put two keys per table into its tableNamesMap; the
collision made drizzle attach each join table's relations to the alias
key and leave the canonical key with none. Relational queries that walk a
many-relation on those tables (with: { tags }, with: { votes }) then threw
"There is not enough information to infer relation posts.tags" — which is
exactly what /feed.xml does, so the RSS feed 500'd.
Strip the aliases from the schema object handed to drizzle so each table
is registered once; app code still imports the aliases from the barrel
unchanged. Adds a regression test that builds the /feed.xml query.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent dd621f2 commit 37cb113
2 files changed
Lines changed: 55 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
8 | 21 | | |
9 | 22 | | |
10 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
0 commit comments