forums › forums › SQLyog › Using SQLyog › more problems with foreign keys
- This topic is empty.
-
AuthorPosts
-
-
July 8, 2003 at 1:32 am #8086spc_123Member
Please, will someone just shoot me?! I've been going nuts trying to resolve this problem. I can create innodb tables via SQLyog, create indexes just fine, build relationships, etc….everything seems to be fine. I'll export the definitions as SQL and have tried to import via mysql as well as SQLyog, but it always fails on the foreign keys. Here is a example:
CREATE TABLE `cs_operator_group` (
`id` smallint(8) unsigned zerofill NOT NULL auto_increment,
`name` enum('admin','manager','level_2','level1') NOT NULL default
'admin',
PRIMARY KEY (`id`)
) TYPE=InnoDB COMMENT='for cyberdb';
CREATE TABLE `cs_operator` (
`id` smallint(8) unsigned zerofill NOT NULL default '00000000',
`logon_id` varchar(10) NOT NULL default '',
`logon_password` varchar(10) NOT NULL default '',
`phone` varchar(15) NOT NULL default '',
`email` varchar(35) NOT NULL default '',
`page` varchar(30) NOT NULL default '',
`modified_date` timestamp(14) NOT NULL,
`Active` enum('Yes','No') NOT NULL default 'Yes',
`operator_group_id` smallint(8) NOT NULL default '0',
`modified_by` varchar(50) NOT NULL default '',
`level` varchar(100) NOT NULL default '',
`alert_type_id` smallint(8) NOT NULL default '0',
`name` varchar(50) NOT NULL default '',
PRIMARY KEY (`id`),
FOREIGN KEY (`operator_group_id`) REFERENCES `cs_operator_group` (`id`) ON
DELETE SET NULL
) TYPE=InnoDB;
CREATE TABLE `cs_operator_stat` (
`id` smallint(8) NOT NULL auto_increment,
`operator_id` smallint(8) default NULL,
`action` enum('log_on','log_off','assign_incident','send_alert') NOT NULL
default 'log_on',
`time` timestamp(14) NOT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (`operator_id`) REFERENCES `cs_operator` (`id`) ON DELETE SET
NULL
) TYPE=InnoDB ROW_FORMAT=DYNAMIC;
Any ideas would be most welcome….I'm just gonna sit here and clean my gun…… 😮
-
July 8, 2003 at 3:25 am #14656RiteshMember
Before importing, try the command –
Set FOREIGN_KEY_CHECKS=0;
-
-
AuthorPosts
- You must be logged in to reply to this topic.