21 lines
462 B
PHP
21 lines
462 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
$app = require dirname(__DIR__) . '/app/bootstrap.php';
|
|
|
|
if (!$app['database']->isConfigured()) {
|
|
fwrite(STDERR, "Database config missing.\n");
|
|
exit(1);
|
|
}
|
|
|
|
$schema = file_get_contents(dirname(__DIR__) . '/database/schema.sql');
|
|
|
|
if (!is_string($schema) || $schema === '') {
|
|
fwrite(STDERR, "Schema missing.\n");
|
|
exit(1);
|
|
}
|
|
|
|
$app['database']->pdo()->exec($schema);
|
|
fwrite(STDOUT, "Schema applied successfully.\n");
|