"""add cluster id in comp_runs

Revision ID: 83f9d2a470ef
Revises: dd8220be55ad
Create Date: 2021-08-31 20:02:45.709839+00:00

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "83f9d2a470ef"
down_revision = "dd8220be55ad"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column("comp_runs", sa.Column("cluster_id", sa.BigInteger(), nullable=True))
    op.create_foreign_key(
        "fk_comp_runs_cluster_id_clusters",
        "comp_runs",
        "clusters",
        ["cluster_id"],
        ["id"],
        onupdate="CASCADE",
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(
        "fk_comp_runs_cluster_id_clusters", "comp_runs", type_="foreignkey"
    )
    op.drop_column("comp_runs", "cluster_id")
    # ### end Alembic commands ###
