added functionality to archive clients
Some checks failed
PHPUnit / test (push) Has been cancelled

This commit is contained in:
2026-06-12 20:55:12 +02:00
parent 59ea2cd667
commit 5dff24a232
15 changed files with 436 additions and 48 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', 10);
define('QDB_VERSION', 11);
function qdb_table_exists(PDO $pdo, string $table): bool {
$stmt = $pdo->prepare(
@ -44,6 +44,17 @@ function qdb_apply_migrations(PDO $pdo, string $schemaSql): bool {
$changed = true;
}
if (qdb_table_exists($pdo, 'client')) {
if (!qdb_column_exists($pdo, 'client', 'archived')) {
$pdo->exec('ALTER TABLE client ADD COLUMN archived INTEGER NOT NULL DEFAULT 0');
$changed = true;
}
if (!qdb_column_exists($pdo, 'client', 'archivedAt')) {
$pdo->exec('ALTER TABLE client ADD COLUMN archivedAt INTEGER NOT NULL DEFAULT 0');
$changed = true;
}
}
if (!qdb_table_exists($pdo, 'questionnaire_submission')) {
$pdo->exec("
CREATE TABLE questionnaire_submission (