Fix kafka migration script again (#4043)

This commit is contained in:
Louis Lam 2023-11-17 15:21:29 +08:00 committed by GitHub
parent b383392e8f
commit 40d6a21453
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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