first commit
This commit is contained in:
49
upgrade/list/upgrade.2012-11-07.php
Normal file
49
upgrade/list/upgrade.2012-11-07.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
class Upgrade17 extends UpgradeNew
|
||||
{
|
||||
// overi, jestli je opravnene provest upgrade
|
||||
public function checkRightfulness_1()
|
||||
{
|
||||
if (!findModule(\Modules::AUTOMATIC_IMPORT)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$change = true;
|
||||
|
||||
$SQL = sqlQuery("SHOW TABLES LIKE '".getTableName('import', false)."'");
|
||||
if (sqlNumRows($SQL) > 0) {
|
||||
$change = false;
|
||||
}
|
||||
|
||||
return $change;
|
||||
}
|
||||
|
||||
// provest samotny upgrade
|
||||
public function makeChanges_1()
|
||||
{
|
||||
$SQL = sqlQuery('CREATE TABLE IF NOT EXISTS '.getTableName('import').' (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(50) NOT NULL,
|
||||
`id_supplier` INT(11) NOT NULL,
|
||||
`source` TEXT NULL,
|
||||
`type` INT(11) NOT NULL,
|
||||
`transformation` LONGTEXT NULL,
|
||||
`last_sync` DATETIME NULL,
|
||||
`last_count` INT(11) NULL,
|
||||
`interval` DECIMAL(5,2) NOT NULL,
|
||||
`add_new` BOOLEAN NOT NULL,
|
||||
`delete_old` DECIMAL(5,2) NULL,
|
||||
`modify_in_store` BOOLEAN NOT NULL,
|
||||
`params` VARCHAR( 200 ) NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id_supplier` (`id_supplier`)
|
||||
) ENGINE=InnoDB');
|
||||
|
||||
sqlQuery('ALTER TABLE '.getTableName('import').'
|
||||
ADD CONSTRAINT `import_ibfk_1`
|
||||
FOREIGN KEY (`id_supplier`) REFERENCES `suppliers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE');
|
||||
|
||||
$this->upgradeOK();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user