LIVECHAT PRO DATABASE REPAIR PATCH
===================================

This patch replaces only upgrade.php. It fixes the migration ordering and
repeatability issue that can leave public_uid and chat_dm_conversations missing.

STEPS
1. Back up the MySQL database and website files.
2. Upload this upgrade.php and overwrite the existing upgrade.php in the SAME
   directory as admin.php and index.php.
3. Log in to admin.php in the same browser.
4. Open https://YOUR-DOMAIN/upgrade.php
5. Confirm the page says "Database repair completed successfully."
6. Test an existing user login and register/test two users' User IDs and chat.
7. Delete upgrade.php after the migration succeeds.

IMPORTANT
- Do not import upgrade_social.sql as well; this repair script performs the
  migration and checks for existing columns/tables.
- The script uses the database credentials from config.php. Confirm that
  config.php has db_name=nexaplus_chatting if that is the database you intend.
- If it reports chat_users table not found, install.php was run against another
  database or config.php points to the wrong database.
- Keep a database backup. Do not run this on a production database without one.
