db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luigi <nad...@iol.it>
Subject modifying a template for mysql
Date Tue, 17 Jun 2003 13:21:59 GMT
Hi,

Since I am currently using mysql with innodb tables for my project and I 
have foreign keys with 'on update' and 'on delete' constraints. I have 
modified the templates/sql/base/mysql/foreignkey.vm file from:

-----------
#foreach ($fk in $table.ForeignKeys)
     FOREIGN KEY ($fk.LocalColumnNames) REFERENCES $fk.ForeignTableName 
($fk.ForeignColumnNames),
#end
-----------

to:

-----------
#foreach ($fk in $table.ForeignKeys)
     FOREIGN KEY ($fk.LocalColumnNames) REFERENCES $fk.ForeignTableName 
($fk.ForeignColumnNames)
#if ($fk.hasOnUpdate())
     ON UPDATE $fk.OnUpdate
#end
#if ($fk.hasOnDelete())
     ON DELETE $fk.OnDelete
#end
,
#end
-----------

This should be compatible with both innodb and myisam tables and with 
4.0.x and 3.23.5x versions of mysql (the unsupported options are simply 
ignored by the db).
In my (few, for the time being) tests it works. Can anyone please tell 
me if there is some kind of problem in his/her opinion I am overlooking 
(this is the first time I use torque, hope the question is not too stupid)?
Thanks a lot
Luigi



Mime
View raw message