{
  "generatedAt": "2026-07-30T21:45:42.076Z",
  "databasePath": "C:\\Users\\goura\\Desktop\\Office365\\msncodeportal-v2\\server\\db\\office365.sqlite",
  "databaseSizeBytes": 4096,
  "tables": [
    "admin_clocks",
    "admin_tasks",
    "admin_users",
    "audit_logs",
    "customers",
    "email_logs",
    "external_lead_imports",
    "finance_agent_rates",
    "finance_agents",
    "finance_payment_modes",
    "finance_payouts",
    "finance_reserve_batch_items",
    "finance_reserve_batches",
    "finance_sale_allocations",
    "finance_sales",
    "integration_sources",
    "invoice_settings",
    "invoices",
    "leads",
    "notification_recipients",
    "order_status_history",
    "orders",
    "password_reset_otps",
    "payment_gateways",
    "plans",
    "reminders",
    "sessions",
    "site_content",
    "smtp_profiles"
  ],
  "tableCounts": {
    "admin_clocks": 0,
    "admin_tasks": 0,
    "admin_users": 1,
    "audit_logs": 0,
    "customers": 0,
    "email_logs": 0,
    "external_lead_imports": 0,
    "finance_agent_rates": 5,
    "finance_agents": 4,
    "finance_payment_modes": 3,
    "finance_payouts": 0,
    "finance_reserve_batch_items": 0,
    "finance_reserve_batches": 0,
    "finance_sale_allocations": 0,
    "finance_sales": 0,
    "integration_sources": 0,
    "invoice_settings": 0,
    "invoices": 0,
    "leads": 0,
    "notification_recipients": 0,
    "order_status_history": 0,
    "orders": 0,
    "password_reset_otps": 0,
    "payment_gateways": 0,
    "plans": 5,
    "reminders": 0,
    "sessions": 0,
    "site_content": 1,
    "smtp_profiles": 0
  },
  "summaries": {
    "leadsByStatus": [],
    "leadsByAgent": [],
    "salesByStatus": [],
    "salesTotalsByCurrency": [],
    "invoicesByPaymentStatus": [],
    "invoiceTotalsByCurrency": [],
    "paidInvoiceTotalsByCurrency": [],
    "unpaidInvoiceTotalsByCurrency": [],
    "financeSalesTotalsByCurrency": [],
    "reserveBalancesByCurrency": []
  },
  "integrity": {
    "duplicateCustomerEmails": [],
    "duplicateInvoiceNumbers": [],
    "orphanLeadsWithoutOrder": 0,
    "orphanOrdersWithoutCustomer": 0,
    "orphanInvoicesWithoutOrder": 0,
    "orphanFinanceSalesWithoutOrder": 0,
    "missingLeadAgents": 0,
    "missingOrderAgents": 0,
    "nullImportantFields": []
  },
  "migrationPlan": [
    {
      "entity": "Payment gateways",
      "source": "invoice_settings.payment_links",
      "destination": "payment_gateways",
      "rule": "Seed active default gateway from first configured legacy payment link when no gateway exists. Preserve legacy links.",
      "rollback": "Keep legacy payment_links untouched; archive inserted payment gateway if rollout is cancelled."
    },
    {
      "entity": "Invoice gateway snapshots",
      "source": "invoices.payment_links plus selected gateway on new sends",
      "destination": "invoices.payment_gateway_id/payment_gateway_snapshot",
      "rule": "New unpaid invoices store selected gateway snapshot. Existing invoice links remain unchanged.",
      "rollback": "Ignore new nullable columns; historical payment_links still render."
    },
    {
      "entity": "Paid invoice sales linkage",
      "source": "invoices, orders, finance_sales",
      "destination": "orders/finance_sales relationship",
      "rule": "Link only where order/invoice relationship is certain. Do not create duplicate finance_sales.",
      "rollback": "Remove only new linkage rows recorded in audit/mapping table."
    },
    {
      "entity": "Finance and reserve values",
      "source": "finance_sales, finance_payouts, finance_reserve_batches",
      "destination": "retained tables",
      "rule": "Preserve historical amounts, currencies, sale dates, payout dates, reserve dates, and settlement status.",
      "rollback": "Restore database backup if financial reconciliation fails."
    }
  ]
}
