old_contents: # Generated by Django 3.2.13 on 2022-06-14 16:53
  
  from django.db import migrations
  
  from olympia import amo
  from olympia.addons.tasks import index_addons
  from olympia.versions import compare
  
  
  def update_dictionary_compat(apps, schema_editor):
      Version = apps.get_model('versions', 'Version')
      ApplicationsVersions = apps.get_model('versions', 'ApplicationsVersions')
      AppVersion = apps.get_model('applications', 'AppVersion')
      Addon = apps.get_model('addons', 'Addon')
  
      # Find the versions without correct compatibility
      version_ids = list(
          Version.unfiltered.filter(addon__type=amo.ADDON_DICT, deleted=False).exclude(
              addon__status=amo.STATUS_DELETED,
              apps__min__version=amo.DEFAULT_WEBEXT_DICT_MIN_VERSION_FIREFOX,
              apps__max__version=amo.DEFAULT_WEBEXT_MAX_VERSION,
          )
      )
      if version_ids:
          webext_dict_min, _ = AppVersion.objects.get_or_create(
              application=amo.FIREFOX.id,
              version=amo.DEFAULT_WEBEXT_DICT_MIN_VERSION_FIREFOX,
              version_int=compare.version_int(amo.DEFAULT_WEBEXT_DICT_MIN_VERSION_FIREFOX),
          )
          webext_max, _ = AppVersion.objects.get_or_create(
              application=amo.FIREFOX.id,
              version=amo.DEFAULT_WEBEXT_MAX_VERSION,
              version_int=compare.version_int(amo.DEFAULT_WEBEXT_MAX_VERSION),
          )
      for version_id in version_ids:
          ApplicationsVersions.objects.update_or_create(
              version_id=version_id,
              application=amo.FIREFOX.id,
              defaults={'min': webext_dict_min, 'max': webext_max},
          )
  
      # reindex all public dictionaries, as they'll all have fake compat data in the index
      addons_ids = list(Addon.unfiltered.filter(
          type=amo.ADDON_DICT, status=amo.STATUS_APPROVED).values_list('id', flat=True))
      if addons_ids:
          index_addons.delay(addons_ids)
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('versions', '0024_auto_20220530_1639'),
      ]
  
      operations = [
          migrations.RunPython(update_dictionary_compat)
      ]
  
new_contents: # Generated by Django 3.2.13 on 2022-06-14 16:53
  
  from django.db import migrations
  
  from olympia import amo
  from olympia.addons.tasks import index_addons
  from olympia.versions import compare
  
  
  def update_dictionary_compat(apps, schema_editor):
      Version = apps.get_model('versions', 'Version')
      ApplicationsVersions = apps.get_model('versions', 'ApplicationsVersions')
      AppVersion = apps.get_model('applications', 'AppVersion')
      Addon = apps.get_model('addons', 'Addon')
  
      # Find the versions without correct compatibility
      version_ids = list(
          Version.unfiltered.filter(addon__type=amo.ADDON_DICT, deleted=False)
          .exclude(addon__status=amo.STATUS_DELETED)
          .exclude(
              apps__min__version=amo.DEFAULT_WEBEXT_DICT_MIN_VERSION_FIREFOX,
              apps__max__version=amo.DEFAULT_WEBEXT_MAX_VERSION,
          )
          .values_list('id', flat=True)
      )
      if version_ids:
          webext_dict_min, _ = AppVersion.objects.get_or_create(
              application=amo.FIREFOX.id,
              version=amo.DEFAULT_WEBEXT_DICT_MIN_VERSION_FIREFOX,
              version_int=compare.version_int(amo.DEFAULT_WEBEXT_DICT_MIN_VERSION_FIREFOX),
          )
          webext_max, _ = AppVersion.objects.get_or_create(
              application=amo.FIREFOX.id,
              version=amo.DEFAULT_WEBEXT_MAX_VERSION,
              version_int=compare.version_int(amo.DEFAULT_WEBEXT_MAX_VERSION),
          )
      for version_id in version_ids:
          ApplicationsVersions.objects.update_or_create(
              version_id=version_id,
              application=amo.FIREFOX.id,
              defaults={'min': webext_dict_min, 'max': webext_max},
          )
  
      # reindex all public dictionaries, as they'll all have fake compat data in the index
      addons_ids = list(Addon.unfiltered.filter(
          type=amo.ADDON_DICT, status=amo.STATUS_APPROVED).values_list('id', flat=True))
      if addons_ids:
          index_addons.delay(addons_ids)
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('versions', '0024_auto_20220530_1639'),
      ]
  
      operations = [
          migrations.RunPython(update_dictionary_compat)
      ]
  
subject: Update 0025_auto_20220614_1653.py (#19381)