mirror of
https://github.com/ohwgiles/laminar.git
synced 2024-10-27 20:34:20 +00:00
create db with primary key and index
This commit is contained in:
parent
a83cc6c7a5
commit
10d7ad8960
@ -69,7 +69,12 @@ Laminar::Laminar() {
|
||||
// Prepare database for first use
|
||||
// TODO: error handling
|
||||
db->exec("CREATE TABLE IF NOT EXISTS builds("
|
||||
"name TEXT, number INT UNSIGNED, node TEXT, queuedAt INT, startedAt INT, completedAt INT, result INT, output TEXT, parentJob TEXT, parentBuild INT, reason TEXT)");
|
||||
"name TEXT, number INT UNSIGNED, node TEXT, queuedAt INT, "
|
||||
"startedAt INT, completedAt INT, result INT, output TEXT, "
|
||||
"parentJob TEXT, parentBuild INT, reason TEXT,"
|
||||
"PRIMARY KEY (name, number))");
|
||||
db->exec("CREATE INDEX IF NOT EXISTS idx_completion_time ON builds("
|
||||
"completedAt DESC)");
|
||||
|
||||
// retrieve the last build numbers
|
||||
db->stmt("SELECT name, MAX(number) FROM builds GROUP BY name")
|
||||
|
Loading…
Reference in New Issue
Block a user