Hi,
The problem I have is that LogEventID is type int in one table (EventLog) and with version 07.04.00 bigint in another table (ExceptionEvents). So the Foreign Key does not match in type:
Current Version - 07.03.04
Upgrade - Version 07.04.00
18:34 Minutes | 25% ERROR occured - System.Data.SqlClient.SqlException (0x80131904): Column 'dbo.EventLog.LogEventID' is not the same data type as referencing column 'ExceptionEvents.LogEventID' in foreign key 'FK_ExceptionEvents_LogEventId'. Could not create constraint or index. See previous errors. at System.Data.SqlClient.SqlConnection. (SqlException exception, Boolean breakConnection, Action`1 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) ClientConnectionId:59a7cee2-021b-41ea-a421-e85d9ba6b443 Error Number:1778,State:0,Class:16 IF NOT EXISTS (SELECT * FROM sys.foreign_keys WHERE name = 'FK_ExceptionEvents_LogEventId' AND parent_object_id = OBJECT_ID(N'dbo.[ExceptionEvents]')) BEGIN ALTER TABLE dbo.[ExceptionEvents] WITH CHECK ADD CONSTRAINT [FK_ExceptionEvents_LogEventId] FOREIGN KEY([LogEventID]) REFERENCES dbo.[EventLog] ([LogEventID]) ON DELETE CASCADE END
I tried this:
ALTER TABLE EventLog
ALTER COLUMN [LogEventID] bigint NOT NULL
GO
However, it is not that easy, there are errors :
Msg 5074, Level 16, State 1, Line 2
The object 'PK_EventLogMaster' is dependent on column 'LogEventID'.
Msg 5074, Level 16, State 1, Line 2
The index 'IX_EventLog_LogConfigID' is dependent on column 'LogEventID'.
Msg 4922, Level 16, State 9, Line 2
ALTER TABLE ALTER COLUMN LogEventID failed because one or more objects access this column.
So the job would be to 1. delete these keys and indexes, 2. alter to bigint and 3. recreate the keys again, right? I don't know if I am doing something wrong during the upgrade, there are bugs in the script, or my sql server is to sensitive. I use 2014.