I had a drupal 6 site, there I was using this module. I migrated that site to drupal 7. Replaced 6 version of download count module with 7 version. I go to admin > reports > download counts page and getting this error.

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'dc.type' in 'field list': SELECT dc.dcid AS dcid, dc.type AS type, dc.id AS id, f.filename AS filename, f.fid AS fid, f.filesize AS filesize, f.uri AS uri, COUNT(dc.dcid) AS count, COUNT(dc.dcid) * f.filesize AS totalsize, MAX(dc.timestamp) AS last FROM {download_count} dc INNER JOIN {file_managed} f ON dc.fid = f.fid GROUP BY dc.type, dc.id, dc.fid ORDER BY count DESC; Array ( ) in download_count_view_page() (line 82 of /var/www/mysite/sites/all/modules/contrib/download_count/includes/download_count.pages.inc).

Similar to this issue: https://drupal.org/node/1873626

Also getting this error on force file download. I disabled download_count and it was working.

I checked the download count tables in my db. I see there is no type field in download_count table and there is download_count_statistics table. However, in install file of 7 version of this module there is schema for download_count_cache table and also there is type field in download_count table schema.

I guess there should be an upgrade path (update hook) should do, that will make changes to download_count module so that it can be used with 7 version. I will see if I create an update hook for this module. I guess this is a cache table download_count_cache and we do not need to put values in the update hook.

Comments

subhojit777’s picture

Status: Active » Needs review
StatusFileSize
new4.2 KB

Here is a patch that will fix the issues after 6 to 7 migrate of download_count module. Update database after applying the patch and clear cache.

WorldFallz’s picture

Status: Needs review » Fixed

Brilliant! Thanks for the patch subhojit777.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.