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

Handle db migrations on update #9

Closed
dmitryevseev opened this issue Jul 1, 2014 · 1 comment
Closed

Handle db migrations on update #9

dmitryevseev opened this issue Jul 1, 2014 · 1 comment

Comments

@dmitryevseev
Copy link
Member

In the process of project development I often face the need of updating db structure.
E. g. I need to run:

db.groups.update({}, {$rename: {"name": "info"}}, false, true);

How do you usually handle it? Does prudentia have something already?

@TizianoPerrucci
Copy link
Member

Hi @dmitryevseev I've updated the Prudentia examples and as you can see now that the example app box (https://github.com/StarterSquad/prudentia/blob/develop/examples/boxes/app.yml) uses a database component.

This component, beside being based on MySQL (does not really matter for the sake of the example), shows you how to manage in a simple way sql increments. When running the db provisioning the sql increments are transferred to the target machine together with the upgrade.sh script that will keep track of the last increment that was run.

I would not use this in production because you could have multiple nodes and would be better to keep the information of which sql increments have been run into a version table in the db. Moreover would be safer to have an upgrade script as well as a downgrade script for rollbacks.

For instance tools like https://sqlalchemy-migrate.readthedocs.org do already this but probably you are not using python/sql alchemy in your settings right now.

I hope I gave you some idea on how to solve your problem.

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