Database Structure

Here’s how Gravity Forms is structured within your database:

Note: This structure applies to Gravity Forms version 2.3 or higher.

Tables

Listed below you can find the names and definitions for tables created by Gravity Forms. WordPress adds a prefix to any tables created, so when checking them in your database you will notice all the tables have a prefix before their name, this prefix is set by the user during the installation of WordPress, so it can be different on each installation.

gf_addon_feed

Contains Gravity Forms feeds.

  • id
    Contains the unique feed ID.
  • form_id
    Contains the ID of the form that the feed is associated with.
  • is_active
    Defines if the feed is active or not. Integer is used as a boolean (0 is false, 1 is true).
  • feed_order
    The order in which the feed is processed if multiple feeds exist.
  • meta
    Meta information related to the feed. Stored as JSON.
  • addon_slug
    The slug of the add-on that the feed is associated with.

gf_addon_payment_callback

Contains information related to payment callbacks that have been received.

  • id
    The row ID.
  • lead_id
    The entry ID associated with the callback.
  • addon_slug
    The add-on associated with the callback.
  • callback_id
    The callback ID.
  • date_created
    The date that the callback was received.

gf_addon_payment_transaction

Contains transaction details.

  • id
    The transaction ID.
  • lead_id
    The entry ID associated with the transaction.
  • transaction_type
    The transaction type.
  • transaction_id
    The unique transaction ID.
  • subscription_id
    The subscription ID, if applicable.
  • is_recurring
    Defines if this is a recurring subscription. Integer is used as a boolean (0 is false, 1 is true).
  • amount
    The amount of the transaction.
  • date_created
    The date the transaction was created.

gf_draft_submissions

Holds draft submissions created by the save and continue feature.

  • uuid
    The unique ID of the draft submission.
  • email
    The email address associated with the draft submission.
  • form_id
    The form ID that the draft submission is associated with.
  • date_created
    The date the draft submission was created.
  • ip
    The IP address that created the draft submission.
  • source_url
    The URL that was used to submit the draft submission.
  • submission
    Submission details regarding the draft submission.

gf_entry

Contains Gravity Forms entries.

  • id
    The unique entry ID.
  • form_id
    The form ID that the entry is associated with.
  • post_id
    The ID of the post that was created from the entry, if applicable.
  • date_created
    The date that the entry was created.
  • date_updated
    The date that the entry was last updated.
  • is_starred
    If the entry is starred. Integer is used as a boolean (0 is false, 1 is true).
  • is_read
    If the entry has been marked as read. Integer is used as a boolean (0 is false, 1 is true).
  • ip
    The IP address that submitted the entry.
  • source_url
    The URL of where the submission took place.
  • user_agent
    The user agent of the entry submitter.
  • currency
    The currency used in the entry, if applicable.
  • payment_status
    The status of the payment, if applicable.
  • payment_date
    The date that the payment took place, if applicable.
  • payment_amount
    The amount of the payment, if applicable.
  • payment_method
    The transaction method used to process the payment, if applicable.
  • transaction_id
    The transaction ID associated with the entry, if applicable.
  • is_fulfilled
    If the transaction has been fulfilled, if applicable.
  • created_by
    The ID of the user that created the entry, if applicable.
  • transaction_type
    The transaction type, if applicable.
  • status
    The current entry status.

gf_entry_meta

Contains additional metadata related to entries. Details from fields as well as add-ons are stored here.

  • id
    The unique ID.
  • form_id
    The form ID that the entry meta is associated with.
  • entry_id
    The entry ID that the meta is associated with.
  • meta_key
    The meta key.
  • meta_value
    The value stored under the meta key.
  • item_index
    The item index.

gf_entry_notes

Contains notes that were placed on an entry.

  • id
    The note ID.
  • entry_id
    The entry ID that the note is associated with.
  • user_name
    The user name that created the note.
  • user_id
    The user ID that created the note.
  • date_created
    The date that the note was created.
  • value
    The contents of the note.
  • note_type
    The type of note that was left, if applicable.
  • sub_type
    The secondary note type, if applicable.

gf_form

Contains the forms that exist within Gravity Forms.

  • id
    The form ID.
  • title
    The form title.
  • date_created
    The date that the form was created.
  • is_active
    If the form is active. Integer is used as a boolean (0 is false, 1 is true).
  • is_trash
    If the form is trashed. Integer is used as a boolean (0 is false, 1 is true).

gf_form_meta

Contains metadata associated with forms.

  • form_id
    The form ID that the metadata is associated with.
  • display_meta
    Meta related to how the form and fields are configured.
  • entries_grid_meta
    Additional meta related to entries and how they will be displayed.
  • confirmations
    Confirmation configuration.
  • notifications
    Notification configuration.

gf_form_revisions

Contains form revisions. At the time of writing this documentation is only used for Consent fields

  • id
    The ID.
  • form_id
    The form ID that the form revision is associated with.
  • display_meta
    Meta related to how the form and fields are configured.
  • date_created
    The date that the revision was created.

gf_form_view

Contains details on form views.

  • id
    The ID.
  • form_id
    The form ID that the data is associated with.
  • date_created
    The date that the row was created.
  • ip
    The IP that accessed the form.
  • count
    The number of times that the IP accessed the form.

Changes from Gravity Forms 2.2

Introduction

The database schema was changed in Gravity Forms 2.3 to enable significant performance enhancements and to allow key features to be added. Code that uses the Gravity Forms API (GFAPI) will not be affected and will continue to work as before. However, custom code and add-ons that access the database tables directly will need updating.

Changes

The following changes were made to the tables and columns.

  • rg_lead -> gf_entry
  • rg_lead_details + rg_lead_meta tables -> gf_entry_meta
  • All lead_id columns -> entry_id
  • rg_form -> gf_form
  • rg_form_view -> gf_form_view
  • rg_form_meta -> gf_form_meta
  • rg_incomplete_submissions -> gf_draft_submissions
Note: Despite of tables gf_addon_feed, gf_addon_payment_callback and gf_addon_payment_transaction are using the gf_ prefix, they’re not part of the changes done in this version. If for any reason you need to delete the new tables to run the upgrade from scratch again, make sure to skip these tables.

The Migration Process

The automatic migration process creates the new tables and copies all the data over to the new tables in a series of background tasks. If the task stops, for example, due to a server restart then the migration will continue with a scheduled cron task. If there’s a database error then the migration will stop and try again later.