<?php

class Migration_20250118045307_alter_users_tble
{
    public static function up(PDO $pdo)
    {

        $sql = "
            ALTER TABLE `users`
            ADD COLUMN `company_name` VARCHAR(100) NOT NULL AFTER `id`;
        ";
        $pdo->exec($sql);


        $sql1 = "
            UPDATE `users`
            SET `company_name` = CASE
                WHEN `layer` IN ('super_admin', 'admin') THEN 'Invisible Intercom'
                WHEN `layer` = 'dealer' THEN 'AutoGate Electric'
            END;
        ";
        $pdo->exec($sql1);

    }

    public static function down(PDO $pdo)
    {
        $sql = "
            ALTER TABLE `users`
            DROP COLUMN `company_name`;
        ";
        $pdo->exec($sql);
    }
}