-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created database schema and added dummy data
Relates #1
- Loading branch information
1 parent
2a06396
commit 4289fa2
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
BEGIN; | ||
|
||
DROP TABLE IF EXISTS users, scores CASCADE; | ||
|
||
CREATE TABLE users ( | ||
id SERIAL PRIMARY KEY, | ||
name VARCHAR(50) NOT NULL, | ||
email VARCHAR(80) UNIQUE NOT NULL, | ||
pw_hash VARCHAR(100) NOT NULL, | ||
admin BOOLEAN DEFAULT FALSE | ||
); | ||
|
||
CREATE TABLE scores ( | ||
id SERIAL PRIMARY KEY, | ||
user_id INTEGER REFERENCES users(id) NOT NULL, | ||
score FLOAT(4) NOT NULL, -- should give about 7 decimal places (4-bytes worth) | ||
emotion VARCHAR(20), | ||
img VARCHAR(100) | ||
) | ||
|
||
INSERT INTO users (name,email,pw_hash) VALUES | ||
('Nicolas Cage', '[email protected]', 'placeholder'), | ||
('Harry', '[email protected]', 'placeholder'); | ||
|
||
INSERT INTO scores (user_id, score, emotion, img) VALUES | ||
(1, 1000.97657, 'Anger', 'nicolascage-anger-1' ), -- last number should be score id | ||
(2, 1.4736, 'Sadness', 'harry-sadness-1'), -- may need to include file extension at end of img | ||
(2, 20.4736, 'Disgust', 'harry-disgust-1'); | ||
|
||
COMMIT; |