summaryrefslogtreecommitdiff
path: root/db/migrate/20181122160027_create_project_repositories.rb
blob: e42cef9b1c666537162b7ff95e1ae03c0e2b7582 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.

class CreateProjectRepositories < ActiveRecord::Migration[5.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  def change
    create_table :project_repositories, id: :bigserial do |t|
      t.references :shard, null: false, index: true, foreign_key: { on_delete: :restrict }
      t.string :disk_path, null: false, index: { unique: true }
      t.references :project, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade }
    end
  end
end