magento-2-blog
magento-2-blog copied to clipboard
MySQL error on setup:upgrade
Preconditions
- Magento: 2.3.3
- Mageplaza blog: 3.1.1
Steps to reproduce
- Update the extension
- 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.
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!
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!
Hi @MrBlueEyez,
We will update this in the next release. Thanks for your contribution!
Do you have a ball park estimate of when the next release might be ready?
@Bang512 the issue still occurs with the mageplaza_blog_comment table.
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)
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!
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 :-)
@Bang512 do you have any estimation about when the next release with the updated db_schema and whitelist will come?
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!
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.
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!
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