Migration fails with "Foreign key constraint is incorrectly formed"
Summary
Migrating to 9.1.4 db migration failure
Steps to reproduce
Be on version:
GitLab 7.14.1
GitLab Shell 2.6.4
GitLab API v3
Ruby 2.0.0p384
Rails 4.1.11
Mysql: Server version: 10.0.14-MariaDB-1~trusty-log mariadb.org binary distribution
When you upgrade and run: bundle exec rake db:migrate RAILS_ENV=production
What is the current bug behavior?
(What actually happens)
What is the expected correct behavior?
Success!
Relevant logs and/or screenshots
== 20160415062917 CreatePersonalAccessTokens: migrating ======================= -- create_table(:personal_access_tokens) rake aborted! StandardError: An error has occurred, all later migrations canceled:
Mysql2::Error: Can't create table gitlabhq_production.#sql-4c1_24f (errno: 150 "Foreign key constraint is incorrectly formed"): ALTER TABLE personal_access_tokens ADD CON
STRAINT fk_rails_08903b8f38
FOREIGN KEY (user_id)
REFERENCES users (id)