Changeset 656 for trunk/Common/Setup/Updates.php
- Timestamp:
- May 16, 2014, 10:44:07 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Setup/Updates.php
r649 r656 2 2 3 3 function UpdateTo493($Manager) 4 { 4 { 5 5 $Manager->Execute("ALTER TABLE `UserOnline` CHANGE `User` `User` INT( 11 ) NULL DEFAULT NULL COMMENT 'User.Id'"); 6 6 } 7 7 8 8 function UpdateTo494($Manager) 9 { 9 { 10 10 $Manager->Execute("ALTER TABLE `FinanceOperation` DROP FOREIGN KEY `FinanceOperation_ibfk_2` ;\n". 11 11 "ALTER TABLE `FinanceOperation` CHANGE `Bill` `File` INT( 11 ) NULL DEFAULT NULL;\n". … … 183 183 `Message` varchar(255) NOT NULL DEFAULT '', 184 184 PRIMARY KEY (`Id`) 185 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;"); 185 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;"); 186 186 } 187 187 … … 201 201 $Manager->Execute("INSERT INTO `ServiceCategory` ( 202 202 `Id` ,`Name`) VALUES (NULL , 'Pevný nájem');"); 203 $ServiceCategoryHire = $Manager->Database->insert_id; 203 $ServiceCategoryHire = $Manager->Database->insert_id; 204 204 $DbResult = $Manager->Execute("SELECT * FROM Member WHERE Hire>0"); 205 205 while($Member = $DbResult->fetch_assoc()) … … 211 211 NULL , 'Nájem', '".$ServiceCategoryHire."', '-".$Member['Hire']."', '2', '', NULL , NULL , '', '', '', '', '', '', '', '' 212 212 );"); 213 $ServiceHire = $Manager->Database->insert_id; 214 $Manager->Execute("INSERT INTO `ServiceCustomerRel` (`Service`, `Customer`) VALUES ". 213 $ServiceHire = $Manager->Database->insert_id; 214 $Manager->Execute("INSERT INTO `ServiceCustomerRel` (`Service`, `Customer`) VALUES ". 215 215 "(".$ServiceHire.",".$Member['Id'].")"); 216 216 } … … 226 226 $Manager->Execute("ALTER TABLE `NetworkSubnet` ADD FOREIGN KEY ( `Service` ) REFERENCES `ServiceCustomerRel` ( 227 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)"); 228 $Manager->Execute("UPDATE `NetworkSubnet` SET `Service` = (SELECT `Id` FROM `ServiceCustomerRel` WHERE `ServiceCustomerRel`.`Customer` = `NetworkSubnet`.`Member` LIMIT 1)"); 229 229 } 230 230 … … 252 252 PRIMARY KEY (`Id`) 253 253 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; 254 254 255 255 INSERT INTO `ActionType` (`Id`, `Name`) VALUES 256 256 (1, 'Odkaz'), … … 301 301 $ActionId = $Manager->Database->insert_id; 302 302 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 303 "VALUES (NULL , 'Nabídky', '23', '".$ActionId."', '1');"); 303 "VALUES (NULL , 'Nabídky', '23', '".$ActionId."', '1');"); 304 304 } 305 305 … … 310 310 while($DbRow = $DbResult->fetch_row()) 311 311 { 312 $Manager->Execute("ALTER TABLE `".$DbRow[0]."` CONVERT TO CHARACTER SET utf8"); 313 } 312 $Manager->Execute("ALTER TABLE `".$DbRow[0]."` CONVERT TO CHARACTER SET utf8"); 313 } 314 314 } 315 315 … … 323 323 324 324 function UpdateTo550($Manager) 325 { 325 { 326 326 $Manager->Execute('ALTER TABLE `FinanceBankAccount` ADD `LastImportId` VARCHAR( 255 ) NOT NULL ;'); 327 327 $Manager->Execute('ALTER TABLE `FinanceBankAccount` ADD `LastImportDate` DATE NULL ;'); … … 330 330 331 331 function UpdateTo551($Manager) 332 { 332 { 333 333 $Manager->Execute('ALTER TABLE `FinanceOperation` ADD `DocumentLine` INT NULL AFTER `Value` , 334 334 ADD INDEX ( `DocumentLine` ) ;'); … … 344 344 345 345 function UpdateTo565($Manager) 346 { 346 { 347 347 $Manager->Execute('CREATE TABLE IF NOT EXISTS `WikiPage` ( 348 348 `Id` int(11) NOT NULL AUTO_INCREMENT, … … 370 370 371 371 function UpdateTo571($Manager) 372 { 372 { 373 373 $Manager->Execute('ALTER TABLE `NetworkDevice` ADD `LoginName` VARCHAR( 255 ) NOT NULL , 374 374 ADD `LoginPassword` VARCHAR( 255 ) NOT NULL ;'); … … 391 391 PRIMARY KEY (`Id`) 392 392 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=33 ;"); 393 393 394 394 $Manager->Execute("INSERT INTO `Module` (`Id`, `Name`, `Title`) VALUES 395 395 (1, 'Customer', 'Zákazník'), … … 647 647 } 648 648 649 function UpdateTo656($Manager) 650 { 651 $Manager->Execute('CREATE TABLE IF NOT EXISTS `Measure` ( 652 `Id` int(11) NOT NULL AUTO_INCREMENT, 653 `Name` varchar(255) NOT NULL, 654 `Method` int(11) NOT NULL, 655 `Continuity` int(11) NOT NULL, 656 `Period` int(11) NOT NULL, 657 `Enabled` int(11) NOT NULL, 658 `Description` text NOT NULL, 659 `DataType` varchar(255) NOT NULL, 660 `DataTable` varchar(255) NOT NULL, 661 `Group` int(11) DEFAULT NULL, 662 `Cumulative` int(11) NOT NULL DEFAULT "0", 663 PRIMARY KEY (`Id`), 664 KEY `Group` (`Group`), 665 KEY `Method` (`Method`) 666 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 667 668 $Manager->Execute('CREATE TABLE IF NOT EXISTS `MeasureData` ( 669 `Id` int(11) NOT NULL AUTO_INCREMENT, 670 `Time` datetime NOT NULL, 671 `Level` int(11) NOT NULL, 672 `Measure` int(11) NOT NULL, 673 `Continuity` int(11) NOT NULL, 674 `Min` int(11) NOT NULL, 675 `Avg` int(11) NOT NULL, 676 `Max` int(11) NOT NULL, 677 PRIMARY KEY (`Id`), 678 KEY `Time` (`Time`), 679 KEY `Measure` (`Measure`) 680 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 681 682 $Manager->Execute('CREATE TABLE IF NOT EXISTS `MeasureGroup` ( 683 `Id` int(11) NOT NULL AUTO_INCREMENT, 684 `Name` varchar(255) NOT NULL, 685 `Parent` int(11) DEFAULT NULL, 686 PRIMARY KEY (`Id`), 687 KEY `Parent` (`Parent`) 688 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 689 690 $Manager->Execute('CREATE TABLE IF NOT EXISTS `MeasureMethod` ( 691 `Id` int(11) NOT NULL AUTO_INCREMENT, 692 `Name` varchar(255) NOT NULL, 693 `Unit` varchar(255) NOT NULL, 694 PRIMARY KEY (`Id`) 695 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 696 697 $Manager->Execute('ALTER TABLE `Measure` 698 ADD CONSTRAINT `Measure_ibfk_1` FOREIGN KEY (`Group`) REFERENCES `MeasureGroup` (`Id`), 699 ADD CONSTRAINT `Measure_ibfk_2` FOREIGN KEY (`Method`) REFERENCES `MeasureMethod` (`Id`);'); 700 701 $Manager->Execute('ALTER TABLE `MeasureData` 702 ADD CONSTRAINT `MeasureData_ibfk_1` FOREIGN KEY (`Measure`) REFERENCES `Measure` (`Id`);'); 703 704 $Manager->Execute('ALTER TABLE `MeasureGroup` 705 ADD CONSTRAINT `MeasureGroup_ibfk_1` FOREIGN KEY (`Parent`) REFERENCES `MeasureGroup` (`Id`);'); 706 } 649 707 650 708 class Updates
Note:
See TracChangeset
for help on using the changeset viewer.