The Database Generation tool can generate SQL script, that represents the diagram you developed and (optionally) executes it on the database server. You can generate database in two ways:
In both cases, the database generation commands are saved in a script file. You must always provide path to the script file. Database Generation To generate database, start the Database Generation tool by using Generate Database ( ) item on Database tab of the Ribbon or pressing Ctrl+G. The following pictures demonstrate Database Generation tool interface.
Database Generation tool consist of several tabs, which contain SQL generation options. Let's explore them. Database Options In the Database Options tab of the Database Generation tool you can set database generation options. Create Database Begin Script End Script Notes as SQL Comment Drop Database Table Options In the Table Options tab of the Database Generation tool you can set tables generation options. Create Tables Begin Script End Script Notes as SQL Comments Create Primary Keys Create Indexes Create Table Options Create table triggers Generate table and column comments Create table partitions Drop table triggers Drop table Foreign Keys Foreign Keys tab of Database Generation tool allows to set up foreign keys generation options. Generate Foreign Keys FK Generation Method Generate FKs inside table definitions. Generate FKs after all tables are generated. Views, Stored Routines, Events Stored Routines Group Create Stored Routine Begin Script End Script Comment Drop Stored Routine Views Group Create View Begin Script End Script Comment Drop Views Events Group Create View Begin Script End Script Comment Drop Views Options This tab allows set generation-related options. Character case Body Delimiter Use 'TYPE' clause instead of 'ENGINE' Generate name in empty comments Check diagram After generation, run Selecting objects to generate You can select diagram objects you want to generate in SQL script or database. Use the Selection tab of the Database Generation tool for it. There are several subtabs: Tables, Stores Routines, Views and Views. Each of which allows you to select appropriate diagram objects to generate. To enable particular objects generation, click on the checkbox near it. The default selection of objects to generate depends on their Generate property. Pay attention to the buttons on the Selection tab: Select All Deselect All Use graphical selection Move selected items to top You can change the order of tables in which they will be placed in the generated SQL script. Use the buttons with arrows for this. Generating, customizing and executing SQL Click on the Generate script button on the Database Generation tool to generate SQL script. The generated SQL script will be stored in the file you have set. If you selected Internal SQL Executor on Options tab, the SQL Executor with generated SQL statements will appear. You can easily customize statements for your needs. And then send them to the database server by clicking on the Execute SQL button. Please, examine SQL Executor section to know more about it. See also: |