mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 01:41:05 -05:00
reformat
This commit is contained in:
@@ -9,41 +9,46 @@ from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision = '0332_broadcast_provider_msg'
|
||||
down_revision = '0331_add_broadcast_org'
|
||||
revision = "0332_broadcast_provider_msg"
|
||||
down_revision = "0331_add_broadcast_org"
|
||||
|
||||
STATUSES = [
|
||||
'technical-failure',
|
||||
'sending',
|
||||
'returned-ack',
|
||||
'returned-error',
|
||||
"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')
|
||||
"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],
|
||||
)
|
||||
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')
|
||||
"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')
|
||||
op.drop_table("broadcast_provider_message")
|
||||
op.drop_table("broadcast_provider_message_status_type")
|
||||
|
||||
Reference in New Issue
Block a user