| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Matomo - free/libre analytics platform |
| 5 |
* |
| 6 |
* @link https://matomo.org |
| 7 |
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later |
| 8 |
*/ |
| 9 |
namespace Piwik\Updater\Migration\Db; |
| 10 |
|
| 11 |
/** |
| 12 |
* @see Factory::addColumn() |
| 13 |
* @ignore |
| 14 |
*/ |
| 15 |
class AddColumn extends \Piwik\Updater\Migration\Db\Sql |
| 16 |
{ |
| 17 |
public function __construct($table, $columnName, $columnType, $placeColumnAfter) |
| 18 |
{ |
| 19 |
$sql = sprintf("ALTER TABLE `%s` ADD COLUMN `%s` %s", $table, $columnName, $columnType); |
| 20 |
if (!empty($placeColumnAfter)) { |
| 21 |
$sql .= sprintf(' AFTER `%s`', $placeColumnAfter); |
| 22 |
} |
| 23 |
parent::__construct($sql, static::ERROR_CODE_DUPLICATE_COLUMN); |
| 24 |
} |
| 25 |
} |
| 26 |
|