Properly uninstall entity types

Created on 13 March 2019, almost 6 years ago
Updated 6 June 2024, 7 months ago

Problem/Motivation

getting

$ drush pmu contact_storage
The following extensions will be uninstalled: contact_storage
Do you really want to continue? (y/n): y
PDOException: SQLSTATE[HY000]: General error: 1 no such column: id in /srv/core/lib/Drupal/Core/Database/Driver/sqlite/Statement.php:82                                                               [error]
Stack trace:
#0 /srv/core/lib/Drupal/Core/Database/Driver/sqlite/Statement.php(82): PDO->prepare('SELECT 1 AS exp...')
#1 /srv/core/lib/Drupal/Core/Database/StatementPrefetch.php(158): Drupal\Core\Database\Driver\sqlite\Statement->getStatement('SELECT 1 AS exp...', Array)
#2 /srv/core/lib/Drupal/Core/Database/Driver/sqlite/Statement.php(90): Drupal\Core\Database\StatementPrefetch->execute(Array, Array)
#3 /srv/core/lib/Drupal/Core/Database/Connection.php(631): Drupal\Core\Database\Driver\sqlite\Statement->execute(Array, Array)
#4 /srv/core/lib/Drupal/Core/Database/Query/Select.php(510): Drupal\Core\Database\Connection->query('SELECT 1 AS exp...', Array, Array)
#5 /srv/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(1792): Drupal\Core\Database\Query\Select->execute()
#6 /srv/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php(637): Drupal\Core\Entity\Sql\SqlContentEntityStorage->countFieldData(Object(Drupal\Core\Field\BaseFieldDefinition),
true)
#7 /srv/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(1577):
Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->onFieldStorageDefinitionDelete(Object(Drupal\Core\Field\BaseFieldDefinition))
#8 /srv/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(1593): Drupal\Core\Entity\Sql\SqlContentEntityStorage->Drupal\Core\Entity\Sql\{closure}()
#9 /srv/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(1578): Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException(Object(Closure))
#10 /srv/core/lib/Drupal/Core/Field/FieldStorageDefinitionListener.php(172):
Drupal\Core\Entity\Sql\SqlContentEntityStorage->onFieldStorageDefinitionDelete(Object(Drupal\Core\Field\BaseFieldDefinition))
#11 /srv/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php(271):
Drupal\Core\Field\FieldStorageDefinitionListener->onFieldStorageDefinitionDelete(Object(Drupal\Core\Field\BaseFieldDefinition))
#12 /srv/core/lib/Drupal/Core/Extension/ModuleInstaller.php(432): Drupal\Core\Entity\EntityDefinitionUpdateManager->uninstallFieldStorageDefinition(Object(Drupal\Core\Field\BaseFieldDefinition))
#13 /srv/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(91): Drupal\Core\Extension\ModuleInstaller->uninstall(Array, true)
#14 phar:///usr/bin/drush/commands/core/drupal/environment.inc(227): Drupal\Core\ProxyClass\Extension\ModuleInstaller->uninstall(Array)
#15 phar:///usr/bin/drush/commands/core/drupal/pm_8.inc(79): drush_module_uninstall(Array)
#16 phar:///usr/bin/drush/commands/pm/pm.drush.inc(1250): _drush_pm_uninstall(Array)
#17 phar:///usr/bin/drush/includes/command.inc(422): drush_pm_uninstall('contact_storage')
#18 phar:///usr/bin/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#19 phar:///usr/bin/drush/includes/command.inc(199): drush_command('contact_storage')
#20 phar:///usr/bin/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#21 phar:///usr/bin/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#22 phar:///usr/bin/drush/includes/startup.inc(465): drush_main()
#23 phar:///usr/bin/drush/includes/startup.inc(369): drush_run_main(false, '/', 'Phar detected. ...')
#24 phar:///usr/bin/drush/drush(114): drush_startup(Array)
#25 /usr/bin/drush(10): require('phar:///usr/bin...')
#26 {main}

Next Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 1 no such column: id: SELECT 1 AS expression
FROM
{contact_message} t
WHERE id IS NOT NULL
LIMIT 1 OFFSET 0; Array
(
)
 in /srv/core/lib/Drupal/Core/Database/Connection.php:692
Stack trace:

Proposed resolution

Implement proper contact_storage_uninstall() hook

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡«πŸ‡·France andypost

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024