Files
rose-ash/relations/alembic/versions/0003_backfill_calendar_metadata.py
giles eda95ec58b
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m15s
Enable cross-subdomain htmx and purify layout to sexp
- Disable htmx selfRequestsOnly, add CORS headers for *.rose-ash.com
- Remove same-origin guards from ~menu-row and ~nav-link htmx attrs
- Convert ~app-layout from string-concatenated HTML to pure sexp tree
- Extract ~app-head component, replace ~app-shell with inline structure
- Convert hamburger SVG from Python HTML constant to ~hamburger sexp component
- Fix cross-domain fragment URLs (events_url, market_url)
- Fix starts-with? primitive to handle nil values
- Fix duplicate admin menu rows on OOB swaps
- Add calendar admin nav links (slots, description)
- Convert slots page from Jinja to sexp rendering
- Disable page caching in development mode
- Backfill migration to clean orphaned container_relations

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:09:00 +00:00

31 lines
688 B
Python

"""Backfill label + metadata for calendar relations.
Removes calendar relations with no metadata slug and no label,
which are either orphaned or were created before metadata was tracked.
Revision ID: relations_0003
Revises: relations_0002
Create Date: 2026-02-28
"""
import sqlalchemy as sa
from alembic import op
revision = "relations_0003"
down_revision = "relations_0002"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.execute("""
DELETE FROM container_relations
WHERE child_type IN ('calendar', 'market')
AND (metadata IS NULL OR metadata->>'slug' IS NULL)
AND label IS NULL
""")
def downgrade() -> None:
pass