Modifying the Generated Database Structure

The majority of your database's structure is generated automatically based on the models in your project. There are easily foreseeable scenarios where it might be desirable to tweak the configuration of the generated database. To mitigate these circumstances, Studio projects have a folder labeled DDL.


Figure 3.30. The location of the DDL folder used to modify the database structure following the normal build.

images/download/attachments/144835043/studio_66-version-1-modificationdate-1645039108000-api-v2.png


The DDL folder is one of several special folders. In the case of the DDL folder, you can place files within this folder with a .sql extension. Any such files will be executed as part of the normal build process after the normal database build has completed.

This is useful for tweaking the structure of the database, such as to create indexes, views, triggers, stored procedures, or any other database object not generated by Platform. Essentially you can execute any DML statements in these scripts.

Be careful to not execute DML that alters the database in such a way that it's out of sync with the model definitions. This could have unforeseen side effects.