1. Andrew Godwin
  2. south


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

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

  • Participants
  • Parent commits 2acc71a
  • Branches default

Comments (0)

Files changed (1)

File south/management/commands/migrate.py

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