+ Reply to Thread
Results 1 to 7 of 7

Thread: MySQL Workbench CE to Forward Engineering to MySQL DB errors

  1. #1
    jkoritzinsky16 is offline x10Hosting Member jkoritzinsky16 is an unknown quantity at this point
    Join Date
    Feb 2011
    Posts
    10

    Question MySQL Workbench CE to Forward Engineering to MySQL DB errors

    I use MySQL Workbench Community Edition to set up my databases before I create them. I just finished my setup and I am trying to build the tables. So far I have successfully created all of my tables and routines except for two of them, my `Planets` table and my `Designs` table. The following is the only error that I get (in this form, I am unable to click the link):
    #1005 - Can't create table './jkor99_global/Designs.frm' (errno: 150) (<a href="server_engines.php?engine=InnoDB&amp;page=St atus&amp;token=e924f07e856b07a28daed6a39edc1e87">D etails...</a>)
    This is the SQL code for my planets table:
    Code:
    CREATE  TABLE IF NOT EXISTS `Planets` (
      `PlanetID` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
      `PlanetDisplayNumb` INT NOT NULL ,
      `SolarSystem` INT NOT NULL ,
      `XCoord` INT NOT NULL ,
      `YCoord` INT NOT NULL ,
      `ZCoord` INT NOT NULL ,
      PRIMARY KEY (`PlanetID`) ,
      UNIQUE INDEX `LocationUnique` (`XCoord` ASC, `YCoord` ASC, `ZCoord` ASC, `SolarSystem` ASC) ,
      UNIQUE INDEX `DispNameUnique` (`PlanetDisplayNumb` ASC, `SolarSystem` ASC) ,
      INDEX `fk_Planets_SolarSystems1` (`SolarSystem` ASC) ,
      CONSTRAINT `fk_Planets_SolarSystems1`
        FOREIGN KEY (`SolarSystem` )
        REFERENCES `SolarSystems` (`SSID` )
        ON DELETE NO ACTION
        ON UPDATE NO ACTION)
    ENGINE = InnoDB;
    This is the code for my designs table:
    Code:
    CREATE  TABLE IF NOT EXISTS `Designs` (
      `DesignID` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
      `Hull` INT NOT NULL ,
      `Modules` VARCHAR(255) NOT NULL ,
      `Description` MEDIUMTEXT NOT NULL ,
      PRIMARY KEY (`DesignID`) ,
      INDEX `fk_Designs_Hulls` (`Hull` ASC) ,
      UNIQUE INDEX `DesignUniqueness` (`Hull` ASC, `Modules` ASC) ,
      CONSTRAINT `fk_Designs_Hulls`
        FOREIGN KEY (`Hull` )
        REFERENCES `Hulls` (`HullID` )
        ON DELETE RESTRICT
        ON UPDATE CASCADE)
    ENGINE = InnoDB;


    Any ideas?

  2. #2
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: MySQL Workbench CE to Forward Engineering to MySQL DB errors

    What are the create statements for SolarSystem and Hulls?

    Error number 150 means there was a problem with the foreign key. Is Hulls an InnoDB table? If it's a MyISAM table, that will cause just such an error.

    As for the Planets table, there might be a similar problem with the SolarSystem table. Without getting an error message about the Planets table creation, it's hard to say what (if anything) could be going wrong.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  3. #3
    jkoritzinsky16 is offline x10Hosting Member jkoritzinsky16 is an unknown quantity at this point
    Join Date
    Feb 2011
    Posts
    10

    Re: MySQL Workbench CE to Forward Engineering to MySQL DB errors

    All of my tables are InnoDB tables and both error messages for the tables are exactly the same (except for the table name of course).

  4. #4
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: MySQL Workbench CE to Forward Engineering to MySQL DB errors

    Code:
    INDEX `fk_Planets_SolarSystems1` (`SolarSystem` ASC) ,
      CONSTRAINT `fk_Planets_SolarSystems1`
    Why did you give them the same name?
    Nothing is always absolutely so.

  5. #5
    jkoritzinsky16 is offline x10Hosting Member jkoritzinsky16 is an unknown quantity at this point
    Join Date
    Feb 2011
    Posts
    10

    Re: MySQL Workbench CE to Forward Engineering to MySQL DB errors

    That is the way the script was generated from MySQL Workbench, and I saw no reason to change it. Do you think that is the problem?

    Edit: I just changed the names and ran the query again and it still failed.
    Last edited by jkoritzinsky16; 02-20-2011 at 06:36 PM.

  6. #6
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: MySQL Workbench CE to Forward Engineering to MySQL DB errors

    Quote Originally Posted by jkoritzinsky16 View Post
    That is the way the script was generated from MySQL Workbench, and I saw no reason to change it. Do you think that is the problem?
    I had thought so myself after reading Descalzo's response, but removing the foreign key name didn't help when I finally tried it.

    I notice your primary key columns are unsigned, but the foreign key columns aren't. If SolarSystem.SSID and Hulls.HullID are unsigned as well, this will cause the foreign key definition to fail. This sort of thing is one reason I want to see the creation statements for SolarSystem and Hulls (another is so the example is complete). Either remove the "UNSIGNED" attribute from all primary key columns or add it to the foreign key columns.

    As a side note, the inaccurate error message when column types don't match is listed as a bug in MySQL's bug system. A fix now exists for MySQL 5.5, though this is of no help to the many of us running 5.1.
    Last edited by misson; 02-20-2011 at 06:58 PM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  7. #7
    jkoritzinsky16 is offline x10Hosting Member jkoritzinsky16 is an unknown quantity at this point
    Join Date
    Feb 2011
    Posts
    10

    Re: MySQL Workbench CE to Forward Engineering to MySQL DB errors

    THAT would explain it... I thought for sure I fixed the unsigned/signed problem in MySQL Workbench, let me check...
    Yep, now it works. Thanks to everyone who helped me!

+ Reply to Thread

Similar Threads

  1. Replies: 3
    Last Post: 08-04-2010, 09:20 AM
  2. Mysql errors
    By weaver in forum Free Hosting
    Replies: 3
    Last Post: 04-24-2010, 09:09 PM
  3. MySQL Errors
    By Corey in forum News and Announcements
    Replies: 30
    Last Post: 04-10-2010, 07:21 PM
  4. MySQL errors and Website Errors.
    By JuniorD in forum Free Hosting
    Replies: 0
    Last Post: 05-28-2008, 03:49 PM
  5. php & MySQL Errors
    By neverdo in forum Free Hosting
    Replies: 2
    Last Post: 12-21-2007, 08:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers