DDL mappings
Enable the Database tools and SQL plugin
This functionality relies on the Database tools and SQL plugin, which is bundled and enabled in IntelliJ IDEA by default. If the relevant features aren't available, make sure that you didn't disable the plugin.
Press Control+Alt+S to open the IDE settings and select
.Open the Installed tab, find the Database tools and SQL plugin, and select the checkbox next to the plugin name.
DDL mapping functionality sets the relation between the regular data source and the DDL data source. By using mapping, you can explicitly select schemas in the real data source to synchronize objects with the DDL data source. And, alternatively, any changes in the DDL data source can be applied to a regular data source.
For example, you can create the actor_1
table in your PostgreSQL data source, and later by using the action in the context menu, add the actor_1.sql file to your DDL data source folder with SQL files. Or, add actor_1.sql file to the DDL data source, select in the context menu, and the actor_1
table will appear in the PostgreSQL data source.
Add a DDL mapping
In the Database tool window ( ) , click the Data Source Properties icon .
Click the DDL Mappings tab.
Alternatively, you can get to this tab by right-clicking a data source in the Database tool window ( ) and selecting .
Click the <Choose Data Source> for Data Source.
Select or create a data source to map.
Click the <Choose Data Source> for DDL Data Source.
Select or create a DDL data source to map.
In the Scope tree, select schemas or databases that will be used in mapping.
Apply changes from a data source to a DDL data source
Ensure that the DDL mapping is created.
In the Database tool window ( ) , right-click a DDL data source and select .
Apply changes from a DDL data source to a data source
Ensure that the DDL mapping is created.
In the Database tool window ( ) , right-click a DDL data source and select .
In the Migration dialog, select changes that you want to apply.
If necessary, modify scripts generated in the Script Preview tab. Leave only those scripts that you plan to execute.
Click Execute.
Dump to DDL data source
Ensure that the DDL mapping is created.
In the Database tool window ( ) , right-click a data source and select .
If there are objects in the DDL data source that are missing in a regular data source. You will see a warning that those files will be deleted.
Settings
Name | Description |
---|---|
Name | Name of the mapping. |
Comment | You comment for the mapping. |
Data Source | Select or create a data source that will be mapped to a DDL data source. |
DDL Data Source | Select or create a DDL data source to map to the real data source. |
Scope | Select schemas or databases that will be used in mapping. |