From 9f0f8c1dc86c05e2abed963a5955c59a14b71225 Mon Sep 17 00:00:00 2001 From: Meng Zhang Date: Thu, 5 Dec 2024 18:27:29 +0800 Subject: [PATCH] update --- .../0039_add-notification-inbox.up.sql | 2 ++ ee/tabby-db/schema.sqlite | Bin 217088 -> 221184 bytes ee/tabby-db/schema/schema.sql | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ee/tabby-db/migrations/0039_add-notification-inbox.up.sql b/ee/tabby-db/migrations/0039_add-notification-inbox.up.sql index 811d916d8a2a..765bb9a83738 100644 --- a/ee/tabby-db/migrations/0039_add-notification-inbox.up.sql +++ b/ee/tabby-db/migrations/0039_add-notification-inbox.up.sql @@ -19,6 +19,8 @@ CREATE TABLE readed_notifications ( created_at TIMESTAMP NOT NULL DEFAULT(DATETIME('now')), updated_at TIMESTAMP NOT NULL DEFAULT(DATETIME('now')), + CONSTRAINT idx_unique_user_id_notification_id UNIQUE (user_id, notification_id), + FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE, FOREIGN KEY (notification_id) REFERENCES notifications(id) ON DELETE CASCADE ) \ No newline at end of file diff --git a/ee/tabby-db/schema.sqlite b/ee/tabby-db/schema.sqlite index 48a17a01063199e778c8ca35636c6f216d5f2b0e..2a57ba44e0d9e0087e59909bc35d5bd75cbd6710 100644 GIT binary patch delta 354 zcmZozz}s+ucY?H_2m=Fy84$xj#zY-sMv;vP0)p0t23AJqRz^nr-RkF_R6O@t|2E#n zpmbNqJGuCk6K7PYi7L73zT0`zXjk(@lX9NE$#*ZNPGH`jJcr$APV;KP_SJ%nK+Lp# zwIFi>AEU`;L4)`F69ZTmO%M>{<+#qk&X&%=yNWlK>mXMO$9=YRj=s%_3W03=Eh;YT z;-;pI?b#)XNja(01KgQKrt5(Sc28!$p8mpvS)S2kI)^9oMX|(`+{`>3g~Xhkc#thz3JTeoc`1`GGKx)) V3uffnF5t!dft8VKGo!(OegHEKYfk_G delta 248 zcmZoTz}v8ZcY?H_5Ca2)DGXJJzs?Ap^h(lqekWu1ot>}$TC?70oz*vIg){e+AI+-;+gA%R0x{F} z)q>0ke2cjo1Q?As3mUxVpBTV8DS$-3i%%<|LcxiRxi7xQF3GCehsNn-LPM$zeU!Hitn1-zI)umS*rk4~`w diff --git a/ee/tabby-db/schema/schema.sql b/ee/tabby-db/schema/schema.sql index 3f09de29811f..9807a6b81468 100644 --- a/ee/tabby-db/schema/schema.sql +++ b/ee/tabby-db/schema/schema.sql @@ -227,7 +227,7 @@ 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 + -- enum of admin, all_user kind VARCHAR(255) NOT NULL DEFAULT 'admin', -- content of notification, in markdown format. content TEXT NOT NULL @@ -238,6 +238,7 @@ CREATE TABLE readed_notifications( notification_id INTEGER NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT(DATETIME('now')), updated_at TIMESTAMP NOT NULL DEFAULT(DATETIME('now')), + CONSTRAINT idx_unique_user_id_notification_id UNIQUE(user_id, notification_id), FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE, FOREIGN KEY(notification_id) REFERENCES notifications(id) ON DELETE CASCADE );