From 40d6a2145301e2515b198ecba2968c8dfa1c278e Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Fri, 17 Nov 2023 15:21:29 +0800 Subject: [PATCH] Fix kafka migration script again (#4043) --- db/patch-fix-kafka-producer-booleans.sql | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/db/patch-fix-kafka-producer-booleans.sql b/db/patch-fix-kafka-producer-booleans.sql index 505f65a95..be2e992f5 100644 --- a/db/patch-fix-kafka-producer-booleans.sql +++ b/db/patch-fix-kafka-producer-booleans.sql @@ -15,12 +15,14 @@ ALTER TABLE monitor ALTER TABLE monitor ADD COLUMN kafka_producer_allow_auto_topic_creation BOOLEAN default 0 NOT NULL; --- Set bring old values from `_old` COLUMNs to correct ones -UPDATE monitor SET kafka_producer_allow_auto_topic_creation = monitor.kafka_producer_allow_auto_topic_creation_old - WHERE monitor.kafka_producer_allow_auto_topic_creation_old IS NOT NULL; +-- These SQL is still not fully safe. See https://github.com/louislam/uptime-kuma/issues/4039. -UPDATE monitor SET kafka_producer_ssl = monitor.kafka_producer_ssl_old - WHERE monitor.kafka_producer_ssl_old IS NOT NULL; +-- Set bring old values from `_old` COLUMNs to correct ones +-- UPDATE monitor SET kafka_producer_allow_auto_topic_creation = monitor.kafka_producer_allow_auto_topic_creation_old +-- WHERE monitor.kafka_producer_allow_auto_topic_creation_old IS NOT NULL; + +-- UPDATE monitor SET kafka_producer_ssl = monitor.kafka_producer_ssl_old +-- WHERE monitor.kafka_producer_ssl_old IS NOT NULL; -- Remove old COLUMNs ALTER TABLE monitor