I deleted an attribute on a table, and added a new attribute .... will Forest accept this?

My original database had a field called “name”. This field was part of my Forest project’s model definitions (json files). This field was also part of various segments (with and without filters on that field).

In my new database, the field name has been split into two fields: “first_name” and “last_name”.

If I update my project’s model definition to reflect the new fields:

  1. will my existing Forest frontend still work?
  2. if not, what is the smart way to incorporate field changes (additions, removals) to a database/model?

Expected behavior

My Forest views/segments still work

Actual behavior

I get “Your server encountered an error” messages

Failure Logs

fields are not found

Context

Please provide any relevant information about your setup.

  • Package Version:
  • Express Version:
  • Sequelize Version:
  • Database Dialect: Postgres
  • Database Version:
  • Project Name: UCM

Hi @rvastag,

Thank you for sharing your issue/concern.

When you update a field from your DB, you have to update those fields directly on the related models files. After that a restart of your server is necessary for ForestAdmin to acknowledge those changes and populate those into the .forestadmin-schema.json file.

This is the basic way of transitioning from a database state to another.

However, this solution won’t update all the existing Forest entries based on that field (charts, segments, etc). To handle those you have two solutions:

  • Going through all existing entries to update the target field
  • Defining a smart field with the same name as the one you dropped to have all existing entries defined to point to this new smart field. (Do note that this will work on filters built with forest, not raw SQL queries)

Moreover it seems that you encountered issues while transitioning, to help you tackle those I might need more informations from you if the soft transition I described isn’t enough to assist you.

I hope this helped!