Forest admin having two database that have table names is this possible?

Hello to you!

Feature(s) impacted

Creation of multiple databases on forest admin with tables that have the same name

Observed behavior

In our case we have 2 databases with similar tables for example:

  • for the database np we have contracts
  • for the nv database we have also contracts

When we put the command forest schema:update
we have the tables that have the same name that are skipped in forest folder.

For the models I put in the new folder nv all the tables we needed.

And in the routes folder the tables that have the same name are also skipped.

Our code in the databases.js file

Expected behavior

Is it possible when adding data not to skip by adding a folder for example for the files created in forest and rotues?

Also is it possible to have display problems on forest admins because we have tables with the same name ?

Would you have an idea about these problems please :pray:.

Context

  • Project name: Nostrum-gateway
  • Team name: Operation
  • Environment name: Develop
  • Agent type & version: “forest-express-sequelize”: “^8.0.0”,

I see that this is a follow up from our last thread Integration of a second database - #3 by jacques_liao

Before investigating further, can you try renaming the model (not the model file, the model itself in sequelize) and providing the table name manually to sequelize?

sequelize.define('NvContracts', {
  // ... (attributes)
}, {
  tableName: 'contracts'
});

You should then be able to create the route file by copy pasting another one and using search & replace.

Also, I’m seeing that both of your database connections are named ‘anythingelse’.
I think that they should have different names.

Hello @romaing

so in the model contracts I have replaced it like this

and I have modified the name for the database connection

and is there anything to modify in the routes folder of the corresponding file? here I have for example the file contracts do I have to change the

const permissionMiddlewareCreator = new PermissionMiddlewareCreator('contracts');
with
const permissionMiddlewareCreator = new PermissionMiddlewareCreator('NvContracts');
?

Thank you in advance!

I tried and that was what needed to be changed and for the files in the route folder there was no need to modify
Thank !