From 3125497b8e9879fe63ddb7b96c2c1818489bc0c6 Mon Sep 17 00:00:00 2001 From: Brandon Roberts Date: Thu, 18 Apr 2024 11:28:34 -0500 Subject: [PATCH] Update quests postgres tables --- postgres/init.sql | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/postgres/init.sql b/postgres/init.sql index 369ec13d..5044b904 100644 --- a/postgres/init.sql +++ b/postgres/init.sql @@ -41,28 +41,44 @@ CREATE TABLE Days ( ); CREATE INDEX days_dayIndex_index ON Days (dayIndex); --- TODO: Remove completedStatus & status from Quests? -CREATE TABLE Quests ( +CREATE TABLE DailyQuests ( key integer NOT NULL PRIMARY KEY, name text NOT NULL, description text NOT NULL, reward integer NOT NULL, - dayIndex integer NOT NULL, - completedStatus integer NOT NULL + dayIndex integer NOT NULL ); -CREATE INDEX quests_dayIndex_index ON Quests (dayIndex); +CREATE INDEX dailyQuests_dayIndex_index ON DailyQuests (dayIndex); -- TODO: Add calldata field -CREATE TABLE UserQuests ( +-- Table for storing the daily quests that the user has completed +CREATE TABLE UserDailyQuests ( + key integer NOT NULL PRIMARY KEY, + userAddress char(64) NOT NULL, + questKey integer NOT NULL, + completed boolean NOT NULL, + completedAt timestamp +); +CREATE INDEX userDailyQuests_userAddress_index ON UserDailyQuests (userAddress); +CREATE INDEX userDailyQuests_questKey_index ON UserDailyQuests (questKey); + +CREATE TABLE MainQuests ( + key integer NOT NULL PRIMARY KEY, + name text NOT NULL, + description text NOT NULL, + reward integer NOT NULL +); + +-- Table for storing the main quests that the user has completed +CREATE TABLE UserMainQuests ( key integer NOT NULL PRIMARY KEY, userAddress char(64) NOT NULL, questKey integer NOT NULL, - status integer NOT NULL, completed boolean NOT NULL, completedAt timestamp ); -CREATE INDEX userQuests_userAddress_index ON UserQuests (userAddress); -CREATE INDEX userQuests_questKey_index ON UserQuests (questKey); +CREATE INDEX userMainQuests_userAddress_index ON UserMainQuests (userAddress); +CREATE INDEX userMainQuests_questKey_index ON UserMainQuests (questKey); CREATE TABLE Colors ( key integer NOT NULL PRIMARY KEY,