Ignore:
Timestamp:
Dec 31, 2016, 8:56:00 PM (7 years ago)
Author:
chronos
Message:
  • Added: Upgrade code to rename columns to have first capital name in all data tables.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/UpdateTrace.php

    r69 r80  
    5858}
    5959
     60function UpdateTo79($Manager)
     61{
     62  $DbResult = $Manager->Execute('SELECT `DataTable`,`DataType` FROM `Measure`;');
     63  while($Measure = $DbResult->fetch_assoc())
     64  {
     65    $Table = $Measure['DataTable'];
     66    $Type = $Measure['DataType'];
     67    $Manager->Execute('ALTER TABLE `'.$Table.'` CHANGE `time` `Time` DATETIME NULL DEFAULT NULL;');
     68    $Manager->Execute('ALTER TABLE `'.$Table.'` CHANGE `measure` `Measure` SMALLINT(11) NOT NULL DEFAULT "0";');
     69    $Manager->Execute('ALTER TABLE `'.$Table.'` CHANGE `min` `Min` '.$Type.' NOT NULL DEFAULT "0"');
     70    $Manager->Execute('ALTER TABLE `'.$Table.'` CHANGE `avg` `Avg` '.$Type.' NOT NULL DEFAULT "0"');
     71    $Manager->Execute('ALTER TABLE `'.$Table.'` CHANGE `max` `Max` '.$Type.' NOT NULL DEFAULT "0"');
     72    $Manager->Execute('ALTER TABLE `'.$Table.'` CHANGE `continuity` `Continuity` TINYINT(1) NOT NULL DEFAULT "0"');
     73    $Manager->Execute('ALTER TABLE `'.$Table.'` CHANGE `level` `Level` TINYINT(4) NOT NULL DEFAULT "0"');
     74  }
     75}
     76
    6077class Updates
    6178{
     
    6481    return(array(
    6582      65 => array('Revision' => 67, 'Function' => 'UpdateTo67'),
     83      67 => array('Revision' => 79, 'Function' => 'UpdateTo79'),
    6684    ));
    6785  }
Note: See TracChangeset for help on using the changeset viewer.