Small refacor of SQL statements.

This commit is contained in:
BurnyLlama 2021-11-01 21:58:19 +01:00
parent 089e0d6fb7
commit bb0e889934
2 changed files with 12 additions and 7 deletions

View File

@ -67,7 +67,8 @@ export function generateDB() {
"time" float NOT NULL DEFAULT 0,
"date" timestamp NOT NULL DEFAULT current_timestamp,
"server" char(4) NOT NULL DEFAULT '',
"rank" INTEGER NOT NULL);
"rank" INTEGER NOT NULL
)
`)
log("Calculating rankings for each map...")
@ -96,7 +97,8 @@ export function generateDB() {
"time" float NOT NULL DEFAULT 0,
"date" timestamp NOT NULL DEFAULT current_timestamp,
"server" char(4) NOT NULL DEFAULT '',
"teamrank" INTEGER NOT NULL);
"teamrank" INTEGER NOT NULL
)
`)
log("Calculating teamrankings for each map...")
@ -113,7 +115,8 @@ export function generateDB() {
CREATE TABLE IF NOT EXISTS "points" (
"rank" INTEGER NOT NULL,
"player" varchar(16) NOT NULL,
"points" INTEGER NOT NULL);
"points" INTEGER NOT NULL
)
`)
log("Generating graphRecordCache...")
@ -123,13 +126,14 @@ export function generateDB() {
"player" varchar(16) NOT NULL,
"time" float NOT NULL DEFAULT 0,
"date" timestamp NOT NULL DEFAULT current_timestamp,
"server" char(4) NOT NULL DEFAULT '');
"server" char(4) NOT NULL DEFAULT ''
)
`)
tasks.processTimeGraph()
execMany([
`CREATE INDEX IF NOT EXISTS "idx_graphCache_player" ON "graphRecordCache" ("player")`,
`CREATE INDEX IF NOT EXISTS "idx_graphCache_map" ON "graphRecordCache" ("map");`
`CREATE INDEX IF NOT EXISTS "idx_graphCache_map" ON "graphRecordCache" ("map")`
])
log("Inserting points to DB...")
@ -146,6 +150,7 @@ export function generateDB() {
"colorBodyRaw" INTEGER NOT NULL,
"colorBodyHex" varchar(8) NOT NULL,
"colorFeetRaw" INTEGER NOT NULL,
"colorFeetHex" varchar(8) NOT NULL);
"colorFeetHex" varchar(8) NOT NULL
)
`)
}

View File

@ -146,7 +146,7 @@ export function processAllPoints() {
"rank" INTEGER NOT NULL,
"player" varchar(16) NOT NULL,
"points" INTEGER NOT NULL
);
)
`)
/* Insert data */