-
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
Showing
7 changed files
with
251 additions
and
7 deletions.
There are no files selected for viewing
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
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 @@ | ||
DROP TABLE IF EXISTS user_chat_rooms; | ||
DROP TABLE IF EXISTS chat_messages; | ||
DROP TABLE IF EXISTS chat_rooms; |
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,29 @@ | ||
CREATE TABLE chat_rooms ( | ||
id SERIAL PRIMARY KEY, | ||
name VARCHAR(255) NOT NULL, | ||
room_type VARCHAR(255) NOT NULL, | ||
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
deleted_at TIMESTAMPTZ | ||
); | ||
|
||
CREATE TABLE chat_messages ( | ||
id SERIAL PRIMARY KEY, | ||
user_id BIGINT NOT NULL, | ||
room_id BIGINT NOT NULL, | ||
message_type VARCHAR(255) NOT NULL, | ||
content TEXT NOT NULL, | ||
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
deleted_at TIMESTAMPTZ, | ||
FOREIGN KEY (room_id) REFERENCES chat_rooms(id) | ||
); | ||
|
||
CREATE TABLE user_chat_rooms ( | ||
id SERIAL PRIMARY KEY, | ||
user_id BIGINT NOT NULL, | ||
room_id BIGINT NOT NULL, | ||
joined_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
left_at TIMESTAMPTZ, | ||
FOREIGN KEY (room_id) REFERENCES chat_rooms(id) | ||
); |
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
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
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
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