Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20180209115333_create_chatops_tables.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2cfb71e1007a29ad1bdd8c88cbcd1cd90a7a047b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

class CreateChatopsTables < ActiveRecord::Migration[4.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  def change
    create_table :ci_pipeline_chat_data, id: :bigserial do |t|
      t.integer :pipeline_id, null: false
      t.references :chat_name, foreign_key: { on_delete: :cascade }, null: false
      t.text :response_url, null: false

      # A pipeline can only contain one row in this table, hence this index is
      # unique.
      t.index :pipeline_id, unique: true

      t.index :chat_name_id
    end

    # rubocop:disable Migration/AddConcurrentForeignKey
    add_foreign_key :ci_pipeline_chat_data, :ci_pipelines,
      column: :pipeline_id,
      on_delete: :cascade
  end
end