Files
kupshop/upgrade/list/upgrade.2014-06-10.php
2025-08-02 16:30:27 +02:00

96 lines
2.6 KiB
PHP

<?php
class Upgrade27 extends Upgrade
{
public function upgrade()
{
$changed = false;
// jestlize je opravnene udelat upgrade, tak provest
if ($this->checkRightfulness_1()) {
$this->makeChanges_1();
$changed = true;
}
// jestlize je opravnene udelat upgrade, tak provest
if ($this->checkRightfulness_2()) {
$this->makeChanges_2();
$changed = true;
}
// jestlize je opravnene udelat upgrade, tak provest
if (findModule('order_edit') && $this->checkRightfulness_3()) {
$this->makeChanges_3();
$changed = true;
}
// jestlize je opravnene udelat upgrade, tak provest
if ($this->checkRightfulness_4()) {
$this->makeChanges_4();
$changed = true;
}
if ($changed == false) {
$this->noChanges();
}
$this->printResult();
}
// overi, jestli je opravnene provest upgrade
public function checkRightfulness_1()
{
return $this->checkColumnIsNull('order_items', 'note', false) || $this->checkColumnType('order_items', 'note', 'TEXT');
}
// provest samotny upgrade
public function makeChanges_1()
{
sqlQuery('ALTER TABLE '.getTableName('order_items').' CHANGE `note` `note` TEXT NOT NULL');
$this->upgradeOK();
}
// overi, jestli je opravnene provest upgrade
public function checkRightfulness_2()
{
return $this->checkColumnIsNull('cart', 'note', false) || $this->checkColumnType('cart', 'note', 'TEXT');
}
// provest samotny upgrade
public function makeChanges_2()
{
sqlQuery('ALTER TABLE '.getTableName('cart').' CHANGE `note` `note` TEXT NOT NULL');
$this->upgradeOK();
}
// overi, jestli je opravnene provest upgrade
public function checkRightfulness_3()
{
return $this->checkColumnIsNull('order_edit', 'note', false) || $this->checkColumnType('order_edit', 'note', 'TEXT');
}
// provest samotny upgrade
public function makeChanges_3()
{
sqlQuery('ALTER TABLE '.getTableName('order_edit').' CHANGE `note` `note` TEXT NOT NULL');
$this->upgradeOK();
}
// overi, jestli je opravnene provest upgrade
public function checkRightfulness_4()
{
return $this->checkColumnType('users', 'passw', 'VARCHAR(256)');
}
// provest samotny upgrade
public function makeChanges_4()
{
sqlQuery('ALTER TABLE '.getTableName('users')." CHANGE `passw` `passw` VARCHAR(256) NOT NULL DEFAULT ''");
$this->upgradeOK();
}
}