2 schema with same named tables

Posts   
 
    
Aranius
User
Posts: 3
Joined: 07-May-2019
# Posted on: 07-May-2019 21:36:54   

Hi,

I have two schemas with nearly the same tables. I want to generate a model for the whole database so that the model will have some prefix based on the schema.

Right now it will generate classes like "Table_with_same_name1" "Table_with_same_name2". I would like to set something like "Dev.Table_with_same_name", "Prod.Table_with_same_name".

Could you help me to point out how to configure it?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 08-May-2019 06:27:33   

Hi Aranius,

To make this possible you could use Entity Model element grouping. You have to set the Group Usage project setting to AsSeparateProjects then add all the tables in schema A to model group Dev, and all tables in schema B to model group Prod. LLBLGen Pro will generate code for each group separately, instead of once for the whole project.

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39747
Joined: 17-Aug-2003
# Posted on: 08-May-2019 09:42:04   

Another is to create a model for 1 schema and use schema name/catalog name overwriting at runtime (if you're using our runtime simple_smile ), see: https://www.llblgen.com/Documentation/5.5/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/gencode_applicationconfiguration.htm#catalog-name-overwriting-sql-server-mysql

It's not clear what you want to do with the 2 schemas, although from the names you want to use it looks like you have a developer environment and a production environment, and want to switch between them, but I could be wrong

Frans Bouma | Lead developer LLBLGen Pro
Aranius
User
Posts: 3
Joined: 07-May-2019
# Posted on: 08-May-2019 13:35:40   

daelmo wrote:

...

Thank you very much for your insight!

Aranius
User
Posts: 3
Joined: 07-May-2019
# Posted on: 08-May-2019 14:15:28   

Otis wrote:

It's not clear what you want to do with the 2 schemas, although from the names you want to use it looks like you have a developer environment and a production environment, and want to switch between them, but I could be wrong

It was as an example. I have a temporary database that is right now build up with data as the data are migrated from an old system.

The second database will be used as base for the new system. Data from temporary DB will be needed to be moved/transformed to the new DB. Most of the tables will be copied 1:1, but some will need to be adapted.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39747
Joined: 17-Aug-2003
# Posted on: 08-May-2019 14:31:03   

ah simple_smile That would indeed mean you should use the two groups and two catalogs as indeed entities can differ.

Frans Bouma | Lead developer LLBLGen Pro