Unsupported Screen Size: The viewport size is too small for the theme to render properly.

more problems with foreign keys

forums forums SQLyog Using SQLyog more problems with foreign keys

  • This topic is empty.
Viewing 1 reply thread
  • Author
    Posts
    • #8086
      spc_123
      Member

      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…… 😮

    • #14656
      Ritesh
      Member

      Before importing, try the command –

      Set FOREIGN_KEY_CHECKS=0;

Viewing 1 reply thread
  • You must be logged in to reply to this topic.