Closed (fixed)
Project:
Metatag
Version:
7.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
20 Apr 2013 at 16:31 UTC
Updated:
28 Jan 2014 at 05:00 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
damienmckennaUpdate 7001 was added ages ago, what version were you using before the update?
As for the problem, can you try changing the db_drop_primary_key line to the following, see if it works?
Comment #2
phatmike10 commentedIt was a very old version, not sure which one.
Thanks for the code, replaced:
with
but it didn't work, I got a white screen. Am I replacing the right bit of code?
Comment #3
damienmckennaAck, sorry, try this:
Comment #4
phatmike10 commentedThanks Damien, I tried replacing:
with yours but still got a blank screen after refreshing the browser. I then added it after the above code and it printed both messages plus there was a warning stating undefined variable. so then I used the below:
but i'm still getting warning messages telling me I need to update the database for metags, when I go to updates it still wants to perform 14 updates and the following error occurs when trying to update:
Failed: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key: ALTER TABLE {metatag_config} DROP PRIMARY KEY; Array ( ) in db_drop_primary_key() (line 2872 of /var/www/vhosts/backup/httpdocs/includes/database/database.inc).Comment #5
damienmckennaThe full function would be:
Comment #6
phatmike10 commentedThanks Damien, really appreciate your help with this. So I replaced
with
When visiting update.php the following error occured:
Fatal error: Cannot redeclare metatag_update_7001() (previously declared in /var/www/*/*/*/*/httpdocs/includes/database/database.inc:2905) in /var/www/*/*/*/*/httpdocs/modules/metatag/metatag.install on line 225
Comment #7
damienmckennaSorry I wasn't clear - just replace metatag_update_7001 in metatag.install with the code from #5 :)
Comment #8
phatmike10 commentedok great, tried that and the update goes through to the final screen. when I go back to the site I still have loads of warnings stating "Error loading meta tag data, do the database updates need to be run?"
Comment #9
damienmckennaThat error should only happen if the 'language' field doesn't exist in the main {metatag} table, which is added in metatag_update_7003.
Comment #10
phatmike10 commentedhmm, so how do I resolve this then?
Comment #11
damienmckennaCheck the {metatag} table, see if it has a 'language' field.
Comment #12
phatmike10 commentedIn the metatag table the fields I have are:
Entity_type
entity_id
data
How do I add the language field? Do you have a bit of code to do this?
thanks
Comment #13
damienmckennaOk, I'm a little confused as to how this could happen. In comment #8 you said the rest of the updates went through ok, but the language field should have been added in update 7003.
BTW the code fix listed above was accidentally included in the beta7 that went out yesterday.
Comment #14
phatmike10 commentedSo after adding the code, update.php makes it to the final screen (attachment 1).
When I go back to the user pages on the site I get the message, "Error loading meta tag data, do the database updates need to be run?" (attachment 2)
If I then go back to run update.php it states I have 14 updates again. (attachment 3)
Comment #15
phatmike10 commentedIs there any more info you need on top of the screenshots in #14?
You'll see in #14, I get stuck in a loop where I've run the 14 updates -> go back to the website -> Warnings are there stating, "Error loading meta tag data, do the database updates need to be run?" -> Run update (states 14 updates).
Comment #16
Demontager commentedConfirm same error
Website become unfunctional except administration pages.
Comment #17
LukM commentedI have the exact same problem after a d6 - d7 upgrade.
Tried the above patches: no solution
Tried the latest dev: same problem
At my wits end here. Can someone solve this please?
Comment #18
damienmckenna@Demontager and @LukM: could you both please let me know what version of Metatag you had installed before updating?
Comment #19
phatmike10 commentedHi Damien, just wondering if there's a way I can add the language table to the database so the update works, as from your last comments it sounds like I'm getting the errors due to the language table not be present?
thanks
Mike
Comment #20
damienmckenna@phatmike10: We need to solve update 7001 first so that all of the other updates work too, then the language field will be added.
Comment #21
damienmckennaCan someone please test to if this resolves the problem? It adds a slightly hackish (database-specific) way to see if the primary key has been added already
Comment #22
damienmckennaThis needs to be fixed.
Comment #24
vanderKraan commentedRan into the same problem as #16 while updating an old project from 7.x-1.0-alpha3 to 7.x-1.0-beta7 and solved it by removing following from the metatag_update_7001 function:
I suppose this a mySQL specific issue, where db_drop_primary_key() can't remove a primary key on auto_increment fields. For some reason it doesn't throw an exception.
Comment #25
phatmike10 commentedSpot on, works for me and the Language table has been created too. thanks
Comment #26
Demontager commented@DamienMcKenna, the current version of Metatag is 7.x-1.0-alpha3
Comment #27
damienmckenna@Demontager: The last release of Metatags was 1.0-alpha3, the current release of Metatag is 1.0-beta7.
Comment #28
sergeis commentedI did what was advised in #24 and I worked as a pure magic. Many thanks to vanderKraan
Comment #29
damienmckennaLets see if this passes the testbot.
Comment #30
damienmckennaFixed an unfinished comment.
Comment #31
seanrThat still doesn't work. Now I get a different error:
SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key
Since I don't have any metatags defined, I'm just going to completely uninstall and reinstall it, but it's pretty clear that first update was really badly hosed.
Comment #32
Bizio commented#24 was magic for me :) Thanks.
Comment #33
damienmckennaDoes this work?
Comment #34
damienmckennaNeed to take look at how Media handled a similar problem (https://drupal.org/node/2064305):
https://drupal.org/files/file_entity-fix_file_metadata_primary_key_schem...
Comment #35
mattys commentedCan anyone please let me know which file the 'metatag_update_7001' function is in so i can do #24 suggested fix?
thank you
*UPDATE* - metatag_update_7001 can be found in 'metatag.install'
Comment #36
pivica commentedPatch from #33 does not work, still getting error
SQLSTATE[42000]: Syntax error or access violation: 1068 Multiple primary key definedTrying to update from 7.x-1.0-alpha3.
Comment #37
pivica commentedHere is a patch against latest dev (hint for the patch taken from #34).
As a note, I am just updating some old Drupal 7 site and situation here with metatag is that I wanna update from 7.x-1.0-alpha3 to 7.x-1.0-beta7. This patch applied to 7.x-1.0-beta7 solved upgade issue. I will test site after full upgrade little more and if I found some problems arround metatag will update here.
In the mean time here is c&p of upgrade process and metatag_config table before and after upgrade with this patch:
Before
After
Everthing looks good I guess ;)
Comment #38
damienmckennaClosed a duplicate: #2163899: update error
Comment #39
damienmckennaI'm about to release beta8, if I can have some help testing this I'll be happy to commit it.
Comment #40
fabsor commentedTested on one of our old installs. The update seems to work fine with the patch.
Comment #41
damienmckennaCommitted! Thanks for the help, everyone!
Comment #42
damienmckennaComment #43
hyperglide commentedDamienMcKenna++