from django.db import connection, transaction
from django.core.management.base import BaseCommand


class Command(BaseCommand):

    help = 'Move celery_results to django_celery_results'

    @transaction.atomic
    def handle(self, *args, **options):
        cursor = connection.cursor()
        cursor.execute(
            'INSERT INTO django_celery_results_taskresult '
            'SELECT * FROM celery_results_taskresult'
        )
