From fd49acd0334b053403970e83e2bbba422ab9951c Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 26 Jan 2018 13:16:27 -0800 Subject: [PATCH] Fix Herald repetition policy migration for NULL When we change a nullable column to a non-nullable column, we can get a data truncation error if any value was "NULL". This is exceptionally unusual, but our two very oldest Herald rules have a "NULL" policy on `secure`. --- resources/sql/autopatches/20180124.herald.01.repetition.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/sql/autopatches/20180124.herald.01.repetition.sql b/resources/sql/autopatches/20180124.herald.01.repetition.sql index 3be9ec627d..31f1477e01 100644 --- a/resources/sql/autopatches/20180124.herald.01.repetition.sql +++ b/resources/sql/autopatches/20180124.herald.01.repetition.sql @@ -5,6 +5,10 @@ */ +UPDATE {$NAMESPACE}_herald.herald_rule + SET repetitionPolicy = '1' + WHERE repetitionPolicy IS NULL; + ALTER TABLE {$NAMESPACE}_herald.herald_rule CHANGE repetitionPolicy repetitionPolicy VARCHAR(32) NOT NULL COLLATE {$COLLATE_TEXT};