Add rule_type to approval_project_rules

Adds migration to introduce non-regular rule_types to
approval_project_rules
This commit is contained in:
Lucas Charles 2019-07-17 17:43:35 +00:00 committed by Mayra Cabrera
parent 2860cfaaff
commit 1b9dbef3fd
4 changed files with 41 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
title: Add migration for adding rule_type to approval_project_rules
merge_request: 30575
author:
type: added

View file

@ -0,0 +1,17 @@
# frozen_string_literal: true
class AddRuleTypeToApprovalProjectRules < ActiveRecord::Migration[5.1]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_column_with_default :approval_project_rules, :rule_type, :integer, limit: 2, default: 0, allow_null: false
end
def down
remove_column :approval_project_rules, :rule_type
end
end

View file

@ -0,0 +1,17 @@
# frozen_string_literal: true
class AddIndexToApprovalProjectRulesRuleType < ActiveRecord::Migration[5.1]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :approval_project_rules, :rule_type
end
def down
remove_concurrent_index :approval_project_rules, :rule_type
end
end

View file

@ -282,7 +282,9 @@ ActiveRecord::Schema.define(version: 2019_07_15_114644) do
t.integer "project_id", null: false
t.integer "approvals_required", limit: 2, default: 0, null: false
t.string "name", null: false
t.integer "rule_type", limit: 2, default: 0, null: false
t.index ["project_id"], name: "index_approval_project_rules_on_project_id", using: :btree
t.index ["rule_type"], name: "index_approval_project_rules_on_rule_type", using: :btree
end
create_table "approval_project_rules_groups", force: :cascade do |t|