Rollback & Recovery#
Entity Builder provides comprehensive rollback support for recovering from failed or unwanted operations.
How Rollback Works#
When operations are executed, Entity Builder stores the data needed to reverse each operation:
flowchart LR
Apply[Apply Definition] -->|Stores| RB[(EbRollback)]
RB -->|Contains| OP1[Operation 1 Data]
RB -->|Contains| OP2[Operation 2 Data]
RB -->|Contains| OP3[Operation 3 Data]
Rollback[Execute Rollback] -->|Reverses| OP3
Rollback -->|Reverses| OP2
Rollback -->|Reverses| OP1
Key Points:
- Operations are rolled back in reverse order
- Each operation type knows how to undo itself
- Rollback data is stored in the database (not config)
Rollback Storage#
EbRollback Entity#
Parent record for each definition apply:
| Field | Description |
|---|---|
definition_id |
Source definition |
status |
pending, completed, failed |
operation_count |
Number of operations |
created |
When apply started |
uid |
User who applied |
EbRollbackOperation Entity#
Individual operation rollback data:
| Field | Description |
|---|---|
rollback_id |
Parent rollback |
operation_type |
Plugin ID |
original_data |
Serialized undo data |
sequence |
Execution order |
Using Rollback#
Via Drush#
Via UI#
- Navigate to Configuration > Development > Entity Builder > Rollback
- Find the rollback in the list
- Click Execute Rollback
- Confirm the action
Rollback Scenarios#
Scenario 1: Undo Recent Apply#
Scenario 2: Partial Failure Recovery#
When an apply partially fails:
You can rollback to return to the previous state:
Scenario 3: Clean Slate#
To completely undo all applies of a definition:
What Gets Rolled Back#
| Operation | Rollback Behavior |
|---|---|
create_bundle |
Delete the bundle |
update_bundle |
Restore original label/settings |
create_field |
Delete field instance (and storage if unused) |
update_field |
Restore original configuration |
delete_field |
Recreate the field |
configure_form_mode |
Restore original widget settings |
configure_view_mode |
Restore original formatter settings |
create_field_group |
Delete the field group |
create_pathauto_pattern |
Delete the pattern |
Limitations#
Content Loss#
Warning
Rolling back create_bundle will delete all content of that bundle type.
Storage Cleanup#
Field storage is only deleted during rollback if:
- No other field instances use it
- The operation that created it is being rolled back
Partial Data#
Some data may not be fully restorable:
- Uploaded files referenced by deleted fields
- Entity references to deleted content
- Custom configuration made outside Entity Builder
Rollback Retention#
By default, rollback data is kept for 30 days. Configure in settings:
Cleanup#
Best Practices#
Before Applying#
- Preview operations first:
drush eb:preview definition.yml - Validate the definition:
drush eb:validate definition.yml - Backup your database for major changes
After Applying#
- Test the created entities
- Don't immediately purge rollbacks
- Document what was applied
Recovery Strategy#
- Identify the rollback ID
- Verify it's the correct one (check operation count, date)
- Execute rollback
- Confirm entities were restored
- Fix the definition
- Re-apply when ready
Rollback Status#
| Status | Meaning |
|---|---|
pending |
Can be executed |
completed |
Already rolled back |
failed |
Rollback failed |
Troubleshooting#
"Rollback not found"#
The rollback may have been:
- Already executed
- Purged due to retention policy
- Never created (apply failed before storing)
"Cannot rollback - content exists"#
Some operations fail rollback if dependent content exists. Options:
- Delete dependent content first
- Use Drupal UI to manually remove
"Partial rollback failure"#
If some operations fail to rollback:
- Check the error messages
- Manually fix the failed items
- The rollback status will be
failed