diff options
Diffstat (limited to 'lib/tasks/migrate/schema_check.rake')
-rw-r--r-- | lib/tasks/migrate/schema_check.rake | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/tasks/migrate/schema_check.rake b/lib/tasks/migrate/schema_check.rake index 76f1f23c7bd..e15304afcff 100644 --- a/lib/tasks/migrate/schema_check.rake +++ b/lib/tasks/migrate/schema_check.rake @@ -6,10 +6,14 @@ task schema_version_check: :environment do schema_version = ActiveRecord::Migrator.current_version + minimum_migration_version = Gitlab::Database.read_minimum_migration_version + + raise 'Unable to find any migration files in db/migrate.' if minimum_migration_version.nil? + # Ensure migrations are being run from a supported schema version # A schema verison of 0 is a fresh db, and should be safe to run migrations # But a database with existing migrations less than our min version is not - if schema_version > 0 && schema_version < Gitlab::Database::MIN_SCHEMA_VERSION + if schema_version > 0 && schema_version < minimum_migration_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" |