20 lines
454 B
PHP
20 lines
454 B
PHP
<?php
|
|
require_once __DIR__ . '/config.php';
|
|
|
|
try {
|
|
$pdo = db();
|
|
$migration_files = glob(__DIR__ . '/migrations/*.sql');
|
|
sort($migration_files);
|
|
|
|
foreach ($migration_files as $file) {
|
|
$sql = file_get_contents($file);
|
|
$pdo->exec($sql);
|
|
echo "Migrated: " . basename($file) . "\n";
|
|
}
|
|
|
|
echo "All migrations successful!\n";
|
|
} catch (PDOException $e) {
|
|
die("Migration failed: " . $e->getMessage() . "\n");
|
|
}
|
|
|