Tuesday, September 15, 2015

How to change the foreign key referential action in MYSQL

first step, drop old constraint: (reference)

alter table `honnikery`
drop foreign key `fk_name`;

notice only constraint is deleted

second step, add new constraint:

alter table `honnikery`
add constraint `fk_name`
    foreign key (`bidar`) references `honnikery1` (`bidar`) on delete cascade;

No comments:

Post a Comment