diff options
author | Dylan Griffith <dyl.griffith@gmail.com> | 2018-05-01 13:26:18 +0400 |
---|---|---|
committer | Dylan Griffith <dyl.griffith@gmail.com> | 2018-05-01 13:26:18 +0400 |
commit | b7b823246602d6821f1773274ee6017c9f46e93f (patch) | |
tree | cdd93cf4aa4031c35e881e4b84880f96c6f25fbe | |
parent | 7e0325896081152e7dd5033342ee4f1b485a76ea (diff) | |
download | gitlab-ce-b7b823246602d6821f1773274ee6017c9f46e93f.tar.gz |
Simplify AddCiRunnerGroups migration
-rw-r--r-- | db/migrate/20170301101006_add_ci_runner_groups.rb | 16 | ||||
-rw-r--r-- | db/schema.rb | 4 |
2 files changed, 8 insertions, 12 deletions
diff --git a/db/migrate/20170301101006_add_ci_runner_groups.rb b/db/migrate/20170301101006_add_ci_runner_groups.rb index 1c4430981a9..558e4d08b8f 100644 --- a/db/migrate/20170301101006_add_ci_runner_groups.rb +++ b/db/migrate/20170301101006_add_ci_runner_groups.rb @@ -5,19 +5,15 @@ class AddCiRunnerGroups < ActiveRecord::Migration disable_ddl_transaction! - def up + def change create_table :ci_runner_groups do |t| t.integer :runner_id t.integer :group_id - end - - add_concurrent_index :ci_runner_groups, :group_id - add_concurrent_index :ci_runner_groups, [:runner_id, :group_id], unique: true - add_concurrent_foreign_key :ci_runner_groups, :ci_runners, column: :runner_id, on_delete: :cascade - add_concurrent_foreign_key :ci_runner_groups, :namespaces, column: :group_id, on_delete: :cascade - end - def down - drop_table :ci_runner_groups + t.index [:runner_id, :group_id], unique: true + t.index :group_id + t.foreign_key :ci_runners, column: :runner_id, on_delete: :cascade + t.foreign_key :namespaces, column: :group_id, on_delete: :cascade + end end end diff --git a/db/schema.rb b/db/schema.rb index 4a541b3ac81..88e9b3bd65b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2096,8 +2096,8 @@ ActiveRecord::Schema.define(version: 20180430143705) do add_foreign_key "ci_pipelines", "ci_pipeline_schedules", column: "pipeline_schedule_id", name: "fk_3d34ab2e06", on_delete: :nullify add_foreign_key "ci_pipelines", "ci_pipelines", column: "auto_canceled_by_id", name: "fk_262d4c2d19", on_delete: :nullify add_foreign_key "ci_pipelines", "projects", name: "fk_86635dbd80", on_delete: :cascade - add_foreign_key "ci_runner_groups", "ci_runners", column: "runner_id", name: "fk_d8a0baa93b", on_delete: :cascade - add_foreign_key "ci_runner_groups", "namespaces", column: "group_id", name: "fk_cdafb3bbba", on_delete: :cascade + add_foreign_key "ci_runner_groups", "ci_runners", column: "runner_id", on_delete: :cascade + add_foreign_key "ci_runner_groups", "namespaces", column: "group_id", on_delete: :cascade add_foreign_key "ci_runner_projects", "projects", name: "fk_4478a6f1e4", on_delete: :cascade add_foreign_key "ci_stages", "ci_pipelines", column: "pipeline_id", name: "fk_fb57e6cc56", on_delete: :cascade add_foreign_key "ci_stages", "projects", name: "fk_2360681d1d", on_delete: :cascade |