-
Notifications
You must be signed in to change notification settings - Fork 2
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
Setup SQL and Hookup User Model #5
Comments
User Table draft, based off of the current Mongoose Schema: Also added a friends and friends request table. Please comment with suggested changes. I'll update this comment directly with changes. CREATE TABLE users IF NOT EXISTS (
id INT UNSIGNED AUTO_INCREMENT NOT NULL,
password CHAR(60) NOT NULL,
email VARCHAR(255) UNIQUE NOT NULL,
username VARCHAR(255) UNIQUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
password_reset_token BINARY(32),
password_reset_token_expiry TIMESTAMP,
PRIMARY KEY(id)
); CREATE TABLE friends IF NOT EXISTS (
requestor INT UNSIGNED NOT NULL,
requestee INT UNSIGNED NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
accepted BOOLEAN NOT NULL,
PRIMARY KEY(requestor, requestee),
FOREIGN KEY(requestor) REFERENCES users(id),
FOREIGN KEY(requestee) REFERENCES users(id)
);
CREATE INDEX friend_accepted ON friends(accepted); |
Alternatively, we can merge Also, open to changes on |
Yeah we should merge them. Also do we need a requestor / requestee distinction? Or user1/user2 would be fine. |
IMO yes b/c then we can distinguish between friend requests you've made, and requests others have made (at least it's more descriptive) |
We can keep it that way (but I think in terms of UI we won't show anything differently once the request is accepted) |
Agreed with the UI post-acceptance. |
Updated DB design to reflect table merge, added index on acceptance. |
👍 |
Add libraries for DB + Setup new run scripts, mark tests as pending - resolution in a future PR (#5)
A few things:
Users
User
model.User
modelThis can be broken out into multiple tasks
The text was updated successfully, but these errors were encountered: