Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update missing SQL compare to a fresh install #689

Merged
merged 4 commits into from
May 13, 2024

Conversation

M0rgan01
Copy link
Contributor

@M0rgan01 M0rgan01 commented Apr 16, 2024

Questions Answers
Description? Update missing SQL compare to a fresh install
Type? improvement
BC breaks? no
Deprecations? no
Fixed ticket? -
Sponsor company -
How to test? Use https://github.com/PrestaShop/SeamlessUpgradeToolbox/tree/main/autoupgrade-scripts for test versions concerned

@M0rgan01 M0rgan01 changed the title Adding missing SQL compare to a fresh install Update missing SQL compare to a fresh install Apr 16, 2024
@M0rgan01 M0rgan01 added this to the 5.0.2 milestone Apr 18, 2024
@M0rgan01 M0rgan01 force-pushed the fix/sql branch 12 times, most recently from 0ac2cfb to c6ab9e5 Compare April 22, 2024 10:10
@@ -58,6 +58,13 @@ ALTER TABLE `PREFIX_product_shop` MODIFY COLUMN `redirect_type` ENUM(
UPDATE `PREFIX_product` SET `redirect_type` = 'default' WHERE `redirect_type` = '404' OR `redirect_type` = '' OR `redirect_type` IS NULL;
UPDATE `PREFIX_product_shop` SET `redirect_type` = 'default' WHERE `redirect_type` = '404' OR `redirect_type` = '' OR `redirect_type` IS NULL;

ALTER TABLE `PREFIX_product` MODIFY COLUMN `redirect_type` ENUM(
'404','410','301-product','302-product','301-category','302-category','200-displayed','404-displayed','410-displayed','default'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already present few lines above, you can modify the original one ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review :) I think we need to do this in 3 steps:

  • Add the ENUMS while keeping the '' so as not to lose the existing values.
  • Update to default where '' and ...
  • Remove the unnecessary ''

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly as you say. :-)

I kept the empty string in the enum, because products created pre 1.7.8.0 had it by default - https://github.com/PrestaShop/PrestaShop/blob/aab3f53c9c31d79a6c60d9744d2a175c4d6c5194/install-dev/data/db_structure.sql#L1647

And also, it was implemented in 8.1.0, so allowing that empty string was to avoid a BC break.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soooo, actually, I think we should do this in 9.0.0 and keep this like it is. 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, well seen !

I changed the updating of data and columns in the v9 script, this way we catch up with potential insertions with empty string

@M0rgan01 M0rgan01 force-pushed the fix/sql branch 14 times, most recently from e766f12 to 54b2b26 Compare April 23, 2024 09:00
@M0rgan01 M0rgan01 force-pushed the fix/sql branch 2 times, most recently from c7aff52 to 2affe63 Compare April 29, 2024 13:07
Copy link
Contributor

@kpodemski kpodemski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need to change 8.1.6 to 8.1.7.

@M0rgan01
Copy link
Contributor Author

@kpodemski Are you saying that because the merge and release of the module will come after the 8.1.6 release?

@kpodemski
Copy link
Contributor

@M0rgan01 I think we won't be able to release 8.1.6 with autoupgrade

@Hlavtox
Copy link
Contributor

Hlavtox commented Apr 30, 2024

@M0rgan01 Can you put the things to 8.1.7.sql so we are consinstent? I did it also with my previous fixes. Just a normal version file.

@M0rgan01
Copy link
Contributor Author

@Hlavtox The idea is to have a specific catch-up file, to separate the "real" migrations from those that have been forgotten.

@M0rgan01 M0rgan01 self-assigned this Apr 30, 2024
@M0rgan01
Copy link
Contributor Author

@kpodemski I updated the migration file to 8.1.7, is that good for you?

@M0rgan01 M0rgan01 requested a review from kpodemski April 30, 2024 13:45
Quetzacoalt91
Quetzacoalt91 previously approved these changes May 2, 2024
upgrade/sql/9.0.0.sql Outdated Show resolved Hide resolved
ga-devfront
ga-devfront previously approved these changes May 6, 2024
Copy link

@AureRita AureRita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @M0rgan01

Thank you for your PR, I tested it :
from 1.7.0.1 to :
1.7.1.0
1.7.2.0
1.7.3.0
1.7.4.0
1.7.5.0 -> impossible to upgrade
1.7.6.0
1.7.7.0
1.7.8.0
1.7.8.11

from 1.7.5.0 to :
8.0.0
8.1.0

from 8.0.5 to 9.0.0

Because all seems to works as expected, It's QA ✔️

Thank you

@M0rgan01 M0rgan01 merged commit dd9afb1 into PrestaShop:dev May 13, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
7 participants