I am getting the following error message when performing the database update after upgrading from 8.x-3.0-beta4 to 8.x-3.0-beta5.
SQLSTATE[42000]: Syntax error or access violation: 1235 This version of MySQL doesn't yet support 'existing primary key drop without adding a new primary key. In @@sql_generate_invisible_primary_key=ON mode table should have a primary key. Please add a new primary key to be able to drop existing primary key.': ALTER TABLE "feeds_clean_list" DROP PRIMARY KEY; Array
Is anybody else having the same issue or is it just a problem with my version of MySQL server (v8.0)?
Issue fork feeds-3454534
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
torfjComment #3
megachrizIt appears to have something to do with a setting on MySQL, one that is called "sql_generate_invisible_primary_key". I read that if that is set to
0, then you should be good.https://github.com/prisma/prisma/issues/20944
https://magento.stackexchange.com/questions/370387/mysql-error-mysql-doe...
I don't know how the issue should be fixed in an other way yet.
Comment #6
karlsheaSome searching seems like it might work to do this inside a transaction? Untested MR created.
Comment #7
torfjI tested the MR and I am still getting the same error.
Comment #8
karlsheaTested, it doesn't work. I don't think having sql_generate_invisible_primary_key enabled is compatible with what we have available to modify the schema in Drupal.
Comment #9
karlsheaComment #10
torfjI tried creating a new table with the desired primary key, coping the data from the old table to the new one, and then renaming the new table to the old one. This works for me, but it might be a better idea to update the sql_generate_invisible_primary_key value.
Comment #11
karlsheaUnfortunately the web user would need the SESSION_VARIABLES_ADMIN privilege to change the sql_generate_invisible_primary_key value.
Comment #12
ericgsmith commentedI think approach looks good - added a comment to the MR as its using incorrect column definition.
Comment #13
torfjComment #14
karlsheaOh good idea! I tested this with sql_generate_invisible_primary_key enabled and it worked just fine.
Comment #15
ericgsmith commented+1 from me
Comment #16
megachrizThis looks like a great solution, however calling a function that returns the current schema (in this case a call to
feeds_schema()) is discouraged. If for whatever reason in the future the table "feeds_clean_list" would get removed, the update function would break. Update functions should never rely on the current implementation ofhook_schema().From https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Extension...
Comment #17
karlsheaAhhh right, commit pushed with a static table definition.
Comment #18
torfjI tested with the static table definition and it still works. Thanks for pointing that out.
Comment #19
ericgsmith commented+1 testing and works for me
Apologies @torfj for the bad advice - thank you @MegaChriz for picking that up and thank you @KarlShea for updating.
Comment #21
megachrizThanks all! I merged the code!