Forum: Ruby on Rails Capistrano only runs migration against production env?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Wes G. (Guest)
on 2006-05-25 20:44
All,

Just read in the Capistrano manual about the Capistrano "migrate" task.
There it says that:

"By default, all this task does is change to the directory of your
current release (as indicated by the current symlink), and run rake
RAILS_ENV=production migrate. You can specify that it should run against
the latest release (regardless of what the current release is) by
setting the migrate_target variable to :latest before invoking this
task. Likewise, if you want to specify additional environment variables
(beside RAILS_ENV) you can set the migrate_env variable to the
space-delimited list of name=value pairs to use."

Can anyone verify the truth of this statement.

Currently I use Capistrano to deploy to a test environment, so I'd like
to be able to run my migrations against test.

Can you modify the RAILS_ENV that Capistrano is using to do the
migration or not?

I think I will just add the "rake migrate RAILS_ENV=test" command as a
command line to run within my deploy script.  That should work, no?

Thanks,
Wes
Wes G. (Guest)
on 2006-05-25 21:00
OK, I attempted to add a "rake migrate RAILS_ENV=test" command into my
Capistrano deploy as a regular command line, like so:

run "cd #{current_path}; chmod 777 public; rake migrate RAILS_ENV=test;
rake appdoc"

(yes I know the chmod 777 public is scary)

But when I run it appears that when that command gets run I get:

 ** [out :: 192.168.1.102] WARNING: STMT 0x8b31910 was not dropped
before garbage collection.

Anyone ever seen that?

Wes
Wes G. (Guest)
on 2006-05-25 21:04
Wes G. wrote:
> OK, I attempted to add a "rake migrate RAILS_ENV=test" command into my
> Capistrano deploy as a regular command line, like so:
>
> run "cd #{current_path}; chmod 777 public; rake migrate RAILS_ENV=test;
> rake appdoc"
>
> (yes I know the chmod 777 public is scary)
>
> But when I run it appears that when that command gets run I get:
>
>  ** [out :: 192.168.1.102] WARNING: STMT 0x8b31910 was not dropped
> before garbage collection.
>
> Anyone ever seen that?
>
> Wes

Doh!  My migration wasn't checked in so it didn't exist when I ran "rake
migrate"

Looks like it runs correctly, but then I get several of those STMT blah
was not dropped before garbage collection.

I'm guessing that the database resources on the Ruby invocation of
capistrano aren't getting freed correctly or something.

Wes
This topic is locked and can not be replied to.