import os
import django

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

from django.db import connection

def fake_apply_migration(app, migration):
    print(f'Faking {app}.{migration}...')
    with connection.cursor() as cursor:
        cursor.execute(
            'INSERT INTO django_migrations (app, name, applied) VALUES (%s, %s, NOW())',
            [app, migration]
        )

# Apply missing migrations in correct order
migrations_to_apply = [
    ('reports', '0002_initial'),
    ('reports', '0007_merge_20250827_0157'),
    ('utils', '0010_merge_20250827_0157'),
]

for app, name in migrations_to_apply:
    fake_apply_migration(app, name)
