Drop unused ci_test_cases and ci_test_case_failures tables
Ref: #336151 (closed)
What does this MR do?
This MR drops 2 ci tables no longer being used, as brought up during our team conversation.
-
ci_test_cases
which has been renamed toci_unit_tests
-
ci_test_case_failures
which has been renamed toci_unit_test_failures
It includes the following items:
-
Drop unused foreign keys as suggested by our documentation it needs to happen in a separate migration. -
Drop unused tables in post_migrate
Why are we doing this?
Following up !56137 (merged) where we renamed our tables to track down unit test failures. Those table ares still around today and create confusion for developers so it's time to clean up this ~"technical debt".
Database review
1️⃣ Foreign key - CiTestCaseFailures
DB migration
$ bin/rails db:migrate
== 20210729161242 RemoveForeignKeysFromCiTestCaseFailures: migrating ==========
-- foreign_keys(:ci_test_case_failures)
-> 0.0041s
-- remove_foreign_key(:ci_test_case_failures, {:column=>:build_id})
-> 0.0052s
-- foreign_keys(:ci_test_case_failures)
-> 0.0021s
-- remove_foreign_key(:ci_test_case_failures, {:column=>:test_case_id})
-> 0.0029s
== 20210729161242 RemoveForeignKeysFromCiTestCaseFailures: migrated (0.0238s) =
DB rollback
$ bin/rails db:rollback
== 20210729161242 RemoveForeignKeysFromCiTestCaseFailures: reverting ==========
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:ci_test_case_failures)
-> 0.0032s
-- execute("ALTER TABLE ci_test_case_failures\nADD CONSTRAINT fk_d69404d827\nFOREIGN KEY (build_id)\nREFERENCES ci_builds (id)\nON DELETE CASCADE\nNOT VALID;\n")
-> 0.0025s
-- execute("SET statement_timeout TO 0")
-> 0.0005s
-- execute("ALTER TABLE ci_test_case_failures VALIDATE CONSTRAINT fk_d69404d827;")
-> 0.0055s
-- execute("RESET ALL")
-> 0.0006s
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:ci_test_case_failures)
-> 0.0022s
-- execute("ALTER TABLE ci_test_case_failures\nADD CONSTRAINT fk_eab6349715\nFOREIGN KEY (test_case_id)\nREFERENCES ci_test_cases (id)\nON DELETE CASCADE\nNOT VALID;\n")
-> 0.0010s
-- execute("ALTER TABLE ci_test_case_failures VALIDATE CONSTRAINT fk_eab6349715;")
-> 0.0014s
== 20210729161242 RemoveForeignKeysFromCiTestCaseFailures: reverted (0.0283s) =
2️⃣ Foreign key - CiTestCases
DB migration
$ bin/rails db:migrate
== 20210729192148 RemoveForeignKeysFromCiTestCases: migrating =================
-- foreign_keys(:ci_test_cases)
-> 0.0032s
-- remove_foreign_key(:ci_test_cases, {:column=>:project_id})
-> 0.0034s
== 20210729192148 RemoveForeignKeysFromCiTestCases: migrated (0.0110s) ========
DB rollback
$ bin/rails db:rollback
== 20210729192148 RemoveForeignKeysFromCiTestCases: reverting =================
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:ci_test_cases)
-> 0.0046s
-- execute("ALTER TABLE ci_test_cases\nADD CONSTRAINT fk_0526c30ded\nFOREIGN KEY (project_id)\nREFERENCES projects (id)\nON DELETE CASCADE\nNOT VALID;\n")
-> 0.0038s
-- execute("SET statement_timeout TO 0")
-> 0.0006s
-- execute("ALTER TABLE ci_test_cases VALIDATE CONSTRAINT fk_0526c30ded;")
-> 0.0160s
-- execute("RESET ALL")
-> 0.0009s
== 20210729192148 RemoveForeignKeysFromCiTestCases: reverted (0.0359s) ========
3️⃣ Drop table - CiTestCaseFailures
DB migration
$ bin/rails db:migrate
== 20210729192959 DropCiTestCaseFailuresTable: migrating ======================
-- drop_table(:ci_test_case_failures)
-> 0.0105s
== 20210729192959 DropCiTestCaseFailuresTable: migrated (0.0105s) =============
DB rollback
$ bin/rails db:rollback
== 20210729192959 DropCiTestCaseFailuresTable: reverting ======================
-- create_table(:ci_test_case_failures)
-> 0.0110s
== 20210729192959 DropCiTestCaseFailuresTable: reverted (0.0111s) =============
4️⃣ Drop table - CiTestCases
DB migration
$ bin/rails db:migrate
== 20210729193056 DropCiTestCasesTable: migrating =============================
-- drop_table(:ci_test_cases)
-> 0.0024s
== 20210729193056 DropCiTestCasesTable: migrated (0.0025s) ====================
DB rollback
$ bin/rails db:rollback
== 20210729193056 DropCiTestCasesTable: reverting =============================
-- create_table(:ci_test_cases, {})
-- quote_column_name(:key_hash)
-> 0.0000s
-> 0.0106s
-- quote_table_name("check_dd3c5d1c15")
-> 0.0000s
-- quote_table_name(:ci_test_cases)
-> 0.0000s
-- execute("ALTER TABLE \"ci_test_cases\"\nADD CONSTRAINT \"check_dd3c5d1c15\" CHECK (char_length(\"key_hash\") <= 64)\n")
-> 0.0013s
== 20210729193056 DropCiTestCasesTable: reverted (0.0217s) ====================
Does this MR meet the acceptance criteria?
Conformity
-
I have included changelog trailers, or none are needed. (Does this MR need a changelog?) - [-] I have added/updated documentation, or it's not needed. (Is documentation required?)
- [-] I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?)
-
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides. -
This change is backwards compatible across updates, or this does not apply.
Edited by Max Orefice