This commit is contained in:
12
db_init.php
12
db_init.php
@ -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', 9);
|
||||
define('QDB_VERSION', 10);
|
||||
|
||||
function qdb_table_exists(PDO $pdo, string $table): bool {
|
||||
$stmt = $pdo->prepare(
|
||||
@ -219,6 +219,16 @@ function qdb_apply_migrations(PDO $pdo, string $schemaSql): bool {
|
||||
}
|
||||
}
|
||||
|
||||
$currentVersion = (int)$pdo->query('PRAGMA user_version')->fetchColumn();
|
||||
if ($currentVersion < 10
|
||||
&& qdb_table_exists($pdo, 'completed_questionnaire')
|
||||
&& qdb_table_exists($pdo, 'client_scoring_profile_result')) {
|
||||
require_once __DIR__ . '/lib/scoring.php';
|
||||
if (qdb_recompute_all_questionnaire_scores($pdo) > 0) {
|
||||
$changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
$currentVersion = (int)$pdo->query('PRAGMA user_version')->fetchColumn();
|
||||
if ($currentVersion < 7 && qdb_table_exists($pdo, 'question_score_rule')) {
|
||||
require_once __DIR__ . '/lib/scoring.php';
|
||||
|
||||
Reference in New Issue
Block a user