When generating migrations from code-first, Down() is always generated to first drop indexes, then foreign keys and then tables. This causes a problem with some rdbms which require an index on the foreign key column for the foreign key to operate. Therefore the drop order should be modified to drop foreign keys before dropping indexes.
↧