[migration/3.21] Add missing foreign keys when upgrading
Try to delete dangling relations, since there's no point in keeping
them.
Related to #4846892.
[schema2sql] properly consider skip_relations parameters.
This is the same bug as yams #286912. Also, introducing a unique function
telling if the relation should have a table or not unhide some other problems
related to computed relation, or missing skipped relations information.