"""empty message

Revision ID: 0cbb4ee729f2
Revises: a8e18daeb3ca
Create Date: 2020-11-23 21:23:56.512877

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '0cbb4ee729f2'
down_revision = 'a8e18daeb3ca'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('charity',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(), nullable=True),
    sa.Column('image_path', sa.String(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column('about_service', sa.Column('name', sa.String(), nullable=True))
    op.add_column('charities', sa.Column('id_charity', sa.Integer(), nullable=False))
    op.create_foreign_key(None, 'charities', 'charity', ['id_charity'], ['id'])
    op.add_column('reference', sa.Column('id_charity', sa.Integer(), nullable=False))
    op.drop_constraint('reference_id_charities_key', 'reference', type_='unique')
    op.create_unique_constraint(None, 'reference', ['id_charity'])
    op.drop_constraint('reference_id_charities_fkey', 'reference', type_='foreignkey')
    op.create_foreign_key(None, 'reference', 'charity', ['id_charity'], ['id'])
    op.drop_column('reference', 'id_charities')
    op.add_column('support', sa.Column('name', sa.String(), nullable=True))
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('support', 'name')
    op.add_column('reference', sa.Column('id_charities', sa.INTEGER(), autoincrement=False, nullable=False))
    op.drop_constraint(None, 'reference', type_='foreignkey')
    op.create_foreign_key('reference_id_charities_fkey', 'reference', 'charities', ['id_charities'], ['id'])
    op.drop_constraint(None, 'reference', type_='unique')
    op.create_unique_constraint('reference_id_charities_key', 'reference', ['id_charities'])
    op.drop_column('reference', 'id_charity')
    op.drop_constraint(None, 'charities', type_='foreignkey')
    op.drop_column('charities', 'id_charity')
    op.drop_column('about_service', 'name')
    op.drop_table('charity')
    # ### end Alembic commands ###
