"""Track the RoomProfile proposal that created an equipment."""
from alembic import op
import sqlalchemy as sa

revision = "m8b9c0d1e2f3"
down_revision = "l7a8b9c0d1e2"
branch_labels = None
depends_on = None

def upgrade():
    op.add_column("equipments", sa.Column("room_profile_item_id", sa.Integer(), nullable=True))
    op.create_foreign_key("fk_equipments_room_profile_item_id", "equipments", "room_profile_items", ["room_profile_item_id"], ["id"])
    op.create_index("ix_equipments_room_profile_item_id", "equipments", ["room_profile_item_id"])

def downgrade():
    op.drop_index("ix_equipments_room_profile_item_id", table_name="equipments")
    op.drop_constraint("fk_equipments_room_profile_item_id", "equipments", type="foreignkey")
    op.drop_column("equipments", "room_profile_item_id")
