"""Add numero convites confirmados

Revision ID: 4ddeaa5e5701
Revises: 589441f16a66
Create Date: 2021-01-03 13:08:05.025709

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

# revision identifiers, used by Alembic.
revision = '4ddeaa5e5701'
down_revision = '589441f16a66'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('convidados', 'confirmou_presenca', new_column_name='confirmou_presenca_timestamp', existing_type=sa.DateTime(), type=sa.DateTime())
    op.add_column('convidados', sa.Column('confirmou_presenca_numero', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'convidados', 'categorias', ['fk_categoria'], ['id'])
    op.create_foreign_key(None, 'convidados', 'noivos', ['fk_noivo'], ['id'])
    op.create_foreign_key(None, 'presentes', 'categorias', ['fk_categoria'], ['id'])
    op.create_foreign_key(None, 'presentes_comprados', 'presentes', ['fk_presente'], ['id'])
    op.create_foreign_key(None, 'referencia_presentes', 'presentes', ['fk_presente'], ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('convidados', 'confirmou_presenca_numero')
    op.alter_column('convidados', 'confirmou_presenca_timestamp', new_column_name='confirmou_presenca', existing_type=sa.DateTime(), type=sa.DateTime())
    op.drop_constraint(None, 'referencia_presentes', type_='foreignkey')
    op.drop_constraint(None, 'presentes_comprados', type_='foreignkey')
    op.drop_constraint(None, 'presentes', type_='foreignkey')
    op.drop_constraint(None, 'convidados', type_='foreignkey')
    op.drop_constraint(None, 'convidados', type_='foreignkey')
    # ### end Alembic commands ###
