File modules/cms/update/version/DBVersion000018.class.php

Last commit: Sun Mar 7 00:10:20 2021 +0100	Jan Dankert	Refactoring: Hopefully more performance while accessing the database resultsets.
1 <?php 2 3 namespace cms\update\version; 4 5 use database\DbVersion; 6 use database\Column; 7 use security\Password; 8 9 /** 10 * Elements should have a name and a separate label. 11 * 12 * @author dankert 13 * 14 */ 15 class DBVersion000018 extends DbVersion 16 { 17 /** 18 * 19 */ 20 public function update() 21 { 22 $table = $this->table('element'); 23 $table->column('label' )->type(Column::TYPE_VARCHAR)->size(100)->defaultValue('')->add(); 24 25 // Initial Value for Labels is the element name. 26 $tableElement = $table->getSqlName(); 27 28 $updateStmt = $this->getDb()->sql(<<<SQL 29 UPDATE $tableElement 30 SET label=name 31 SQL 32 ); 33 $updateStmt->execute(); 34 35 $table->addUniqueIndex(['templateid','label']); 36 } 37 } 38
Download modules/cms/update/version/DBVersion000018.class.php
History Sun, 7 Mar 2021 00:10:20 +0100 Jan Dankert Refactoring: Hopefully more performance while accessing the database resultsets. Fri, 25 Sep 2020 01:00:58 +0200 Jan Dankert Refactoring: More OO in the database updater :) Sun, 23 Feb 2020 00:30:10 +0100 Jan Dankert Refactoring: Namespacing for module 'database-update', now called 'cms\update'.