# New agent nodejs, forest-schema is not updated

**URL:** <https://community.forestadmin.com/t/new-agent-nodejs-forest-schema-is-not-updated/7654>\
**Category:** Help me!\
**Created:** [November 22, 2024, 3:21pm UTC](https://community.forestadmin.com/t/new-agent-nodejs-forest-schema-is-not-updated/7654 "2024-11-22T15:21:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adel\_de\_Clevermate](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/adel_de_clevermate/32/4608_2.png) [@Adel\_de\_Clevermate](https://community.forestadmin.com/u/Adel_de_Clevermate)\
**Post date:** [November 22, 2024, 3:21pm UTC](https://community.forestadmin.com/t/new-agent-nodejs-forest-schema-is-not-updated/7654/1 "2024-11-22T15:21:20Z")

</div>

Hello,

I just create a new folder using `forest projects:bundle:sql "aFolderName"` and the run it using docker on my local dev.

## Feature(s) impacted

migrating from v9 to new agent

## Observed behavior

## Expected behavior

I changed the index.ts adding a field to collection appointment, but when I start/restart the server the forestadmin-schema.json is not being updated, I dont find the new field in there. I even tried to rename some fields but I always dont see the changes on the forest schema.

this is my index file:

```javascript
import type { SslMode } from '@forestadmin/datasource-sql';
import type { Schema } from './typings';

import 'dotenv/config';
import { createAgent } from '@forestadmin/agent';
import { createSqlDataSource } from '@forestadmin/datasource-sql';
import { convertToSnakeCase } from './utils';

// This object allows to configure your Forest Admin panel
const agent = createAgent<Schema>({
  // Security tokens
  authSecret: process.env.FOREST_AUTH_SECRET!,
  envSecret: process.env.FOREST_ENV_SECRET!,

  // Make sure to set NODE_ENV to 'production' when you deploy your project
  isProduction: false,

  // Autocompletion of collection names and fields
  typingsPath: './typings.ts',
  typingsMaxDepth: 5,
});

// Connect your datasources
// All options are documented at https://docs.forestadmin.com/developer-guide-agents-nodejs/data-sources/connection
agent.addDataSource(
  createSqlDataSource({
    uri: process.env.DATABASE_URL,
    schema: process.env.DATABASE_SCHEMA,
    sslMode: process.env.DATABASE_SSL_MODE as SslMode,
  }),
   {
    rename(oldCollectionName) {
      return convertToSnakeCase(oldCollectionName);
    },
  }
);

agent.customizeCollection('appointments', collection => {
  collection.renameField('date_action', 'dateActionTest');
  collection.addField('displayEventEmail', {
    // Type of the new field
    columnType: 'String',

    // Dependencies which are needed to compute the new field (must not be empty)
    dependencies: ['email', 'date_action'],

    // Compute function for the new field
    // Note that the function computes the new values in batches: the return value
    // must be an array which contains the new values in the same order than the
    // provided records.
    getValues: (records, context) =>
      records.map(r => `${r.email}: ${r.date_action}`),
  });
})

// Add customizations here.
// For instance, you can code custom actions, charts, create new fields or relationships, load plugins.
// As your project grows, you will need to split it into multiple files!
//
// Here is some code to get your started
//
// agent.customizeCollection('products', collection => {
// // Actions are documented here:
// // https://docs.forestadmin.com/developer-guide-agents-nodejs/agent-customization/actions
// collection.addAction('Order new batch from supplier', {
// scope: 'Single', // This action can be triggered product by product
// form: [{ label: 'Quantity', type: 'Number', isRequired: true }],
// execute: async (context, resultBuilder) => {
// const product = await context.getRecord(['id', 'name'])
// const quantity = context.formValues['Quantity'];

// // ... Perform work here ...

// return resultBuilder.success(`Your order for a batch of ${quantity} '${product.name}' was sent`);
// }
// });

// // Search customization is documented here:
// // https://docs.forestadmin.com/developer-guide-agents-nodejs/agent-customization/search
// collection.replaceSearch(searchString => {
// // user has most likely typed a product id, let's search only that column
// if (searchString.match(/^prdid[\d]{8}/$))
// return { field: 'id', operator: 'Equal', value: searchString };

// // Otherwise assume that user wants to search for a product by name
// return { field: 'name', operator: 'Contains', value: searchString };
// });
// });

// Expose an HTTP endpoint.
agent.mountOnStandaloneServer(Number(process.env.APPLICATION_PORT));

// Start the agent.
agent.start().catch(error => {
  console.error('\x1b[31merror:\x1b[0m Forest Admin agent failed to start\n');
  console.error('');
  console.error(error.stack);
  process.exit(1);
});

```

## Failure Logs

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/b/b3a938a8cdd06a164a9e425dfe1c2f6fbb4c7f47.png)

## Context

[relared issue.](https://community.forestadmin.com/t/new-agent-nodejs-on-local-doesnt-show-collections-content/7627)

- Project name: clevermate
- Environment name: Development | adeldjidjik (my-dev)
- Agent technology: (nodejs
- Agent (forest package) name & version: new agent v1
- Database type: postgres

---

<div class="post-metadata">

**Author:** ![Arnaud\_Moncel](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/arnaud_moncel/32/24_2.png) [@Arnaud\_Moncel](https://community.forestadmin.com/u/Arnaud_Moncel)\
**Post date:** [November 22, 2024, 3:40pm UTC](https://community.forestadmin.com/t/new-agent-nodejs-forest-schema-is-not-updated/7654/2 "2024-11-22T15:40:34Z")

</div>

This is due on how the docker file/compose are configured.  
If you have a look the docker file is configured to run as a production images.  
You should update the image creation accordingly to your usage.  
If you don’t, you need to run `docker compose up --build` every time you make a change.
