This commit is contained in:
11
db_init.php
11
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', 12);
|
||||
define('QDB_VERSION', 13);
|
||||
|
||||
function qdb_table_exists(PDO $pdo, string $table): bool {
|
||||
$stmt = $pdo->prepare(
|
||||
@ -227,6 +227,7 @@ function qdb_apply_migrations(PDO $pdo, string $schemaSql): bool {
|
||||
yellowMin INTEGER NOT NULL DEFAULT 13,
|
||||
yellowMax INTEGER NOT NULL DEFAULT 36,
|
||||
redMin INTEGER NOT NULL DEFAULT 37,
|
||||
processCompleteBands TEXT NOT NULL DEFAULT '[]',
|
||||
createdAt INTEGER NOT NULL DEFAULT 0,
|
||||
updatedAt INTEGER NOT NULL DEFAULT 0
|
||||
)
|
||||
@ -339,6 +340,14 @@ function qdb_apply_migrations(PDO $pdo, string $schemaSql): bool {
|
||||
$changed = true;
|
||||
}
|
||||
|
||||
$currentVersion = (int)$pdo->query('PRAGMA user_version')->fetchColumn();
|
||||
if ($currentVersion < 13 && qdb_table_exists($pdo, 'scoring_profile')) {
|
||||
if (!qdb_column_exists($pdo, 'scoring_profile', 'processCompleteBands')) {
|
||||
$pdo->exec("ALTER TABLE scoring_profile ADD COLUMN processCompleteBands TEXT NOT NULL DEFAULT '[]'");
|
||||
$changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
$currentVersion = (int)$pdo->query('PRAGMA user_version')->fetchColumn();
|
||||
if ($currentVersion < 6 && qdb_table_exists($pdo, 'questionnaire_submission')) {
|
||||
$pdo->exec(
|
||||
|
||||
Reference in New Issue
Block a user