Control DDL code generated in "model first" mode

Posts   
 
    
mds avatar
mds
User
Posts: 33
Joined: 24-Sep-2006
# Posted on: 20-Oct-2010 12:19:17   

Hi I'm trying the new feature of version 3.0 "Generate database schema create script" and i've notice that the name assigned to primary keys or foreign keys are generated as "PK_[i]nnnnnnnnnn[/i]"..

Is there a way to control this name ? Some setting where i can specify "For primary key name use PK{EntityName} " ? or "For foreign key name use FK{EntityName}_{RelatedEntityName}" ?

Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39905
Joined: 17-Aug-2003
# Posted on: 20-Oct-2010 12:48:45   

No, it's an artificial name. the reasoning behind it is that for some databases the names can't exceed 30 characters, and staying inside the 30 characters and be able to produce a unique name (which is unique for all elements inside the DB, so also for elements which are in the schema but not imported/unknown to the designer), is not really doable, if you're using names from entities and fields (you quickly exceed 30 characters).

It's also not really possible to define a unique name for FK constraints without knowing all FK constraints in a schema, but not all Fk constraints can be available to you in the relational model data, even with working model first, as the real database schema might contain other Fk constraints already, created by others. Hence the artificial names, to make sure the schema script runs.

For PK constraints, these are not really that important, as you don't refer to them in scripts, they're used for when the PK has to be dropped. Why would you want to have a real name for the PK constraint name? (which sometimes are created by the db or aren't available in constraint form)

Frans Bouma | Lead developer LLBLGen Pro
mds avatar
mds
User
Posts: 33
Joined: 24-Sep-2006
# Posted on: 20-Oct-2010 14:21:57   

It's not a very important features... usually I use a mnemonic name for these constraint to easily write script that change db structure when necessary ...

Thank's for rapid reply ... (i'll stop my search wink ).