Re-organize schema. Drop protected from runner. Add access_level to runner. Drop protected from pipeline. Add protected to ci_bilds.
This commit is contained in:
parent
23ac401b6e
commit
0a7b3ae9f1
|
@ -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.
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
class AddProtectedToCiRunners < ActiveRecord::Migration
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_column_with_default(:ci_runners, :protected, :boolean, default: false)
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column(:ci_runners, :protected)
|
||||
end
|
||||
end
|
|
@ -1,15 +0,0 @@
|
|||
class AddProtectedToCiPipelines < ActiveRecord::Migration
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_column(:ci_pipelines, :protected, :boolean)
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column(:ci_pipelines, :protected)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
class AddAccessLevelToCiRunners < ActiveRecord::Migration
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
# Ci::Runner.protection_none: 0
|
||||
add_column_with_default(:ci_runners, :access_level, :integer, default: 0)
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column(:ci_runners, :access_level)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,15 @@
|
|||
class AddIndexOnCiRunnersAccessLevel < ActiveRecord::Migration
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_index :ci_runners, :access_level
|
||||
end
|
||||
|
||||
def down
|
||||
remove_concurrent_index :ci_runners, :access_level if index_exists?(:ci_runners, :access_level)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue