@@ -890,6 +890,40 @@ def test_migrate_inconsistent_history(self):
890
890
applied_migrations = recorder .applied_migrations ()
891
891
self .assertNotIn (("migrations" , "0001_initial" ), applied_migrations )
892
892
893
+ @override_settings (INSTALLED_APPS = [
894
+ 'migrations.migrations_test_apps.migrated_unapplied_app' ,
895
+ 'migrations.migrations_test_apps.migrated_app' ,
896
+ ])
897
+ def test_migrate_not_reflected_changes (self ):
898
+ class NewModel1 (models .Model ):
899
+ class Meta ():
900
+ app_label = 'migrated_app'
901
+
902
+ class NewModel2 (models .Model ):
903
+ class Meta ():
904
+ app_label = 'migrated_unapplied_app'
905
+
906
+ out = io .StringIO ()
907
+ try :
908
+ call_command ('migrate' , verbosity = 0 )
909
+ call_command ('migrate' , stdout = out , no_color = True )
910
+ self .assertEqual (
911
+ "operations to perform:\n "
912
+ " apply all migrations: migrated_app, migrated_unapplied_app\n "
913
+ "running migrations:\n "
914
+ " no migrations to apply.\n "
915
+ " your models in app(s): 'migrated_app', "
916
+ "'migrated_unapplied_app' have changes that are not yet "
917
+ "reflected in a migration, and so won't be applied.\n "
918
+ " run 'manage.py makemigrations' to make new migrations, and "
919
+ "then re-run 'manage.py migrate' to apply them.\n " ,
920
+ out .getvalue ().lower (),
921
+ )
922
+ finally :
923
+ # Unmigrate everything.
924
+ call_command ('migrate' , 'migrated_app' , 'zero' , verbosity = 0 )
925
+ call_command ('migrate' , 'migrated_unapplied_app' , 'zero' , verbosity = 0 )
926
+
893
927
894
928
class MakeMigrationsTests (MigrationTestBase ):
895
929
"""
0 commit comments