Phase 1-3 of decoupling plan: - Shared DB, models, infrastructure, browser, config, utils - Event infrastructure (domain_events outbox, bus, processor) - Structured logging - Generic container concept (container_type/container_id) - Alembic migrations for all schema changes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
|
|
# Alembic migration script template
|
|
|
|
"""Add calendar_entry_posts association table
|
|
|
|
Revision ID: 6cb124491c9d
|
|
Revises: 0011_add_entry_tickets
|
|
Create Date: 2025-12-07 03:40:49.194068
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects.postgresql import TIMESTAMP
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '6cb124491c9d'
|
|
down_revision = '0011_add_entry_tickets'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
'calendar_entry_posts',
|
|
sa.Column('id', sa.Integer(), primary_key=True, autoincrement=True),
|
|
sa.Column('entry_id', sa.Integer(), sa.ForeignKey('calendar_entries.id', ondelete='CASCADE'), nullable=False),
|
|
sa.Column('post_id', sa.Integer(), sa.ForeignKey('posts.id', ondelete='CASCADE'), nullable=False),
|
|
sa.Column('created_at', TIMESTAMP(timezone=True), nullable=False, server_default=sa.func.now()),
|
|
sa.Column('deleted_at', TIMESTAMP(timezone=True), nullable=True),
|
|
)
|
|
op.create_index('ix_entry_posts_entry_id', 'calendar_entry_posts', ['entry_id'])
|
|
op.create_index('ix_entry_posts_post_id', 'calendar_entry_posts', ['post_id'])
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index('ix_entry_posts_post_id', 'calendar_entry_posts')
|
|
op.drop_index('ix_entry_posts_entry_id', 'calendar_entry_posts')
|
|
op.drop_table('calendar_entry_posts')
|