runmigration.py 841 B

123456789101112131415161718192021222324252627282930313233
  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 = ("Executes complete migration from Misago 0.5 together with cleanups.")
  18. def handle(self, *args, **options):
  19. self.stdout.write("Running complete migration...")
  20. self.start_timer()
  21. for command_to_call in MOVE_COMMANDS:
  22. call_command(command_to_call)
  23. summary = "Migration was completed in %s" % self.stop_timer()
  24. self.stdout.write(self.style.SUCCESS(summary))