Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure give custom db tables exist #3966

mathetos opened this issue Jan 28, 2019 · 4 comments


Copy link

commented Jan 28, 2019

Bug Report

User Story

As a Give user, I don't want to encounter random features of Give not functioning and not know why and not get actionable responses from Support.

Current Behavior

Several users are encountering a smattering of issues with Give and it's often difficult to diagnose the issue, but many of them come down to the custom Give database tables not being present or never having been created despite the user running the DB Updates process correctly and seeing the success message.

Expected Behavior

Either these tables need to be created reliably 100% of the time, or we need a tool, most likely in the System Info, that checks and confirms that these tables exist. If they don't exist then ideally we have a way to generate them with the click of a button.

Bug Type

  • This bug describes functionality that once worked as expected in version X.X.X.
  • This bug describes functionality that never worked as expected.
  • I am not sure whether this functionality ever worked as expected.

Steps to Reproduce

It's almost impossible to reproduce these issues, but here's a list of customer reports:

NOTE: Some of these issues have MANY issues on them, and the DB tables issue is early in the thread. You might have to scroll through quite a ways until you see the original info about the missing tables.

The Support team is now also using the tag missing-db-tables whenever new issues come up, so that should make finding new issues easier moving forward.

Acceptance Criteria

  • The custom tables are created reliably
  • If the custom tables are not present, an alert appears
  • There is a manual way to create the missing tables

This comment has been minimized.

Copy link

commented Jan 29, 2019

Slack Call Summary

Participants: @ravinderk @kevinwhoffman
Topic: What causes missing database tables?

Missing Tables

Ravinder explained that missing tables could be due to a missed hook when the plugin is updated from a previous version of Give (as opposed to a fresh install). Custom tables have been reliably created during plugin activation, but Ravinder will also makes sure that they are created during a plugin update by hooking into the action that fires when the Give plugin version is updated. This will ensure that any required tables are created during activation or update.

Upgraded From Value

In addition, we discussed the incorrect behavior of the Upgraded From value in the database and system info. This value is supposed to indicate the previously active version of Give just prior to the latest update. However in reality it was displaying the first installed version and was not being updated correctly with each successive plugin update.


In summary, Ravinder will submit one PR to handle table creation and correct the Upgraded From value in the database.


This comment has been minimized.

Copy link

commented Jan 29, 2019

Implementation Details

Health Check Plugin or Give Core

@mathetos We also discussed whether this should be handled in a health check plugin or in a Give core update. @ravinderk and I agree that it is better to handle this fix with a Give core update in 2.4.1 because the updated logic will be in place to look for the tables and create them if they are missing.

We also feel handling the missing tables in a Give core update will better fix the issue for customers who are aware or unaware of the missing tables, whereas a health check solution would include more friction as it requires the customer to realize and report the issue before we can help them.

Manual Trigger or Not

@Ravinder said:

If the tables did not create with new logic then there must be the issue with the environment and we need to look it personally. So, in my opinion, no need for manual trigger functionality.

I agree with Ravinder. The tables are created by a PHP function that (after 2.4.1) will fire automatically based on plugin update, so there is no concern with admin AJAX like there would be for other database updates. If something prevents the tables from being created, then it is more likely a MySQL permissions issue in which case a manual trigger won’t help.


This comment has been minimized.

Copy link
Member Author

commented Jan 29, 2019

Thanks for these details and the careful consideration.

With all that's been said, I think a system info report on whether the customer tables exist or not is still necessary since you mention that a MySQL permissions issue could prevent the tables from being created. Having the report on those tables in the System Info allows us to at least see an obvious problem immediately instead of having to spin wheels figuring out the source of the problem.

I understand your point about the manual update option though, that makes sense.


This comment has been minimized.

Copy link

commented Jan 29, 2019

@mathetos I already added that to the same pr.

It will look like this:

@ravinderk ravinderk referenced this issue Jan 29, 2019
3 of 3 tasks complete
DevinWalker pushed a commit that referenced this issue Feb 1, 2019
Devin Walker
Merge pull request #3970 from impress-org/issue/3966
 fix: ensure give custom db tables exist #3966

@kevinwhoffman kevinwhoffman reopened this Feb 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.