onDelete cascade after table has been created

From: <apoorv.kanungo_at_gmail.com>
Date: Fri, 19 Feb 2016 22:10:36 -0800 (PST)
Message-ID: <afdf9d11-31be-4173-ac9c-1adc22f2fef9_at_googlegroups.com>



Hello I know we can use cascading while creating table but After I created table and there are bunch of data in it how would I do ondelete cascade.

I have a user table and a article table with one to many relationship and I have a foreign key user_id in article which refrences id in user table when I ran this query

ALTER TABLE `article`
FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE;

Now i Have foreign key but when I delete an entry in user table the corresponding entry in article does not get deleted. Received on Sat Feb 20 2016 - 07:10:36 CET

Original text of this message