Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
database update system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
12 Mar 2012 at 23:44 UTC
Updated:
16 Oct 2012 at 20:52 UTC
Jump to comment: Most recent
Comments
Comment #1
catchI'm not aware of any documentation that states this, could you point to it?
Comment #2
danepowell commentedOkay, upon closer inspection of the documentation for hook_update_n()...
However, this doesn't sound like a very good policy. In quite a few (most?) modules, the 6.x and 7.x branches are being developed simultaneously, meaning that many of the schema updates will be redundant between the branches. In other words, hook_update_6101 is likely to be identical to hook_update_7101, etc... So when users upgrade from 6.x to 7.x, they are getting a ton of redundant schema updates that break the upgrade process.
It seems fairly obvious to gielfeldt and me that the way this was probably intended to work (and is implied, though not stated explicitly, elsewhere in the docs) is that upgrading from 6.x to 7.x should ONLY run 70XX updates. This is supported by the fact that the docs refer to an outdated version of Drupal, and there has been traction in related issues (#1167996: UPGRADE.txt needs to say all D6 contrib modules need to be upgraded to their latest D6 versions before the D6->D7 update) since then.
Comment #3
marcingy commentedThis is not major it isn't even really a bug to be honest
Comment #4
catchNo this is by design, which is why I asked for a pointer to the documentation to see if it was documented incorrectly.
Comment #5
webchickYeah, I don't understand. This is working exactly as designed. The update numbering scheme is purely a convenience for module developers to keep track of when update functions were introduced.
Comment #6
webchickComment #7
danepowell commentedOkay, if this is 'by design' then I guess this is a support request or feature request. But my original problem (described in the linked issues and in #2) still stands: how is a maintainer supposed to maintain 6.x and 7.x branches simultaneously, and allow 6.x -> 7.x upgrades? Again, the problem is that many of the schema updates are duplicated between the 6.x and 7.x branches, meaning that upgrades from 6.x-7.x fail.
As an example, let's say you have these hooks:
Perfectly reasonable, and yet upgrades from 6.x-7.x will fail because new_field already exists. This is a somewhat trivial example and is easy to guard against, but there are cases where it's much more difficult to guard against this. Assuming that the user is coming from the latest 6.x schema (a good assumption since #1167996: UPGRADE.txt needs to say all D6 contrib modules need to be upgraded to their latest D6 versions before the D6->D7 update) then only hook_update_7001 should be called on upgrade to convert to the latest 7.x schema.
Comment #8
gielfeldt commentedPerhaps another way to ask is: What is the reason/usecase for running hook_update_71xx on D6->D7 upgrade? It seems to be more of an obstacle than a help. Would it be a good idea to revisit this design?
Comment #9
danepowell commentedCan someone besides gielfeldt and myself at least acknowledge that there's a problem here?
I don't want to mark this as 'major' again just to get attention, but I'm not sure what else to do. Keep in mind that it prevents upgrades to Drupal 7.x for at least least two projects and 3,000 users, and the problem will only grow if it isn't tackled early.
Comment #10
catchNo it really is by design, your module needs to work around it if you have conflicting updates bewteen 7.x-1.x and 7.x-2.x branches.
For the example in #7, you could remove the 70* updates from the 7.x-1.x branch altogether, or you can use db_field_exists() to check if a column exists before trying to add it.
Comment #11
gielfeldt commentedAlright, this is by design. Then I ask, what is the reason for this design, and would it be a good idea to revisit this in order to improve this? Does our suggestion limit the current functionality in any way, or will it in fact just make it easier to create upgrade paths for modules?
IMO running db_field_exists() etc, is somewhat cumbersome and perhaps unnecessary if we change the design.
I'm thinking that we just avoid running 71xx updates on D6 => D7 upgrade. Will that limit the feature set of the install hooks in any way?
Thoughts?
Comment #12
danepowell commentedThank you for clarifying, catch. I agree with gielfeldt that we should reconsider whether this is the best design, considering how much extra burden it places on maintainers and in many cases will prevent users from upgrading to later versions of Drupal.
Comment #13
gielfeldt commentedThis ticket now seems more to fit the category feature request.
Comment #14
gielfeldt commentedWhat probably is a bug, is that 7000 is run on non major upgrades.