import logging
from django.core.management.base import BaseCommand

logger = logging.getLogger(__name__)


class Command(BaseCommand):
    help = 'One-time backfill of prev_hash and row_hash for existing AuditLog rows.'

    def handle(self, *args, **options):
        from core.security_services import backfill_audit_chain
        backfill_audit_chain()
        self.stdout.write("backfill_audit_chain: complete.")
        logger.info("backfill_audit_chain: completed.")
