Hi all,
Just read a few threads about the issue of SQLObject trying to create
tables in the wrong order, and the use of soClasses as a workaround.
However, using soClasses has the following problem: "tg-admin sql drop"
still fails, as it tries to drop the tables in the same order they were
created. I think the correct way is to drop the tables in reverse
order.
It may be a small thing, but I find it very annoying, in particular at
the start of a project, when I brainstorm and drop/recreate my model
frequently. So I came up with this simple patch to
sqlobject/manager/command.py that seems to fix the drop problem:
--- command.py 2006-08-04 10:27:35.546875000 +0900
+++ new.py 2006-08-04 10:27:27.703125000 +0900
@@ -583,7 +583,9 @@
v = self.options.verbose
dropped = 0
not_existing = 0
- for soClass in self.classes():
+ soClasses = self.classes()
+ soClasses.reverse()
+ for soClass in soClasses:
exists =
soClass._connection.tableExists(soClass.sqlmeta.table)
if v >= 1:
if exists:
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---