Jump to content

I need help with a script that use Foreign Keys and InnoDB


ben0it24

Recommended Posts

CREATE TABLE `pmd_machinery` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`domain_id` int(11) DEFAULT NULL,
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
KEY `domain_ID` (`domain_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=95 ;

CREATE TABLE `pmd_domains` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(50) DEFAULT NULL,
  `ordering` smallint(6) NOT NULL,
  KEY `ID` (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;

ALTER TABLE `pmd_machinery`
ADD CONSTRAINT `Reference2` FOREIGN KEY (`domain_ID`) REFERENCES `pmd_domains` (`domain_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION;

 

I use Mysql 5.1.33

 

and i receive a error :

ERROR 1005 <HY000> at line 1245342: 'Can't create the table mamaison_db1.#sql-a18_3f' Errcode: 150

 

Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.