DDL data sources
DDL data sources
SQL files that contain data definition language statements (DDL statements) can be used as data sources. As a result, you can reference all tables, columns and other objects defined in such files in the editor.
If you already have a DDL data source for the selected data source, you can choose whether to dump DDL files to the existing DDL data source or create a new one.
Dump an existing data source to a DDL data source
In the Database tool window ( ), right-click a data source that you want to dump to a DDL data source and select .
To configure code settings for the DDL data source, see Configuring DDL generation settings.
In the Data Sources and Drivers dialog, select the DDL data source, and click Add directories or DDL files.
In the file browser, navigate to the directory that will store DDL files of a data source and click Open.
Click OK.
Create a DDL data source from existing files
In the Database tool window ( ), click the Data Source Properties icon .
On the Data Sources tab in the Data Sources and Drivers dialog, click the Add icon () and select DDL Data Source.
In the Sources pane, click the Add button ().
In the file browser, navigate to the SQL file or files with DDL statements and click Open.
Click the Dialect link and select a dialect that you want to use for added SQL files.
Apply settings and click OK.
If the Auto sync is selected, the DDL data source is automatically refreshed with changes to the corresponding files. To disable this behavior, clear the checkbox.
Reference objects in a data source
You can create an index in the DDL data source that references a table in a usual data source. In your code, this table will be correctly referenced and the table with the index will appear in the database tree.
In the Database tool window ( ), click the Data Source Properties icon .
Select a DDL data source that you want to extend.
Click the Add icon (), select Extend Data Source and select the data source that you want to reference.
Set a dialect for SQL files in the DDL data source
In the Database tool window ( ), click the Data Source Properties icon .
Click a DDL data source that you want to modify.
On the Sources tab, click the Configure SQL Dialect icon ().
Creating objects in the DDL data source
In the Database tool window ( ), right-click a node of the DDL data source and navigate to New. In the list of objects, select the object that you want to create.
Configuring DDL generation settings
You can configure code settings for files that are generated for the DDL data source.
In the Database tool window ( ), click the Data Source Properties icon .
On the Data Sources tab, select the DDL data source.
Click the New File Layout tab.
Settings of the New File Layout tab
Option | Description |
---|---|
Layout | Defines the way how to store and generate DDL files.
|
Root path | Defines the location directory for DDL files. |
Code style | Applies the code style to generated DDL files. |
Qualify objects with schema names | Adds a schema name to the table name. You can qualify a table when you have two and more tables with identical names in different schemes. This option has the following parameters:
|
Place constraints | Defines where to place FOREIGN KEY, UNIQUE, CHECK, and other constraints.
|
Regenerate database-provided code of property definitions | Regenerate property definitions that are provided as a part of source code by the database. |
Reformat generated code | Reformat generated code with the current code style profile. This option affects generated code only and does not affect the code received directly from the server. |
Default schemas/databases | Set a default schema or database for objects in the DDL data source. DDL data sources has unnamed databases and schemas. The following table allows you to set the default schema name. |