21 lines
440 B
PHP
21 lines
440 B
PHP
<?php
|
|
require_once 'config.php';
|
|
|
|
try {
|
|
$pdo = db();
|
|
$migrations = glob(__DIR__ . '/migrations/*.sql');
|
|
sort($migrations);
|
|
|
|
foreach ($migrations as $migration) {
|
|
$sql = file_get_contents($migration);
|
|
$pdo->exec($sql);
|
|
echo "Executed migration: $migration\n";
|
|
}
|
|
|
|
echo "All migrations executed successfully.\n";
|
|
|
|
} catch (PDOException $e) {
|
|
die("Migration failed: " . $e->getMessage());
|
|
}
|
|
|