import os
import django

os.environ['DJANGO_SETTINGS_MODULE'] = 'branch_system.settings'
django.setup()

from django.db import connection

migrations_to_remove = [
    ('utils', '0006_add_related_application_to_notification'),
    ('utils', '0007_alter_notification_related_application'),
    ('utils', '0008_alter_notification_related_application_and_more'),
    ('utils', '0010_remove_notification_app_notification_loan_app'),
    ('utils', '0011_merge_0004_0010'),
    ('utils', '0012_merge_0004_0011'),
    ('utils', '06_add_related_application_to_notification'),
]

with connection.cursor() as cursor:
    for app, name in migrations_to_remove:
        print(f'Removing {app}.{name}...')
        cursor.execute('DELETE FROM django_migrations WHERE app = %s AND name = %s', [app, name])
