Skip to content

Prepare change of index with pre-deletion of duplicates in image_type table#1494

Merged
Quetzacoalt91 merged 2 commits intoPrestaShop:devfrom
Quetzacoalt91:fix-unicity-image-type-dev
Oct 20, 2025
Merged

Prepare change of index with pre-deletion of duplicates in image_type table#1494
Quetzacoalt91 merged 2 commits intoPrestaShop:devfrom
Quetzacoalt91:fix-unicity-image-type-dev

Conversation

@Quetzacoalt91
Copy link
Member

Questions Answers
Description? When updating to PS 9.0.1, an index of two columns is replaced by an index of only one column. We risk an issue in the case where different themes have been installed on the shop.
Type? bug fix
BC breaks? Nope
Deprecations? Nope
Fixed ticket? Fixes #1467 (comment)
Sponsor company @PrestaShopCorp
How to test? See below

How to test

From an updated shop on PrestaShop v9.0.0

Case 1: Hummingbird is active during the update

Prerequisites:

  • Update to PrestaShop 9.0.0 with a default configuration,
  • If necessary, open the page Design > Image Settings and customize the values,
  • Check your images type look like this in the database (Value may differ with your recent changes):
+---------------+-------------------+-------+--------+----------+------------+---------------+-----------+--------+-------------+
| id_image_type | name              | width | height | products | categories | manufacturers | suppliers | stores | theme_name  |
+---------------+-------------------+-------+--------+----------+------------+---------------+-----------+--------+-------------+
|             1 | cart_default      |   125 |    125 |        1 |          0 |             0 |         0 |      0 | NULL        |
|             2 | small_default     |    98 |     98 |        1 |          1 |             1 |         1 |      0 | NULL        |
|             3 | medium_default    |   452 |    452 |        1 |          0 |             1 |         1 |      0 | NULL        |
|             4 | home_default      |   250 |    250 |        1 |          0 |             0 |         0 |      0 | NULL        |
|             5 | large_default     |   800 |    800 |        1 |          0 |             1 |         1 |      0 | NULL        |
|             6 | category_default  |   141 |    180 |        0 |          1 |             0 |         0 |      0 | NULL        |
|             7 | stores_default    |   170 |    115 |        0 |          0 |             0 |         0 |      1 | NULL        |
+---------------+-------------------+-------+--------+----------+------------+---------------+-----------+--------+-------------+
  • Update to PrestaShop v9.0.1
  • Check the database contents again

Expected result: You keep all the images type details as they were before the update. Only the column theme_name is deleted.

Case 2: Hummingbird is active during the update

Prerequisites:

  • Update to PrestaShop 9.0.0 with a default configuration
  • Switch to the theme Hummingbird
  • If necessary, open the page Design > Image Settings and customize the values,
  • Check your images type look like this in the database (Value may differ with your recent changes):
+---------------+-------------------+-------+--------+----------+------------+---------------+-----------+--------+-------------+
| id_image_type | name              | width | height | products | categories | manufacturers | suppliers | stores | theme_name  |
+---------------+-------------------+-------+--------+----------+------------+---------------+-----------+--------+-------------+
|             1 | cart_default      |   125 |    125 |        1 |          0 |             0 |         0 |      0 | NULL        |
|             2 | small_default     |    98 |     98 |        1 |          1 |             1 |         1 |      0 | NULL        |
|             3 | medium_default    |   452 |    452 |        1 |          0 |             1 |         1 |      0 | NULL        |
|             4 | home_default      |   250 |    250 |        1 |          0 |             0 |         0 |      0 | NULL        |
|             5 | large_default     |   800 |    800 |        1 |          0 |             1 |         1 |      0 | NULL        |
|             6 | category_default  |   141 |    180 |        0 |          1 |             0 |         0 |      0 | NULL        |
|             7 | stores_default    |   170 |    115 |        0 |          0 |             0 |         0 |      1 | NULL        |
|             8 | cart_default      |   125 |    125 |        1 |          0 |             0 |         0 |      0 | hummingbird |
|             9 | small_default     |    98 |     98 |        1 |          1 |             1 |         1 |      0 | hummingbird |
|            10 | medium_default    |   452 |    452 |        1 |          0 |             1 |         1 |      0 | hummingbird |
|            11 | home_default      |   250 |    250 |        1 |          0 |             0 |         0 |      0 | hummingbird |
|            12 | large_default     |   800 |    800 |        1 |          0 |             1 |         1 |      0 | hummingbird |
|            13 | category_default  |   141 |    180 |        0 |          1 |             0 |         0 |      0 | hummingbird |
|            14 | stores_default    |   170 |    115 |        0 |          0 |             0 |         0 |      1 | hummingbird |
|            15 | default_xs        |   120 |    120 |        1 |          1 |             1 |         1 |      0 | hummingbird |
|            16 | default_s         |   160 |    160 |        1 |          1 |             0 |         0 |      0 | hummingbird |
|            17 | default_m         |   200 |    200 |        1 |          0 |             1 |         1 |      1 | hummingbird |
|            18 | default_md        |   320 |    320 |        1 |          1 |             0 |         0 |      0 | hummingbird |
|            19 | default_xl        |   400 |    400 |        1 |          0 |             0 |         0 |      1 | hummingbird |
|            20 | product_main      |   720 |    720 |        1 |          0 |             0 |         0 |      0 | hummingbird |
|            21 | category_cover    |  1000 |    200 |        0 |          1 |             0 |         0 |      0 | hummingbird |
|            22 | product_main_2x   |  1440 |   1440 |        1 |          0 |             0 |         0 |      0 | hummingbird |
|            23 | category_cover_2x |  2000 |    400 |        0 |          1 |             0 |         0 |      0 | hummingbird |
+---------------+-------------------+-------+--------+----------+------------+---------------+-----------+--------+-------------+
  • Update to PrestaShop v9.0.1
  • Check the database contents again

Expected result: You keep the images type details that were assigned to hummingbird (IDs 8 to 23). The column theme_name is deleted.

Case 3: Classic is active during the update

Prerequisites:

  • Update to PrestaShop 9.0.0 with a default configuration
  • Switch to the theme Hummingbird
  • Switch to the theme Classic
  • If necessary, open the page Design > Image Settings and customize the values,
  • Check your images type look like this in the database (Value may differ with your recent changes):
image Or in the database:
+---------------+-------------------+-------+--------+----------+------------+---------------+-----------+--------+-------------+
| id_image_type | name              | width | height | products | categories | manufacturers | suppliers | stores | theme_name  |
+---------------+-------------------+-------+--------+----------+------------+---------------+-----------+--------+-------------+
|             1 | cart_default      |   125 |    125 |        1 |          0 |             0 |         0 |      0 | NULL        |
|             2 | small_default     |    98 |     98 |        1 |          1 |             1 |         1 |      0 | NULL        |
|             3 | medium_default    |   452 |    452 |        1 |          0 |             1 |         1 |      0 | NULL        |
|             4 | home_default      |   250 |    250 |        1 |          0 |             0 |         0 |      0 | NULL        |
|             5 | large_default     |   800 |    800 |        1 |          0 |             1 |         1 |      0 | NULL        |
|             6 | category_default  |   141 |    180 |        0 |          1 |             0 |         0 |      0 | NULL        |
|             7 | stores_default    |   170 |    115 |        0 |          0 |             0 |         0 |      1 | NULL        |
|             8 | cart_default      |   125 |    125 |        1 |          0 |             0 |         0 |      0 | hummingbird |
|             9 | small_default     |    98 |     98 |        1 |          1 |             1 |         1 |      0 | hummingbird |
|            10 | medium_default    |   452 |    452 |        1 |          0 |             1 |         1 |      0 | hummingbird |
|            11 | home_default      |   250 |    250 |        1 |          0 |             0 |         0 |      0 | hummingbird |
|            12 | large_default     |   800 |    800 |        1 |          0 |             1 |         1 |      0 | hummingbird |
|            13 | category_default  |   141 |    180 |        0 |          1 |             0 |         0 |      0 | hummingbird |
|            14 | stores_default    |   170 |    115 |        0 |          0 |             0 |         0 |      1 | hummingbird |
|            15 | default_xs        |   120 |    120 |        1 |          1 |             1 |         1 |      0 | hummingbird |
|            16 | default_s         |   160 |    160 |        1 |          1 |             0 |         0 |      0 | hummingbird |
|            17 | default_m         |   200 |    200 |        1 |          0 |             1 |         1 |      1 | hummingbird |
|            18 | default_md        |   320 |    320 |        1 |          1 |             0 |         0 |      0 | hummingbird |
|            19 | default_xl        |   400 |    400 |        1 |          0 |             0 |         0 |      1 | hummingbird |
|            20 | product_main      |   720 |    720 |        1 |          0 |             0 |         0 |      0 | hummingbird |
|            21 | category_cover    |  1000 |    200 |        0 |          1 |             0 |         0 |      0 | hummingbird |
|            22 | product_main_2x   |  1440 |   1440 |        1 |          0 |             0 |         0 |      0 | hummingbird |
|            23 | category_cover_2x |  2000 |    400 |        0 |          1 |             0 |         0 |      0 | hummingbird |
|            24 | cart_default      |   125 |    125 |        1 |          0 |             0 |         0 |      0 | classic     |
|            25 | small_default     |    98 |     98 |        1 |          1 |             1 |         1 |      0 | classic     |
|            26 | medium_default    |   452 |    452 |        1 |          0 |             1 |         1 |      0 | classic     |
|            27 | home_default      |   250 |    250 |        1 |          0 |             0 |         0 |      0 | classic     |
|            28 | large_default     |   800 |    800 |        1 |          0 |             1 |         1 |      0 | classic     |
|            29 | category_default  |   141 |    180 |        0 |          1 |             0 |         0 |      0 | classic     |
|            30 | stores_default    |   170 |    115 |        0 |          0 |             0 |         0 |      1 | classic     |
+---------------+-------------------+-------+--------+----------+------------+---------------+-----------+--------+-------------+
  • Update to PrestaShop v9.0.1
  • Check the database contents again

Expected result: You keep the images type details that were assigned to classic (IDs 24 to 30). The column theme_name is deleted.

Case 4: In a multishop context, Classic is active on the shop 1 and Hummingbird is on the shop 2

Prerequisites:

  • Update to PrestaShop 9.0.0 with a default configuration
  • Switch to the theme Hummingbird
  • Switch to the theme Classic
  • Enable multishop
  • Create a new shop with Hummingbird
  • If necessary, open the page Design > Image Settings and customize the values,
  • Check your images type look like this in the database (Value may differ with your recent changes):
image Or in the database:
+---------------+-------------------+-------+--------+----------+------------+---------------+-----------+--------+-------------+
| id_image_type | name              | width | height | products | categories | manufacturers | suppliers | stores | theme_name  |
+---------------+-------------------+-------+--------+----------+------------+---------------+-----------+--------+-------------+
|             1 | cart_default      |   125 |    125 |        1 |          0 |             0 |         0 |      0 | NULL        |
|             2 | small_default     |    98 |     98 |        1 |          1 |             1 |         1 |      0 | NULL        |
|             3 | medium_default    |   452 |    452 |        1 |          0 |             1 |         1 |      0 | NULL        |
|             4 | home_default      |   250 |    250 |        1 |          0 |             0 |         0 |      0 | NULL        |
|             5 | large_default     |   800 |    800 |        1 |          0 |             1 |         1 |      0 | NULL        |
|             6 | category_default  |   141 |    180 |        0 |          1 |             0 |         0 |      0 | NULL        |
|             7 | stores_default    |   170 |    115 |        0 |          0 |             0 |         0 |      1 | NULL        |
|             8 | cart_default      |   125 |    125 |        1 |          0 |             0 |         0 |      0 | hummingbird |
|             9 | small_default     |    98 |     98 |        1 |          1 |             1 |         1 |      0 | hummingbird |
|            10 | medium_default    |   452 |    452 |        1 |          0 |             1 |         1 |      0 | hummingbird |
|            11 | home_default      |   250 |    250 |        1 |          0 |             0 |         0 |      0 | hummingbird |
|            12 | large_default     |   800 |    800 |        1 |          0 |             1 |         1 |      0 | hummingbird |
|            13 | category_default  |   141 |    180 |        0 |          1 |             0 |         0 |      0 | hummingbird |
|            14 | stores_default    |   170 |    115 |        0 |          0 |             0 |         0 |      1 | hummingbird |
|            15 | default_xs        |   120 |    120 |        1 |          1 |             1 |         1 |      0 | hummingbird |
|            16 | default_s         |   160 |    160 |        1 |          1 |             0 |         0 |      0 | hummingbird |
|            17 | default_m         |   200 |    200 |        1 |          0 |             1 |         1 |      1 | hummingbird |
|            18 | default_md        |   320 |    320 |        1 |          1 |             0 |         0 |      0 | hummingbird |
|            19 | default_xl        |   400 |    400 |        1 |          0 |             0 |         0 |      1 | hummingbird |
|            20 | product_main      |   720 |    720 |        1 |          0 |             0 |         0 |      0 | hummingbird |
|            21 | category_cover    |  1000 |    200 |        0 |          1 |             0 |         0 |      0 | hummingbird |
|            22 | product_main_2x   |  1440 |   1440 |        1 |          0 |             0 |         0 |      0 | hummingbird |
|            23 | category_cover_2x |  2000 |    400 |        0 |          1 |             0 |         0 |      0 | hummingbird |
|            24 | cart_default      |   125 |    125 |        1 |          0 |             0 |         0 |      0 | classic     |
|            25 | small_default     |    98 |     98 |        1 |          1 |             1 |         1 |      0 | classic     |
|            26 | medium_default    |   452 |    452 |        1 |          0 |             1 |         1 |      0 | classic     |
|            27 | home_default      |   250 |    250 |        1 |          0 |             0 |         0 |      0 | classic     |
|            28 | large_default     |   800 |    800 |        1 |          0 |             1 |         1 |      0 | classic     |
|            29 | category_default  |   141 |    180 |        0 |          1 |             0 |         0 |      0 | classic     |
|            30 | stores_default    |   170 |    115 |        0 |          0 |             0 |         0 |      1 | classic     |
+---------------+-------------------+-------+--------+----------+------------+---------------+-----------+--------+-------------+
  • Update to PrestaShop v9.0.1
  • Check the database contents again

Expected result: You keep the images type details that were assigned to classic AND hummingbird. If two lines share the same name, only the one with the highest ID is kept (IDs 15 to 30). The column theme_name is deleted.

@Quetzacoalt91 Quetzacoalt91 self-assigned this Oct 14, 2025
@Quetzacoalt91 Quetzacoalt91 added bug Type: Bug fix Blocked Status: The issue is blocked by another task labels Oct 14, 2025
@github-project-automation github-project-automation bot moved this to Ready for review in PR Dashboard Oct 14, 2025
@Quetzacoalt91 Quetzacoalt91 removed the Blocked Status: The issue is blocked by another task label Oct 15, 2025
@Quetzacoalt91 Quetzacoalt91 force-pushed the fix-unicity-image-type-dev branch from 8745ed6 to c18a24e Compare October 15, 2025 16:29
@Quetzacoalt91
Copy link
Member Author

Quetzacoalt91 commented Oct 15, 2025

We've released these changes with Update Assistant 7.4.2, even though alerts are detected about this change now.

This is caused by the SQL engine we use locally which is different (Maria 10 vs MySQL 5.7 here), and the time the CI ran. On the branch 7.4.x, PrestaShop 9.0.1 was not released yet so we did not detect the issue, while the PR for the dev branch was opened after.
We'll take the time to make things right here.

@Quetzacoalt91 Quetzacoalt91 added this to the 7.5.0 milestone Oct 15, 2025
@Quetzacoalt91 Quetzacoalt91 force-pushed the fix-unicity-image-type-dev branch from b2c93e2 to 518d626 Compare October 20, 2025 10:18
@sonarqubecloud
Copy link

@Quetzacoalt91
Copy link
Member Author

Backport from branch 7.4.x. Merging

@Quetzacoalt91 Quetzacoalt91 merged commit 1691d2d into PrestaShop:dev Oct 20, 2025
60 of 61 checks passed
@Quetzacoalt91 Quetzacoalt91 deleted the fix-unicity-image-type-dev branch October 20, 2025 13:33
@github-project-automation github-project-automation bot moved this from Ready for review to Merged in PR Dashboard Oct 20, 2025
@ps-jarvis ps-jarvis moved this from Merged to Ready for review in PR Dashboard Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Type: Bug fix

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants