From 2a1c0616e0ea0d46a5bdb182b8625996b49f7ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gast=C3=B3n=20Fournier?= Date: Tue, 2 Jan 2024 17:53:29 +0100 Subject: [PATCH] feat: support null created_by_user_id (#5744) ## About the changes Creating an incoming webhook with an admin token means we can't correlate the action with a real user. In this case we should support null. --- .../20240102142100-incoming-webhooks-created-by.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/migrations/20240102142100-incoming-webhooks-created-by.js diff --git a/src/migrations/20240102142100-incoming-webhooks-created-by.js b/src/migrations/20240102142100-incoming-webhooks-created-by.js new file mode 100644 index 0000000000..a11dec0c57 --- /dev/null +++ b/src/migrations/20240102142100-incoming-webhooks-created-by.js @@ -0,0 +1,13 @@ +exports.up = function (db, cb) { + db.runSql( + ` + ALTER TABLE incoming_webhooks ALTER COLUMN created_by_user_id DROP NOT NULL; + ALTER TABLE incoming_webhook_tokens ALTER COLUMN created_by_user_id DROP NOT NULL; + `, + cb, + ); +}; + +exports.down = function (db, callback) { + callback(); +};