[SQLObject] sqlobject-admin == ruby-on-rails migrations?
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Christian W. <cw...@tu...> - 2009-02-19 11:25:50
|
Hi all, in the past I've worked on some projects using ruby-on-rails. I found the "migrations" framework very useful, that allows to semi-automatically keep track of an evolving database scheme. In particular, I am facing the following problem. I have a class definition, which also defines my database scheme. By now I have already generated a number of datasets which populate latter database. The problem now is that I need additional fields in my database. I see two obvious solutions to this: 1) drop and recreate database with new scheme 2) manually alter my tables according to my class definitions 1) is not an option, and I would like to avoid going with 2) every time I need to add a column. As mentioned before, ruby-on-rails provides some tools to update a database scheme semi-automatically, once the corresponding class definition has been changed. A google search pointed me to a tool called sqlobject-admin, which seems to be able to do something similar. However, from the documentation (http://www.sqlobject.org/sqlobject-admin.html), it was not obvious to me how to achieve this. "sqlobject-admin upgrade -h" says: This command runs scripts (that you write by hand) to upgrade a database.... Does this mean, that I end up having to manually update the table definition AND the class definition each time? Is there no way to create a "diff" between the class defined in python and the current database scheme automatically? Help would be appreciated, Chris |