Commit 0a7b3ae9 authored by Shinya Maeda's avatar Shinya Maeda

Re-organize schema. Drop protected from runner. Add access_level to runner....

Re-organize schema. Drop protected from runner. Add access_level to runner. Drop protected from pipeline. Add protected to ci_bilds.
parent 23ac401b
......@@ -40,6 +40,11 @@ module Ci
after_destroy :cleanup_runner_queue
enum access_level: {
protection_none: 0,
protection_full: 1
}
# Searches for runners matching the given query.
#
# This method uses ILIKE on PostgreSQL and LIKE on MySQL.
......
class AddProtectedToCiPipelines < ActiveRecord::Migration
class AddAccessLevelToCiRunners < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
......@@ -6,10 +6,11 @@ class AddProtectedToCiPipelines < ActiveRecord::Migration
disable_ddl_transaction!
def up
add_column(:ci_pipelines, :protected, :boolean)
# Ci::Runner.protection_none: 0
add_column_with_default(:ci_runners, :access_level, :integer, default: 0)
end
def down
remove_column(:ci_pipelines, :protected)
remove_column(:ci_runners, :access_level)
end
end
class AddProtectedToCiRunners < ActiveRecord::Migration
class AddIndexOnCiRunnersAccessLevel < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
......@@ -6,10 +6,10 @@ class AddProtectedToCiRunners < ActiveRecord::Migration
disable_ddl_transaction!
def up
add_column_with_default(:ci_runners, :protected, :boolean, default: false)
add_concurrent_index :ci_runners, :access_level
end
def down
remove_column(:ci_runners, :protected)
remove_concurrent_index :ci_runners, :access_level if index_exists?(:ci_runners, :access_level)
end
end
class AddProtectedToCiBuilds < ActiveRecord::Migration
DOWNTIME = false
def change
add_column :ci_builds, :protected, :boolean
end
end
......@@ -246,6 +246,7 @@ ActiveRecord::Schema.define(version: 20170824162758) do
t.integer "auto_canceled_by_id"
t.boolean "retried"
t.integer "stage_id"
t.boolean "protected"
end
add_index "ci_builds", ["auto_canceled_by_id"], name: "index_ci_builds_on_auto_canceled_by_id", using: :btree
......@@ -336,7 +337,6 @@ ActiveRecord::Schema.define(version: 20170824162758) do
t.integer "auto_canceled_by_id"
t.integer "pipeline_schedule_id"
t.integer "source"
t.boolean "protected"
end
add_index "ci_pipelines", ["auto_canceled_by_id"], name: "index_ci_pipelines_on_auto_canceled_by_id", using: :btree
......@@ -372,9 +372,10 @@ ActiveRecord::Schema.define(version: 20170824162758) do
t.string "architecture"
t.boolean "run_untagged", default: true, null: false
t.boolean "locked", default: false, null: false
t.boolean "protected", default: false, null: false
t.integer "access_level", default: 0, null: false
end
add_index "ci_runners", ["access_level"], name: "index_ci_runners_on_access_level", using: :btree
add_index "ci_runners", ["contacted_at"], name: "index_ci_runners_on_contacted_at", using: :btree
add_index "ci_runners", ["is_shared"], name: "index_ci_runners_on_is_shared", using: :btree
add_index "ci_runners", ["locked"], name: "index_ci_runners_on_locked", using: :btree
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment