Fix problems with deleted foreign keys

Improve support for deleting foreign keys which have been removed, but
are for columns which have not changed.
Refactor code for generating up migration for changed tables - find the
old table once, instead of every time it's needed.