FixTask00020DeleteOrphanedIdentifiers: update or delete on table "identifier" violates foreign key constraint "fk_htmlpage_ver_info_ident" on table "htmlpage_version_info"
Tested on a client database (postgreSQL) right after their upgrade from 3.2 to 3.6.
Full error can be found here: https://gist.github.com/gabbydotCMS/e8c2cb973c8fafe46a8d59170eb9a4be
I can provide the database dump to reproduce the issue.
Related to changes introduced by this request #9234 which didn't fail when running the fix assets inconsistency tool on 3.5.1.
PR: https://github.com/dotCMS/core/pull/9966
@shaydotcms these are the queries executed by the new fix task (FixTask00015FixAssetTypesInIdentifiers.java) in order to determine whether or not there are inconsistencies to be fixed:
SELECT COUNT() AS count FROM identifier i WHERE EXISTS(SELECT * FROM contentlet WHERE i.id = identifier) AND asset_type <> 'contentlet'; SELECT COUNT() AS count FROM identifier i WHERE EXISTS(SELECT * FROM dot_containers WHERE i.id = identifier) AND asset_type <> 'containers'; SELECT COUNT() AS count FROM identifier i WHERE EXISTS(SELECT * FROM file_asset WHERE i.id = identifier) AND asset_type <> 'file_asset'; SELECT COUNT() AS count FROM identifier i WHERE EXISTS(SELECT * FROM htmlpage WHERE i.id = identifier) AND asset_type <> 'htmlpage'; SELECT COUNT() AS count FROM identifier i WHERE EXISTS(SELECT * FROM links WHERE i.id = identifier) AND asset_type <> 'links'; SELECT COUNT() AS count FROM identifier i WHERE EXISTS(SELECT * FROM template WHERE i.id = identifier) AND asset_type <> 'template';
You should run these queries before and after executing the fix asset inconsistencies process in order to determine whether or not the task is doing what it's supposed to do.
Since the original DB comes from a dotCMS 3.2 instance, remember that the query to check containers is slightly different:
SELECT COUNT(*) AS count FROM identifier i WHERE EXISTS(SELECT * FROM containers WHERE i.id = identifier) AND asset_type <> 'containers';
Let me know if you need any help.
Passed QA. Executed Fix Assets Inconsistencies tool and verified that tasks successfully fixed assets by running the queries provided by @gabbydotCMS Assets count after task returns 0 Tested in latest master-3.7 and 3.7 distribution using a Postgres DB coming from a dotCMS 3.2 instance
port to new 3.7
Merged into master-3.7: https://github.com/dotCMS/core/pull/10421