diff options
author | DJ Mountney <david@twkie.net> | 2019-06-25 10:28:18 -0700 |
---|---|---|
committer | DJ Mountney <david@twkie.net> | 2019-06-25 10:44:40 -0700 |
commit | de93bf1fbbd091075ef7ebafb2ab9dabc2e6563c (patch) | |
tree | b97e6b0d09f55251bee3cbe96ec733ff1b0167e8 | |
parent | e793f96c2b684fb8e224eef509bcc7cb8b8d94af (diff) | |
download | gitlab-ce-de93bf1fbbd091075ef7ebafb2ab9dabc2e6563c.tar.gz |
Update comments and docs around min schema version
Fixed some spelling
Dropped rake task description for a prefix only task
Added note on skipping the check to the postgres debugging dev doc
-rw-r--r-- | doc/development/database_debugging.md | 18 | ||||
-rw-r--r-- | lib/gitlab/database.rb | 2 | ||||
-rw-r--r-- | lib/tasks/migrate/schema_check.rake | 2 |
3 files changed, 20 insertions, 2 deletions
diff --git a/doc/development/database_debugging.md b/doc/development/database_debugging.md index 68d33a9d8e0..de2c5b43411 100644 --- a/doc/development/database_debugging.md +++ b/doc/development/database_debugging.md @@ -85,3 +85,21 @@ eric 37709 0.0 0.0 2518640 7524 s006 S Wed11AM 0:00.79 s $ kill 87304 $ kill 37709 ``` + +### db:migrate `database version is too old to be migrated` error + +Users receive this error when `db:migrate` detects that the current schema version +is older than the `MIN_SCHEMA_VERSION` defined in the `Gitlab::Database` library +module. + +Over time we cleanup/combine old migrations in the codebase, so it is not always +possible to migrate GitLab from every previous version. + +In some cases you may want to bypass this check. For example, if you were on a version +of GitLab schema later than the `MIN_SCHEMA_VERSION`, and then rolled back the +to an older migration, from before. In this case, in order to migrate forward again, +you should set the `SKIP_SCHEMA_VERSION_CHECK` environment variable. + +```sh +bundle exec rake db:migrate SKIP_SCHEMA_VERSION_CHECK=true +``` diff --git a/lib/gitlab/database.rb b/lib/gitlab/database.rb index 2fd9250b3c2..7bb4a2c67bf 100644 --- a/lib/gitlab/database.rb +++ b/lib/gitlab/database.rb @@ -11,7 +11,7 @@ module Gitlab # https://dev.mysql.com/doc/refman/5.7/en/datetime.html MAX_TIMESTAMP_VALUE = Time.at((1 << 31) - 1).freeze - # Minimum schema version from which migrations are be supported + # Minimum schema version from which migrations are supported # Migrations before this version may have been removed MIN_SCHEMA_VERSION = 20190506135400 MIN_SCHEMA_GITLAB_VERSION = '11.11.0' diff --git a/lib/tasks/migrate/schema_check.rake b/lib/tasks/migrate/schema_check.rake index ea4131d8bc2..76f1f23c7bd 100644 --- a/lib/tasks/migrate/schema_check.rake +++ b/lib/tasks/migrate/schema_check.rake @@ -1,6 +1,6 @@ # frozen_string_literal: true -desc 'Configures the database by running migrate, or by loading the schema and seeding if needed' +# Configures the database by running migrate, or by loading the schema and seeding if needed task schema_version_check: :environment do next if ENV['SKIP_SCHEMA_VERSION_CHECK'] |