Your models are located in
/models. They control a big part of your Forest UI.
When you install for the first time, Lumber introspects your database and generates your models accordingly.
Afterwards, here's how your database changes can be rendered in your Forest UI:
If you made many changes or even added a new table/collection, we recently reintroduced a programmatic way to help you manage the associated file changes:
Version 2.2+ of Forest CLI allows you via its
schema:update command to:
Generate files which, after introspecting your database, appear to be missing in your folders (
forest). Eg. Adding a new table and launching
lumber update within your project directory should generate the associated models/routes & forest files
Generate a correct project architecture for to easily manage multiple databases. After your onboarding (on a single database), update the
config/databases.js file to add a new connection, launch
lumber update and your models should be set correctly
forest schema:update options are as follows:
--config , allowing to specify a path for the config file to user (Default to
--output-directory : Create a directory named after the config parameter provided. It will also redump all the
models/routes/forest file in a specific directory, allowing the enduser to pick code modification.
This command need to be launched at the root of the project directory, where the
.env should be, since it is required by
Lumber does some of the work for you. However, you remain in control of your models.
On the following page, we'll cover how you can enrich your models:
On server start, a
.forestadmin-schema.json file will be auto-generated in local (development) environments only. It reflects:
the state of your models (in
your Forest Admin customisation (in
.forestadmin-schema.json file will also help you visualize your changes: