CORE-5386 Fix for NULL ids in app_categories.
CORE-5386 Consolidated PRIMARY KEY constraints.

Moved all PRIMARY KEY constraint definitions into 99_constraints.sql file.
This allows the conversion to drop all constraints and add the correct ones back using this SQL file.
CORE-5386 Added duplicate ID clean-up.

Implemented @dennisroberts71 fix for collaborators.