Skip to content

Instantly share code, notes, and snippets.

@Ducain
Last active June 13, 2017 09:56
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ducain/edaaf4644d71601f4334 to your computer and use it in GitHub Desktop.
Save Ducain/edaaf4644d71601f4334 to your computer and use it in GitHub Desktop.
Capistrano 3 running Phinx migrations on Windows server
after "deploy:updating", "deploy:phinx_migrations"
namespace :deploy do
task :restart do ; end
desc 'Run Phinx migrations'
task :phinx_migrations do
on roles(:app) do
within release_path do
execute 'php', 'vendor/robmorgan/phinx/bin/phinx', 'migrate', '-e', 'production', raise_on_non_zero_exit: false
end
end
end
end
@Ducain
Copy link
Author

Ducain commented Oct 23, 2014

Adding raise_on_non_zero_exit: false is necessary because the Phinx process exits with no message, and the default behavior in Capistrano is to abort in that case.

@Ducain
Copy link
Author

Ducain commented Oct 23, 2014

Additional info: this is running on a Windows server, and I couldn't execute the 'vendor/bin/phinx' symlink, so I had to execute using the full path to the phinx file.

@MasonM
Copy link

MasonM commented Jan 2, 2015

This is exactly what I was looking for. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment