schema - Neminem1203/Me-Cube GitHub Wiki
column | data type | details |
---|---|---|
id |
integer | not null, primary key |
username |
string | not null, indexed, unique |
email |
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 | data type | details |
---|---|---|
id |
integer | not null, primary key |
title |
string | not null, indexed |
video_url |
text | not null |
description |
text | not null |
creator_id |
integer | not null, indexed, foreign key |
created at |
datetime | not null |
updated at |
datetime | not null |
- index on
title
- index on
creator_id
-
creator_id
referencesusers
-
:title, uniqueness: {scope: :creator_id}
in models
column | data type | details |
---|---|---|
id |
integer | not null, primary key |
like_dislike |
boolean | not null |
user_id |
integer | not null, indexed |
likeable_id |
integer | not null, indexed |
likeable_type |
string | not null, indexed |
- index on
likeable_id
- index on
likeable_type
- index on
user_id
-
user_id
refers tousers
-
likeable_type
can becomments
orvideos
-
:user_id, uniqueness: {scope: [:likeable_id, :likeable_type]}
in models
column | data type | details |
---|---|---|
id |
integer | not null, primary |
comment |
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 |
- index on
video_id
- index on
commenter_id
-
commenter_id
referencesusers
-
commentable_type
can becomments
orvideos
-
:commenter_id, uniqueness: {scope: [:commentable_id, :commentable_type]}
in models