From 2dc24ada8e6787ff5bd573a87fa7e6a7542b2a89 Mon Sep 17 00:00:00 2001 From: andreas-unleash Date: Wed, 26 Apr 2023 12:00:13 +0300 Subject: [PATCH] fix: migration failure when sessionId exists (#3624) (#3625) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Back-porting the migration fix ## About the changes Closes # ### Important files ## Discussion points ## About the changes Closes # ### Important files ## Discussion points Signed-off-by: andreas-unleash --- .../20230420211308-update-context-fields-add-sessionId.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/migrations/20230420211308-update-context-fields-add-sessionId.js b/src/migrations/20230420211308-update-context-fields-add-sessionId.js index 16344dc09f8..4a2dc54d63c 100644 --- a/src/migrations/20230420211308-update-context-fields-add-sessionId.js +++ b/src/migrations/20230420211308-update-context-fields-add-sessionId.js @@ -3,7 +3,7 @@ exports.up = function (db, callback) { db.runSql( ` - INSERT INTO context_fields(name, description, sort_order, stickiness) VALUES('sessionId', 'Allows you to constrain on sessionId', 4, true); + INSERT INTO context_fields(name, description, sort_order, stickiness) VALUES('sessionId', 'Allows you to constrain on sessionId', 4, true) ON CONFLICT DO NOTHING; UPDATE context_fields SET stickiness = true @@ -16,12 +16,6 @@ exports.up = function (db, callback) { exports.down = function (db, callback) { db.runSql( ` - DELETE FROM context_fields - WHERE name LIKE 'sessionId'; - - UPDATE context_fields - SET stickiness = null - WHERE name LIKE 'userId'; `, callback, );