"""remove sources table

Revision ID: 0816c22f8668
Revises: 2e1c3b0ba3d1
Create Date: 2019-04-12 14:24:54.105413

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '0816c22f8668'
down_revision = '2e1c3b0ba3d1'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint('files_source_id_fkey', 'files', type_='foreignkey')
    op.drop_column('files', 'source_id')
    op.drop_table('sources')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('files', sa.Column('source_id', sa.INTEGER(), autoincrement=False, nullable=True))
    op.create_foreign_key('files_source_id_fkey', 'files', 'sources', ['source_id'], ['id'])
    op.create_table('sources',
    sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
    sa.Column('name', sa.VARCHAR(), autoincrement=False, nullable=False),
    sa.PrimaryKeyConstraint('id', name='sources_pkey')
    )
    # ### end Alembic commands ###
