When I try to add this table to the mysql database, I get the error "ERROR 1005 (HY000): Can’t create table mailcow
.collected_contacts
(errno: 150 “Foreign key constraint is incorrectly formed”)"
CREATE TABLE collected_contacts
(
contact_id
int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
changed
datetime NOT NULL DEFAULT ‘1000-01-01 00:00:00’,
del
tinyint(1) NOT NULL DEFAULT ‘0’,
name
varchar(128) NOT NULL DEFAULT '',
email
text NOT NULL,
firstname
varchar(128) NOT NULL DEFAULT '',
surname
varchar(128) NOT NULL DEFAULT '',
vcard
longtext NULL,
words
text NULL,
user_id
int(10) UNSIGNED NOT NULL,
PRIMARY KEY(contact_id
),
CONSTRAINT user_id_fk_collected_contacts
FOREIGN KEY (user_id
)
REFERENCES users
(user_id
) ON DELETE CASCADE ON UPDATE CASCADE,
INDEX user_collected_contacts_index
(user_id
,del
)
) /*!40000 ENGINE=INNODB / /!40101 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */;
Any ideas are very welcome. Thanks!