BigW Consortium Gitlab

20161113184239_create_user_chat_names_table.rb 676 Bytes
Newer Older
1 2
# rubocop:disable Migration/Datetime
# rubocop:disable Migration/Timestamps
3 4 5 6 7 8 9
class CreateUserChatNamesTable < ActiveRecord::Migration
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  def change
    create_table :chat_names do |t|
10 11 12 13 14 15
      t.integer :user_id, null: false
      t.integer :service_id, null: false
      t.string :team_id, null: false
      t.string :team_domain
      t.string :chat_id, null: false
      t.string :chat_name
16
      t.datetime :last_used_at
17
      t.timestamps null: false
18 19 20 21 22 23
    end

    add_index :chat_names, [:user_id, :service_id], unique: true
    add_index :chat_names, [:service_id, :team_id, :chat_id], unique: true
  end
end