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

20200922052316_create_issue_email_participants.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a8aeb9d9a5acecce731f2b29454299fed2f203f6 (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
27
28
29
30
31
32
# frozen_string_literal: true

class CreateIssueEmailParticipants < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    unless table_exists?(:issue_email_participants)
      with_lock_retries do
        create_table :issue_email_participants do |t|
          t.references :issue, index: false, null: false, foreign_key: { on_delete: :cascade }
          t.datetime_with_timezone :created_at, null: false
          t.datetime_with_timezone :updated_at, null: false
          t.text :email, null: false

          t.index [:issue_id, :email], unique: true
        end
      end

      add_text_limit(:issue_email_participants, :email, 255)
    end
  end

  def down
    with_lock_retries do
      drop_table :issue_email_participants
    end
  end
end