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

BartNijs’s picture

Same here

dysproseum’s picture

StatusFileSize
new526 bytes

I 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.

dysproseum’s picture

Assigned: Unassigned » dysproseum
Status: Active » Needs review

Patch needs review

Status: Needs review » Needs work

The last submitted patch, 2: twitter-2337219-update-7400.patch, failed testing.

dysproseum’s picture

StatusFileSize
new30.13 KB

Updated patch with fixed conditional.

dysproseum’s picture

StatusFileSize
new663 bytes

Updated patch with fixed conditional.

dysproseum’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 6: twitter-2337219-update-7400-3.patch, failed testing.

dysproseum’s picture

StatusFileSize
new559 bytes

Updated patch file to reference file paths inside the twitter repo.

dysproseum’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 9: twitter-2337219-update-7400-9.patch, failed testing.

mrjmd’s picture

Version: 7.x-5.8 » 7.x-5.x-dev

Good 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 ===.

Status: Needs work » Needs review
dysproseum’s picture

StatusFileSize
new423 bytes

Updated patch to include comments from mrjmd

mrjmd’s picture

Assigned: dysproseum » Unassigned
BartNijs’s picture

#14 worked for me.

damienmckenna’s picture

StatusFileSize
new947 bytes

I moved the $data definition to inside the if() statement.

damienmckenna’s picture

Status: Needs review » Fixed

Committed to both the 7.x-5.x and 7.x-8.x branches.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

The last submitted patch, 9: twitter-2337219-update-7400-9.patch, failed testing.

The last submitted patch, 14: twitter-2337219-update-7400-14.patch, failed testing.

Status: Closed (fixed) » Needs work

The last submitted patch, 17: twitter-n2337219-17.patch, failed testing.

damienmckenna’s picture

Status: Needs work » Fixed

This was already committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.