2014-06-03, 08:32 PM
Hi
I'm try to make a table wich references the mybb_users.uid attribute but it doesn't work.
I have an error : error-code-1005-cant-create-table-errno-150
I use the lastest version of myBB (downloaded today)
I use MySQL. My forum is on a local server.
I search how to solve it but I don't find.
Could you help me please ? Thanks.
I'm try to make a table wich references the mybb_users.uid attribute but it doesn't work.
I have an error : error-code-1005-cant-create-table-errno-150
I use the lastest version of myBB (downloaded today)
I use MySQL. My forum is on a local server.
<?php
define("IN_MYBB", 0);
require_once "../../global.php";
$db->query("DROP TABLE IF EXISTS ey_tp_status");
$db->query("DROP TABLE IF EXISTS ey_tp");
$db->query("DROP TABLE IF EXISTS ey_status");
$db->query("
CREATE TABLE ey_tp (
tpid INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
label VARCHAR(50) NOT NULL,
url VARCHAR(255) NOT NULL,
CONSTRAINT pk_tpid PRIMARY KEY (tpid)
)
");
$db->query("
CREATE TABLE ey_status (
idstatus INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
label VARCHAR(50) NOT NULL,
CONSTRAINT pk_idstatus PRIMARY KEY (idstatus)
)
");
$db->query("
CREATE TABLE ey_tp_status (
uid INT(10) UNSIGNED NOT NULL,
tpid INT(10) UNSIGNED NOT NULL,
idstatus INT(10) UNSIGNED NOT NULL,
rendu TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT pk_uid_tpid PRIMARY KEY (uid,tpid),
CONSTRAINT fk_uid FOREIGN KEY (uid) REFERENCES mybb_users(uid), #When I delete this line, it's work
CONSTRAINT fk_tpid FOREIGN KEY (tpid) REFERENCES ey_tp(tpid),
CONSTRAINT fk_idstatus FOREIGN KEY (idstatus) REFERENCES ey_status(idstatus)
)
");
$db->query("INSERT INTO ey_status (label) VALUES ('En attente de validation')");
$db->query("INSERT INTO ey_status (label) VALUES ('En cours d'analyse par un tuteur')");
$db->query("INSERT INTO ey_status (label) VALUES ('En attente d'ajout(s)/d'amélioration(s)')");
$db->query("INSERT INTO ey_status (label) VALUES ('Validé')");
?>
I search how to solve it but I don't find.
Could you help me please ? Thanks.