I have been trying to clean up portals that are no longer needed on our servers. Some of them delete ok but most of them don't and fail with the following database exception:
DotNetNuke.Services.Exceptions.ModuleLoadException: DELETE statement conflicted with COLUMN REFERENCE constraint 'FK_Categories_Portals'. The conflict occurred in database 'dotnetnuke', table 'Categories', column 'PortalId'. The statement has been terminated. ---> System.Data.SqlClient.SqlException: DELETE statement conflicted with COLUMN REFERENCE constraint 'FK_Categories_Portals'. The conflict occurred in database 'dotnetnuke', table 'Categories', column 'PortalId'. The statement has been terminated. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) 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.DeletePortalInfo(Int32 PortalId) at DotNetNuke.Entities.Portals.PortalController.DeletePortalInfo(Int32 PortalId) at DotNetNuke.Modules.Admin.PortalManagement.SiteSettings.cmdDelete_Click(Object sender, EventArgs e)
--- End of inner exception stack trace ---
Why is this? I've seen this happen with other instances of DNN as well and it's really annoying because you end up with orphan portals that you can't get rid of without going into clean out using Enterprise manager.
JB