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