[OE-3987] migration foreign key bugfixes
[OE-3987] table versioning migration foreign key fixes
[OE-3987] tweaks to verifyversiontables command script
Merge branch 'develop' into jira/3987