started work on scheduling
Some checks failed
PHPUnit / test (push) Has been cancelled

This commit is contained in:
2026-07-01 10:07:20 +02:00
parent 70dca17451
commit c5c61f22ad
13 changed files with 414 additions and 4 deletions

View File

@ -13,7 +13,7 @@ if (defined('QDB_TEST_UPLOADS')) {
define('QDB_LOCK', QDB_UPLOADS_DIR . '/.qdb_lock');
}
define('QDB_SCHEMA', __DIR__ . '/schema.sql');
define('QDB_VERSION', 15);
define('QDB_VERSION', 16);
function qdb_table_exists(PDO $pdo, string $table): bool {
$stmt = $pdo->prepare(
@ -136,6 +136,22 @@ function qdb_apply_migrations(PDO $pdo, string $schemaSql): bool {
}
}
if (!qdb_table_exists($pdo, 'client_session_schedule')) {
$pdo->exec("
CREATE TABLE client_session_schedule (
clientCode TEXT NOT NULL PRIMARY KEY,
scheduledDate TEXT NOT NULL,
programCycleNumber INTEGER NOT NULL,
programSessionNumber INTEGER NOT NULL,
programSessionID TEXT,
updatedAt INTEGER NOT NULL DEFAULT 0,
FOREIGN KEY(clientCode) REFERENCES client(clientCode) ON DELETE CASCADE
)
");
$pdo->exec('CREATE INDEX IF NOT EXISTS idx_client_session_schedule_date ON client_session_schedule(scheduledDate)');
$changed = true;
}
if (qdb_table_exists($pdo, 'questionnaire_structure_snapshot')
&& qdb_table_exists($pdo, 'questionnaire')) {
require_once __DIR__ . '/lib/questionnaire_structure.php';