Database & table updates

Hi guys,

I wanted to know what would be the exact process when we apply structural changes to our database.
If I understood correctly, when I add a table I simply have to use the forest schema:update command and push the files to the server.
Is that correct or am I missing a step ?

And what if I do some changes into an existing table (adding a column, changing column name, type, add or remove constraints…), what should I do ? Delete the model file and run forest schema:update ? or would it not be enough ?

Thanks in advance for your help !

Hi @mrlian :wave:

when I add a table I simply have to use the forest schema:update command and push the files to the server.

Correct!

if I do some changes into an existing table (adding a column, changing column name, type, add or remove constraints…), what should I do ? Delete the model file and run forest schema:update ?

Exactly!

If you change some relations, try to remove all the models impacted.

Le me know if you have more questions.

Ok great, thank you !
However, I had to also run the local backend before pushing to remote environment, because forestadmin-schema.json is not updated in remote. What is the reason for that ? Is there any way to avoid this behaviour ?

Yeah it is a wanted behaviour, we recommend to versioning this file with your code.
The UI is a reflection of this file. If you change this file the UI change.
The only way you have to bypass this is to set NODE_ENV to development

Let me know if it’s clear :smiley: