Missing core Database Constraint
Missing core Database Constraint
Description
When calling http://<INSTANCE_HOSTNAME>/coveo/rest, you get this error:
Cannot insert the value NULL into column 'ID', table '<INSTANCE_HOSTNAME>_core.dbo.Properties';
column doesn’t allow nulls.
INSERT fails.
You also get the same result if you open the database <INSTANCE_HOSTNAME>_core in SQL Studio and perform this query:
INSERT INTO [dbo].[properties] ([dbo].[key], [dbo].[value]) VALUES ('TestKey', 'Test Value')
Explanation
There’s a constraint missing in the dbo.Properties table of <INSTANCE_HOSTNAME>_core database.
Resolution
Recreate the constraints in your Sitecore database.
The simplest way is to run the following query in your <INSTANCE_HOSTNAME>_core database:
USE [<INSTANCE_HOSTNAME>_core]
GO
ALTER TABLE [dbo].[Properties] ADD CONSTRAINT [DF_Properties_ID] DEFAULT (newid()) FOR [ID]
GO
Where you replace [<INSTANCE_HOSTNAME>_core] with the name of your core database.