Phase 5: Drop cross-domain FK constraints (events → cart)
Merge three alembic heads and drop: - calendar_entries.order_id FK → orders.id - tickets.order_id FK → orders.id Columns kept as plain integers for glue-service bridging. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
51
alembic/versions/j0h8e4f6g7_drop_cross_domain_fks.py
Normal file
51
alembic/versions/j0h8e4f6g7_drop_cross_domain_fks.py
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
"""drop cross-domain FK constraints (events → cart)
|
||||||
|
|
||||||
|
Merge three existing heads and remove:
|
||||||
|
- calendar_entries.order_id FK → orders.id
|
||||||
|
- tickets.order_id FK → orders.id
|
||||||
|
|
||||||
|
Columns are kept as plain integers.
|
||||||
|
|
||||||
|
Revision ID: j0h8e4f6g7
|
||||||
|
Revises: c3d4e5f6a7b8, i9g7d3e5f6, g7e5b1c3d4f8
|
||||||
|
Create Date: 2026-02-14
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
revision = 'j0h8e4f6g7'
|
||||||
|
down_revision = ('c3d4e5f6a7b8', 'i9g7d3e5f6', 'g7e5b1c3d4f8')
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
op.drop_constraint(
|
||||||
|
'fk_calendar_entries_order_id',
|
||||||
|
'calendar_entries',
|
||||||
|
type_='foreignkey',
|
||||||
|
)
|
||||||
|
op.drop_constraint(
|
||||||
|
'tickets_order_id_fkey',
|
||||||
|
'tickets',
|
||||||
|
type_='foreignkey',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
op.create_foreign_key(
|
||||||
|
'fk_calendar_entries_order_id',
|
||||||
|
'calendar_entries',
|
||||||
|
'orders',
|
||||||
|
['order_id'],
|
||||||
|
['id'],
|
||||||
|
ondelete='SET NULL',
|
||||||
|
)
|
||||||
|
op.create_foreign_key(
|
||||||
|
'tickets_order_id_fkey',
|
||||||
|
'tickets',
|
||||||
|
'orders',
|
||||||
|
['order_id'],
|
||||||
|
['id'],
|
||||||
|
ondelete='SET NULL',
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user