"""

Revision ID: 0334_broadcast_message_number
Revises: 0333_service_broadcast_provider
Create Date: 2020-12-04 15:06:22.544803

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

revision = '0334_broadcast_message_number'
down_revision = '0333_service_broadcast_provider'


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.execute("create sequence broadcast_provider_message_number_seq")
    op.create_table(
        'broadcast_provider_message_number',
        sa.Column(
            'broadcast_provider_message_number',
            sa.Integer(),
            server_default=sa.text("nextval('broadcast_provider_message_number_seq')"),
            nullable=False
        ),
        sa.Column('broadcast_provider_message_id', postgresql.UUID(as_uuid=True), nullable=False),
        sa.ForeignKeyConstraint(['broadcast_provider_message_id'], ['broadcast_provider_message.id'], ),
        sa.PrimaryKeyConstraint('broadcast_provider_message_number')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('broadcast_provider_message_number')
    op.execute("drop sequence broadcast_provider_message_number_seq")
    # ### end Alembic commands ###
