Commit c72f39ad authored by catch's avatar catch

Issue #2057401 by plach, socketwench, kfritsche: Fixed Make the node entity...

Issue #2057401 by plach, socketwench, kfritsche: Fixed Make the node entity database schema sensible.
parent f4c5be06
...@@ -525,14 +525,17 @@ function drupal_write_record($table, &$record, $primary_keys = array()) { ...@@ -525,14 +525,17 @@ function drupal_write_record($table, &$record, $primary_keys = array()) {
* The converted value. * The converted value.
*/ */
function drupal_schema_get_field_value(array $info, $value) { function drupal_schema_get_field_value(array $info, $value) {
if ($info['type'] == 'int' || $info['type'] == 'serial') { // Preserve legal NULL values.
$value = (int) $value; if (isset($value) || !empty($info['not null'])) {
} if ($info['type'] == 'int' || $info['type'] == 'serial') {
elseif ($info['type'] == 'float') { $value = (int) $value;
$value = (float) $value; }
} elseif ($info['type'] == 'float') {
else { $value = (float) $value;
$value = (string) $value; }
else {
$value = (string) $value;
}
} }
return $value; return $value;
} }
......
...@@ -318,7 +318,7 @@ protected function buildQuery($ids, $revision_id = FALSE) { ...@@ -318,7 +318,7 @@ protected function buildQuery($ids, $revision_id = FALSE) {
if ($this->revisionKey) { if ($this->revisionKey) {
// Add all fields from the {entity_revision} table. // Add all fields from the {entity_revision} table.
$entity_revision_fields = drupal_map_assoc(drupal_schema_fields_sql($this->entityInfo['revision_table'])); $entity_revision_fields = drupal_map_assoc(drupal_schema_fields_sql($this->entityInfo['revision_table']));
// The id field is provided by entity, so remove it. // The ID field is provided by entity, so remove it.
unset($entity_revision_fields[$this->idKey]); unset($entity_revision_fields[$this->idKey]);
// Remove all fields from the base table that are also fields by the same // Remove all fields from the base table that are also fields by the same
...@@ -331,7 +331,7 @@ protected function buildQuery($ids, $revision_id = FALSE) { ...@@ -331,7 +331,7 @@ protected function buildQuery($ids, $revision_id = FALSE) {
} }
$query->fields('revision', $entity_revision_fields); $query->fields('revision', $entity_revision_fields);
// Compare revision id of the base and revision table, if equal then this // Compare revision ID of the base and revision table, if equal then this
// is the default revision. // is the default revision.
$query->addExpression('base.' . $this->revisionKey . ' = revision.' . $this->revisionKey, 'isDefaultRevision'); $query->addExpression('base.' . $this->revisionKey . ' = revision.' . $this->revisionKey, 'isDefaultRevision');
} }
......
...@@ -76,6 +76,7 @@ public function testAggregatorItemView() { ...@@ -76,6 +76,7 @@ public function testAggregatorItemView() {
// Add a image to ensure that the sanitizing can be tested below. // Add a image to ensure that the sanitizing can be tested below.
$values['author'] = $this->randomName() . '<img src="http://example.com/example.png" \>"'; $values['author'] = $this->randomName() . '<img src="http://example.com/example.png" \>"';
$values['link'] = 'http://drupal.org/node/' . mt_rand(1000, 10000); $values['link'] = 'http://drupal.org/node/' . mt_rand(1000, 10000);
$values['guid'] = $this->randomString();
$aggregator_item = $this->itemStorageController->create($values); $aggregator_item = $this->itemStorageController->create($values);
$aggregator_item->save(); $aggregator_item->save();
......
...@@ -31,7 +31,7 @@ public static function getInfo() { ...@@ -31,7 +31,7 @@ public static function getInfo() {
function setUp() { function setUp() {
parent::setUp(); parent::setUp();
$this->installSchema('node', array('node', 'node_access', 'node_field_data', 'node_field_revision')); $this->installSchema('node', array('node', 'node_access', 'node_field_data', 'node_field_revision', 'node_revision'));
$this->installSchema('file', array('file_managed', 'file_usage')); $this->installSchema('file', array('file_managed', 'file_usage'));
// Add text formats. // Add text formats.
......
...@@ -71,7 +71,7 @@ function testViewsData() { ...@@ -71,7 +71,7 @@ function testViewsData() {
$this->assertTrue(isset($data[$revision_table])); $this->assertTrue(isset($data[$revision_table]));
// The node field should join against node. // The node field should join against node.
$this->assertTrue(isset($data[$current_table]['table']['join']['node'])); $this->assertTrue(isset($data[$current_table]['table']['join']['node']));
$this->assertTrue(isset($data[$revision_table]['table']['join']['node_field_revision'])); $this->assertTrue(isset($data[$revision_table]['table']['join']['node_revision']));
$expected_join = array( $expected_join = array(
'left_field' => 'nid', 'left_field' => 'nid',
...@@ -88,7 +88,7 @@ function testViewsData() { ...@@ -88,7 +88,7 @@ function testViewsData() {
array('field' => 'deleted', 'value' => 0, 'numeric' => TRUE), array('field' => 'deleted', 'value' => 0, 'numeric' => TRUE),
), ),
); );
$this->assertEqual($expected_join, $data[$revision_table]['table']['join']['node_field_revision']); $this->assertEqual($expected_join, $data[$revision_table]['table']['join']['node_revision']);
} }
} }
...@@ -422,7 +422,7 @@ display: ...@@ -422,7 +422,7 @@ display:
provider: views provider: views
langcode: langcode:
id: langcode id: langcode
table: node table: node_revision
field: langcode field: langcode
operator: in operator: in
value: { } value: { }
......
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
* }, * },
* base_table = "node", * base_table = "node",
* data_table = "node_field_data", * data_table = "node_field_data",
* revision_table = "node_field_revision", * revision_table = "node_revision",
* revision_data_table = "node_field_revision",
* uri_callback = "node_uri", * uri_callback = "node_uri",
* fieldable = TRUE, * fieldable = TRUE,
* translatable = TRUE, * translatable = TRUE,
...@@ -396,11 +397,6 @@ public static function baseFieldDefinitions($entity_type) { ...@@ -396,11 +397,6 @@ public static function baseFieldDefinitions($entity_type) {
'description' => t('A boolean indicating whether the node should be displayed at the top of lists in which it appears.'), 'description' => t('A boolean indicating whether the node should be displayed at the top of lists in which it appears.'),
'type' => 'boolean_field', 'type' => 'boolean_field',
); );
$properties['translate'] = array(
'label' => t('Translate'),
'description' => t('A boolean indicating whether this translation page needs to be updated.'),
'type' => 'boolean_field',
);
$properties['revision_timestamp'] = array( $properties['revision_timestamp'] = array(
'label' => t('Revision timestamp'), 'label' => t('Revision timestamp'),
'description' => t('The time that the current revision was created.'), 'description' => t('The time that the current revision was created.'),
......
...@@ -21,7 +21,7 @@ class UidRevision extends Uid { ...@@ -21,7 +21,7 @@ class UidRevision extends Uid {
public function query($group_by = FALSE) { public function query($group_by = FALSE) {
$this->ensureMyTable(); $this->ensureMyTable();
$placeholder = $this->placeholder(); $placeholder = $this->placeholder();
$this->query->addWhereExpression(0, "$this->tableAlias.revision_uid = $placeholder OR ((SELECT COUNT(DISTINCT vid) FROM {node_field_revision} nfr WHERE nfr.revision_uid = $placeholder AND nfr.nid = $this->tableAlias.nid) > 0)", array($placeholder => $this->argument)); $this->query->addWhereExpression(0, "$this->tableAlias.revision_uid = $placeholder OR ((SELECT COUNT(DISTINCT vid) FROM {node_revision} nr WHERE nfr.revision_uid = $placeholder AND nr.nid = $this->tableAlias.nid) > 0)", array($placeholder => $this->argument));
} }
} }
...@@ -57,7 +57,7 @@ public static function create(ContainerInterface $container, array $configuratio ...@@ -57,7 +57,7 @@ public static function create(ContainerInterface $container, array $configuratio
public function titleQuery() { public function titleQuery() {
$titles = array(); $titles = array();
$results = $this->database->query('SELECT npr.vid, npr.nid, npr.title FROM {node_field_revision} npr WHERE npr.vid IN (:vids)', array(':vids' => $this->value))->fetchAllAssoc('vid', PDO::FETCH_ASSOC); $results = $this->database->query('SELECT nr.vid, nr.nid, npr.title FROM {node_revision} nr WHERE nr.vid IN (:vids)', array(':vids' => $this->value))->fetchAllAssoc('vid', PDO::FETCH_ASSOC);
$nids = array(); $nids = array();
foreach ($results as $result) { foreach ($results as $result) {
$nids[] = $result['nid']; $nids[] = $result['nid'];
......
...@@ -28,7 +28,7 @@ class RevisionLink extends Link { ...@@ -28,7 +28,7 @@ class RevisionLink extends Link {
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options); parent::init($view, $display, $options);
$this->additional_fields['node_vid'] = array('table' => 'node_field_revision', 'field' => 'vid'); $this->additional_fields['node_vid'] = array('table' => 'node_revision', 'field' => 'vid');
} }
public function access() { public function access() {
......
...@@ -27,7 +27,7 @@ public function query($group_by = FALSE) { ...@@ -27,7 +27,7 @@ public function query($group_by = FALSE) {
$args = array_values($this->value); $args = array_values($this->value);
$this->query->addWhereExpression($this->options['group'], "$this->tableAlias.uid IN($placeholder) OR $this->query->addWhereExpression($this->options['group'], "$this->tableAlias.uid IN($placeholder) OR
((SELECT COUNT(DISTINCT vid) FROM {node_field_revision} nfr WHERE nfr.revision_uid IN ($placeholder) AND nfr.nid = $this->tableAlias.nid) > 0)", array($placeholder => $args), ((SELECT COUNT(DISTINCT vid) FROM {node_revision} nr WHERE nr.revision_uid IN ($placeholder) AND nr.nid = $this->tableAlias.nid) > 0)", array($placeholder => $args),
$args); $args);
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* *
* @ViewsWizard( * @ViewsWizard(
* id = "node_revision", * id = "node_revision",
* base_table = "node_field_revision", * base_table = "node_revision",
* title = @Translation("Content revisions") * title = @Translation("Content revisions")
* ) * )
*/ */
...@@ -36,7 +36,7 @@ class NodeRevision extends WizardPluginBase { ...@@ -36,7 +36,7 @@ class NodeRevision extends WizardPluginBase {
*/ */
protected $pathField = array( protected $pathField = array(
'id' => 'vid', 'id' => 'vid',
'table' => 'node_field_revision', 'table' => 'node_revision',
'field' => 'vid', 'field' => 'vid',
'exclude' => TRUE, 'exclude' => TRUE,
'alter' => array( 'alter' => array(
...@@ -97,7 +97,7 @@ protected function defaultDisplayOptions() { ...@@ -97,7 +97,7 @@ protected function defaultDisplayOptions() {
/* Field: Content revision: Created date */ /* Field: Content revision: Created date */
$display_options['fields']['timestamp']['id'] = 'timestamp'; $display_options['fields']['timestamp']['id'] = 'timestamp';
$display_options['fields']['timestamp']['table'] = 'node_field_revision'; $display_options['fields']['timestamp']['table'] = 'node_revision';
$display_options['fields']['timestamp']['field'] = 'timestamp'; $display_options['fields']['timestamp']['field'] = 'timestamp';
$display_options['fields']['timestamp']['provider'] = 'node'; $display_options['fields']['timestamp']['provider'] = 'node';
$display_options['fields']['timestamp']['alter']['alter_text'] = 0; $display_options['fields']['timestamp']['alter']['alter_text'] = 0;
......
...@@ -26,7 +26,7 @@ public static function getInfo() { ...@@ -26,7 +26,7 @@ public static function getInfo() {
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();
$this->installSchema('node', array('node', 'node_field_data', 'node_field_revision')); $this->installSchema('node', array('node', 'node_field_data', 'node_field_revision', 'node_revision'));
} }
/** /**
......
...@@ -32,6 +32,7 @@ public static function getInfo() { ...@@ -32,6 +32,7 @@ public static function getInfo() {
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();
$this->installSchema('node', 'node'); $this->installSchema('node', 'node');
$this->installSchema('node', 'node_revision');
$this->installSchema('node', 'node_field_data'); $this->installSchema('node', 'node_field_data');
$this->installSchema('node', 'node_field_revision'); $this->installSchema('node', 'node_field_revision');
$this->installSchema('user', array('users')); $this->installSchema('user', array('users'));
......
...@@ -134,14 +134,14 @@ function testRevisions() { ...@@ -134,14 +134,14 @@ function testRevisions() {
'%title' => $nodes[1]->getTitle(), '%title' => $nodes[1]->getTitle(),
)), )),
'Revision deleted.'); 'Revision deleted.');
$this->assertTrue(db_query('SELECT COUNT(vid) FROM {node_field_revision} WHERE nid = :nid and vid = :vid', $this->assertTrue(db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid and vid = :vid',
array(':nid' => $node->id(), ':vid' => $nodes[1]->getRevisionId()))->fetchField() == 0, array(':nid' => $node->id(), ':vid' => $nodes[1]->getRevisionId()))->fetchField() == 0,
'Revision not found.'); 'Revision not found.');
// Set the revision timestamp to an older date to make sure that the // Set the revision timestamp to an older date to make sure that the
// confirmation message correctly displays the stored revision date. // confirmation message correctly displays the stored revision date.
$old_revision_date = REQUEST_TIME - 86400; $old_revision_date = REQUEST_TIME - 86400;
db_update('node_field_revision') db_update('node_revision')
->condition('vid', $nodes[2]->getRevisionId()) ->condition('vid', $nodes[2]->getRevisionId())
->fields(array( ->fields(array(
'revision_timestamp' => $old_revision_date, 'revision_timestamp' => $old_revision_date,
......
...@@ -114,12 +114,12 @@ function testRevisions() { ...@@ -114,12 +114,12 @@ function testRevisions() {
$this->assertRaw(t('Revision from %revision-date of @type %title has been deleted.', $this->assertRaw(t('Revision from %revision-date of @type %title has been deleted.',
array('%revision-date' => format_date($nodes[1]->getRevisionCreationTime()), array('%revision-date' => format_date($nodes[1]->getRevisionCreationTime()),
'@type' => 'Basic page', '%title' => $nodes[1]->label())), 'Revision deleted.'); '@type' => 'Basic page', '%title' => $nodes[1]->label())), 'Revision deleted.');
$this->assertTrue(db_query('SELECT COUNT(vid) FROM {node_field_revision} WHERE nid = :nid and vid = :vid', array(':nid' => $node->id(), ':vid' => $nodes[1]->getRevisionId()))->fetchField() == 0, 'Revision not found.'); $this->assertTrue(db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid and vid = :vid', array(':nid' => $node->id(), ':vid' => $nodes[1]->getRevisionId()))->fetchField() == 0, 'Revision not found.');
// Set the revision timestamp to an older date to make sure that the // Set the revision timestamp to an older date to make sure that the
// confirmation message correctly displays the stored revision date. // confirmation message correctly displays the stored revision date.
$old_revision_date = REQUEST_TIME - 86400; $old_revision_date = REQUEST_TIME - 86400;
db_update('node_field_revision') db_update('node_revision')
->condition('vid', $nodes[2]->getRevisionId()) ->condition('vid', $nodes[2]->getRevisionId())
->fields(array( ->fields(array(
'revision_timestamp' => $old_revision_date, 'revision_timestamp' => $old_revision_date,
......
...@@ -34,7 +34,7 @@ public static function getInfo() { ...@@ -34,7 +34,7 @@ public static function getInfo() {
*/ */
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();
$this->installSchema('node', array('node', 'node_field_data', 'node_field_revision')); $this->installSchema('node', array('node', 'node_field_data', 'node_field_revision', 'node_revision'));
// Create a node type for testing. // Create a node type for testing.
$type = entity_create('node_type', array('type' => 'page', 'name' => 'page')); $type = entity_create('node_type', array('type' => 'page', 'name' => 'page'));
......
...@@ -53,8 +53,8 @@ public function testNodeRevisionRelationship() { ...@@ -53,8 +53,8 @@ public function testNodeRevisionRelationship() {
$node_revision->save(); $node_revision->save();
$column_map = array( $column_map = array(
'vid' => 'vid', 'vid' => 'vid',
'node_field_revision_nid' => 'node_field_revision_nid', 'node_revision_nid' => 'node_revision_nid',
'node_node_field_revision_nid' => 'node_node_field_revision_nid', 'node_node_revision_nid' => 'node_node_revision_nid',
); );
// Here should be two rows. // Here should be two rows.
...@@ -63,13 +63,13 @@ public function testNodeRevisionRelationship() { ...@@ -63,13 +63,13 @@ public function testNodeRevisionRelationship() {
$resultset_nid = array( $resultset_nid = array(
array( array(
'vid' => '1', 'vid' => '1',
'node_field_revision_nid' => '1', 'node_revision_nid' => '1',
'node_node_field_revision_nid' => '1', 'node_node_revision_nid' => '1',
), ),
array( array(
'vid' => '2', 'vid' => '2',
'node_field_revision_nid' => '1', 'node_revision_nid' => '1',
'node_node_field_revision_nid' => '1', 'node_node_revision_nid' => '1',
), ),
); );
$this->assertIdenticalResultset($view_nid, $resultset_nid, $column_map); $this->assertIdenticalResultset($view_nid, $resultset_nid, $column_map);
...@@ -80,8 +80,8 @@ public function testNodeRevisionRelationship() { ...@@ -80,8 +80,8 @@ public function testNodeRevisionRelationship() {
$resultset_vid = array( $resultset_vid = array(
array( array(
'vid' => '2', 'vid' => '2',
'node_field_revision_nid' => '1', 'node_revision_nid' => '1',
'node_node_field_revision_nid' => '1', 'node_node_revision_nid' => '1',
), ),
); );
$this->assertIdenticalResultset($view_vid, $resultset_vid, $column_map); $this->assertIdenticalResultset($view_vid, $resultset_vid, $column_map);
......
This diff is collapsed.
...@@ -1124,7 +1124,7 @@ function node_last_changed($nid, $langcode = NULL) { ...@@ -1124,7 +1124,7 @@ function node_last_changed($nid, $langcode = NULL) {
*/ */
function node_revision_list(EntityInterface $node) { function node_revision_list(EntityInterface $node) {
$revisions = array(); $revisions = array();
$result = db_query('SELECT nfr.vid, nfr.title, nfr.log, nfr.revision_uid AS uid, n.vid AS current_vid, nfr.revision_timestamp, u.name FROM {node_field_revision} nfr LEFT JOIN {node} n ON n.vid = nfr.vid INNER JOIN {users} u ON u.uid = nfr.revision_uid WHERE nfr.nid = :nid AND nfr.default_langcode = 1 ORDER BY nfr.vid DESC', array(':nid' => $node->id())); $result = db_query('SELECT nr.vid, nfr.title, nr.log, nr.revision_uid AS uid, n.vid AS current_vid, nr.revision_timestamp, u.name FROM {node_field_revision} nfr JOIN {node_revision} nr ON nr.vid = nfr.vid LEFT JOIN {node} n ON n.vid = nfr.vid INNER JOIN {users} u ON u.uid = nr.revision_uid WHERE nfr.nid = :nid AND nfr.default_langcode = 1 ORDER BY nfr.vid DESC', array(':nid' => $node->id()));
foreach ($result as $revision) { foreach ($result as $revision) {
$revisions[$revision->vid] = $revision; $revisions[$revision->vid] = $revision;
} }
...@@ -2139,7 +2139,7 @@ function node_file_download_access($field, EntityInterface $entity, File $file) ...@@ -2139,7 +2139,7 @@ function node_file_download_access($field, EntityInterface $entity, File $file)
*/ */
function node_language_delete($language) { function node_language_delete($language) {
// On nodes with this language, unset the language. // On nodes with this language, unset the language.
db_update('node') db_update('node_revision')
->fields(array('langcode' => '')) ->fields(array('langcode' => ''))
->condition('langcode', $language->id) ->condition('langcode', $language->id)
->execute(); ->execute();
......
...@@ -198,25 +198,6 @@ function node_views_data() { ...@@ -198,25 +198,6 @@ function node_views_data() {
), ),
); );
if (module_exists('language')) {
$data['node']['langcode'] = array(
'title' => t('Language'),
'help' => t('The language the content is in.'),
'field' => array(
'id' => 'node_language',
),
'filter' => array(
'id' => 'language',
),
'argument' => array(
'id' => 'language',
),
'sort' => array(
'id' => 'standard',
),
);
}
if (\Drupal::moduleHandler()->moduleExists('content_translation')) { if (\Drupal::moduleHandler()->moduleExists('content_translation')) {
$data['node']['translation_link'] = array( $data['node']['translation_link'] = array(
'title' => t('Translation link'), 'title' => t('Translation link'),
...@@ -419,15 +400,14 @@ function node_views_data() { ...@@ -419,15 +400,14 @@ function node_views_data() {
), ),
); );
$data['node_field_revision']['table']['entity type'] = 'node'; $data['node_revision']['table']['entity type'] = 'node';
// Define the base group of this table. Fields that don't have a group defined // Define the base group of this table. Fields that don't have a group defined
// will go into this field by default. // will go into this field by default.
$data['node_field_revision']['table']['group'] = t('Content revision'); $data['node_revision']['table']['group'] = t('Content revision');
$data['node_field_revision']['table']['wizard_id'] = 'node_revision'; $data['node_revision']['table']['wizard_id'] = 'node_revision';
// Advertise this table as a possible base table. // Advertise this table as a possible base table.
$data['node_field_revision']['table']['base'] = array( $data['node_revision']['table']['base'] = array(
'field' => 'vid', 'field' => 'vid',
'title' => t('Content revision'), 'title' => t('Content revision'),
'help' => t('Content revision is a history of changes to content.'), 'help' => t('Content revision is a history of changes to content.'),
...@@ -437,25 +417,14 @@ function node_views_data() { ...@@ -437,25 +417,14 @@ function node_views_data() {
); );
// For other base tables, explain how we join. // For other base tables, explain how we join.
$data['node_field_revision']['table']['join'] = array( $data['node_revision']['table']['join'] = array(
'node' => array( 'node' => array(
'left_field' => 'vid', 'left_field' => 'vid',
'field' => 'vid', 'field' => 'vid',
), ),
); );
$data['node_field_revision']['revision_uid'] = array( $data['node_revision']['nid'] = array(
'title' => t('User'),
'help' => t('Relate a content revision to the user who created the revision.'),
'relationship' => array(
'id' => 'standard',
'base' => 'users',
'base field' => 'uid',
'label' => t('revision user'),
),
);
$data['node_field_revision']['nid'] = array(
'title' => t('Nid'), 'title' => t('Nid'),
'help' => t('The revision NID of the content revision.'), 'help' => t('The revision NID of the content revision.'),
'field' => array( 'field' => array(
...@@ -480,7 +449,7 @@ function node_views_data() { ...@@ -480,7 +449,7 @@ function node_views_data() {
), ),
); );
$data['node_field_revision']['vid'] = array( $data['node_revision']['vid'] = array(
'title' => t('Vid'), 'title' => t('Vid'),
'help' => t('The revision ID of the content revision.'), 'help' => t('The revision ID of the content revision.'),
'field' => array( 'field' => array(
...@@ -505,6 +474,61 @@ function node_views_data() { ...@@ -505,6 +474,61 @@ function node_views_data() {
), ),
); );
if (\Drupal::moduleHandler()->moduleExists('language')) {
$data['node_revision']['langcode'] = array(
'title' => t('Language'),
'help' => t('The language the content is in.'),
'field' => array(
'id' => 'node_language',
),
'filter' => array(
'id' => 'language',
),
'argument' => array(
'id' => 'language',
),
'sort' => array(
'id' => 'standard',
),
);
}
$data['node_revision']['log'] = array(
'title' => t('Log message'),
'help' => t('The log message entered when the revision was created.'),
'field' => array(
'id' => 'xss',
),
'filter' => array(
'id' => 'string',
),
);
$data['node_revision']['revision_uid'] = array(
'title' => t('User'),
'help' => t('Relate a content revision to the user who created the revision.'),
'relationship' => array(
'id' => 'standard',
'base' => 'users',
'base field' => 'uid',
'label' => t('revision user'),
),
);
$data['node_field_revision']['table']['entity type'] = 'node';
// Define the base group of this table. Fields that don't have a group defined
// will go into this field by default.
$data['node_field_revision']['table']['group'] = t('Content revision');
$data['node_field_revision']['table']['wizard_id'] = 'node_field_revision';