first commit
This commit is contained in:
37
upgrade/list/upgrade.2011-12-03.php
Normal file
37
upgrade/list/upgrade.2011-12-03.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
class Upgrade9 extends UpgradeNew
|
||||
{
|
||||
// overi, jestli je opravnene provest upgrade
|
||||
public function checkRightfulness_1()
|
||||
{
|
||||
$change = true;
|
||||
|
||||
$SQL = sqlQuery("SHOW TABLES LIKE '".getTableName('orders_history', false)."'");
|
||||
if (sqlNumRows($SQL) > 0) {
|
||||
$change = false;
|
||||
}
|
||||
|
||||
return $change;
|
||||
}
|
||||
|
||||
// provest samotny upgrade
|
||||
public function makeChanges_1()
|
||||
{
|
||||
$SQL = sqlQuery('CREATE TABLE '.getTableName('orders_history')." (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`id_order` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`id_status` INT(2) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`comment` TEXT,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id_order` (`id_order`),
|
||||
FOREIGN KEY (`id_order`) REFERENCES ".getTableName('orders').' (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;');
|
||||
|
||||
$SQL = sqlQuery('ALTER TABLE '.getTableName('order_items').'
|
||||
ADD FOREIGN KEY ( `id_order` ) REFERENCES '.getTableName('orders').' (`id`) ON DELETE CASCADE ON UPDATE CASCADE;');
|
||||
|
||||
$this->upgradeOK();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user