Update schema from docker

Feature(s) impacted

Development workflow

Observed behavior

We develop within a docker container. It works well but of course, the Forest Admin schema does not get updated on our host machines. We have to make sure to start the project on our host machine to update the schema before committing.
This step is easily missed and makes our development workflow more complex.

What do you recommend as best practice for developing with docker and keeping the schema up-to-date?

Context

Our Forest Admin project shares its model with other projects within a yarn workspace monorepo.
Our development workflow uses docker and docker compose to run Forest Admin along with other projects of the monorepo.

  • Agent type & version: “forest-express-sequelize”: “^8.5.8”

Hello @AlexisSMT,

If I understand it well, you have 2 ways of launching your agent:

  1. within the docker container, where you develop
  2. on your host machine

In the docker environment, the schema is not re-generated whereas the agent is launched, in order to develop with it.

And on your host machine, you don’t want to develop but you have to start the agent in order to generate the file.

Am I correct?

Within the docker machine, the schema is generated correctly. We can develop with no problem.

Then before committing we need to update the schema on our host machine. For that, either we start the agent or we somehow copy the schema from the docker machine to our host machine.

What is the best practice in that situation?

Ok, thanks for your answer.

Is there a difference in your process between modifications made to the source code and the schema?

We recommend using the same approach for both, and commiting the schema with the code that produced the changes. Both should be treated the same way. Is it something that could be applied in your case?

We commit both our source code and schema changes together.

The only difference is that it is the agent that changes the schema, and thus it is done on our docker machine and not on our host machine. So we have to run the agent on our host machine before committing

Have you defined a volume to share some files between your host and docker instance? Don’t you have the possibility to include the path where the schema is written?

I could try what you suggest indeed, if that’s what you recommend!

Yes it is what I recommend.