"""empty message

Revision ID: 82669ff31369
Revises: 
Create Date: 2021-03-22 20:19:04.915369

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

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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('movies_genres')
    op.drop_table('movies_person')
    op.drop_table('movies')
    op.drop_table('genres')
    op.drop_table('persons')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('persons',
    sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
    sa.Column('name', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
    sa.PrimaryKeyConstraint('id', name='persons_pkey'),
    postgresql_ignore_search_path=False
    )
    op.create_table('genres',
    sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
    sa.Column('name', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
    sa.PrimaryKeyConstraint('id', name='genres_pkey'),
    postgresql_ignore_search_path=False
    )
    op.create_table('movies',
    sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
    sa.Column('title', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
    sa.Column('plot', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('imdb_rating', sa.NUMERIC(), server_default=sa.text('0'), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='movies_pkey'),
    postgresql_ignore_search_path=False
    )
    op.create_table('movies_person',
    sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
    sa.Column('movie_id', postgresql.UUID(), autoincrement=False, nullable=False),
    sa.Column('person_id', postgresql.UUID(), autoincrement=False, nullable=False),
    sa.Column('position', postgresql.ENUM('director', 'writer', 'actor', name='person_position'), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['id'], ['movies.id'], name='movies_person_movie'),
    sa.ForeignKeyConstraint(['id'], ['persons.id'], name='movies_person_person'),
    sa.PrimaryKeyConstraint('id', name='movies_person_pkey')
    )
    op.create_table('movies_genres',
    sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
    sa.Column('movie_id', postgresql.UUID(), autoincrement=False, nullable=False),
    sa.Column('genre_id', postgresql.UUID(), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['id'], ['genres.id'], name='movies_genres_genre'),
    sa.ForeignKeyConstraint(['id'], ['movies.id'], name='movies_genres_movie'),
    sa.PrimaryKeyConstraint('id', name='movies_genres_pkey')
    )
    # ### end Alembic commands ###
