diff --git a/core/lib/Drupal/Core/Entity/DatabaseStorageController.php b/core/lib/Drupal/Core/Entity/DatabaseStorageController.php index c6b3a9a..ed02154 100644 --- a/core/lib/Drupal/Core/Entity/DatabaseStorageController.php +++ b/core/lib/Drupal/Core/Entity/DatabaseStorageController.php @@ -1101,7 +1101,14 @@ static public function _fieldTableName(FieldInterface $field) { return "field_deleted_data_" . substr(hash('sha256', $field['uuid']), 0, 10); } else { - return "field_{$field['entity_type']}__{$field['field_name']}"; + $table_name = $field->entity_type . '__' . $field->name; + // Limit the table name to 50 characters, keeping a 14 characters margin + // for db prefixes. When needed, truncate and add a hash of the UUID for + // disambiguation. + if (strlen($table_name) > 50) { + $table_name = substr($table_name, 0, 40) . '_' . substr(hash('sha256', $field->uuid), 0, 10); + } + return $table_name; } } @@ -1130,7 +1137,14 @@ static public function _fieldRevisionTableName(FieldInterface $field) { return "field_deleted_revision_" . substr(hash('sha256', $field['uuid']), 0, 10); } else { - return "field_rev_{$field['entity_type']}__{$field['field_name']}"; + $table_name = $field->entity_type . '_revision__' . $field->name; + // Limit the table name to 50 characters, keeping a 14 characters margin + // for db prefixes. When needed, truncate and add a hash of the UUID for + // disambiguation. + if (strlen($table_name) > 50) { + $table_name = substr($table_name, 0, 40) . '_' . substr(hash('sha256', $field->uuid), 0, 10); + } + return $table_name; } } diff --git a/core/modules/field/lib/Drupal/field/Tests/Views/HandlerFieldFieldTest.php b/core/modules/field/lib/Drupal/field/Tests/Views/HandlerFieldFieldTest.php index 704f3b4..2002c0f 100644 --- a/core/modules/field/lib/Drupal/field/Tests/Views/HandlerFieldFieldTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/Views/HandlerFieldFieldTest.php @@ -96,7 +96,7 @@ protected function prepareView(ViewExecutable $view) { $view->initDisplay(); foreach ($this->fields as $key => $field) { $view->display_handler->options['fields'][$field['field_name']]['id'] = $field['field_name']; - $view->display_handler->options['fields'][$field['field_name']]['table'] = 'field_node__' . $field['field_name']; + $view->display_handler->options['fields'][$field['field_name']]['table'] = 'node__' . $field['field_name']; $view->display_handler->options['fields'][$field['field_name']]['field'] = $field['field_name']; } } diff --git a/core/modules/field/tests/modules/field_test_views/test_views/views.view.test_view_fieldapi.yml b/core/modules/field/tests/modules/field_test_views/test_views/views.view.test_view_fieldapi.yml index 18ad22e..b370ab1 100644 --- a/core/modules/field/tests/modules/field_test_views/test_views/views.view.test_view_fieldapi.yml +++ b/core/modules/field/tests/modules/field_test_views/test_views/views.view.test_view_fieldapi.yml @@ -16,7 +16,7 @@ display: provider: node field_name_0: id: field_name_0 - table: field_node__field_name_0 + table: node__field_name_0 field: field_name_0 plugin_id: field provider: field diff --git a/core/modules/user/user.install b/core/modules/user/user.install index b16bb93..6371077 100644 --- a/core/modules/user/user.install +++ b/core/modules/user/user.install @@ -817,7 +817,7 @@ function user_update_8012(&$sandbox) { $rows = db_query_range('SELECT uid, picture FROM {users} WHERE picture > 0', 0, 20)->fetchAllKeyed(); foreach ($rows as $uid => $fid) { // Add a row to the field data and revision tables. - db_insert('field_user__user_picture') + db_insert('user__user_picture') ->fields(array( 'bundle' => 'user', 'entity_id' => $uid, @@ -827,7 +827,7 @@ function user_update_8012(&$sandbox) { 'user_picture_target_id' => $fid, )) ->execute(); - db_insert('field_rev_user__user_picture') + db_insert('user_revision__user_picture') ->fields(array( 'bundle' => 'user', 'entity_id' => $uid, diff --git a/core/modules/views/config/views.view.comments_recent.yml b/core/modules/views/config/views.view.comments_recent.yml index 60f4c53..9b9db7d 100644 --- a/core/modules/views/config/views.view.comments_recent.yml +++ b/core/modules/views/config/views.view.comments_recent.yml @@ -378,7 +378,7 @@ display: provider: comment comment: id: comment - table: field_comment__comment_body + table: comment__comment_body field: comment_body label: '' plugin_id: field diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_admin_ui.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_admin_ui.yml index b4046d3..1c993fb 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_admin_ui.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_exposed_admin_ui.yml @@ -26,7 +26,7 @@ display: provider: views body_value: id: body_value - table: field_node__body + table: node__body field: body_value relationship: none group_type: group