Adding project control status table
What does this MR do and why?
As per https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/compliance-adherence-reporting/decisions/006_storing_controls_in_a_separate_table/, adding table for project_control_compliance_statuses
for storing status of a compliance control for a specific project.
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
- https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/compliance-adherence-reporting/decisions/006_storing_controls_in_a_separate_table/
- Adding compliance requirement controls table an... (!175812 - merged)
Database
Migration 1: Creation of table
### up
bundle exec rake db:migrate:up:main VERSION=20241227065733
main: == [advisory_lock_connection] object_id: 131000, pg_backend_pid: 50070
main: == 20241227065733 CreateProjectControlComplianceStatuses: migrating ===========
main: -- create_table(:project_control_compliance_statuses)
main: -> 0.0123s
main: == 20241227065733 CreateProjectControlComplianceStatuses: migrated (0.0386s) ==
main: == [advisory_lock_connection] object_id: 131000, pg_backend_pid: 50070
### down
bundle exec rake db:migrate:down:main VERSION=20241227065733
main: == [advisory_lock_connection] object_id: 131000, pg_backend_pid: 42169
main: == 20241227065733 CreateProjectControlComplianceStatuses: reverting ===========
main: -- drop_table(:project_control_compliance_statuses)
main: -> 0.0046s
main: == 20241227065733 CreateProjectControlComplianceStatuses: reverted (0.0135s) ==
main: == [advisory_lock_connection] object_id: 131000, pg_backend_pid: 42169
Migration 2: Addition of foreign key for compliance_requirements
### Up
bundle exec rake db:migrate:up:main VERSION=20241227095043
DEPRECATION WARNING: Support for Rails versions < 7.1 is deprecated and will be removed from ViewComponent 4.0.0 (ViewComponent v4 will remove support for Rails versions < 7.1 no earlier than April 1, 2025) (called from <main> at /Users/hitesh/gitlab/gitlab-development-kit/gitlab/config/environment.rb:7)
main: == [advisory_lock_connection] object_id: 131000, pg_backend_pid: 58956
main: == 20241227095043 AddForeignKeyToComplianceControlsStatusesRequirementId: migrating
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- execute("ALTER TABLE project_control_compliance_statuses ADD CONSTRAINT fk_de8f1f0f22 FOREIGN KEY (compliance_requirement_id) REFERENCES compliance_requirements (id) ON DELETE CASCADE NOT VALID;")
main: -> 0.0017s
main: -- execute("SET statement_timeout TO 0")
main: -> 0.0004s
main: -- execute("ALTER TABLE project_control_compliance_statuses VALIDATE CONSTRAINT fk_de8f1f0f22;")
main: -> 0.0020s
main: -- execute("RESET statement_timeout")
main: -> 0.0004s
main: == 20241227095043 AddForeignKeyToComplianceControlsStatusesRequirementId: migrated (0.0759s)
main: == [advisory_lock_connection] object_id: 131000, pg_backend_pid: 58956
### Down
bundle exec rake db:migrate:down:main VERSION=20241227095043
main: == [advisory_lock_connection] object_id: 131000, pg_backend_pid: 39761
main: == 20241227095043 AddForeignKeyToComplianceControlsStatusesRequirementId: reverting
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- remove_foreign_key(:project_control_compliance_statuses, {:column=>:compliance_requirement_id})
main: -> 0.0311s
main: == 20241227095043 AddForeignKeyToComplianceControlsStatusesRequirementId: reverted (0.0609s)
main: == [advisory_lock_connection] object_id: 131000, pg_backend_pid: 39761
Migration 3: Addition of foreign key for namespace
### up
bundle exec rake db:migrate:up:main VERSION=20241227094923
kit/gitlab/config/environment.rb:7)
main: == [advisory_lock_connection] object_id: 131000, pg_backend_pid: 86847
main: == 20241227094923 AddForeignKeyToComplianceControlsStatusesNamespaceId: migrating
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- execute("ALTER TABLE project_control_compliance_statuses ADD CONSTRAINT fk_13fb61bcfa FOREIGN KEY (namespace_id) REFERENCES namespaces (id) ON DELETE CASCADE NOT VALID;")
main: -> 0.0019s
main: -- execute("SET statement_timeout TO 0")
main: -> 0.0003s
main: -- execute("ALTER TABLE project_control_compliance_statuses VALIDATE CONSTRAINT fk_13fb61bcfa;")
main: -> 0.0042s
main: -- execute("RESET statement_timeout")
main: -> 0.0004s
main: == 20241227094923 AddForeignKeyToComplianceControlsStatusesNamespaceId: migrated (0.0673s)
main: == [advisory_lock_connection] object_id: 131000, pg_backend_pid: 86847
### down
bundle exec rake db:migrate:down:main VERSION=20241227094923
main: == [advisory_lock_connection] object_id: 131000, pg_backend_pid: 80054
main: == 20241227094923 AddForeignKeyToComplianceControlsStatusesNamespaceId: reverting
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- remove_foreign_key(:project_control_compliance_statuses, {:column=>:namespace_id})
main: -> 0.0261s
main: == 20241227094923 AddForeignKeyToComplianceControlsStatusesNamespaceId: reverted (0.0461s)
main: == [advisory_lock_connection] object_id: 131000, pg_backend_pid: 80054
Migration 3: Addition of foreign key for projects
### up
bundle exec rake db:migrate:up:main VERSION=20241227094746
main: == [advisory_lock_connection] object_id: 131000, pg_backend_pid: 25198
main: == 20241227094746 AddForeignKeyToComplianceControlsStatusesProjectId: migrating
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- execute("ALTER TABLE project_control_compliance_statuses ADD CONSTRAINT fk_9826fbb4a6 FOREIGN KEY (project_id) REFERENCES projects (id) ON DELETE CASCADE NOT VALID;")
main: -> 0.0019s
main: -- execute("SET statement_timeout TO 0")
main: -> 0.0004s
main: -- execute("ALTER TABLE project_control_compliance_statuses VALIDATE CONSTRAINT fk_9826fbb4a6;")
main: -> 0.0142s
main: -- execute("RESET statement_timeout")
main: -> 0.0008s
main: == 20241227094746 AddForeignKeyToComplianceControlsStatusesProjectId: migrated (0.0767s)
main: == [advisory_lock_connection] object_id: 131000, pg_backend_pid: 25198
### down
bundle exec rake db:migrate:down:main VERSION=20241227094746
main: == [advisory_lock_connection] object_id: 131000, pg_backend_pid: 16602
main: == 20241227094746 AddForeignKeyToComplianceControlsStatusesProjectId: reverting
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- remove_foreign_key(:project_control_compliance_statuses, {:column=>:project_id})
main: -> 0.0216s
main: == 20241227094746 AddForeignKeyToComplianceControlsStatusesProjectId: reverted (0.0434s)
main: == [advisory_lock_connection] object_id: 131000, pg_backend_pid: 16602
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
Related to #508483