2019-11-27 07:12:00 +00:00
|
|
|
class CreateContactInboxes < ActiveRecord::Migration[6.0]
|
2019-10-27 07:44:36 +00:00
|
|
|
def change
|
|
|
|
create_table :contact_inboxes do |t|
|
|
|
|
t.references :contact, foreign_key: true, index: true
|
|
|
|
t.references :inbox, foreign_key: true, index: true
|
|
|
|
t.string :source_id, null: false
|
|
|
|
|
|
|
|
t.timestamps
|
|
|
|
end
|
2019-11-27 07:12:00 +00:00
|
|
|
add_index :contact_inboxes, [:inbox_id, :source_id], unique: true
|
2019-10-27 07:44:36 +00:00
|
|
|
add_index :contact_inboxes, [:source_id]
|
|
|
|
remove_column :contacts, :inbox_id, :integer
|
|
|
|
remove_column :contacts, :source_id, :integer
|
|
|
|
end
|
|
|
|
end
|