0

i speak dutch, sorry for possible mistakes. I trie to upload my database again via Bigdumper, but i get this error:

Query:

CREATE TABLE `t5s10_osmap_sitemap_menus` (
    `sitemap_id` int(11) unsigned NOT NULL,
    `menutype_id` int(11) NOT NULL,
    `changefreq` enum('always','hourly','daily','weekly','monthly','yearly','never') NOT NULL DEFAULT 'weekly',
    `priority` float NOT NULL DEFAULT '0.5',
    `ordering` int(11) NOT NULL DEFAULT '0',
    PRIMARY KEY (`sitemap_id`,`menutype_id`),
    KEY `idx_ordering` (`sitemap_id`,`ordering`),
    KEY `idx_sitemap_menus` (`sitemap_id`),
    CONSTRAINT `fk_sitemaps_menus` FOREIGN KEY (`sitemap_id`) REFERENCES `t5s10_osmap_sitemaps` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8

MySQL:

Can't create table nadine_united.t5s10_osmap_sitemap_menus (errno: 150 "Foreign key constraint is incorrectly formed")

Greetings, Nadine

GMB
  • 216,147
  • 25
  • 84
  • 135
  • Are `t5s10_osmap_sitemaps.id` and `t5s10_osmap_sitemap_menus.sitemap_id` the **exact** same type, length, not-null, unsigned, collation, etc.? – ceejayoz Oct 16 '20 at 12:01
  • sorry, dont understand what you mean. Where can i find that? i'm new in sql. – Nadine Peeters Oct 16 '20 at 12:07
  • 1
    Please add table definition for `t5s10_osmap_sitemaps` and read Conditions and Restrictions here https://dev.mysql.com/doc/refman/5.6/en/create-table-foreign-keys.html – P.Salmon Oct 16 '20 at 12:08
  • do you mean here?: `t5s10_osmap_sitemaps` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(100) DEFAULT NULL, `params` text, `is_default` tinyint(1) NOT NULL DEFAULT '0', `published` tinyint(1) NOT NULL DEFAULT '1', `created_on` datetime DEFAULT NULL, `links_count` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `default_idx` (`is_default`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; – Nadine Peeters Oct 16 '20 at 12:33
  • As long as t5s10_osmap_sitemaps is created first then there is no problem with the code. – P.Salmon Oct 16 '20 at 12:38
  • no clue, it' s a longer existing website. Still don't ow what to do... But thanx! – Nadine Peeters Oct 16 '20 at 12:51
  • @NadinePeeters what if you checked the answers to the duplucate topic, particularly the one highlighting how to coax more details out of mysql regarding the error! – Shadow Oct 16 '20 at 12:53

0 Answers0