[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 192
  • 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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
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

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

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