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
|
Hello, I find that every time I try to use the update database feature in the designer it will attempt to remove and re-add columns relating to foreign keys. This usually fails and leaves the database in an unusuable state but running another update generally fixes things up again. My guess is that the failure is due to the order that the update commands are applied to the database but the real question is why these operations are being attempted at all when there have been no changes to those parts of the Entity model? For example: Asset table "Add column AssetId and associated foreign key to table AssetFile" AssetFile table "Delete column AssetId" This results in "Duplicate column name 'AssetId'" and the removal of the "AssetId" column.
Have I configured my model incorrectly or is this a known limitation? Thanks, Chris |
|
|
My guess would be that the AssetId column may not have a foreign key. This confuses the designer because it sees that the model has an association which isn't present in the database (so it needs to create a FK column), whereas the database has a plain old integer column that isn't represented in the model (so it needs to delete that column). It doesn't (yet) figure out, "ah, but that plain old integer column happens to be exactly the one that the association would be represented by, so actually everything does match up after all." (This is a known problem for databases that have limited FK support, and one that we would like to address at some point, because the LightSpeed runtime doesn't actually require FKs; we only actually use them as designer hints.) Try setting the appropriate FK on the AssetId column via your MySQL administration tool and see if that fixes the situation. If not (or if the FK is already set), could you send us the CREATE TABLE statements for the two tables, and your .lsmodel file, and we will investigate. Thanks! |
|
|
Thanks for the suggestions Ivan, it got me looking in the right area. The actual cause of the problem was that I had a mixture of identity types and some had been changed in lsmodel and not the database (I must have previously missed the error message telling me that LightSpeed is unable to apply those changes automatically). I suspect that just manually tidying the database column types so they matched the lsmodel would have fixed the problem but I actually wanted to rebuild the whole database from scratch anyway to verify the current model can be neatly set-up in an empty database. So it's all fixed now and in answer to my original question, it was a problem in my model :-) Chris |
|