"I did have to manually add identity on ID column in mp_SchemaScriptHistory table - before database upgrade did not work."
That tells me you did something wrong. You tried to make a backup of the database by importing objects into a new database, that does not work. It results in losing all the primary keys, foreign keys, indexes, and default values, which will cause many errors.
My conclusion is your database is in an unknown state that is not correct for the version of the code.
your error happened at
mojoPortal.Data.DBModuleDefinition.UpdateModuleDefinitionSetting
which calls the stored procedure mp_ModuleDefinitionSettings_Update
which should look like this:
ALTER PROCEDURE [dbo].[mp_ModuleDefinitionSettings_Update]
@ModuleDefID int,
@SettingName nvarchar(50),
@SettingValue nvarchar(max),
@ControlType nvarchar(50),
@RegexValidationExpression nvarchar(max),
@FeatureGuid uniqueidentifier,
@ResourceFile nvarchar(255),
@ControlSrc nvarchar(255),
@HelpKey nvarchar(255),
@SortOrder int,
@GroupName nvarchar(255)
AS
IF NOT EXISTS (
SELECT
*
FROM
mp_ModuleDefinitionSettings
WHERE
(ModuleDefID = @ModuleDefID OR FeatureGuid = @FeatureGuid)
AND
SettingName = @SettingName
)
INSERT INTO mp_ModuleDefinitionSettings (
FeatureGuid,
ModuleDefID,
ResourceFile,
SettingName,
SettingValue,
ControlType,
RegexValidationExpression,
ControlSrc,
HelpKey,
SortOrder,
GroupName
)
VALUES (
@FeatureGuid,
@ModuleDefID,
@ResourceFile,
@SettingName,
@SettingValue,
@ControlType,
@RegexValidationExpression,
@ControlSrc,
@HelpKey,
@SortOrder,
@GroupName
)
ELSE
UPDATE
mp_ModuleDefinitionSettings
SET
FeatureGuid = @FeatureGuid,
SettingValue = @SettingValue,
ControlType = @ControlType,
RegexValidationExpression = @RegexValidationExpression,
ResourceFile = @ResourceFile,
ControlSrc = @ControlSrc,
HelpKey = @HelpKey,
SortOrder = @SortOrder,
GroupName = @GroupName
WHERE
(ModuleDefID = @ModuleDefID OR FeatureGuid = @FeatureGuid)
AND
SettingName = @SettingName
GO