Revision tracker's dynamic table creation can break Views

Created on 26 January 2017, over 7 years ago
Updated 3 May 2024, about 2 months ago

So it looks like WBM's revision tracker creates its table on-demand. This is a good idea in theory but it has problems in practice.

For example, if you want to add a Views relationship to the latest revision of the node, you'd better be damn sure you already have at least one versioned node in the database, or you will get horrible SQL errors as soon as you add the relationship:

Drupal\Core\Database\DatabaseExceptionWrapper: Exception in Content[content]: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'workbench_revision_tracker' doesn't exist: SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {node_field_data} node_field_data INNER JOIN {users_field_data} users_field_data_node_field_data ON node_field_data.uid = users_field_data_node_field_data.uid LEFT JOIN {workbench_revision_tracker} workbench_revision_tracker ON node_field_data.nid = workbench_revision_tracker.entity_id AND (workbench_revision_tracker.entity_type = :views_join_condition_0 AND workbench_revision_tracker.langcode = node_field_data.langcode) INNER JOIN {node_field_revision} node_field_revision_workbench_revision_tracker ON workbench_revision_tracker.revision_id = node_field_revision_workbench_revision_tracker.vid AND (workbench_revision_tracker.entity_type = :views_join_condition_2 AND node_field_revision_workbench_revision_tracker.langcode = workbench_revision_tracker.langcode) WHERE (( (node_field_data._deleted = :db_condition_placeholder_0) ))) subquery; Array ( [:db_condition_placeholder_0] => [:views_join_condition_0] => node [:views_join_condition_2] => node ) in Drupal\views\Plugin\views\query\Sql->execute() (line 1488 of core/modules/views/src/Plugin/views/query/Sql.php).

Workbench Moderation should define the revision tracking table at install time using hook_schema(), rather than on-demand creation. This fixes the Views problem, and possibly others that I can't foresee...

πŸ› Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024