runmigration.py 855 B

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