Skip to content

Skip truncation of database tables if CI database not enabled

Stan Hu requested to merge sh-skip-truncate-when-ci-db-not-enabled into main

What does this merge request do and why?

If you have gitlab.rails.databases.ci.enabled set to false, then the Rake tasks added in !3272 (merged) will fail with an error since the main and CI database are the same.

This commit skips the truncation step if the CI database is not enabled.

Relates to #1905 (closed)

How to set up and validate locally

  1. Run rm .cache/.truncate_tables.
  2. Run make truncate-legacy-tables
  3. On a normal database with ci and main, this should proceed.
  4. If you set up a separate GDK with gdk config set gitlab.rails.databases.ci.enabled false and repeat steps 1-2, then you should see:
--------------------------------------------------------------------------------
Ensuring legacy data in main & ci databases are truncated
--------------------------------------------------------------------------------
CI database not enabled, nothing to do here

Impacted categories

The following categories relate to this merge request:

Merge request checklist

  • This change is backward compatible. If not, please include steps to communicate to our users.
  • Tests added for new functionality. If not, please raise an issue to follow-up.
  • Documentation added/updated, if needed.
  • Announcement added, if change is notable.
  • gdk doctor test added, if needed.
  • Add the ~highlight label if this MR should be included in the CHANGELOG.md.
Edited by Stan Hu

Merge request reports

Loading