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.
    image 856×404 59.2 KB

    For the models I put in the new folder nv all the tables we needed.
    image 402×780 46.3 KB

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

    Our code in the databases.js file
    image 2068×860 109 KB
    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.

    image1230×806 89.2 KB

    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');
    const permissionMiddlewareCreator = new PermissionMiddlewareCreator('NvContracts');
    image2516×928 408 KB

    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 !