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.
 
 
 
 

44 lines
1.4 KiB

<?php
error_reporting( E_ALL );
require_once('settings.php');
require_once('defines.php');
$UPGRADE = false;
$TT_123 = explode( '.', PHP_VERSION );
if( $TT_123[0] == '4' ){
require_once( 'php/db/MySQL_class.php' );
$DATABASE = new MySQL_DB($DBHost, $DBName, $DBUser, $DBPassword);
} elseif( $TT_123[0] > '4' ){
require_once( 'php/db/MySQLi_class.php' );
$DATABASE = new MySQLi_DB($DBHost, $DBName, $DBUser, $DBPassword);
} else {
echo "CANNOT DETERMINE DATABASE ENGINE!!!!!!!\n\n";
exit();
};
$QS="SHOW INDEX FROM `modbus_modules` WHERE Column_name='platform_id'";
$R = $DATABASE->Query( $QS );
if( count( $R ) ){
$QS = "ALTER TABLE `modbus_modules` DROP INDEX `{$R[0]['Key_name']}`";
$UPGRADE = true;
$DATABASE->Query( $QS );
};
$QS = "SHOW COLUMNS FROM `modbus_modules` LIKE 'label'";
$R = $DATABASE->Query( $QS );
if( count( $R ) == 0 ){
$QS = "ALTER TABLE `modbus_modules` ADD `label` CHAR(32) DEFAULT ''";
$UPGRADE = true;
$DATABASE->Query( $QS );
};
$QS = "SHOW COLUMNS FROM `metro_stations` LIKE 'short'";
$R = $DATABASE->Query( $QS );
if( count( $R ) == 0 ){
$QS = "ALTER TABLE `metro_stations` ADD `short` CHAR(32) DEFAULT ''";
$UPGRADE = true;
$DATABASE->Query( $QS );
};
if( $UPGRADE ){
echo "Upgrade Done!\n\n";
} else {
echo "No Upgrade Needed!\n\n";
};
?>