I'm trying to upgrade my D6 website to D7 where the Twitter module was enabled in D6. I've enabled the D7 Twitter module and gone to /update.php to update the database. However, I get the following error after it runs:
The following updates returned messages
twitter module
Update #7400
Failed: DatabaseSchemaObjectExistsException: Cannot add field <em class="placeholder">twitter_account</em>.<em class="placeholder">mentions</em>: field already exists. in DatabaseSchema_mysql->addField() (line 328 of /usr/home/monarchist/www/devmonarchist/includes/database/mysql/schema.inc).
I suppose I could uninstall the Twitter module and install it fresh and this would probably go away. However, I'm reluctant to do so because I don't want to risk losing data from the D6 website.
Comments
Comment #1
BartNijs commentedSame here
Comment #2
dysproseum commentedI went through the upgrade process with the Twitter module installed on D6, and was able to successfully reproduce the error when running update.php in D7.
I compared the twitter_account.mentions column schema created in hook_update_7400 to the one defined in hook_schema. They match, and are the only two places in twitter.install where the mentions column is modified.
I created a patch that checks for the existence of the field before adding it in hook_update_7400.
After running update.php again, the updates complete successfully, I'm able to re-enable the module successfully, and the settings/tweets that were present before the upgrade remain intact.
Comment #3
dysproseum commentedPatch needs review
Comment #5
dysproseum commentedUpdated patch with fixed conditional.
Comment #6
dysproseum commentedUpdated patch with fixed conditional.
Comment #7
dysproseum commentedComment #9
dysproseum commentedUpdated patch file to reference file paths inside the twitter repo.
Comment #10
dysproseum commentedComment #12
mrjmd commentedGood patch! I didn't functionally test, but I did try to apply the patch. It applies cleanly to to 7.x-5.x-dev branch but not 7.x-5.8. Switching the issue target version.
For the code itself, it looks like it should get the job done just fine, so I'm just going to offer a couple of small nitpicks. You're missing the newline at the end of your file, and if you're checking against FALSE, I'd say go ahead and be strict and use the ===.
Comment #14
dysproseum commentedUpdated patch to include comments from mrjmd
Comment #15
mrjmd commentedComment #16
BartNijs commented#14 worked for me.
Comment #17
damienmckennaI moved the $data definition to inside the if() statement.
Comment #19
damienmckennaCommitted to both the 7.x-5.x and 7.x-8.x branches.
Comment #25
damienmckennaThis was already committed.