Changeset 69 for trunk/Application/UpdateTrace.php
- Timestamp:
- Feb 28, 2016, 10:54:30 AM (9 years ago)
- Location:
- trunk/Application
- Files:
-
- 1 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/UpdateTrace.php
r68 r69 1 1 <?php 2 2 3 class UpdateTrace 3 function FullInstall($Manager) 4 4 { 5 var $Manager; 6 7 function FullInstall($Manager) 8 { 9 $this->Manager->Execute('CREATE TABLE IF NOT EXISTS `SystemVersion` ( 5 $Manager->Execute('CREATE TABLE IF NOT EXISTS `SystemVersion` ( 10 6 `Id` int(11) NOT NULL AUTO_INCREMENT, 11 7 `Revision` int(11) NOT NULL, 12 8 PRIMARY KEY (`Id`) 13 9 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;'); 14 $this->Manager->Execute('INSERT INTO `SystemVersion` (`Id`, `Version`) VALUES (NULL, 65);'); 15 } 10 $Manager->Execute('INSERT INTO `SystemVersion` (`Id`, `Revision`) VALUES (NULL, 65);'); 11 $Manager->Execute('CREATE TABLE IF NOT EXISTS `measure` ( 12 `Id` int(11) NOT NULL auto_increment, 13 `Name` varchar(255) collate utf8_general_ci NOT NULL, 14 `Description` varchar(255) collate utf8_general_ci NOT NULL, 15 `Divider` int(11) NOT NULL default 1, 16 `Unit` varchar(16) collate utf8_general_ci NOT NULL, 17 `Continuity` tinyint(1) NOT NULL default 0, 18 `Period` int(11) NOT NULL default 60, 19 `OldName` varchar(32) collate utf8_general_ci NOT NULL, 20 `PermissionView` varchar(255) collate utf8_general_ci NOT NULL default "all", 21 `PermissionAdd` varchar(255) collate utf8_general_ci NOT NULL default "localhost.localdomain", 22 `Info` varchar(255) collate utf8_general_ci NOT NULL, 23 `Enabled` int(11) NOT NULL default 1, 24 `Cumulative` int(11) NOT NULL default 0, 25 `DataTable` varchar(32) collate utf8_general_ci NOT NULL default "data", 26 `DataType` varchar(32) collate utf8_general_ci NOT NULL, 27 PRIMARY KEY (`Id`) 28 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;'); 29 } 16 30 17 function UpdateTo67($Manager) 18 { 19 $this->Manager->Execute('RENAME TABLE `measure` TO `Measure`;'); 20 $this->Manager->Execute('CREATE TABLE IF NOT EXISTS `Permission` ( 31 function UpdateTo67($Manager) 32 { 33 $Manager->Execute('RENAME TABLE `measure` TO `Measure`;'); 34 /* 35 $Manager->Execute('CREATE TABLE IF NOT EXISTS `Permission` ( 21 36 `Id` int(11) NOT NULL AUTO_INCREMENT, 22 37 `Measure` int(11) NOT NULL, … … 26 41 KEY `Measure` (`Measure`) 27 42 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;'); 28 $this->Manager->Execute('ALTER TABLE `Permission` ADD FOREIGN KEY (`Measure`) '.29 30 $DbResult = $this->Manager->Execute('SELECT `Id`, `PermissionAdd` FROM `Measure`');31 32 33 $this->Manager->Execute('INSERT INTO `Permission` (`Measure`, `Operation`) VALUES ('.43 $Manager->Execute('ALTER TABLE `Permission` ADD FOREIGN KEY (`Measure`) '. 44 'REFERENCES `Measure`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;'); 45 $DbResult = $Manager->Execute('SELECT `Id`, `PermissionAdd` FROM `Measure`'); 46 while($DbRow = $DbResult->fetch_assoc()) 47 { 48 $Manager->Execute('INSERT INTO `Permission` (`Measure`, `Operation`) VALUES ('. 34 49 $DbRow['Id'].', "add");'); 35 50 } 36 $DbResult = $this->Manager->Execute('SELECT `Id`, `PermissionView` FROM `Measure`');37 38 39 $ this->Manager->Execute('INSERT INTO `Permission` (`Measure`, `Operation`) VALUES ('.51 $DbResult = $Manager->Execute('SELECT `Id`, `PermissionView` FROM `Measure`'); 52 while($DbRow = $DbResult->fetch_assoc()) 53 { 54 $Manager->Execute('INSERT INTO `Permission` (`Measure`, `Operation`) VALUES ('. 40 55 $DbRow['Id'].', "view");'); 41 }42 //$this->Manager->Execute('');43 56 } 57 */ 58 } 44 59 45 function __construct() 60 class Updates 61 { 62 function Get() 46 63 { 47 $this->Updates =array(64 return(array( 48 65 65 => array('Revision' => 67, 'Function' => 'UpdateTo67'), 49 ) ;66 )); 50 67 } 51 68 }
Note:
See TracChangeset
for help on using the changeset viewer.