Skip to content

Step 2: Remove unused columns in elastic_reindexing_tasks

What does this MR do?

Related to #322394 (closed)

  • remove columns from elastic_reindexing_tasks table that are already ignored
  • update the remove_with and remove_after data in the ignore_columns statement to the next release

Full plan to remove unused columns in elastic_reindexing_tasks table according to the guidelines

  1. add ignore_columns - !54666 (merged) (completed in %13.10)
  2. remove columns - #322394 (closed) (this MR)
  3. remove ignore_columns from code - #322396 (closed) (scheduled for %14.3)

Database

up

➜ bundle exec rails db:migrate
== 20210727175201 RemoveUnusedColumnsFromElasticReindexingTasks: migrating ====
-- remove_column(:elastic_reindexing_tasks, :documents_count, :integer)
   -> 0.0028s
-- remove_column(:elastic_reindexing_tasks, :index_name_from, :text)
   -> 0.0025s
-- remove_column(:elastic_reindexing_tasks, :index_name_to, :text)
   -> 0.0014s
-- remove_column(:elastic_reindexing_tasks, :elastic_task, :text)
   -> 0.0013s
-- remove_column(:elastic_reindexing_tasks, :documents_count_target, :integer)
   -> 0.0011s
== 20210727175201 RemoveUnusedColumnsFromElasticReindexingTasks: migrated (0.0093s)

down

➜ bundle exec rails db:rollback
== 20210727175201 RemoveUnusedColumnsFromElasticReindexingTasks: reverting ====
-- add_column(:elastic_reindexing_tasks, :documents_count, :integer)
   -> 0.0020s
-- add_column(:elastic_reindexing_tasks, :index_name_from, :text)
   -> 0.0011s
-- add_column(:elastic_reindexing_tasks, :index_name_to, :text)
   -> 0.0010s
-- add_column(:elastic_reindexing_tasks, :elastic_task, :text)
   -> 0.0010s
-- add_column(:elastic_reindexing_tasks, :documents_count_target, :integer)
   -> 0.0009s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE elastic_reindexing_tasks\nADD CONSTRAINT check_04151aca42\nCHECK ( char_length(index_name_from) <= 255 )\nNOT VALID;\n")
   -> 0.0011s
-- current_schema()
   -> 0.0001s
-- execute("SET statement_timeout TO 0")
   -> 0.0005s
-- execute("ALTER TABLE elastic_reindexing_tasks VALIDATE CONSTRAINT check_04151aca42;")
   -> 0.0009s
-- execute("RESET ALL")
   -> 0.0005s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0001s
-- execute("ALTER TABLE elastic_reindexing_tasks\nADD CONSTRAINT check_85ebff7124\nCHECK ( char_length(index_name_to) <= 255 )\nNOT VALID;\n")
   -> 0.0008s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE elastic_reindexing_tasks VALIDATE CONSTRAINT check_85ebff7124;")
   -> 0.0008s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE elastic_reindexing_tasks\nADD CONSTRAINT check_942e5aae53\nCHECK ( char_length(elastic_task) <= 255 )\nNOT VALID;\n")
   -> 0.0007s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE elastic_reindexing_tasks VALIDATE CONSTRAINT check_942e5aae53;")
   -> 0.0009s
== 20210727175201 RemoveUnusedColumnsFromElasticReindexingTasks: reverted (0.0347s)

Screenshots or Screencasts (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Terri Chu

Merge request reports