Skip to content

Commit

Permalink
fix(install): fix upgrading from older versions (#245)
Browse files Browse the repository at this point in the history
* fix(install): fix upgrading from older versions

Resolves #243

* refactor: remove migrations that will never be run

* test: add tests

* test: add unhappy flow test case

* refactor: move account update to pdk migration

* test: increase coverage
  • Loading branch information
EdieLemoine committed May 1, 2024
1 parent cf3c9e4 commit ae3b626
Show file tree
Hide file tree
Showing 36 changed files with 357 additions and 594 deletions.
14 changes: 7 additions & 7 deletions myparcelnl.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,20 @@ public function uninstall(): bool
/**
* @return string
*/
private function getBaseUrl(): string
protected function getVersionFromComposer(): string
{
return $this->context->link->getAdminLink('AdminModules');
$filename = __DIR__ . '/composer.json';
$composerData = json_decode(file_get_contents($filename), true);

return $composerData['version'];
}

/**
* @return string
*/
private function getVersionFromComposer(): string
private function getBaseUrl(): string
{
$filename = __DIR__ . '/composer.json';
$composerData = json_decode(file_get_contents($filename), true);

return $composerData['version'];
return $this->context->link->getAdminLink('AdminModules');
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Facade/MyParcelModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@

namespace MyParcelNL\PrestaShop\Facade;

use Module;
use MyParcelNL;
use MyParcelNL\Pdk\Base\Facade;
use MyParcelNL\PrestaShop\Service\ModuleService;

/**
* @method static MyParcelNL getInstance()
* @method static void registerHooks()
* @method static bool install(Module $module)
* @see \MyParcelNL\PrestaShop\Service\ModuleService
*/
final class MyParcelModule extends Facade
Expand Down
40 changes: 0 additions & 40 deletions src/Migration/AbstractLegacyPsMigration.php

This file was deleted.

5 changes: 5 additions & 0 deletions src/Migration/AbstractPsMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@

abstract class AbstractPsMigration implements MigrationInterface
{
public const LEGACY_TABLE_ORDER_LABEL = 'myparcelnl_order_label';
public const LEGACY_TABLE_CARRIER_CONFIGURATION = 'myparcelnl_carrier_configuration';
public const LEGACY_TABLE_DELIVERY_SETTINGS = 'myparcelnl_delivery_settings';
public const LEGACY_TABLE_PRODUCT_CONFIGURATION = 'myparcelnl_product_configuration';

/**
* @var \Db
*/
Expand Down
66 changes: 0 additions & 66 deletions src/Migration/Migration1_1_2.php

This file was deleted.

22 changes: 0 additions & 22 deletions src/Migration/Migration1_3_0.php

This file was deleted.

159 changes: 0 additions & 159 deletions src/Migration/Migration1_4_0.php

This file was deleted.

Loading

0 comments on commit ae3b626

Please sign in to comment.