FIX: Account for empty string setting values when migrating category settings (#22979)
This migration that populates category setting data from custom fields did not account for the fact that custom fields that expect an integer can still be an empty string. An empty string can't be inserted into the new integer type column. If the setting is an empty string, cast it to NULL.
This commit is contained in:
parent
b7e642d99d
commit
207d983809
|
@ -10,15 +10,15 @@ class ChangeCategorySettingNumAutoBumpDailyDefault < 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
|
||||
|
|
Loading…
Reference in New Issue