mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-11 07:42:20 -05:00
we need to track the state of sending to different provider separately (and trigger them off separately, refer to references separately, etc)
50 lines
1.5 KiB
Python
50 lines
1.5 KiB
Python
"""
|
|
|
|
Revision ID: 0332_broadcast_provider_msg
|
|
Revises: 0331_add_broadcast_org
|
|
Create Date: 2020-10-26 16:28:11.917468
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
revision = '0332_broadcast_provider_msg'
|
|
down_revision = '0331_add_broadcast_org'
|
|
|
|
STATUSES = [
|
|
'technical-failure',
|
|
'sending',
|
|
'returned-ack',
|
|
'returned-error',
|
|
]
|
|
|
|
|
|
def upgrade():
|
|
|
|
broadcast_provider_message_status_type = op.create_table(
|
|
'broadcast_provider_message_status_type',
|
|
sa.Column('name', sa.String(), nullable=False),
|
|
sa.PrimaryKeyConstraint('name')
|
|
)
|
|
op.bulk_insert(broadcast_provider_message_status_type, [{'name': status} for status in STATUSES])
|
|
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table(
|
|
'broadcast_provider_message',
|
|
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
|
|
sa.Column('broadcast_event_id', postgresql.UUID(as_uuid=True), nullable=True),
|
|
sa.Column('provider', sa.String(), nullable=True),
|
|
sa.Column('status', sa.String(), nullable=True),
|
|
sa.Column('created_at', sa.DateTime(), nullable=False),
|
|
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
|
sa.ForeignKeyConstraint(['broadcast_event_id'], ['broadcast_event.id'], ),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
sa.UniqueConstraint('broadcast_event_id', 'provider')
|
|
)
|
|
|
|
|
|
def downgrade():
|
|
op.drop_table('broadcast_provider_message')
|
|
op.drop_table('broadcast_provider_message_status_type')
|