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

function migrate_celestial_object_types() {
    $db = db();
    
    // Check if table exists
    $result = $db->query("SHOW TABLES LIKE 'celestial_object_types'");
    if ($result->rowCount() > 0) {
        echo "Table celestial_object_types already exists.\n";
        return;
    }

    echo "Creating table celestial_object_types...\n";
    $sql = "CREATE TABLE celestial_object_types (
        id INT AUTO_INCREMENT PRIMARY KEY,
        name VARCHAR(255) NOT NULL,
        slug VARCHAR(50) NOT NULL UNIQUE,
        icon VARCHAR(50),
        description TEXT,
        image_url VARCHAR(255),
        orbital_control_enabled TINYINT(1) DEFAULT 1,
        terrestrial_control_enabled TINYINT(1) DEFAULT 1,
        status_profile_id INT
    ) ENGINE=InnoDB;";
    
    $db->exec($sql);
    echo "Table celestial_object_types created successfully.\n";
}

migrate_celestial_object_types();
?>