Feature: Create conversations from Tweets (#470)
* Feature: Add tweets to conversations
This commit is contained in:
12
db/migrate/20200206180408_add_contact_to_message.rb
Normal file
12
db/migrate/20200206180408_add_contact_to_message.rb
Normal 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
|
||||
7
db/migrate/20200206180927_rename_fb_id_to_source_id.rb
Normal file
7
db/migrate/20200206180927_rename_fb_id_to_source_id.rb
Normal 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
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddAdditionalAttributesToContact < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :contacts, :additional_attributes, :jsonb
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user