Ignore:
Timestamp:
May 31, 2014, 1:07:01 AM (10 years ago)
Author:
chronos
Message:
  • Upraveno: Definice třídy Subject přesunuta do samostatného modulu Subject.
  • Přidáno: K Subjektům přidána definice Kontaktů a druhů kontaktů.
File:
1 edited

Legend:

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

    r657 r661  
    727727}
    728728
     729function UpdateTo661($Manager)
     730{
     731  $Manager->Execute('CREATE TABLE IF NOT EXISTS `Contact` (
     732    `Id` int(11) NOT NULL AUTO_INCREMENT,
     733    `Category` int(11) NOT NULL,
     734    `Value` varchar(255) NOT NULL,
     735    `Subject` int(11) DEFAULT NULL,
     736    `User` int(11) DEFAULT NULL,
     737    PRIMARY KEY (`Id`),
     738    KEY `Category` (`Category`),
     739    KEY `User` (`User`),
     740    KEY `Subject` (`Subject`)
     741  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
     742
     743  $Manager->Execute('CREATE TABLE IF NOT EXISTS `ContactCategory` (
     744    `Id` int(11) NOT NULL AUTO_INCREMENT,
     745    `Name` varchar(255) NOT NULL,
     746    PRIMARY KEY (`Id`)
     747  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
     748
     749  $Manager->Execute('ALTER TABLE `Contact`
     750    ADD CONSTRAINT `Contact_ibfk_3` FOREIGN KEY (`User`) REFERENCES `User` (`Id`),
     751    ADD CONSTRAINT `Contact_ibfk_1` FOREIGN KEY (`Category`) REFERENCES `ContactCategory` (`Id`),
     752    ADD CONSTRAINT `Contact_ibfk_2` FOREIGN KEY (`Subject`) REFERENCES `Subject` (`Id`);');
     753
     754  $Manager->Execute("INSERT INTO `Action` (
     755`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,`Group` ,`Icon` ,`PermissionOperation` ,
     756`Enable`) VALUES (NULL , '', 'Kontakty', '1', '/is/?t=Contact&a=list', NULL , NULL , NULL , '1'
     757);");
     758  $ActionId = $Manager->Database->insert_id;
     759  $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     760    "VALUES (NULL , 'Kontakty', '12', '".$ActionId."', '1');");
     761  $ConatctMenuId = $Manager->Database->insert_id;
     762
     763  $Manager->Execute("INSERT INTO `Action` (
     764`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,`Group` ,`Icon` ,`PermissionOperation` ,
     765`Enable`) VALUES (NULL , '', 'Druhy kontakty', '1', '/is/?t=ContactCategory&a=list', NULL , NULL , NULL , '1'
     766);");
     767  $ActionId = $Manager->Database->insert_id;
     768  $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     769    "VALUES (NULL , 'Druhy kontaktů', ".$ConatctMenuId.", '".$ActionId."', '1');");
     770
     771  $Manager->Execute("INSERT INTO `ContactCategory` (`Id` ,`Name`)
     772VALUES (NULL , 'Telefón'), (NULL , 'ICQ'), (NULL , 'Jabber'), (NULL , 'Email'), (NULL , 'Skype');");
     773}
     774
    729775class Updates
    730776{
     
    767813      646 => array('Revision' => 647, 'Function' => 'UpdateTo647'),
    768814      647 => array('Revision' => 657, 'Function' => 'UpdateTo657'),
     815      657 => array('Revision' => 661, 'Function' => 'UpdateTo661'),
    769816    ));
    770817  }
Note: See TracChangeset for help on using the changeset viewer.