Fix the way migration helpers check FK names.

The current check for FK names is unsfafe due to the order
of checks - this patch resolves this.

Since FKs are not supported as part of standard database used for
unit tests (sqlite), there is no unit test for this change. This
change has been tested (and required) with MySQL and Postgres in the
following on patch (https://review.openstack.org/#/c/130954/)

Change-Id: I77ab359b4018e49de0afbef1f6e137d9080bdc26
Closes-bug: 1398470