Error on Getting Latest Version after adding new column

A SQL Server Management Studio add-in to source control your database in Subversion or Team Foundation Server.

Moderators: Chris Auckland, David Atkinson, sherr, PhilScrace

Error on Getting Latest Version after adding new column

Postby alibulut2006 » Thu Dec 23, 2010 3:08 pm

I am getting these warnings while getting lastest version and then it fails with below error while applying changes to database step. What should I do ?

Cannot insert the value NULL into column 'DeviceId', table 'TestForRG.dbo.tmp_rg_xx_DemDeviceType'; column does not allow nulls. INSERT fails.

Warnings :
Severity: High
Object: DemDeviceType
Title: The column [DeviceDtcId] on table [dbo].[DemDeviceType] must be added but has no default and does not allow NULL values. The table must be rebuilt. If the table contains data then the migration script will not work. To avoid this, add a default to the column or mark it as allowing NULL values.
----------------------------------------------------
Severity: High
Object: DemDeviceType
Title: The column [DeviceDtfId] on table [dbo].[DemDeviceType] must be added but has no default and does not allow NULL values. The table must be rebuilt. If the table contains data then the migration script will not work. To avoid this, add a default to the column or mark it as allowing NULL values.
----------------------------------------------------
Severity: High
Object: DemDeviceType
Title: The column [DeviceId] on table [dbo].[DemDeviceType] must be added but has no default and does not allow NULL values. The table must be rebuilt. If the table contains data then the migration script will not work. To avoid this, add a default to the column or mark it as allowing NULL values.
----------------------------------------------------
Severity: High
Object: DemDeviceType
Title: The column [DeviceName] on table [dbo].[DemDeviceType] must be added but has no default and does not allow NULL values. The table must be rebuilt. If the table contains data then the migration script will not work. To avoid this, add a default to the column or mark it as allowing NULL values.
----------------------------------------------------
Severity: Medium
Object: DemDeviceType
Title: Column [DtyDtcId] on table [dbo].[DemDeviceType] could not be matched to a column in the source table. The data in this column will be lost.
----------------------------------------------------
Severity: Medium
Object: DemDeviceType
Title: Column [DtyDtfId] on table [dbo].[DemDeviceType] could not be matched to a column in the source table. The data in this column will be lost.
----------------------------------------------------
Severity: Medium
Object: DemDeviceType
Title: Column [DtyId] on table [dbo].[DemDeviceType] could not be matched to a column in the source table. The data in this column will be lost.
----------------------------------------------------
Severity: Medium
Object: DemDeviceType
Title: Column [DtyName] on table [dbo].[DemDeviceType] could not be matched to a column in the source table. The data in this column will be lost.
----------------------------------------------------
Ali Bulut
Senior Database Administrator & Project Manager
a.bulut@triodor.eu
alibulut2006
 
Posts: 17
Joined: Thu Dec 23, 2010 2:56 pm
Location: 218

Postby David Atkinson » Thu Dec 23, 2010 11:27 pm

You are trying to 'get' a column that is set to NOT NULL so the script will fail due to it not knowing how to populate the column's data as your local table has existing data.

What might be worth doing is to edit the table in source control and set the column to allow null values? Or you can remove the data in your dev DB, although this could be problematic. Alternatively you'd need to make the change manually rather than relying on 'get latest'.

We hope to improve the user experience for this in future. Can I ask you how you'd like the software to behave in this instance?

David Atkinson
Red Gate Software
David Atkinson
 
Posts: 1124
Joined: Mon Dec 05, 2005 4:54 pm
Location: Twitter: @dtabase

Postby alibulut2006 » Tue Dec 28, 2010 12:30 pm

Hi David;
Thanks for your explanations. I think you are right. We can'T manage this stiuation "automatically".. When we try same case empty table; we didn'T have any error about NULL data. So; it seems we have to manage manually this case in our database development process. Or; we have to indicate "default value" for this column while creating.

Thanks and Regards.
Ali Bulut
Senior Database Administrator & Project Manager
a.bulut@triodor.eu
alibulut2006
 
Posts: 17
Joined: Thu Dec 23, 2010 2:56 pm
Location: 218

Postby David Atkinson » Tue Dec 28, 2010 11:22 pm

We're considering a feature that:

1) will prompt users for a default value when it detects this scenario
2) will allow the user to commit their own script that would be used when another user does 'get latest' on that specific change.

Any feedback on these ideas would be welcome.

David
David Atkinson
 
Posts: 1124
Joined: Mon Dec 05, 2005 4:54 pm
Location: Twitter: @dtabase


Return to SQL Source Control 1

Who is online

Users browsing this forum: No registered users and 0 guests