CLion
 
2023.2
Get CLion

Databases in the Version Control System

Last modified: 27 September 2023

DDL data source is a virtual data source with a schema based on a number of SQL scripts. Storing these files in the Version Control System (VCS) is a way to keep your database under the VCS.

The general workflow with VCS is the following:

db_storing_db_in_vcs

First of all, you need to enable the VCS integration in your IDE. It will allow you to share and apply changes right from the IDE. With the VCS integration enabled, prepare a folder that you will share as a repository. This folder will also be a root folder for your DDL data source.

Then you need to create your DDL data source by dumping a regular data source (for example, SQLite) to a root/repository folder. Then you need to create a mapping between a data source and a DDL data source. You need the mapping to set what you want to share. For example, you hardly need to share all system or template schemas. So, you can select those schemas that you will exchange with your college.

Depending on what you want to do, you can dump your changes and share them through a VCS, or you can pull changes and apply it to your data source. The synchronization in both directions is made with the help of a DDL data source.