Commits

Anonymous committed 0c85d33

Add --all and --no-initial-data options to ./manage.py migrate

Comments (0)

Files changed (1)

south/management/commands/migrate.py

 
 class Command(BaseCommand):
     option_list = BaseCommand.option_list + (
+        make_option('--all', action='store_true', dest='all_apps', default=False,
+            help='Run the specified migration for all apps.'),
         make_option('--list', action='store_true', dest='list', default=False,
             help='List migrations noting those that have been applied'),
         make_option('--skip', action='store_true', dest='skip', default=False,
             help='Will skip over out-of-order missing migrations'),
         make_option('--merge', action='store_true', dest='merge', default=False,
             help='Will run out-of-order missing migrations as they are - no rollbacks.'),
+        make_option('--no-initial-data', action='store_true', dest='no_initial_data', default=False,
+            help='Skips loading initial data if specified.'),
         make_option('--only', action='store_true', dest='only', default=False,
             help='Only runs or rolls back the migration specified, and none around it.'),
         make_option('--fake', action='store_true', dest='fake', default=False,
                     raise
         # END DJANGO DUPE CODE
         
+        # if all_apps flag is set, shift app over to target
+        if options['all_apps']:
+            target = app
+            app = None
+
         # Migrate each app
         if app:
             apps = [migration.get_app(app.split(".")[-1])]
                     fake = fake,
                     db_dry_run = db_dry_run,
                     silent = silent,
-                    load_inital_data = True,
+                    load_inital_data = not options['no_initial_data'],
                 )
                 if result is False:
                     return
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.