464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
|
# File 'lib/migr8.rb', line 464
def upgrade(n)
migs_hist, migs_dict = _get_migrations_hist_and_applied()
curr = migs_hist.rindex {|mig| mig.applied? }
if curr
j = migs_hist.index {|mig| ! mig.applied? }
raise MigrationError.new("apply #{migs_hist[j].version} at first.") if j && j < curr
end
migs_unapplied = curr ? migs_hist[(curr+1)..-1] : migs_hist
migs_to_apply = n.nil? ? migs_unapplied : migs_unapplied[0...n]
if migs_to_apply.empty?
puts "## (nothing to apply)"
else
@repo.apply_migrations(migs_to_apply)
end
end
|