All Posts

Ninja Forms Database Schema post

Ninja Forms leverages three (3) main database tables for storing form and form action data:

  • nf_objects
  • nf_objectmeta
  • nf_relationships

The nf_objects and nf_objectmeta tables mirror the setup between the WordPress posts and postmeta tables. With this setup, the nf_objects table is essentially a list of objects without any real information about each object. This keeps the table small and the queries fast.

[caption id="attachment_424" align="aligncenter" width="1024"]The nf_objects table. Ninja Forms objects.[/caption]

If information about an object is needed, then a quick call to the nf_objectmeta table will tell you everything that you need to know.

For example, we can see from the nf_objectmeta table that the object with an ID of 2 is of type email.

[caption id="attachment_426" align="aligncenter" width="1024"]The nf_objectmeta table. Meta Data for Ninja Forms Object ID #2.[/caption]

All meta data for each object is stored in the nf_objectmeta table, with the exception of relationship information. Instead, the nf_relationship table is used to lookup a relationship between two objects in the nf_objects table, with the nf_relationships table being used as a Junction Table.

Using the previous example of the object with an ID of 2, we can see from the nf_relationships table that the notification is a child of a form object.

[caption id="attachment_430" align="aligncenter" width="1024"]The nf_relationships table. The relationship between a Object ID #2 and Object ID #1.[/caption]

Although this data is separated across three different tables in the database, the information appears together in the WordPress dashboard.

[caption id="attachment_433" align="aligncenter" width="1024"]Ninja Forms Email Action The "Emails & Actions" tab in Ninja Forms.[/caption]