View Issue Details

IDProjectCategoryView StatusLast Update
0007182OXID eShop (all versions)5. ------ UpdateApp / Update ------public2024-07-24 11:07
ReporterPavel Stolba Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status confirmedResolutionopen 
Product Version6.2.2 
Summary0007182: Migration for xxx2shop tables from PE to EE wrong
DescriptionThere is a copy&paste bug in the migration script oxideshop\vendor\oxid-esales\oxideshop-ee\migration\data\Version20160919103142_pe_to_ee.php

All the tables xxx2shop are filled with entries from oxarticles table, because the subquery is in all cases the same "SELECT OXSHOPID,OXMAPID from oxarticles". That can lead to a big problems after update to EE, because of data mixture. And it's not easy to find out the reason.


The part of the code from Version20160919103142_pe_to_ee.php (Row 473):

        $this->addSql("INSERT INTO `oxdeliveryset2shop` (`OXSHOPID`, `OXMAPOBJECTID`) VALUES (1, 901)");
        $this->addSql("INSERT INTO `oxdeliveryset2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxarticles");
        $this->addSql("INSERT INTO `oxdelivery2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxarticles");
        $this->addSql("INSERT INTO `oxarticles2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxarticles");
        $this->addSql("INSERT INTO `oxdiscount2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxarticles");
        $this->addSql("INSERT INTO `oxcategories2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxarticles");
        $this->addSql("INSERT INTO `oxattribute2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxarticles");
        $this->addSql("INSERT INTO `oxlinks2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxarticles");
        $this->addSql("INSERT INTO `oxvoucherseries2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxarticles");
        $this->addSql("INSERT INTO `oxmanufacturers2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxarticles");
        $this->addSql("INSERT INTO `oxnews2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxarticles");
        $this->addSql("INSERT INTO `oxselectlist2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxarticles");
        $this->addSql("INSERT INTO `oxwrapping2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxarticles");
        $this->addSql("INSERT INTO `oxvendor2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxarticles");


Also if you first add the $this->addSql("INSERT INTO `oxdeliveryset2shop` (`OXSHOPID`, `OXMAPOBJECTID`) VALUES (1, 901)"); query and then will be the next query started $this->addSql("INSERT INTO `oxdeliveryset2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxarticles"); that ends with a DB error: Duplicate entry '1-901' for key 'OXMAPIDX'. So in the oxdeliveryset2shop will land only the one entry (1, 901).

Steps To ReproduceRun a migration in OXID 6 from PE to EE
TagsNo tags attached.
ThemeNot defined
BrowserNot defined
PHP VersionNot defined
Database VersionNot defined

Activities

Pavel Stolba

2020-10-07 13:57

reporter   ~0013322

The second part i noticed with the "Duplicate entry '1-901' for key 'OXMAPIDX'" problem is coming only if there more then 900 articles at the time the migrations are running. So will not happend with demo datas.

Pavel Stolba

2020-10-07 14:48

reporter   ~0013323

Here is a fix we used (in project_migration)

      $this->addSql("TRUNCATE TABLE `oxdeliveryset2shop`");
        $this->addSql("INSERT INTO `oxdeliveryset2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxdeliveryset");
        $this->addSql("TRUNCATE TABLE `oxdelivery2shop`");
        $this->addSql("INSERT INTO `oxdelivery2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxdelivery");
        $this->addSql("TRUNCATE TABLE `oxdiscount2shop`");
        $this->addSql("INSERT INTO `oxdiscount2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxdiscount");
        $this->addSql("TRUNCATE TABLE `oxcategories2shop`");
        $this->addSql("INSERT INTO `oxcategories2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxcategories");
        $this->addSql("TRUNCATE TABLE `oxattribute2shop`");
        $this->addSql("INSERT INTO `oxattribute2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxattribute");
        $this->addSql("TRUNCATE TABLE `oxlinks2shop`");
        $this->addSql("INSERT INTO `oxlinks2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxlinks");
        $this->addSql("TRUNCATE TABLE `oxvoucherseries2shop`");
        $this->addSql("INSERT INTO `oxvoucherseries2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxvoucherseries");
        $this->addSql("TRUNCATE TABLE `oxmanufacturers2shop`");
        $this->addSql("INSERT INTO `oxmanufacturers2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxmanufacturers");
        $this->addSql("TRUNCATE TABLE `oxnews2shop`");
        $this->addSql("INSERT INTO `oxnews2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxnews");
        $this->addSql("TRUNCATE TABLE `oxselectlist2shop`");
        $this->addSql("INSERT INTO `oxselectlist2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxselectlist");
        $this->addSql("TRUNCATE TABLE `oxwrapping2shop`");
        $this->addSql("INSERT INTO `oxwrapping2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxwrapping");
        $this->addSql("TRUNCATE TABLE `oxvendor2shop`");
        $this->addSql("INSERT INTO `oxvendor2shop` (OXSHOPID, OXMAPOBJECTID) SELECT OXSHOPID,OXMAPID from oxvendor");

QA

2020-10-09 11:40

administrator   ~0013326

Dear Pavel Stolba,

thank you for reporting this issue.

Best regard

QA - SG -

SvenBrunk

2024-07-24 11:07

administrator   ~0017286

Confirmed. The source should be the old oxshopid together from the original table, not always oxarticle.
Also the order should be changed (if necessary at all).
901 is the default delivery. And that is probably already in the delivery table.