[Nitro] [BUG][nitroproject][og] STI table creation broken

Jonas Pfenniger zimba.tm at gmail.com
Tue Jun 27 10:34:45 EDT 2006


This is a bug in the repo.nitroproject.org repo.

Just run the og/test/og/tc_inheritance.rb test.

There is a weird generated SQL : "CREATE TABLE ogtc_oginheritance_user
(ogtype VARCHAR(30), login text, oid integer AUTO_INCREMENT PRIMARY
KEY, login text, oid integer AUTO_INCREMENT PRIMARY KEY, password );"
(appears if you apply my previous patch and set debug to true in
og/test/og/CONFIG.rb=

I've looked a bit in the code but couldn't sort that out.

There seems to be three problems :

1) The Og::SqlStore#serializable_attributes_for_class doesn't return
unique fields. Thus the two AUTO_INCREMENT fields

2) The password field has no type set. In the test case it's a String.

3) The order of the defined fields is not good, password should be
defined before the primary key.

NOTE : in SqlStore#fields_for_class there is a FIXME not about the new
serializable attributes.

Hope this helps

-- 
Cheers,
  zimbatm

http://zimbatm.oree.ch


More information about the Nitro-general mailing list