Changeset 710 for trunk/Common/Setup/Updates.php
- Timestamp:
- Dec 29, 2014, 12:09:46 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Setup/Updates.php
r707 r710 914 914 function UpdateTo696($Manager) 915 915 { 916 917 918 919 916 $Manager->Execute('ALTER TABLE `NetworkInterfaceUpDown` ADD `Duration` INT NOT NULL ;'); 917 $Manager->Execute('UPDATE `NetworkInterfaceUpDown` AS `TM` SET `Duration` = IFNULL(TIMESTAMPDIFF(SECOND, 918 (SELECT `Time` FROM (SELECT * FROM `NetworkInterfaceUpDown`) AS `TA` WHERE (`TA`.`Time` < `TM`.`Time`) 919 AND (`TA`.`Interface`=`TM`.`Interface`) ORDER BY `TA`.`Time` DESC LIMIT 1), `TM`.`Time`), 0)'); 920 920 } 921 921 922 922 function UpdateTo697($Manager) 923 923 { 924 925 926 927 928 924 $Manager->Execute('ALTER TABLE `NetworkInterfaceUpDown` CHANGE `Duration` `Duration` INT( 11 ) NULL ;'); 925 $Manager->Execute('UPDATE `NetworkInterfaceUpDown` SET `Duration` = NULL'); 926 $Manager->Execute('UPDATE `NetworkInterfaceUpDown` AS `TM` SET `Duration` = TIMESTAMPDIFF(SECOND, 927 `TM`.`Time`, (SELECT `Time` FROM (SELECT * FROM `NetworkInterfaceUpDown`) AS `TA` WHERE (`TA`.`Time` > `TM`.`Time`) 928 AND (`TA`.`Interface`=`TM`.`Interface`) ORDER BY `TA`.`Time` ASC LIMIT 1))'); 929 929 } 930 930 931 931 function UpdateTo707($Manager) 932 932 { 933 $Manager->Execute('ALTER TABLE `NetworkDevice` CHANGE `Product` `Product` INT(11) NULL;'); 933 $Manager->Execute('ALTER TABLE `NetworkDevice` CHANGE `Product` `Product` INT(11) NULL;'); 934 } 935 936 function UpdateTo710($Manager) 937 { 938 $Manager->Execute('RENAME TABLE `StockItem` TO `StockSerialNumber`;'); 939 $Manager->Execute('UPDATE `Action` SET `URL`="/is/?t=StockSerialNumber&a=list",`Title`="Sériová čísla" WHERE `URL`="/is/?t=StockItem&a=list";'); 940 941 // StockMove 942 $Manager->Execute('CREATE TABLE IF NOT EXISTS `StockMove` ( 943 `Id` int(11) NOT NULL, 944 `Time` datetime NOT NULL, 945 `StockFrom` int(11) DEFAULT NULL, 946 `StockTo` int(11) DEFAULT NULL, 947 `BillCode` varchar(255) NOT NULL, 948 `DocumentLine` int(11) NOT NULL, 949 `File` int(11) DEFAULT NULL 950 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 951 952 $Manager->Execute('ALTER TABLE `StockMove` 953 ADD PRIMARY KEY (`Id`), ADD KEY `DocumentLine` (`DocumentLine`), ADD KEY `StockFrom` (`StockFrom`), ADD KEY `StockTo` (`StockTo`), ADD KEY `File` (`File`);'); 954 955 $Manager->Execute('ALTER TABLE `StockMove` 956 MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;'); 957 958 $Manager->Execute('ALTER TABLE `StockMove` 959 ADD CONSTRAINT `StockMove_ibfk_1` FOREIGN KEY (`StockFrom`) REFERENCES `Stock` (`Id`), 960 ADD CONSTRAINT `StockMove_ibfk_2` FOREIGN KEY (`StockTo`) REFERENCES `Stock` (`Id`), 961 ADD CONSTRAINT `StockMove_ibfk_3` FOREIGN KEY (`DocumentLine`) REFERENCES `DocumentLine` (`Id`);'); 962 963 // StockMoveItem 964 $Manager->Execute('CREATE TABLE IF NOT EXISTS `StockMoveItem` ( 965 `Id` int(11) NOT NULL, 966 `StockMove` int(11) NOT NULL, 967 `Product` int(11) NOT NULL, 968 `Amount` int(11) NOT NULL, 969 `Text` varchar(255) NOT NULL, 970 `UnitPrice` int(11) NOT NULL 971 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 972 973 $Manager->Execute('ALTER TABLE `StockMoveItem` 974 ADD PRIMARY KEY (`Id`), ADD KEY `Product` (`Product`), ADD KEY `StockMove` (`StockMove`);'); 975 976 $Manager->Execute('ALTER TABLE `StockMoveItem` 977 MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;'); 978 979 $Manager->Execute('ALTER TABLE `StockMoveItem` 980 ADD CONSTRAINT `StockMoveItem_ibfk_2` FOREIGN KEY (`Product`) REFERENCES `Product` (`Id`), 981 ADD CONSTRAINT `StockMoveItem_ibfk_1` FOREIGN KEY (`StockMove`) REFERENCES `StockMove` (`Id`);'); 982 983 // IS menu item 984 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` , 985 `Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES ( 986 NULL , "", "Skladové pohyby", "1", "/is/?t=StockMove&a=list", NULL , NULL , NULL , "1");'); 987 $ActionId = $Manager->Database->insert_id; 988 $DbResult = $Manager->Execute('SELECT `Id` FROM `MenuItem` WHERE `Name`="Sklad"'); 989 if($DbResult->num_rows > 0) 990 { 991 $DbRow = $DbResult->fetch_assoc(); 992 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 993 "VALUES (NULL , 'Skladové pohyby', ".$DbRow['Id'].", '".$ActionId."', '1');"); 994 } 934 995 } 935 996 … … 987 1048 696 => array('Revision' => 697, 'Function' => 'UpdateTo697'), 988 1049 697 => array('Revision' => 707, 'Function' => 'UpdateTo707'), 1050 707 => array('Revision' => 710, 'Function' => 'UpdateTo710'), 989 1051 )); 990 1052 }
Note:
See TracChangeset
for help on using the changeset viewer.