Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed symfony:doctrine:schema:drop - added --force #319

Merged
merged 3 commits into from

2 participants

@viliam-husar

Task symfony:doctrine:schema:drop never actually droped schema because of missing --force parameter.

viliam-husar added some commits
@viliam-husar viliam-husar Fixed symfony:doctrine:schema:drop - added --force
Task symfony:doctrine:schema:drop never actually droped schema because of missing --force parameter.
67eba74
@viliam-husar viliam-husar Added confirmation to doctrine drops tasks
Fixed symfony:doctrine:database:drop (missed --force argument too).
Added confirmation for symfony:doctrine:database:drop and 
symfony:doctrine:schema:drop.
478f639
@viliam-husar

I understand your concern, so I added a confirmation you suggested. There was same issue with symfony:doctrine:database:drop task. I changed that too.

@willdurand
Collaborator

What about adding a few examples to the test suite?

@willdurand willdurand merged commit c878e14 into from
@willdurand
Collaborator

Great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 17, 2013
  1. @viliam-husar

    Fixed symfony:doctrine:schema:drop - added --force

    viliam-husar authored
    Task symfony:doctrine:schema:drop never actually droped schema because of missing --force parameter.
  2. @viliam-husar

    Added confirmation to doctrine drops tasks

    viliam-husar authored
    Fixed symfony:doctrine:database:drop (missed --force argument too).
    Added confirmation for symfony:doctrine:database:drop and 
    symfony:doctrine:schema:drop.
Commits on Jan 18, 2013
  1. Updated specs for doctrine drop tasks

    solzenic authored
This page is out of date. Refresh to see the latest.
View
29 lib/symfony2/doctrine.rb
@@ -27,19 +27,22 @@
end
namespace :database do
- [:create, :drop].each do |action|
- desc "#{action.to_s.capitalize}s the configured databases"
- task action, :roles => :app, :except => { :no_release => true } do
- case action.to_s
- when "create"
- capifony_pretty_print "--> Creating databases"
- when "drop"
- capifony_pretty_print "--> Dropping databases"
- end
+ desc "Drops the configured databases"
+ task :drop, :roles => :app, :except => { :no_release => true } do
+ capifony_pretty_print "--> Dropping databases"
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:database:#{action.to_s} --env=#{symfony_env_prod}'", :once => true
- capifony_puts_ok
+ if !interactive_mode || Capistrano::CLI.ui.agree("Do you really want to drop #{symfony_env_prod}'s database? (y/N)")
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:database:drop --force --env=#{symfony_env_prod}'", :once => true
end
+ capifony_puts_ok
+ end
+
+ desc "Creates the configured databases"
+ task :create, :roles => :app, :except => { :no_release => true } do
+ capifony_pretty_print "--> Creating databases"
+
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:database:create --env=#{symfony_env_prod}'", :once => true
+ capifony_puts_ok
end
end
@@ -56,7 +59,9 @@
task :drop, :roles => :app, :except => { :no_release => true } do
capifony_pretty_print "--> Droping schema"
- run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:drop --env=#{symfony_env_prod}'", :once => true
+ if !interactive_mode || Capistrano::CLI.ui.agree("Do you really want to drop #{symfony_env_prod}'s database schema? (y/N)")
+ run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} doctrine:schema:drop --force --env=#{symfony_env_prod}'", :once => true
+ end
capifony_puts_ok
end
View
6 spec/capifony_symfony2_doctrine_spec.rb
@@ -12,6 +12,8 @@
@configuration.set :try_sudo, ''
Capifony::Symfony2.load_into(@configuration)
+
+ @configuration.set :interactive_mode, false
end
subject { @configuration }
@@ -64,7 +66,7 @@
@configuration.find_and_execute_task('symfony:doctrine:database:drop')
end
- it { should have_run(' sh -c \'cd /var/www/releases/20120927 && php app/console doctrine:database:drop --env=prod\'') }
+ it { should have_run(' sh -c \'cd /var/www/releases/20120927 && php app/console doctrine:database:drop --force --env=prod\'') }
end
it "defines symfony:doctrine:schema tasks" do
@@ -86,7 +88,7 @@
@configuration.find_and_execute_task('symfony:doctrine:schema:drop')
end
- it { should have_run(' sh -c \'cd /var/www/releases/20120927 && php app/console doctrine:schema:drop --env=prod\'') }
+ it { should have_run(' sh -c \'cd /var/www/releases/20120927 && php app/console doctrine:schema:drop --force --env=prod\'') }
end
context "when running symfony:doctrine:schema:update" do
View
1  spec/spec_helper.rb
@@ -5,6 +5,7 @@
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'capistrano-spec'
+require 'capistrano/cli'
require 'rspec'
require 'rspec/autorun'
Something went wrong with that request. Please try again.