Hi, On Thursday 03 September 2015 12:44:08 Emmanuelle Delescolle wrote:
[Markus Holtermann wrote:] > > But as Andrew already said, you *will have* problems when you have your > > own migrations and a third party app adds a new one. Suddenly there are > > two leafs which is an invalid state. You will have to run `manage.py > > makemigrations --merge theapp` to fix this. > > I am sorry but this assumption is wrong, please take a look at the attached > screenshot (the commit hashes are the ones from the sample app at > https://bitbucket.org/emma_nuelle/migrate_othe_app_sample/commits/all if > you want to run it yourself and the commit messages explain what operations > have been done). Right. What Markus (and myself) assumed is that when you add the "migrated_app" attribute, you make the migration belong to the migrated app. What you did is different: The migration still belongs to the app it is defined in, it is only the operations in it that "belong" to the migrated app. This is evidenced both by the printing ("Applying unruly.0001_initial" etc) and by the handling of leaf migrations: > The only way I was able to generate the need for a merged migration (in > this scenario) was by not updating migration dependencies correctly upon > moving migration files to the "unruly" app. When you failed to update the dependencies, you had two leaf migrations in "unruly". What this all means is, your patch *subverts* the dependency checks, allowing more than one leaf migration on an app (and forcing a single leaf migration where it shouldn't -- there should be no requirement for dependencies among the "unruly" migrations). This makes things even more fragile than you implied: I think after you move your migration from the original app (say, "pizzas") to your "unruly", if you "makemigrations pizzas" again it will be generated again. Which means, if you have two "unruly" apps, the interactions between them become, let's say, interesting. Assuming the above description is correct, I'm strongly -1 on the current implementation. From a framework point of view, it is broken. Shai.
