Writing updates for minor releases
Hi, I closed http://drupal.org/node/64212 for good. To sum up, if you are writing a core patch which adds an update to a minor release, then you need to duplicate that in the HEAD section (which has a different numbering) and do it in such a way that the second update won't generate an error. To achieve this, use DROP IF EXSITS for indexes (both databases), in the unlikely case you are adding a field, check for its existence first through SELECT * FROM, db_fetch_array, isset. ALTERs need no special taking care of. I do not think there will be a very complex update in a minor revision ever but if there will be, we can solve that when the need arrives. Note that the above did not divulge into introspection which is available for complex cases. Regards NK
On Oct 4, 2006, at 12:43 AM, Karoly Negyesi wrote:
To achieve this, use DROP IF EXSITS for indexes (both databases), in the unlikely case you are adding a field, check for its existence first through SELECT * FROM, db_fetch_array, isset. ALTERs need no special taking care of.
in the unlikely case you are adding a whole new table, can check if the table exists in 5.x and beyond using db_table_exists('foo'). enjoy, -dww
in the unlikely case you are adding a whole new table, can check if the table exists in 5.x and beyond using db_table_exists('foo').
And as this rule first can apply to a 4.7.x update which is needed for 5.0 too, this is indeed always usable. Rejoice.
Karoly Negyesi wrote:
Hi,
I closed http://drupal.org/node/64212 for good.
To sum up, if you are writing a core patch which adds an update to a minor release, then you need to duplicate that in the HEAD section (which has a different numbering) and do it in such a way that the second update won't generate an error.
does this affect update functions in contrib modules?
participants (4)
-
Derek Wright -
Karoly Negyesi -
karoly@negyesi.net -
Moshe Weitzman