Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293174

field_deleted_data_XX & field_deleted_revision_XX

$
0
0

Hello

When fields are deleted, the data/revision tables are renamed to this convention:
field_data_FIELDNAME becomes field_deleted_data_XX
field_revision_FIELDNAME becomes field_deleted_revision_XX

This way, fields aren't permanently deleted right away, and the data can be restored, by renaming the tables and setting deleted=0 for the field on field_config and field_config_instances.

There is a problem though - if you have many fields to restore, like the case of accidentally deleting a field_collection with over 50 fields, it becomes painfully hard to go through each table, lookup the old table name on the description, and renaming accordingly both tables for each field that was deleted.

This could be simplified if field tables were just renamed to
field_deleted_data_FIELDNAME
field_deleted_revision_FIELDNAME

which would only require a mass find replace of "deleted_" with "".

As for the occurrence of tables with conflicting names (same name, duplicate tables/fields), for these the other method of renaming the tables to field_deleted_data_XX and field_deleted_revision_XX, by first checking if the table already exists - thus saving us trouble, while still providing a error proof method.

Thanks!


Viewing all articles
Browse latest Browse all 293174

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>