Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Giehl <stefan@piwik.org>2016-10-31 01:45:01 +0300
committerGitHub <noreply@github.com>2016-10-31 01:45:01 +0300
commit44b02620e71b78b5d652989e7b1a473828e22faf (patch)
treee8765bffbb64f1e0cd3e9f090e07761eebe3c390
parent3018d078a9b302abbf78e2c8129b66979fc5bb21 (diff)
parent8009c53332a1fd0946fac54898e35fbc4fe4e5ad (diff)
Merge pull request #10808 from piwik/migrategoalupdatescript
Migrate Goal plugin update script to use Migration Factory
-rw-r--r--plugins/Goals/Updates/3.0.0-b1.php29
1 files changed, 23 insertions, 6 deletions
diff --git a/plugins/Goals/Updates/3.0.0-b1.php b/plugins/Goals/Updates/3.0.0-b1.php
index db28c5a45c..923c2acb7a 100644
--- a/plugins/Goals/Updates/3.0.0-b1.php
+++ b/plugins/Goals/Updates/3.0.0-b1.php
@@ -12,21 +12,38 @@ namespace Piwik\Plugins\Goals;
use Piwik\Common;
use Piwik\Updater;
use Piwik\Updates;
+use Piwik\Updater\Migration\Factory as MigrationFactory;
class Updates_3_0_0_b1 extends Updates
{
- public function getMigrationQueries(Updater $updater)
+ /**
+ * @var MigrationFactory
+ */
+ private $migration;
+
+ public function __construct(MigrationFactory $factory)
+ {
+ $this->migration = $factory;
+ }
+
+ /**
+ * Here you can define one or multiple SQL statements that should be executed during the update.
+ * @return Updater\Migration[]
+ */
+ public function getMigrations(Updater $updater)
{
- $updateSql = array(
- 'ALTER TABLE `' . Common::prefixTable('goal')
- . '` ADD COLUMN `description` VARCHAR(255) NOT NULL DEFAULT \'\' AFTER `name`;' => array(1060)
+ return array(
+ $this->migration->db->addColumn('goal', 'description', 'VARCHAR(255) NOT NULL DEFAULT \'\'', 'name'),
);
- return $updateSql;
}
+ /**
+ * Here you can define any action that should be performed during the update. For instance executing SQL statements,
+ * renaming config entries, updating files, etc.
+ */
public function doUpdate(Updater $updater)
{
- $updater->executeMigrationQueries(__FILE__, $this->getMigrationQueries($updater));
+ $updater->executeMigrations(__FILE__, $this->getMigrations($updater));
}
}