The preferred solution would be to fix torque, so that it produces the
needed sql.  As you say you are not comfortable with this, I guess you
can alter the scripts by hand.

john mcnally

David Wynter wrote:
> 
> Hello,
> 
> I built an application using the TDK2.1 with MySQL as the database. I have a
> number of tables with optional foreign keys. In other words, a table can
> have three different mutually exclusive contexts represented by 3 different
> parent tables. Thus it would have 3 foreign keys defined but with only one
> populated and the other 2 are NULL. This is no problem with MySQL and the
> classes produced by Torque allow this optionality of foreign.
> 
> I have switched to Oracle and it is stricter about foreign keys (i.e. it has
> them!). It would not allow nulls in the 2 foreign keys that were not
> populated. Now Oracle will allow nulls in foreign keys but you have to use a
> constraint directive when they are foreign keys (I think eg. ...CONSTRAINT
> context1 NULL...) and Torque does not support this.
> 
> Before I approach this I thought that the experienced Turbine users might
> give me guidance on approach. I figure I have 3 options:
> 1. Remove the foreign key statements from my project-schema.sql and manage
> these relationships in my Actions, quite alot of work.
> 2. Modify the SQL produced by Torque to include the extra constraint
> statements and run the SQL script independently of Torque. Maybe even
> produce my own independent script with just the alter table bits e.g. "ALTER
> TABLE blah ADD (fk1_column NUMBER(20) CONSTRAINT NULL, fk2_column NUMBER(20)
> CONSTRAINT NULL, fk3_column NUMBER(20) CONSTRAINT NULL)"
> 3. Alter the database.dtd to support the extra clause required and alter
> Torque to produce the extra SQL, (not really considering this as it requires
> more knowledge than I have).
> 
> Please let me know if my logic is flawed here. 2 is my preferred option as
> it means I do not have to change my actions code.
> 
> Thanks
> 
> David
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to