hello group,

i have here something that looks like an error.

innodb as mysql storage engine is quite picky about the table
definitions when it comes to create foreign keys.

lets say we have
==================================
ClassA (SQLObject):
  name = StringCol()

ClassB (SQLObecjt):
  name = StringCol()
  classA = ForeignKey("ClassA")
==================================

this works when mysqld is configured to use MyISAM, but when there is
InnoDB as engine, this won´t work because tg-admin sql sql outputs

==================================
CREATE TABLE class_a (
    id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
    name VARCHAR(xyz)
);

CREATE TABLE class_b (
    id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
    name VARCHAR(xyz),
    class_a int
);

ALTER TABLE class_a ADD CONSTRAINT class_b_class_a_id_exists FOREIGN
KEY (class_a_id) REFERENCES class_a (id);
==================================

But InnoDB requires the column class_b.class_a to be of the type INT
UNSIGNED just like class_a.id which it references.


i found no way to manually specify this with the SQLObject syntax...
is it an SQLObject issue or an MySQLdb issue?

I just want to save anybody´s time, who is trying to do the same - it
just did cost me 2 days of figuring out :-(

Regards, Frank
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to