The road to Rails 5
May 28, 2019Jan Provaznik

Summary
This post details the strategy and technical implementation of upgrading GitLab from Rails 4 to Rails 5. Key contributions include: developing a method to run the application on both Rails 4 and Rails 5 simultaneously using environment variables (`RAILS5`, `BUNDLE_GEMFILE`), splitting the upgrade into smaller, manageable issues, using a helper method (`Gitlab.rails5?`) to conditionally apply code for each Rails version, and a phased production release strategy to ensure stability. It also highlights challenges encountered with Active Record changes and monkey patches, and the importance of robust CI testing for both versions.
More from the Database Migration Debugging and Cross-Database Compatibility trail
- Seamlessly migrate from Jira to GitLab with Jira2Lab at scale
- We are upgrading the operating system on our Postgres database clusters
- Decomposing the GitLab backend database, Part 1: Designing and planning
- GitLab database decomposition: Final migration and results
- Decomposing the GitLab backend database, Part 3: Challenges and surprises