Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

How to migrate database down on rollback? #87

Closed
airblade opened this issue Aug 8, 2017 · 1 comment
Closed

How to migrate database down on rollback? #87

airblade opened this issue Aug 8, 2017 · 1 comment

Comments

@airblade
Copy link

airblade commented Aug 8, 2017

I am setting up git-deploy to use with a Rails app and I'm looking at rollbacks.

The rollback code resets the working tree to before the last push, then executes either deploy/rollback or deploy/after_push.

If I'm rolling back I want to migrate the database down to where it was, probably using rake db:migrate VERSION=x where the script figures out what x is.

However I can't do this in deploy/rollback because the migration files have already been removed by the git reset --hard.

I can't even do this by hand after rolling back, for the same reason.

Any help would be much appreciated!

@airblade
Copy link
Author

airblade commented Aug 8, 2017

I see capistrano-rails doesn't rollback the database. Instead they advise writing backward-compatible migrations which one then cleans up later after a successful deployment.

@airblade airblade closed this as completed Oct 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant