Enum Organization Schema Updates

Feature(s) impacted

Automatic schema generation

Observed behavior


We are currently a team of 3 people using the Forest Admin Agent on a NestJS app, and depending on who is running the app with the Forest Admin plugin, we keep having suggestion to change the forest admin schema, only to change the orders of the Enum values (even though we didn’t make any database migration to change our schema).

Expected behavior

No schema changes if the database schema didn’t change.

Failure Logs

Context

  • Project name: Novesia
  • Team name: Operations
  • Environment name: Staging
  • Agent (forest package) name & version: @forestadmin/agent v 1.13.4
  • Database type: PostgreSQL
  • Recent changes made on your end if any: N/A

Could you help me to understand why I can have those schema changes updates (it appears to be only on enum arrays)

Thanks for your help,

Quentin Churet

Hi Quentin

This is clearly a bug, thank you for showing it to us.
I merged a PR to sort the enum values in the schema, it will be released in a matter of minutes.

Don’t hesitate to reopen the ticket and come back to us if the issue is not fixed,

1 Like

Hi Romain !

Thank you very much for the update !! Very impressed by your capacity to release so fast !

I’m going to check right now, but I also see that we have the same issues in the typings.ts. Does your change is going to fix this problem too ?

Thanks for your help !

it should fix both as I’m sorting in the script that does the database structure introspection

Yes it does :slight_smile: However, now the default value is not null but an empty array. I don’t know if that is an issue, but in my side it seems to work.

Anyway, I seem to have another useless schema difference, in the “flat” attribute (in the typings.ts)

Wouldn’t it be the same thing ? :slight_smile:

Thanks for your help !

By taking a look at your code, I have the impression that it could also be fixed by sorting the fields in the packages/datasource-customizer/src/typing-generator.ts :