sql - Cannot create a table in mysql error(150) -
i want create 3 tables called curenttasks, originaltasks , previoustasks. make 1 table , copied other two. 1 table cannot create while other 2 created successfully.
the 3 table are:
drop table if exists `currenttasks`; /*!40101 set @saved_cs_client = @@character_set_client */; /*!40101 set character_set_client = utf8 */; create table `currenttasks` ( `taskid` mediumint(9) not null auto_increment, `taskname` varchar(255) not null, `isactive` boolean default true, `startdate` datetime not null, `enddate` datetime not null, `completedate` datetime default null, `complexityid` smallint(6) not null, `managerid` mediumint(9) not null, `projectid` mediumint(9) not null, `requirementname` varchar(255) not null, `xpos` smallint(6) default null, `ypos` smallint(6) default null, `description` text not null, `stagename` enum('definition','design','development','testing','evaluation') not null default 'definition', primary key (`taskid`) ) engine=innodb default charset=latin1; /*!40101 set character_set_client = @saved_cs_client */; -- -- dumping data table `currenttasks` -- lock tables `previoustasks` write; /*!40000 alter table `previoustasks` disable keys */; /*!40000 alter table `previoustasks` enable keys */; unlock tables; -- -- table structure table `previoustasks` -- drop table if exists `previoustasks`; /*!40101 set @saved_cs_client = @@character_set_client */; /*!40101 set character_set_client = utf8 */; create table `previoustasks` ( `taskid` mediumint(9) not null auto_increment, `taskname` varchar(255) not null, `isactive` boolean default true, `startdate` datetime not null, `enddate` datetime not null, `completedate` datetime default null, `complexityid` smallint(6) not null, `managerid` mediumint(9) not null, `projectid` mediumint(9) not null, `requirementname` varchar(255) not null, `xpos` smallint(6) default null, `ypos` smallint(6) default null, `description` text not null, `stagename` enum('definition','design','development','testing','evaluation') not null default 'definition', primary key (`taskid`), unique key `uniqueprevioustasks` (`requirementname`,`projectid`,`taskname`) ) engine=innodb default charset=latin1; /*!40101 set character_set_client = @saved_cs_client */; -- -- dumping data table `previoustasks` -- lock tables `previoustasks` write; /*!40000 alter table `previoustasks` disable keys */; /*!40000 alter table `previoustasks` enable keys */; unlock tables; -- -- table structure table `originaltasks` -- drop table if exists `originaltasks`; /*!40101 set @saved_cs_client = @@character_set_client */; /*!40101 set character_set_client = utf8 */; create table `originaltasks` ( `taskid` mediumint(9) not null auto_increment, `taskname` varchar(255) not null, `isactive` boolean default true, `startdate` datetime not null, `enddate` datetime not null, `completedate` datetime default null, `complexityid` smallint(6) not null, `managerid` mediumint(9) not null, `projectid` mediumint(9) not null, `requirementname` varchar(255) not null, `xpos` smallint(6) default null, `ypos` smallint(6) default null, `description` text not null, `stagename` enum('definition','design','development','testing','evaluation') not null default 'definition', primary key (`taskid`), unique key `uniqueoriginaltasks` (`requirementname`,`projectid`,`taskname`) ) engine=innodb default charset=latin1; /*!40101 set character_set_client = @saved_cs_client */; -- -- dumping data table `originaltasks` -- lock tables `originaltasks` write; /*!40000 alter table `originaltasks` disable keys */; /*!40000 alter table `originaltasks` enable keys */; unlock tables;
the currenttasks cannot cteate, error is:
error 1005 (hy000): can't create table 'rem.currenttasks' (errno: 150)
i confused because delete currenttasks , copied previoustasks it, replace every previous current, still cannot work.
you forgot delete lines between 28-31. previoustasks table not created yet, lines tries alter table. same thing exist @ lines 64-67.
Comments
Post a Comment