We develop a module which has some FKs to the "Modules" table (and some the "Portals" table too).
In DNN 4 everything was OK, but since DNN 5.0, including the current 5.2 we have a problem when uninstalling the module ("UnInstall Package" on the Host > Module Definitions page).
The error is (it includes DNN 5.2 symbols information):
Failure |
ExceptionSystem.Data.SqlClient.SqlException: The DELETE statement conflicted with the REFERENCE constraint "FK_dnn5_Interzoic_LMS_Attempt_dnn5_Interzoic_LMS_Category". The conflict occurred in database "dnn520", table "dbo.dnn5_Interzoic_LMS_Attempt", column 'CategoryId'. The statement has been terminated. 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.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(SqlConnection connection, CommandType commandType, String commandText, SqlParameter[] commandParameters) at Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, SqlParameter[] commandParameters) at Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String connectionString, String spName, Object[] parameterValues) at DotNetNuke.Data.SqlDataProvider.DeleteDesktopModule(Int32 DesktopModuleId) at DotNetNuke.Entities.Modules.DesktopModuleController.DeleteDesktopModule(DesktopModuleInfo objDesktopModule) in M:\CCNet_Builds\DotNetNuke_5_Maintenance\WorkingDirectory\Library\Entities\Modules\DesktopModuleController.vb:line 436 at DotNetNuke.Services.Installer.Installers.ModuleInstaller.DeleteModule() in M:\CCNet_Builds\DotNetNuke_5_Maintenance\WorkingDirectory\Library\Services\Installer\Installers\ModuleInstaller.vb:line 93 |
...
...
Warning |
Uninstalled with Warnings - Interzoic.AccordLMS.Manager |
EndJob |
Uninstalled with Warnings
|
this would be when:
Dim controller As New DesktopModuleController
controller.DeleteDesktopModule(tempDesktopModule)
which is:
dataProvider.DeleteDesktopModule(objDesktopModule.DesktopModuleID)
which is:
SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DeleteDesktopModule", DesktopModuleId)
which is:
DELETE FROM {databaseOwner}{objectQualifier}Permission
WHERE moduledefid in
(SELECT moduledefid
FROM {databaseOwner}{objectQualifier}ModuleDefinitions
WHERE desktopmoduleid = @DesktopModuleId)
DELETE FROM {databaseOwner}{objectQualifier}DesktopModules
WHERE DesktopModuleId = @DesktopModuleId
Besides the problem, which is a "warning", all the database objects are cleaned from the database. No trace is left behind. The module's Uninstall.SqlDataProvider is OK and has no error.
The problem is NOT in this specific module's FK or table. I've tried a lot of things, and the only way to avoid this warning and get a "clean" uninstall log is in advance manually deleting ALL the module's FKs related with the "Modules" table.
It also work fine when I in advance manually run (from Host > SQL) the module's Uninstall.SqlDataProvider. Therefore, as said, the problem is NOT in Uninstall.SqlDataProvider.
Conclusion?:
Is the core logic first removing the module from its core tables (DesktopModules, Modules,...) and later it runs the module's Uninstall.SqlDataProvider?
Should it have been the other way?. First run the Uninstall.SqlDataProvider and then remove from DesktopModules, etc., right?
Whatever, how can I solve this problem? This warning/error doesn't looks well and gives a bad impression (and unwanted support calls...)
Should I remove all the FKs to the Modules table? This would be wrong, right? Isn't normal to have FKs to the Modules table?
Thoughts / suggestions / solutions?
Thanks,
Horacio.-