This commit is contained in:
18
db_init.php
18
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', 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';
|
||||
|
||||
Reference in New Issue
Block a user