Restore proper rollback database indexing (#15707)

This commit is contained in:
Lars Müller 2025-01-24 16:50:59 +01:00 committed by GitHub
parent 41dfac96c1
commit 7c6ade0fc5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -224,7 +224,12 @@ bool RollbackManager::createTables()
" FOREIGN KEY (`oldNode`) REFERENCES `node`(`id`),\n"
" FOREIGN KEY (`newNode`) REFERENCES `node`(`id`)\n"
");\n"
"CREATE INDEX IF NOT EXISTS `actionIndex` ON `action`(`x`,`y`,`z`,`timestamp`,`actor`);\n",
// We run queries with the following filters:
// - `timestamp` >= ? AND `actor` = ?
// - `timestamp` >= ?
// - `timestamp` >= ? AND <range query on X, Y, Z>
"CREATE INDEX IF NOT EXISTS `actionIndex` ON `action`(`x`,`y`,`z`,`timestamp`,`actor`);\n"
"CREATE INDEX IF NOT EXISTS `actionTimestampActorIndex` ON `action`(`timestamp`,`actor`);\n",
NULL, NULL, NULL));
verbosestream << "SQL Rollback: SQLite3 database structure was created" << std::endl;