Whenever I try to delete ANY field from ANY content type I get the following error:
Uncaught PHP Exception Drupal\\Core\\Database\\DatabaseExceptionWrapper: "SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal.field_deleted_data_35ab99eaa1' doesn't exist: SELECT DISTINCT t.entity_id AS entity_id\nFROM \n{field_deleted_data_35ab99eaa1} t\nWHERE bundle = :db_condition_placeholder_0\nLIMIT 10 OFFSET 0; Array\n(\n [:db_condition_placeholder_0] => slider_images\n)\n" at /var/www/html/web/core/lib/Drupal/Core/Database/Connection.php line 685
The only difference being the table hash data, I.E. deleted_data_xxxx, each field i try to delete is referencing a different table. I've tried reinstalling Drupal and reimporting my configuration but no luck.
Any suggestions?
UPDATE: After checking the database there are many of these tables: field_deleted_revision_df347fb61b and field_deleted_df347fb61b
If that makes any difference.
1 Answers
Answers 1
I experienced this also, dig down the code. I found this all reason why fields not deleted after you did, the following:
- executing cron gazillion times
The entries in field_config
and field_config_instance
have probably a value of 1 in the deleted column.
This means they're marked for deletion, but won't actually be deleted until you run cron (deleted field data is purged in field_cron()
).
As an alternative to running cron to remove deleted data, you can manually run field_purge_batch($batch_size)
.
The $batch_size
to use will vary depending on your server environment and needs. I've used values as low a 5 and as high as 10000.
Here more informations about the field_purge_batch()
function.
Here a possible solution to resolve your issue, but backup your database first. Don't be lazy, it will save your ass, if something goes wrong.
using drush:
drush eval "field_purge_batch(500)"
you might have to run a few times, or increase the $batch_size
then there might still be field_deleted
and field_deleted_revision
tables, even after running cron
using SQL query:
SELECT * FROM `field_config` WHERE `deleted` = 1 SELECT * FROM `field_config_instance` WHERE `deleted` = 1
if you come up empty, you can safely delete those leftover tables.
0 comments:
Post a Comment