In an effort to help provide further information, I just upgraded a small 4.9.2 install to the 5.1 official release and received the same error as the original poster of this message thread. The contents of my log file that it said to reference is below:
System.Data.SqlClient.SqlException: Table '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.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.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_EventLogMaster'))
ALTER TABLE dbo.EventLog
DROP CONSTRAINT PK_EventLogMaster
ALTER TABLE dbo.EventLog
ADD LogEventID bigint NOT NULL IDENTITY (1, 1)
ALTER TABLE dbo.EventLog
ADD CONSTRAINT PK_EventLogMaster PRIMARY KEY CLUSTERED ( LogEventID )
END