Migration to `@forestadmin/agent` - entity naming with spaces

We’re migrating from forest-express-sequelize to @forestadmin/agent.

In your docs, you say that we need to keep the very same names for entities, in order to have a smooth transition.

But it looks like the new version does not support names with spaces. In the new agent, spaces are not allowed in fields’ names (not documented, but error thrown from @forestadmin/datasource-tooklit/dist/src/validation/field.js ).

image (9)

And this is the log:

But currently, we have spaces in our names!!
How can we keep names unchanged and remove spaces from names at the same time?

Here is the “meta” section of the forest admin schema file:

  {
    "liana": "forest-nodejs-agent",
    "liana_version": "1.41.7",
    "liana_features": null,
    "stack": {"engine": "nodejs", "engine_version": "20.11.1"}
  }

and from package.json:

"sequelize": "^6.28.0"

cc @julien.jolles

Hello @Matteo

Keeping the name identical prevents your from losing your layout customizations. Inputting your names in a camel case format should translate them to the display name you are used to in your UI.

You can try in your development environment to see if your customizations are kept or not;

(On your dev env):

  • keeping the old agent
  • Customize a collection in your UI
  • Switch to the new agent and deploy the forest schema
  • Check in the UI if your previous customization is still present

If it is, you should not worry about your customizations in your production environment.

Best regards,

Ok, we’ll try.

May you please tell the procedure to restore the dev env to the previous setting if we need to step back?

Le’t say that something goes wrong and we need to restore the previous version in the dev env, how can we achieve this?

At the moment, as you suggest in you migration guide, we created a brand new env for the development of the migration.

Thank you.

No real procedure was designed for this since the operation should be done on a non critical environment.

But if I’m not wrong, you should be able to restore it by:

  • switch back to the old agent
  • publish the forest schema (with the old names)
  • then using the forest cli, create a new branch with origin being your prod

@dogan.ay we tried to replace our names containing spaces (old agent) with new names in camel case (new agent), as you suggested. But the names change!! And all the settings related to these names on your side are lost.
This can be easily observed in the changes in the .forest_admin_schema file.
and in the Forest UI all the settings are lost :man_shrugging:

So we don’t understand how to preserve these fields settings.
If names with spaces are not supported any more in the new agent, how can we preserve all our existing names (and all the related settings)?

Thank you for a double check.

Matteo

Hey :wave:

This was introduced to prevent an issue we had with our v1 agent - where fields name containing spaces partially worked (In v1, it wasn’t possible to make them filterable/sortable/searchable, etc).

In order to prevent this, we decided to drop the support of this feature - as the actual benefit of having name with spaces was rather small (If you name your field with spaces, it would break typings, etc).

However this lead to the underlying issue: As the field name changes, the associated layout configuration done on the UI will be lost. As of today, there is no workaround to maintain this layout.

If that’s possible to fix on your end, that would be the best.
If not, just get back to us, and we will take a look and estimate if this is fixable on our end.

1 Like

Hi @jeffladiray
I confirm we’re renaming our smart field names, removing any space before affording the upgrade.
This way we’ll have no problems with spaces.

Thank you,
Matteo

1 Like