Bug #39902 making "synchronize" more friendly
Submitted: 7 Oct 2008 8:57 Modified: 19 Mar 2009 12:14
Reporter: lorenzo lucioni Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Workbench Severity:S4 (Feature request)
Version:5.0.22 OS:Any
Assigned to: CPU Architecture:Any

[7 Oct 2008 8:57] lorenzo lucioni
Description:
Hi,
during last few days I used Synchronize many time and now I'd like to explain what, in my opinion, could be very useful.

I like to get full control to naming convention (foreign keys and indexes, in particular) but "default Values and Formats/templates for default object names" seems to be not enough.
For instance, Workbench generates:

ALTER TABLE `ASSET`.`rel_device_ticket` 
  ADD CONSTRAINT `fk_rel_device_ticket_id`
  FOREIGN KEY (`id_device` )
  REFERENCES `ASSET`.`device` (`id` )
  ON DELETE RESTRICT
  ON UPDATE CASCADE
, ADD INDEX fk_rel_device_ticket_id (`id_device` ASC) ;

where:
2nd line: "_id" is "_<referenced_column>"
last line: "fk_" is quite strange prefix for an index, in my experience
last line: "_id" is "_<referenced_column>"

I'd like to have it in this format:

ALTER TABLE `ASSET`.`rel_device_ticket` 
  ADD CONSTRAINT `fk_rel_device_ticket_id_device`
  FOREIGN KEY (`id_device` )
  REFERENCES `ASSET`.`device` (`id` )
  ON DELETE RESTRICT
  ON UPDATE CASCADE
, ADD INDEX idx_rel_device_ticket_id_device (`id_device` ASC) ;

where:
2nd line: "_id_device" is "_<referencing_column>"
last line: "idx_" is a better prefix
last line: "_id_device" is "_<referenced_column>"

recapitulating, my suggestion can be "templatized" in this way:

ALTER TABLE `ASSET`.`rel_device_ticket` 
  ADD CONSTRAINT `fk_<source_table_name>_<source_column_name>`
  FOREIGN KEY (`id_device` )
  REFERENCES `ASSET`.`device` (`id` )
  ON DELETE RESTRICT
  ON UPDATE CASCADE
, ADD INDEX idx_<source_table_name>_<source_column_name> (`id_device` ASC) ;

At this moment (version 5.0.22) workbench naming convention and naming templates does not permit to customize as above.

How to repeat:
just create a foreign relationship
[23 Oct 2008 7:37] Valeriy Kravchuk
Thank you for a reasonable feature request.
[19 Mar 2009 12:14] Susanne Ebrecht
Many thanks for writing a feature request. After discussion we decided that we won't implement it.