Skip to content

Refactor decomposition migration to use Backup::DatabaseConfiguration

Gabriel Mazetto requested to merge brodock/remove-database-model-again into master

What does this MR do and why?

During the refactor of !137454 (merged) a parallel work happened to create a script for the database decomposition (!135585 (merged)) that relied on the Backup::DatabaseModel which was refactored into Backup::DatabaseConfiguration and Backup::DatabaseConnection.

For some reason the regular MR flow did not catch this and both were eventually merged to master.

The Backup::DatabaseModel was then restored in : !139939 (merged) to ensure master was again functional.

This MR refactors the decomposition migration to use the newly refactored classes and remove again the Backup::DatabaseModel.

Related to: #435529 (closed)

How to set up and validate locally

Using GDK:

  1. Modify database.yml: comment out ci section (so Rails is using a single database)
  2. Drop and create ci database gdk psql -c "DROP DATABASE gitlabhq_development_ci";gdk psql -c "CREATE DATABASE gitlabhq_development_ci"
  3. Run the rake task: bundle exec rake gitlab:db:decomposition:migrate
  4. Verify CI database now also have projects: gdk psql -d gitlabhq_development -c "SELECT COUNT(*) FROM projects";gdk psql -d gitlabhq_development_ci -c "SELECT COUNT(*) FROM projects"; should match

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Gabriel Mazetto

Merge request reports