38497-vm/db/migrate.php
Flatlogic Bot 688e42d5dc v1
2026-02-16 19:45:52 +00:00

28 lines
678 B
PHP

<?php
declare(strict_types=1);
@ini_set('display_errors', '1');
@error_reporting(E_ALL);
require_once __DIR__ . '/../includes/db.php';
echo "Starting database migration...\n";
try {
$pdo = db();
$sql = file_get_contents(__DIR__ . '/migrations/001_create_sessions.sql');
if ($sql === false) {
throw new Exception('Could not read migration file.');
}
$pdo->exec($sql);
echo "Migration 001_create_sessions.sql applied successfully.\n";
} catch (PDOException $e) {
echo "Database migration failed: " . $e->getMessage() . "\n";
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
}
echo "Database migration finished.\n";