-
Notifications
You must be signed in to change notification settings - Fork 1
Postgres Database Schema
jas-singh-code edited this page Mar 15, 2021
·
26 revisions
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
lastname | string | not null, indexed, unique |
firstname | string | not null, indexed, unique |
username | string | not null, indexed, unique |
string | not null, indexed, unique | |
password_digest | string | not null |
session_token | string | not null, indexed, unique |
friends | array | not null |
created_at | datetime | not null |
updated_at | datetime | not null |
- has_many posts
- has_many likes
- has_many friends
- has_one wall
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
title | string | not null |
message | text | not null |
poster_id | integer | not null, indexed, foreign key |
created_at | datetime | not null |
updated_at | datetime | not null |
- belongs_to user
- has_many likes
- has_many comments
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
body | text | not null |
author_id | integer | not null, foreign key |
likes | array | not null |
created_at | datetime | not null |
updated_at | datetime | not null |
- belongs_to user
- has_many likes
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
liker_id | integer | not null, indexed, foreign key |
comment_id | integer | not null ,indexed, foreign key |
created_at | datetime | not null |
updated_at | datetime | not null |
- belongs_to user
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
sender_id | integer | not null, indexed, foreign key |
receiver_id | integer | not null, indexed, foreign key |
pending | boolean | not null, presence |
created_at | datetime | not null |
updated_at | datetime | not null |
- polymorphic assoication
- belongs_to user