magento-2-blog icon indicating copy to clipboard operation
magento-2-blog copied to clipboard

MySQL error on setup:upgrade

Open LucasMDL opened this issue 4 years ago • 13 comments

Preconditions

  1. Magento: 2.3.3
  2. Mageplaza blog: 3.1.1

Steps to reproduce

  1. Update the extension
  2. Run setup:upgrade

OUTPUT: SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name 'MAGEPLAZA_BLOG_AUTHOR_USER_ID', query was: ALTER TABLE mageplaza_blog_author MODIFY COLUMN user_id int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT "Author ID", MODIFY COLUMN name varchar(255) NULL COMMENT "Author Name", MODIFY COLUMN updated_at timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT "Author Updated At", MODIFY COLUMN short_description mediumtext NULL COMMENT "Author Short Description", ADD COLUMN customer_id int(10) UNSIGNED NULL DEFAULT 0 COMMENT "Customer ID", ADD COLUMN type int(10) UNSIGNED NULL DEFAULT 0 COMMENT "Author Type", ADD COLUMN status int(10) UNSIGNED NULL DEFAULT 0 COMMENT "Author Status", ADD INDEX MAGEPLAZA_BLOG_AUTHOR_USER_ID (user_id), COMMENT='Mageplaza Blog Author Table'

I checked the pull request containing a fix for this issue, but the setup:upgrade still fails with the mysql error.

LucasMDL avatar Mar 04 '20 08:03 LucasMDL

Hi @LucasMDL,

Thanks for contacting us. You can follow this issue to solve this problem: #250 Please let me know if you have any questions or problems with our extension.

Thanks!

Bang512 avatar Mar 04 '20 09:03 Bang512

Hi @Bang512 ,

I have taken a look at #250 and it seems that that issue is not solved at all for composer installations. Can you merge that db_schema.xml into the repository so that it is fixed within your repository?

Thanks in advance!

MrBlueEyez avatar Mar 09 '20 13:03 MrBlueEyez

Hi @MrBlueEyez,

We will update this in the next release. Thanks for your contribution!

Bang512 avatar Mar 12 '20 08:03 Bang512

Do you have a ball park estimate of when the next release might be ready?

andrewkett avatar Mar 16 '20 09:03 andrewkett

@Bang512 the issue still occurs with the mageplaza_blog_comment table.

LucasMDL avatar Mar 16 '20 14:03 LucasMDL

Is there an temporary fix? As I had to disable the blog module (module:disable), also resulting in the module removing all mageplaza_blog tables from the database. (Thank god for backups)

AlexNauta avatar Mar 16 '20 15:03 AlexNauta

Hi,

After download and replace the db_schema.xml file, please run this command on the Magento installation folder:

  • bin/magento setup:db-declaration:generate-whitelist --module-name=Mageplaza_Blog

Then, please clear all the cache and let me know the result. Thanks!

Bang512 avatar Mar 17 '20 01:03 Bang512

I had this error fixed on my development enviorment by just droping the foreign and indexes which was causing the problems, but when i pushed that fix to the production environment the environment went down because the issue persistet between setup:upgrades, but the fixes made in this merge: https://github.com/mageplaza/magento-2-blog/pull/251 fixed it for me :-)

sicet7 avatar Mar 19 '20 14:03 sicet7

@Bang512 do you have any estimation about when the next release with the updated db_schema and whitelist will come?

MrBlueEyez avatar Mar 20 '20 10:03 MrBlueEyez

Hi @MrBlueEyez,

We need to review carefully and we will release the next version as soon as possible. I will let you know whenever the new version is released.

Thanks!

Bang512 avatar Mar 24 '20 03:03 Bang512

Hello @Bang512 and @thaimageplaza,

Do you have any estimate about when this issue is going to be handled? It is already known since begin 2020 and multiple tickets (#250 ) have been opened for this issue already, even some pull requests (#251 #261 ). However the issue is still not fixed.

I know a work around has been provided, but as it is an issue in the code (xml's are not correct) I do hope it will be fixed soon. So that no work around is needed anymore.

MrBlueEyez avatar May 27 '20 09:05 MrBlueEyez

Hi @MrBlueEyez,

Please try this problem with the latest version of the Mageplaza_Blog extension (v3.1.2) We already fix this problem in this version.

Then, please let me know the result. I am looking forward to hearing from you.

Thank you!

Bang512 avatar May 27 '20 09:05 Bang512

For reference, it appears that the database schema whitelist has been updated between the mentioned versions: https://github.com/mageplaza/magento-2-blog/compare/v3.1.1..v3.1.2?w=1#diff-627779520149ae58d57df99c2b688aec

fredden avatar May 27 '20 10:05 fredden