"""Agregar Actor

Revision ID: 58f2e1023816
Revises: 1dab8596851b
Create Date: 2021-05-18 13:59:30.194472

"""
from alembic import op
import sqlalchemy as sa
from config.db import GUID

# revision identifiers, used by Alembic.
revision = '58f2e1023816'
down_revision = '1dab8596851b'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('actor',
    sa.Column('id', GUID(), nullable=False),
    sa.Column('nombre', sa.String(length=80), nullable=False, unique=True),
    sa.Column('nombre_completo', sa.String(length=80), nullable=False),
    sa.Column('fecha_nacimiento', sa.Date(), nullable=True),
    sa.Column('descripcion', sa.Text(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column('personaje', sa.Column('actor_id', GUID(), nullable=False))
    op.create_foreign_key('personaje_ibfk_1', 'personaje', 'actor', ['actor_id'], ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint('personaje_ibfk_1', 'personaje', type_='foreignkey')
    op.drop_column('personaje', 'actor_id')
    op.drop_table('actor')
    # ### end Alembic commands ###
