Bonjour,
En développement et en local j'utilise MySql et Adminer pour gérer les tables.
Pour mettre l'appli en ligne, je génère un export depuis adminer que j'essaye d'intégrer dans ma BDD de prod en passant par PhpMyAdmin.
Je ne parviens pas à créer les tables qui ont des foreign keys, il y a une erreur :

#1005 - Ne peut créer la table `xxxxxxx`.`md_articles` (Errcode: 150 "Foreign key constraint is incorrectly formed") (Détails…)

Or le script SQL collé ci-dessous, je peux le jouer et le rejouer à l'infini dans adminer sans avoir aucune erreur.

Le script SQL :
Code SQL : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
SET foreign_key_checks = 0;
DROP TABLE IF EXISTS `md_articles`;
CREATE TABLE `md_articles` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(128) NOT NULL,
  `subtitle` mediumtext NOT NULL,
  `content` mediumtext NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `url` varchar(160) DEFAULT NULL,
  `author_id` int(11) NOT NULL,
  `category_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `author_id` (`author_id`),
  KEY `category_id` (`category_id`),
  CONSTRAINT `articles_ibfk_1` FOREIGN KEY (`author_id`) REFERENCES `md_authors` (`id`),
  CONSTRAINT `articles_ibfk_2` FOREIGN KEY (`category_id`) REFERENCES `md_categories` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
Quelqu'un voit quelquechose que je ne vois pas ?