Update 8103 Fails for User Viewsreference Fields

Created on 24 August 2022, almost 2 years ago
Updated 17 October 2023, 8 months ago

Problem/Motivation

I have a viewsreference field that is attached to user entities to display a view of owned nodes. User fields in core are not revisionable, but update 8103 attempts to load the revision table for the field anyways.

CODE:

$tables = [
"{$entity_type_id}__$field_name",
"{$entity_type_id}_revision__$field_name",
];
$existing_data = [];
foreach ($tables as $table) {
    // Get the old data.
    $existing_data[$table] = $database->select($table)
        ->fields($table)
        ->execute()
        ->fetchAll(PDO::FETCH_ASSOC);
    // Wipe it.
    $database->truncate($table)->execute();
}



Throws this error when trying to run database updates demonstrating my point above:

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal9.user_revision__field_user_items' doesn't exist: SELECT "user_revision__field_user_items".* FROM "user_revision__field_user_items" "user_revision__field_user_items"; Array ( ) in viewsreference_update_8103() (line 52 of /app/web/modules/contrib/viewsreference/viewsreference.install).


🐛 Bug report
Status

Closed: duplicate

Version

2.0

Component

Code

Created by

🇺🇸United States sam.dufrin

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

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