openrat-cms

# OpenRat Content Management System
git clone http://git.code.weiherhei.de/openrat-cms.git
Log | Files | Refs

DBVersion000019.class.php (785B)


      1 <?php
      2 
      3 use database\DbVersion;
      4 use security\Password;
      5 
      6 /**
      7  * The format of a value is stored in the value table, so users can change the format of a value, independent of the element.
      8  *
      9  * @author dankert
     10  *
     11  */
     12 class DBVersion000019 extends DbVersion
     13 {
     14     /**
     15      *
     16      */
     17     public function update()
     18     {
     19         $this->addColumn('value','format'  ,OR_DB_COLUMN_TYPE_INT,1,0,OR_DB_COLUMN_NOT_NULLABLE);
     20 
     21         // Initial Value: Copy from element.
     22         $tableValue   = $this->getTableName('value');
     23         $tableElement = $this->getTableName('element');
     24 
     25         $updateStmt = $this->getDb()->sql(<<<SQL
     26 UPDATE $tableValue
     27    SET format=(select format from $tableElement where $tableValue.elementid=$tableElement.id)
     28 SQL
     29         );
     30         $updateStmt->query();
     31     }
     32 }
     33