JimHagan / wwwsqldesigner

Automatically exported from code.google.com/p/wwwsqldesigner
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

SQL Generate how to change outputing #161

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Very amazing this webapp !! really a great job man !

Would like to know if possible to change the clientSql for ouputing a 
constraint naming with foreign key as:

"Alter table_name add constraint 'fkey_name' foreign key ... "

i try modifie the file mysql/output.xsl but nothing append, also i have not 
enough xml practice ! is it possible to do ? that will increase more practical 
code for remove constraint key..

thanks, btw

My config: W7 wwwsqlDesigner_2.6

Original issue reported on code.google.com by francisg...@yahoo.fr on 26 Jun 2012 at 11:41

GoogleCodeExporter commented 9 years ago
What is the correct grammar you propose?

The currently generated SQL is this:

ALTER TABLE `t1` ADD FOREIGN KEY (k1) REFERENCES `t2` (`k2`);

Original comment by ondrej.zara on 26 Jun 2012 at 12:05

GoogleCodeExporter commented 9 years ago
I propose like this:

ALTER TABLE `tble_name` ADD CONSTRAINT `constraint_name` FOREIGN KEY (id_chap) 
REFERENCES `ref_tble_name` (`id_chap`);

I run with and it's correct but maybe difficult to implement, also that put by 
default :
ON DELETE and ON UPDATE to RESTRICT. 

I think better to force the ON UPDATE to CASCADE by script output if you don't 
think to implement it in the webapp.

So this also occur a better handled for constraint but need that customer gave 
the key name field for work !!

may be a field empty condition is possible to put toggle syntax ?

Original comment by francisg...@yahoo.fr on 26 Jun 2012 at 4:39