HI,
I have upgraded my drupal 8.6 to 8.9.1 and also updated the commerce to 2.2 version , while updating the database using drush updb I am getting the followings error

Drupal\Core\Entity\Sql\SqlContentEntityStorageException: Table information not available for the 'coupons' field. in Drupal\Core\Entity\Sql\DefaultTableMapping->getFieldTableName() (line 391 of core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php).

Can you please help me on this issue, I am stuck on this issue.
Thanks in advance.

Issue fork commerce-3157342

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

sooraj sahai created an issue. See original summary.

g-brodiei’s picture

Status: Active » Closed (duplicate)
Related issues: +#3150268: Ensure commerce_promotion can be installed without the cart module.

@sooraj sahai I met the same issue like you when I only wanted to enable commerce_promotion when commerce_cart is not enabled.

The error message was gone when I commerce cart is enabled before commerce promotion. Using Drupal 9.0.7.
Seems like it's a hidden dependency on Cart when using Promotion.

g-brodiei’s picture

Status: Closed (duplicate) » Active

Sorry, setting wrong status of issue.

jsacksick’s picture

Status: Active » Closed (outdated)
danharper’s picture

Version: 8.x-2.20 » 8.x-2.32
Status: Closed (outdated) » Active

Just got the same issue, now my site is broken.

It seems promotion did not install correctly so there is no table created, now I can't uninstall commerce_promotion with drush as it fails because the table doesn't exist.

jsacksick’s picture

Not sure how to reproduce this unfortunately... Try disabling it manually using the instructions from https://www.drupal.org/node/157632. And re-enable it?

jsacksick’s picture

@danharper: Did the solution from the link work?

laboratory.mike’s picture

I recently ran into this on my d10 site, using a fresh install. I tried the commerce_cart workaround, and got it working.

maartendeblock’s picture

When installing the commerce modules locally, exporting the config, and importing it on staging, this also happens.

jsacksick’s picture

Priority: Critical » Normal

This could be considered critical if I'm provided reproducible steps... The initial report is 4 years old and seems to affect a small portion of users, probably under specific circumstances, so downgrading the ticket priority to "normal".

@maartendeblock: Could you provide additional details / reproducible steps on a clean install please?

jsacksick’s picture

Status: Active » Postponed (maintainer needs more info)
donbuche’s picture

Stills happens when deploying in a drupal 10.4.6.

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

zaporylie’s picture

Version: 8.x-2.32 » 3.x-dev
Priority: Normal » Major
Status: Postponed (maintainer needs more info) » Needs review

Reproduction: install Canvas (drupal.org/project/canvas) before commerce_promotion.

Canvas's block plugin manager decorator eagerly rebuilds all block-plugin definitions (including Views block derivatives) synchronously on every entity_field_info cache tag invalidation. commerce_promotion's own entity/field schema install fires exactly that cache tag mid-install - before the coupons field's table exists - and Canvas's eager rebuild walks straight into it. Without Canvas active, Drupal's block-derivative discovery is normally lazy, so the bug stays a rare edge case instead of firing reliably.

Root cause: CommerceEntityViewsData::addReverseRelationships() (src/CommerceEntityViewsData.php:516) calls $this->tableMapping->getFieldTableName($field_name) with no guard for a field that's declared in code but not yet schema-installed. Core's DefaultTableMapping::getFieldTableName() throwing in that case is correct, deliberate behavior - Commerce just doesn't handle it. A defensive check (e.g. skip the reverse relationship, or catch and log, if the field's storage isn't installed yet) would fix it without changing behavior for the normal case.

Confirmed on Commerce 3.3.8 / Drupal 11.4 / Canvas 1.10.0 / PHP 8.5.7 .

tbkot’s picture

Status: Needs review » Reviewed & tested by the community

Can confirm that the issue is reproducible by the steps provided in comment #14. Also, can confirm that changes in the MR resolve the issue, and a new test fails without changes in the CommerceEntityViewsData class

  • jsacksick committed 1c703e4d on 3.x authored by zaporylie
    fix: #3157342 Table information not available for the 'coupons' field....
jsacksick’s picture

Status: Reviewed & tested by the community » Fixed

Merged thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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