Skip to content
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

Rails migration failing using remote command #56

Open
thelinuxlich opened this issue Apr 28, 2014 · 6 comments
Open

Rails migration failing using remote command #56

thelinuxlich opened this issue Apr 28, 2014 · 6 comments

Comments

@thelinuxlich
Copy link

I run bundle install, assets:precompile and db:migrate using the .remote.sh feature, but mgirate always fails, it tries to rerun migrations and throws "IrreversibleMigration" exception, leaving the production schema inconsistent. If I run this command inside the machine, it runs correctly.

@arnoo
Copy link
Owner

arnoo commented Apr 28, 2014

You might want to check that the environment variables are the same in both
cases.

If you are using the run_remote function, it might also be an escaping
problem.

On Mon, Apr 28, 2014 at 9:50 PM, Alisson Cavalcante Agiani <
[email protected]> wrote:

I run bundle install, assets:precompile and db:migrate using the
.remote.sh feature, but mgirate always fails, it tries to rerun migrations
and throws "IrreversibleMigration" exception, leaving the production schema
inconsistent. If I run this command inside the machine, it runs correctly.


Reply to this email directly or view it on GitHubhttps://github.com//issues/56
.

@thelinuxlich
Copy link
Author

I'm running the commands inside a script.remote.sh using RAILS_ENV=production rake db:migrate

Why it could be an escaping problem?

@arnoo
Copy link
Owner

arnoo commented Apr 28, 2014

inside a .remote.sh script it can't be an escaping problem

I'd try looking at the output of "env" to compare it in both
environments... maybe by adding something like this to your migration
script :

env > /tmp/env.log

On Mon, Apr 28, 2014 at 10:20 PM, Alisson Cavalcante Agiani <
[email protected]> wrote:

I'm running the commands inside a script.remote.sh using
RAILS_ENV=production rake db:migrate

Why it could be an escaping problem?


Reply to this email directly or view it on GitHubhttps://github.com//issues/56#issuecomment-41608143
.

@thelinuxlich
Copy link
Author

I did it, tried using export RAILS_ENV=production in the beginning...it is crazy because rake db:migrate running with git-deliver is reverting the migrations!

@thelinuxlich
Copy link
Author

Found out the problem: git-deliver sets a VERSION variable, which rake db:migrate thinks it is the version it needs to run against, thus reverting...the solution is to run unset VERSION before it.

@arnoo
Copy link
Owner

arnoo commented Apr 29, 2014

Wow, that's confusing indeed ! Maybe I should to prefix all git-deliver
environment variables to avoid this kind of conflict.

On Mon, Apr 28, 2014 at 11:34 PM, Alisson Cavalcante Agiani <
[email protected]> wrote:

Found out the problem: git-deliver sets a VERSION variable, which rake
db:migrate thinks it is the version it needs to run against, thus
reverting...the solution is to run unset VERSION before it.


Reply to this email directly or view it on GitHubhttps://github.com//issues/56#issuecomment-41616639
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants