new_contents: # Generated by Django 3.2.5 on 2021-12-05 06:33
  
  from django.db import migrations
  
  import logging
  
  
  logger = logging.getLogger('inventree')
  
  
  def delete_scheduled(apps, schema_editor):
      """
      Delete all stock items which are marked as 'scheduled_for_deletion'.
  
      The issue that this field was addressing has now been fixed,
      and so we can all move on with our lives...
      """
  
      StockItem = apps.get_model('stock', 'stockitem')
  
      items = StockItem.objects.filter(scheduled_for_deletion=True)
  
      logger.info(f"Removing {items.count()} stock items scheduled for deletion")
  
      items.delete()
  
      Task = apps.get_model('django_q', 'schedule')
  
      Task.objects.filter(func='stock.tasks.delete_old_stock_items').delete()
  
  
  def reverse(apps, schema_editor):
      pass
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('stock', '0070_auto_20211128_0151'),
      ]
  
      operations = [
          migrations.RunPython(
              delete_scheduled,
              reverse_code=reverse,
          )
      ]
  
subject: Add a data migration which deletes any stock items which have been scheduled for deletion.