After running update.php I get the following error:

The following updates returned messages:

uc_addresses module

Update #6200
Failed: DatabaseSchemaObjectExistsException: Cannot add field uc_addresses.default_shipping: field already exists. in DatabaseSchema_mysql->addField() (line 328 of /public_html/new/includes/database/mysql/schema.inc).

Any ideas how to overcome this?

Thanks!

Comments

megachriz’s picture

Status: Active » Postponed (maintainer needs more info)

From which version did you upgrade?

  • From 6.x-1.x to 7.x-1.x;
  • From 6.x-2.x to 7.x-1.x;
  • Or from 6.x-1.x to 6.x-2.x to 7.x-1.x?

All three noted situations should work, but that gives me an idea of where to look to reproduce the issue.

A possible fix would probably be to check if the update is somehow already done, but first I'd like to reproduce the issue.

VanessaM’s picture

from 6.28 to 7.22

megachriz’s picture

Sorry, I meant from which specific version of Ubercart Addresses did you upgrade?

Did you upgrade directly from Ubercart Addresses 6.x-1.0, for example? Or did you upgrade from Ubercart Addresses 6.x-1.0, but first upgraded to Ubercart Addresses 6.x-2.0-beta1 and then to 7.x-1.0-alpha2? Or did you, for example, upgraded from Ubercart Addresses 6.x-2.0-alpha2 and had Ubercart Addresses 6.x-1.0 never installed?

I'd like to know the specific upgrade path you took, so I can easier try to reproduce the issue.

VanessaM’s picture

Hi,

I upgraded from Ubercart Addresses 6.x-1.0 to 7.x-1.0-alpha2

megachriz’s picture

Assigned: Unassigned » megachriz
Status: Postponed (maintainer needs more info) » Active

It took a while till I get back to this, but I've been able to at least reproduce the error! At first glance, this error seem to have caused by an earlier failed upgrade at the time the module was not enabled. I think the cause of the earlier failed upgrade is because Ubercart Addresses is trying to set default uc_addresses permissions for the authenticated user (because uc_addresses 7.x-1.x introduces some new permissions) and that probably fails when the module is disabled (technical: in the upgrade function a call to user_role_grant_permissions() is made).

I need think about how to fix this problem. Thanks for reporting. :)

megachriz’s picture

Status: Active » Needs review
StatusFileSize
new11.41 KB
new8.12 KB

Attached are two patches: one with the automated test only and one with the fix + the test.

The patch that contains the fix inserts the default permissions directly instead of calling the API function for it, since calling that function resulted into a failing upgrade. It appears to be that setting permissions for disabled modules doesn't work with user_role_grant_permissions(). See also #737816: user_role_grant_permissions() throws PDOException when used with non-existent permissions (e.g. a permission for a disabled/uninstalled module).

Status: Needs review » Needs work

The last submitted patch, uc_addresses7-upgrade-fix-1974976-6.patch, failed testing.

megachriz’s picture

Status: Needs work » Needs review
StatusFileSize
new19.71 KB
new15.98 KB

I don't quite understand what went wrong during these tests on qa.drupal.org. In the tests I have now moved the uc_addresses table (6.x-1.x style) creation to a separate file, just as is the case for the uc_store tables that are created during the upgrade test.

New try. The first patch contains the test only and should fail tests. The second patch contains the test + the fix. I have nothing changed in the fix, only the contents of the test changed.

megachriz’s picture

I should have included the info-file in the tests-only patch.

Again, first patch should fail tests, second should pass.

megachriz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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