Skip to content

Fix migrating from scratch with Mysql

Jamie Macey requested to merge jamie_ca/gitlab-ce:fix-mysql-migrate into master

Setting up my dev environment to do some hacking (by hand, because I like being difficult), and found that it was impossible to migrate up an empty mysql database.

Fix was pretty quick - schema.rb is generated through postgres (I think?) and after loading the schema there's a followup task for mysql to add some column size limits. With the integration of GitLab CI, an additional two db columns were added to the list, but this wound up attempting to modify the columns in a 2014 migration, before they were created in a 2015 migration.

This PR pulls those column changes (to ci_builds and ci_commits) into a separate named migration, adds a timestamped migration to load them at a point where those tables exist, and also adds the migration to the add_limits_mysql rake task.

For confirmation, both of the following commands now run to completion, and both set column limits for all six special columns:

  • bundle exec rake db:drop db:create db:migrate
  • bundle exec rake setup

Merge request reports