21 lines
706 B
Python
21 lines
706 B
Python
|
|
"""Checkpoint B: associer un profil validé à un local."""
|
||
|
|
from alembic import op
|
||
|
|
import sqlalchemy as sa
|
||
|
|
|
||
|
|
revision = "l7a8b9c0d1e2"
|
||
|
|
down_revision = "k6f7a8b9c0d1"
|
||
|
|
branch_labels = None
|
||
|
|
depends_on = None
|
||
|
|
|
||
|
|
|
||
|
|
def upgrade():
|
||
|
|
op.add_column("rooms", sa.Column("room_profile_id", sa.Integer(), nullable=True))
|
||
|
|
op.create_foreign_key("fk_rooms_room_profile_id", "rooms", "room_profiles", ["room_profile_id"], ["id"])
|
||
|
|
op.create_index("ix_rooms_room_profile_id", "rooms", ["room_profile_id"])
|
||
|
|
|
||
|
|
|
||
|
|
def downgrade():
|
||
|
|
op.drop_index("ix_rooms_room_profile_id", table_name="rooms")
|
||
|
|
op.drop_constraint("fk_rooms_room_profile_id", "rooms", type_="foreignkey")
|
||
|
|
op.drop_column("rooms", "room_profile_id")
|