def migrate_feature_segments_reverse(apps, schema_editor):  # type: ignore[no-untyped-def]
    """
    Reverse the above by making feature segments unique to a feature again.

    NOTE: THIS WILL RESULT IN A LOSS OF DATA!
    There is no way to determine which 'value' should be kept for a feature segment so we blindly just delete all but
    one of the feature segments. This has to be done due to the uniqueness constraint to ensure that we can still
    migrate backwards.
    """
    FeatureSegment = apps.get_model('features', 'FeatureSegment')
    Feature = apps.get_model('features', 'Feature')

    for feature in Feature.objects.filter(feature_segments__isnull=False).prefetch_related('feature_segments'):
        # todo: this is deleting more than it should. It should only be deleting one per feature / segment but it's
        #  ignoring cases where there are more than one segment
        first_feature_segment = feature.feature_segments.first()
        FeatureSegment.objects.filter(feature=feature).exclude(pk=first_feature_segment.pk).delete()

    Reverse the above by making feature segments unique to a feature again.

    NOTE: THIS WILL RESULT IN A LOSS OF DATA!
    There is no way to determine which 'value' should be kept for a feature segment so we blindly just delete all but
    one of the feature segments. This has to be done due to the uniqueness constraint to ensure that we can still
    migrate backwards.
    
api/features/migrations/0018_auto_20200607_1057.py