diff options
author | DJ Mountney <david@twkie.net> | 2019-06-20 17:56:46 +0300 |
---|---|---|
committer | DJ Mountney <david@twkie.net> | 2019-06-25 20:44:40 +0300 |
commit | f4e15535198da1d5a655b6abe0afafac47219ab5 (patch) | |
tree | 11c0a29db654aae83d98de903e110f8040c5a3c4 /lib/tasks/migrate | |
parent | 7a089438fa138934b5dab7bdd575a74a1dfd03c0 (diff) |
Move min schema version check to db:migrate
Rather than have it checked only as part of gitlab:db:configure, we will
instead have it as a pre-req for every db:migrate command
Diffstat (limited to 'lib/tasks/migrate')
-rw-r--r-- | lib/tasks/migrate/schema_check.rake | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/tasks/migrate/schema_check.rake b/lib/tasks/migrate/schema_check.rake new file mode 100644 index 00000000000..1f2ed2f439c --- /dev/null +++ b/lib/tasks/migrate/schema_check.rake @@ -0,0 +1,11 @@ +desc 'Configures the database by running migrate, or by loading the schema and seeding if needed' +task schema_version_check: :environment do + if ActiveRecord::Migrator.current_version < Gitlab::Database::MIN_SCHEMA_VERSION + raise "Your current database version is too old to be migrated. " \ + "You should upgrade to GitLab #{Gitlab::Database::MIN_SCHEMA_GITLAB_VERSION} before moving to this version. " \ + "Please see https://docs.gitlab.com/ee/policy/maintenance.html#upgrade-recommendations" + end +end + +# Ensure the check is a pre-requisite when running db:migrate +Rake::Task["db:migrate"].enhance [:schema_version_check] |