21 lines
627 B
PHP
21 lines
627 B
PHP
<?php
|
|
require_once __DIR__ . '/db/config.php';
|
|
|
|
try {
|
|
$pdo = db();
|
|
$sql = file_get_contents(__DIR__ . '/db/migrations/001_initial_schema.sql');
|
|
|
|
// Split SQL by semicolon and execute each statement
|
|
// Note: This is a simple parser, might fail on complex SQL but should work for this schema
|
|
$statements = explode(';', $sql);
|
|
foreach ($statements as $statement) {
|
|
$statement = trim($statement);
|
|
if ($statement) {
|
|
$pdo->exec($statement);
|
|
}
|
|
}
|
|
echo "Migration successful!\n";
|
|
} catch (Exception $e) {
|
|
echo "Migration failed: " . $e->getMessage() . "\n";
|
|
}
|