Skip Navigation

[Closed] Need a description / Database schema for the toolset tables and how they relate

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 4 replies, has 2 voices.

Last updated by Christopher Amirian 1 month, 2 weeks ago.

Assisted by: Christopher Amirian.

Author
Posts
#2688247

Tell us what you are trying to do?
Understand the Database schema for custom sql queries. Also need to understand how the Toolset custom tables relate back to WP tables.

#2688276

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

That is too broad of a question and Toolset database tables are complicated that it is not possible to give proper info.

I suggest that you open up a Toolset installation database table and you will see what is there.

The only thing that I can tell is as follows:

Custom fields are added in posts_meta like any other WordPress custom field (only difference is it adds wpcf_ prefix for the custom field names)

Post types are added just like WordPress so everything is the same.

The other Toolset tables to handle additional aspects that Toolset adds such as relationship, forms, ,....

#2688303

Hi Christopher, sure let me be a little more specific.

1. toolset_associations table, has parent_id, child_id, relationship_id. How are these IDs connected to other WordPress tables? For example, is child_id connected to the Posts table ID (post_id) or is parent_id or both?
2. toolset_connected_elements, which has group_id and element_id, same question, how to determine which has the Post Id ?

Some ERD diagram like this would be helpful too: https://codex.wordpress.org/Database_Description

Thanks for your time.

#2688304

Maybe I can explain what I am attempting. We have about 70k posts and almost 2million postmeta entries. The Toolset Associations table has about 200k entries. I need to purge almost half of posts and related postmeta, which I can do based on a custom post status. Posts that are in the 'closed' status can be purged. I've tried via bulk delete plugins and it seems not possible due to the large amount of deletes. PHP times out, or plugin has issues. So I am reverting to SQL operations. For that reason I wanted to write a delete statement that can do it. I understand SQL support is out of scope so just wondering about the database tables. So far I have this delete SQL:

delete a,b,c,d,e, ta
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id )
LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id )
LEFT JOIN wp_term_taxonomy d ON ( d.term_taxonomy_id = b.term_taxonomy_id )
LEFT JOIN wp_terms e ON ( e.term_id = d.term_id )
LEFT JOIN wp_toolset_associations ta ON ( a.ID = ta.child_id)
WHERE a.post_type = 'referral' and a.post_status = 'closed'

#2688450

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

I am afraid that will be impossible to keep track of everything here as you might miss something here and there.

We do not have any table relationship schema to be able to share, and honestly the route you want to take seems to be impossible because of the amount of moving parts.

I can ask for the specific two questions you mentioned from the second tier support but I doubt it will help you.

If you would want to remove the whole meta data of the fields that Toolset has, there is a tool:

To completely remove the information from the database, you can go to Toolset > Post Fields (or User Fields, or Term Fields) and click "Post Field Control" at the bottom of the screen. Here you can find and delete any field and remove the data from the database at the same time. Make a backup of your site before using this feature.

If you need to have an answer for that specific one you mentioned I can ask the second tier and get back to you

The topic ‘[Closed] Need a description / Database schema for the toolset tables and how they relate’ is closed to new replies.