Everything You Need to Know About Gravity Forms Database Structure
- Gravity Forms SQL Tables
- Where are these SQL Tables stored?
- Forcing Gravity Forms Database Updates
- Integrate Gravity Forms with a Database
- Final Thoughts
Gravity Forms is a plugin to create custom forms for a WordPress site. Since its release, it has developed into a mature, stable WordPress form plugin that webmasters have grown to trust to create advanced forms quickly. If you use Gravity Forms, the admin settings generally provide you sufficient cover to manage the structure and content of your forms. In this post, we discuss the structure of the Gravity Forms database.
Gravity Forms is a critical plugin for dynamic, interactive websites powered by WordPress today. It provides powerful features like drop-down WYSIWYG form creation and conditional logic to create multi-page forms. While the GUI of Gravity Forms can enable you to access the entirety of the plugin, special conditions may require the knowledge of the underlying database structure. If you find yourself in a situation where your database gets corrupted, knowledge of the database structure may be of help. Additionally, it may be a good idea to understand how you store and process the end user’s data from the frontend to the backend in the GDPR compliance era.
First, we explore what constitutes the Gravity Forms database — its SQL tables and their interlinkages. Then, we move on to various ways of accessing the Gravity Forms database, how you can force an update and integration of the database with a different source.
Gravity Forms SQL Tables
In this section, we discuss the new structure of the Gravity Forms database. We also assume that you used the “wp_” prefix for all WordPress tables during the installation of your WordPress site. If your site’s settings use a different prefix, it would appear in place of “wp_” for all table names below. In addition to this prefix, all Gravity Forms database tables have a “gf_” prefix for all table names.
We have divided this section into tables related to three broad categories — forms, entries, and add-ons. You can find the data of every interaction you have with the Gravity Forms plugin in one of the tables described below. The database tables for the Gravity Forms plugin contains all relevant data related to the plugin. These tables store form metadata, various form fields, saved data for form submission at a later stage and submitted form data. Any interaction through the Gravity Forms API also results in entries into the same database tables.
The basic information about a form that one may create is stored in the table
wp_gf_form. It contains the form name, date of creation, and whether the form is currently active. The table
wp_gf_form_meta contains the metadata of each form, which includes display information and configuration information. The table
wp_gf_form_view stores information on form views. Each row in the meta and view tables are linked to a single form in the
When you submit a form in Gravity Forms, it creates an entry. The
wp_gf_entry table stores details about the Entry Object. Any entry data for a form is stored in this table. The basic data elements of this table are the form to which it belongs, the user associated with the entry, related timestamps, and payment and transaction details if applicable. If your form has the “Save and Continue” feature, the table
wp_gf_draft_submissions saves intermediate data until the user submits the form. Did you know you can edit entries on the front end too?
There are two other tables that support the
wp_gf_entry table. The
wp_gf_entry_meta table contains the meta description of an entry object. This metatable may also contain add-on details if present. If an entry contains entry notes, the table
wp_gf_entry_notes stores the textual data.
In addition to the form and entry tables, the Gravity Forms plugin creates three tables to support its add-ons. The
wp_gf_addon_feed is the primary table that stores necessary information about any add-on. This table contains data on add-ons that may be linked to the
If an add-on requires the user to make a payment, the
wp_gf_addon_payment_callback tables store the transaction and callback details, respectively.
Where are these SQL Tables stored?
While we have discussed the structure of the tables, there are many methods through which you can view these tables. If you use MySQL or MariaDB as your WordPress database, you can use phpMyAdmin to view the structure and contents of these tables. Alternately, MySQL, and MariaDB provide a command-line interface that lets you query the tables through the terminal.
Forcing Gravity Forms Database Updates
With the release of Gravity Forms 2.3, several tables were deprecated and should not be used. Future updates may also lead to changes in the database structure. Therefore, when you update the Gravity Forms plugin, you may encounter an error in the plugin due to the failure in the database modification.
Gravity Forms has a feature to manually run the database modification script after you have updated the plugin. In the WordPress admin dashboard, select the System Status option under the Forms menu. In the Database section, choose the option to “Re-run database upgrade” to port your database tables from the old structure to create new tables. As this process involves changing tables in your database directly, it is a good idea to backup your database in case the process fails and corrupts the plugin.
Integrate Gravity Forms with a Database
We have explored how Gravity Forms stores its data within the database that your WordPress site runs on. At this point, you may wonder whether it is possible to store the data of Gravity Forms in a different database, within the system that runs WordPress or in an external source.
While it is possible to achieve this integration, the easiest way to do so is through an add-on, wpDataTables. Once you have purchased and installed both Gravity Forms and wpDataTables, you can set up an external data source for an existing form with entries. You can also add wpDataTables data into a Gravity Form with GP Populate Anything. In case you are skeptical of starting the complex migration, wpDataTables provides a sandbox environment to test the whole process before you make a final decision. It is, however, difficult, though not impossible, to automate the process of complete migration from the existing database source of Gravity Forms.
Gravity Forms Google Sheets automatically syncs your Gravity Forms data with Google Sheets, which integrates with Data Studio (aka Looker Studio), BigQuery, and others.
In this tutorial, we discussed the need to understand the structure of the Gravity Forms database. We explored various tables that form the base for the functioning of Gravity Forms. Next, we looked at the process of forced database modifications for the plugin on an update. Finally, we analyzed the process of integration of Gravity Forms with an external database.
You need Gravity Perks to get the full power of Gravity Forms! Buy Gravity Perks today to all of our galactic Gravity Forms plugins!