-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from Mouwf/feature/design-notification
通知機能の設計を行った。
- Loading branch information
Showing
7 changed files
with
322 additions
and
51 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
project-designs/database-definitions/create-table-scripts/notification_types.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CREATE TABLE notification_types ( | ||
id SERIAL PRIMARY KEY, | ||
type_name VARCHAR(255) NOT NULL UNIQUE | ||
); |
14 changes: 14 additions & 0 deletions
14
project-designs/database-definitions/create-table-scripts/notifications.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
CREATE TABLE notifications ( | ||
id BIGSERIAL PRIMARY KEY, | ||
notification_target_user_id INTEGER NOT NULL REFERENCES users(id), | ||
action_user_id INTEGER NOT NULL REFERENCES users(id), | ||
action_target_user_id INTEGER NOT NULL REFERENCES users(id), | ||
notification_type_id INTEGER NOT NULL REFERENCES notification_types(id), | ||
action_target_post_id BIGINT NOT NULL REFERENCES posts(id), | ||
action_target_reply_id BIGINT NULL REFERENCES replies(id), | ||
action_reply_id BIGINT NULL REFERENCES replies(id), | ||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP | ||
); | ||
|
||
CREATE INDEX idx_notification_target_user_id ON notifications(notification_target_user_id); | ||
CREATE INDEX idx_action_user_id ON notifications(action_user_id); |
7 changes: 7 additions & 0 deletions
7
project-designs/database-definitions/create-table-scripts/user_notification_statuses.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CREATE TABLE user_notification_statuses ( | ||
id SERIAL PRIMARY KEY, | ||
user_id INTEGER NOT NULL REFERENCES users(id), | ||
is_read BOOLEAN NOT NULL DEFAULT FALSE | ||
); | ||
|
||
CREATE INDEX idx_user_id_on_user_notification_statuses ON user_notification_statuses(user_id); |
3 changes: 3 additions & 0 deletions
3
project-designs/database-definitions/table-schemas/notification-types.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# 通知タイプテーブル | ||
* ID(主キー) | ||
* タイプ名(一意、NULL不可) |
10 changes: 10 additions & 0 deletions
10
project-designs/database-definitions/table-schemas/notifications.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# 通知テーブル | ||
* ID(主キー) | ||
* 通知対象ユーザーID(外部キー、NULL不可) | ||
* アクションユーザーID(外部キー、NULL不可) | ||
* アクション対象ユーザーID(外部キー、NULL不可) | ||
* 通知タイプID(外部キー、NULL不可) | ||
* アクション対象投稿ID(外部キー、NULL不可) | ||
* アクション対象リプライID(外部キー、NULL可) | ||
* アクションリプライID(外部キー、NULL可) | ||
* 通知日時 |
4 changes: 4 additions & 0 deletions
4
project-designs/database-definitions/table-schemas/user-notification-statuses.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# ユーザー通知ステータス | ||
* ID(主キー) | ||
* ユーザーID(外部キー、NULL不可) | ||
* 既読したかどうか(BOOL、NULL不可) |