From 28f821cb34485c263a29705ff815e0c1cec76742 Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Date: Thu, 31 Oct 2024 12:38:15 +0100 Subject: [PATCH] feat(db): user email un-subscription (#8612) Opt-out table for emails --- .../20241031102325-user-unsubscription.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/migrations/20241031102325-user-unsubscription.js diff --git a/src/migrations/20241031102325-user-unsubscription.js b/src/migrations/20241031102325-user-unsubscription.js new file mode 100644 index 000000000000..f5d1a6eeafb7 --- /dev/null +++ b/src/migrations/20241031102325-user-unsubscription.js @@ -0,0 +1,15 @@ +exports.up = function(db, cb) { + db.runSql(` + CREATE TABLE IF NOT EXISTS user_unsubscription + ( + user_id INTEGER NOT NULL references users (id), + subscription VARCHAR(255) NOT NULL, + created_at TIMESTAMP DEFAULT now(), + PRIMARY KEY (user_id, subscription) + ); +`, cb); +}; + +exports.down = function(db, cb) { + db.runSql(`DROP TABLE IF EXISTS user_unsubscription;`, cb); +};