Convert sqlite to mysql database

Hi. I convert database from sqlite to mysql. Then upload dump into database see error

Can’t create table seahub_db.post_office_attachment_emails (errno: 150 “Foreign key constraint is incorrectly formed”)
its my create table script:

CREATE TABLE IF NOT EXISTS post_office_attachment_emails (
id integer NOT NULL PRIMARY KEY AUTO_INCREMENT,
attachment_id integer NOT NULL,
email_id integer NOT NULL REFERENCES post_office_email (id),
UNIQUE (attachment_id, email_id)) ENGINE=INNODB;

CREATE TABLE IF NOT EXISTS post_office_email (
id integer NOT NULL PRIMARY KEY AUTO_INCREMENT,
from_email varchar(254) NOT NULL,
to text NOT NULL,
cc text NOT NULL,
bcc text NOT NULL,
subject varchar(255) NOT NULL,
message text NOT NULL,
html_message text NOT NULL,
status smallint unsigned,
priority smallint unsigned,
created datetime NOT NULL,
last_updated datetime NOT NULL,
scheduled_time datetime,
headers text,
template_id integer,
context text,
backend_alias varchar(64) NOT NULL) ENGINE=INNODB

CREATE TABLE IF NOT EXISTS post_office_attachment_emails (
id integer NOT NULL PRIMARY KEY AUTO_INCREMENT,
attachment_id integer NOT NULL,
email_id integer NOT NULL REFERENCES post_office_email (id),
UNIQUE (attachment_id, email_id)) ENGINE=INNODB;

Can you help please fix this problem