FIX: Category settings migration failing on '' integer (#20261)

Fixes migration introduced in a90ad52dff,
some category custom fields like `num_auto_bump_daily` which should be
an integer are actually empty string ''.
This commit is contained in:
Martin Brennan 2023-02-13 18:07:46 +10:00 committed by GitHub
parent 7a593e2fb5
commit e502175f62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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