> ## Documentation Index
> Fetch the complete documentation index at: https://forest-chore-open-api.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Models

> ⚠️ This page and sub-pages are relevant only if you installed Forest directly on a database (SQL/Mongodb). If you installed in a Rails/Django/Laravel app, you manage your models like you normal

Your models are located in `/models`. They control a big part of your Forest UI.

### Reflecting your database changes in your 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:

<img src="https://mintcdn.com/forest-chore-open-api/TmGmEqoffYUVv4Df/images/legacy/javascript-agents/the_models.jpg?fit=max&auto=format&n=TmGmEqoffYUVv4Df&q=85&s=ddfe5da1cdbfcca9a851380f7a4c5a6d" alt="" width="1920" height="1080" data-path="images/legacy/javascript-agents/the_models.jpg" />

### Updating your models automatically

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:

<Warning>
  This feature requires an agent **version** 7 or higher.
</Warning>

Version 2.2+ of [Forest CLI](https://www.npmjs.com/package/forest-cli) allows you via its `schema:update` command to:

* Generate files which, after introspecting your database, appear to be missing in your folders (`models` , `routes` & `forest`). Eg. Adding a new table and launching `schema:update` within your project directory should generate the associated models/routes & forest files
* Generate a correct project architecture to easily manage multiple databases. After your onboarding (on a single database), update the `config/databases.js` file to add a new connection, launch `schema:update` and your models should be set correctly

<Warning>
  `forest schema:update` will **never** modify your code base (remove files, move files, change file content). It's up to you to copy some (or all) of the generated contents into your existing files/folders.
</Warning>

Note that `forest schema:update` options are as follows:

* `-c` or `--config` , allowing to specify a path for the config file to user (Default to `./config/databases.js`)
* `-o` or `--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 end-user 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 `config/databases.js` file.&#x20;

<Info>
  Have any models that will always stay hidden? Find out how [you can exclude them](/legacy/javascript-agents/how-tos/settings/include-exclude-models) and gain on performance.
</Info>

### Enriching your models

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:

### The `.forestadmin-schema.json` file

On server start, a `.forestadmin-schema.json` file will be auto-generated in **local (development) environments only.** It reflects:&#x20;

* the **state of your models** (in `/models`)**.**
* your **Forest customization** (in `/forest`).

<Info>
  This file **must be versioned and deployed** for any remote environment (staging, production, etc.), as it will be used to generate your Forest UI.
</Info>

<Info>
  We use the environment variable ***NODE\_ENV*** to detect if an environment is in development. Setting this variable to either nothing or ***development*** will regenerate a new *.forestadmin-schema.json* file every time your app restarts. Using another value will not regenerate the file.
</Info>

<Warning>
  A consequence of the above is, **in Production** the `.forestadmin-schema.json` file does **not** update according to your schema changes.
</Warning>

<Warning>
  **Do not edit this file,** as it could break your interface if the wrong syntax is used.
</Warning>

Versioning the`.forestadmin-schema.json` file will also help you visualize your changes.

<Info>
  To **disable automatic** Forest schema updates and do it **manually**, follow this [how-to](https://docs.forestadmin.com/documentation/v/v4/how-tos/disable-automatic-forest-admin-schema-update).
</Info>
