-
Notifications
You must be signed in to change notification settings - Fork 6
Schema for Streak and learned word page
This table is created with a motive of only showing the users current streak and the highest streak he/she has achieved to the user.
CREATE TABLE user_daily_streaks ( id SERIAL PRIMARY KEY, user_id UUID NOT NULL, streak_start_date DATE NOT NULL, streak_end_date DATE, current_streak INT DEFAULT 0, longest_streak INT DEFAULT 0, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, CONSTRAINT fk_user FOREIGN KEY(user_id) REFERENCES auth.users(id) );
Each user will have some flashcard they have seen and some they have learned. This table stores seen words and learned words as a list of texts so that we could create targeted features with these data.
CREATE TABLE user_flashcards ( id SERIAL PRIMARY KEY, user_id UUID NOT NULL UNIQUE, words_not_seen TEXT[] DEFAULT '{}', words_learned TEXT[] DEFAULT '{}', last_viewed TIMESTAMP, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, CONSTRAINT fk_user FOREIGN KEY (user_id) REFERENCES auth.users(id) );