<?php

class Migration_20240712000013_property_invitations
{
    public static function up(PDO $pdo)
    {
        $sql = "
            CREATE TABLE IF NOT EXISTS property_invitations (
                id INT AUTO_INCREMENT PRIMARY KEY,
                email VARCHAR(255) NOT NULL UNIQUE,
                token VARCHAR(64) NOT NULL,
                role VARCHAR(25) NOT NULL,
                role_type INT NOT NULL,
                invited_by INT NOT NULL,
                creator_type ENUM('users', 'property_users'),
                created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
            );
        ";

        $pdo->exec($sql);
    }

    public static function down(PDO $pdo)
    {
        $sql = "
            DROP TABLE IF EXISTS property_invitations;
        ";

        $pdo->exec($sql);
    }
}
