<?php

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

        $sql = "
            CREATE TABLE IF NOT EXISTS `config_files` (
                `id` INT AUTO_INCREMENT PRIMARY KEY,
                `filename` VARCHAR(255) NOT NULL,
                `config` BLOB NOT NULL,
                `property` int NOT NULL,
                `hardware` ENUM('smsio') NOT NULL, 
                `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
            )
        ";

        $pdo->exec($sql);

        $sql1 = "
            CREATE TABLE IF NOT EXISTS `hardware_configs` (
                `id` INT AUTO_INCREMENT PRIMARY KEY,
                `hardware` ENUM('smsio') NOT NULL,
                `base_config` BLOB NOT NULL,
                `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
            )
        ";

        $pdo->exec($sql1);
    }

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

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