"""update fav list

Revision ID: 5d9adc826605
Revises: e9e8638813b7
Create Date: 2020-11-10 20:45:18.626007

"""
from alembic import op
import sqlalchemy as sa
import app
import sqlalchemy_utils
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = '5d9adc826605'
down_revision = 'e9e8638813b7'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user_favourites',
    sa.Column('user_id', sqlalchemy_utils.types.uuid.UUIDType(), nullable=False),
    sa.Column('recipe_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['user_id'], ['user.user_id'], ),
    sa.PrimaryKeyConstraint('user_id', 'recipe_id')
    )
    op.drop_table('favourites_list')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('favourites_list',
    sa.Column('user_id', sa.BINARY(length=16), nullable=False),
    sa.Column('recipe_id', sa.BINARY(length=16), nullable=False),
    sa.Column('temp', mysql.VARCHAR(length=50), nullable=True),
    sa.ForeignKeyConstraint(['recipe_id'], ['recipe.recipe_id'], name='favourites_list_ibfk_2'),
    sa.ForeignKeyConstraint(['user_id'], ['user.user_id'], name='favourites_list_ibfk_1'),
    sa.PrimaryKeyConstraint('user_id'),
    mysql_collate='utf8mb4_0900_ai_ci',
    mysql_default_charset='utf8mb4',
    mysql_engine='InnoDB'
    )
    op.drop_table('user_favourites')
    # ### end Alembic commands ###
