2

I'm working in a migration from Drupal 7 and I'm trying to find out where the value of some fields are. I've tried but could not find an answer for this on this site.

I see each field has a pair of tables:

field_data_field_{field_name}
field_revision_field_{field_name}

Some of the field_data tables have a column named field_{field_name}_value and that's easy to find.

However, other tables don't have this column and have one called field_{field_name}_target_id. Inside it they have an integer but I can not find where it is referenced to...

I'm looking only at the database, I don't have the code (yet) and I don't know if this is related to a module, or if this is Drupal native. Anyhow, I can't find any other table with the values that relate to these Ids...

2

Different field types can have different data columns in the database. Most modules have a 'value' column. Others, like reference fields, have a 'target_id' column instead. The Date module can create a 'value1' and 'value2' column (for start date / end date).

You can't assume that it is always 'value'.

The 'target_id' value refers to the ID of the entity being referenced. So, if the field is referencing nodes, target_id is holding a node id value. If the field was referencing users, the value stored is the user id.

  • @LeoGermani if it helped please accept the answer using the tick below the voting arrows on the left – CalvT Mar 28 '17 at 9:41
  • How we can known the 'target_id' field which entity is referencing? – albert May 3 '18 at 15:22
  • I have no idea what this means. – Kevin May 3 '18 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.