"""empty message

Revision ID: cecfbd90cef7
Revises: fb905875eaea
Create Date: 2021-07-15 02:29:19.713964

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('film_director', 'film_id',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.alter_column('film_director', 'director_id',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.drop_constraint('film_director_director_id_fkey', 'film_director', type_='foreignkey')
    op.drop_constraint('film_director_film_id_fkey', 'film_director', type_='foreignkey')
    op.create_foreign_key(None, 'film_director', 'director', ['director_id'], ['director_id'], ondelete='SET NULL')
    op.create_foreign_key(None, 'film_director', 'film', ['film_id'], ['film_id'], ondelete='SET NULL')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'film_director', type_='foreignkey')
    op.drop_constraint(None, 'film_director', type_='foreignkey')
    op.create_foreign_key('film_director_film_id_fkey', 'film_director', 'film', ['film_id'], ['film_id'])
    op.create_foreign_key('film_director_director_id_fkey', 'film_director', 'director', ['director_id'], ['director_id'])
    op.alter_column('film_director', 'director_id',
               existing_type=sa.INTEGER(),
               nullable=False)
    op.alter_column('film_director', 'film_id',
               existing_type=sa.INTEGER(),
               nullable=False)
    # ### end Alembic commands ###
