reddy buddy
This commit is contained in:
parent
f424a16609
commit
ad06cfe250
14
setup.php
14
setup.php
@ -13,11 +13,17 @@ try {
|
|||||||
// Now connect to the newly created database
|
// Now connect to the newly created database
|
||||||
$pdo = db();
|
$pdo = db();
|
||||||
|
|
||||||
// Execute the initial schema
|
// Get all migration files and sort them
|
||||||
$sql = file_get_contents('db/migrations/001_initial_schema.sql');
|
$migration_files = glob('db/migrations/*.sql');
|
||||||
$pdo->exec($sql);
|
sort($migration_files);
|
||||||
|
|
||||||
echo "Database setup completed successfully.";
|
// Execute each migration
|
||||||
|
foreach ($migration_files as $file) {
|
||||||
|
$sql = file_get_contents($file);
|
||||||
|
$pdo->exec($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Database setup and all migrations completed successfully.";
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
die("Database setup failed: " . $e->getMessage());
|
die("Database setup failed: " . $e->getMessage());
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user