"Fossies" - the Fresh Open Source Software Archive

Member "matomo/core/Updates/1.5-b1.php" (3 Aug 2022, 2528 Bytes) of package /linux/www/matomo-4.11.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 <?php
    2 /**
    3  * Matomo - free/libre analytics platform
    4  *
    5  * @link https://matomo.org
    6  * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
    7  *
    8  */
    9 
   10 namespace Piwik\Updates;
   11 
   12 use Piwik\Updater;
   13 use Piwik\Updates;
   14 use Piwik\Updater\Migration\Factory as MigrationFactory;
   15 
   16 /**
   17  */
   18 class Updates_1_5_b1 extends Updates
   19 {
   20     /**
   21      * @var MigrationFactory
   22      */
   23     private $migration;
   24 
   25     public function __construct(MigrationFactory $factory)
   26     {
   27         $this->migration = $factory;
   28     }
   29 
   30     public function getMigrations(Updater $updater)
   31     {
   32         return array(
   33             $this->migration->db->createTable('log_conversion_item', array(
   34                 'idsite' => 'int(10) UNSIGNED NOT NULL',
   35                 'idvisitor' => 'BINARY(8) NOT NULL',
   36                 'server_time' =>'DATETIME NOT NULL',
   37                 'idvisit' => 'INTEGER(10) UNSIGNED NOT NULL',
   38                 'idorder' => 'varchar(100) NOT NULL',
   39                 'idaction_sku' => 'INTEGER(10) UNSIGNED NOT NULL',
   40                 'idaction_name' => 'INTEGER(10) UNSIGNED NOT NULL',
   41                 'idaction_category' => 'INTEGER(10) UNSIGNED NOT NULL',
   42                 'price' => 'FLOAT NOT NULL',
   43                 'quantity' => 'INTEGER(10) UNSIGNED NOT NULL',
   44                 'deleted' => 'TINYINT(1) UNSIGNED NOT NULL',
   45             ), array('idvisit', 'idorder', 'idaction_sku')),
   46             $this->migration->db->addIndex('log_conversion_item', array('idsite', 'server_time')),
   47 
   48             $this->migration->db->addColumns('log_visit', array(
   49                 'visitor_days_since_order' => 'SMALLINT(5) UNSIGNED NOT NULL',
   50                 'visit_goal_buyer' => 'TINYINT(1) NOT NULL'
   51             )),
   52             
   53             $this->migration->db->addColumn('log_conversion', 'visitor_days_since_order', 'SMALLINT(5) UNSIGNED NOT NULL'),
   54             $this->migration->db->addColumns('log_conversion', array(
   55                 'idorder' => 'varchar(100) default NULL',
   56                 'items' => 'SMALLINT UNSIGNED DEFAULT NULL',
   57                 'revenue_subtotal' => 'float default NULL',
   58                 'revenue_tax' => 'float default NULL',
   59                 'revenue_shipping' => 'float default NULL',
   60                 'revenue_discount' => 'float default NULL',
   61             )),
   62             $this->migration->db->addUniqueKey('log_conversion', array('idsite', 'idorder'))
   63         );
   64     }
   65 
   66     public function doUpdate(Updater $updater)
   67     {
   68         $updater->executeMigrations(__FILE__, $this->getMigrations($updater));
   69     }
   70 }