Skip to content

Commit

Permalink
feat(db): add notification inbox tables
Browse files Browse the repository at this point in the history
- Added `notifications` table to store notification messages.
- Added `readed_notifications` table to track which notifications have been read by users.
  • Loading branch information
wsxiaoys committed Nov 26, 2024
1 parent 0e89f0b commit af956f1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-- Add down migration script here
20 changes: 20 additions & 0 deletions ee/tabby-db/migrations/0039_add-notification-inbox.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
CREATE TABLE notifications (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,

created_at TIMESTAMP NOT NULL DEFAULT(DATETIME('now')),
updated_at TIMESTAMP NOT NULL DEFAULT(DATETIME('now')),

-- enum of ADMIN, ALL_USERS
kind: TEXT NOT NULL,

message: TEXT NOT NULL,
)

CREATE TABLE readed_notifications (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL,
notification_id INTEGER NOT NULL,

FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (notification_id) REFERENCES notifications(id) ON DELETE CASCADE,
)

0 comments on commit af956f1

Please sign in to comment.