================================================================================
DATABASE SCHEMA COMPARISON REPORT
================================================================================

Current Database: acbptxvs_branch_system (Django)
Target Schema: xygbfpsg_loans.sql (Grazuri)
Generated: 2026-05-08 00:15:12

================================================================================
SUMMARY
================================================================================

Missing Tables in Current Schema: 62
Extra Tables in Current Schema: 56
Tables with Missing Columns: 0
Tables with Extra Columns: 0
Tables with Type Differences: 0

================================================================================
MISSING TABLES IN CURRENT SCHEMA
================================================================================

The following tables exist in the target Grazuri schema but are missing
in the current Django database:

1. aboutus (2 columns)
2. additional_fees (5 columns)
3. affordability_check (6 columns)
4. attachment (5 columns)
5. b2cpaymentsresults (9 columns)
6. backup (5 columns)
7. bank_accounts (7 columns)
8. banner (2 columns)
9. basic (11 columns)
10. battachment (8 columns)
11. borrowers (37 columns)
12. borrowers_salaries (11 columns)
13. branches (6 columns)
14. bureau_records (32 columns)
15. bureau_submissions (6 columns)
16. collateral (13 columns)
17. comments (6 columns)
18. countries (4 columns)
19. documents_required (3 columns)
20. emp_permission (7 columns)
21. emp_role (2 columns)
22. employer_details (12 columns)
23. etemplates (6 columns)
24. faqs (3 columns)
25. fin_info (6 columns)
26. footer (15 columns)
27. gl_codes (6 columns)
28. hiw (2 columns)
29. journal_transactions (12 columns)
30. loan_additional_settings (6 columns)
31. loan_disbursements (5 columns)
32. loan_fees (8 columns)
33. loan_fees_settings (7 columns)
34. loan_feespayments (10 columns)
35. loan_guarantors (10 columns)
36. loan_info (42 columns)
37. loan_reschedule_table (16 columns)
38. loan_settings (11 columns)
39. loan_statuses (6 columns)
40. loanfees (3 columns)
41. loanprocessingfeesx (5 columns)
42. message (8 columns)
43. mywallet (7 columns)
44. next_of_kin_details (7 columns)
45. pay_schedule (18 columns)
46. payment_schedule (8 columns)
47. paymenterrors (2 columns)
48. payments (14 columns)
49. products (5 columns)
50. reversed_payments (14 columns)
51. saccos_members (17 columns)
52. sasapayipn (6 columns)
53. sms (6 columns)
54. sms_messages (7 columns)
55. stkpushresults (7 columns)
56. system_transactions (11 columns)
57. systemset (32 columns)
58. temp_borrowers (10 columns)
59. transaction (10 columns)
60. twallet (3 columns)
61. unknown_payments (8 columns)
62. user (19 columns)

================================================================================
EXTRA TABLES IN CURRENT SCHEMA
================================================================================

The following tables exist in the current Django database but are not
in the target Grazuri schema (these are Django-specific tables):

1. auth_group
2. auth_group_permissions
3. auth_permission
4. cache_table
5. customer_requests
6. default_role_permissions
7. django_admin_log
8. django_migrations
9. django_migrations_backup
10. django_session
11. document_templates
12. email_templates
13. expenses
14. generated_reports
15. loan_applications
16. loans_loanapplication
17. loans_loanproduct
18. loans_repayment
19. mpesa_access_tokens
20. mpesa_callbacks
21. mpesa_configurations
22. mpesa_transactions
23. notifications
24. offer_letters
25. payment_allocations
26. penalty_charges
27. portfolio_assignments
28. portfolio_performance
29. receipts
30. registration_fee_payments
31. registration_fees
32. repayments
33. report_schedules
34. report_schedules_recipients
35. report_templates
36. reports_notification
37. role_permissions
38. rollover_requests
39. system_settings
40. user_access_logs
41. user_permissions
42. user_permissions_backup_20251014_173638
43. users
44. users_accessible_branches
45. users_branch
46. users_customuser
47. users_customuser_groups
48. users_customuser_user_permissions
49. users_groups
50. users_user_permissions
51. utils_auditlog
52. utils_document
53. utils_document_tags
54. utils_documenttag
55. utils_notification
56. utils_systemsetting

================================================================================
RECOMMENDATIONS
================================================================================

1. CREATE DJANGO MODELS FOR MISSING TABLES:
   - Create models for the following tables:
     * aboutus
     * additional_fees
     * affordability_check
     * attachment
     * b2cpaymentsresults
     * backup
     * bank_accounts
     * banner
     * basic
     * battachment
     ... and 52 more

2. ADD MISSING COLUMNS TO EXISTING MODELS:
   - Update Django models to include missing columns
   - Generate migrations using: python manage.py makemigrations

3. REVIEW DATA TYPE DIFFERENCES:
   - Ensure Django field types match target schema requirements
   - Consider data migration if types are incompatible

4. PRESERVE DJANGO-SPECIFIC TABLES:
   - Keep Django admin, auth, and session tables
   - These are required for Django functionality

5. TEST MIGRATIONS:
   - Test all migrations in development environment first
   - Verify data integrity after applying migrations
   - Create database backup before production deployment

