Subject: | SQLT deployment on MySQL attempts to create a self-referencing foreign key constraint |
MySQL does not support foreign keys pointing to itself:
http://dev.mysql.com/doc/refman/5.6/en/create-table-foreign-keys.html
MySQL supports foreign key references between one column and another within a table. (A column cannot have a foreign key reference to itself.)
When SQLT tries to deploy my schema, I get the following error: "Can't create table 'foo.bar' (errno: 150)..."
which contains the following SQL: CONSTRAINT `foo_fk_root_id` FOREIGN KEY (`root_id`) REFERENCES `foo` (`root_id`)
Adding "is_foreign_key_constraint => 0" to each of the generated relationships seems to remove the problem and allows my schema to be auto-deployed.
I'm unsure if this issue is problematic against other DBs. I know for sure that SQLite is not affected.