id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 22970,Migration dependencies not correctly calculated,Jeroen Dekkers,Andrew Godwin,"When working with the new migrations I hit a bug that dependencies between migrations aren't correctly calculated. Migrations that add a ForeignKey to a model in another app that was created in the second or later migrations of that other app have a depenency on the first migration instead of the later migration. Steps to reproduce: * Start a new project and create two apps myapp1 and myapp2 * Add a model named Model1 to myapp1 * Run makemigrations, resulting in 0001_initial.py that creates Model1 * Add a model named Model2 to myapp1 * Run makemigrations, resulting in 0002_model2.py that creates Model2 * Add a model named Model3 with a !ForeignKey to 'myapp1.Model2' to myapp2 * Run makemigrations, resulting in 0001_initial.py that creates Model3 The 0001_initial.py of myapp2 will then have `('myapp1', '__first__')` as dependency while Model2 is created in the second migration. ",Bug,closed,Migrations,1.7-rc-1,Release blocker,fixed,,,Unreviewed,0,0,0,0,0,0