1038350- Fixed a CV foreign key migration issue

Handled the case where changeset was associated with a CV
and then changeset deleted. Upgrade causes FK violation.
Fix for additional CV migration issues

One of the issues while migrating from 1.3 to 1.4 was that content view
delete in 1.3 was leaving bad data causing foreign key migration to
break. This has now been fixed with this commit.
Merge pull request #3464 from parthaa/migration-fix

1038350- Fixed a CV foreign key migration issue