28 lines
678 B
PHP
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";
|