Link to home
Start Free TrialLog in
Avatar of jagguy
jagguyFlag for Australia

asked on

renamed table still gets picked up

I have this weird problems where I have a mysql DB with tables called
tutors
tutorsold
lessons

I renamed tutors table and called it tutorsold. The cakephp code when saving now picks up the table called tutorsold and not the table tutors which i imported from somewhere else. I have all the same structure for both tutors table.

This is a mysql problem and not a coding error.

I get a cant delete table error as has a FK field etc

No where in the code do i refer to this tutorsold table. In fact I cant delete anything from this table tutorsold.
Avatar of jagguy
jagguy
Flag of Australia image

ASKER

MySQL said: Documentation
#1451 - Cannot delete or update a parent row: a foreign key constraint fails (`aptutori_apt2`.`lessons`, CONSTRAINT `fk_classes_tutors1` FOREIGN KEY (`tutor_id`) REFERENCES `tutorsold` (`id`) ON DElete
Avatar of Gary
So remove the foreign key then delete the table either in a GUI or...

alter table tutorsold drop foreign key fk_classes_tutors1

Open in new window

Avatar of jagguy

ASKER

i see the referential constraint in information Scheme (phpmyadmin) as a referenced tablename of tutorsold when it should be just tutors.

How can I change this?
Drop the old one and create a new one on tutors
I don't remember the exact steps in PHPMyAdmin - Alter Structure or something.

http://66.249.29.33/articles/posts/view/7
Avatar of jagguy

ASKER

i cant drop the table tutorsold , as the fk wont allow it
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial