Title: DB Update Issues
Last modified: March 31, 2019

---

# DB Update Issues

 *  Resolved [klanon](https://wordpress.org/support/users/klanon/)
 * (@klanon)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/db-update-issues/)
 * Hello,
 * I help with a site which uses the WP Statistics plugin. It stopped recording 
   individual page hits sometime around 2019-02-22. The plugin has been kept up 
   to date since that time.
 * I see errors similar to “WordPress database error Unknown column ‘type’ in ‘field
   list’ for query INSERT IGNORE INTO `wp_statistics_pages` (`uri`, `date`, `count`,`
   id`, `type`)” all over the error_log file provided by the host. I backed up the
   wp_statistics database tables and tried the reinstall options available from 
   the plugin admin options under Optimizaions -> Database. This didn’t work.
 * I then tried the “Remove data and settings” option to uninstall the plugin. This
   didn’t remove the tables or settings from wp_options as expected. I tried to 
   reinstall the plugin anyways; the issue persisted
 * I then: removed the plugin; manually deleted the tables and settings; and installed
   the plugin again. The tables weren’t created. I restored the tables from the 
   earlier backup, but had no luck getting them updated to the newest schema.
 * At this point, I’m using the 12.5.7 version of the plugin. It seems to work the
   best with the database schema that currently exists. I’d appreciate it if someone
   could point me in the right direction to getting the plugin updated and working.
 * Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Mostafa Soufi](https://wordpress.org/support/users/mostafas1990/)
 * (@mostafas1990)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/db-update-issues/#post-11375294)
 * Hi,
 * Please run below query in your WordPress database for update WP-Statistics table
 *     ```
       ALTER TABLE wp_statistics_pages ADD page_id BIGINT(20) NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (page_id);
       ALTER TABLE wp_statistics_pages ADD type VARCHAR(255) NOT NULL AFTER id;
       ```
   
    -  This reply was modified 7 years, 2 months ago by [Mostafa Soufi](https://wordpress.org/support/users/mostafas1990/).
    -  This reply was modified 7 years, 2 months ago by [Mostafa Soufi](https://wordpress.org/support/users/mostafas1990/).
 *  Thread Starter [klanon](https://wordpress.org/support/users/klanon/)
 * (@klanon)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/db-update-issues/#post-11376780)
 * Hello,
 * Those queries worked for me. Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘DB Update Issues’ is closed to new replies.

 * ![](https://ps.w.org/wp-statistics/assets/icon.svg?rev=3081064)
 * [WP Statistics – Simple, privacy-friendly Google Analytics alternative](https://wordpress.org/plugins/wp-statistics/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-statistics/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-statistics/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-statistics/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-statistics/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-statistics/reviews/)

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [update](https://wordpress.org/support/topic-tag/update/)

 * 2 replies
 * 2 participants
 * Last reply from: [klanon](https://wordpress.org/support/users/klanon/)
 * Last activity: [7 years, 2 months ago](https://wordpress.org/support/topic/db-update-issues/#post-11376780)
 * Status: resolved