Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Version 1 (modified by jorge.vargas, 11 years ago) (diff)



Where you one of those people that luv the .sql file and luv to drop everything and recreate it? do you need to provide resonable defaults with your instalation? do you want to kill yourself after exiting tg-admin shell and forgot to run hub.commit?

then this is what you need.

The Script

The link refers to the actual code kevin but in, which is the base for mine (the one I had before was so ugly that doesn't deserve to live) Eventually I'll integrate this as a feature to tg-admin so that's why I have it there. although I could't figure out how to call that code without the testcase being executed.

import turbogears
import sqlobject
from sqlobject.inheritance import InheritableSQLObject
import inspect

#maybe use

#~ delete old model and create it again.
for item in turbogears.util.get_model().__dict__.values(): 
    if inspect.isclass(item) and issubclass(item,sqlobject.SQLObject) and \
    item != sqlobject.SQLObject and item != InheritableSQLObject: 

#ALWAYS commit at the end

how to run it

tg-admin shell <