summaryrefslogtreecommitdiff
path: root/db/migrate/20200928131934_create_required_code_owners_sections.rb
blob: f2dfd4007e53f366725886fd52e35e10421276ac (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 CreateRequiredCodeOwnersSections < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    with_lock_retries do
      create_table :required_code_owners_sections, if_not_exists: true do |t|
        t.references :protected_branch, null: false, foreign_key: { on_delete: :cascade }
        t.text :name, null: false
      end
    end

    add_text_limit :required_code_owners_sections, :name, 1024
  end

  def down
    with_lock_retries do
      drop_table :required_code_owners_sections, if_exists: true
    end
  end
end