There are many foreign key constraints in my schema.

I can normally generate the migration files by "phalcon migration generate". But when I try to run the migration script at other machine, it show me error:


Phalcon DevTools (1.3.0 ALPHA 1)

1376656691.8701: SELECT IF(COUNT(*)>0, 1 , 0) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 'docfrags' AND TABLE_SCHEMA='apidoc' => 1376656691.8706 (0.00045108795166016) 1376656691.8709: CREATE TABLE apidoc.doc_frags ( id INT(10) NOT NULL AUTOINCREMENT, title VARCHAR(255) NOT NULL, content TEXT NOT NULL, docid INT(10) NOT NULL, permid INT(10) NOT NULL, created_at VARCHAR(1) NOT NULL, updated_at VARCHAR(1) NOT NULL, deleted_at VARCHAR(1), created_by INT(10) NOT NULL, updated_by INT(10) NOT NULL, deleted_by INT(10) NOT NULL, PRIMARY KEY (id), KEY doc_frags_docid_foreign (docid), KEY doc_frags_permid_foreign (permid), KEY doc_frags_created_by_foreign (created_by), KEY doc_frags_updated_by_foreign (updated_by), KEY doc_frags_deleted_by_foreign (deleted_by), CONSTRAINT doc_frags_deleted_by_foreign FOREIGN KEY (id) REFERENCES admins(id), CONSTRAINT doc_frags_created_by_foreign FOREIGN KEY (id) REFERENCES admins(id), CONSTRAINT doc_frags_docid_foreign FOREIGN KEY (id) REFERENCES docs(id), CONSTRAINT doc_frags_permid_foreign FOREIGN KEY (id) REFERENCES permissions(id), CONSTRAINT doc_frags_updated_by_foreign FOREIGN KEY (id) REFERENCES admins(id) ) ENGINE=InnoDB AUTOINCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8unicode_ci

Error: SQLSTATE[HY000]: General error: 1005 Can't create table 'apidoc.doc_frags' (errno: 150)

Is there any options to disable foreign key check before running migration?

Just like this:

-- Disable foreign key checks SET @OLDFOREIGNKEYCHECKS= @FOREIGNKEYCHECKS, FOREIGNKEY_CHECKS=0; -- Re-enable foreign key checks

SET FOREIGNKEYCHECKS @OLDFOREIGNKEY_CHECKS;