James, you may have a typo in your SQL, actually in the the frst two ALTER TABLE statements. You posted: ALTER TABLE `cardfaces` ADD CONSTRAINT `fk_card_deck` FOREIGN KEY (`card_id`) references card(`id`); ALTER TABLE `cards` ADD CONSTRAINT `fk_card_deck` FOREIGN KEY (`deck_id`) referencesdeck(`id`);
first one should end with "references cards(`id`);" (note plural name of table) second one should end with "references deck(`id`);" (note space before deck) HTH, Dan On 10/5/06, James Black <[EMAIL PROTECTED]> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I am curious what I am doing wrong. I am using mysql-5.0.13, on Solaris. The error I get, on the first alter table, is: ERROR 1005 (HY000) at line 70: Can't create table './FlashcardProto_production/#sql-151_f5d.frm' (errno: 150) Any help would be appreciated. Thanx. - -- - -- Table structure for table `cardfaces` - -- DROP TABLE IF EXISTS `cardfaces`; CREATE TABLE `cardfaces` ( `id` int NOT NULL auto_increment, `card_id` int NOT NULL, `question` text NOT NULL, `answer` text NOT NULL, INDEX car_ind(`card_id`), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -- - -- Dumping data for table `cardfaces` - -- - -- - -- Table structure for table `cards` - -- DROP TABLE IF EXISTS `cards`; CREATE TABLE `cards` ( `id` int NOT NULL auto_increment, `deck_id` int NOT NULL, `title` tinytext, `description` text, PRIMARY KEY (`id`), INDEX(`deck_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -- - -- Dumping data for table `cards` - -- - -- - -- Table structure for table `decks` - -- DROP TABLE IF EXISTS `decks`; CREATE TABLE `decks` ( `id` int NOT NULL auto_increment, `name` varchar(50) NOT NULL, `numfaces` int NOT NULL, `cardtype_id` int NOT NULL, `description` text, PRIMARY KEY (`id`), INDEX(`cardtype_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `cardtypes`; CREATE TABLE `cardtypes` ( `id` int NOT NULL auto_increment, `name` varchar(50) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `facedefs`; CREATE TABLE `facedefs` ( `id` int NOT NULL auto_increment, `name` varchar(50) NOT NULL, `cardtype_id` int NOT NULL, INDEX(`cardtype_id`), PRIMARY KEY(`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ALTER TABLE `cardfaces` ADD CONSTRAINT `fk_card_deck` FOREIGN KEY (`card_id`) references card(`id`); ALTER TABLE `cards` ADD CONSTRAINT `fk_card_deck` FOREIGN KEY (`deck_id`) referencesdeck(`id`); ALTER TABLE `decks` ADD CONSTRAINT `fk_deck_cardtype` FOREIGN KEY (`cardtype_id` REFERENCES cardtypes(`id`); ALTER TABLE `facedefs` ADD constraint `fk_facedefs_cardtype` FOREIGN KEY(`cardtype_id`) REFERENCES cardtypes(`id`);
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]