Skip to content

Adds timestamps to compliance frameworks

What does this MR do and why?

  • Adds updated_at and created_at timestamps to compliance_management_frameworks table.
  • This allows the service ping to build data from specific timeframes as well as all-time.

Database review

Migrate

main: == 20220530104431 AddTimestampsToComplianceFrameworks: migrating ==============
main: -- add_column(:compliance_management_frameworks, :created_at, :datetime_with_timezone, {:null=>true})
main:    -> 0.0142s
main: -- add_column(:compliance_management_frameworks, :updated_at, :datetime_with_timezone, {:null=>true})
main:    -> 0.0009s
main: == 20220530104431 AddTimestampsToComplianceFrameworks: migrated (0.0200s) =====

main: == 20220615091059 AddCreatedAtIndexToComplianceManagementFrameworks: migrating
main: -- transaction_open?()
main:    -> 0.0000s
main: -- index_exists?(:compliance_management_frameworks, [:id, :created_at, :pipeline_configuration_full_path], {:name=>"i_compliance_frameworks_on_id_and_created_at", :algorithm=>:concurrently})
main:    -> 0.0180s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0004s
main: -- add_index(:compliance_management_frameworks, [:id, :created_at, :pipeline_configuration_full_path], {:name=>"i_compliance_frameworks_on_id_and_created_at", :algorithm=>:concurrently})
main:    -> 0.0045s
main: -- execute("RESET statement_timeout")
main:    -> 0.0004s
main: == 20220615091059 AddCreatedAtIndexToComplianceManagementFrameworks: migrated (0.0323s)

ci: == 20220530104431 AddTimestampsToComplianceFrameworks: migrating ==============
ci: -- add_column(:compliance_management_frameworks, :created_at, :datetime_with_timezone, {:null=>true})
ci:    -> 0.0039s
ci: -- add_column(:compliance_management_frameworks, :updated_at, :datetime_with_timezone, {:null=>true})
ci:    -> 0.0007s
ci: == 20220530104431 AddTimestampsToComplianceFrameworks: migrated (0.0048s) =====

ci: == 20220615091059 AddCreatedAtIndexToComplianceManagementFrameworks: migrating
ci: -- transaction_open?()
ci:    -> 0.0000s
ci: -- index_exists?(:compliance_management_frameworks, [:id, :created_at, :pipeline_configuration_full_path], {:name=>"i_compliance_frameworks_on_id_and_created_at", :algorithm=>:concurrently})
ci:    -> 0.0057s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0004s
ci: -- add_index(:compliance_management_frameworks, [:id, :created_at, :pipeline_configuration_full_path], {:name=>"i_compliance_frameworks_on_id_and_created_at", :algorithm=>:concurrently})
ci:    -> 0.0097s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0004s
ci: == 20220615091059 AddCreatedAtIndexToComplianceManagementFrameworks: migrated (0.0220s)

Rollback

main: == 20220615091059 AddCreatedAtIndexToComplianceManagementFrameworks: reverting
main: -- transaction_open?()
main:    -> 0.0000s
main: -- indexes(:compliance_management_frameworks)
main:    -> 0.0210s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0007s
main: -- remove_index(:compliance_management_frameworks, {:algorithm=>:concurrently, :name=>"i_compliance_frameworks_on_id_and_created_at"})
main:    -> 0.0054s
main: -- execute("RESET statement_timeout")
main:    -> 0.0006s
main: == 20220615091059 AddCreatedAtIndexToComplianceManagementFrameworks: reverted (0.0418s)

main: == 20220530104431 AddTimestampsToComplianceFrameworks: reverting ==============
main: -- remove_column(:compliance_management_frameworks, :created_at)
main:    -> 0.0026s
main: -- remove_column(:compliance_management_frameworks, :updated_at)
main:    -> 0.0017s
main: == 20220530104431 AddTimestampsToComplianceFrameworks: reverted (0.0046s) =====

Query Performance

Projects with Frameworks

All Frameworks

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #337494 (closed)

Edited by Max Woolf

Merge request reports