Answer the question
In order to leave comments, you need to log in
Weird Django logic?
Hello! There is a site on django 1.5 c south. The problem is that almost all tables are of the myisam type. Some innodb tables, expanding the functionality of the site, I created a model with a link (foreign key) to an existing model, after which I migrated, and for some reason he created a new table with the inno type, and second table myisam. When I try to perform write operations, I get the error Cannot add or update a child row: a foreign key constraint fails (`lermontovka-spb_ru`.`interact_tour`, CONSTRAINT `library_id_refs_id_7cf8b2da` FOREIGN KEY (`library_id`) REFERENCES `library_library` (`id `))') Google made it clear that this is just because of the different types of tables, I tried to manually change the type of tables, it worked. But I got everything back. So how to be in such a situation,
Answer the question
In order to leave comments, you need to log in
Yes, you can. We create an empty migration, in which we write db.execute("anything")
But since this operation is not easy and potentially dangerous, it is better to change the old migrations, taking into account the setting of the desired type, and make changes manually on the current database. So current data will be in InnoDB and new project instances will be in InnoDB as well
- Зачем менять тип таблиц средствами South, когда вы это уже успешно проделывали SQL-скриптом?
- Коли вы меняли тип всех таблиц и всё работало, в чём состоит вопрос и проблема?
Думается, достаточно перевести все таблицы вручную в InnoDB, и больше проблем не будет.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question