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

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

class CreateIpRestriction < ActiveRecord::Migration[5.1]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  def change
    create_table :ip_restrictions do |t|
      t.references :group, references: :namespace,
                   column: :group_id,
                   type: :integer,
                   null: false,
                   index: true
      t.string :range, null: false # rubocop:disable Migration/AddLimitToStringColumns
    end

    add_foreign_key(:ip_restrictions, :namespaces, column: :group_id, on_delete: :cascade) # rubocop: disable Migration/AddConcurrentForeignKey
  end
end