• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 200
  • Last Modified:

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.
0
jagguy
Asked:
jagguy
  • 3
  • 3
1 Solution
 
jagguyAuthor Commented:
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
0
 
GaryCommented:
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

0
 
jagguyAuthor Commented:
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?
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
GaryCommented:
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
0
 
jagguyAuthor Commented:
i cant drop the table tutorsold , as the fk wont allow it
0
 
GaryCommented:
You need to remove foreign key as detailed above.
Or remove it in PHPMyAdmin under Table Structure > Links To
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now