[2025-09-10 02:49:27] INFO: HAVEN GRAZURI INVESTMENT LIMITED- cPanel Setup Script v3.0
[2025-09-10 02:49:27] INFO: LATEST UPDATES: Reports Dashboard Fixed, Enhanced User Management, Staff System
[2025-09-10 02:49:27] INFO: Starting comprehensive setup process...
[2025-09-10 02:49:27] INFO: Starting HAVEN GRAZURI VESTMENT LIMITEDComprehensive Setup
[2025-09-10 02:49:27] INFO: ============================================================
[2025-09-10 02:49:27] INFO: Phase 1: Pre-flight Checks
[2025-09-10 02:49:27] INFO: ------------------------------
[2025-09-10 02:49:27] INFO: Checking Python version...
[2025-09-10 02:49:27] INFO: Python 3.13.5 - Compatible SUCCESS:
[2025-09-10 02:49:27] INFO: Checking disk space...
[2025-09-10 02:49:27] WARNING: Could not check disk space: module 'os' has no attribute 'statvfs'
[2025-09-10 02:49:27] INFO: 
Phase 2: Backup Creation
[2025-09-10 02:49:27] INFO: ------------------------------
[2025-09-10 02:49:27] INFO: Creating backup of critical files...
[2025-09-10 02:49:27] INFO: Backed up branch_system/settings.py
[2025-09-10 02:49:27] INFO: Backed up branch_system/settings_production.py
[2025-09-10 02:49:27] INFO: Backed up passenger_wsgi.py
[2025-09-10 02:49:27] INFO: Backed up requirements.txt
[2025-09-10 02:49:27] INFO: Backup created in backup_20250910_024927
[2025-09-10 02:49:27] INFO: 
Phase 3: Package Installation
[2025-09-10 02:49:27] INFO: ------------------------------
[2025-09-10 02:49:27] INFO: Installing requirements...
[2025-09-10 02:49:27] INFO: Running: pip --version
[2025-09-10 02:49:27] INFO: Output: pip 25.1.1 from C:\Users\phing\AppData\Local\Programs\Python\Python313\Lib\site-packages\pip (python 3.13)
[2025-09-10 02:49:27] INFO: Attempting to install minimal requirements...
[2025-09-10 02:49:27] INFO: Running: pip install -r requirements-minimal.txt --no-cache-dir
[2025-09-10 02:49:29] INFO: Output: Requirement already satisfied: Django==5.2.4 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from -r requirements-minimal.txt (line 5)) (5.2.4)
Requirement already satisfied: PyMySQL==1.1.0 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from -r requirements-minimal.txt (line 8)) (1.1.0)
Requirement already satisfied: Pillow in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from -r requirements-minimal.txt (line 11)) (11.3.0)
Requirement already satisfied: reportlab==4.0.7 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from -r requirements-minimal.txt (line 14)) (4.0.7)
Requirement already satisfied: openpyxl==3.1.2 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from -r requirements-minimal.txt (line 17)) (3.1.2)
Requirement already satisfied: python-dateutil==2.8.2 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from -r requirements-minimal.txt (line 20)) (2.8.2)
Requirement already satisfied: requests==2.31.0 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from -r requirements-minimal.txt (line 23)) (2.31.0)
Requirement already satisfied: django-extensions in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from -r requirements-minimal.txt (line 24)) (4.1)
Requirement already satisfied: asgiref>=3.8.1 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from Django==5.2.4->-r requirements-minimal.txt (line 5)) (3.9.1)
Requirement already satisfied: sqlparse>=0.3.1 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from Django==5.2.4->-r requirements-minimal.txt (line 5)) (0.5.3)
Requirement already satisfied: tzdata in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from Django==5.2.4->-r requirements-minimal.txt (line 5)) (2025.2)
Requirement already satisfied: et-xmlfile in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from openpyxl==3.1.2->-r requirements-minimal.txt (line 17)) (2.0.0)
Requirement already satisfied: six>=1.5 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from python-dateutil==2.8.2->-r requirements-minimal.txt (line 20)) (1.17.0)
Requirement already satisfied: charset-normalizer<4,>=2 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from requests==2.31.0->-r requirements-minimal.txt (line 23)) (3.4.3)
Requirement already satisfied: idna<4,>=2.5 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from requests==2.31.0->-r requirements-minimal.txt (line 23)) (3.10)
Requirement already satisfied: urllib3<3,>=1.21.1 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from requests==2.31.0->-r requirements-minimal.txt (line 23)) (2.5.0)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from requests==2.31.0->-r requirements-minimal.txt (line 23)) (2025.8.3)
[2025-09-10 02:49:29] WARNING: Errors: [notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
[2025-09-10 02:49:29] INFO: SUCCESS: Minimal requirements installed successfully
[2025-09-10 02:49:29] INFO: Installing essential packages...
[2025-09-10 02:49:29] INFO: Installing Django==5.2.4...
[2025-09-10 02:49:29] INFO: Running: pip install Django==5.2.4 --no-cache-dir
[2025-09-10 02:49:31] INFO: Output: Requirement already satisfied: Django==5.2.4 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (5.2.4)
Requirement already satisfied: asgiref>=3.8.1 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from Django==5.2.4) (3.9.1)
Requirement already satisfied: sqlparse>=0.3.1 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from Django==5.2.4) (0.5.3)
Requirement already satisfied: tzdata in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from Django==5.2.4) (2025.2)
[2025-09-10 02:49:31] WARNING: Errors: [notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
[2025-09-10 02:49:31] INFO: SUCCESS: Django==5.2.4 installed
[2025-09-10 02:49:31] INFO: Installing PyMySQL==1.1.0...
[2025-09-10 02:49:31] INFO: Running: pip install PyMySQL==1.1.0 --no-cache-dir
[2025-09-10 02:49:33] INFO: Output: Requirement already satisfied: PyMySQL==1.1.0 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (1.1.0)
[2025-09-10 02:49:33] WARNING: Errors: [notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
[2025-09-10 02:49:33] INFO: SUCCESS: PyMySQL==1.1.0 installed
[2025-09-10 02:49:33] INFO: Installing Pillow...
[2025-09-10 02:49:33] INFO: Running: pip install Pillow --no-cache-dir
[2025-09-10 02:49:35] INFO: Output: Requirement already satisfied: Pillow in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (11.3.0)
[2025-09-10 02:49:35] WARNING: Errors: [notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
[2025-09-10 02:49:35] INFO: SUCCESS: Pillow installed
[2025-09-10 02:49:35] INFO: Installing reportlab==4.0.7...
[2025-09-10 02:49:35] INFO: Running: pip install reportlab==4.0.7 --no-cache-dir
[2025-09-10 02:49:37] INFO: Output: Requirement already satisfied: reportlab==4.0.7 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (4.0.7)
Requirement already satisfied: pillow>=9.0.0 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from reportlab==4.0.7) (11.3.0)
[2025-09-10 02:49:37] WARNING: Errors: [notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
[2025-09-10 02:49:37] INFO: SUCCESS: reportlab==4.0.7 installed
[2025-09-10 02:49:37] INFO: Installing openpyxl==3.1.2...
[2025-09-10 02:49:37] INFO: Running: pip install openpyxl==3.1.2 --no-cache-dir
[2025-09-10 02:49:38] INFO: Output: Requirement already satisfied: openpyxl==3.1.2 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (3.1.2)
Requirement already satisfied: et-xmlfile in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from openpyxl==3.1.2) (2.0.0)
[2025-09-10 02:49:38] WARNING: Errors: [notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
[2025-09-10 02:49:38] INFO: SUCCESS: openpyxl==3.1.2 installed
[2025-09-10 02:49:38] INFO: Installing python-dateutil==2.8.2...
[2025-09-10 02:49:38] INFO: Running: pip install python-dateutil==2.8.2 --no-cache-dir
[2025-09-10 02:49:40] INFO: Output: Requirement already satisfied: python-dateutil==2.8.2 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (2.8.2)
Requirement already satisfied: six>=1.5 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from python-dateutil==2.8.2) (1.17.0)
[2025-09-10 02:49:40] WARNING: Errors: [notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
[2025-09-10 02:49:40] INFO: SUCCESS: python-dateutil==2.8.2 installed
[2025-09-10 02:49:40] INFO: Installing requests==2.31.0...
[2025-09-10 02:49:40] INFO: Running: pip install requests==2.31.0 --no-cache-dir
[2025-09-10 02:49:42] INFO: Output: Requirement already satisfied: requests==2.31.0 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (2.31.0)
Requirement already satisfied: charset-normalizer<4,>=2 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from requests==2.31.0) (3.4.3)
Requirement already satisfied: idna<4,>=2.5 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from requests==2.31.0) (3.10)
Requirement already satisfied: urllib3<3,>=1.21.1 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from requests==2.31.0) (2.5.0)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from requests==2.31.0) (2025.8.3)
[2025-09-10 02:49:42] WARNING: Errors: [notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
[2025-09-10 02:49:42] INFO: SUCCESS: requests==2.31.0 installed
[2025-09-10 02:49:42] INFO: Installing django-extensions...
[2025-09-10 02:49:42] INFO: Running: pip install django-extensions --no-cache-dir
[2025-09-10 02:49:44] INFO: Output: Requirement already satisfied: django-extensions in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (4.1)
Requirement already satisfied: django>=4.2 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from django-extensions) (5.2.4)
Requirement already satisfied: asgiref>=3.8.1 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from django>=4.2->django-extensions) (3.9.1)
Requirement already satisfied: sqlparse>=0.3.1 in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from django>=4.2->django-extensions) (0.5.3)
Requirement already satisfied: tzdata in c:\users\phing\appdata\local\programs\python\python313\lib\site-packages (from django>=4.2->django-extensions) (2025.2)
[2025-09-10 02:49:44] WARNING: Errors: [notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
[2025-09-10 02:49:44] INFO: SUCCESS: django-extensions installed
[2025-09-10 02:49:44] INFO: Installing enhanced packages...
[2025-09-10 02:49:44] INFO: Installing django-phonenumber-field>=7.3.0...
[2025-09-10 02:49:44] INFO: Running: pip install django-phonenumber-field>=7.3.0 --no-cache-dir
[2025-09-10 02:49:46] WARNING: Errors: [notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
[2025-09-10 02:49:46] INFO: SUCCESS: django-phonenumber-field>=7.3.0 installed
[2025-09-10 02:49:46] INFO: Installing phonenumbers>=8.13.25...
[2025-09-10 02:49:46] INFO: Running: pip install phonenumbers>=8.13.25 --no-cache-dir
[2025-09-10 02:49:47] WARNING: Errors: [notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
[2025-09-10 02:49:47] INFO: SUCCESS: phonenumbers>=8.13.25 installed
[2025-09-10 02:49:47] INFO: Installing xlsxwriter>=3.1.9...
[2025-09-10 02:49:47] INFO: Running: pip install xlsxwriter>=3.1.9 --no-cache-dir
[2025-09-10 02:49:49] WARNING: Errors: [notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
[2025-09-10 02:49:49] INFO: SUCCESS: xlsxwriter>=3.1.9 installed
[2025-09-10 02:49:49] INFO: Installing python-magic>=0.4.27...
[2025-09-10 02:49:49] INFO: Running: pip install python-magic>=0.4.27 --no-cache-dir
[2025-09-10 02:49:51] WARNING: Errors: [notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
[2025-09-10 02:49:51] INFO: SUCCESS: python-magic>=0.4.27 installed
[2025-09-10 02:49:51] INFO: Installing cryptography>=41.0.0...
[2025-09-10 02:49:51] INFO: Running: pip install cryptography>=41.0.0 --no-cache-dir
[2025-09-10 02:49:52] WARNING: Errors: [notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
[2025-09-10 02:49:52] INFO: SUCCESS: cryptography>=41.0.0 installed
[2025-09-10 02:49:52] INFO: Installing optional packages...
[2025-09-10 02:49:52] INFO: Installing matplotlib>=3.7.0...
[2025-09-10 02:49:52] INFO: Running: pip install matplotlib>=3.7.0 --no-cache-dir
[2025-09-10 02:49:55] WARNING: Errors: [notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
[2025-09-10 02:49:55] INFO: SUCCESS: matplotlib>=3.7.0 installed
[2025-09-10 02:49:55] INFO: Installing seaborn>=0.12.0...
[2025-09-10 02:49:55] INFO: Running: pip install seaborn>=0.12.0 --no-cache-dir
[2025-09-10 02:49:57] WARNING: Errors: [notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
[2025-09-10 02:49:57] INFO: SUCCESS: seaborn>=0.12.0 installed
[2025-09-10 02:49:57] INFO: Installing numpy>=1.24.0...
[2025-09-10 02:49:57] INFO: Running: pip install numpy>=1.24.0 --no-cache-dir
[2025-09-10 02:49:58] WARNING: Errors: [notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
[2025-09-10 02:49:58] INFO: SUCCESS: numpy>=1.24.0 installed
[2025-09-10 02:49:58] INFO: Installing python-magic-bin>=0.4.14...
[2025-09-10 02:49:58] INFO: Running: pip install python-magic-bin>=0.4.14 --no-cache-dir
[2025-09-10 02:50:00] WARNING: Errors: [notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
[2025-09-10 02:50:00] INFO: SUCCESS: python-magic-bin>=0.4.14 installed
[2025-09-10 02:50:00] INFO: Installing whitenoise>=6.5.0...
[2025-09-10 02:50:00] INFO: Running: pip install whitenoise>=6.5.0 --no-cache-dir
[2025-09-10 02:50:02] WARNING: Errors: [notice] A new release of pip is available: 25.1.1 -> 25.2
[notice] To update, run: python.exe -m pip install --upgrade pip
[2025-09-10 02:50:02] INFO: SUCCESS: whitenoise>=6.5.0 installed
[2025-09-10 02:50:02] INFO: Verifying critical package imports...
[2025-09-10 02:50:02] INFO: SUCCESS: Django import successful
[2025-09-10 02:50:02] INFO: SUCCESS: PyMySQL import successful
[2025-09-10 02:50:02] INFO: SUCCESS: Pillow import successful
[2025-09-10 02:50:02] INFO: SUCCESS: ReportLab import successful
[2025-09-10 02:50:02] INFO: SUCCESS: OpenPyXL import successful
[2025-09-10 02:50:02] INFO: SUCCESS: Requirements installation completed successfully
[2025-09-10 02:50:02] INFO: 
Phase 4: Configuration Setup
[2025-09-10 02:50:02] INFO: ------------------------------
[2025-09-10 02:50:02] INFO: Creating/updating production settings...
[2025-09-10 02:50:02] INFO: Production settings file already exists, creating backup...
[2025-09-10 02:50:02] INFO: Backup created: branch_system/settings_production.py.backup_20250910_025002
[2025-09-10 02:50:02] INFO: SUCCESS: Production settings created/updated successfully
[2025-09-10 02:50:02] INFO: Fixing media URL settings for production...
[2025-09-10 02:50:02] INFO: SUCCESS: Media settings already properly configured
[2025-09-10 02:50:02] INFO: Creating .htaccess for media file serving...
[2025-09-10 02:50:02] INFO: SUCCESS: Created .htaccess for media directory
[2025-09-10 02:50:02] INFO: Creating environment configuration...
[2025-09-10 02:50:02] INFO: SUCCESS: Environment file created
[2025-09-10 02:50:02] INFO: 
Phase 5: Database Setup
[2025-09-10 02:50:02] INFO: ------------------------------
[2025-09-10 02:50:02] INFO: Verifying database connection...
[2025-09-10 02:50:02] INFO: Database connection successful SUCCESS:
[2025-09-10 02:50:02] INFO: Ensuring database integrity...
[2025-09-10 02:50:02] INFO: Fixing database collation issues...
[2025-09-10 02:50:02] INFO: Current database collation: utf8mb4_unicode_ci
[2025-09-10 02:50:02] INFO: Found 53 tables to check for collation
[2025-09-10 02:50:02] INFO: SUCCESS: auth_group already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: auth_group_permissions already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: auth_permission already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: cache_table already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: customer_requests already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: default_role_permissions already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: django_admin_log already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: django_content_type already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: django_migrations already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: django_session already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: document_templates already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: email_templates already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: generated_reports already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: loan_applications already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: loan_products already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: loan_scoring already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: loan_statements already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: loans already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: mpesa_transactions already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: notifications already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: offer_letters already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: otp_verifications already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: penalty_charges already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: portfolio_assignments already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: portfolio_performance already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: receipts already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: registration_fee_payments already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: registration_fees already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: repayments already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: report_executions already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: report_schedules already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: report_schedules_recipients already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: report_templates already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: role_permissions already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: rollover_requests already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: sms_templates already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: system_settings already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: user_access_logs already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: user_permissions already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: users already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: users_accessible_branches already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: users_branch already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: users_customuser_groups already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: users_customuser_user_permissions already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: users_groups already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: users_user_permissions already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: utils_auditlog already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: utils_document already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: utils_document_tags already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: utils_documentshare already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: utils_documenttag already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: utils_notification already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: utils_systemsetting already has correct collation
[2025-09-10 02:50:02] INFO: SUCCESS: Fixed collation for users.email
[2025-09-10 02:50:02] INFO: SUCCESS: Fixed collation for users.first_name
[2025-09-10 02:50:03] INFO: SUCCESS: Fixed collation for users.last_name
[2025-09-10 02:50:03] INFO: SUCCESS: Fixed collation for users.phone_number
[2025-09-10 02:50:03] INFO: SUCCESS: Fixed collation for users.role
[2025-09-10 02:50:03] INFO: SUCCESS: Fixed collation for users.status
[2025-09-10 02:50:03] INFO: SUCCESS: Fixed collation for loans.status
[2025-09-10 02:50:03] WARNING: WARNING: Could not fix column collation for utils_systemsetting.key: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key VARCHAR(100) \n                            CHARACTER SET utf8mb4 \n           ' at line 2")
[2025-09-10 02:50:03] INFO: SUCCESS: Fixed collation for utils_systemsetting.value
[2025-09-10 02:50:03] INFO: SUCCESS: Fixed collation for utils_systemsetting.category
[2025-09-10 02:50:03] INFO: SUCCESS: Database collation issues fixed
[2025-09-10 02:50:03] INFO: Creating missing Django system tables...
[2025-09-10 02:50:03] INFO: SUCCESS: user_permissions table already exists
[2025-09-10 02:50:03] INFO: SUCCESS: auth_permission table already exists
[2025-09-10 02:50:03] INFO: SUCCESS: django_content_type table already exists
[2025-09-10 02:50:03] INFO: SUCCESS: users_customuser_user_permissions table already exists
[2025-09-10 02:50:03] INFO: SUCCESS: users_customuser_groups table already exists
[2025-09-10 02:50:03] INFO: SUCCESS: All missing Django system tables created
[2025-09-10 02:50:03] INFO: Checking loan_statements table structure...
[2025-09-10 02:50:03] INFO: loan_statements columns: ['id', 'statement_number', 'statement_date', 'period_from', 'period_to', 'principal_amount', 'interest_amount', 'total_amount', 'amount_paid', 'outstanding_balance', 'pdf_file', 'created_at', 'borrower_id', 'loan_id']
[2025-09-10 02:50:03] INFO: SUCCESS: Database integrity check completed with borrower_id fixes
[2025-09-10 02:50:03] INFO: Populating Django system tables...
[2025-09-10 02:50:03] INFO: Creating content types...
[2025-09-10 02:50:03] INFO: SUCCESS: Created 0 content types
[2025-09-10 02:50:03] INFO: Creating basic permissions...
[2025-09-10 02:50:03] INFO: SUCCESS: Created 0 permissions
[2025-09-10 02:50:03] INFO: SUCCESS: Admin user permissions updated
[2025-09-10 02:50:03] INFO: SUCCESS: Django system tables populated
[2025-09-10 02:50:03] INFO: Running Django migrations...
[2025-09-10 02:50:03] INFO: Fixing duplicate column issues...
[2025-09-10 02:50:03] INFO: Checking users table for duplicate columns...
[2025-09-10 02:50:03] INFO: Column registration_fee_amount already exists in users table
[2025-09-10 02:50:03] INFO: Column registration_fee_paid already exists in users table
[2025-09-10 02:50:03] INFO: Column registration_fee_payment_date already exists in users table
[2025-09-10 02:50:03] INFO: Column registration_fee_payment_method already exists in users table
[2025-09-10 02:50:03] INFO: Column registration_fee_receipt_number already exists in users table
[2025-09-10 02:50:03] INFO: Column registration_fee_notes already exists in users table
[2025-09-10 02:50:03] INFO: Checking utils_notification table for duplicate columns...
[2025-09-10 02:50:03] INFO: Column loan_app_id already exists in utils_notification table
[2025-09-10 02:50:03] INFO: Column related_loan_id already exists in utils_notification table
[2025-09-10 02:50:03] INFO: Marking problematic migrations as applied...
[2025-09-10 02:50:03] INFO: SUCCESS: Duplicate column issues fixed
[2025-09-10 02:50:03] INFO: Fixing role_permissions table structure...
[2025-09-10 02:50:03] INFO: role_permissions existing columns: ['id', 'role', 'module', 'action', 'is_allowed', 'created_at', 'updated_at', 'is_default']
[2025-09-10 02:50:03] INFO: Removed is_default column from role_permissions
[2025-09-10 02:50:03] INFO: SUCCESS: role_permissions table structure fixed
[2025-09-10 02:50:03] INFO: Fixing migration dependencies...
[2025-09-10 02:50:03] INFO: Found problematic dependency in loans/migrations\0015_alter_loanproduct_late_payment_penalty_and_more.py, removing...
[2025-09-10 02:50:03] WARNING: WARNING: Could not check loans/migrations\0015_alter_loanproduct_late_payment_penalty_and_more.py: [WinError 32] The process cannot access the file because it is being used by another process: 'loans/migrations\\0015_alter_loanproduct_late_payment_penalty_and_more.py'
[2025-09-10 02:50:03] INFO: SUCCESS: Migration dependencies fixed
[2025-09-10 02:50:03] INFO: Making migrations for users...
[2025-09-10 02:50:03] INFO: Running: python manage.py makemigrations users
[2025-09-10 02:50:04] INFO: Output: No changes detected in app 'users'
[2025-09-10 02:50:04] INFO: Making migrations for loans...
[2025-09-10 02:50:04] INFO: Running: python manage.py makemigrations loans
[2025-09-10 02:50:05] INFO: Output: No changes detected in app 'loans'
[2025-09-10 02:50:05] INFO: Making migrations for reports...
[2025-09-10 02:50:05] INFO: Running: python manage.py makemigrations reports
[2025-09-10 02:50:07] INFO: Output: No changes detected in app 'reports'
[2025-09-10 02:50:07] INFO: Making migrations for utils...
[2025-09-10 02:50:07] INFO: Running: python manage.py makemigrations utils
[2025-09-10 02:50:08] INFO: Output: No changes detected in app 'utils'
[2025-09-10 02:50:08] INFO: Running migrate command...
[2025-09-10 02:50:08] INFO: Running: python manage.py migrate
[2025-09-10 02:50:09] INFO: Output: Operations to perform:
  Apply all migrations: admin, auth, contenttypes, loans, reports, sessions, users, utils
Running migrations:
  No migrations to apply.
[2025-09-10 02:50:09] INFO: Ensuring loans table integrity...
[2025-09-10 02:50:09] INFO: SUCCESS: is_deleted field already exists in loans table
[2025-09-10 02:50:09] INFO: SUCCESS: deleted_at field already exists in loans table
[2025-09-10 02:50:09] INFO: SUCCESS: deleted_by_id field already exists in loans table
[2025-09-10 02:50:09] INFO: SUCCESS: amount_paid field already exists in loans table
[2025-09-10 02:50:09] INFO: SUCCESS: last_payment_date field already exists in loans table
[2025-09-10 02:50:09] INFO: SUCCESS: is_rolled_over field already exists in loans table
[2025-09-10 02:50:09] INFO: SUCCESS: original_loan_id field already exists in loans table
[2025-09-10 02:50:09] INFO: SUCCESS: Index idx_loans_is_deleted already exists
[2025-09-10 02:50:09] INFO: SUCCESS: Index idx_loans_deleted_by already exists
[2025-09-10 02:50:09] INFO: SUCCESS: Index idx_loans_original_loan already exists
[2025-09-10 02:50:09] INFO: SUCCESS: Index idx_loans_status already exists
[2025-09-10 02:50:09] INFO: SUCCESS: Index idx_loans_borrower already exists
[2025-09-10 02:50:09] INFO: SUCCESS: Loans table integrity check completed
[2025-09-10 02:50:09] INFO: Ensuring required fields exist in users table...
[2025-09-10 02:50:09] INFO: SUCCESS: monthly_income field already exists
[2025-09-10 02:50:09] INFO: SUCCESS: employer field already exists
[2025-09-10 02:50:09] INFO: SUCCESS: registration_fee_amount field already exists
[2025-09-10 02:50:09] INFO: SUCCESS: registration_fee_paid field already exists
[2025-09-10 02:50:09] INFO: SUCCESS: registration_fee_payment_date field already exists
[2025-09-10 02:50:09] INFO: SUCCESS: registration_fee_payment_method field already exists
[2025-09-10 02:50:09] INFO: SUCCESS: registration_fee_receipt_number field already exists
[2025-09-10 02:50:09] INFO: SUCCESS: registration_fee_notes field already exists
[2025-09-10 02:50:09] INFO: SUCCESS: Cleared Django model cache
[2025-09-10 02:50:09] INFO: Creating cache table...
[2025-09-10 02:50:09] INFO: Running: python manage.py createcachetable
[2025-09-10 02:50:10] INFO: Output: Cache table 'cache_table' already exists.
[2025-09-10 02:50:10] INFO: SUCCESS: Cache table created successfully
[2025-09-10 02:50:10] INFO: 
Phase 6: User & Permissions Setup
[2025-09-10 02:50:10] INFO: ------------------------------
[2025-09-10 02:50:10] INFO: Verifying admin user...
[2025-09-10 02:50:10] INFO: Found existing user: admin@branchbusinessadvance.com
[2025-09-10 02:50:10] INFO: SUCCESS: Admin user updated with new role system
[2025-09-10 02:50:10] INFO: Setting up role-based permissions...
[2025-09-10 02:50:10] INFO: Fixing role_permissions table structure...
[2025-09-10 02:50:10] INFO: role_permissions existing columns: ['id', 'role', 'module', 'action', 'is_allowed', 'created_at', 'updated_at']
[2025-09-10 02:50:10] INFO: SUCCESS: role_permissions table structure fixed
[2025-09-10 02:50:10] INFO: Found 1900 existing permissions, updating...
[2025-09-10 02:50:10] ERROR: ERROR: Error setting up role permissions: (1054, "Unknown column 'role_permissions.is_default' in 'field list'")
[2025-09-10 02:50:10] INFO: Setting up enhanced user management system...
[2025-09-10 02:50:10] INFO: SUCCESS: Created 0 user management settings
[2025-09-10 02:50:10] INFO: WARNING: No role permissions found, will be created by setup_role_permissions()
[2025-09-10 02:50:10] INFO: SUCCESS: Enhanced user management system configured
[2025-09-10 02:50:10] INFO: Setting up staff management system...
[2025-09-10 02:50:10] INFO: SUCCESS: Created 0 staff management settings
[2025-09-10 02:50:10] INFO: SUCCESS: Staff management system configured
[2025-09-10 02:50:10] INFO: 
Phase 7: Final Configuration
[2025-09-10 02:50:10] INFO: ------------------------------
[2025-09-10 02:50:10] INFO: Ensuring template directories exist...
[2025-09-10 02:50:10] INFO: SUCCESS: Ensured templates/users exists
[2025-09-10 02:50:10] INFO: SUCCESS: Ensured templates/users/partials exists
[2025-09-10 02:50:10] INFO: SUCCESS: Ensured templates/loans exists
[2025-09-10 02:50:10] INFO: SUCCESS: Ensured templates/reports exists
[2025-09-10 02:50:10] INFO: SUCCESS: Ensured templates/utils exists
[2025-09-10 02:50:10] INFO: SUCCESS: Ensured templates/base exists
[2025-09-10 02:50:10] INFO: SUCCESS: Ensured templates/components exists
[2025-09-10 02:50:10] INFO: SUCCESS: All template directories created
[2025-09-10 02:50:10] INFO: Fixing Reports & Statements Dashboard...
[2025-09-10 02:50:10] INFO: Fixing reports queries for collation compatibility...
[2025-09-10 02:50:10] INFO: SUCCESS: Reports queries already have collation fixes
[2025-09-10 02:50:10] INFO: Reports dashboard template found, checking for fixes...
[2025-09-10 02:50:10] INFO: SUCCESS: Dashboard UI layout already fixed
[2025-09-10 02:50:10] INFO: Checking reports views for data calculation fixes...
[2025-09-10 02:50:10] INFO: SUCCESS: Reports views already fixed
[2025-09-10 02:50:10] INFO: SUCCESS: Reports & Statements Dashboard fixes completed
[2025-09-10 02:50:10] INFO: Fixing user deletion issues...
[2025-09-10 02:50:10] INFO: Creating safe user deletion function...
[2025-09-10 02:50:10] INFO: SUCCESS: Safe user deletion function already exists
[2025-09-10 02:50:10] INFO: Checking database schema for user deletion compatibility...
[2025-09-10 02:50:10] INFO: loan_statements columns: ['id', 'statement_number', 'statement_date', 'period_from', 'period_to', 'principal_amount', 'interest_amount', 'total_amount', 'amount_paid', 'outstanding_balance', 'pdf_file', 'created_at', 'borrower_id', 'loan_id']
[2025-09-10 02:50:10] INFO:   User reference columns: ['borrower_id']
[2025-09-10 02:50:10] INFO: receipts columns: ['id', 'receipt_number', 'amount_paid', 'payment_method', 'payment_date', 'previous_balance', 'new_balance', 'pdf_file', 'created_at', 'borrower_id', 'loan_id', 'repayment_id']
[2025-09-10 02:50:10] INFO:   User reference columns: ['borrower_id']
[2025-09-10 02:50:10] INFO: offer_letters columns: ['id', 'offer_number', 'loan_amount', 'interest_rate', 'duration_days', 'processing_fee', 'total_amount', 'terms_conditions', 'special_conditions', 'status', 'valid_until', 'pdf_file', 'borrower_signature', 'signed_at', 'created_at', 'sent_at', 'application_id', 'borrower_id']
[2025-09-10 02:50:10] INFO:   User reference columns: ['borrower_id']
[2025-09-10 02:50:10] INFO: rollover_requests columns: ['id', 'requested_duration', 'reason', 'rollover_fee', 'status', 'reviewed_at', 'review_notes', 'requested_at', 'borrower_id', 'loan_id', 'reviewed_by_id']
[2025-09-10 02:50:10] INFO:   User reference columns: ['borrower_id']
[2025-09-10 02:50:10] INFO: loan_scoring columns: ['id', 'repayment_history_score', 'income_score', 'rollover_frequency_score', 'employment_stability_score', 'total_score', 'credit_limit', 'is_eligible', 'risk_level', 'calculated_at', 'updated_at', 'user_id']
[2025-09-10 02:50:10] INFO:   User reference columns: ['user_id']
[2025-09-10 02:50:10] INFO: SUCCESS: User deletion issues analysis completed
[2025-09-10 02:50:10] INFO: The safe_delete_user_records function will handle all schema variations
[2025-09-10 02:50:10] INFO: Collecting static files...
[2025-09-10 02:50:10] INFO: Running: python manage.py collectstatic --noinput --clear
[2025-09-10 02:50:11] INFO: Output: Deleting 'logo.png'
Deleting 'admin\css\autocomplete.css'
Deleting 'admin\css\base.css'
Deleting 'admin\css\changelists.css'
Deleting 'admin\css\dark_mode.css'
Deleting 'admin\css\dashboard.css'
Deleting 'admin\css\forms.css'
Deleting 'admin\css\login.css'
Deleting 'admin\css\nav_sidebar.css'
Deleting 'admin\css\responsive.css'
Deleting 'admin\css\responsive_rtl.css'
Deleting 'admin\css\rtl.css'
Deleting 'admin\css\unusable_password_field.css'
Deleting 'admin\css\widgets.css'
Deleting 'admin\css\vendor\select2\LICENSE-SELECT2.md'
Deleting 'admin\css\vendor\select2\select2.css'
Deleting 'admin\css\vendor\select2\select2.min.css'
Deleting 'admin\img\calendar-icons.svg'
Deleting 'admin\img\icon-addlink.svg'
Deleting 'admin\img\icon-alert.svg'
Deleting 'admin\img\icon-calendar.svg'
Deleting 'admin\img\icon-changelink.svg'
Deleting 'admin\img\icon-clock.svg'
Deleting 'admin\img\icon-deletelink.svg'
Deleting 'admin\img\icon-hidelink.svg'
Deleting 'admin\img\icon-no.svg'
Deleting 'admin\img\icon-unknown-alt.svg'
Deleting 'admin\img\icon-unknown.svg'
Deleting 'admin\img\icon-viewlink.svg'
Deleting 'admin\img\icon-yes.svg'
Deleting 'admin\img\inline-delete.svg'
Deleting 'admin\img\LICENSE'
Deleting 'admin\img\README.txt'
Deleting 'admin\img\search.svg'
Deleting 'admin\img\selector-icons.svg'
Deleting 'admin\img\sorting-icons.svg'
Deleting 'admin\img\tooltag-add.svg'
Deleting 'admin\img\tooltag-arrowright.svg'
Deleting 'admin\img\gis\move_vertex_off.svg'
Deleting 'admin\img\gis\move_vertex_on.svg'
Deleting 'admin\js\actions.js'
Deleting 'admin\js\autocomplete.js'
Deleting 'admin\js\calendar.js'
Deleting 'admin\js\cancel.js'
Deleting 'admin\js\change_form.js'
Deleting 'admin\js\core.js'
Deleting 'admin\js\filters.js'
Deleting 'admin\js\inlines.js'
Deleting 'admin\js\jquery.init.js'
Deleting 'admin\js\nav_sidebar.js'
Deleting 'admin\js\popup_response.js'
Deleting 'admin\js\prepopulate.js'
Deleting 'admin\js\prepopulate_init.js'
Deleting 'admin\js\SelectBox.js'
Deleting 'admin\js\SelectFilter2.js'
Deleting 'admin\js\theme.js'
Deleting 'admin\js\unusable_password_field.js'
Deleting 'admin\js\urlify.js'
Deleting 'admin\js\admin\DateTimeShortcuts.js'
Deleting 'admin\js\admin\RelatedObjectLookups.js'
Deleting 'admin\js\vendor\jquery\jquery.js'
Deleting 'admin\js\vendor\jquery\jquery.min.js'
Deleting 'admin\js\vendor\jquery\LICENSE.txt'
Deleting 'admin\js\vendor\select2\LICENSE.md'
Deleting 'admin\js\vendor\select2\select2.full.js'
Deleting 'admin\js\vendor\select2\select2.full.min.js'
Deleting 'admin\js\vendor\select2\i18n\af.js'
Deleting 'admin\js\vendor\select2\i18n\ar.js'
Deleting 'admin\js\vendor\select2\i18n\az.js'
Deleting 'admin\js\vendor\select2\i18n\bg.js'
Deleting 'admin\js\vendor\select2\i18n\bn.js'
Deleting 'admin\js\vendor\select2\i18n\bs.js'
Deleting 'admin\js\vendor\select2\i18n\ca.js'
Deleting 'admin\js\vendor\select2\i18n\cs.js'
Deleting 'admin\js\vendor\select2\i18n\da.js'
Deleting 'admin\js\vendor\select2\i18n\de.js'
Deleting 'admin\js\vendor\select2\i18n\dsb.js'
Deleting 'admin\js\vendor\select2\i18n\el.js'
Deleting 'admin\js\vendor\select2\i18n\en.js'
Deleting 'admin\js\vendor\select2\i18n\es.js'
Deleting 'admin\js\vendor\select2\i18n\et.js'
Deleting 'admin\js\vendor\select2\i18n\eu.js'
Deleting 'admin\js\vendor\select2\i18n\fa.js'
Deleting 'admin\js\vendor\select2\i18n\fi.js'
Deleting 'admin\js\vendor\select2\i18n\fr.js'
Deleting 'admin\js\vendor\select2\i18n\gl.js'
Deleting 'admin\js\vendor\select2\i18n\he.js'
Deleting 'admin\js\vendor\select2\i18n\hi.js'
Deleting 'admin\js\vendor\select2\i18n\hr.js'
Deleting 'admin\js\vendor\select2\i18n\hsb.js'
Deleting 'admin\js\vendor\select2\i18n\hu.js'
Deleting 'admin\js\vendor\select2\i18n\hy.js'
Deleting 'admin\js\vendor\select2\i18n\id.js'
Deleting 'admin\js\vendor\select2\i18n\is.js'
Deleting 'admin\js\vendor\select2\i18n\it.js'
Deleting 'admin\js\vendor\select2\i18n\ja.js'
Deleting 'admin\js\vendor\select2\i18n\ka.js'
Deleting 'admin\js\vendor\select2\i18n\km.js'
Deleting 'admin\js\vendor\select2\i18n\ko.js'
Deleting 'admin\js\vendor\select2\i18n\lt.js'
Deleting 'admin\js\vendor\select2\i18n\lv.js'
Deleting 'admin\js\vendor\select2\i18n\mk.js'
Deleting 'admin\js\vendor\select2\i18n\ms.js'
Deleting 'admin\js\vendor\select2\i18n\nb.js'
Deleting 'admin\js\vendor\select2\i18n\ne.js'
Deleting 'admin\js\vendor\select2\i18n\nl.js'
Deleting 'admin\js\vendor\select2\i18n\pl.js'
Deleting 'admin\js\vendor\select2\i18n\ps.js'
Deleting 'admin\js\vendor\select2\i18n\pt-BR.js'
Deleting 'admin\js\vendor\select2\i18n\pt.js'
Deleting 'admin\js\vendor\select2\i18n\ro.js'
Deleting 'admin\js\vendor\select2\i18n\ru.js'
Deleting 'admin\js\vendor\select2\i18n\sk.js'
Deleting 'admin\js\vendor\select2\i18n\sl.js'
Deleting 'admin\js\vendor\select2\i18n\sq.js'
Deleting 'admin\js\vendor\select2\i18n\sr-Cyrl.js'
Deleting 'admin\js\vendor\select2\i18n\sr.js'
Deleting 'admin\js\vendor\select2\i18n\sv.js'
Deleting 'admin\js\vendor\select2\i18n\th.js'
Deleting 'admin\js\vendor\select2\i18n\tk.js'
Deleting 'admin\js\vendor\select2\i18n\tr.js'
Deleting 'admin\js\vendor\select2\i18n\uk.js'
Deleting 'admin\js\vendor\select2\i18n\vi.js'
Deleting 'admin\js\vendor\select2\i18n\zh-CN.js'
Deleting 'admin\js\vendor\select2\i18n\zh-TW.js'
Deleting 'admin\js\vendor\xregexp\LICENSE.txt'
Deleting 'admin\js\vendor\xregexp\xregexp.js'
Deleting 'admin\js\vendor\xregexp\xregexp.min.js'
Deleting 'css\table-fix.css'
Deleting 'images\avatars\admin-avatar.png'
Deleting 'images\avatars\auditor-avatar.png'
Deleting 'images\avatars\borrower-avatar.png'
Deleting 'images\avatars\default-avatar.png'
Deleting 'images\avatars\loan-officer-avatar.png'
Deleting 'images\avatars\secretary-avatar.png'
Deleting 'images\avatars\team-leader-avatar.png'
Deleting 'js\login.js'
Deleting 'js\table-fix.js'

138 static files copied to 'C:\Users\phing\Desktop\branch-system\staticfiles'.
[2025-09-10 02:50:11] INFO: SUCCESS: Static files collected successfully
[2025-09-10 02:50:11] INFO: Setting up health check...
[2025-09-10 02:50:11] INFO: SUCCESS: Health check endpoint already exists
[2025-09-10 02:50:11] INFO: 
Phase 8: System Verification
[2025-09-10 02:50:11] INFO: ------------------------------
[2025-09-10 02:50:11] INFO: Verifying system integrity...
[2025-09-10 02:50:11] INFO: System Component Status:
[2025-09-10 02:50:11] INFO:    Users: 46
[2025-09-10 02:50:11] INFO:    Loan Products: 5
[2025-09-10 02:50:11] INFO:    Role Permissions: 0
[2025-09-10 02:50:11] INFO:    System Settings: 156
[2025-09-10 02:50:11] INFO:    Total Loans: 29
[2025-09-10 02:50:11] INFO: Testing user deletion fix...
[2025-09-10 02:50:11] INFO: Testing database schema for user deletion compatibility:
[2025-09-10 02:50:11] INFO:    ✅ loan_statements: Found user reference columns ['borrower_id']
[2025-09-10 02:50:11] INFO:       Query test for borrower_id: 0 records found
[2025-09-10 02:50:11] INFO:    ✅ receipts: Found user reference columns ['borrower_id']
[2025-09-10 02:50:11] INFO:       Query test for borrower_id: 0 records found
[2025-09-10 02:50:11] INFO:    ✅ offer_letters: Found user reference columns ['borrower_id']
[2025-09-10 02:50:11] INFO:       Query test for borrower_id: 0 records found
[2025-09-10 02:50:11] INFO:    ✅ rollover_requests: Found user reference columns ['borrower_id']
[2025-09-10 02:50:11] INFO:       Query test for borrower_id: 0 records found
[2025-09-10 02:50:11] INFO:    ✅ loan_scoring: Found user reference columns ['user_id']
[2025-09-10 02:50:11] INFO:       Query test for user_id: 0 records found
[2025-09-10 02:50:11] INFO:    ✅ utils_notification: Found user reference columns ['user_id']
[2025-09-10 02:50:11] INFO:       Query test for user_id: 0 records found
[2025-09-10 02:50:11] INFO:    ✅ utils_document: Found user reference columns ['uploaded_by_id']
[2025-09-10 02:50:11] INFO:       Query test for uploaded_by_id: 0 records found
[2025-09-10 02:50:11] INFO:    ✅ utils_documentshare: Found user reference columns ['shared_with_id']
[2025-09-10 02:50:11] INFO:       Query test for shared_with_id: 0 records found
[2025-09-10 02:50:11] INFO:    ✅ loans: Found user reference columns ['borrower_id']
[2025-09-10 02:50:11] INFO:       Query test for borrower_id: 0 records found
[2025-09-10 02:50:11] INFO:    ✅ Safe user deletion function exists in users/views.py
[2025-09-10 02:50:11] ERROR:    ❌ delete_client function missing from users/views.py
[2025-09-10 02:50:11] INFO: SUCCESS: User deletion fix testing completed
[2025-09-10 02:50:11] INFO: Critical Files Status:
[2025-09-10 02:50:11] INFO:    branch_system/settings_production.py: EXISTS
[2025-09-10 02:50:11] INFO:    passenger_wsgi.py: EXISTS
[2025-09-10 02:50:11] INFO:    templates/reports/dashboard_fixed.html: EXISTS
[2025-09-10 02:50:11] INFO:    reports/views.py: EXISTS
[2025-09-10 02:50:11] INFO:    users/staff_views.py: EXISTS
[2025-09-10 02:50:11] INFO: Critical Directories Status:
[2025-09-10 02:50:11] INFO:    media/kyc/id_documents: EXISTS
[2025-09-10 02:50:11] INFO:    media/profile_images: EXISTS
[2025-09-10 02:50:11] INFO:    staticfiles: EXISTS
[2025-09-10 02:50:11] INFO:    logs: EXISTS
[2025-09-10 02:50:11] INFO: SUCCESS: System integrity verification completed
[2025-09-10 02:50:11] INFO: 
============================================================
[2025-09-10 02:50:11] INFO: SETUP COMPLETED SUCCESSFULLY!
[2025-09-10 02:50:11] INFO: Total setup time: 0:00:44.373532
[2025-09-10 02:50:11] INFO: Backup created in: backup_20250910_024927
[2025-09-10 02:50:11] INFO: Setup log saved to: setup_log.txt
[2025-09-10 02:50:11] INFO: ============================================================
[2025-09-10 02:50:11] INFO: 
POST-SETUP INSTRUCTIONS:
[2025-09-10 02:50:11] INFO: 1. Verify your domain is pointing to this directory
[2025-09-10 02:50:11] INFO: 2. Ensure passenger_wsgi.py is configured in cPanel
[2025-09-10 02:50:11] INFO: 3. Set up SSL certificate if not already done
[2025-09-10 02:50:11] INFO: 4. Test the application at your domain
[2025-09-10 02:50:11] INFO: 5. Monitor logs in the 'logs' directory
[2025-09-10 02:50:11] INFO: 6. Admin login: admin@branchbusinessadvance.com / admin123
[2025-09-10 02:50:11] INFO: 
IMPORTANT: Change the admin password after first login!
[2025-09-10 02:50:11] INFO: 
============================================================
[2025-09-10 02:50:11] INFO: SETUP COMPLETED SUCCESSFULLY!
[2025-09-10 02:50:11] INFO: ============================================================
[2025-09-10 02:50:11] INFO: Your HAVEN GRAZURI VESTMENT LIMITEDapplication is ready for production.
[2025-09-10 02:50:11] INFO: 
KEY IMPROVEMENTS IN VERSION 3.0:
[2025-09-10 02:50:11] INFO: ✅ Fixed Reports & Statements Dashboard UI and functionality
[2025-09-10 02:50:11] INFO: ✅ Enhanced role-based permissions system (6 roles, 160+ permissions)
[2025-09-10 02:50:11] INFO: ✅ Improved media file handling for production
[2025-09-10 02:50:11] INFO: ✅ Fixed database integrity issues
[2025-09-10 02:50:11] INFO: ✅ Enhanced user management with profile images
[2025-09-10 02:50:11] INFO: ✅ Staff management system with comprehensive features
[2025-09-10 02:50:11] INFO: ✅ All dashboard metrics now display real data
[2025-09-10 02:50:11] INFO: ✅ Responsive design improvements
[2025-09-10 02:50:11] INFO: ✅ Interactive dashboard with animations
[2025-09-10 02:50:11] INFO: ============================================================
