The following error occured with the latest update.

Uncaught PHP Exception Drupal\Core\Entity\EntityStorageException: "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'commerce_promotion_field_data_3.weight' in 'field list': SELECT base_table.promotion_id AS promotion_id, base_table.promotion_id AS base_table_promotion_id, commerce_promotion_field_data_3.weight AS weight
FROM
{commerce_promotion} base_table
INNER JOIN {commerce_promotion__stores} commerce_promotion__stores ON commerce_promotion__stores.entity_id = base_table.promotion_id
INNER JOIN {commerce_promotion__order_types} commerce_promotion__order_types ON commerce_promotion__order_types.entity_id = base_table.promotion_id
INNER JOIN {commerce_promotion_field_data} commerce_promotion_field_data ON commerce_promotion_field_data.promotion_id = base_table.promotion_id
LEFT JOIN {commerce_promotion_field_data} commerce_promotion_field_data_2 ON commerce_promotion_field_data_2.promotion_id = base_table.promotion_id
LEFT JOIN {commerce_promotion__coupons} commerce_promotion__coupons ON commerce_promotion__coupons.entity_id = base_table.promotion_id
LEFT JOIN {commerce_promotion_field_data} commerce_promotion_field_data_3 ON commerce_promotion_field_data_3.promotion_id = base_table.promotion_id
WHERE (commerce_promotion__stores.stores_target_id IN (:db_condition_placeholder_0)) AND (commerce_promotion__order_types.order_types_target_id IN (:db_condition_placeholder_1)) AND (commerce_promotion_field_data.start_date <= :db_condition_placeholder_2) AND (commerce_promotion_field_data.status = :db_condition_placeholder_3) AND( (commerce_promotion_field_data_2.end_date >= :db_condition_placeholder_4) or (commerce_promotion_field_data_2.end_date IS NULL ) )AND (commerce_promotion__coupons.coupons_target_id IS NULL )
ORDER BY commerce_promotion_field_data_3.weight ASC; Array
(
[:db_condition_placeholder_0] => 2
[:db_condition_placeholder_1] => default
[:db_condition_placeholder_2] => 2017-03-28
[:db_condition_placeholder_3] => 1
[:db_condition_placeholder_4] => 2017-03-28
at mystore/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php line 770

Comments

barry6575 created an issue. See original summary.

mglaman’s picture

Priority: Critical » Normal

Run your updates, such as `drush updb`

barry6575’s picture

I'm using composer and not drush, but I did run update.php (saw the promotion updates) manually and the site logged this error and didn't work. It was working with the previous dev and the curent beta which I've since reverted to.

bojanz’s picture

Title: PHP exception (site crash) » Missing update hook for the promotion weight field
Priority: Normal » Critical

We are missing an update hook for the weight field.

  • bojanz committed 2db70eb on 8.x-2.x
    Issue #2864882: Missing update hook for the promotion weight field
    
bojanz’s picture

Status: Active » Fixed

1) Added an update hook for weight.
2) Moved the current_usage field removal to that hook as well, these kinds of changes should happen in update hooks, not post update hooks.
3) Fixed the misnumbered first update hook that was committed last night.

Note: I am assuming that you reverted your database when you reverted the code.
If you haven't, you will need to manually delete the "commerce_promotion_usage" table before running update.php again.

barry6575’s picture

Great, it works, and I did not revert the database. Thx for the note.

Status: Fixed » Closed (fixed)

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