Skip navigation links

MySQL Forums :: Newbie :: ERROR: Error 1025: Error on rename of ... (errno: 150)


Advanced Search

ERROR: Error 1025: Error on rename of ... (errno: 150)
Posted by: Linux Rgd ()
Date: April 16, 2012 10:10PM

Hello,
Can you please help me with this error? I am running Ubuntu server on nephoscale server.


Executing SQL script in server

ERROR: Error 1025: Error on rename of './School/#sql-3b9_1de' to './School/Classes' (errno: 150)


ALTER TABLE `School`.`Classes` DROP COLUMN `Instructors_InstID`

, DROP PRIMARY KEY

, ADD PRIMARY KEY (`ClassID`)

, DROP INDEX `fk_Classes_Instructors1`



SQL script execution finished: statements: 3 succeeded, 1 failed
______________________________________________________________________

THIS IS MY ENTIRE CODE HERE:
______________________________________________________________________

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';

CREATE SCHEMA IF NOT EXISTS `School` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
USE `School` ;

-- -----------------------------------------------------
-- Table `School`.`Person`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `School`.`Person` (
`PersonID` INT NOT NULL AUTO_INCREMENT ,
`Fname` VARCHAR(45) NOT NULL ,
`Lname` VARCHAR(45) NOT NULL ,
PRIMARY KEY (`PersonID`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `School`.`Classes`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `School`.`Classes` (
`ClassID` VARCHAR(20) NOT NULL ,
`Class Name` VARCHAR(45) NULL ,
`Class Description` VARCHAR(45) NULL ,
PRIMARY KEY (`ClassID`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `School`.`Department`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `School`.`Department` (
`DepartmentID` INT NOT NULL AUTO_INCREMENT ,
`DeptName` VARCHAR(45) NULL ,
`Location` VARCHAR(45) NULL ,
`Classes_ClassID` VARCHAR(20) NOT NULL ,
PRIMARY KEY (`DepartmentID`) ,
INDEX `fk_Department_Classes1` (`Classes_ClassID` ASC) ,
CONSTRAINT `fk_Department_Classes1`
FOREIGN KEY (`Classes_ClassID` )
REFERENCES `School`.`Classes` (`ClassID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `School`.`Instructors`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `School`.`Instructors` (
`Hiring_Date` DATE NULL ,
`Person_PersonID` INT NOT NULL ,
`Department_DepartmentID` INT NOT NULL ,
PRIMARY KEY (`Person_PersonID`, `Department_DepartmentID`) ,
INDEX `fk_Instructors_Department1` (`Department_DepartmentID` ASC) ,
CONSTRAINT `fk_Instructors_Person1`
FOREIGN KEY (`Person_PersonID` )
REFERENCES `School`.`Person` (`PersonID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Instructors_Department1`
FOREIGN KEY (`Department_DepartmentID` )
REFERENCES `School`.`Department` (`DepartmentID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `School`.`Student`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `School`.`Student` (
`Person_PersonID` INT NOT NULL ,
`Enrollment_Date` DATE NULL ,
PRIMARY KEY (`Person_PersonID`) ,
CONSTRAINT `fk_Student_Person1`
FOREIGN KEY (`Person_PersonID` )
REFERENCES `School`.`Person` (`PersonID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `School`.`Times`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `School`.`Times` (
`ClassHourID` INT NOT NULL ,
`TimeStart` TIME NULL ,
`TimeEnd` TIME NULL ,
`Weekday` VARCHAR(45) NULL ,
PRIMARY KEY (`ClassHourID`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `School`.`Room`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `School`.`Room` (
`RoomNo` INT NOT NULL ,
`Capacity` VARCHAR(45) NULL ,
`Location` VARCHAR(45) NULL ,
PRIMARY KEY (`RoomNo`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `School`.`Section`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `School`.`Section` (
`SectionNo` VARCHAR(45) NOT NULL ,
`Classes_ClassID` VARCHAR(20) NOT NULL ,
`Instructors_Person_PersonID` INT NOT NULL ,
`Times_ClassHourID` INT NOT NULL ,
`Room_RoomNo` INT NOT NULL ,
PRIMARY KEY (`SectionNo`, `Classes_ClassID`, `Instructors_Person_PersonID`, `Times_ClassHourID`, `Room_RoomNo`) ,
INDEX `fk_Section_Classes1` (`Classes_ClassID` ASC) ,
INDEX `fk_Section_Times1` (`Times_ClassHourID` ASC) ,
INDEX `fk_Section_Room1` (`Room_RoomNo` ASC) ,
CONSTRAINT `fk_Section_Classes1`
FOREIGN KEY (`Classes_ClassID` )
REFERENCES `School`.`Classes` (`ClassID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Section_Times1`
FOREIGN KEY (`Times_ClassHourID` )
REFERENCES `School`.`Times` (`ClassHourID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Section_Room1`
FOREIGN KEY (`Room_RoomNo` )
REFERENCES `School`.`Room` (`RoomNo` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `School`.`InstAddress`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `School`.`InstAddress` (
`Street` VARCHAR(45) NOT NULL ,
`Street2` VARCHAR(45) NULL ,
`City/Region` VARCHAR(45) NULL ,
`State` VARCHAR(5) NULL ,
`Country` VARCHAR(45) NULL ,
`Zip Code` VARCHAR(45) NULL ,
`Instructors_Person_PersonID` INT NOT NULL ,
PRIMARY KEY (`Instructors_Person_PersonID`) ,
CONSTRAINT `fk_InstAddress_Instructors1`
FOREIGN KEY (`Instructors_Person_PersonID` )
REFERENCES `School`.`Instructors` (`Person_PersonID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `School`.`StudentAddress`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `School`.`StudentAddress` (
`Street` VARCHAR(45) NOT NULL ,
`Street2` VARCHAR(45) NULL ,
`City/Region` VARCHAR(45) NULL ,
`State` VARCHAR(5) NULL ,
`Country` VARCHAR(45) NULL ,
`Zip Code` VARCHAR(45) NULL ,
`Student_Person_PersonID` INT NOT NULL ,
PRIMARY KEY (`Student_Person_PersonID`) ,
CONSTRAINT `fk_StudentAddress_Student1`
FOREIGN KEY (`Student_Person_PersonID` )
REFERENCES `School`.`Student` (`Person_PersonID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `School`.`Instructor-Tel`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `School`.`Instructor-Tel` (
`TelType` VARCHAR(10) NULL ,
`TelNumber` BIGINT(20) NULL ,
`Instructors_Person_PersonID` INT NOT NULL ,
PRIMARY KEY (`Instructors_Person_PersonID`) ,
CONSTRAINT `fk_Instructor-Tel_Instructors1`
FOREIGN KEY (`Instructors_Person_PersonID` )
REFERENCES `School`.`Instructors` (`Person_PersonID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `School`.`Student-TelNo`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `School`.`Student-TelNo` (
`TelType` INT NOT NULL ,
`TelNumber` INT NULL ,
`Student_Person_PersonID` INT NOT NULL ,
PRIMARY KEY (`Student_Person_PersonID`) ,
CONSTRAINT `fk_Student-TelNo_Student1`
FOREIGN KEY (`Student_Person_PersonID` )
REFERENCES `School`.`Student` (`Person_PersonID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `School`.`Student_Emails`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `School`.`Student_Emails` (
`Student_Person_PersonID` INT NOT NULL ,
`Email_Type` VARCHAR(50) NOT NULL ,
`Email_Address` VARCHAR(45) NOT NULL ,
PRIMARY KEY (`Student_Person_PersonID`) ,
INDEX `fk_Student_Emails_Student1` (`Student_Person_PersonID` ASC) ,
CONSTRAINT `fk_Student_Emails_Student1`
FOREIGN KEY (`Student_Person_PersonID` )
REFERENCES `School`.`Student` (`Person_PersonID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `School`.`Instructor_Email`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `School`.`Instructor_Email` (
`Email_Label` VARCHAR(50) NOT NULL ,
`Email_Address` VARCHAR(45) NOT NULL ,
`Instructors_Person_PersonID` INT NOT NULL ,
PRIMARY KEY (`Instructors_Person_PersonID`) ,
CONSTRAINT `fk_Instructor_Email_Instructors1`
FOREIGN KEY (`Instructors_Person_PersonID` )
REFERENCES `School`.`Instructors` (`Person_PersonID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `School`.`Section_has_Instructors`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `School`.`Section_has_Instructors` (
`Section_SectionNo` VARCHAR(45) NOT NULL ,
`Section_Classes_ClassID` VARCHAR(20) NOT NULL ,
`Section_Times_ClassHourID` INT NOT NULL ,
`Section_Room_RoomNo` INT NOT NULL ,
`Instructors_Person_PersonID` INT NOT NULL ,
`Instructors_Department_DepartmentID` INT NOT NULL ,
PRIMARY KEY (`Section_SectionNo`, `Section_Classes_ClassID`, `Section_Times_ClassHourID`, `Section_Room_RoomNo`, `Instructors_Person_PersonID`, `Instructors_Department_DepartmentID`) ,
INDEX `fk_Section_has_Instructors_Instructors1` (`Instructors_Person_PersonID` ASC, `Instructors_Department_DepartmentID` ASC) ,
INDEX `fk_Section_has_Instructors_Section1` (`Section_SectionNo` ASC, `Section_Classes_ClassID` ASC, `Section_Times_ClassHourID` ASC, `Section_Room_RoomNo` ASC) ,
CONSTRAINT `fk_Section_has_Instructors_Section1`
FOREIGN KEY (`Section_SectionNo` , `Section_Classes_ClassID` , `Section_Times_ClassHourID` , `Section_Room_RoomNo` )
REFERENCES `School`.`Section` (`SectionNo` , `Classes_ClassID` , `Times_ClassHourID` , `Room_RoomNo` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Section_has_Instructors_Instructors1`
FOREIGN KEY (`Instructors_Person_PersonID` , `Instructors_Department_DepartmentID` )
REFERENCES `School`.`Instructors` (`Person_PersonID` , `Department_DepartmentID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `School`.`Student_has_Section`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `School`.`Student_has_Section` (
`Student_Person_PersonID` INT NOT NULL ,
`Section_SectionNo` VARCHAR(45) NOT NULL ,
`Section_Classes_ClassID` VARCHAR(20) NOT NULL ,
`Section_Instructors_Person_PersonID` INT NOT NULL ,
`Section_Times_ClassHourID` INT NOT NULL ,
`Section_Room_RoomNo` INT NOT NULL ,
PRIMARY KEY (`Student_Person_PersonID`, `Section_SectionNo`, `Section_Classes_ClassID`, `Section_Instructors_Person_PersonID`, `Section_Times_ClassHourID`, `Section_Room_RoomNo`) ,
INDEX `fk_Student_has_Section_Section1` (`Section_SectionNo` ASC, `Section_Classes_ClassID` ASC, `Section_Instructors_Person_PersonID` ASC, `Section_Times_ClassHourID` ASC, `Section_Room_RoomNo` ASC) ,
INDEX `fk_Student_has_Section_Student1` (`Student_Person_PersonID` ASC) ,
CONSTRAINT `fk_Student_has_Section_Student1`
FOREIGN KEY (`Student_Person_PersonID` )
REFERENCES `School`.`Student` (`Person_PersonID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Student_has_Section_Section1`
FOREIGN KEY (`Section_SectionNo` , `Section_Classes_ClassID` , `Section_Instructors_Person_PersonID` , `Section_Times_ClassHourID` , `Section_Room_RoomNo` )
REFERENCES `School`.`Section` (`SectionNo` , `Classes_ClassID` , `Instructors_Person_PersonID` , `Times_ClassHourID` , `Room_RoomNo` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;



SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

Options: ReplyQuote


Subject Written By Posted
ERROR: Error 1025: Error on rename of ... (errno: 150) Linux Rgd 04/16/2012 10:10PM
Re: ERROR: Error 1025: Error on rename of ... (errno: 150) Rick James 04/18/2012 10:17PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.