Needs review
Project:
Geofield
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Apr 2013 at 13:44 UTC
Updated:
29 Jan 2014 at 12:16 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
drupalion commentedresolved problem with update to geofiled-7.x-2.x-dev
Comment #2
guillaumev commentedNote that this problem is caused by http://drupal.org/node/1942826. Here is a patch which fixes and adds an update function for existing fields, update function which had not been added in http://drupal.org/node/1942826.
Comment #3
larowlanThis throws an erro
Comment #4
larowlanPatch at #2 has incorrect use of SelectQuery::fields method
Fix attached.
Comment #5
guillaumev commentedThanks for fixing my patch :-) ! Here is a new one which fixes a warning that shows when there is no content to update... (through a if (!empty($values)) ).
Comment #6
leducdubleuet commentedI can confirm that patch in #5 is working properly.
Thank you very much! :-)
Comment #7
radimklaska#5 worked for me. Thanks!
Comment #8
Brandonian commented#5 committed to both 1.x and 2.x branches. Thanks, @larowlan and @guillaumev!
7.x-1.x - http://drupalcode.org/project/geofield.git/commit/1756445
7.x-2.x - http://drupalcode.org/project/geofield.git/commit/599ec51
Comment #9
mraichelson commentedStill coming across this error when trying to update a site from 7.x-1.1 to latest 7.x-2.x-dev here.
Comment #10
mraichelson commentedAfter a bit of poking around: commenting out geofield_update_7100() clears up this issue when trying to upgrade.
Since 7100 changes the field type of the srid field which seems to be what's freaking out (at least for me) and then 7202 eliminates it as a field entirely can 7100 be removed?
(Glad to put together a patch, just want to double-check on what's doing what.)
Comment #11
grota commentedYeah, I can confirm the upgrade path is broken because of geofield_update_7100(), deleting it fixes the problem
Comment #12
twodUpdate 7100 does exactly what a schema update MUST NOT do, it reuses the CURRENT schema definition in an old update.
If you try to update from an early 7.x-1.x state to a late 7.x-2.x, the schema will have changed drastically. You MUST copy the old schema (or the relevant parts of it) into the update functions or the result becomes very unpredictable. In my case, I had to extract the old schema from a 7.x-1.x version and remove the
$schema = geofield_field_schema(array());line and use this instead:Comment #13
thelee commentedTwoD in #12 is exactly right - this issue completely broke down one of our sites. there's a slight typo in his code, though, should be (missing a paren):
can anyone more knowledgeable comment if simply swapping out the schema line with this is a sufficient change for a patch? that's what I did and it got our site/update working fine again, but don't know if this would lead to unintentional side effects.
Comment #14
Christopher Riley commentedYes this resolved the issue that I had doing the upgrade to the latest dev version.
Comment #15
socialnicheguru commentedThe above fix in 13 worked.
Otherwise I get the following:
drush updatedb
The following updates are pending:
geofield module :
7100 - Changing srid from int to text
7200 - Change geofield lat, lon, left, top, right and bottom from floats to numeric fields with precision of 18 and scale of 12.
7201 - Converts the wkt field into a geom field. Converts already existing data from wkt storage to wkb. Much inspiration for this implementation comes from taxonomy_update_7005.
7202 - Drops unused table fields srid, accuracy and source, adds geohash field, populates it.
Do you wish to run all pending updates? (y/n): y
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server[error]
version for the right syntax to use near 'DEFAULT NULL' at line 1
Finished performing updates.
Comment #16
Brandonian commentedGood catch, @TwoD and @thelee. Apologies for taking a bit to fix this, but I've committed a change to the original update hook based on @TwoD's comments in 13.
http://drupalcode.org/project/geofield.git/commit/fce2c4f
Comment #18
Jan van Diepen commentedI'm upgrading from 7.x-1.0 to 7.x-2.1 and am having the issue described in https://drupal.org/node/2057485:
In case the table to be updated has no entries the following lines of code in geofield_update_7100()
returns a non-empty object.
Changing the conditional statement two lines down the code from
if (!empty($values)) {to
if (!empty($values) && (count($values) > 0)) {solved it for me.
Attached is a patch against the current 7.x-2.x branch.
Comment #19
Jan van Diepen commented