<?php

class Migration_20250203111948_dont_disturb_table
{
    public static function up(PDO $pdo)
    {
        $sql = "
        CREATE TABLE don_not_disturb (
            id INT AUTO_INCREMENT PRIMARY KEY,
            user_email VARCHAR(255) NOT NULL,
            user_id INT NOT NULL,
            isDontDisturb BOOLEAN NOT NULL DEFAULT FALSE,
            property_id INT NULL,
            createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
            updatedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
            FOREIGN KEY (property_id) REFERENCES properties(id)
            ON DELETE SET NULL ON UPDATE CASCADE
        );
        ";
        $pdo->exec($sql);
    }

    public static function down(PDO $pdo)
    {
        $sql = "DROP TABLE IF EXISTS don_not_disturb;";
        $pdo->exec($sql);
    }
}
