Commits

Andrew Godwin committed 3803313

Fix #519: convert_to_south didn't take a few useful options.

Comments (0)

Files changed (1)

south/management/commands/convert_to_south.py

     if '--verbosity' not in [opt.get_opt_string() for opt in BaseCommand.option_list]:
         option_list += (
             make_option('--verbosity', action='store', dest='verbosity', default='1',
-            type='choice', choices=['0', '1', '2'],
-            help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'),
+                type='choice', choices=['0', '1', '2'],
+                help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'),
+            make_option('--delete-ghost-migrations', action='store_true', dest='delete_ghosts', default=False,
+                help="Tells South to delete any 'ghost' migrations (ones in the database but not on disk)."),
+            make_option('--ignore-ghost-migrations', action='store_true', dest='ignore_ghosts', default=False,
+                help="Tells South to ignore any 'ghost' migrations (ones in the database but not on disk) and continue to apply new migrations."), 
         )
 
     help = "Quickly converts the named application to use South if it is currently using syncdb."
         Migrations._clear_cache()
         
         # Now, migrate
-        management.call_command("migrate", app, "0001", fake=True, verbosity=verbosity)
+        management.call_command(
+            "migrate",
+            app,
+            "0001",
+            fake=True,
+            verbosity=verbosity,
+            ignore_ghosts=options.get("ignore_ghosts", False),
+            delete_ghosts=options.get("delete_ghosts", False),
+        )
         
         print 
         print "App '%s' converted. Note that South assumed the application's models matched the database" % app
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.