# 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.

> **Note:**
> DDL mapping functionality is not supported for MongoDB databases.

For example, you can create the `actor_1` table in your PostgreSQL data source, and later by using the `DDL Mapping | Update from PostgreSQL` 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 `DDL Mapping | Apply to PostgreSQL` in the context menu, and the `actor_1` table will appear in the PostgreSQL data source.

![DDL Mappings tab in the Data Sources and Drivers dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_ddl_mappings.png)

Procedure: Add a DDL mapping

1. Open data source properties by doing one of the following:

* On the Database tool window toolbar, click ![The Data Sources icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.manageDataSources.svg) Data Sources.

* Press `Shift+Enter` (Windows), `⌘ I` (macOS), `⇧ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Shift+Enter` (XWin), `Shift+Enter` (GNOME), `Shift+Enter` (KDE), `Shift+Enter` (Emacs), `Shift+Enter` (Sublime Text), `⌘ I` (Sublime Text (macOS)), `Shift+Enter` (NetBeans), `Shift+Enter` (Visual Studio), `⌘ I` (Visual Studio (macOS)), `Shift+Enter` (Eclipse), `⌘ I` (Eclipse (macOS)) .

![Open the Data Source and Drivers dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/open_data_sources_and_drivers_dialog.png)

2. Click the DDL Mappings tab.

Alternatively, you can get to this tab by right-clicking a data source in the   Database   tool window  ( `View  | Tool Windows |  Database` ) and selecting `DDL Mapping | Create DDL Mapping`.

3. Click the <Choose Data Source> for Data Source.

4. Select or [create](managing-data-sources.html#create_a_data_source) a data source to map.

5. Click the <Choose Data Source> for DDL Data Source.

6. Select or [create](ddl-data-sources.html) a DDL data source to map.

7. In the Scope tree, select the schemas or databases that will be used in mapping.

[Video](https://resources.jetbrains.com.cn/help/img/idea/2026.2/add_a_ddl_mapping.mp4)

Procedure: Apply changes from a data source to a DDL data source

1. Ensure that [the DDL mapping is created](#add_ddl_mapping).

2. In the   Database   tool window ,  right-click a DDL data source and select `DDL Mapping | Update from data_source_name`.

[Video](https://resources.jetbrains.com.cn/help/img/idea/2026.2/apply_changes_from_a_data_source_to_a_ddl_data_source.mp4)

Procedure: Apply changes from a DDL data source to a data source

1. Ensure that [the DDL mapping is created](#add_ddl_mapping).

2. In the   Database   tool window ,  right-click a DDL data source and select `DDL Mapping | Apply to data_source_name`.

3. 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 IntelliJ IDEA, refer to  [Schema migration](schema-comparison-and-migration.html#schema_migration) and [Controls of the Migration dialog](schema-comparison-and-migration.html#controls_of_the_migration_dialog).

4. Click Execute.

![Apply changes from a DDL data source to a data source in the Migration dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_apply_changes_from_a_ddl_data_source_to_a_data_source.png)

Procedure: Dump to DDL data source

1. Ensure that [the DDL mapping is created](#add_ddl_mapping).

2. In the   Database   tool window ,  right-click a data source and select `DDL Mapping | Dump to DDL_data_source_name`.

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.

![Dump to DDL data source](https://resources.jetbrains.com.cn/help/img/idea/2026.2/dump_to_ddl_data_source.png)

## 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. |

## See also

### Reference

[Data sources and their elements](database-tool-window.html#icons-for-data-sources-and-their-elements) [Data Sources and Drivers dialog](data-sources-and-drivers-dialog.html)

### Tool Windows

[Database tool window](database-tool-window.html)

