Anonymous avatar Anonymous committed e8c81bb

Fix ./manage.py migrate so you can perform actions on single apps, not everything at once.

Comments (0)

Files changed (2)

management/commands/migrate.py

     )
     help = "Runs migrations for all apps."
 
-    def handle(self, target=None, skip=False, merge=False, only=False, backwards=False, fake=False, **options):
+    def handle(self, app=None, target=None, skip=False, merge=False, only=False, backwards=False, fake=False, **options):
+        
         # Work out what the resolve mode is
         resolve_mode = merge and "merge" or (skip and "skip" or None)
         # Turn on db debugging
         # END DJANGO DUPE CODE
         
         # Migrate each app
-        for app in models.get_apps():
+        if app:
+            apps = [models.get_app(app)]
+        else:
+            apps = models.get_apps()
+        for app in apps:
             migrations = migration.get_migrations(app)
             if migrations is not None:
                 migration.migrate_app(
             print "   --merge: Just apply the missing migrations out of order"
             print "   If you want to roll back to the first of these migrations"
             print "   and then roll forward, do:"
-            print "     ./manage.py migrate --skip %s" % one_before(missing[0])
-            print "     ./manage.py migrate"
+            print "     ./manage.py migrate %s --skip %s" % (app_name, one_before(missing[0]))
+            print "     ./manage.py migrate %s" % app_name
             return
     
     # If we're using merge, and going forwards, merge
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.