"""empty message

Revision ID: 9dc91a50e1c7
Revises: 58208f0f33f7
Create Date: 2022-07-14 18:20:57.128181

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

# revision identifiers, used by Alembic.
revision = '9dc91a50e1c7'
down_revision = '58208f0f33f7'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('media',
    sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
    sa.Column('title', sa.String(), nullable=False),
    sa.Column('description', sa.String(), nullable=False),
    sa.Column('link', sa.String(), nullable=True),
    sa.Column('reviewed', sa.String(), nullable=False),
    sa.Column('order', sa.Integer(), nullable=False),
    sa.Column('project_id', postgresql.UUID(as_uuid=True), nullable=False),
    sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column('project', sa.Column('description', sa.String(), nullable=True))
    op.add_column('project', sa.Column('show_only_reviewed_media', sa.String(), nullable=True))
    show_only_reviewed_media = sa.table('project', sa.column('show_only_reviewed_media'))
    op.execute(show_only_reviewed_media.update().values(show_only_reviewed_media=False))
    op.alter_column('project', 'show_only_reviewed_media', nullable=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('project', 'show_only_reviewed_media')
    op.drop_column('project', 'description')
    op.drop_table('media')
    # ### end Alembic commands ###
