chore: Prevent null in Contact JSONB attributes (#3730)

This commit is contained in:
Sojan Jose
2022-01-11 15:14:55 -08:00
committed by GitHub
parent de37975be4
commit ebb04487a8
5 changed files with 56 additions and 6 deletions
@@ -0,0 +1,8 @@
class UpdateNilContactAttributesToEmptyHash < ActiveRecord::Migration[6.1]
def change
# rubocop:disable Rails/SkipsModelValidations
Contact.where(custom_attributes: nil).update_all(custom_attributes: {})
Contact.where(additional_attributes: nil).update_all(additional_attributes: {})
# rubocop:enable Rails/SkipsModelValidations
end
end
+3 -3
View File
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_12_21_125545) do
ActiveRecord::Schema.define(version: 2022_01_11_200105) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"
@@ -461,7 +461,7 @@ ActiveRecord::Schema.define(version: 2021_12_21_125545) do
t.string "timezone", default: "UTC"
t.boolean "enable_email_collect", default: true
t.boolean "csat_survey_enabled", default: false
t.boolean 'allow_messages_after_resolved', default: true
t.boolean "allow_messages_after_resolved", default: true
t.index ["account_id"], name: "index_inboxes_on_account_id"
end
@@ -830,4 +830,4 @@ ActiveRecord::Schema.define(version: 2021_12_21_125545) do
"NEW.display_id := nextval('camp_dpid_seq_' || NEW.account_id);"
end
end
end