summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-04-01 17:57:52 +0900
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-04-06 23:46:58 +0900
commit934e949726adf4428a03970d78e23555cc1d7a72 (patch)
treeda26a02cf4f27563633c31ebe07a6e9e33f693ef /db
parent62480461c943b4ca4c72830c04932cd5bba9f4e7 (diff)
downloadgitlab-ce-934e949726adf4428a03970d78e23555cc1d7a72.tar.gz
Fix rubocop issues. Use add_concurrent_foreign_key.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20170329095325_add_ref_to_triggers.rb4
-rw-r--r--db/migrate/20170329095907_create_ci_trigger_schedules.rb15
-rw-r--r--db/schema.rb2
3 files changed, 10 insertions, 11 deletions
diff --git a/db/migrate/20170329095325_add_ref_to_triggers.rb b/db/migrate/20170329095325_add_ref_to_triggers.rb
index 6900ded4277..4aa52dd8f8f 100644
--- a/db/migrate/20170329095325_add_ref_to_triggers.rb
+++ b/db/migrate/20170329095325_add_ref_to_triggers.rb
@@ -1,10 +1,6 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class AddRefToTriggers < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
- # Set this constant to true if this migration requires downtime.
DOWNTIME = false
def change
diff --git a/db/migrate/20170329095907_create_ci_trigger_schedules.rb b/db/migrate/20170329095907_create_ci_trigger_schedules.rb
index 7b2e2e2098b..3dcd05175c0 100644
--- a/db/migrate/20170329095907_create_ci_trigger_schedules.rb
+++ b/db/migrate/20170329095907_create_ci_trigger_schedules.rb
@@ -1,13 +1,11 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
class CreateCiTriggerSchedules < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
- # Set this constant to true if this migration requires downtime.
DOWNTIME = false
- def change
+ disable_ddl_transaction!
+
+ def up
create_table :ci_trigger_schedules do |t|
t.integer "project_id"
t.integer "trigger_id", null: false
@@ -21,6 +19,11 @@ class CreateCiTriggerSchedules < ActiveRecord::Migration
add_index :ci_trigger_schedules, ["next_run_at"], name: "index_ci_trigger_schedules_on_next_run_at", using: :btree
add_index :ci_trigger_schedules, ["project_id"], name: "index_ci_trigger_schedules_on_project_id", using: :btree
- add_foreign_key :ci_trigger_schedules, :ci_triggers, column: :trigger_id, on_delete: :cascade
+ add_concurrent_foreign_key :ci_trigger_schedules, :ci_triggers, column: :trigger_id, on_delete: :cascade
+ end
+
+ def down
+ remove_foreign_key :ci_trigger_schedules, column: :trigger_id
+ drop_table :ci_trigger_schedules
end
end
diff --git a/db/schema.rb b/db/schema.rb
index 8f3b3110548..7d9f969c2e1 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -1313,7 +1313,7 @@ ActiveRecord::Schema.define(version: 20170405080720) do
add_foreign_key "boards", "projects"
add_foreign_key "chat_teams", "namespaces", on_delete: :cascade
- add_foreign_key "ci_trigger_schedules", "ci_triggers", column: "trigger_id", on_delete: :cascade
+ add_foreign_key "ci_trigger_schedules", "ci_triggers", column: "trigger_id", name: "fk_90a406cc94", on_delete: :cascade
add_foreign_key "ci_triggers", "users", column: "owner_id", name: "fk_e8e10d1964", on_delete: :cascade
add_foreign_key "issue_metrics", "issues", on_delete: :cascade
add_foreign_key "label_priorities", "labels", on_delete: :cascade