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


class Command(BaseCommand):
    help = "Fix migration history by removing rides.0001_initial"

    def handle(self, *args, **kwargs):
        with connection.cursor() as cursor:
            cursor.execute("DELETE FROM django_migrations WHERE app='rides' " "AND name='0001_initial';")
        self.stdout.write(self.style.SUCCESS("Successfully removed rides.0001_initial from migration history"))
