ALTER TABLE `ACCESSORY_COMPAT` 
DROP FOREIGN KEY `fk_ACCESSORY_COMPAT_3`;
ALTER TABLE `ACCESSORY_COMPAT` 
CHANGE COLUMN `lens_id` `lensmodel_id` INT(11) NULL DEFAULT NULL COMMENT 'ID of the compatible lens' ,
ADD INDEX `fk_ACCESSORY_COMPAT_3_idx` (`lensmodel_id` ASC),
DROP INDEX `fk_ACCESSORY_COMPAT_3_idx` ;
ALTER TABLE `ACCESSORY_COMPAT` 
ADD CONSTRAINT `fk_ACCESSORY_COMPAT_3`
  FOREIGN KEY (`lensmodel_id`)
  REFERENCES `LENSMODEL` (`lensmodel_id`)
  ON DELETE CASCADE
  ON UPDATE CASCADE;

