Changeset 738 for trunk/Common/Setup/Updates.php
- Timestamp:
- Apr 14, 2015, 10:20:16 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Setup/Updates.php
r736 r738 538 538 function UpdateTo627($Manager) 539 539 { 540 541 540 $Manager->Execute('ALTER TABLE `FinanceInvoice` CHANGE `TimeCreation` `Time` DATETIME NOT NULL DEFAULT "0000-00-00 00:00:00";'); 541 $Manager->Execute('ALTER TABLE `FinanceYear` ADD `Closed` INT NOT NULL ;'); 542 542 } 543 543 544 544 function UpdateTo632($Manager) 545 545 { 546 546 $Manager->Execute('CREATE TABLE IF NOT EXISTS `FinanceInvoiceOperationRel` ( 547 547 `Id` int(11) NOT NULL AUTO_INCREMENT, 548 548 `Invoice` int(11) NOT NULL, … … 559 559 function UpdateTo633($Manager) 560 560 { 561 561 $Manager->Execute('ALTER TABLE `UserOnline` ADD `StayLoggedHash` VARCHAR( 40 ) NOT NULL ;'); 562 562 } 563 563 564 564 function UpdateTo645($Manager) 565 565 { 566 566 $Manager->Execute('CREATE TABLE IF NOT EXISTS `FinanceVATType` ( 567 567 `Id` int(11) NOT NULL, 568 568 `Name` varchar(255) NOT NULL, … … 578 578 function UpdateTo646($Manager) 579 579 { 580 580 $Manager->Execute('CREATE TABLE IF NOT EXISTS `Contract` ( 581 581 `Id` int(11) NOT NULL AUTO_INCREMENT, 582 582 `BillCode` varchar(255) NOT NULL, … … 614 614 function UpdateTo647($Manager) 615 615 { 616 616 $Manager->Execute('ALTER TABLE `EmployeeSalary` ADD FOREIGN KEY ( `Employee` ) REFERENCES `Employee` ( 617 617 `Id` 618 618 ) ON DELETE RESTRICT ON UPDATE RESTRICT ;'); … … 649 649 function UpdateTo656($Manager) 650 650 { 651 651 $Manager->Execute('CREATE TABLE IF NOT EXISTS `Measure` ( 652 652 `Id` int(11) NOT NULL AUTO_INCREMENT, 653 653 `Name` varchar(255) NOT NULL, … … 708 708 function UpdateTo657($Manager) 709 709 { 710 710 $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkInterfaceUpDown` ( 711 711 `Id` int(11) NOT NULL AUTO_INCREMENT, 712 712 `Time` datetime NOT NULL, … … 873 873 if($DbResult->num_rows > 0) 874 874 { 875 875 $DbRow = $DbResult->fetch_assoc(); 876 876 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 877 877 "VALUES (NULL , 'Oblíbené položky nabídky', ".$DbRow['Id'].", '".$ActionId."', '1');"); … … 887 887 function UpdateTo688($Manager) 888 888 { 889 889 // Convert monthly plus payment for consumption to regular service 890 890 $DbResult = $Manager->Execute('SELECT `MonthlyPlus`, `Member` FROM `MemberPayment` WHERE `MonthlyPlus` > 0'); 891 891 while($DbRow = $DbResult->fetch_assoc) … … 935 935 936 936 function UpdateTo710($Manager) 937 { 937 { 938 938 $Manager->Execute('RENAME TABLE `StockItem` TO `StockSerialNumber`;'); 939 939 $Manager->Execute('UPDATE `Action` SET `URL`="/is/?t=StockSerialNumber&a=list",`Title`="Sériová čísla" WHERE `URL`="/is/?t=StockItem&a=list";'); 940 940 941 941 // StockMove 942 942 $Manager->Execute('CREATE TABLE IF NOT EXISTS `StockMove` ( … … 949 949 `File` int(11) DEFAULT NULL 950 950 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 951 951 952 952 $Manager->Execute('ALTER TABLE `StockMove` 953 953 ADD PRIMARY KEY (`Id`), ADD KEY `DocumentLine` (`DocumentLine`), ADD KEY `StockFrom` (`StockFrom`), ADD KEY `StockTo` (`StockTo`), ADD KEY `File` (`File`);'); 954 954 955 955 $Manager->Execute('ALTER TABLE `StockMove` 956 956 MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;'); 957 957 958 958 $Manager->Execute('ALTER TABLE `StockMove` 959 959 ADD CONSTRAINT `StockMove_ibfk_1` FOREIGN KEY (`StockFrom`) REFERENCES `Stock` (`Id`), 960 960 ADD CONSTRAINT `StockMove_ibfk_2` FOREIGN KEY (`StockTo`) REFERENCES `Stock` (`Id`), 961 961 ADD CONSTRAINT `StockMove_ibfk_3` FOREIGN KEY (`DocumentLine`) REFERENCES `DocumentLine` (`Id`);'); 962 962 963 963 // StockMoveItem 964 964 $Manager->Execute('CREATE TABLE IF NOT EXISTS `StockMoveItem` ( … … 970 970 `UnitPrice` int(11) NOT NULL 971 971 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 972 972 973 973 $Manager->Execute('ALTER TABLE `StockMoveItem` 974 974 ADD PRIMARY KEY (`Id`), ADD KEY `Product` (`Product`), ADD KEY `StockMove` (`StockMove`);'); 975 975 976 976 $Manager->Execute('ALTER TABLE `StockMoveItem` 977 977 MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;'); … … 979 979 $Manager->Execute('ALTER TABLE `StockMoveItem` 980 980 ADD CONSTRAINT `StockMoveItem_ibfk_2` FOREIGN KEY (`Product`) REFERENCES `Product` (`Id`), 981 ADD CONSTRAINT `StockMoveItem_ibfk_1` FOREIGN KEY (`StockMove`) REFERENCES `StockMove` (`Id`);'); 981 ADD CONSTRAINT `StockMoveItem_ibfk_1` FOREIGN KEY (`StockMove`) REFERENCES `StockMove` (`Id`);'); 982 982 983 983 // IS menu item … … 989 989 if($DbResult->num_rows > 0) 990 990 { 991 991 $DbRow = $DbResult->fetch_assoc(); 992 992 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 993 993 "VALUES (NULL , 'Skladové pohyby', ".$DbRow['Id'].", '".$ActionId."', '1');"); … … 997 997 function UpdateTo715($Manager) 998 998 { 999 1000 1001 1002 1003 1004 999 $Manager->Execute('ALTER TABLE `StockSerialNumber` DROP FOREIGN KEY `StockSerialNumber_ibfk_6`;'); 1000 $Manager->Execute('ALTER TABLE `StockSerialNumber` DROP `Segment`'); 1001 $Manager->Execute('ALTER TABLE `Member` DROP `NetworkSegment`'); 1002 $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 1005 } 1006 1006 1007 1007 function UpdateTo718($Manager) 1008 { 1008 { 1009 1009 $Manager->Execute('CREATE TABLE IF NOT EXISTS `Company` ( 1010 1010 `Id` int(11) NOT NULL, … … 1027 1027 if($DbResult->num_rows > 0) 1028 1028 { 1029 1029 $DbRow = $DbResult->fetch_assoc(); 1030 1030 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1031 1031 "VALUES (NULL , 'Firmy', ".$DbRow['Id'].", '".$ActionId."', '1');"); … … 1034 1034 1035 1035 function UpdateTo719($Manager) 1036 { 1036 { 1037 1037 $Manager->Execute('ALTER TABLE `FinanceOperation` ADD `Direction` INT NOT NULL AFTER `Cash`;'); 1038 1038 $Manager->Execute('UPDATE `FinanceOperation` SET `Direction` = 1 WHERE `Value` >= 0 ;'); 1039 1039 $Manager->Execute('UPDATE `FinanceOperation` SET `Direction` = -1 WHERE `Value` < 0 ;'); 1040 1040 $Manager->Execute('UPDATE `FinanceOperation` SET `Value` = -`Value` WHERE `Value` < 0 ;'); 1041 // Set missing FinanceOperation DocumentLine according BillCode 1041 // Set missing FinanceOperation DocumentLine according BillCode 1042 1042 $Manager->Execute('UPDATE `FinanceOperation` SET `DocumentLine` = 1 WHERE (`BillCode` LIKE "PP%") AND (`DocumentLine` IS NULL)'); 1043 1043 $Manager->Execute('UPDATE `FinanceOperation` SET `DocumentLine` = 2 WHERE (`BillCode` LIKE "VP%") AND (`DocumentLine` IS NULL)'); 1044 1044 $Manager->Execute('UPDATE `FinanceOperation` SET `DocumentLine` = 3 WHERE (`BillCode` LIKE "BV%") AND (`DocumentLine` IS NULL)'); 1045 1045 $Manager->Execute('UPDATE `FinanceOperation` SET `DocumentLine` = 4 WHERE (`BillCode` LIKE "PR%") AND (`DocumentLine` IS NULL)'); 1046 1046 1047 1047 // IS menu item 1048 1048 $DbResult = $Manager->Execute('SELECT `Id` FROM `MenuItem` WHERE `Name`="Příjmy a výdaje"'); 1049 1049 if($DbResult->num_rows > 0) 1050 1050 { 1051 1051 $DbRow = $DbResult->fetch_assoc(); 1052 1052 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` , 1053 1053 `Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES ( 1054 1054 NULL , "", "Příjem do pokladny", "1", "/is/?t=FinanceTreasuryIn&a=list", NULL , NULL , NULL , "1");'); 1055 1055 $ActionId = $Manager->Database->insert_id; 1056 1056 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1057 1057 "VALUES (NULL , 'Příjem do pokladny', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1058 1058 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` , … … 1060 1060 NULL , "", "Výdej z pokladny", "1", "/is/?t=FinanceTreasuryOut&a=list", NULL , NULL , NULL , "1");'); 1061 1061 $ActionId = $Manager->Database->insert_id; 1062 1062 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1063 1063 "VALUES (NULL , 'Výdej z pokladny', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1064 1064 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` , … … 1066 1066 NULL , "", "Příjem na účet", "1", "/is/?t=FinanceAccountIn&a=list", NULL , NULL , NULL , "1");'); 1067 1067 $ActionId = $Manager->Database->insert_id; 1068 1068 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1069 1069 "VALUES (NULL , 'Příjem na účet', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1070 1070 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` , … … 1072 1072 NULL , "", "Výdej z účtu", "1", "/is/?t=FinanceAccountOut&a=list", NULL , NULL , NULL , "1");'); 1073 1073 $ActionId = $Manager->Database->insert_id; 1074 1074 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1075 1075 "VALUES (NULL , 'Výdej z účtu', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1076 1076 } … … 1079 1079 function UpdateTo720($Manager) 1080 1080 { 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1081 $Manager->Execute('ALTER TABLE `FinanceInvoice` ADD `Direction` INT NOT NULL AFTER `TimePayment`;'); 1082 $Manager->Execute('UPDATE `FinanceInvoice` SET `Direction` = 1 WHERE `Value` >= 0 ;'); 1083 $Manager->Execute('UPDATE `FinanceInvoice` SET `Direction` = -1 WHERE `Value` < 0 ;'); 1084 $Manager->Execute('UPDATE `FinanceInvoice` SET `Value` = -`Value` WHERE `Value` < 0 ;'); 1085 // Set missing FinanceInvoice DocumentLine according BillCode 1086 $Manager->Execute('UPDATE `FinanceInvoice` SET `DocumentLine` = 5 WHERE (`BillCode` LIKE "PF%") AND (`DocumentLine` IS NULL)'); 1087 $Manager->Execute('UPDATE `FinanceInvoice` SET `DocumentLine` = 6 WHERE (`BillCode` LIKE "VF%") AND (`DocumentLine` IS NULL)'); 1088 1089 // IS menu item 1090 $DbResult = $Manager->Execute('SELECT `Id` FROM `MenuItem` WHERE `Name`="Závazky a pohledávky"'); 1091 if($DbResult->num_rows > 0) 1092 { 1093 $DbRow = $DbResult->fetch_assoc(); 1094 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` , 1095 1095 `Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES ( 1096 1096 NULL , "", "Příjaté", "1", "/is/?t=FinanceInvoiceIn&a=list", NULL , NULL , NULL , "1");'); 1097 1098 1099 1100 1101 1097 $ActionId = $Manager->Database->insert_id; 1098 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1099 "VALUES (NULL , 'Přijaté', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1100 1101 $Manager->Execute('INSERT INTO `Action` (`Id` ,`Name` ,`Title` ,`Type` ,`URL` , 1102 1102 `Group` ,`Icon` ,`PermissionOperation` ,`Enable`) VALUES ( 1103 1103 NULL , "", "Vydané", "1", "/is/?t=FinanceInvoiceOut&a=list", NULL , NULL , NULL , "1");'); 1104 1105 1106 1107 1104 $ActionId = $Manager->Database->insert_id; 1105 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1106 "VALUES (NULL , 'Vydané', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1107 } 1108 1108 } 1109 1109 1110 1110 function UpdateTo722($Manager) 1111 1111 { 1112 1112 $Manager->Execute('ALTER TABLE `Service` DROP `CustomerCount`;'); 1113 1113 } 1114 1114 1115 1115 function UpdateTo725($Manager) 1116 1116 { 1117 1118 1119 1120 $SearchText = 'Připojení k síti'; 1121 1122 1123 1124 1125 $Text = explode('-', $Text); 1126 1127 1128 1129 1130 1131 1132 1133 1134 $SearchText = 'Připojení k Internetu'; 1135 1136 1137 1138 1139 $Text = explode('-', $Text); 1140 1141 1142 1143 1144 1145 1146 1147 1148 1117 // Text column of invoices is not used. Text from invoice items is taken instead. 1118 $DbResult = $Manager->Execute('ALTER TABLE `FinanceInvoice` DROP `Text`;'); 1119 1120 $SearchText = 'Připojení k síti'; 1121 $DbResult = $Manager->Execute('SELECT * FROM `FinanceInvoiceItem` WHERE `Description` LIKE "'.$SearchText.' za období%";'); 1122 while($DbRow = $DbResult->fetch_assoc()) 1123 { 1124 $Text = trim(substr($DbRow['Description'], strlen($SearchText.' za období') + 1)); 1125 $Text = explode('-', $Text); 1126 $PeriodFrom = explode('.', trim($Text[0])); 1127 $PeriodFrom = $PeriodFrom[2].'-'.$PeriodFrom[1].'-'.$PeriodFrom[0]; 1128 $PeriodTo = explode('.', trim($Text[1])); 1129 $PeriodTo = $PeriodTo[2].'-'.$PeriodTo[1].'-'.$PeriodTo[0]; 1130 $Manager->Execute('UPDATE `FinanceInvoice` SET `PeriodFrom`="'.$PeriodFrom.'", `PeriodTo`="'.$PeriodTo.'" WHERE `Id`='.$DbRow['FinanceInvoice']); 1131 } 1132 $DbResult = $Manager->Execute('UPDATE `FinanceInvoiceItem` SET `Description` = "'.$SearchText.'" WHERE `Description` LIKE "'.$SearchText.' za období%";'); 1133 1134 $SearchText = 'Připojení k Internetu'; 1135 $DbResult = $Manager->Execute('SELECT * FROM `FinanceInvoiceItem` WHERE `Description` LIKE "'.$SearchText.' za období%";'); 1136 while($DbRow = $DbResult->fetch_assoc()) 1137 { 1138 $Text = trim(substr($DbRow['Description'], strlen($SearchText.' za období') + 1)); 1139 $Text = explode('-', $Text); 1140 $PeriodFrom = explode('.', trim($Text[0])); 1141 $PeriodFrom = $PeriodFrom[2].'-'.$PeriodFrom[1].'-'.$PeriodFrom[0]; 1142 $Text[1] = trim($Text[1]); 1143 if(strpos($Text[1], ' ') !== false) $Text[1] = substr($Text[1], 0, strpos($Text[1], ' ')); 1144 $PeriodTo = explode('.', trim($Text[1])); 1145 $PeriodTo = $PeriodTo[2].'-'.$PeriodTo[1].'-'.$PeriodTo[0]; 1146 $Manager->Execute('UPDATE `FinanceInvoice` SET `PeriodFrom`="'.$PeriodFrom.'", `PeriodTo`="'.$PeriodTo.'" WHERE `Id`='.$DbRow['FinanceInvoice']); 1147 } 1148 $DbResult = $Manager->Execute('UPDATE `FinanceInvoiceItem` SET `Description` = "'.$SearchText.'" WHERE `Description` LIKE "'.$SearchText.' za období%";'); 1149 1149 } 1150 1150 1151 1151 function UpdateTo726($Manager) 1152 1152 { 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1153 $Manager->Execute('ALTER TABLE `ServiceCustomerRel` CHANGE `Action` `ChangeAction` ENUM("add","modify","remove") CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;'); 1154 $Manager->Execute('ALTER TABLE `ServiceCustomerRel` ADD `ChangeTime` DATETIME NULL AFTER `ChangeAction`;'); 1155 $Manager->Execute('ALTER TABLE `ServiceCustomerRel` DROP FOREIGN KEY `ServiceCustomerRel_ibfk_4`;'); 1156 $Manager->Execute('ALTER TABLE `ServiceCustomerRel` CHANGE `ReplaceId` `ChangeReplaceId` INT(11) NULL DEFAULT NULL;'); 1157 $Manager->Execute('ALTER TABLE `ServiceCustomerRel` ADD FOREIGN KEY (`ChangeReplaceId`) REFERENCES `ServiceCustomerRel`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;'); 1158 1159 $Manager->Execute('ALTER TABLE `Service` CHANGE `Action` `ChangeAction` ENUM("add","modify","remove") CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;'); 1160 $Manager->Execute('ALTER TABLE `Service` ADD `ChangeTime` DATETIME NULL AFTER `ChangeAction`;'); 1161 $Manager->Execute('ALTER TABLE `Service` DROP FOREIGN KEY `Service_ibfk_2`;'); 1162 $Manager->Execute('ALTER TABLE `Service` CHANGE `ReplaceId` `ChangeReplaceId` INT(11) NULL DEFAULT NULL;'); 1163 $Manager->Execute('ALTER TABLE `Service` ADD FOREIGN KEY (`ChangeReplaceId`) REFERENCES `Service`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;'); 1164 1165 $Manager->Execute('ALTER TABLE `FinanceCharge` CHANGE `Action` `ChangeAction` ENUM("add","modify","remove") CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;'); 1166 $Manager->Execute('ALTER TABLE `FinanceCharge` ADD `ChangeTime` DATETIME NULL AFTER `ChangeAction`;'); 1167 $Manager->Execute('ALTER TABLE `FinanceCharge` DROP FOREIGN KEY `FinanceCharge_ibfk_1`;'); 1168 $Manager->Execute('ALTER TABLE `FinanceCharge` CHANGE `ReplaceId` `ChangeReplaceId` INT(11) NULL DEFAULT NULL;'); 1169 $Manager->Execute('ALTER TABLE `FinanceCharge` ADD FOREIGN KEY (`ChangeReplaceId`) REFERENCES `FinanceCharge`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;'); 1170 1171 $Manager->Execute('ALTER TABLE `MemberPayment` DROP `NetworkDevice`;'); 1172 1172 } 1173 1173 … … 1175 1175 { 1176 1176 $Manager->Execute('ALTER TABLE `FinanceBankAccount` ADD `AutoImport` INT NOT NULL ;'); 1177 1177 1178 1178 $Manager->Execute('CREATE TABLE IF NOT EXISTS `Scheduler` ( 1179 1179 `Id` int(11) NOT NULL, … … 1189 1189 $Manager->Execute('ALTER TABLE `Scheduler` 1190 1190 ADD PRIMARY KEY (`Id`);'); 1191 1191 1192 1192 $Manager->Execute('ALTER TABLE `Scheduler` 1193 1193 MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;'); … … 1201 1201 if($DbResult->num_rows > 0) 1202 1202 { 1203 1203 $DbRow = $DbResult->fetch_assoc(); 1204 1204 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1205 1205 "VALUES (NULL , 'Plánovač', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1206 1206 } 1207 1207 1208 1208 $Manager->Execute('INSERT INTO `Module` (`Id`, `Name`, `Title`) VALUES (NULL, "Plánovač", "Scheduler");'); 1209 1209 } … … 1211 1211 function UpdateTo730($Manager) 1212 1212 { 1213 1213 $Manager->Execute('CREATE TABLE IF NOT EXISTS `SchedulerAction` ( 1214 1214 `Id` int(11) NOT NULL AUTO_INCREMENT, 1215 1215 `Name` varchar(255) NOT NULL, 1216 1216 `Class` varchar(255) NOT NULL, 1217 1218 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 1217 PRIMARY KEY (`Id`) 1218 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 1219 1219 $Manager->Execute('ALTER TABLE `Scheduler` CHANGE `Class` `Action` INT(11) NOT NULL;'); 1220 1220 $Manager->Execute("ALTER TABLE `Scheduler` ADD INDEX ( `Action` ) "); … … 1226 1226 function UpdateTo731($Manager) 1227 1227 { 1228 1229 1228 // NetworkDomain 1229 $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkDomain` ( 1230 1230 `Id` int(11) NOT NULL, 1231 1231 `Name` varchar(255) NOT NULL, … … 1252 1252 if($DbResult->num_rows > 0) 1253 1253 { 1254 1255 1256 1257 } 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1254 $DbRow = $DbResult->fetch_assoc(); 1255 $Manager->Execute("INSERT INTO `MenuItem` (`Id` ,`Name` ,`Parent` ,`Action` ,`Menu`) ". 1256 "VALUES (NULL , 'Síťová doména', ".$DbRow['Id'].", '".$ActionId."', '1');"); 1257 } 1258 1259 // Model additions 1260 $Manager->Execute('ALTER TABLE `Model` ADD `Title` VARCHAR(255) NOT NULL , '. 1261 'ADD `Query` VARCHAR(255) NOT NULL , '. 1262 'ADD `DefaultSortColumn` VARCHAR(255) NOT NULL , '. 1263 'ADD `DefaultSortOrder` INT NOT NULL ;'); 1264 1265 // ModelField 1266 $Manager->Execute('CREATE TABLE IF NOT EXISTS `ModelField` ( 1267 `Id` int(11) NOT NULL, 1268 `Name` varchar(255) NOT NULL, 1269 `Model` int(11) NOT NULL, 1270 `Query` varchar(255) NOT NULL, 1271 `Type` varchar(255) NOT NULL, 1272 `Title` varchar(255) NOT NULL, 1273 `DefaultValue` varchar(255) NOT NULL, 1274 `IsNull` int(11) NOT NULL, 1275 `Suffix` varchar(255) NOT NULL 1276 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 1277 1278 $Manager->Execute('ALTER TABLE `ModelField` 1279 ADD PRIMARY KEY (`Id`), ADD KEY `Model` (`Model`);'); 1280 1281 $Manager->Execute('ALTER TABLE `ModelField` 1282 MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;'); 1283 1284 $Manager->Execute('ALTER TABLE `ModelField` 1285 ADD CONSTRAINT `ModelField_ibfk_1` FOREIGN KEY (`Model`) REFERENCES `Model` (`Id`);'); 1286 1287 // Module additions 1288 $Manager->Execute('ALTER TABLE `Module` ADD `Version` VARCHAR(255) NOT NULL , '. 1289 'ADD `Creator` VARCHAR(255) NOT NULL , '. 1290 'ADD `License` VARCHAR(255) NOT NULL , '. 1291 'ADD `Installed` INT NOT NULL , '. 1292 'ADD `HomePage` VARCHAR(255) NOT NULL , '. 1293 'ADD `Description` TEXT NOT NULL ;'); 1294 1295 // ModuleLink 1296 $Manager->Execute('CREATE TABLE IF NOT EXISTS `ModuleLink` ( 1297 1297 `Id` int(11) NOT NULL, 1298 1298 `Module` int(11) NOT NULL, … … 1305 1305 1306 1306 $Manager->Execute('ALTER TABLE `ModuleLink` 1307 1307 MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;'); 1308 1308 } 1309 1309 1310 1310 function UpdateTo735($Manager) 1311 1311 { 1312 1312 $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkFreeAccess` ( 1313 1313 `Id` int(11) NOT NULL, 1314 1314 `IPAddress` varchar(255) NOT NULL, 1315 1315 `Time` datetime NOT NULL 1316 1316 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;'); 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 $Manager->Execute('INSERT INTO `Scheduler` (`Id`, `Name`, `Enabled`, `Action`, 1329 `Log`, `LastExecutedTime`, `ScheduledTime`, `Period`) VALUES (NULL, "Internet zdarma", 1330 1331 1317 1318 $Manager->Execute('ALTER TABLE `NetworkFreeAccess` 1319 ADD PRIMARY KEY (`Id`);'); 1320 1321 $Manager->Execute('ALTER TABLE `NetworkFreeAccess` 1322 MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;'); 1323 1324 $Manager->Execute('ALTER TABLE `NetworkFreeAccess` ADD `Configured` INT NOT NULL ;'); 1325 $DbResult = $Manager->Execute('INSERT INTO `SchedulerAction` (`Id`, `Name`, `Class`) VALUES '. 1326 '(NULL, "Konfigurace internetu zdarma", "ScheduleConfigureFreeAccess");'); 1327 $ActionId = $Manager->Database->insert_id; 1328 $Manager->Execute('INSERT INTO `Scheduler` (`Id`, `Name`, `Enabled`, `Action`, 1329 `Log`, `LastExecutedTime`, `ScheduledTime`, `Period`) VALUES (NULL, "Internet zdarma", 1330 1, '.$ActionId.', "", NULL, "", 5);'); 1331 $Manager->Execute('ALTER TABLE `Scheduler` CHANGE `ScheduledTime` `ScheduledTime` DATETIME NULL;'); 1332 1332 } 1333 1333 1334 1334 function UpdateTo736($Manager) 1335 1335 { 1336 1336 $Manager->Execute('CREATE TABLE IF NOT EXISTS `NetworkLinkType` ( 1337 1337 `Id` int(11) NOT NULL, 1338 1338 `Name` varchar(255) NOT NULL … … 1399 1399 697 => array('Revision' => 707, 'Function' => 'UpdateTo707'), 1400 1400 707 => array('Revision' => 710, 'Function' => 'UpdateTo710'), 1401 1401 710 => array('Revision' => 715, 'Function' => 'UpdateTo715'), 1402 1402 715 => array('Revision' => 718, 'Function' => 'UpdateTo718'), 1403 1403 718 => array('Revision' => 719, 'Function' => 'UpdateTo719'), 1404 1405 1406 1407 1408 1409 1410 1411 1412 1404 719 => array('Revision' => 720, 'Function' => 'UpdateTo720'), 1405 720 => array('Revision' => 722, 'Function' => 'UpdateTo722'), 1406 722 => array('Revision' => 725, 'Function' => 'UpdateTo725'), 1407 725 => array('Revision' => 726, 'Function' => 'UpdateTo726'), 1408 726 => array('Revision' => 729, 'Function' => 'UpdateTo729'), 1409 729 => array('Revision' => 730, 'Function' => 'UpdateTo730'), 1410 730 => array('Revision' => 731, 'Function' => 'UpdateTo731'), 1411 731 => array('Revision' => 735, 'Function' => 'UpdateTo735'), 1412 735 => array('Revision' => 736, 'Function' => 'UpdateTo736'), 1413 1413 )); 1414 1414 }
Note:
See TracChangeset
for help on using the changeset viewer.