"""empty message

Revision ID: 14795b402e17
Revises: 
Create Date: 2019-03-17 22:28:35.781148

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

# revision identifiers, used by Alembic.
revision = '14795b402e17'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(
        'fbusers',
        'last_reward_points',
        existing_type=sa.INTEGER(),
        nullable=False)
    op.drop_constraint(
        'menusectionassignemnts_section_name_fkey',
        'menusectionassignemnts',
        type_='foreignkey')
    op.create_foreign_key(
        None,
        'menusectionassignemnts',
        'menusections', ['section_name', 'restaurant_id'],
        ['name', 'restaurant_id'],
        onupdate='CASCADE',
        ondelete='CASCADE')
    op.alter_column(
        'restaurants',
        'approval_status',
        existing_type=postgresql.ENUM(
            'pending', 'approved', 'rejected', name='approvalstatus'),
        nullable=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(
        'restaurants',
        'approval_status',
        existing_type=postgresql.ENUM(
            'pending', 'approved', 'rejected', name='approvalstatus'),
        nullable=True)
    op.drop_constraint(None, 'menusectionassignemnts', type_='foreignkey')
    op.create_foreign_key(
        'menusectionassignemnts_section_name_fkey',
        'menusectionassignemnts',
        'menusections', ['section_name', 'restaurant_id'],
        ['name', 'restaurant_id'],
        ondelete='CASCADE')
    op.alter_column(
        'fbusers',
        'last_reward_points',
        existing_type=sa.INTEGER(),
        nullable=True)
    # ### end Alembic commands ###
