The Database scripts page displays automatically generated database initialization and update scripts. The scripts will be saved on disk when you click Save and close or run database update or creation right from this page.
modules/core/db/update
directory. Scripts have autogenerated names
with prefixes that ensure the order of execution. Scripts containing DROP statements are highlighted in red.
You can add an arbitrary script by clicking the New update script button, and it will be saved and executed later together with auto-generated scripts.
The newly generated scripts can be edited or completely deleted by clicking the Remove selected button.
If you click Exclude selected, you will have two options:
modules/core/db/update-manually
.
Then the script will not be executed automatically when you run Update database, but you will
be able to run it manually when needed. This option is useful for scripts that drop columns or tables
renamed earlier to *__UNUSED
.modules/core/db/update
directory, but remembered in the studio-settings.xml
file in your project folder. When you
generate scripts next time, Studio will ignore changes, corresponding to the excluded scripts. This allows
you to have differences between the database and the model entities. For example, you may want to add a
database field to a table, corresponding to a project entity, but do not map it to an entity attribute. When
Studio generates a script to delete the field from the database, just exclude it, and Studio will never
generate it again.10.create-db.sql
file.
20.create-db.sql
file.
30.create-db.sql
file.
01.create-db.sql
file.
02.create-db.sql
file.
Click Save and close to save all generated scripts. After that, stop the application server if it is running and execute Run > Create database or Run > Update database to apply the scripts.
You can get more information on how to work with database during application development in documentation.