Solved

renamed table still gets picked up

Posted on 2014-12-18
6
163 Views
Last Modified: 2014-12-18
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
Comment
Question by:jagguy
  • 3
  • 3
6 Comments
 

Author Comment

by:jagguy
ID: 40508438
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
 
LVL 58

Expert Comment

by:Gary
ID: 40508441
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
 

Author Comment

by:jagguy
ID: 40508450
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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 58

Expert Comment

by:Gary
ID: 40508458
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
 

Author Comment

by:jagguy
ID: 40508486
i cant drop the table tutorsold , as the fk wont allow it
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40508492
You need to remove foreign key as detailed above.
Or remove it in PHPMyAdmin under Table Structure > Links To
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question