summaryrefslogtreecommitdiff
path: root/db/migrate/20190930153535_create_zoom_meetings.rb
blob: 8bc9f0e89def386745a9ee6b6d68da3b096f75f0 (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
# frozen_string_literal: true

class CreateZoomMeetings < ActiveRecord::Migration[5.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  ZOOM_MEETING_STATUS_ADDED = 1

  def change
    create_table :zoom_meetings do |t|
      t.references :project, foreign_key: { on_delete: :cascade },
        null: false
      t.references :issue, foreign_key: { on_delete: :cascade },
        null: false
      t.timestamps_with_timezone null: false
      t.integer :issue_status, limit: 2, default: 1, null: false
      t.string :url, limit: 255 # rubocop:disable Migration/PreventStrings

      t.index [:issue_id, :issue_status], unique: true,
        where: "issue_status = #{ZOOM_MEETING_STATUS_ADDED}"
    end
  end
end