diff --git a/migrations/schema.sql b/migrations/schema.sql index 1b8d060bd..ad3d0f876 100644 --- a/migrations/schema.sql +++ b/migrations/schema.sql @@ -226,7 +226,7 @@ CREATE TABLE IF NOT EXISTS notifications( message TEXT, acknowledged BOOLEAN DEFAULT false, creationTime TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - UNIQUE KEY appPasswords_name_appId_identifier (name, userId, identifier), + FOREIGN KEY(eventId) REFERENCES eventlog(id), PRIMARY KEY (id) ); diff --git a/src/notifications.js b/src/notifications.js index 90334c2e0..3817351b9 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -45,10 +45,10 @@ function add(userId, eventId, title, message, callback) { assert.strictEqual(typeof callback, 'function'); notificationdb.add({ - userId: userId, - eventId: eventId, - title: title, - message: message, + userId, + eventId, + title, + message, acknowledged: false }, function (error, result) { if (error) return callback(error); @@ -283,9 +283,9 @@ function alert(id, title, message, callback) { const data = { userId: admin.id, eventId: null, - title: title, - message: message, - acknowledged: acknowledged, + title, + message, + acknowledged, creationTime: new Date() };