Do not delete indexes if they are needed for foreign keys
When changing a custom field from searchable to not searchable, CiviCRM tries to remove the index. This causes a fatal error when the column is also a foreign key to another table because the index is needed for the foreign key.
We ensure that the column is not an FK before removing the index
I added a test to CustomFieldTest which exercises this functionality