Patches item #1458380, was opened at 2006-03-25 19:08
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1458380&group_id=74338
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Dennis Brakhane (dennis)
Assigned to: Nobody/Anonymous (nobody)
Summary: Let admin create tables with no foreign keys first
Initial Comment:
Suppose I have the following model:
class A(SQLObject):
foo = StringCol()
b = ForeignKey("B")
class B(SQLObject):
bar = StringCol()
If I now let sqlobject-admin create the tables for me,
the order in with these are created is not defined.
If table A is created before table B, PostgreSQL will fail:
CREATE TABLE a (
id SERIAL PRIMARY KEY,
foo TEXT,
b_id INT, CONSTRAINT b_id_exists FOREIGN KEY (b_id)
REFERENCES b (id)
)
Fails with "Relation >b< does not exist"
So, I've patched manager/command.py to create tables in
the order of classes with fewest foreign keys created
first.
This might not catch all cases, but it "works for me(TM)"
Patch is attached
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1458380&group_id=74338
|