Ignore:
Timestamp:
Jan 1, 2015, 3:22:27 PM (10 years ago)
Author:
chronos
Message:
  • Added: New table Company for representation of currecnt selected subject to work with.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Setup/Updates.php

    r715 r718  
    10011001        $Manager->Execute('ALTER TABLE `Member` DROP `NetworkSegment`');
    10021002        $Manager->Execute('DROP TABLE `NetworkSegment`');
     1003        $Manager->Execute('DELETE FROM `MenuItem` WHERE `Name`="Úseky sítě"');
     1004        $Manager->Execute('DELETE FROM `Action` WHERE `Title`="Úseky sítě"');
     1005}
     1006
     1007function UpdateTo718($Manager)
     1008{       
     1009  $Manager->Execute('CREATE TABLE IF NOT EXISTS `Company` (
     1010`Id` int(11) NOT NULL,
     1011`Name` varchar(255) NOT NULL,
     1012`Subject` int(11) NOT NULL
     1013) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
     1014  $Manager->Execute('ALTER TABLE `Company`
     1015ADD PRIMARY KEY (`Id`), ADD KEY `Subject` (`Subject`);');
     1016  $Manager->Execute('ALTER TABLE `Company`
     1017MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;');
     1018  $Manager->Execute('ALTER TABLE `Company`
     1019ADD CONSTRAINT `Company_ibfk_1` FOREIGN KEY (`Subject`) REFERENCES `Subject` (`Id`);');
     1020
     1021  // IS menu item
     1022  $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,
     1023`Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES (
     1024NULL , "", "Firmy", "1", "/is/?t=Company&a=list", NULL , NULL , NULL , "1");');
     1025  $ActionId = $Manager->Database->insert_id;
     1026  $DbResult = $Manager->Execute('SELECT `Id` FROM `MenuItem` WHERE `Name`="Finance"');
     1027  if($DbResult->num_rows > 0)
     1028  {
     1029        $DbRow = $DbResult->fetch_assoc();
     1030    $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     1031      "VALUES (NULL , 'Firmy', ".$DbRow['Id'].", '".$ActionId."', '1');");
     1032  }
    10031033}
    10041034
     
    10571087      697 => array('Revision' => 707, 'Function' => 'UpdateTo707'),
    10581088      710 => array('Revision' => 715, 'Function' => 'UpdateTo715'),
     1089      715 => array('Revision' => 718, 'Function' => 'UpdateTo718'),
    10591090    ));
    10601091  }
Note: See TracChangeset for help on using the changeset viewer.