Update 20201203213108_add_unread_count_to_chat_conversation_accounts_not_null.rb

This commit is contained in:
admin 2020-12-22 20:07:30 +00:00
parent 4e1e29571b
commit fb0b654e11

View File

@ -1,5 +1,15 @@
class AddUnreadCountToChatConversationAccountsNotNull < ActiveRecord::Migration[5.2] class AddUnreadCountToChatConversationAccountsNotNull < ActiveRecord::Migration[5.2]
def change def change
change_column_null :chat_conversation_accounts, :unread_count, false safety_assured do
execute 'ALTER TABLE "chat_conversation_accounts" ADD CONSTRAINT "chat_conversation_accounts_unread_count_null" CHECK ("unread_count" IS NOT NULL) NOT VALID'
end
end end
end end
class ValidateAddUnreadCountToChatConversationAccountsNotNull < ActiveRecord::Migration[5.2]
def change
safety_assured do
execute 'ALTER TABLE "chat_conversation_accounts" VALIDATE CONSTRAINT "chat_conversation_accounts_unread_count_null"'
end
end
end