How/when does CUBA create it's tables when deploying to an existing non-CUBA database?

I will shortly be deploying my CUBA application using UberJAR to an existing MSSQL QA database.

I understand how my application entities, constraints, indexes etc get created, but how/when do the CUBA SEC/SYS tables get created?

I’ve scoured the docs and forum and couldn’t find an explanation of how to create the CUBA tables.

hi,

the DB schema information for the platform itself as well as all application components are self contained within the platform / the app components.

Let’s take the platform itself. You can find the sql scripts in the core/db/init/ module. E.g. this is the init file for postgres: https://github.com/cuba-platform/cuba/blob/master/modules/core/db/init/postgres/create-db.sql

The tables will created by the DbUpdaterEngine.updateDatabase, which runs at startup (ifcuba.automaticDatabaseUpdate is set to true, which is pretty common). The mechanism how the db gets updated is described here: https://doc.cuba-platform.com/manual-6.8/db_update_server.html

After the init scripts are executed, the next time the DBUpdaterEngine will only checks if the db is up to date. If not it will execute the corresponding (newly added) update scripts.

I hope this helps a little to clarify.

Bye
Mario

2 Likes