20 lines
463 B
PHP
20 lines
463 B
PHP
<?php
|
|
require_once __DIR__ . '/config.php';
|
|
|
|
try {
|
|
$pdo = db();
|
|
$migrationsDir = __DIR__ . '/migrations';
|
|
$migrationFiles = glob($migrationsDir . '/*.sql');
|
|
|
|
foreach ($migrationFiles as $file) {
|
|
echo "Running migration: " . basename($file) . "\n";
|
|
$sql = file_get_contents($file);
|
|
$pdo->exec($sql);
|
|
echo "Success.\n";
|
|
}
|
|
|
|
} catch (PDOException $e) {
|
|
die("Database migration failed: " . $e->getMessage());
|
|
}
|
|
|