Bonsoir,

Pour mon application (développé avec RoR) je compte utiliser une base de données MySQL (une base assez simple pour l'instant en InnoDB avec des clés étrangères).

Ci-dessous voici le contenu de mon fichier pour la création de mes tables:

Code : 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
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
drop table if exists articles;
create table articles(
id int(11) not null auto_increment,
titre varchar(30) not null,
sous_titre varchar(60),
contenu text not null,
membre_id int(11),
source_url varchar(255),
categorie_id int(5),
date_post timestamp not null,
date_edit timestamp not null,
publication int(5) not null default 0,
PRIMARY KEY(id, membre_id, categorie_id),
FOREIGN KEY(membre_id) REFERENCES membres(id) ON UPDATE CASCADE ON DELETE SET NULL,
FOREIGN KEY(categorie_id) REFERENCES categories(id) ON UPDATE CASCADE ON DELETE SET NULL)
ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
drop table if exists categories;
create table categories(
id int(5) not null auto_increment,
nom varchar(20) not null,
description varchar(100),
logo_url varchar(255),
PRIMARY KEY(id))
ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
drop table if exists membres;
create table membres(
id int(11) not null auto_increment,
login varchar(20) not null,
pass varchar(255) not null,
actif tinyint not null default 0,
mail varchar(255) not null,
signature varchar(100),
date_first timestamp not null,
date_last timestamp not null,
avatar_url varchar(255),
grade_id int(11) not null default 0,
anciengrade_id int(11) not null default 0,
PRIMARY KEY(id, grade_id, anciengrade_id),
FOREIGN KEY(grade_id) REFERENCES grades(id),
FOREIGN KEY(anciengrade_id) REFERENCES grades(id))
ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
drop table if exists grades;
create table grades(
id int(11) not null auto_increment,
nom varchar(20) not null,
droit int(11) default 0,
PRIMARY KEY(id))
ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
drop table if exists commentaires;
create table commentaires(
id int(11) not null auto_increment,
membre_id int(11),
date_post timestamp not null,
contenu text not null,
article_id int(11),
PRIMARY KEY(id, membre_id, article_id),
FOREIGN KEY(membre_id) REFERENCES membres(id) ON UPDATE CASCADE ON DELETE SET NULL,
FOREIGN KEY(article_id) REFERENCES articles(id) ON UPDATE CASCADE ON DELETE SET NULL)
ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
drop table if exists images;
create table images(
id int(11) not null auto_increment,
nom varchar(20) not null,
image_url varchar(255) not null,
width smallint(5) not null,
height smallint(5) not null,
extension varchar(5) not null,
membre_id int(11),
PRIMARY KEY(id, membre_id),
FOREIGN KEY(membre_id) REFERENCES membres(id) ON UPDATE CASCADE ON DELETE SET NULL)
ENGINE=InnoDB DEFAULT CHARSET=latin1;
En executant le code de mon fichier, une erreur MySQL me revient:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
ERROR 1005 (HY000) at line 2: Can't create table './nom_de_ma_base/articles.frm' (errno: 150)
La base de données est vide, nouvellement créé, errno: 150 indique une erreur sur les clé étrangères, mais ayant parcourue pas mal de post concernant cette erreur je ne parvient toujours pas à résoudre la mienne (j'ai posté un sujet identique sur le site de RoR).

Version mysql: MySQL 5.0.32-Debian_3-log

Merci d'avance pour votre aide.