21 lines
472 B
PHP
21 lines
472 B
PHP
<?php
|
|
require_once __DIR__ . '/config.php';
|
|
|
|
$pdo = db();
|
|
|
|
$migrationsDir = __DIR__ . '/migrations';
|
|
$files = glob($migrationsDir . '/*.sql');
|
|
|
|
sort($files);
|
|
|
|
foreach ($files as $file) {
|
|
$sql = file_get_contents($file);
|
|
try {
|
|
$pdo->exec($sql);
|
|
echo "Successfully executed migration: " . basename($file) . "\n";
|
|
} catch (PDOException $e) {
|
|
echo "Error executing migration: " . basename($file) . " - " . $e->getMessage() . "\n";
|
|
}
|
|
}
|
|
|