DDL mappings
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 more information about using DDL data source and DDL mapping to keep your regular data source under VCS, refer to the Databases in the Version Control System tutorial.
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
Open data source properties. You can open data source properties by using one of the following options:
Navigate to
.Press Ctrl+Alt+Shift+S.
In the Database Explorer ⌘ 1 ( ), 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 Explorer ( ) 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 the 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 Explorer ( ) , 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 Explorer ( ) , 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.
For more information about migration in DataGrip, refer to Schema migration and Controls of the Migration dialog.
Click Execute.
Dump to DDL data source
Ensure that the DDL mapping is created.
In the Database Explorer ( ) , 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 the schemas or databases that will be used in mapping. |