Files
mono/shared/alembic/versions/f6d4a0b2c3e7_add_domain_events_table.py
giles f42042ccb7 Monorepo: consolidate 7 repos into one
Combines shared, blog, market, cart, events, federation, and account
into a single repository. Eliminates submodule sync, sibling model
copying at build time, and per-app CI orchestration.

Changes:
- Remove per-app .git, .gitmodules, .gitea, submodule shared/ dirs
- Remove stale sibling model copies from each app
- Update all 6 Dockerfiles for monorepo build context (root = .)
- Add build directives to docker-compose.yml
- Add single .gitea/workflows/ci.yml with change detection
- Add .dockerignore for monorepo build context
- Create __init__.py for federation and account (cross-app imports)
2026-02-24 19:44:17 +00:00

41 lines
1.6 KiB
Python

"""add domain_events table
Revision ID: f6d4a0b2c3e7
Revises: e5c3f9a2b1d6
Create Date: 2026-02-11
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = 'f6d4a0b2c3e7'
down_revision = 'e5c3f9a2b1d6'
branch_labels = None
depends_on = None
def upgrade() -> None:
op.create_table(
'domain_events',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('event_type', sa.String(128), nullable=False),
sa.Column('aggregate_type', sa.String(64), nullable=False),
sa.Column('aggregate_id', sa.Integer(), nullable=False),
sa.Column('payload', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('state', sa.String(20), server_default='pending', nullable=False),
sa.Column('attempts', sa.Integer(), server_default='0', nullable=False),
sa.Column('max_attempts', sa.Integer(), server_default='5', nullable=False),
sa.Column('last_error', sa.Text(), nullable=True),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
sa.Column('processed_at', sa.DateTime(timezone=True), nullable=True),
sa.PrimaryKeyConstraint('id'),
)
op.create_index('ix_domain_events_event_type', 'domain_events', ['event_type'])
op.create_index('ix_domain_events_state', 'domain_events', ['state'])
def downgrade() -> None:
op.drop_index('ix_domain_events_state', table_name='domain_events')
op.drop_index('ix_domain_events_event_type', table_name='domain_events')
op.drop_table('domain_events')