schema - adammoftah/Stack-Overwhelm GitHub Wiki
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| display_name | string | not null, indexed, unique |
| string | not null, indexed, unique | |
| password_digest | string | not null |
| session_token | string | not null, indexed, unique |
| created_at | datetime | not null |
| updated_at | datetime | not null |
- index on
username, unique: true - index on
email, unique: true - index on
session_token, unique: true
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| title | string | not null |
| body | text | not null |
| author_id | integer | not null, indexed, foreign key |
| created_at | datetime | not null |
| updated_at | datetime | not null |
- index on
author_id -
author_idreferencesusers
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| body | string | not null |
| author_id | integer | not null, indexed, foreign key |
| question_id | integer | not null, indexed, foreign key |
| created_at | datetime | not null |
| updated_at | datetime | not null |
- index on
author_id -
author_idreferencesusers - index on
question_id -
question_idreferencesquestions
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| voter_id | integer | not null |
| votable_type | string | not null, indexed |
| votable_id | integer | not null, indexed |
| vote_type | integer | not null |
-
votesrepresents a polymorphic association, whereby question and answers can both be upvoted
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| user_id | integer | not null, indexed, foreign key |
| question_id | integer | not null, indexed, foreign key |
| created_at | datetime | not null |
| updated_at | datetime | not null |
- index on
user_id -
user_idreferencesusers - index on
question_id -
question_idreferencesquestions
`