-
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.
- Loading branch information
1 parent
ec13ee5
commit 736f602
Showing
5 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
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 | ||
); |
13 changes: 13 additions & 0 deletions
13
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,13 @@ | ||
CREATE TABLE notifications ( | ||
id BIGSERIAL PRIMARY KEY, | ||
user_id INTEGER NOT NULL REFERENCES users(id), | ||
action_user_id INTEGER NOT NULL REFERENCES users(id), | ||
notification_type_id INTEGER NOT NULL REFERENCES notification_types(id), | ||
related_post_id BIGINT NOT NULL REFERENCES posts(id), | ||
related_reply_id BIGINT NULL REFERENCES replies(id), | ||
action_target_reply_id BIGINT NULL REFERENCES replies(id), | ||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP | ||
); | ||
|
||
CREATE INDEX idx_user_id_on_notifications ON notifications(user_id); | ||
CREATE INDEX idx_action_user_id_on_notifications 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); |
4 changes: 3 additions & 1 deletion
4
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
# 通知テーブル | ||
* ID(主キー) | ||
* ユーザーID(外部キー、NULL不可) | ||
* アクションユーザーID(外部キー、NULL不可) | ||
* 通知タイプID(外部キー、NULL不可) | ||
* 関連投稿ID(外部キー、NULL不可) | ||
* 関連リプライID(外部キー、NULL不可) | ||
* 関連リプライID(外部キー、NULL可) | ||
* アクション対象リプライID(外部キー、NULL可) | ||
* 通知日時 |
1 change: 1 addition & 0 deletions
1
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# ユーザー通知ステータス | ||
* ID(主キー) | ||
* ユーザーID(外部キー、NULL不可) | ||
* 既読したかどうか(BOOL、NULL不可) |