Fix CalendarEntryPost join: add explicit ON clause for polymorphic content_id
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m47s

content_id is a loose reference (no FK to posts.id), so SQLAlchemy
cannot infer the join condition automatically.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-18 21:24:39 +00:00
parent ba456dca4c
commit b153203fc0

View File

@@ -97,7 +97,7 @@ async def get_entry_posts(
"""
result = await session.execute(
select(Post)
.join(CalendarEntryPost)
.join(CalendarEntryPost, (CalendarEntryPost.content_id == Post.id) & (CalendarEntryPost.content_type == "post"))
.where(
CalendarEntryPost.entry_id == entry_id,
CalendarEntryPost.deleted_at.is_(None)