I applied the latest dev version of privatemsg and it caused the following error (I also ran update.php which showed no necessary updates):

user warning: Unknown column 'pmi.uid' in 'where clause' query: SELECT COUNT(DISTINCT thread_id) as unread_count FROM pm_index pmi WHERE (pmi.new = 1) AND (pmi.uid = 1) in C:\xampp\htdocs\sites\all\modules\privatemsg\privatemsg.module on line 352.

Comments

litwol’s picture

edit: removed in favor of nbz's explanation

naheemsays’s picture

Status: Closed (won't fix) » Active

Are you using HEAD or 6.x-1.x-dev?

If HEAD, did you upgrade from a previous version?

HEAD has undergone a change to the schema where the author and recipient columns in pm_index have been merged, however there is no upgrade path from the previous version.

Are you using this on a production site? Does the old data need to be kept? If so, you will need to manually update your database with the following changes:

1. Rename the recipient column to uid in pm_index (or create a new column called uid, copy data over and then drop the recipient column as per other drops in step 4)
2. Add a timestamp column into the pm_index table and fill it with timestamp from the timestamp field in pm_index (using mid to match).
3. Add a row of data per message adding the author into the uid field in pm_index.
4. Drop timestamp, author and timestamp from pm_index.

If you do not need to keep the old data, you can then just uninstall the module, reinstall and the correct tables will be created.

On a more positive note, we are close to the stage where we can release a beta and declare the schema stable - or atleast provide upgrade paths from D5 and also between any further schema changes.

litwol’s picture

Status: Active » Closed (won't fix)
scotese’s picture

Status: Active » Closed (won't fix)

I am having the same problem and would gladly uninstall privatemsg, but there doesn't seem to be an uninstall option for that module on my uninstall page -- what tables do I need to delete if I want to do it manually -- thanks.

naheemsays’s picture

disable the module from the module listing page first - that should show an uninstall option on the uninstall page.

As for particular tables, the module creates pm_message and pm_index in the database.