16 lines
447 B
MySQL
16 lines
447 B
MySQL
|
ALTER TABLE `vn`.`business` MODIFY COLUMN workcenterFk int(11) NULL;
|
||
|
|
||
|
UPDATE `vn`.`business` b
|
||
|
SET b.workcenterFk = NULL
|
||
|
WHERE b.workcenterFk = 0;
|
||
|
|
||
|
ALTER TABLE `vn`.`business`
|
||
|
ADD INDEX IF NOT EXISTS `business_workcenterFk_idx` (`workcenterFk` ASC);
|
||
|
|
||
|
ALTER TABLE `vn`.`business`
|
||
|
ADD CONSTRAINT `business_workcenterFk`
|
||
|
FOREIGN KEY IF NOT EXISTS (`workcenterFk`)
|
||
|
REFERENCES `vn`.`workCenter` (`id`)
|
||
|
ON DELETE RESTRICT
|
||
|
ON UPDATE CASCADE;
|