-
Notifications
You must be signed in to change notification settings - Fork 18
Added cp leaderboard queries and mutations #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
0e034fe
67e1362
3ca759b
6d1bd58
097ee46
30a83f8
39fa451
d47f864
ffd36c4
32fe3db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ Secrets*.toml | |
backups/ | ||
.env | ||
*.log | ||
|
||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
-- Add migration script here | ||
|
||
CREATE TABLE IF NOT EXISTS leaderboard ( | ||
id SERIAL PRIMARY KEY, | ||
member_id INT UNIQUE NOT NULL, | ||
leetcode_score INT, | ||
codeforces_score INT, | ||
unified_score INT NOT NULL, | ||
last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | ||
FOREIGN KEY (member_id) REFERENCES member(member_id) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS leetcode_stats ( | ||
id SERIAL PRIMARY KEY, | ||
member_id INT NOT NULL, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why no unique? |
||
leetcode_username VARCHAR(255) NOT NULL, | ||
problems_solved INT NOT NULL, | ||
easy_solved INT NOT NULL, | ||
medium_solved INT NOT NULL, | ||
hard_solved INT NOT NULL, | ||
contests_participated INT NOT NULL, | ||
best_rank INT NOT NULL, | ||
total_contests INT NOT NULL, | ||
FOREIGN KEY (member_id) REFERENCES member(member_id) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS codeforces_stats ( | ||
id SERIAL PRIMARY KEY, | ||
member_id INT NOT NULL, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unique |
||
codeforces_handle VARCHAR(255) NOT NULL, | ||
codeforces_rating INT NOT NULL, | ||
max_rating INT NOT NULL, | ||
contests_participated INT NOT NULL, | ||
FOREIGN KEY (member_id) REFERENCES member(member_id) | ||
); | ||
|
||
ALTER TABLE leetcode_stats ADD CONSTRAINT leetcode_stats_member_id_key UNIQUE (member_id); | ||
ALTER TABLE codeforces_stats ADD CONSTRAINT codeforces_stats_member_id_key UNIQUE (member_id); | ||
Comment on lines
+37
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we altering it here? We can add the constraint directly during creation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing