This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, it seems that foreign keys for the primary keys with inheritance are not included within the migrations. For an example use a model with two classes and "ClassTableInheritance" and create the migrations. Can you please add them. Regards, Dennis |
|
|
Do you mean you want a foreign key constraint between the Id columns of derived and base tables, e.g. each derived table Id column references the base table Id column? If so, that is not currently supported in LightSpeed due to SQL ordering considerations for cascade deletes. |
|
|
Exactly. It would really help us to have these in the database as other (possibly non LightSpeed-based) applications will access the database. Furthermore it would ensure consistent db entries. Thanks, Dennis |
|
|
We understand the motivation. However, ordering considerations mean that FKs, if present, must be parent-to-child which is not the way most customers expect (and we believe that sometimes we may have to vary the ordering so that even parent-to-child FKs are not sustainable, though we think this wouldn't be an issue in your case). Until we can resolve this discrepancy we do not want to commit to a particular path with all the forward compatibility implications that entails. You can add FKs yourself by editing the migration script after generation (use the ExecuteNativeCommand method to emit an ALTER TABLE), or automate the process by implementing IMigrationGenerationExtender in a design-time assembly (we haven't produced docs for this yet but I can write it up if you want to go that route). |
|