Skip truncation of database tables if CI database not enabled
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
- Run
rm .cache/.truncate_tables. - Run
make truncate-legacy-tables - On a normal database with
ciandmain, this should proceed. - If you set up a separate GDK with
gdk config set gitlab.rails.databases.ci.enabled falseand 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:
-
gdk-reliability - e.g. When a GDK action fails to complete. -
gdk-usability - e.g. Improvements or suggestions around how the GDK functions. -
gdk-performance - e.g. When a GDK action is slow or times out.
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 doctortest added, if needed. -
Add the ~highlightlabel if this MR should be included in theCHANGELOG.md.
Edited by Stan Hu