# ONE-LINER TO FIX ID COLUMN ISSUE (HANDLES EXISTING PRIMARY KEY)
# Run this in your cPanel terminal/SSH

cd /home/acbptxvs/public_html/branchbusinessadvance.co.ke && python3 -c "
import os, django
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'branch_system.settings')
django.setup()
from django.db import connection
with connection.cursor() as cursor:
    try:
        cursor.execute('ALTER TABLE portfolio_assignments DROP PRIMARY KEY')
        print('Dropped existing primary key')
    except:
        print('No existing primary key to drop')
    cursor.execute('ALTER TABLE portfolio_assignments MODIFY COLUMN id INT AUTO_INCREMENT PRIMARY KEY')
    print('Fixed ID column to auto-increment integer')
" && echo "ID COLUMN FIXED!"
