BigW Consortium Gitlab

Commit 2cddd02e by Timothy Andrew

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.
parent 8f620851
......@@ -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
......
......@@ -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'
......
......@@ -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
......
# 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
# 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
# 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment