Extra property in dbo.Customer

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
I'm trying to add a newproperty to dbo.Customer. I changed already Customer.cs and CustomerMap.cs. When I try to add  a new column in dbo.Customer in SQL Server I get a message

'Customer' table
- Unable to modify table.  
Cannot insert the value NULL into column 'ClientNumber', table 'NopTest.dbo.Tmp_Customer'; column does not allow nulls. INSERT fails.
The statement has been terminated.

How I can resolve this problem?
7 years ago
This is an SQL error. You are trying to add a new column "ClientNumber", which is non-nullable.

SQL doesn't know what value to insert there, if you have already existing records. So you either need to specify a default value (link here: http://stackoverflow.com/questions/92082/add-a-column-with-a-default-value-to-an-existing-table-in-sql-server) or to add the column as nullable (so default value is null)
7 years ago
Make the column nullable or set a default value for it.

edit: yeah, what nop-payments just said.
7 years ago
(Consider instead using a Generic Attribute, otherwise when you upgrade in the future it could be more difficult ;)
7 years ago
Yes!!!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.