Permalink
Browse files

fixes #030

  • Loading branch information...
1 parent 8b34553 commit 5c6316d63d0b895ef02f1079a56193f50e262054 @everzet committed Jun 14, 2011
Showing with 8 additions and 12 deletions.
  1. +8 −12 lib/symfony2.rb
View
@@ -90,24 +90,20 @@
currentVersion = 0
end
end
-
+
if currentVersion == nil
raise "Could not find current database migration version"
end
- puts "Current database version #{currentVersion}"
-
+ puts "Current database version: #{currentVersion}"
+
on_rollback {
- run "#{php-bin} #{symfony_console} doctrine:migrations:migrate #{currentVersion} --env=#{symfony_env_prod}" do |ch, stream, out|
- if out =~ /Are you sure you wish to continue/
- ch.send_data("y\r\n")
- end
+ if Capistrano::CLI.ui.agree("Do you really want to migrate #{symfony_env_prod}'s database back to version #{currentVersion}? (y/N)")
+ run "#{php-bin} #{symfony_console} doctrine:migrations:migrate #{currentVersion} --env=#{symfony_env_prod} --no-interaction"
end
}
-
- run "#{php-bin} #{symfony_console} doctrine:migrations:migrate --env=#{symfony_env_prod}" do |ch, stream, out|
- if out =~ /Are you sure you wish to continue/
- ch.send_data("y\r\n")
- end
+
+ if Capistrano::CLI.ui.agree("Do you really want to migrate #{symfony_env_prod}'s database? (y/N)")
+ run "#{php-bin} #{symfony_console} doctrine:migrations:migrate --env=#{symfony_env_prod} --no-interaction"
end
end
end

0 comments on commit 5c6316d

Please sign in to comment.