Hi,
I'm using PostgreSql 8.1, and I have two classes below:
class Department(SqlObject):
attr1 = StringCol(...)
...
chief = ForeignKey('Employee')
class Employee(SqlObject):
attr2 = StringCol(...)
...
department = ForeignKey('Department')
I know because they are referred by each other, I can't create them in any
order.
So I modify the Department class like this:
class Department(SqlObject):
attr1 = StringCol(...)
...
Now I think I can create the two classes and add new column to the
Department class:
Department.createTable()
Employee.createTable()
Department.sqlmeta.addColumn(ForeignKey('Employee',notNone=True),changeSchema=True)
But there is an error in the sql command:
ALTER TABLE department ADD COLUMN employee_id INT NOT NULL, CONSTRAINT
employee_id_exists FOREIGN KEY (employee_id) REFERENCES employee (id)
Is it a bug or I'm using addColumn in a wrong way? and HOW CAN I GIVE A NAME
TO THE ADDED FOREIGNKEY?
Thanks in advance!
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss