<?php

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

        $pdo->exec($sql);

        $sql1 = "
            INSERT INTO key_type (name, `desc`) VALUES 
                ('CallerID', 'Automatically recognizes a pre-approved phone number and triggers the immediate opening of a door or gate for secure and convenient access.'),
                ('Key Code', 'Allows access by entering a numerical PIN, which, when correctly input, grants secure entry through a door or gate.'),
                ('Magic Password', 'Grants access by recognizing a specific verbal word or phrase, which, when spoken, triggers the opening of a door or gate.')
            ;
        ";

        $pdo->exec($sql1);
    }

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