New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the Community Exchange, where community members ask and answer questions about DNN. To get started, just start typing your question below and either select one of the suggested questions or ask a new question of your own.

Error updating from 5.04.04 to 5.06.08 in log 5.06.00

Return to previous page

  • 11/25/2014
  • 1952 Views

Question:

Eilif Johannsen long time ago

When updating as above i got an error in 5.6.0:

I replaced the actual database with xxxxx

System.Data.SqlClient.SqlException: The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_ModuleControls_ModuleDefinitions". The conflict occurred in database "xxxxx", table "dbo.ModuleDefinitions", column 'ModuleDefID'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at DotNetNuke.Data.SqlDataProvider.ExecuteADOScript(String SQL)
at DotNetNuke.Data.SqlDataProvider.ExecuteScript(String Script, Boolean UseTransactions)



/* DNN-13285 - Clustered Primary Key for ModuleDefinitions */
/*************************************************************/

if not exists (select * from dbo.sysobjects where id = object_id(N'PK_ModuleDefinitions') and OBJECTPROPERTY(id, N'CnstIsClustKey') = 1)
begin
alter table dbo.[Modules]
drop constraint FK_Modules_ModuleDefinitions

alter table dbo.[ModuleControls]
drop constraint FK_ModuleControls_ModuleDefinitions

alter table dbo.[ModuleDefinitions]
drop constraint PK_ModuleDefinitions

alter table dbo.[ModuleDefinitions]
add constraint PK_ModuleDefinitions
primary key clustered (ModuleDefID asc ) on [PRIMARY]

alter table dbo.[ModuleControls]
add constraint FK_ModuleControls_ModuleDefinitions
foreign key ( ModuleDefID ) references dbo.[ModuleDefinitions] ( ModuleDefID )
on update no action
on delete cascade

alter table dbo.[Modules]
add constraint FK_Modules_ModuleDefinitions
foreign key ( ModuleDefID ) references dbo.[ModuleDefinitions] ( ModuleDefID )
on update no action
on delete cascade
en

I ran the sql "select * from dbo.sysobjects where id = object_id(N'PK_ModuleDefinitions') and OBJECTPROPERTY(id, N'CnstIsClustKey') = 1"

And got a result, so dont understand why I got an error when acording to the "if not exists" then is should not try to alter anything.

1: Do I need to do anything to correct this
2: do I need to run the rest of the 5.06.00.SqlDataProvider file manually ?

Error updating from 5.04.04 to 5.06.08 in log 5.06.00

Eilif Johannsen
Eilif Johannsen long time ago
Add an Answer

Answers

Sign In to Participate
Or register to become a member