-
Notifications
You must be signed in to change notification settings - Fork 492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why does rails:db_migrate run on the previous release? #300
Comments
if you are running the default deploy.rb script that mina generates, db_migrate is run in default scope task :deploy => :environment do
deploy do
...
invoke :'rails:db_migrate'
...
end
end this will end up in command(:default) array. If you then take a look at <% prepare = commands(:default).map { |s| "(\n\n#{indent 2, s}\n\n)" }.join(" && ") %>
...
(
echo "-----> Creating a temporary build path"
<%= echo_cmd %[touch "#{lock_file}"] %> &&
<%= echo_cmd %[mkdir -p "$build_path"] %> &&
<%= echo_cmd %[cd "$build_path"] %> &&
(
<%= indent 4, (prepare.empty? ? "true" : prepare) %>
)
) && |
That's what I thought, but look at this line in the https://github.com/mina-deploy/mina/blob/master/lib/mina/rails.rb#L72 file:
Doesn't that specifically make the commands run on the current path, i.e., the previous release? |
That lambda is not used inside tasks which are used for db_migrate or other which are invoked in deploy script. This one is used in deploy script: |
Ah, confusing but I'm beginning to understand. Still, say I want to run my own commands inside the build_path? I haven't found a way of doing that yet :( |
Just queue/invoke them among others in task :deploy => :environment do
deploy do
...
queue "command my_something"
invoke :'rails:db_migrate'
...
end
end |
That was what I tried. I will test this further, maybe it's a difference between invoking a task and using queue directly. |
I'm not sure what I was doing wrong before, but it seems you're 100% right. Sorry for the time waster! |
Forgive me if I'm missing something obvious (though I think not, I've been reading the docs and source), but why does
rails:db_migrate
run on thecurrent
directory before linking to the new version?Shouldn't there be a
release_path
property where it should be run?The text was updated successfully, but these errors were encountered: