"""complete models

Revision ID: f4cf7890a4b6
Revises: 
Create Date: 2021-08-31 10:36:19.038838

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('actor',
    sa.Column('id', sa.String(length=16), nullable=False),
    sa.Column('name', sa.String(length=120), nullable=True),
    sa.Column('image_url', sa.Text(), nullable=True),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_actor_name'), 'actor', ['name'], unique=True)
    op.create_index(op.f('ix_actor_timestamp'), 'actor', ['timestamp'], unique=False)
    op.create_table('film',
    sa.Column('id', sa.String(length=16), nullable=False),
    sa.Column('title', sa.String(length=128), nullable=True),
    sa.Column('year', sa.Integer(), nullable=True),
    sa.Column('image_url', sa.Text(), nullable=True),
    sa.Column('featured_cast', sa.Text(), nullable=True),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_film_timestamp'), 'film', ['timestamp'], unique=False)
    op.create_index(op.f('ix_film_title'), 'film', ['title'], unique=False)
    op.create_table('actor_film',
    sa.Column('actor_id', sa.String(), nullable=True),
    sa.Column('film_id', sa.String(), nullable=True),
    sa.ForeignKeyConstraint(['actor_id'], ['actor.id'], ),
    sa.ForeignKeyConstraint(['film_id'], ['film.id'], )
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('actor_film')
    op.drop_index(op.f('ix_film_title'), table_name='film')
    op.drop_index(op.f('ix_film_timestamp'), table_name='film')
    op.drop_table('film')
    op.drop_index(op.f('ix_actor_timestamp'), table_name='actor')
    op.drop_index(op.f('ix_actor_name'), table_name='actor')
    op.drop_table('actor')
    # ### end Alembic commands ###
