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 ?