From cd88fa8f80710ec977a85ab8701570073c94f017 Mon Sep 17 00:00:00 2001 From: "micael.bergeron" Date: Wed, 1 Nov 2017 10:31:35 -0400 Subject: removed the #ensure_ref_fetched from all controllers also, I refactored the MergeRequest#fetch_ref method to express the side-effect that this method has. MergeRequest#fetch_ref -> MergeRequest#fetch_ref! Repository#fetch_source_branch -> Repository#fetch_source_branch! --- ...0171101134435_remove_ref_fetched_from_merge_requests.rb | 14 ++++++++++++++ db/schema.rb | 3 +-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20171101134435_remove_ref_fetched_from_merge_requests.rb (limited to 'db') diff --git a/db/migrate/20171101134435_remove_ref_fetched_from_merge_requests.rb b/db/migrate/20171101134435_remove_ref_fetched_from_merge_requests.rb new file mode 100644 index 00000000000..acba8384da4 --- /dev/null +++ b/db/migrate/20171101134435_remove_ref_fetched_from_merge_requests.rb @@ -0,0 +1,14 @@ +class RemoveRefFetchedFromMergeRequests < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + # We don't need to cache this anymore: the refs are now created + # upon save/update and there is no more use for this flag + # + # See https://gitlab.com/gitlab-org/gitlab-ce/issues/36061 + def change + remove_column :merge_requests, :ref_fetched + end +end diff --git a/db/schema.rb b/db/schema.rb index 80d8ff92d6e..7f1cfed4bb8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20171026082505) do +ActiveRecord::Schema.define(version: 20171101134435) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -970,7 +970,6 @@ ActiveRecord::Schema.define(version: 20171026082505) do t.datetime "last_edited_at" t.integer "last_edited_by_id" t.integer "head_pipeline_id" - t.boolean "ref_fetched" t.string "merge_jid" t.boolean "discussion_locked" t.integer "latest_merge_request_diff_id" -- cgit v1.2.1 From 5c367a2a36dec7a4b4a6f0b911db5551d7fd8411 Mon Sep 17 00:00:00 2001 From: "micael.bergeron" Date: Wed, 1 Nov 2017 11:20:06 -0400 Subject: add changelog and move migration to post_migrate --- ...0171101134435_remove_ref_fetched_from_merge_requests.rb | 14 -------------- ...0171101134435_remove_ref_fetched_from_merge_requests.rb | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-) delete mode 100644 db/migrate/20171101134435_remove_ref_fetched_from_merge_requests.rb create mode 100644 db/post_migrate/20171101134435_remove_ref_fetched_from_merge_requests.rb (limited to 'db') diff --git a/db/migrate/20171101134435_remove_ref_fetched_from_merge_requests.rb b/db/migrate/20171101134435_remove_ref_fetched_from_merge_requests.rb deleted file mode 100644 index acba8384da4..00000000000 --- a/db/migrate/20171101134435_remove_ref_fetched_from_merge_requests.rb +++ /dev/null @@ -1,14 +0,0 @@ -class RemoveRefFetchedFromMergeRequests < ActiveRecord::Migration - include Gitlab::Database::MigrationHelpers - - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - - # We don't need to cache this anymore: the refs are now created - # upon save/update and there is no more use for this flag - # - # See https://gitlab.com/gitlab-org/gitlab-ce/issues/36061 - def change - remove_column :merge_requests, :ref_fetched - end -end diff --git a/db/post_migrate/20171101134435_remove_ref_fetched_from_merge_requests.rb b/db/post_migrate/20171101134435_remove_ref_fetched_from_merge_requests.rb new file mode 100644 index 00000000000..acba8384da4 --- /dev/null +++ b/db/post_migrate/20171101134435_remove_ref_fetched_from_merge_requests.rb @@ -0,0 +1,14 @@ +class RemoveRefFetchedFromMergeRequests < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + # We don't need to cache this anymore: the refs are now created + # upon save/update and there is no more use for this flag + # + # See https://gitlab.com/gitlab-org/gitlab-ce/issues/36061 + def change + remove_column :merge_requests, :ref_fetched + end +end -- cgit v1.2.1 From 84b9343230f73dfd2ee6de0b894160bb4b745780 Mon Sep 17 00:00:00 2001 From: "micael.bergeron" Date: Wed, 1 Nov 2017 12:30:16 -0400 Subject: make the migration reversible --- .../20171101134435_remove_ref_fetched_from_merge_requests.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'db') diff --git a/db/post_migrate/20171101134435_remove_ref_fetched_from_merge_requests.rb b/db/post_migrate/20171101134435_remove_ref_fetched_from_merge_requests.rb index acba8384da4..4e8f495d65d 100644 --- a/db/post_migrate/20171101134435_remove_ref_fetched_from_merge_requests.rb +++ b/db/post_migrate/20171101134435_remove_ref_fetched_from_merge_requests.rb @@ -9,6 +9,6 @@ class RemoveRefFetchedFromMergeRequests < ActiveRecord::Migration # # See https://gitlab.com/gitlab-org/gitlab-ce/issues/36061 def change - remove_column :merge_requests, :ref_fetched + remove_column :merge_requests, :ref_fetched, :boolean end end -- cgit v1.2.1