Ignore:
Timestamp:
Apr 21, 2013, 11:24:56 PM (12 years ago)
Author:
chronos
Message:
  • Upraveno: Tabulka ISMenuItem přepracována na obecnější MenuItem odkazující se na Menu. Nově položky nabídky jsou vázány přímo na akce tabulku Action.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/Updates.php

    r526 r527  
    275275}
    276276
     277function UpdateTo527($Manager)
     278{
     279  $Manager->Execute("RENAME TABLE `ISMenuItem` TO `MenuItem` ;");
     280  $Manager->Execute("CREATE TABLE IF NOT EXISTS `Menu` (
     281  `Id` int(11) NOT NULL AUTO_INCREMENT,
     282  `Name` varchar(255) NOT NULL,
     283  PRIMARY KEY (`Id`)
     284) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
     285  $Manager->Execute("INSERT INTO `Menu` (`Id` ,`Name`)VALUES (NULL , 'IS');");
     286  $Manager->Execute("ALTER TABLE `MenuItem` ADD `Menu` INT NOT NULL , ADD INDEX ( `Menu` )");
     287  $Manager->Execute("UPDATE `MenuItem` SET `Menu` = 1");
     288  $Manager->Execute("ALTER TABLE `MenuItem` ADD FOREIGN KEY ( `Menu` ) REFERENCES `Menu` (".
     289    "`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;");
     290  $Manager->Execute("ALTER TABLE `Action` CHANGE `Group` `Group` INT( 11 ) NULL ");
     291  $Manager->Execute("INSERT INTO `Action` (SELECT NULL AS `Id`, '' AS `Name`, `Name` AS `Title`, 1 AS `Type`, CONCAT('/is/?t=', `Table`, '&a=list') AS `URL`, NULL AS `Group`, NULL AS `Icon`, NULL AS `PermisionModule`,  NULL AS `PermissionOperation`, 1 AS `Enable` FROM `MenuItem` WHERE `Parent` IS NOT NULL)");
     292  $Manager->Execute("ALTER TABLE `MenuItem` DROP `IconName`");
     293  $Manager->Execute("UPDATE `MenuItem` SET `Table` = (SELECT `Id` FROM `Action` WHERE `Action`.`URL` = CONCAT('/is/?t=', `MenuItem`.`Table`, '&a=list')) WHERE `MenuItem`.`Table` != ''");
     294  $Manager->Execute("ALTER TABLE `MenuItem` CHANGE `Table` `Action` INT NULL");
     295  $Manager->Execute("UPDATE `MenuItem` SET `Action` = NULL WHERE `Action` = 0");
     296  $Manager->Execute("ALTER TABLE `MenuItem` ADD INDEX ( `Action` ) ");
     297  $Manager->Execute("ALTER TABLE `MenuItem` ADD FOREIGN KEY ( `Action` ) REFERENCES `Action` (`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT ;");
     298  $Manager->Execute("INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` ,`Group` ,`Icon` ,`PermissionModule` ,`PermissionOperation` ,`Enable`)".
     299    "VALUES (NULL , '', 'Nabídky', '1', '/is/?t=Menu&a=list', NULL , NULL , '', '', '1');");
     300  $ActionId = $Manager->Database->insert_id;
     301  $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ".
     302    "VALUES (NULL , 'Nabídky', '23', '".$ActionId."', '1');"); 
     303 
     304}
     305
    277306$Updates = array(
    278307  491 => array('Revision' => 493, 'Function' => 'UpdateTo493'),
     
    289318  515 => array('Revision' => 517, 'Function' => 'UpdateTo517'),
    290319  517 => array('Revision' => 526, 'Function' => 'UpdateTo526'),
     320  526 => array('Revision' => 527, 'Function' => 'UpdateTo527'),
    291321);
    292322
Note: See TracChangeset for help on using the changeset viewer.