Problem/Motivation

Cannot delete field of type "date recur".

Steps to reproduce

1. Add field of type "date recur" using machine name "field_date_recur".
2. Try to delete this field. The following error appears:
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db_10002_dev.date_recur__node__field_date_recur' doesn't exist: DELETE FROM {date_recur__node__field_date_recur} WHERE "entity_id" = :db_condition_placeholder_0; Array ( [:db_condition_placeholder_0] => 140 ) in Drupal\date_recur\DateRecurOccurrences->onEntityDelete() (Zeile 185 in /var/www/vhosts/sbm.einskommanull.com/dev.sbm.einskommanull.com/web/modules/contrib/date_recur/src/DateRecurOccurrences.php).

Proposed resolution

Field gets deleted without error.

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork date_recur-3217384

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

e5sego created an issue. See original summary.

e5sego’s picture

As a workaround, you can first dump the table date_recur__node__field_date_recur (or similar name on you install) and recreate it if the above error accours. Than reload the page with the error message and the field is dropped.

khaldoon_masud’s picture

+1 having the same issue

dpi made their first commit to this issue’s fork.

dpi’s picture

Version: 3.0.x-dev » 3.1.x-dev

I'm not clear how this is possible, especially considering the test exists for this: \Drupal\Tests\date_recur\Kernel\DateRecurOccurrenceTableAttachedTest::testTableCreateDeleteOnFieldStorageCreate

So my only conclusion to this is the table isnt getting created due to permissions, or is being deleted manually, for some reason.

So I'm adding a table exists guard, and hoping this resolves the trouble.

  • dpi committed 2798d83 on 3.1.x
    Issue #3217384 by dpi: Don't attempt to drop occurrence tables if they...

  • dpi committed 9518cf9 on 3.2.x
    Issue #3217384 by dpi: Don't attempt to drop occurrence tables if they...
dpi’s picture

Version: 3.1.x-dev » 3.2.x-dev
Status: Active » Fixed

Committed to 3.1.x and 3.2.x.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.