mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-20 00:08:02 +01:00
fix: add on delete cascade to notifications and userNotifications tables (#3192)
<!-- Thanks for creating a PR! To make it easier for reviewers and everyone else to understand what your changes relate to, please add some relevant content to the headings below. Feel free to ignore or delete sections that you don't think are relevant. Thank you! ❤️ --> ## About the changes <!-- Describe the changes introduced. What are they and why are they being introduced? Feel free to also add screenshots or steps to view the changes if they're visual. --> <!-- Does it close an issue? Multiple? --> Closes # <!-- (For internal contributors): Does it relate to an issue on public roadmap? --> <!-- Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item: # --> ### Important files <!-- PRs can contain a lot of changes, but not all changes are equally important. Where should a reviewer start looking to get an overview of the changes? Are any files particularly important? --> ## Discussion points <!-- Anything about the PR you'd like to discuss before it gets merged? Got any questions or doubts? --> Signed-off-by: andreas-unleash <andreas@getunleash.ai>
This commit is contained in:
parent
411adca447
commit
631535dc89
@ -5,15 +5,15 @@ exports.up = function (db, cb) {
|
||||
`
|
||||
CREATE TABLE IF NOT EXISTS notifications (
|
||||
id SERIAL PRIMARY KEY,
|
||||
event_id INTEGER NOT NULL REFERENCES events (id),
|
||||
created_by INTEGER NOT NULL REFERENCES users (id),
|
||||
event_id INTEGER NOT NULL REFERENCES events (id) ON DELETE CASCADE,
|
||||
created_by INTEGER NOT NULL REFERENCES users (id) ON DELETE CASCADE,
|
||||
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE TABLE if not exists user_notifications
|
||||
(
|
||||
notification_id INTEGER NOT NULL REFERENCES notifications (id),
|
||||
user_id INTEGER NOT NULL REFERENCES users (id),
|
||||
notification_id INTEGER NOT NULL REFERENCES notifications (id) ON DELETE CASCADE,
|
||||
user_id INTEGER NOT NULL REFERENCES users (id) ON DELETE CASCADE,
|
||||
read_at TIMESTAMP WITH TIME ZONE,
|
||||
PRIMARY KEY (notification_id, user_id)
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user