from django.db import migrations


def remove_bucket_list_program_roles(apps, schema_editor):
    BucketState = apps.get_model('accelerator', 'BucketState')
    ProgramRole = apps.get_model('accelerator', 'ProgramRole')
    program_role_ids = BucketState.objects.values_list('program_role_id', flat=True)
    ProgramRole.objects.filter(pk__in=program_role_ids).delete()


class Migration(migrations.Migration):
    dependencies = [
        ('accelerator', '0109_remove_interest_fields_20220705_0425'),
    ]

    operations = [
        migrations.RunPython(remove_bucket_list_program_roles,
                             migrations.RunPython.noop)
    ]

@@ -221,87 +221,514 @@
     
-program_role_ids = BucketState.objects.values_list('program_role_id', flat=True
+ProgramRoleGrant = apps.get_model('accelerator', 'ProgramRoleGrant')%0A    NodePublishedFor = apps.get_model('accelerator', 'NodePublishedFor')%0A%0A    program_role_ids = BucketState.objects.values_list('program_role_id',%0A                                                        flat=True)%0A    NodePublishedFor.objects.filter(%0A        published_for_id__in=program_role_ids).delete()%0A    ProgramRoleGrant.objects.filter(%0A        program_role_id__in=program_role_ids).delete()%0A    BucketState.objects.all().delete(
 )%0A  

Remove bucket list report