<?php
namespace ModulesGarden\HostingQuotaNotifications\App\Configuration\Addon\Update\Patch;

use ModulesGarden\HostingQuotaNotifications\App\Libs\Migration\Migration;
use ModulesGarden\HostingQuotaNotifications\Core\Configuration\Addon\Update\Patch\AbstractPatch;
use ModulesGarden\HostingQuotaNotifications\Core\Helper;

/**
 * Description of M1M1P0
 *
 *  @author Artur Pilch <artur.pi@modulesgarden.com>
 */
class M1M1P0 extends AbstractPatch
{
    
    public function execute()
    {
        if ($this->runSchema())
        {
            $this->migrate();
            Helper\sl('logger')
                ->addDebug("Correctly installed update {$this->getVersion()} .",[]);
        }
        else
        {
            Helper\sl('"errorManager"')
                ->addError(self::class,"Incorrectly installed update {$this->getVersion()} .",[]);
        }
    }

    public function migrate()
    {
        $migration = new Migration();
        $migration->run();
    }
}
