Skip Navigation

[Resolved] Relationships dissappeard after the last update

This support ticket is created 3 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+00:00)

This topic contains 17 replies, has 2 voices.

Last updated by simonM-5 3 years, 5 months ago.

Assisted by: Jamal.

Author
Posts
#1798487

Hi Jamal

1) I think I solved the issue with the Relationships.

I installed the toolset plugins on another clean environment and exported the SQL structure of the following tables, then used the SQL to create the tables, indices etc on our dev environment.
- wp_toolset_relationships
- wp_toolset_associations
- wp_toolset_connected_elements

Now I can see the Relationships in the GUI, the related Job Ads and related Nanny Ads are working again in Messages.

Can you please verify that what I have done is correct?

2) Regarding my previous question (2) that you wanted clarification on:
When we are post referencing fields from different post types, it would seem logical to me that we should only be able to post reference fields from post types for which there exists a Relationship between them.

So if we go to Toolset > Custom Fields > (open some Field Group, as an example in our environment Messages) > Add New Field.

When creating a new field to store a post reference from another Post Type, surely when the picklist "Post Type to connect" drops down, we should only get Post Types for which there exists a relationship. At the moment, all the Post Types are available.

Kind regards
Simon

Below is the SQL I used to re-create the tables:

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
--
-- Table structure for table `wp_toolset_relationships`
--
CREATE TABLE `wp_toolset_relationships` (
`id` bigint(20) UNSIGNED NOT NULL,
`slug` varchar(190) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`display_name_plural` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`display_name_singular` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`driver` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`parent_domain` varchar(20) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`parent_types` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
`child_domain` varchar(20) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`child_types` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
`intermediary_type` varchar(20) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`ownership` varchar(8) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT 'none',
`cardinality_parent_max` int(10) NOT NULL DEFAULT '-1',
`cardinality_parent_min` int(10) NOT NULL DEFAULT '0',
`cardinality_child_min` int(10) NOT NULL DEFAULT '0',
`cardinality_child_max` int(10) NOT NULL DEFAULT '-1',
`is_distinct` tinyint(1) NOT NULL DEFAULT '0',
`scope` longtext COLLATE utf8mb4_unicode_520_ci NOT NULL,
`origin` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`role_name_parent` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`role_name_child` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`role_name_intermediary` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`role_label_parent_singular` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`role_label_child_singular` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`role_label_parent_plural` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`role_label_child_plural` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`needs_legacy_support` tinyint(1) NOT NULL DEFAULT '0',
`is_active` tinyint(1) NOT NULL DEFAULT '0',
`autodelete_intermediary` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `wp_toolset_relationships`
--
ALTER TABLE `wp_toolset_relationships`
ADD PRIMARY KEY (`id`),
ADD KEY `slug` (`slug`),
ADD KEY `is_active` (`is_active`),
ADD KEY `needs_legacy_support` (`needs_legacy_support`),
ADD KEY `parent` (`parent_domain`,`parent_types`),
ADD KEY `child` (`child_domain`,`child_types`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `wp_toolset_relationships`
--
ALTER TABLE `wp_toolset_relationships`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;COMMIT;

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
--
-- Table structure for table `wp_toolset_associations`
--
CREATE TABLE `wp_toolset_associations` (
`id` bigint(20) UNSIGNED NOT NULL,
`relationship_id` bigint(20) UNSIGNED NOT NULL,
`parent_id` bigint(20) UNSIGNED NOT NULL,
`child_id` bigint(20) UNSIGNED NOT NULL,
`intermediary_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `wp_toolset_associations`
--
ALTER TABLE `wp_toolset_associations`
ADD PRIMARY KEY (`id`),
ADD KEY `relationship_id` (`relationship_id`),
ADD KEY `parent_id` (`parent_id`,`relationship_id`),
ADD KEY `child_id` (`child_id`,`relationship_id`),
ADD KEY `intermediary_id` (`intermediary_id`,`relationship_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `wp_toolset_associations`
--
ALTER TABLE `wp_toolset_associations`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;COMMIT;

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
--
-- Table structure for table `wp_toolset_connected_elements`
--
CREATE TABLE `wp_toolset_connected_elements` (
`id` bigint(20) UNSIGNED NOT NULL,
`element_id` bigint(20) UNSIGNED NOT NULL,
`domain` varchar(20) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
`wpml_trid` bigint(20) UNSIGNED DEFAULT NULL,
`lang_code` varchar(7) COLLATE utf8mb4_unicode_520_ci DEFAULT '',
`group_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `wp_toolset_connected_elements`
--
ALTER TABLE `wp_toolset_connected_elements`
ADD PRIMARY KEY (`id`),
ADD KEY `group_id` (`group_id`),
ADD KEY `element` (`domain`,`element_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `wp_toolset_connected_elements`
--
ALTER TABLE `wp_toolset_connected_elements`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;COMMIT;

#1798511

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Hello Simon,

The SQL used to create the table seems correct to me. As you have exported from a new installation, it will be correct, you will only need to make sure that the same tables' prefix (wp_) is used in both installations. Otherwise, you will have to adapt your SQL code or to rename the tables after creation. Congratulations on getting this done 🙂

Regarding your statement When creating a new field to store a post reference from another Post Type, surely when the picklist "Post Type to connect" drops down, we should only get Post Types for which there exists a relationship. At the moment, all the Post Types are available.
This is not true, because, "Post Reference" fields are managed by a kind of "universal and hidden relationship". Universal, because it will work for every custom post type. Hidden, because you can't use its slug, or use it as a relationship in views or forms.
But, if you have created a relationship, and want to connect an existing post, you will only be able to connect the post from the custom post type used in the relationship.

#1799977

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.