cakephp / phinx

PHP Database Migrations for Everyone
https://phinx.org
MIT License
4.46k stars 891 forks source link

Alter key support? #784

Open TiGR opened 8 years ago

TiGR commented 8 years ago

In some conditions keys are not modifiable while you could still modify them using plain sql.

Say you have foreign key. If you want to modify that key by adding another column to the key, you could do it like this way:

ALTER TABLE `records` 
  DROP INDEX `record_types`, 
  ADD UNIQUE `record_types` (`edition_id`, `date`);

However, phinx splits this into two queries and this surely breaks as this key is required and could not be removed.

dereuromark commented 6 years ago

Are you able to provide a pull request with your suggested changes?