Use in production sites

Last updated on
17 February 2023

Using this module in production sites need particular precautions.

For Site administrators and Webmasters

Normally you don't need to use this module on your sites in production. Anyway if you need to update an entity type schema you can do it.

  1. Make a backup of the site.
  2. Test twice locally.
  3. put the site into maintain mode.
  4. Update entity types one by one using
    drush upe ENTITY_TYPE_ID
    method.

Contrib Module developer

Steps to follow:
1. Add entity_update module as a dependencies to .info.yml file and composer.json file.

Examples:
.info.yml file

dependencies:
  - drupal:entity_update

composer.json

  "require": {
    "drupal/entity_update": "^3.0"
  }

2. Use hook_update_N() to update your entity type.
Example :

$entity_type = \Drupal::entityTypeManager()->getStorage('THE_ENTITY_TYPE_ID');
$result = EntityUpdate::safeUpdateMain($entity_type->getEntityType());

Please follow this example : Update entities programmatically

Module : Entity Update

Help improve this page

Page status: No known problems

You can: