Core 7.43

Updated Rooms 7.x-1.0 to 7.x-1.11. As suggested in the "Available Updates".

When update.php is run the following errors are produced.

Update #7009

Failed: DatabaseSchemaObjectExistsException: Cannot add field rooms_units.status: field already exists. in DatabaseSchema_mysql->addField() (line 328 of /home/rg/xxxx.org/bookings/includes/database/mysql/schema.inc).
rooms_booking module

Update #7004

Failed: DatabaseSchemaObjectExistsException: Cannot add field rooms_bookings.uid: field already exists. in DatabaseSchema_mysql->addField() (line 328 of /home/rg/xxxx.org/bookings/includes/database/mysql/schema.inc).

Here's more detail for this post.
In the Drupal "Available Updates Page" only 7x.-1.11 was listed for Rooms. My past experiences with Drupal is it lists all the available updates (I always install module updates oldest to newest in the progression of the updates). Based on this, at the time of installing 7.x-1.11 I was not aware of the updates between 7x.-1.0 and 7.x-1.11.

If 7x.-1.0 was reinstalled and each update was installed in progression up to 7.x-1.11 will this alleviate errors #7009 and #7004?

Comments

goc2 created an issue. See original summary.

slipit’s picture

Issue summary: View changes
slipit’s picture

When I go to Rooms/Bookable units the error occurrs. I mistakingly missed some updates and I think this is the root of the issue.

If this column is missing can some offer quidedance on the best approach toward resolving this.

  • Upload original version and add updates in progression? Will this fix what ails the module.
  • or

  • Add the column 'base.weekly_discount' to the database.

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'base.weekly_discount' in 'field list': SELECT base.unit_id AS unit_id, base.type AS type, base.language AS language, base.name AS name, base.created AS created, base.changed AS changed, base.base_price AS base_price, base.weekly_discount AS weekly_discount, base.monthly_discount AS monthly_discount, base.default_state AS default_state, base.bookable AS bookable, base.min_sleeps AS min_sleeps, base.max_sleeps AS max_sleeps, base.min_children AS min_children, base.max_children AS max_children, base.status AS status, base.uid AS uid, base.data AS data FROM {rooms_units} base WHERE (base.unit_id IN (:db_condition_placeholder_0)) ; Array ( [:db_condition_placeholder_0] => 23 ) in EntityAPIController->query() (line 187 of /home/xxx.org/bookings/sites/all/modules/entity/includes/entity.controller.inc).

slipit’s picture

When update.php is run it lists the following pending updates for the rooms_booking module and rooms unit module. When the updates are run it produces the errors #7009 and #7004. Why would these fields already exist in the database? Would it cause problems to delete fields rooms_bookings and rooms_units fields from the database or is there a better approach?

rooms_booking module

7004 - Create owner field in rooms_booking table.
7005 - Update permission names for rooms_booking entity management.
7006 - Update permission name for administer rooms_booking entities.
7007 - Give the new permission 'create customer profiles on bookings' to all roles with 'bypass rooms_booking entities access' permission.

rooms_unit module

7009 - Adds status and uid properties to Bookable units.
7010 - Update permission names for rooms_unit entity management.
7011 - Adds options field to Rooms unit type entity.
7012 - Adds weekly_price and monthly_price to Bookable units.
7013 - Update permission name for administer rooms_unit entities.
7014 - Rename columns 'weekly_price' in 'weekly_discount' and 'monthly_price' in 'monthly_discount'.

The following updates returned messages
rooms_unit module
Update #7009

Failed: DatabaseSchemaObjectExistsException: Cannot add field rooms_units.status: field already exists. in DatabaseSchema_mysql->addField() (line 328 of /home/domain.org/bookings/includes/database/mysql/schema.inc).

rooms_booking module
Update #7004

Failed: DatabaseSchemaObjectExistsException: Cannot add field rooms_bookings.uid: field already exists. in DatabaseSchema_mysql->addField() (line 328 of /home/domain.org/bookings/includes/database/mysql/schema.inc).

steeph’s picture

#7009 and #7004 aren't the errors. They are the numbers of the updates. Not knowing the rooms module, here are some general suggestions. If there was an earlier update that changed the database schema, try installing this first. Deleting the already existing fields doesn't seem right. It sounds more likely to me that the updates were already performed and that's why you can't do them again. Did the other updates, that didn't through any errors, complete? If you go to update.php again now, are the two updates with the errors still pending?