You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.4 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. error_reporting( E_ALL );
  3. require_once('settings.php');
  4. require_once('defines.php');
  5. $UPGRADE = false;
  6. $TT_123 = explode( '.', PHP_VERSION );
  7. if( $TT_123[0] == '4' ){
  8. require_once( 'php/db/MySQL_class.php' );
  9. $DATABASE = new MySQL_DB($DBHost, $DBName, $DBUser, $DBPassword);
  10. } elseif( $TT_123[0] > '4' ){
  11. require_once( 'php/db/MySQLi_class.php' );
  12. $DATABASE = new MySQLi_DB($DBHost, $DBName, $DBUser, $DBPassword);
  13. } else {
  14. echo "CANNOT DETERMINE DATABASE ENGINE!!!!!!!\n\n";
  15. exit();
  16. };
  17. $QS="SHOW INDEX FROM `modbus_modules` WHERE Column_name='platform_id'";
  18. $R = $DATABASE->Query( $QS );
  19. if( count( $R ) ){
  20. $QS = "ALTER TABLE `modbus_modules` DROP INDEX `{$R[0]['Key_name']}`";
  21. $UPGRADE = true;
  22. $DATABASE->Query( $QS );
  23. };
  24. $QS = "SHOW COLUMNS FROM `modbus_modules` LIKE 'label'";
  25. $R = $DATABASE->Query( $QS );
  26. if( count( $R ) == 0 ){
  27. $QS = "ALTER TABLE `modbus_modules` ADD `label` CHAR(32) DEFAULT ''";
  28. $UPGRADE = true;
  29. $DATABASE->Query( $QS );
  30. };
  31. $QS = "SHOW COLUMNS FROM `metro_stations` LIKE 'short'";
  32. $R = $DATABASE->Query( $QS );
  33. if( count( $R ) == 0 ){
  34. $QS = "ALTER TABLE `metro_stations` ADD `short` CHAR(32) DEFAULT ''";
  35. $UPGRADE = true;
  36. $DATABASE->Query( $QS );
  37. };
  38. if( $UPGRADE ){
  39. echo "Upgrade Done!\n\n";
  40. } else {
  41. echo "No Upgrade Needed!\n\n";
  42. };
  43. ?>