<?php

require_once __DIR__ . '/../db.php';

$sql = file_get_contents(__DIR__ . '/settings_extensions.sql');

if ($sql === false) {
    exit("Unable to read settings_extensions.sql\n");
}

if ($conn->multi_query($sql)) {
    do {
        if ($result = $conn->store_result()) {
            $result->free();
        }
    } while ($conn->more_results() && $conn->next_result());
    echo "Settings extension tables created successfully.\n";
    exit(0);
}

echo "Failed to create settings extension tables: " . $conn->error . "\n";
exit(1);
