Ignore:
Timestamp:
Feb 22, 2016, 11:17:22 PM (9 years ago)
Author:
chronos
Message:
  • Modified: StockSerialNumber info transformed to separate table so multiple history items with different time can be added to track serial number history.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/UpdateTrace.php

    r792 r800  
    18201820    $Manager->Execute('UPDATE `Contract` SET `BillCode`='.$CodeId.' WHERE `Id`='.$DbRow['Id']);
    18211821  }
    1822   //$Manager->Execute('ALTER TABLE `Contract` DROP `BillCodeText`;');
     1822  $Manager->Execute('ALTER TABLE `Contract` DROP `BillCodeText`;');
     1823  $Manager->Execute('ALTER TABLE `StockSerialNumber` DROP `Info`;');
     1824}
     1825
     1826function UpdateTo800($Manager)
     1827{
     1828  $Manager->Execute('CREATE TABLE IF NOT EXISTS `StockItemHistory` (
     1829    `Id` int(11) NOT NULL,
     1830    `StockSerialNumber` int(11) NOT NULL,
     1831    `Time` datetime NOT NULL,
     1832    `Text` varchar(255) NOT NULL,
     1833    PRIMARY KEY (`Id`),
     1834    KEY `StockSerialNumber` (`StockSerialNumber`)
     1835   ) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
     1836  $Manager->Execute('ALTER TABLE `StockItemHistory` ADD FOREIGN KEY (`StockSerialNumber`) '.
     1837    'REFERENCES `StockSerialNumber`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
     1838  $Manager->Execute('INSERT INTO `StockItemHistory` (SELECT NULL AS `Id`, `Id` AS `StockSerialNumber`, '.
     1839    '"" AS `Time`, `Info` AS `Text` FROM `StockSerialNumber`)');
    18231840}
    18241841
     
    19061923      785 => array('Revision' => 786, 'Function' => 'UpdateTo786'),
    19071924      786 => array('Revision' => 792, 'Function' => 'UpdateTo792'),
     1925      792 => array('Revision' => 800, 'Function' => 'UpdateTo800'),
    19081926    ));
    19091927  }
Note: See TracChangeset for help on using the changeset viewer.