DBVersion000005.class.php (669B)
1 <?php 2 use database\DbVersion; 3 4 /** 5 * Security enhancements. 6 * 7 * @author dankert 8 * 9 */ 10 class DBVersion000005 extends DbVersion 11 { 12 public function update() 13 { 14 $not_nullable = false; 15 $nullable = true; 16 17 // longer Passwords! 50 is not enough. 18 $this->addColumn('user','password_hash',OR_DB_COLUMN_TYPE_VARCHAR,255,null,$not_nullable); 19 20 $db = $this->getDb(); 21 $table = $this->getTableName('user'); 22 $updateStmt = $db->sql('UPDATE '.$table. 23 ' SET password_hash=password' 24 ); 25 $updateStmt->query(); 26 27 $this->dropColumn('user','password'); 28 29 $this->addColumn('user','password_salt',OR_DB_COLUMN_TYPE_VARCHAR,255,null,$not_nullable); 30 } 31 } 32 33 ?>