<?php
require_once __DIR__ . '/../../db/config.php';

try {
    $pdo = db();

    $sql = "CREATE TABLE IF NOT EXISTS event_types (
        id INT AUTO_INCREMENT PRIMARY KEY,
        name VARCHAR(255) NOT NULL,
        color VARCHAR(7) NOT NULL DEFAULT '#007bff'
    );";

    $pdo->exec($sql);

    // Add some default values
    $sql_insert = "INSERT INTO event_types (name, color) VALUES
    ('Meeting', '#007bff'),
    ('Training', '#ffc107'),
    ('Other', '#28a745');";
    $pdo->exec($sql_insert);


    echo "Migration 003 completed successfully.\n";
} catch (PDOException $e) {
    die("Migration 003 failed: " . $e->getMessage() . "\n");
}