Skip to content
Extraits de code Groupes Projets
Valider 44b02620 rédigé par Stefan Giehl's avatar Stefan Giehl Validation de GitHub
Parcourir les fichiers

Merge pull request #10808 from piwik/migrategoalupdatescript

Migrate Goal plugin update script to use Migration Factory
parents 3018d078 8009c533
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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));
}
}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter