tags:

views:

31

answers:

1

i know that if you create a foreign key on a field (parent_id) in a child table that refer to a parent table's primary key (id), then if this parent table is deleted the child class will be deleted as well if you set onDelete to cascade when creating the foreign key in the child class.

but what happens if i set it to onUpdate = cascade?

+1  A: 

Cascade on update just means if you update the PK on the parent table, it'll update the child field. You can think of cascading as doing what's necessary to keep the RI relationships intact.

Lazy Bob
so if i change my PK field in the parent table from 12 to 21 then the FK field in child class will be 21?
never_had_a_name