Database Schema Update Script

Posts   
 
    
jg
User
Posts: 25
Joined: 29-Dec-2011
# Posted on: 29-Dec-2011 20:19:49   

I upgraded to LLBLGen 3.1 last week and I noticed that the validation is stricter than 2.6. I had to make a few adjustments, but nothing major. When I tried to Refresh the Relational Model Data from the Database, it said that I had some pending changes and gave me a Database Schema Update Script to run on our database to bring it into sync with the designer.

That makes sense to me because I did make changes, however not all the changes in that script seem to be related to things that I changed. There are several tables that the update script is trying to add the identity property to the Primary Key field. Our application is huge and those tables have been around for years and I have no idea where those tables are used in our legacy code or why they don't have the identity property set.

My question is essentially this: Do I have to add the identity property to those fields? If so, why? If not, why does the LLBLGen designer think I do?

Here is a simplified version of the script for just one table:

ALTER TABLE [dbo].[ActivityLink] DROP CONSTRAINT [PK_72d0ad741b5a0f6d307b2c0e9ce]

ALTER TABLE [dbo].[ActivityLink] 
    ALTER COLUMN [ActivityLinkID] [int] IDENTITY (1,1) NOT NULL

ALTER TABLE [dbo].[ActivityLink] WITH NOCHECK 
    ADD CONSTRAINT [PK_72d0ad741b5a0f6d307b2c0e9ce] PRIMARY KEY CLUSTERED 
    ( 
        [ActivityLinkID] 
    ) ON [PRIMARY]

LLBLGen Pro v3.1 Build: September 30th, 2011 We use SQL Server 2008

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 30-Dec-2011 09:25:31   

Is there a Sequence assigned to these fields? Got to "Edit Entity", then go to the "Field mappings" tab.

jg
User
Posts: 25
Joined: 29-Dec-2011
# Posted on: 30-Dec-2011 17:33:55   

Yes. It says Scope_Identity().

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 30-Dec-2011 23:58:54   

It looks like you modified something in that field, maybe the name or something. Or you add the identity property. The update generates that for a reason. To be completely sure, you have to inspect the project before the changes and then the project after the changes. LLBLGen generates a backup copy for security every time you try to refresh the catalog.

Also, some entity/field changes produce (or trigger) another related entity/field change in special situations. There is a dock-tab in the bottom of the Designer windows called "Command queue contents", open it and enable "Real time tree updates". Then do your changes, that tree shows you the actual changes that are made in the objects. Maybe that would help to find the reason behind this. In short, we need more info about the scenario, would be helpful if you reduce the project to some few entities and post that file and let us know the steps to reproduce the behavior.

David Elizondo | LLBLGen Support Team
jg
User
Posts: 25
Joined: 29-Dec-2011
# Posted on: 17-Jan-2012 17:54:49   

Ok. That's gave me enough to figure it out. Thanks guys.