18 lines
510 B
PHP
18 lines
510 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
if (PHP_SAPI !== 'cli') {
|
|
http_response_code(404);
|
|
exit(1);
|
|
}
|
|
$root = dirname(__DIR__);
|
|
require_once $root . '/app/Services/DB.php';
|
|
require_once $root . '/app/Services/Migrations.php';
|
|
Migrations::run($root . '/migrations');
|
|
$integrity = DB::pdo()->query('PRAGMA integrity_check')->fetchColumn();
|
|
if ($integrity !== 'ok') {
|
|
fwrite(STDERR, "SQLite integrity check failed: $integrity\n");
|
|
exit(2);
|
|
}
|
|
fwrite(STDOUT, "Migrations applied; SQLite integrity: ok\n");
|