Issue Bug Closed

#50450Drop keys before fields in install tool

Alexander Stehlik 07/26/13, 01:12 updated 10/23/17, 21:47

Description

When a key and the field that is referenced in the key will be removed at the same time in the install tool a database error will occur:

Error: Can't DROP '<key_name>'; check that column/key exists

This is because the install tool will first remove the field and then tries to remove the key which obviously will not work because the referenced field was already deleted.

The solution would be to drop the key before the field.

Steps to reproduce:

  • install phpunit extension
  • update database in install tool
  • uninstall phpunit extension
  • in the install tool rename a phpunit dummy field, e.g.
ALTER TABLE be_groups CHANGE tx_phpunit_is_dummy_record zzz_deleted_tx_phpunit_is_dummy_record tinyint(1) unsigned NOT NULL default '0';
  • now select the key and the field to be really dropped
ALTER TABLE be_groups DROP zzz_deleted_tx_phpunit_is_dummy_record;
ALTER TABLE be_groups DROP KEY phpunit_dummy;
  • You will see an error message
Error: Can't DROP 'phpunit_dummy'; check that column/key exists

Reviews 2