Constraint Error in DNN

Oct 24, 2015 at 8:05 PM
Running dnn 7.4.2 ran version I of TurboScripts and have this constraint error for Active Forums

System.Data.SqlClient.SqlException (0x80131904): The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_activeforums_ForumTopics_activeforums_Replies". The conflict occurred in database "423345_rheebo_2008", table "dbo.activeforums_Replies", column 'ReplyId'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource
1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at DotNetNuke.Data.SqlDataProvider.ExecuteScriptInternal(String connectionString, String script)

-- drop AF foregn keys with known issues:
IF EXISTS (SELECT * FROM Sys.Foreign_Keys WHERE Parent_Object_id = OBJECT_ID(N'dbo.[activeforums_ForumTopics]')
                         AND name = N'FK_Journal_Data_activeforums_ForumTopics_activeforums_Replies')
ALTER TABLE dbo.[activeforums_ForumTopics] 
 DROP CONSTRAINT [FK_activeforums_ForumTopics_activeforums_Replies]
-- make sure, all constraints are enabled
Oct 27, 2015 at 10:09 AM
Thanks, I'll have a look. I noticed on a longtime DNN that Active Forum has a couple of non-enforced FK constraints, this one caused issues, due to FK violations
Oct 27, 2015 at 5:05 PM
fixed in revision m
Marked as answer by leupold on 10/27/2015 at 9:05 AM