This reverts commit ae3f77da80.
Maintain a persistent record of reminder notifications as notifications are always retrievable by the user, e.g. via
email, viewing "all" notifications.
A reminder notification is only created IF there are no active unread notifications, hence when rescheduling, snoozing or editing a reminder then
ensure all previous notifications are marked as read- as we should not have duplicate notifications for a given reminder.
Add uniqueness index on NOT null
```
-- add_index(:reminders, :notification_id, {:unique=>true, :where=>"notification_id IS NOT NULL", :name=>"index_reminders_on_notification_id_unique"})
(1.0ms) CREATE UNIQUE INDEX "index_reminders_on_notification_id_unique" ON "reminders" ("notification_id") WHERE notification_id IS NOT NULL
```
On notification delete, nullify the reminder record- at present reminders are a persistent record (so are notifications, but that could change).
There can be a race condition when a user continues to alter a work package or other resource after a first change has been made resulting in a journal and the background process creating a notification for that journal. If the second journal caused by the users continued interaction removes the first journal after the job for creating a notification has already started, all checks within ruby are blind. Therefore a foreign key constraint is needed.