Skip to content

Commit

Permalink
Allow usage of long doctrine migrations names
Browse files Browse the repository at this point in the history
Add support for doctrine migration names that contain a timestamp + a description.

Ex : "20140409203042 Create User entity"
  • Loading branch information
rolebi committed Feb 11, 2015
1 parent 72742d2 commit f68216d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/symfony2/doctrine.rb
Expand Up @@ -105,7 +105,7 @@
task :migrate, :roles => :app, :only => { :primary => true }, :except => { :no_release => true } do
currentVersion = nil
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} --no-ansi doctrine:migrations:status #{console_options}#{doctrine_em_flag}'", :once => true do |ch, stream, out|
if stream == :out and out =~ /Current Version:.+\(([\w]+)\)/
if stream == :out and out =~ /Current Version:.+\(([^\)]+)\)/
currentVersion = Regexp.last_match(1)
end
if stream == :out and out =~ /Current Version:\s*0\s*$/
Expand All @@ -119,8 +119,8 @@
logger.info " Current database version: #{currentVersion}"

on_rollback {
if !interactive_mode || Capistrano::CLI.ui.agree("Do you really want to migrate #{symfony_env_prod}'s database back to version #{currentVersion}? (y/N)")
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:migrate #{currentVersion} #{console_options} --no-interaction#{doctrine_em_flag}'", :once => true
if !interactive_mode || Capistrano::CLI.ui.agree("Do you really want to migrate #{symfony_env_prod}'s database back to version \"#{currentVersion}\"? (y/N)")
run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:migrations:migrate \"#{currentVersion}\" #{console_options} --no-interaction#{doctrine_em_flag}'", :once => true
end
}

Expand Down

0 comments on commit f68216d

Please sign in to comment.