From 63ac6c50881ecdd7c49b93613dfa4fb0ae55a7ff Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 17 Apr 2020 12:40:54 +1000 Subject: [PATCH] Remove superfluous conditional A migration's `up` method is only run when the migration needs to be applied. The only case we could have a higher version number is when a migration with a higher version got merged before the current one. And in that case, we still want this migration to fail, because it hasn't been applied yet. --- db/migrate/20181128054803_old_migrations_removed.rb | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/db/migrate/20181128054803_old_migrations_removed.rb b/db/migrate/20181128054803_old_migrations_removed.rb index e0ad67a62b..3cd68a2610 100644 --- a/db/migrate/20181128054803_old_migrations_removed.rb +++ b/db/migrate/20181128054803_old_migrations_removed.rb @@ -1,11 +1,8 @@ class OldMigrationsRemoved < ActiveRecord::Migration - LAST_DELETED_MIGRATION = 20181128054803 def up - if ActiveRecord::Migrator.current_version < LAST_DELETED_MIGRATION - message = "You haven't updated your dev environment in a long time! " \ - "Legacy migration files before 2019 have now been removed. " \ - "Run `rails db:schema:load` before running `rails db:migrate`." - raise StandardError, message - end + message = "You haven't updated your dev environment in a long time! " \ + "Legacy migration files before 2019 have now been removed. " \ + "Run `rails db:schema:load` before running `rails db:migrate`." + raise StandardError, message end end