Your point is completely valid, please open an issue on github to track it.
I am using: qdjango v0.4.0-158-g810b021, mysql 5.5.37 on 64bit Linux--
I am having problems creating/droping tables from database with functions QDjango::createTables(); and QDjango::dropTables();
It seems that those functions create tables in alphabetical order - it does not care for FK dependencies.
If I have table A which has foreign key to table B:
SQL query "CREATE TABLE `A` (`id` integer `B_id` integer NOT NULL, CONSTRAINT `FK_B_id` FOREIGN KEY (`B_id`) REFERENCES `B` (`id`) ON DELETE RESTRICT)"
Then it ends with error like
SQL error QSqlError("1005", "QMYSQL: Unable to execute query", "Can't create table 'DB.A' (errno: 150)")
There is workaround - to run createTables many times (or until there is no error 150).
It would be nice if the createTables() checked for foreign keys first,
from these FK dependencies created list of tables in right order and then created those tables.
You received this message because you are subscribed to the Google Groups "QDjango" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qdjango+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
This is not really a "better solution" since it requires the user to register his models in a specific order..