I was upgrading to DNN 5.1.0. The entire upgrade process was successful except for the SqlDataProvider upgrade to 05.01.00. I received the following during the upgrade process:
00:00:10.827 - Executing Script: 05.01.00.SqlDataProvider Error! (see 05.01.00.log for more information)
...
00:01:09.326 - Executing Application Upgrades: 05.01.00 Error!
When I looked in the 05.01.00.log file, I discovered the following:
System.Data.SqlClient.SqlException: Table 'PSRB_EventLog' already has a primary key defined on it.
Could not create constraint. See previous errors.
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)
/* Change primary key of EventLog Table */
/****************************************/
IF NOT EXISTS (SELECT 1 FROM INformATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'dbo.PSRB_EventLog' AND COLUMN_NAME = 'LogEventID')
BEGIN
--Note this name does NOT have an object qualifier in 4.x upgrades
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'PK_EventLogMaster'))
ALTER TABLE dbo.PSRB_EventLog
DROP CONSTRAINT PK_EventLogMaster
--Note this name does have an object qualifier in 5.x installs
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'PK_PSRB_EventLogMaster'))
ALTER TABLE dbo.PSRB_EventLog
DROP CONSTRAINT PK_PSRB_EventLogMaster
ALTER TABLE dbo.PSRB_EventLog
ADD LogEventID bigint NOT NULL IDENTITY (1, 1)
ALTER TABLE dbo.PSRB_EventLog
ADD CONSTRAINT PK_PSRB_EventLogMaster PRIMARY KEY CLUSTERED ( LogEventID )
END
Can anyone please explain how to resolve this error? My DNN site came up fine, even after the error - so I'm not expecting anything too tough to resolve. I did use an object qualifier in my database provider statement ("PSRB") - but that was from the original installation years ago.
Thanks for the help!
Todd Sturner