Error on Getting Latest Version after adding new column

alibulut2006alibulut2006 Posts: 25
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
[email protected]

Comments

  • 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
    Product Manager
    Redgate Software
  • 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
    [email protected]
  • 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
    Product Manager
    Redgate Software
Sign In or Register to comment.