"""rename the table github_accepted_orgs github_orgs

Revision ID: 936fc5b02f16
Revises: c0d8d6a8f071
Create Date: 2020-12-26 18:43:24.367061

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '936fc5b02f16'
down_revision = 'c0d8d6a8f071'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.rename_table('github_accepted_orgs', 'github_orgs')
    # op.create_table('github_orgs',
    # sa.Column('org_id', sa.Integer(), nullable=False),
    # sa.Column('login', sa.Text(), nullable=False),
    # sa.PrimaryKeyConstraint('org_id', name=op.f('pk_github_orgs'))
    # )
    # op.drop_table('github_accepted_orgs')
    # with op.batch_alter_table('github_org_memberships', schema=None) as batch_op:
    #     batch_op.drop_constraint('fk_github_org_memberships_org_id_github_accepted_orgs', type_='foreignkey')
    #     batch_op.create_foreign_key(batch_op.f('fk_github_org_memberships_org_id_github_orgs'), 'github_orgs', ['org_id'], ['org_id'])

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.rename_table('github_orgs', 'github_accepted_orgs')
    # with op.batch_alter_table('github_org_memberships', schema=None) as batch_op:
    #     batch_op.drop_constraint(batch_op.f('fk_github_org_memberships_org_id_github_orgs'), type_='foreignkey')
    #     batch_op.create_foreign_key('fk_github_org_memberships_org_id_github_accepted_orgs', 'github_accepted_orgs', ['org_id'], ['org_id'])

    # op.create_table('github_accepted_orgs',
    # sa.Column('org_id', sa.INTEGER(), nullable=False),
    # sa.Column('login', sa.TEXT(), nullable=False),
    # sa.PrimaryKeyConstraint('org_id', name='pk_github_accepted_orgs')
    # )
    # op.drop_table('github_orgs')
    # ### end Alembic commands ###
