<?php

class Migration_20250310111134_alter_door_groups_table
{
    public static function up(PDO $pdo)
    {
        $sqlUpdate = "
            ALTER TABLE `gate_door_group`
            ADD COLUMN `property_id` INT DEFAULT NULL,
            ADD CONSTRAINT `fk_door_gate_group_property_id`
            FOREIGN KEY (`property_id`) REFERENCES `properties`(`id`)
            ON DELETE SET NULL ON UPDATE CASCADE
        ";

        $pdo->exec($sqlUpdate);
    }

    public static function down(PDO $pdo)
    {
        // Rollback code here
    }
}