Changeset 507 for trunk/admin/Updates.php
- Timestamp:
- Apr 1, 2013, 7:14:59 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/Updates.php
r505 r507 183 183 `Message` varchar(255) NOT NULL DEFAULT '', 184 184 PRIMARY KEY (`Id`) 185 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;"); 186 185 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;"); 186 } 187 188 function UpdateTo507($Manager) 189 { 190 $Manager->Execute("INSERT INTO `ISMenuItem` (`Id` ,`Name` ,`Parent` ,`Table` ,`IconName`) ". 191 "VALUES (NULL , 'Aktuality', NULL, '', '');"); 192 $Id = $Manager->Database->insert_id; 193 $Manager->Execute("INSERT INTO `ISMenuItem` (`Id` ,`Name` ,`Parent` ,`Table` ,`IconName`) ". 194 "VALUES (NULL , 'Aktuality', '".$Id."', 'News', '');"); 195 $Manager->Execute("INSERT INTO `ISMenuItem` (`Id` ,`Name` ,`Parent` ,`Table` ,`IconName`) ". 196 "VALUES (NULL , 'Kategorie aktualit', '".$Id."', 'NewsCategory', '');"); 197 $Manager->Execute("INSERT INTO `FileDirectory` (`Id` ,`Name` ,`Parent`". 198 ") VALUES (NULL , 'news', NULL);"); 199 $Manager->Execute("ALTER TABLE `File` ADD `Time` DATETIME NOT NULL "); 200 // Convert Hire column to Service item 201 $Manager->Execute("INSERT INTO `ServiceCategory` ( 202 `Id` ,`Name`) VALUES (NULL , 'Pevný nájem');"); 203 $ServiceCategoryHire = $Manager->Database->insert_id; 204 $DbResult = $Manager->Execute("SELECT * FROM Member WHERE Hire>0"); 205 while($Member = $DbResult->fetch_assoc()) 206 { 207 $Manager->Execute("INSERT INTO `Service` ( 208 `Id` ,`Name` ,`Category` ,`Price` ,`VAT` ,`CustomerCount` ,`Action` ,`ReplaceId` , 209 `Public` ,`InternetSpeedMin` ,`InternetSpeedMax` ,`UploadAsymmetry` ,`Memory` ,`MemorySwap` ,`Storage` ,`CPUCount`) 210 VALUES ( 211 NULL , 'Nájem', '".$ServiceCategoryHire."', '-".$Member['Hire']."', '2', '', NULL , NULL , '', '', '', '', '', '', '', '' 212 );"); 213 $ServiceHire = $Manager->Database->insert_id; 214 $Manager->Execute("INSERT INTO `ServiceCustomerRel` (`Service`, `Customer`) VALUES ". 215 "(".$ServiceHire.",".$Member['Id'].")"); 216 } 217 $Manager->Execute("ALTER TABLE `Member` DROP `Hire`"); 218 // Each device and subnet have to be assigned to payed service to determine service parameters 219 $Manager->Execute("ALTER TABLE `NetworkDevice` ADD `Service` INT NULL AFTER `Location` , 220 ADD INDEX ( `Service` )"); 221 $Manager->Execute("ALTER TABLE `NetworkDevice` ADD FOREIGN KEY ( `Service` ) REFERENCES `ServiceCustomerRel` ( 222 `Id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;"); 223 $Manager->Execute("UPDATE `NetworkDevice` SET `Service` = (SELECT `Id` FROM `ServiceCustomerRel` WHERE `ServiceCustomerRel`.`Customer` = `NetworkDevice`.`Member` LIMIT 1)"); 224 $Manager->Execute("ALTER TABLE `NetworkSubnet` ADD `Service` INT NULL AFTER `Member` , 225 ADD INDEX ( `Service` ) "); 226 $Manager->Execute("ALTER TABLE `NetworkSubnet` ADD FOREIGN KEY ( `Service` ) REFERENCES `ServiceCustomerRel` ( 227 `Id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;"); 228 $Manager->Execute("UPDATE `NetworkSubnet` SET `Service` = (SELECT `Id` FROM `ServiceCustomerRel` WHERE `ServiceCustomerRel`.`Customer` = `NetworkSubnet`.`Member` LIMIT 1)"); 187 229 } 188 230 … … 197 239 500 => array('Revision' => 502, 'Function' => 'UpdateTo502'), 198 240 502 => array('Revision' => 505, 'Function' => 'UpdateTo505'), 241 505 => array('Revision' => 507, 'Function' => 'UpdateTo507'), 199 242 ); 200 243
Note:
See TracChangeset
for help on using the changeset viewer.