1
0

20180929222014_create_account_conversations.rb 764 B

12345678910111213141516
  1. # frozen_string_literal: true
  2. class CreateAccountConversations < ActiveRecord::Migration[5.2]
  3. def change
  4. create_table :account_conversations do |t| # rubocop:disable Rails/CreateTableWithTimestamps
  5. t.belongs_to :account, foreign_key: { on_delete: :cascade }
  6. t.belongs_to :conversation, foreign_key: { on_delete: :cascade }
  7. t.bigint :participant_account_ids, array: true, null: false, default: []
  8. t.bigint :status_ids, array: true, null: false, default: []
  9. t.bigint :last_status_id, null: true, default: nil
  10. t.integer :lock_version, null: false, default: 0
  11. end
  12. add_index :account_conversations, [:account_id, :conversation_id, :participant_account_ids], unique: true, name: 'index_unique_conversations'
  13. end
  14. end