Skip to content

Geo: Drop tables related to vulnerability export replication

Aakriti Gupta requested to merge ag-remove-replciation-migrations into master

What does this MR do?

Issue: #232977 (closed)

This MR "removes" 2 migrations that added tables related to vulnerability export replication.

This replication is no longer needed, so we want to remove these tables.

However, the code has been released for a few days, so developers, and Gitlab staging and production have already run the migrations. So, in addition to new post migrations to rollback the changes, this MR also adds a no-op comment to the older migrations and removes their original code.

The code that used these tables, is reverted in !38295 (merged) which should be merged before this MR is merged. This MR is created against ag-revert-vulnerability-export-replication. I'll make it against master once the corresponding MR is merged.

Notes for db review

Running the old and new migrations

➜  gitlab git:(ag-remove-replciation-migrations) ✗ rake db:migrate
== 20200720154007 CreateVulnerabilitiesExportVerificationStatus: migrating ====
-- table_exists?(:vulnerability_export_verification_status)
   -> 0.0004s
-- create_table(:vulnerability_export_verification_status, {:id=>false})
   -> 0.0088s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE vulnerability_export_verification_status\nADD CONSTRAINT check_48fdf48546\nCHECK ( char_length(verification_failure) <= 255 )\nNOT VALID;\n")
   -> 0.0004s
-- execute("ALTER TABLE vulnerability_export_verification_status VALIDATE CONSTRAINT check_48fdf48546;")
   -> 0.0004s
== 20200720154007 CreateVulnerabilitiesExportVerificationStatus: migrated (0.0137s)
...
== 20200730133730 RemoveTableVulnerabilityExportVerificationStatus: migrating =
-- table_exists?(:vulnerability_export_verification_status)
   -> 0.0005s
-- drop_table(:vulnerability_export_verification_status)
   -> 0.0009s
== 20200730133730 RemoveTableVulnerabilityExportVerificationStatus: migrated (0.0015s)
...

➜  gitlab git:(ag-remove-replciation-migrations) ✗ rake geo:db:migrate
== 20200710194046 CreateVulnerabilityExportRegistry: migrating ================
== 20200710194046 CreateVulnerabilityExportRegistry: migrated (0.0000s) =======

== 20200730133800 RemoveTableVulnerabilityExportRegistry: migrating ===========
-- table_exists?(:vulnerability_export_registry)
   -> 0.0005s
== 20200730133800 RemoveTableVulnerabilityExportRegistry: migrated (0.0005s) ==

Rolling back the old and new migrations

➜  gitlab git:(ag-remove-replciation-migrations) ✗ rake db:rollback STEP=20
== 20200720154007 CreateVulnerabilitiesExportVerificationStatus: reverting ====
-- table_exists?(:vulnerability_export_verification_status)
   -> 0.0005s
== 20200720154007 CreateVulnerabilitiesExportVerificationStatus: reverted (0.0005s)
...

➜  gitlab git:(ag-remove-replciation-migrations) ✗ rake geo:db:rollback STEP=2
== 20200730133800 RemoveTableVulnerabilityExportRegistry: reverting ===========
== 20200730133800 RemoveTableVulnerabilityExportRegistry: reverted (0.0000s) ==

== 20200710194046 CreateVulnerabilityExportRegistry: reverting ================
== 20200710194046 CreateVulnerabilityExportRegistry: reverted (0.0028s) =======

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Mayra Cabrera

Merge request reports