From e502175f62a9fac55520374c861302f741ddaf8e Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Mon, 13 Feb 2023 18:07:46 +1000 Subject: [PATCH] FIX: Category settings migration failing on '' integer (#20261) Fixes migration introduced in a90ad52dffb2e1dfa41db9d259454dbbe99ff64f, some category custom fields like `num_auto_bump_daily` which should be an integer are actually empty string ''. --- db/migrate/20230208020404_populate_category_settings.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/migrate/20230208020404_populate_category_settings.rb b/db/migrate/20230208020404_populate_category_settings.rb index bf3e0aabe93..9df846797e7 100644 --- a/db/migrate/20230208020404_populate_category_settings.rb +++ b/db/migrate/20230208020404_populate_category_settings.rb @@ -16,15 +16,15 @@ class PopulateCategorySettings < ActiveRecord::Migration[7.0] category_id, MAX( CASE WHEN (name = 'require_topic_approval') - THEN value ELSE NULL END + THEN NULLIF(value, '') ELSE NULL END )::boolean AS require_topic_approval, MAX( CASE WHEN (name = 'require_reply_approval') - THEN value ELSE NULL END + THEN NULLIF(value, '') ELSE NULL END )::boolean AS require_reply_approval, MAX( CASE WHEN (name = 'num_auto_bump_daily') - THEN value ELSE NULL END + THEN NULLIF(value, '') ELSE NULL END )::integer AS num_auto_bump_daily, NOW() AS created_at, NOW() AS updated_at