chore: Add migration to set the default empty string value for contact name (#7052)

Fixes: https://linear.app/chatwoot/issue/CW-1650/issue-with-the-contact-name
This commit is contained in:
Muhsin Keloth
2023-05-11 17:35:19 +05:30
committed by GitHub
parent d99997d17d
commit c97d6021e0
3 changed files with 8 additions and 3 deletions

View File

@@ -8,7 +8,7 @@
# email :string # email :string
# identifier :string # identifier :string
# last_activity_at :datetime # last_activity_at :datetime
# name :string # name :string default("")
# phone_number :string # phone_number :string
# created_at :datetime not null # created_at :datetime not null
# updated_at :datetime not null # updated_at :datetime not null

View File

@@ -0,0 +1,5 @@
class SetDefaultEmptyStringForContactName < ActiveRecord::Migration[7.0]
def change
change_column_default :contacts, :name, from: nil, to: ''
end
end

View File

@@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_05_10_060828) do ActiveRecord::Schema[7.0].define(version: 2023_05_10_113208) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements" enable_extension "pg_stat_statements"
enable_extension "pg_trgm" enable_extension "pg_trgm"
@@ -394,7 +394,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_05_10_060828) do
end end
create_table "contacts", id: :serial, force: :cascade do |t| create_table "contacts", id: :serial, force: :cascade do |t|
t.string "name" t.string "name", default: ""
t.string "email" t.string "email"
t.string "phone_number" t.string "phone_number"
t.integer "account_id", null: false t.integer "account_id", null: false