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