diff options
author | Yves Senn <yves.senn@gmail.com> | 2015-02-11 11:09:29 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2015-02-11 11:20:59 +0100 |
commit | a893718c3165aa6ef6b2b500f7922954ba21eb02 (patch) | |
tree | cbc8692b54f5b6f72040000bfd6bf78d16b5bf9a /activerecord/lib/active_record/table_metadata.rb | |
parent | 9bdb083dba0778f47866fa440476b3141716de52 (diff) | |
download | rails-a893718c3165aa6ef6b2b500f7922954ba21eb02.tar.gz rails-a893718c3165aa6ef6b2b500f7922954ba21eb02.tar.bz2 rails-a893718c3165aa6ef6b2b500f7922954ba21eb02.zip |
fix `remove_reference` with `foreign_key: true` on MySQL. #18664.
MySQL rejects to remove an index which is used in a foreign key constraint:
```
ActiveRecord::StatementInvalid: Mysql2::Error: Cannot drop index 'index_copies_on_title_id': needed in a foreign key constraint: ALTER TABLE `copies` DROP `title_id`
```
Removing the constraint before removing the column (and the index) solves this problem.
Diffstat (limited to 'activerecord/lib/active_record/table_metadata.rb')
0 files changed, 0 insertions, 0 deletions