LionWeb-io / lionweb-repository

Reference implementation of LionWeb repository
Apache License 2.0
2 stars 1 forks source link

Auto-initialization of the database #31

Closed ftomassetti closed 4 months ago

ftomassetti commented 7 months ago

Currently the init API must be called explicitly to initialize the database.

@joswarmer would it make sense if, when starting the repository, we check if the database has already the expected classes, and if not we call the init logic automatically?

If you think it makes sense, I can prepare a PR.

ftomassetti commented 7 months ago

Alternatively, it could make sense to expose a method ensureTheDBIsInitialized that can be safely called without losing all the content of the database, if the database has been already initialized

joswarmer commented 7 months ago

Until now I only used this for testing, but I agree that this is a dangerous operation. I even doubt whether this init should be available in the model server. It is also directly callable through the command line, where you can also create a new database.

joswarmer commented 4 months ago

Hi Federico, I just found out that the create database was always done when starting the server. This was not intentional, but the side effect of JS/TS script (database.ts) that can be run as an application. When loading the server this code always ran at the start. I am removing it in the history branch, and will probably remove the database.ts script as well. @ftomassetti If you are using the database.ts script, we should see how we can replace this.

joswarmer commented 4 months ago

This has been fixed,