3

Is it possible to set table prefix in MySQL workbench? For example: I have created complete schema(table_1, table_2, table_3, ... table_N), and want to ask Workbench to add prefix to each table inside this schema on executing Forward Engineering. Want to see in SQL script something like that

CREATE TABLE IF NOT EXISTS `mydb`.`myprefix_table_1`...
LINKeRxUA
  • 559
  • 6
  • 26
  • you can execute the forward engineering. save the script as file and modify the script with find & replace pattern? – Krish Nov 12 '14 at 14:23
  • @krishKM, this is kludge, not a solution... Hope somebody know how to configure Workbench – LINKeRxUA Nov 12 '14 at 15:12

1 Answers1

7

Having your model or EER open, select Tools --> Catalog --> "Give a Prefix to All Tables in Catalog" from the menu.

George
  • 310
  • 1
  • 9
  • thanks! Can you also tell me how to remove database name from SQL Script? i have found [this](http://stackoverflow.com/questions/4545634/how-do-i-rename-a-mysql-schema). But this only gives possibility to rename and not to remove.. want something like this : `CREATE TABLE IF NOT EXISTS 'myprefix_table_1'` – LINKeRxUA Nov 13 '14 at 08:37
  • In the forward engineer wizard, while on Options tab (second step), uncheck the "Generate DROP SCHEMA" and the script will end up with the CREATE SCHEMA IF NOT EXISTS 'myprefix_table_1' command. – George Nov 13 '14 at 11:29
  • Don't help unchecking this option, but helps to check this option "Omit SchemaQualifier in Object Names" in that second step. Thank you for help! – LINKeRxUA Nov 13 '14 at 15:00