Sindbad~EG File Manager
<?php
/**
* Events and Codes Migration Runner
* Creates events and memberuser_codes tables
*/
require_once '../config/config.php';
try {
$db = Database::getInstance()->getConnection();
echo "<h2>Running Events and Codes Migration</h2>\n";
echo "<p>Creating events and memberuser_codes tables...</p>\n";
// Read the migration SQL
$migrationSQL = file_get_contents(__DIR__ . '/migrations/create_events_and_codes_tables.sql');
// Split and execute each statement
$statements = explode(';', $migrationSQL);
foreach ($statements as $statement) {
$statement = trim($statement);
if (!empty($statement)) {
$db->exec($statement);
}
}
echo "<p style='color: green;'>✅ Migration completed successfully!</p>\n";
echo "<p>The events and memberuser_codes tables have been created.</p>\n";
// Verify tables exist
$tables = ['events', 'memberuser_codes'];
foreach ($tables as $table) {
$stmt = $db->query("SHOW TABLES LIKE '{$table}'");
if ($stmt->fetch()) {
echo "<p style='color: green;'>✅ Table verification: {$table} table exists</p>\n";
} else {
echo "<p style='color: red;'>❌ Table verification failed: {$table} table not found</p>\n";
}
}
// Check event records
$stmt = $db->query("SELECT COUNT(*) as count FROM events");
$result = $stmt->fetch();
echo "<p>Default events created: " . $result['count'] . "</p>\n";
} catch (PDOException $e) {
echo "<p style='color: red;'>❌ Migration failed: " . htmlspecialchars($e->getMessage()) . "</p>\n";
}
echo "<hr>";
echo "<p><a href='../dashboard.php'>← Back to Dashboard</a></p>";
?>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists