<?php

class Migration_20250202212809_add_new_creatortype
{
    public static function up(PDO $pdo)
    {
        $pdo->exec("SET FOREIGN_KEY_CHECKS = 0;");

        $pdo->exec("ALTER TABLE profile_photo MODIFY COLUMN creator_type ENUM('users', 'property_users', 'dealer_admins') NOT NULL;");
        $pdo->exec("ALTER TABLE dealer_admins_data MODIFY COLUMN creator_type ENUM('users', 'property_users', 'dealer_admins') NOT NULL;");
        $pdo->exec("ALTER TABLE dealer_invitations MODIFY COLUMN creator_type ENUM('users', 'property_users', 'dealer_admins') NOT NULL;");
        $pdo->exec("ALTER TABLE multi_prop_users MODIFY COLUMN creator_type ENUM('users', 'property_users', 'dealer_admins') NOT NULL;");
        $pdo->exec("ALTER TABLE property_users MODIFY COLUMN creator_type ENUM('users', 'property_users', 'dealer_admins') NOT NULL;");
        $pdo->exec("ALTER TABLE property_users_data MODIFY COLUMN creator_type ENUM('users', 'property_users', 'dealer_admins') NOT NULL;");
        $pdo->exec("ALTER TABLE property_groups MODIFY COLUMN creator_type ENUM('users', 'property_users', 'dealer_admins') NOT NULL;");
        $pdo->exec("ALTER TABLE property_invitations MODIFY COLUMN creator_type ENUM('users', 'property_users', 'dealer_admins') NOT NULL;");

        $pdo->exec("SET FOREIGN_KEY_CHECKS = 1;");
    }

    public static function down(PDO $pdo)
    {
        $pdo->exec("SET FOREIGN_KEY_CHECKS = 0;");

        $pdo->exec("ALTER TABLE profile_photo MODIFY COLUMN creator_type ENUM('users', 'property_users') NOT NULL;");
        $pdo->exec("ALTER TABLE dealer_admins MODIFY COLUMN creator_type ENUM('users', 'property_users') NOT NULL;");
        $pdo->exec("ALTER TABLE dealer_admins_data MODIFY COLUMN creator_type ENUM('users', 'property_users') NOT NULL;");
        $pdo->exec("ALTER TABLE dealer_invitations MODIFY COLUMN creator_type ENUM('users', 'property_users') NOT NULL;");
        $pdo->exec("ALTER TABLE multi_prop_users MODIFY COLUMN creator_type ENUM('users', 'property_users') NOT NULL;");
        $pdo->exec("ALTER TABLE property_users MODIFY COLUMN creator_type ENUM('users', 'property_users') NOT NULL;");
        $pdo->exec("ALTER TABLE property_users_data MODIFY COLUMN creator_type ENUM('users', 'property_users') NOT NULL;");
        $pdo->exec("ALTER TABLE property_groups MODIFY COLUMN creator_type ENUM('users', 'property_users') NOT NULL;");
        $pdo->exec("ALTER TABLE property_invitations MODIFY COLUMN creator_type ENUM('users', 'property_users') NOT NULL;");

        $pdo->exec("SET FOREIGN_KEY_CHECKS = 1;");
    }
}