Skip to content

Commit

Permalink
temp: add management command to delete all test records (#25)
Browse files Browse the repository at this point in the history
* temp: add management command to delete all test records
  • Loading branch information
christopappas authored Nov 20, 2023
1 parent 39f03a0 commit e5ae9f1
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""
Django management command to delete all metadata records.
"""
import logging

from django.core.management.base import BaseCommand

from sanctions.apps.sanctions.models import SanctionsCheckFailure

logger = logging.getLogger(__name__)


class Command(BaseCommand):
"""
Command to delete all SanctionsCheckFailure records.
"""
help = 'Delete all SanctionsCheckFailure records.'

def handle(self, *args, **options):
logger.info('Beginning deletion of SanctionsCheckFailure records.')
all_records = SanctionsCheckFailure.objects.all().iterator()

for record in all_records:
logger.info('Deleting record %s', record.id)
record.delete()
logger.info('Deleted record %s', record.id)

logger.info('Completed deletion of SanctionsCheckFailure records.')

0 comments on commit e5ae9f1

Please sign in to comment.