summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2016-09-19 13:00:21 +0530
committerTimothy Andrew <mail@timothyandrew.net>2016-09-19 13:12:06 +0530
commit2cddd02ec5dd9d27fc9e9b6ac5e0748fe92e1cff (patch)
tree229e8f558d9619612e4f58ad0f333cc0db74a991
parent8f6208513a98b33d7edd6ecf1ae6062f266c279f (diff)
downloadgitlab-ce-2cddd02ec5dd9d27fc9e9b6ac5e0748fe92e1cff.tar.gz
Remove unused merge request metrics.
- These are not being used anymore. - Consolidate all issue metrics into a single migration. - Consolidate all merge request metrics into a single migration.
-rw-r--r--app/models/merge_request/metrics.rb12
-rw-r--r--db/migrate/20160824124900_add_table_issue_metrics.rb1
-rw-r--r--db/migrate/20160825052008_add_table_merge_request_metrics.rb6
-rw-r--r--db/migrate/20160915061248_add_production_deploy_time_to_merge_request_metrics.rb29
-rw-r--r--db/migrate/20160915072217_add_first_mentioned_in_commit_time_to_issue_metrics.rb29
-rw-r--r--db/migrate/20160915081353_add_latest_build_time_to_merge_request_metrics.rb30
6 files changed, 4 insertions, 103 deletions
diff --git a/app/models/merge_request/metrics.rb b/app/models/merge_request/metrics.rb
index 18b1e7c5bf3..8c42c830fac 100644
--- a/app/models/merge_request/metrics.rb
+++ b/app/models/merge_request/metrics.rb
@@ -2,22 +2,10 @@ class MergeRequest::Metrics < ActiveRecord::Base
belongs_to :merge_request
def record!
- if !merge_request.work_in_progress? && self.wip_flag_first_removed_at.blank?
- self.wip_flag_first_removed_at = Time.now
- end
-
- if merge_request.author_id != merge_request.assignee_id && self.first_assigned_to_user_other_than_author.blank?
- self.first_assigned_to_user_other_than_author = Time.now
- end
-
if merge_request.merged? && self.merged_at.blank?
self.merged_at = Time.now
end
- if merge_request.closed? && self.first_closed_at.blank?
- self.first_closed_at = Time.now
- end
-
self.save if self.changed?
end
diff --git a/db/migrate/20160824124900_add_table_issue_metrics.rb b/db/migrate/20160824124900_add_table_issue_metrics.rb
index 256c1b7c15c..04dff26043d 100644
--- a/db/migrate/20160824124900_add_table_issue_metrics.rb
+++ b/db/migrate/20160824124900_add_table_issue_metrics.rb
@@ -27,6 +27,7 @@ class AddTableIssueMetrics < ActiveRecord::Migration
create_table :issue_metrics do |t|
t.references :issue, index: { name: "index_issue_metrics" }, foreign_key: true, null: false
+ t.datetime 'first_mentioned_in_commit_at'
t.datetime 'first_associated_with_milestone_at'
t.datetime 'first_added_to_board_at'
diff --git a/db/migrate/20160825052008_add_table_merge_request_metrics.rb b/db/migrate/20160825052008_add_table_merge_request_metrics.rb
index 809804cbfea..fb5494c5e8b 100644
--- a/db/migrate/20160825052008_add_table_merge_request_metrics.rb
+++ b/db/migrate/20160825052008_add_table_merge_request_metrics.rb
@@ -27,10 +27,10 @@ class AddTableMergeRequestMetrics < ActiveRecord::Migration
create_table :merge_request_metrics do |t|
t.references :merge_request, index: { name: "index_merge_request_metrics" }, foreign_key: true, null: false
- t.datetime 'wip_flag_first_removed_at'
- t.datetime 'first_assigned_to_user_other_than_author'
+ t.datetime 'latest_build_started_at'
+ t.datetime 'latest_build_finished_at'
+ t.datetime 'first_deployed_to_production_at'
t.datetime 'merged_at'
- t.datetime 'first_closed_at'
t.timestamps null: false
end
diff --git a/db/migrate/20160915061248_add_production_deploy_time_to_merge_request_metrics.rb b/db/migrate/20160915061248_add_production_deploy_time_to_merge_request_metrics.rb
deleted file mode 100644
index 34dacfc994b..00000000000
--- a/db/migrate/20160915061248_add_production_deploy_time_to_merge_request_metrics.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddProductionDeployTimeToMergeRequestMetrics < ActiveRecord::Migration
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # When a migration requires downtime you **must** uncomment the following
- # constant and define a short and easy to understand explanation as to why the
- # migration requires downtime.
- # DOWNTIME_REASON = ''
-
- # When using the methods "add_concurrent_index" or "add_column_with_default"
- # you must disable the use of transactions as these methods can not run in an
- # existing transaction. When using "add_concurrent_index" make sure that this
- # method is the _only_ method called in the migration, any other changes
- # should go in a separate migration. This ensures that upon failure _only_ the
- # index creation fails and can be retried or reverted easily.
- #
- # To disable transactions uncomment the following line and remove these
- # comments:
- # disable_ddl_transaction!
-
- def change
- add_column :merge_request_metrics, :first_deployed_to_production_at, :datetime
- end
-end
diff --git a/db/migrate/20160915072217_add_first_mentioned_in_commit_time_to_issue_metrics.rb b/db/migrate/20160915072217_add_first_mentioned_in_commit_time_to_issue_metrics.rb
deleted file mode 100644
index 6c1a388ff3f..00000000000
--- a/db/migrate/20160915072217_add_first_mentioned_in_commit_time_to_issue_metrics.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddFirstMentionedInCommitTimeToIssueMetrics < ActiveRecord::Migration
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # When a migration requires downtime you **must** uncomment the following
- # constant and define a short and easy to understand explanation as to why the
- # migration requires downtime.
- # DOWNTIME_REASON = ''
-
- # When using the methods "add_concurrent_index" or "add_column_with_default"
- # you must disable the use of transactions as these methods can not run in an
- # existing transaction. When using "add_concurrent_index" make sure that this
- # method is the _only_ method called in the migration, any other changes
- # should go in a separate migration. This ensures that upon failure _only_ the
- # index creation fails and can be retried or reverted easily.
- #
- # To disable transactions uncomment the following line and remove these
- # comments:
- # disable_ddl_transaction!
-
- def change
- add_column :issue_metrics, :first_mentioned_in_commit_at, :datetime
- end
-end
diff --git a/db/migrate/20160915081353_add_latest_build_time_to_merge_request_metrics.rb b/db/migrate/20160915081353_add_latest_build_time_to_merge_request_metrics.rb
deleted file mode 100644
index b413e6103c9..00000000000
--- a/db/migrate/20160915081353_add_latest_build_time_to_merge_request_metrics.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddLatestBuildTimeToMergeRequestMetrics < ActiveRecord::Migration
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # When a migration requires downtime you **must** uncomment the following
- # constant and define a short and easy to understand explanation as to why the
- # migration requires downtime.
- # DOWNTIME_REASON = ''
-
- # When using the methods "add_concurrent_index" or "add_column_with_default"
- # you must disable the use of transactions as these methods can not run in an
- # existing transaction. When using "add_concurrent_index" make sure that this
- # method is the _only_ method called in the migration, any other changes
- # should go in a separate migration. This ensures that upon failure _only_ the
- # index creation fails and can be retried or reverted easily.
- #
- # To disable transactions uncomment the following line and remove these
- # comments:
- # disable_ddl_transaction!
-
- def change
- add_column :merge_request_metrics, :latest_build_started_at, :datetime
- add_column :merge_request_metrics, :latest_build_finished_at, :datetime
- end
-end