When updating the votingapi module to version 8.x-3.0-beta1. I had the problem of not being able to update the vote_result entity.
I used the command "drush entup" but got the error "The SQL storage cannot change the schema for an existing field (function in vote_result entity) with data."
And the way below has helped me solve that problem. Hope it can be helpful.
Note: Back up your database first.
Step 1: Export the votingapi_result table and the votingapi_vote tables into the corresponding sql files. I use the command line "mysqldump -uSqluser -p mysitedb votingapi_vote > votingapi_vote.sql" and "mysqldump -uSqluser -p mysitedb votingapi_result > votingapi_result.sql".
Step 2: Export all configurations. Here I use the command line: "drush cex".
Step 3: Uninstall votingapi module, in this step, rate module will also be required to uninstall.
Step 4: Import the exported configuration in step 2. I use the command line: "drush cim".
Step 5: Import the votingapi_result data table and the votingapi_vote data table exported in step 1. Note that you need to edit the xxx.sql file and delete the table creation for "Table structure for table `xxx`"
because this table already exists, we only need to keep "Dumping data for table `xxx`" because these are the data that needs to be re-imported. I use the command line: "drush sql:cli < votingapi_vote.sql" and "drush sql:cli < votingapi_result.sql".
Step 6: Clear the cache and see the results.
Comment | File | Size | Author |
---|---|---|---|
#6 | 3083473-entity-definition-update-manager-6.patch | 2.21 KB | a.dmitriiev |
votingapi_update_entity.png | 52.74 KB | bcmc0904 |
Comments
Comment #2
bcmc0904 CreditAttribution: bcmc0904 commentedComment #3
manishdrupaldev CreditAttribution: manishdrupaldev as a volunteer commentedI have applied all the steps as per given above.
It's working for me.
Thanks for update.
Comment #4
a.dmitriiev CreditAttribution: a.dmitriiev as a volunteer and at 1xINTERNET commentedHere is the patch with update hook for proper change of the field definition that fixes the issue.
Comment #5
a.dmitriiev CreditAttribution: a.dmitriiev as a volunteer and at 1xINTERNET commentedComment #6
a.dmitriiev CreditAttribution: a.dmitriiev as a volunteer and at 1xINTERNET commentedI found that the previous patch is not working for the case when there is already data in the database table. So here is another patch that works in any case.
Comment #7
andralex CreditAttribution: andralex at EPAM Systems for EPAM Systems commentedTested localy and did't faced any issue.
Comment #8
alex_optim+1
Comment #9
pifagorComment #11
pifagor