Add missing indexes on emailsubscription table - #141
Conversation
|
Hello @Prestaplugins! This is your first pull request on ps_emailsubscription repository of the PrestaShop project. Thank you, and welcome to this Open Source community! |
|
Correction: module version is no longer bumped in PHP / PrestaShop decides the published module version. The upgrade script |
|
I checked the queries against The I'm less sure about For example, the subscribers query filters on: WHERE e.active = 1and, depending on the shop context, may additionally filter on: AND e.id_shop = ...With the proposed I also tested With both filters: and with only So Would it make sense to reconsider |
|
Hi @Codencode, thanks for the review and the EXPLAIN tests — we agree with your analysis.
Install schema + |
|
@Hlavtox can you also check? |
emailsubscriptiontable only had a primary key onid, while the module repeatedly looks up guests byemail/id_shopand lists active subscribers byactive/id_shop. This PR addsKEY email_shop (email, id_shop)andKEY active_shop (active, id_shop)to the install schema, plus an upgrade script (upgrade/upgrade-3.0.1.php) for existing shops. Module version in PHP /config.xmlis intentionally left at3.0.0— PrestaShop decides the release version.SHOW INDEX FROM <prefix>emailsubscription— expectPRIMARY,email_shop,active_shop.Upgrade: with the module already at 3.0.0, run the upgrade script path (or temporarily set
$this->versionto3.0.1locally only to trigger the upgrade), then confirm the two indexes appear.Functional smoke: subscribe / unsubscribe a guest email, open BO subscribers list / export, verify FO + BO still work.