<?php

class Migration_20240826141006_qr_code_table
{
    public static function up(PDO $pdo)
    {
        // SQL statement to create the qr_code table
        $sql = "
        CREATE TABLE qr_code (
            id INT AUTO_INCREMENT PRIMARY KEY,
            phone_number VARCHAR(20) NULL,
            url VARCHAR(255) NULL,
            email VARCHAR(255) NULL,
            CreatedBy VARCHAR(255),
            createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
            updatedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
            status ENUM('active', 'inactive') DEFAULT 'active',
            description TEXT NULL,
            type ENUM('phone', 'url', 'email') DEFAULT 'phone'
        );
        ";
        
        // Execute the SQL statement
        $pdo->exec($sql);
    }

    public static function down(PDO $pdo)
    {
        // SQL statement to drop the qr_code table
        $sql = "DROP TABLE IF EXISTS qr_code;";
        
        // Execute the SQL statement
        $pdo->exec($sql);
    }
}
