How to generate db update scripts in prod/cloud (no access to db)

Hi

I’m a bit confused on the db update scripts mechanic in Studio. I understand it compares current model defined in the code with currently connected database, which seems perfect.

However, once the application is in production, and more specifically in jelastic cloud, I do not have access to the database.

So how can I generate the db update scripts comparing the model of the new version I’m planning to release, with the current database status in cloud ?

Mike

Hi, @michael.renaud

So, you use a database deployed in cloud while developing a new version of your application, am I right? Or structure of your production database can be changed while operation?

We are talking about development and operation processes, so please clarify your workflow and environment.

Regards,
Daniil.

Let me clarify.

We developped normally in our dev environment, then we delivered for the first time on Jelastic (tomcat/app + Postgres/database). Now we are on the edge of delivering a new version on Jelastic, with database changes.

Of course we cannot access directly the database on Jelastic, this is perfectly desirable.

However we would like to have a fine control over the db scripts to be executed, and we don’t want to rely on the fact that there is a dev database that keeps permanently the same list of update scripts than production. Dev databases are throwable objects.

EDIT : especially when in development mode you can drop a column, readd it back later, etc… Which means that the update scripts generated on dev env are not reliable. Ideally we would like to be able to run a differential between prod database current schema and application ready to be deployed.

Sorry to rebound, but we would really appreciate help here.

Hi Mike,

Sorry for the late reply.

Ideally we would like to be able to run a differential between prod database current schema and application ready to be deployed.

So backup your prod database, restore locally and connect to it with Studio with the latest project version. Studio will generate update scripts for the difference.

You can run these scripts manually on prod, or deliver them in the db directory and run on app server startup. In the latter case, be sure that db directory contains only scripts intended for execution (and previously executed and registered in SYS_DB_CHANGELOG). Also, keep in mind that if you upgraded to a newer platform version, you should execute scripts contained in db/10-cuba/update directory (and corresponding addons directories).

1 Like