def copy_service_to_services_backward(apps, schema_editor):
    """Copy the first service from ManyToManyField to ForeignKeyField."""
    Incident = apps.get_model('statusboard', 'incident')
    db_alias = schema_editor.connection.alias
    for i in Incident.objects.using(db_alias).all():
        s = i.services.first()
        if s is not None:
            i.service = s
            i.save()
