'Database migration issue in gitlab after upgrading gitlab

Recently i have upgraded gitlab after which few database migrations are not yet migrated and are showing status as down.

We have tried sudo gitlab-rake db:migrate but still some migration are failing.

== 20200213224220 AddSprints: migrating =======================================
-- create_table(:sprints, {:id=>:bigserial})
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::ReadOnlySqlTransaction: ERROR:  cannot execute CREATE TABLE in a read-only transaction
/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20200213224220_add_sprints.rb:7:in `change'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'

Caused by:
ActiveRecord::StatementInvalid: PG::ReadOnlySqlTransaction: ERROR:  cannot execute CREATE TABLE in a read-only transaction
/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20200213224220_add_sprints.rb:7:in `change'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'


Solution 1:[1]

try

sudo touch /opt/gitlab/embedded/service/gitlab-rails/db/migrate/*

or

sudo chmod -R 777 /opt/gitlab/embedded/service/gitlab-rails/

and run migration again.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 DUDEZKIE