Feature: Create conversations from Tweets (#470)

* Feature: Add tweets to conversations
This commit is contained in:
Pranav Raj S
2020-02-09 15:47:48 +05:30
committed by GitHub
parent 3465ebefd1
commit 272c481464
29 changed files with 333 additions and 68 deletions

View File

@@ -0,0 +1,12 @@
class AddContactToMessage < ActiveRecord::Migration[6.0]
def change
add_reference(:messages, :contact, foreign_key: true, index: true)
::Message.all.each do |message|
conversation = message.conversation
next if conversation.contact.nil?
message.update!(contact_id: conversation.contact.id)
end
end
end

View File

@@ -0,0 +1,7 @@
class RenameFbIdToSourceId < ActiveRecord::Migration[6.0]
def change
rename_column :messages, :fb_id, :source_id
add_index(:messages, :source_id)
end
end

View File

@@ -0,0 +1,5 @@
class AddAdditionalAttributesToContact < ActiveRecord::Migration[6.0]
def change
add_column :contacts, :additional_attributes, :jsonb
end
end