first commit
This commit is contained in:
129
upgrade/list/upgrade.2013-09-02.php
Normal file
129
upgrade/list/upgrade.2013-09-02.php
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
class Upgrade21 extends UpgradeNew
|
||||
{
|
||||
// overi, jestli je opravnene provest upgrade
|
||||
public function checkRightfulness_1()
|
||||
{
|
||||
return !$this->checkTableExists('paymuzo_payments') || !$this->checkTableExists('homecredit_payments') || !$this->checkTableExists('ebanka_payments');
|
||||
}
|
||||
|
||||
// provest samotny upgrade
|
||||
public function makeChanges_1()
|
||||
{
|
||||
if (!$this->checkTableExists('homecredit_payments')) {
|
||||
sqlQuery('DROP TABLE '.getTableName('homecredit_payments'));
|
||||
}
|
||||
if (!$this->checkTableExists('homecredit_delivery_type_relation')) {
|
||||
sqlQuery('DROP TABLE '.getTableName('homecredit_delivery_type_relation'));
|
||||
}
|
||||
if (!$this->checkTableExists('ebanka_payments')) {
|
||||
sqlQuery('DROP TABLE '.getTableName('ebanka_payments'));
|
||||
}
|
||||
if (!$this->checkTableExists('multiservis_delivery_type_relation')) {
|
||||
sqlQuery('DROP TABLE '.getTableName('multiservis_delivery_type_relation'));
|
||||
}
|
||||
if (!$this->checkTableExists('multiservis_payments')) {
|
||||
sqlQuery('DROP TABLE '.getTableName('multiservis_payments'));
|
||||
}
|
||||
if (!$this->checkTableExists('paymuzo_delivery_type_relation')) {
|
||||
sqlQuery('DROP TABLE '.getTableName('paymuzo_delivery_type_relation'));
|
||||
}
|
||||
if (!$this->checkTableExists('paymuzo_payments')) {
|
||||
sqlQuery('DROP TABLE '.getTableName('paymuzo_payments'));
|
||||
}
|
||||
|
||||
$this->upgradeOK();
|
||||
}
|
||||
|
||||
// overi, jestli je opravnene provest upgrade
|
||||
public function checkRightfulness_2()
|
||||
{
|
||||
return $this->checkColumnExists('products', 'show_in_feed');
|
||||
}
|
||||
|
||||
// provest samotny upgrade
|
||||
public function makeChanges_2()
|
||||
{
|
||||
$SQL = sqlQuery('ALTER TABLE '.getTableName('products').' ADD
|
||||
(`show_in_feed` BOOLEAN NOT NULL DEFAULT 1,
|
||||
`max_cpc` DOUBLE NOT NULL DEFAULT 0)');
|
||||
|
||||
sqlQuery('UPDATE '.getTableName('products')."
|
||||
SET max_cpc=IF(tollfree='Y', 1, 0)");
|
||||
|
||||
$this->upgradeOK();
|
||||
}
|
||||
|
||||
// overi, jestli je opravnene provest upgrade
|
||||
public function checkRightfulness_3()
|
||||
{
|
||||
return !$this->checkColumnExists('products', 'tollfree');
|
||||
}
|
||||
|
||||
// provest samotny upgrade
|
||||
public function makeChanges_3()
|
||||
{
|
||||
// Drop tollfree column
|
||||
$SQL = sqlQuery('ALTER TABLE '.getTableName('products').' DROP tollfree');
|
||||
|
||||
$this->upgradeOK();
|
||||
}
|
||||
|
||||
// overi, jestli je opravnene provest upgrade
|
||||
public function checkRightfulness_4()
|
||||
{
|
||||
return $this->checkConstraintWithColumnExists('parameters_products', 'PRIMARY', 'value') && !$this->checkColumnExists('parameters_products', 'value');
|
||||
}
|
||||
|
||||
// provest samotny upgrade
|
||||
public function makeChanges_4()
|
||||
{
|
||||
// Drop tollfree column
|
||||
$SQL = sqlQuery('ALTER TABLE '.getTableName('parameters_products').' DROP PRIMARY KEY ,
|
||||
ADD PRIMARY KEY ( `id_product` , `id_parameter` , `value` )');
|
||||
|
||||
$this->upgradeOK();
|
||||
}
|
||||
|
||||
// overi, jestli je opravnene provest upgrade
|
||||
public function checkRightfulness_5()
|
||||
{
|
||||
return $this->checkColumnType('sections', 'meta_title', 'varchar(70)');
|
||||
}
|
||||
|
||||
// provest samotny upgrade
|
||||
public function makeChanges_5()
|
||||
{
|
||||
// Make SEO fields wider
|
||||
sqlQuery('ALTER TABLE '.getTableName('sections').' CHANGE `meta_title` `meta_title` VARCHAR( 70 ) NULL DEFAULT NULL ,
|
||||
CHANGE `meta_description` `meta_description` VARCHAR( 250 ) NULL DEFAULT NULL ,
|
||||
CHANGE `meta_keywords` `meta_keywords` VARCHAR( 100 ) NULL DEFAULT NULL');
|
||||
|
||||
sqlQuery('ALTER TABLE '.getTableName('products').' CHANGE `meta_title` `meta_title` VARCHAR( 70 ) NULL DEFAULT NULL ,
|
||||
CHANGE `meta_description` `meta_description` VARCHAR( 250 ) NULL DEFAULT NULL ,
|
||||
CHANGE `meta_keywords` `meta_keywords` VARCHAR( 100 ) NULL DEFAULT NULL');
|
||||
|
||||
$this->upgradeOK();
|
||||
}
|
||||
|
||||
// overi, jestli je opravnene provest upgrade
|
||||
public function checkRightfulness_6()
|
||||
{
|
||||
return $this->checkColumnIsNull('parameters_products', 'unit', true);
|
||||
}
|
||||
|
||||
// provest samotny upgrade
|
||||
public function makeChanges_6()
|
||||
{
|
||||
// Make SEO fields wider
|
||||
sqlQuery('ALTER TABLE '.getTableName('parameters_products').'
|
||||
CHANGE `unit` `unit` VARCHAR( 20 ) NULL DEFAULT NULL ,
|
||||
CHANGE `weight` `weight` INT( 11 ) NULL DEFAULT NULL');
|
||||
|
||||
sqlQuery('UPDATE '.getTableName('parameters_products').' SET weight=NULL WHERE weight=0');
|
||||
sqlQuery('UPDATE '.getTableName('parameters_products')." SET unit=NULL WHERE unit='' OR unit='Array'");
|
||||
|
||||
$this->upgradeOK();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user