Skip to main content

Posts

Showing posts from July, 2008

SQLAlchemy-Migrate for dummies

I'm gave sqlalchemy-migrate a try today. I like it, and I'm going to keep using it. The one downside is that it's a bit hard to find "the least you need to know" in the documentation, especially if you lean old-school like me and prefer to write your upgrade scripts in raw sql. So here's my stab at it. Create a "repository" for upgrade scripts: migrate create path/to/upgradescripts "comment" Create your manage script. If you have development/production dbs with different connection urls, create two scripts with the same repository but different urls: migrate manage dbmanage.py --repository=path/to/upgradescripts --url=db-connection-url For each database, create the Migrate metadata (a migrate_version table): ./dbmanage.py version_control Create an upgrade script. This will create a script [next version number]-[database type]-upgrade.sql in the "versions" subdirectory of your "repository." That's a