-
Notifications
You must be signed in to change notification settings - Fork 0
schema
Vincent Shuali edited this page May 12, 2023
·
34 revisions
Column Name | Data Type | Details |
---|---|---|
id | bigint | primary key |
username | string | not null, unique |
password_digest | varchar(255) | not null |
last_login | datetime | not null |
created_at | datetime | not null |
updated_at | datetime | not null |
- members (a user may become more than one member to be in more than one club)
Column Name | Data Type | Details |
---|---|---|
id | bigint | primary key |
name | string | not null, unique |
location | string | not null |
join_code | varchar(6) | not null |
created_at | datetime | not null |
updated_at | datetime | not null |
To create a member and join a club, you must enter the current join code, which owner can periodically change for security reasons.
- name
- members
- lunches
Column Name | Data Type | Details |
---|---|---|
id | bigint | primary key |
name | string | not null, index |
member_info | member_type | not null |
string | not null, unique | |
club_id | bigint | foreign key |
user_id | bigint | foreign key, unique |
created_at | datetime | not null |
updated_at | datetime | not null |
member_type
is an ENUM that can be either 'banned', 'regular', or 'admin'.
- index on name
- index on user_id, unique: true
- club (club_id)
- user (user_id)
- votes
- lunches
- poll_options through votes
Uniqueness constraint of email in scope of club_id
Column Name | Data Type | Details |
---|---|---|
id | bigint | primary key |
name | string | not null, index |
address | string | not null |
created_at | datetime | not null |
updated_at | datetime | not null |
- lunches
Uniqueness constraint on (name, address)
Column Name | Data Type | Details |
---|---|---|
id | bigint | primary key |
club_id | bigint | foreign key |
restaurant_id | bigint | foreign key |
name | string | not null, index |
lunch_date | datetime | not null, index |
poll_open_date | datetime | not null |
poll_close_date | datetime | not null |
- club
- restaurant (this can be optional, until poll closes)
- poll_options
- votes (votes through poll_options)
- voters (members through votes through poll_options)
Notes: Open date can default to time poll was created. Poll close date can default to 24 hours before lunch date. Both of these can be set on the frontend restaurant_id can be optional, until poll closes
We may want to limit when the organizer can change the date of a poll, to either a time limit or before anyone has cast a vote.
Column Name | Data Type | Details |
---|---|---|
id | bigint | primary key |
lunch_id | bigint | foreign key |
restaurant_id | bigint | foreign key |
- lunch
- restaurant
- votes
Column Name | Data Type | Details |
---|---|---|
id | bigint | primary key |
member_id | bigint | foreign key |
lunch_id | bigint | foreign key |
poll_option_id | bigint | foreign key |
- member_id
- lunch_id
- poll_option_id
Uniqueness constraint on (member_id, lunch_id) to prevent member from voting in the same lunch twice
- member
- lunch
- poll_option