"""1- movie table added to db

Revision ID: b57c21d5c66f
Revises: c12b19e59531
Create Date: 2020-01-24 22:00:08.863526

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

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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('movies',
    sa.Column('creation_date', sa.Integer(), nullable=False),
    sa.Column('modification_date', sa.Integer(), nullable=True),
    sa.Column('id', postgresql.UUID(), nullable=False),
    sa.Column('version', sa.Integer(), nullable=True),
    sa.Column('tags', postgresql.ARRAY(sa.String()), nullable=True),
    sa.Column('creator', sa.String(), nullable=True),
    sa.Column('modifier', sa.String(), nullable=True),
    sa.Column('title', sa.String(), nullable=False),
    sa.Column('description', sa.String(), nullable=True),
    sa.Column('director', sa.String(), nullable=True),
    sa.Column('writer', sa.String(), nullable=True),
    sa.Column('producer', sa.String(), nullable=True),
    sa.Column('images', sa.ARRAY(postgresql.UUID()), nullable=True),
    sa.Column('genre', sa.ARRAY(sa.String()), nullable=True),
    sa.Column('pub_year', sa.String(), nullable=True),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_tb_movies')),
    sa.UniqueConstraint('id', name=op.f('movies_id_key'))
    )
    op.drop_constraint('persons_id_key', 'persons', type_='unique')
    op.create_unique_constraint(op.f('persons_id_key'), 'persons', ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(op.f('persons_id_key'), 'persons', type_='unique')
    op.create_unique_constraint('persons_id_key', 'persons', ['cell_no'])
    op.drop_table('movies')
    # ### end Alembic commands ###
