Permalink
Switch branches/tags
production_RELEASE_RELEASE_CANDIDATE_STABLE_34 production_RELEASE_RELEASE_CANDIDATE_STABLE_32 production_RELEASE_RELEASE_CANDIDATE_STABLE_31 production_RELEASE_RELEASE_CANDIDATE_STABLE_30 production_RELEASE_RELEASE_CANDIDATE_STABLE_28 production_RELEASE_RELEASE_CANDIDATE_STABLE_27 production_RELEASE_RELEASE_CANDIDATE_STABLE_26 production_RELEASE_RELEASE_CANDIDATE_STABLE_25 production_RELEASE_RELEASE_CANDIDATE_STABLE_24 production_RELEASE_RELEASE_CANDIDATE_STABLE_23 production_RELEASE_RELEASE_CANDIDATE_STABLE_22 production_RELEASE_RELEASE_CANDIDATE_STABLE_21 production_RELEASE_RELEASE_CANDIDATE_STABLE_20 production_RELEASE_RELEASE_CANDIDATE_STABLE_19 production_RELEASE_RELEASE_CANDIDATE_STABLE_18 production_RELEASE_RELEASE_CANDIDATE_STABLE_17 production_RELEASE_RELEASE_CANDIDATE_STABLE_16 production_RELEASE_RELEASE_CANDIDATE_STABLE_15 production_RELEASE_RELEASE_CANDIDATE_STABLE_14 production_RELEASE_RELEASE_CANDIDATE_STABLE_13 production_RELEASE_RELEASE_CANDIDATE_STABLE_12 production_RELEASE_RELEASE_CANDIDATE_STABLE_11 production_RELEASE_RELEASE_CANDIDATE_STABLE_10 production_RELEASE_RELEASE_CANDIDATE_STABLE_8 production_RELEASE_RELEASE_CANDIDATE_STABLE_6 production_RELEASE_RELEASE_CANDIDATE_STABLE_5 production_RELEASE_RELEASE_CANDIDATE_STABLE_2 production_RELEASE_RELEASE_CANDIDATE_BETA_1 production_RELEASE_DEV_597 production_RELEASE_DEV_596 production_RELEASE_DEV_595 production_RELEASE_DEV_594 production_RELEASE_DEV_593 production_RELEASE_DEV_592 production_RELEASE_DEV_591 production_RELEASE_DEV_590 production_RELEASE_DEV_589 production_RELEASE_DEV_588 production_RELEASE_DEV_587 production_RELEASE_DEV_586 production_RELEASE_DEV_585 production_RELEASE_DEV_584 production_RELEASE_DEV_583 production_RELEASE_DEV_582 production_RELEASE_DEV_581 production_RELEASE_DEV_580 production_RELEASE_DEV_579 production_RELEASE_DEV_578 production_RELEASE_DEV_577 production_RELEASE_DEV_576 production_RELEASE_DEV_575 production_RELEASE_DEV_574 production_RELEASE_DEV_573 production_RELEASE_DEV_572 production_RELEASE_DEV_571 production_RELEASE_DEV_570 production_RELEASE_DEV_569 production_RELEASE_DEV_568 production_RELEASE_DEV_567 production_RELEASE_DEV_566 production_RELEASE_DEV_565 production_RELEASE_DEV_564 production_RELEASE_DEV_563 production_RELEASE_DEV_562 production_RELEASE_DEV_561 production_RELEASE_DEV_560 production_RELEASE_DEV_559 production_RELEASE_DEV_558 production_RELEASE_DEV_557 production_RELEASE_DEV_556 production_RELEASE_DEV_555 production_RELEASE_DEV_554 production_RELEASE_DEV_553 production_RELEASE_DEV_552 production_RELEASE_DEV_551 production_RELEASE_DEV_550 production_RELEASE_DEV_549 production_RELEASE_DEV_548 production_RELEASE_DEV_547 production_RELEASE_DEV_546 production_RELEASE_DEV_545 production_RELEASE_DEV_544 production_RELEASE_DEV_543 production_RELEASE_DEV_542 production_RELEASE_DEV_541 production_RELEASE_DEV_540 production_RELEASE_DEV_539 production_RELEASE_DEV_538 production_RELEASE_DEV_537 production_RELEASE_DEV_536 production_RELEASE_DEV_535 production_RELEASE_DEV_534 production_RELEASE_DEV_533 production_RELEASE_DEV_532 production_RELEASE_DEV_531 production_RELEASE_DEV_530 production_RELEASE_DEV_529 production_RELEASE_DEV_528 production_RELEASE_DEV_527 production_RELEASE_DEV_526
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (28 sloc) 1.03 KB
dep 'migrated db' do
requires 'deployed app', 'existing db', 'db gem'
setup {
if (db_config = yaml(var(:rails_root) / 'config/database.yml')[var(:rails_env)]).nil?
log_error "There's no database.yml entry for the #{var(:rails_env)} environment."
else
set :db_name, db_config['database']
end
}
met? {
current_version = bundle_rake("db:version") {|shell| shell.stdout.val_for('Current version') }
latest_version = Dir[
var(:rails_root) / 'db/migrate/*.rb'
].map {|f| File.basename f }.push('0').sort.last.split('_', 2).first
(current_version.gsub(/^0+/, '') == latest_version.gsub(/^0+/, '')).tap {|result|
unless current_version.blank?
if latest_version == '0'
log_verbose "This app doesn't have any migrations yet."
elsif result
log_ok "DB is up to date at migration #{current_version}"
else
log "DB needs migrating from #{current_version} to #{latest_version}"
end
end
}
}
meet { bundle_rake "db:migrate --trace" }
end