From aa28bddeab522c0d6c769b462a442cf115a71f5f Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Wed, 27 May 2026 15:45:42 -0400 Subject: [PATCH] =?UTF-8?q?fix(alembic=200025):=20qualify=20ambiguous=20po?= =?UTF-8?q?st.id=20/=20post.source=5Fid=20in=20fragment-group=20SELECT=20(?= =?UTF-8?q?post=20JOIN=20source=20=E2=80=94=20both=20have=20id)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- alembic/versions/0025_fix_subscribestar_post_ids.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/alembic/versions/0025_fix_subscribestar_post_ids.py b/alembic/versions/0025_fix_subscribestar_post_ids.py index 2baa72b..b44f430 100644 --- a/alembic/versions/0025_fix_subscribestar_post_ids.py +++ b/alembic/versions/0025_fix_subscribestar_post_ids.py @@ -188,12 +188,13 @@ def upgrade() -> None: # Merge to one canonical row. Pre-handle the same ImageProvenance # collision pattern as alembic 0022 (uq_image_provenance_image_post). fragment_groups = conn.execute(text(""" - SELECT source_id, external_post_id, ARRAY_AGG(id ORDER BY id ASC) AS post_ids + SELECT p.source_id, p.external_post_id, + ARRAY_AGG(p.id ORDER BY p.id ASC) AS post_ids FROM post p JOIN source s ON s.id = p.source_id WHERE s.platform = 'subscribestar' AND p.external_post_id IS NOT NULL - GROUP BY source_id, external_post_id + GROUP BY p.source_id, p.external_post_id HAVING COUNT(*) > 1 """)).fetchall()