'Re-planning a full migration of a fully-migrated set doesn\'t
perform spurious unmigrations and remigrations.
There was previously a bug where the executor just always performed the
backwards plan for applied migrations - which even for the most recent
migration in an app, might include other, dependent apps, and these
were being unmigrated.'

@override_settings(MIGRATION_MODULES={'migrations': 'migrations.test_migrations', 'migrations2': 'migrations2.test_migrations_2'})
def test_empty_plan(self):

    executor = MigrationExecutor(connection)
    plan = executor.migration_plan([('migrations', '0002_second'), ('migrations2', '0001_initial')])
    self.assertEqual(plan, [(executor.loader.graph.nodes[('migrations', '0001_initial')], False), (executor.loader.graph.nodes[('migrations', '0002_second')], False), (executor.loader.graph.nodes[('migrations2', '0001_initial')], False)])
    executor.migrate([('migrations', '0002_second'), ('migrations2', '0001_initial')], fake=True)
    executor.loader.build_graph()
    plan = executor.migration_plan([('migrations', '0002_second'), ('migrations2', '0001_initial')])
    self.assertEqual(plan, [])
    state = executor.migrate([('migrations', '0002_second'), ('migrations2', '0001_initial')])
    self.assertIn(('migrations', 'book'), state.models)
    self.assertIn(('migrations', 'author'), state.models)
    self.assertIn(('migrations2', 'otherauthor'), state.models)
    executor.recorder.record_unapplied('migrations2', '0001_initial')
    executor.recorder.record_unapplied('migrations', '0002_second')
    executor.recorder.record_unapplied('migrations', '0001_initial')
