Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...module Uninstalled w/Warnings. How DNN uninstall a module / when Uninstall.SqlDataProvider is run?module Uninstalled w/Warnings. How DNN uninstall a module / when Uninstall.SqlDataProvider is run?
Previous
 
Next
New Post
12/16/2009 12:29 PM
 

Hello,

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.-

 

 

 

 

 

 

 

 
New Post
12/16/2009 5:06 PM
 

No replies and I think it's a bug, so, posting in Gemini: http://support.dotnetnuke.com/issue/ViewIssue.aspx?id=11277&PROJID=2

or should we remove all FKs to the Modules (and Portals) table?

 
New Post
12/16/2009 5:27 PM
 

Hi Horacio, it's hard to tell without seeing your SQL schema, but the name of the FK implies that it's failing because it's trying to delete a Category when it has a linked Attempt. Since this is firing when you're deleting modules, my best guess is that the module delete is cascading to the Category table, but that the FK to the Attempt table doesn't have ON DELETE CASCADE.

 
New Post
12/16/2009 6:42 PM
 

Please note that creating relations on core tables is NOT best practice, it may brake core upgrades and fail on future core versions.

According to unwritten developers guidelines, you should avoid any modification on core database objects and refer to business layer only.


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
12/17/2009 9:10 AM
 

 

Sebastian Leupold wrote
Please note that creating relations on core tables is NOT best practice, it may brake core upgrades and fail on future core versions.
 
According to unwritten developers guidelines, you should avoid any modification on core database objects and refer to business layer only.
 
No FK was added to any core table.
The FKs are in our tables, referencing the module or portal where the data is living. This is to delete data turn into invalid data if the portal or module where the data is living is deleted. I thought that was the proper practice. Am I wrong? Should we avoid/delete these FKs? Which would be the proper way to do this? Or the problem is just that the DNN core module's uninstalled should run the module's unsintall.sqldataprovider before deleting from the desktopmodules (and cascaded tables)?
 
Some sample FKs we have:
 
ALTER TABLE {databaseOwner}[{objectQualifier}Interzoic_LMS_COType] WITH NOCHECK
ADD CONSTRAINT [FK_{objectQualifier}Interzoic_LMS_COType_{objectQualifier}Portals] 
FOREIGN KEY ([PortalID]) 
REFERENCES {databaseOwner}[{objectQualifier}Portals] ([PortalID]) 
ON DELETE CASCADE NOT FOR REPLICATION
 
ALTER TABLE {databaseOwner}[{objectQualifier}Interzoic_LMS_COType] WITH NOCHECK
ADD CONSTRAINT [FK_{objectQualifier}Interzoic_LMS_COType_{objectQualifier}Modules] 
FOREIGN KEY ([ModuleId]) 
REFERENCES {databaseOwner}[{objectQualifier}Modules] ([ModuleID]) 
ON DELETE CASCADE NOT FOR REPLICATION
 

 

 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...module Uninstalled w/Warnings. How DNN uninstall a module / when Uninstall.SqlDataProvider is run?module Uninstalled w/Warnings. How DNN uninstall a module / when Uninstall.SqlDataProvider is run?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out