Skip to content

Commit

Permalink
Add audit trigger for when invite is consumed
Browse files Browse the repository at this point in the history
Invites are deleted once used, so log this in the audit table
  • Loading branch information
norrisng-bc committed Jul 4, 2024
1 parent 63812c2 commit 3a5860a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/src/db/migrations/20240703000000_015-invite-audit-trigger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
exports.up = function (knex) {
return Promise.resolve()
// Create invite audit trigger
.then(() => knex.schema.raw(`
CREATE TRIGGER audit_invite_trigger
AFTER UPDATE OR DELETE ON invite
FOR EACH ROW EXECUTE PROCEDURE audit.if_modified_func();
`));
};

exports.down = function (knex) {
return Promise.resolve()
// Drop invite audit trigger
.then(() => knex.schema.raw('DROP TRIGGER IF EXISTS audit_invite_trigger ON invite'));
};

0 comments on commit 3a5860a

Please sign in to comment.