Schema - Tdon95/Center GitHub Wiki
Schema
Users
| Column Name | Data Type | Details |
|---|---|---|
| id | integer | not null, primary key |
| name | string | not null |
| 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 email, unique: true
- Index on sesion_token unique: true
Stories
| Column Name | Data Type | Details |
|---|---|---|
| id | integer | not null, primary key |
| body | text | |
| viewCount | integer | not null |
| author_id | integer | not null, indexed, foreign key |
| created_at | datetime | not null |
| updated_at | datetime | not null |
- Index on [:author_id, :article_id]
Claps(likes)
| Column Name | Data Type | Details |
|---|---|---|
| id | integer | not null, primary key |
| user_id | integer | not null, indexed, foreign key |
| article_id | integer | not null, indexed, foreign key |
| clapable_id | integer | not null, indexed |
| clapable_type | string | not null, indexed |
| created_at | datetime | not null |
| updated_at | datetime | not null |
- user_id references users index on [:clapable_id, :clapable_type, :user_id] unique: true
Responses (comments)
| Column Name | Data Type | Details |
|---|---|---|
| id | integer | not null, primary key |
| body | text | not null |
| user_id | integer | not null, indexed, foreign key |
| article_id | integer | not null, indexed, foreign key |
| created_at | datetime | not null |
| updated_at | datetime | not null |
- user_id references users
- article_id references articles
- Index on [:user_id, :article_id], unique: true