Chatwoot/db/migrate/20170406092426_add_display_id.rb
Pranav Raj Sreepuram 2a34255e0b Initial Commit
Co-authored-by: Subin <subinthattaparambil@gmail.com>
Co-authored-by: Manoj <manojmj92@gmail.com>
Co-authored-by: Nithin <webofnithin@gmail.com>
2019-08-14 15:18:44 +05:30

8 lines
269 B
Ruby

class AddDisplayId < ActiveRecord::Migration[5.0]
def change
Conversation.all.each do |conversation|
conversation.display_id = Conversation.where(account_id: conversation.account_id).maximum("display_id").to_i + 1
conversation.save!
end
end
end