summaryrefslogtreecommitdiff
path: root/lib/tasks/gitlab/db.rake
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tasks/gitlab/db.rake')
-rw-r--r--lib/tasks/gitlab/db.rake4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/tasks/gitlab/db.rake b/lib/tasks/gitlab/db.rake
index 4e7a8adbef6..3a371de5bb7 100644
--- a/lib/tasks/gitlab/db.rake
+++ b/lib/tasks/gitlab/db.rake
@@ -53,6 +53,10 @@ namespace :gitlab do
# Check if we have existing db tables
# The schema_migrations table will still exist if drop_tables was called
if ActiveRecord::Base.connection.tables.count > 1
+ if ActiveRecord::Migrator.current_version < Gitlab::Database::MIN_SCHEMA_VERSION
+ raise "Your current database version is too old to be migrated. Please see https://docs.gitlab.com/ee/policy/maintenance.html#upgrade-recommendations"
+ end
+
Rake::Task['db:migrate'].invoke
else
# Add post-migrate paths to ensure we mark all migrations as up