Hi! I'm trying to use the sqlobject-admin command to track the evolution
of my database schema but I couldn't find the right way to use it.
I couldn't find any documentation on the subject, except for the brief
description when using sqlobject-admin help record/upgrade or in the
sqlobject-admin command web documentation, but they are not enough.
As I understand the steps to use this is:
1) Create a project using sqlobject. For example (model.py):
from sqlobject import *
from os.path import dirname, realpath
__connection__ = 'sqlite://%s/db' % dirname(realpath(__file__))
class Person(SQLObject):
name = UnicodeCol()
2) Create the database:
PYTHONPATH=. sqlobject-admin --module=model create
3) Record the database version:
PYTHONPATH=. sqlobject-admin --module=model \
--output-dir=sqlobject-history record
4) Edit model.py to add a column age = IntCol() to Person
5) Record the new version of the database schema:
PYTHONPATH=. sqlobject-admin --module=model \
--output-dir=sqlobject-history record --edit
(sqlobject-history/2007-08-21/upgrade_sqlite_2007-08-21a.sql is filled
with 'ALTER TABLE person ADD COLUMN age INT;' in the editor)
6) Upgrade the database:
PYTHONPATH=. sqlobject-admin --connection=sqlite://$PWD/db \
--output-dir=sqlobject-history upgrade
But this last step says "Database up to date" because step 5) added a row
to sqlobject_db_version table which says version='2007-08-21a'. If I
manually change version to '2007-08-21' in the database, the 'upgrade'
command works fine.
The 'record' command has a switch to avoid updating the version row
(--no-db-record), but when I use it the status presented in the editor
when making the record --edit is empty, so it's a little annoying.
This is not the way to use this record/upgrade stuff or I'm hitting a bug?
Is there any other documentation/examples on this?
TIA.
--
LUCA - Leandro Lucarella - Usando Debian GNU/Linux Sid - GNU Generation
------------------------------------------------------------------------
E-Mail / JID: [EMAIL PROTECTED]
GPG Fingerprint: D9E1 4545 0F4B 7928 E82C 375D 4B02 0FE0 B08B 4FB2
GPG Key: gpg --keyserver pks.lugmen.org.ar --recv-keys B08B4FB2
------------------------------------------------------------------------
El poco sol que entra, me deja ciego
Pero ni siquiera entibia mis baldozas frías
Aquí donde todo es frío y casi muerto
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss