I just updated the module to its stable version and there is a big bug when I clear the cache :

Table information not available for the 'customers' field

Comments

zenimagine created an issue. See original summary.

zenimagine’s picture

This problem breaks my whole site which now displays a blank page with this message "The website encountered an unexpected error. Please try again later.".

jsacksick’s picture

Category: Bug report » Support request
Priority: Critical » Normal
Status: Active » Fixed

The problem here is that there's supposed to be an update (See https://git.drupalcode.org/project/commerce_pricelist/blob/b303f822498eb...).

Did you have a patch applied previously that added that update function (so it's considered as executed or something)?

I personally tried the update multiple times before committing it and it worked as expected... You should have a pending update...

Try running drush php-eval "module_load_install('commerce_pricelist'); commerce_pricelist_update_8205();" manually?

zenimagine’s picture

@jsacksick

ubuntu@ov-5f2 ~/www-example-com $ drush php-eval "module_load_install('commerce_pricelist'); commerce_pricelist_update_8205();"
 [error]  Error: Call to undefined function commerce_pricelist_update_8205() in eval() (line 1 of /home/ubuntu/www-example-com/vendor/drush/drush/src/Commands/core/PhpCommands.php(29) : eval()'d code) #0 /home/ubuntu/www-example-com/vendor/drush/drush/src/Commands/core/PhpCommands.php(29): eval()
#1 [internal function]: Drush\Commands\core\PhpCommands->evaluate()
#2 /home/ubuntu/www-example-com/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array()
#3 /home/ubuntu/www-example-com/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
#4 /home/ubuntu/www-example-com/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
#5 /home/ubuntu/www-example-com/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(302): Consolidation\AnnotatedCommand\CommandProcessor->process()
#6 /home/ubuntu/www-example-com/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
#7 /home/ubuntu/www-example-com/vendor/symfony/console/Application.php(1005): Symfony\Component\Console\Command\Command->run()
#8 /home/ubuntu/www-example-com/vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application->doRunCommand()
#9 /home/ubuntu/www-example-com/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun()
#10 /home/ubuntu/www-example-com/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run()
#11 /home/ubuntu/www-example-com/vendor/drush/drush/src/Runtime/Runtime.php(49): Drush\Runtime\Runtime->doRun()
#12 /home/ubuntu/www-example-com/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run()
#13 /home/ubuntu/www-example-com/vendor/drush/drush/includes/preflight.inc(18): require('/home/ubuntu/ww...')
#14 phar:///usr/local/bin/drush/bin/drush.php(141): drush_main()
#15 /usr/local/bin/drush(10): require('phar:///usr/loc...')
#16 {main}. 
Error: Call to undefined function commerce_pricelist_update_8205() in /home/ubuntu/www-example-com/vendor/drush/drush/src/Commands/core/PhpCommands.php(29) : eval()'d code on line 1 #0 /home/ubuntu/www-example-com/vendor/drush/drush/src/Commands/core/PhpCommands.php(29): eval()
#1 [internal function]: Drush\Commands\core\PhpCommands->evaluate()
#2 /home/ubuntu/www-example-com/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array()
#3 /home/ubuntu/www-example-com/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
#4 /home/ubuntu/www-example-com/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
#5 /home/ubuntu/www-example-com/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(302): Consolidation\AnnotatedCommand\CommandProcessor->process()
#6 /home/ubuntu/www-example-com/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
#7 /home/ubuntu/www-example-com/vendor/symfony/console/Application.php(1005): Symfony\Component\Console\Command\Command->run()
#8 /home/ubuntu/www-example-com/vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application->doRunCommand()
#9 /home/ubuntu/www-example-com/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun()
#10 /home/ubuntu/www-example-com/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run()
#11 /home/ubuntu/www-example-com/vendor/drush/drush/src/Runtime/Runtime.php(49): Drush\Runtime\Runtime->doRun()
#12 /home/ubuntu/www-example-com/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run()
#13 /home/ubuntu/www-example-com/vendor/drush/drush/includes/preflight.inc(18): require('/home/ubuntu/ww...')
#14 phar:///usr/local/bin/drush/bin/drush.php(141): drush_main()
#15 /usr/local/bin/drush(10): require('phar:///usr/loc...')
#16 {main}
Error: Call to undefined function commerce_pricelist_update_8205() in eval() (line 1 of /home/ubuntu/www-example-com/vendor/drush/drush/src/Commands/core/PhpCommands.php(29) : eval()'d code).
 [warning] Drush command terminated abnormally.
BigEd’s picture

I just landed on this on updating to "2.x-dev", I tried the drush command but just got a syntax error.

luca cattaneo’s picture

Hi @jsacksick, thanks a lot for this new feature!
Same error for me; these are my steps till now.

I'm on a website with some pricelists active.
- Update the module;
- Got the error on update.php.
Drupal\Core\Entity\Sql\SqlContentEntityStorageException: Table information not available for the 'customers' field
- Check in database, no customers table or similar found.
- Run this command with no problem.

drush php-eval "module_load_install('commerce_pricelist'); commerce_pricelist_update_8205();"

- Rerun update.php (the previous error is gone).
- The Update #8205 failed (strange, hasn't it already done with drush?) with this message:

Failed: Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'cp.customer' in 'field list': SELECT cp.id AS id, cp.type AS type, cp.customer AS customer FROM {commerce_pricelist} cp WHERE (cp.customer IS NOT NULL); Array ( ) in commerce_pricelist_update_8205() (line 158 of /../contrib/commerce_pricelist/commerce_pricelist.install).

- The update 8205 is still pending.
- Checked the database; the commerce_pricelist__customers table is present;

I'm gonna try to use the updated module as is, trying to deleting the pricelists and see if I can run the update.
Or .. do you recommend restoring a backup and updating later?

Let me know if I help somehow.
Thanks a lot!

jsacksick’s picture

@Luca Cattaneo: drush php-eval "module_load_install('commerce_pricelist'); commerce_pricelist_update_8205();" was just in case the update wasn't detected for some reason...

If the update was detected, you should have executed it instead of manually invoking it. Now the problem is that Drupal thinks it hasn't ran...

@zenimagine: Double check that the module was updated, because it really looks like it wasn't... Otherwise the update function should be discovered and present...

Open the .install file, is it there?

luca cattaneo’s picture

Hi @jsacksick, thanks for your quick reply.
I can confirm (after the steps detailed in my preview comment) that the module is working smoothly, the tables in the database are updated as they should be: perfect.
The only thing I've to manage now is the drupal db update system, it still says that the 8205 update has to be done.
But it fails because the customer field is not present anymore in the DB.
I also tried commenting the lines 152 to 166 in commerce_pricelist.install but I got a different error during the db update process.

Failed: Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'customer' in 'where clause': SELECT 1 AS expression FROM {commerce_pricelist} t WHERE customer IS NOT NULL LIMIT 1 OFFSET 0; Array ( ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->countFieldData() (line 1808 of /../core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php)

Don't know where this is coming from..

I do not know well how the db update system works, but probably I just need to say to Drupal to forget about it ;) Am I wrong?

jsacksick’s picture

@Luca Cattaneo: You executed it manually, that is why it's failing.

So either you remove all the content from it... Or you update the "key_value" table, (collection => "system.schema", "name" => commerce_pricelist to have the value "i:8205;".

This will make Drupal think the update was executed.

luca cattaneo’s picture

Thanks a lot for the tip! Solved

nofue’s picture

@jsacksick @ #7:

Perfect advice, just saved my -- thanks a lot.

Status: Fixed » Closed (fixed)

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

ytsurk’s picture

Same for me - I guess running cache-rebuild before update-database was the cause.