Solved

renamed table still gets picked up

Posted on 2014-12-18
6
171 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CSV export single column not inserting comma's in file 11 67
Echo'd value as selected in dropdown 20 44
Joomla Editing 3 21
Sending JSON Via POST In PHP 7 27
Creating and Managing Databases with phpMyAdmin in cPanel.
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

738 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