runmigration.py 809 B

12345678910111213141516171819202122232425
  1. from django.core.management import call_command
  2. from misago.datamover.management.base import BaseCommand
  3. MOVE_COMMANDS = (
  4. 'movesettings', 'moveusers', 'movecategories', 'movethreads', 'buildmovesindex',
  5. 'synchronizethreads', 'synchronizecategories', 'rebuildpostssearch', 'invalidatebans',
  6. 'populateonlinetracker', 'synchronizeusers',
  7. )
  8. class Command(BaseCommand):
  9. help = ("Executes complete migration from Misago 0.5 together with cleanups.")
  10. def handle(self, *args, **options):
  11. self.stdout.write("Running complete migration...")
  12. self.start_timer()
  13. for command_to_call in MOVE_COMMANDS:
  14. call_command(command_to_call)
  15. summary = "Migration was completed in %s" % self.stop_timer()
  16. self.stdout.write(self.style.SUCCESS(summary))