"""add convidado uuid and config table

Revision ID: fd3541cfc5ca
Revises: 9ac560dc68fb
Create Date: 2020-09-02 23:05:13.613487

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'fd3541cfc5ca'
down_revision = '9ac560dc68fb'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('configuracoes',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('chave', sa.String(length=40), nullable=True),
    sa.Column('valor', sa.String(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column('convidados', sa.Column('convide_uuid', sa.String(length=64), nullable=True))
    op.create_foreign_key(None, 'convidados', 'noivos', ['fk_noivo'], ['id'])
    op.create_foreign_key(None, 'convidados', 'categorias', ['fk_categoria'], ['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_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')
    op.drop_column('convidados', 'convide_uuid')
    op.drop_table('configuracoes')
    # ### end Alembic commands ###
