Skip to content

Introduce 'gdk truncate-legacy-tables' command

Nao Hashizume requested to merge 2013-no-db-truncate-on-gdk-bootstrap into main

What does this merge request do and why?

This MR removes the make truncate-legacy-tables from the gdk reconfigure command as it's not necessary for fresh installations of GDK. Instead, it introduces a new gdk truncate-legacy-tables command to handle truncating unnecessary data in the main and ci databases.

The MR also adds a diagnostic to check for stale data and suggest users to run gdk truncate-legacy-tabls when it's needed.

Closes #2013 (closed)

How to set up and validate locally

  1. git checkout 2013-no-db-truncate-on-gdk-bootstrap
  2. gdk config set gitlab.rails.databases.ci.enabled true && gdk config set geo.secondary false
  3. rm .cache/.truncate_tables
  4. gdk doctor
    Stale Data
    ================================================================================
    You might encounter a PG::CheckViolation error during database migrations, likely due to stale data in the ci database that belongs in the main database, or vice versa. To address this, you can run:
    
    gdk truncate-legacy-tables
  5. gdk truncate-legacy-tables
    $ gdk truncate-legacy-tables                       
    => Ensuring legacy data in main & ci databases are truncated.
    ...
    ✅️ Legacy table truncation completed successfully.

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 Nao Hashizume

Merge request reports