-
Notifications
You must be signed in to change notification settings - Fork 0
schema
Darian Chen edited this page Oct 9, 2022
·
3 revisions
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
display_name |
string | not null |
email |
string | not null, indexed, unique |
about_me |
text | |
reputation |
integer | not null, default=0 |
session_token |
string | not null, indexed, unique |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
email, unique: true - index on
session_token, unique: true has_many questionshas_many answershas_many commentshas_many followed_questions
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
title |
string | not null, indexed |
body |
text | not null |
views |
integer | not null, default=0 |
author_id |
integer | not null, indexed, foreign key |
editor_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
author_idreferencesusers -
editor_idreferencesusers - index on
title - index on
author_id - index on
editor_id belongs_to authorhas_many answershas_many commentshas_many voteshas_many taggingshas_many tags through taggings
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
body |
text | not null |
commenter_id |
integer | not null, indexed, foreign key |
commentable_id |
integer | not null, indexed |
commentable_type |
string | not null, indexed |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
commenter_idreferencesusers - index on
commenter_id belongs_to questions
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
body |
text | not null |
answerer_id |
integer | not null, indexed, foreign key |
question_id |
integer | not null, indexed, foreign key |
editor_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
answerer_idreferencesusers -
question_idreferencesusers -
editor_idreferencesusers - index on
answerer_id - index on
question_id - index on
editor_id belongs_to updaterbelongs_to questionsbelongs_to users
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
voter_id |
integer | not null, indexed, foreign key |
votable_id |
integer | not null, indexed, foreign key |
votable_type |
string | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
voter_idreferencesusers - index on
votable_id - index on
votable_type
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
name |
string | not null, indexed |
created_at |
datetime | not null |
updated_at |
datetime | not null |
has_many taggingshas_many questions through taggings
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
tag_id |
integer | not null, indexed |
question_id |
integer | not null, indexed |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
tag_idreferencestags -
question_idreferencesquestions - index on
tag_id - index on question_id`
belongs_to tagsbelongs_to questions
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
name |
string | not null, indexed |
description |
text | not null, indexed |
-
has_manyuser_badges` has_many users through user_badges
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
user_id |
integer | not null, indexed, foreign_key |
badge_id |
integer | not null, indexed, foreign_key |
-
user_idreferencesusers -
badge_idreferencesbadges - index on
user_id - index on badge_id`