ignore extra args when test env

This commit is contained in:
Seth Call 2021-03-24 20:18:18 -05:00
parent 1f862baccf
commit dcbf52a88b
1 changed files with 7 additions and 4 deletions

View File

@ -17,11 +17,14 @@ namespace :db do
desc "Migrate the database"
task :migrate do
version = ARGV[1]
if !version.nil?
version = version.to_i
version = nil
if ENV['RAILS_ENV'] != "test"
version = ARGV[1]
if !version.nil?
version = version.to_i
end
end
ActiveRecord::Base.establish_connection(db_config)
migrate_dir = JamRuby::RakeUtil.migrations_path
ActiveRecord::Migrator.migrate(migrate_dir, version)