<?php
include 'includes/db.php';

// Create system_settings table
$sql = "CREATE TABLE IF NOT EXISTS system_settings (
    id INT AUTO_INCREMENT PRIMARY KEY,
    setting_key VARCHAR(50) UNIQUE NOT NULL,
    setting_value VARCHAR(255)
)";

if ($conn->query($sql) === TRUE) {
    echo "Table system_settings created successfully\n";
} else {
    echo "Error creating table: " . $conn->error . "\n";
}

// Insert default registration status
$sql_insert = "INSERT IGNORE INTO system_settings (setting_key, setting_value) VALUES ('registration_status', 'open')";

if ($conn->query($sql_insert) === TRUE) {
    echo "Default setting inserted successfully\n";
} else {
    echo "Error inserting setting: " . $conn->error . "\n";
}
?>
