Databasemigration fails after Update to 10.1.0

Recipe: gitlab::database_migrations
  • bash[migrate gitlab-rails database] action rune
    [execute] rake aborted!
    StandardError: An error has occurred, all later migrations canceled:

          PG::DuplicateColumn: ERROR:  column "merge_requests_ff_only_enabled" of relation "projects" already exists
          : ALTER TABLE "projects" ADD "merge_requests_ff_only_enabled" boolean
          /opt/gitlab/embedded/service/gitlab-rails/config/initializers/postgresql_limit_fix.rb:6:in `add_column'
          /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:325:in `block in add_column_with_default'
          /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:321:in `add_column_with_default'
          /opt/gitlab/embedded/service/gitlab-rails/db/migrate/20150827121444_add_fast_forward_option_to_project.rb:11:in `up'
          /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:50:in `block (3 levels) in <top (required)>'
          /opt/gitlab/embedded/bin/bundle:23:in `load'
          /opt/gitlab/embedded/bin/bundle:23:in `<main>'

I tried to run a reconfigure after the upgrade, same error.

What to do?

1 Like

Just had the same problem.
I solved it by accessing the embedded postgresql console and renaming the column that seems to be already present (I guess you can also delete it), and then launching again the upgrade process:

$ sudo gitlab-rails dbconsole
gitlabhq_production=> alter table projects rename column merge_requests_ff_only_enabled to merge_requests_ff_only_enabled_BAK;
gitlabhq_production=> \q
$ sudo gitlab-ctl  upgrade

Let me know if it helps.

1 Like

This fixed the issue. Thanks