How to avoid the creation of foreign key constraints when Entities are mapped from database views

Hello Cuba Team,

I’m developing a new application with Cuba Studio sharing data with a legacy application. I have two databases, the original one of the legacy application and the new one for the Cuba application.
In the database for Cuba application there are views to map data from master tables allocated in the legacy database (customers, products, providers, …).

I’ve created entities from the views with the functionality “Generate Model” of Cuba Studio 6.8.2.

I’ve created new entities that have attributes with association relationship to the entities mapped from database views.

Everytime Cuba Platform need to update database, it generates database scripts for the tables of the new entities created with the creation of a foreign key constraint towards the database view. Obviously, the database server produces an error because there isn’t any table, because it is a view.

Which is the best method to have entities generated from database views to define association relationships between the new entities created by Cuba Studio and avoiding the generation of database scripts with the creation of foreign key constraints towards a databse view?

1 Like

Hi Xavier,

I think it is an obvious defect, we’ll try to fix it in one of the next updates. See https://youtrack.cuba-platform.com/issue/STUDIO-4426