summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20170731123938_add_protected_to_ci_runners.rb15
-rw-r--r--db/migrate/20170731132235_add_protected_to_ci_pipelines.rb15
-rw-r--r--db/migrate/20170816133938_add_access_level_to_ci_runners.rb16
-rw-r--r--db/migrate/20170816133939_add_index_on_ci_runners_access_level.rb15
-rw-r--r--db/migrate/20170816133940_add_protected_to_ci_builds.rb7
-rw-r--r--db/schema.rb5
6 files changed, 41 insertions, 32 deletions
diff --git a/db/migrate/20170731123938_add_protected_to_ci_runners.rb b/db/migrate/20170731123938_add_protected_to_ci_runners.rb
deleted file mode 100644
index 3782e047eee..00000000000
--- a/db/migrate/20170731123938_add_protected_to_ci_runners.rb
+++ /dev/null
@@ -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
diff --git a/db/migrate/20170731132235_add_protected_to_ci_pipelines.rb b/db/migrate/20170731132235_add_protected_to_ci_pipelines.rb
deleted file mode 100644
index d2d2b6733f6..00000000000
--- a/db/migrate/20170731132235_add_protected_to_ci_pipelines.rb
+++ /dev/null
@@ -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
diff --git a/db/migrate/20170816133938_add_access_level_to_ci_runners.rb b/db/migrate/20170816133938_add_access_level_to_ci_runners.rb
new file mode 100644
index 00000000000..8cda0c3a717
--- /dev/null
+++ b/db/migrate/20170816133938_add_access_level_to_ci_runners.rb
@@ -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
diff --git a/db/migrate/20170816133939_add_index_on_ci_runners_access_level.rb b/db/migrate/20170816133939_add_index_on_ci_runners_access_level.rb
new file mode 100644
index 00000000000..4239bf6f9cb
--- /dev/null
+++ b/db/migrate/20170816133939_add_index_on_ci_runners_access_level.rb
@@ -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
diff --git a/db/migrate/20170816133940_add_protected_to_ci_builds.rb b/db/migrate/20170816133940_add_protected_to_ci_builds.rb
new file mode 100644
index 00000000000..c73a4387d29
--- /dev/null
+++ b/db/migrate/20170816133940_add_protected_to_ci_builds.rb
@@ -0,0 +1,7 @@
+class AddProtectedToCiBuilds < ActiveRecord::Migration
+ DOWNTIME = false
+
+ def change
+ add_column :ci_builds, :protected, :boolean
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 85cb4e99b10..c933b47ab01 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -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