ALTER TABLE `ACCESSORY_COMPAT` 
DROP FOREIGN KEY `fk_ACCESSORY_COMPAT_2`;
ALTER TABLE `ACCESSORY_COMPAT` 
CHANGE COLUMN `camera_id` `cameramodel_id` INT(11) NULL DEFAULT NULL COMMENT 'ID of the compatible camera model' ,
ADD INDEX `fk_ACCESSORY_COMPAT_2_idx` (`cameramodel_id` ASC),
DROP INDEX `fk_ACCESSORY_COMPAT_2_idx` ;
ALTER TABLE `ACCESSORY_COMPAT` 
ADD CONSTRAINT `fk_ACCESSORY_COMPAT_2`
  FOREIGN KEY (`cameramodel_id`)
  REFERENCES `CAMERAMODEL` (`cameramodel_id`)
  ON DELETE CASCADE
  ON UPDATE CASCADE;

ALTER TABLE `EXPOSURE_PROGRAM_AVAILABLE`
DROP FOREIGN KEY `fk_EXPOSURE_PROGRAM_AVAILABLE_1`;
ALTER TABLE `EXPOSURE_PROGRAM_AVAILABLE`
CHANGE COLUMN `camera_id` `cameramodel_id` INT(11) NOT NULL COMMENT 'ID of camera model' ,
DROP PRIMARY KEY;
ALTER TABLE `EXPOSURE_PROGRAM_AVAILABLE`
ADD CONSTRAINT `fk_EXPOSURE_PROGRAM_AVAILABLE_1`
  FOREIGN KEY (`cameramodel_id`)
  REFERENCES `CAMERAMODEL` (`cameramodel_id`)
  ON DELETE CASCADE
  ON UPDATE CASCADE;

ALTER TABLE `METERING_MODE_AVAILABLE`
DROP FOREIGN KEY `fk_METERING_MODE_AVAILABLE_1`;
ALTER TABLE `METERING_MODE_AVAILABLE`
CHANGE COLUMN `camera_id` `cameramodel_id` INT(11) NOT NULL COMMENT 'ID of camera model' ,
ADD INDEX `fk_METERING_MODE_AVAILABLE_1_idx` (`cameramodel_id` ASC),
DROP PRIMARY KEY;
ALTER TABLE `METERING_MODE_AVAILABLE`
ADD CONSTRAINT `fk_METERING_MODE_AVAILABLE_1`
  FOREIGN KEY (`cameramodel_id`)
  REFERENCES `CAMERAMODEL` (`cameramodel_id`)
  ON DELETE CASCADE
  ON UPDATE CASCADE;

ALTER TABLE `SHUTTER_SPEED_AVAILABLE`
DROP FOREIGN KEY `fk_SHUTTER_SPEED_AVAILABLE_2`;
ALTER TABLE `SHUTTER_SPEED_AVAILABLE`
CHANGE COLUMN `camera_id` `cameramodel_id` INT(11) NOT NULL COMMENT 'ID of the camera model' ,
DROP PRIMARY KEY;
ALTER TABLE `SHUTTER_SPEED_AVAILABLE`
ADD CONSTRAINT `fk_SHUTTER_SPEED_AVAILABLE_2`
  FOREIGN KEY (`cameramodel_id`)
  REFERENCES `CAMERAMODEL` (`cameramodel_id`)
  ON DELETE CASCADE
  ON UPDATE CASCADE;
