<?php

class Migration_20240712000018_create_role_description_table
{
    public static function up(PDO $pdo)
    {
        $sql = "
            CREATE TABLE IF NOT EXISTS `role_desc` (
                `id` INT NOT NULL AUTO_INCREMENT,
                `role_id` INT NOT NULL,
                `desc` VARCHAR(255) NOT NULL,
                PRIMARY KEY (`id`)
            )
        ";

        $pdo->exec($sql);

        $sql = "
            INSERT INTO role_desc (role_id, `desc`) VALUES 
                (1, 'Full Control'),
                (2, 'Administrator Control. User can create/modify/delete all users or operators at Dealers level and below'),
                (3, 'Dealers Control. User can create/modify/delete all users or operators at Organization level and below'),
                (4, 'Organization Admins Control. User can create/modify/delete all users or operators at Property Admin level and below'),
                (5, 'Property Admin Control. User can create/modify/delete all users or operators at Property level and below'),
                (6, 'Users Control. User can create/modify/delete all Visitors associated to them'),
                (7, 'Visitor Control. Visitors have no website permissions')
        ";

        $pdo->exec($sql);
    }

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