views:

121

answers:

1

I have database migrations (with sqlalchemy-migrate) working well in my dev environment. However, I'm a little stumped about how to integrate this into my deployment process.

I'd like to use fabric to execute the manage.py file on the remote server but I'm not sure what to use for the repository value in this file. Referring to both 'appname/migrations' and '/usr/local/pylons/appname/env/lib/python2.6/site-packages/appname-05.egg/appname/migrations/' both fail with a migrate.versioning.exceptions.InvalidRepositoryError

Does anyone have a fabfile and manage.py that plays nicely with sqlalchemy-migrate?

+2  A: 

What I did was to generate a manage.py file per the sqlalchemy-migrations docs. In there I hacked it up to load our config information which includes the db auth info. In our case it's a Pylons app so it reads the proper Pylons config.ini file.

http://packages.python.org/sqlalchemy-migrate/versioning.html#project-management-script

Then the fabric commands all interact with the manage.py file vs using the Python API directly. Since everything, from the SA-Migrate manage.py through the app itself I don't run into any sort of path issues like you mention.

Not sure this is a 'exact' fix but maybe helps.

Rick
Great- I like this approach as it's very straight forward to script the manage.py with fabric. But what do you set for the 'repository' value in the manage.py file? Referring to 'appname/migrations' or '/usr/local/pylons/appname/env/lib/python2.6/site-packages/appname-05.egg/appname/migrations/' both fail with an migrate.versioning.exceptions.InvalidRepositoryError
Chris Reid
I set the migrations inside my app and since my app is in the path I can set the repository to appname/migrations.
Rick