Add initial version of querying by hash prefix

This commit is contained in:
Martijn van der Ven
2020-05-23 16:54:21 +02:00
parent ca46f4c9ac
commit 803b1fa505
4 changed files with 103 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
BEGIN TRANSACTION;
/* Add hash field */
CREATE TABLE "sqlb_temp_table_1" (
"videoID" TEXT NOT NULL,
"startTime" REAL NOT NULL,
"endTime" REAL NOT NULL,
"votes" INTEGER NOT NULL,
"incorrectVotes" INTEGER NOT NULL default '1',
"UUID" TEXT NOT NULL UNIQUE,
"userID" TEXT NOT NULL,
"timeSubmitted" INTEGER NOT NULL,
"views" INTEGER NOT NULL,
"category" TEXT NOT NULL DEFAULT "sponsor",
"shadowHidden" INTEGER NOT NULL,
"hashedVideoID" TEXT NOT NULL
);
INSERT INTO sqlb_temp_table_1 SELECT *, sha256(videoID) FROM sponsorTimes;
DROP TABLE sponsorTimes;
ALTER TABLE sqlb_temp_table_1 RENAME TO "sponsorTimes";
/* Bump version in config */
UPDATE config SET value = 2 WHERE key = "version";
COMMIT;