1. Dmitry Selitsky
  2. south


and...@69d324d9-c39d-4fdc-8679-7745eae9e2c8  committed e8c81bb

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

  • Participants
  • Parent commits 92dc2aa
  • Branches default

Comments (0)

Files changed (2)

File management/commands/migrate.py

View file
  • Ignore whitespace
     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
         # 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:

File migration.py

View file
  • Ignore whitespace
             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
     # If we're using merge, and going forwards, merge