2013-10-14 17:39



When you delete a field of a content type from Drupal 7, does it delete it from the database as well? For example I have a content type with 20 fields and about 250000 nodes. If I delete a field, will it delete the 250000 field values as well? Thanks.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • dqjfw40446 dqjfw40446 8年前

    Yes -- all data from that field will be deleted because the table in the database containing the data will be deleted.

    点赞 评论 复制链接分享
  • dongxiansi0158 dongxiansi0158 8年前

    When you delete a field from a content type in Drupal 7 (and possibly Drupal 8, but I am not yet sure) it gets away from your content type and you cannot access the data any more. Nevertheless, if you have more than a small amount of nodes with values for that field, the actual content may remain in the database for a time, in tables named like field_deleted_data_<NUMBER>, where <NUMBER> is the id of your field in the field_config table.

    The data gets actually purged from the database in small batches over the time via hook_cron. The amount of data that gets deleted on each run of cron is defined in the field_purge_batch_size variable, which has by default a value of 10 (in field.module). When there is no data left in the table, the remaining field configuration data are deleted too.

    You can check Drupal API documentation for field_delete_field and field_purge_batch for further references.

    点赞 评论 复制链接分享