[1.7.x] Added database migration for contrib.contenttypes.

Moved contenttypes tests to allow them to run correctly in the presence of
migrations. refs #22170.

Backport of eb8600a656 from master