2017-06-13 11:44:13 +00:00
|
|
|
# rubocop:disable Migration/Timestamps
|
2017-03-15 22:26:48 +00:00
|
|
|
class CreateProtectedTags < ActiveRecord::Migration
|
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
|
|
|
|
2017-03-31 16:56:26 +00:00
|
|
|
GITLAB_ACCESS_MASTER = 40
|
2017-03-15 22:26:48 +00:00
|
|
|
|
|
|
|
def change
|
|
|
|
create_table :protected_tags do |t|
|
|
|
|
t.integer :project_id, null: false
|
|
|
|
t.string :name, null: false
|
2017-03-31 16:56:26 +00:00
|
|
|
t.timestamps null: false
|
2017-03-15 22:26:48 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
add_index :protected_tags, :project_id
|
|
|
|
|
2017-04-04 02:37:22 +00:00
|
|
|
create_table :protected_tag_create_access_levels do |t|
|
|
|
|
t.references :protected_tag, index: { name: "index_protected_tag_create_access" }, foreign_key: true, null: false
|
2017-03-31 16:56:26 +00:00
|
|
|
t.integer :access_level, default: GITLAB_ACCESS_MASTER, null: true
|
|
|
|
t.references :user, foreign_key: true, index: true
|
2017-04-04 02:37:22 +00:00
|
|
|
t.integer :group_id
|
2017-03-15 22:26:48 +00:00
|
|
|
t.timestamps null: false
|
|
|
|
end
|
|
|
|
|
2017-04-04 02:37:22 +00:00
|
|
|
add_foreign_key :protected_tag_create_access_levels, :namespaces, column: :group_id # rubocop: disable Migration/AddConcurrentForeignKey
|
2017-03-15 22:26:48 +00:00
|
|
|
end
|
|
|
|
end
|