openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

DBVersion000022.class.php (996B)


      1 <?php
      2 
      3 namespace cms\update\version;
      4 
      5 use database\DbVersion;
      6 use database\Column;
      7 
      8 /**
      9  * External user ids from sso services like openid.
     10  * The user name alone is not unique any more
     11  *
     12  * @author Jan Dankert
     13  *
     14  */
     15 class DBVersion000022 extends DbVersion
     16 {
     17     /**
     18      *
     19      */
     20     public function update()
     21     {
     22         $table = $this->table('user');
     23 
     24 		$table->column('issuer'     )->type(Column::TYPE_VARCHAR )->charset('ascii')->size(50)->nullable()->add();
     25         $table->column('auth_type'  )->type(Column::TYPE_INT )->size(2)->defaultValue(1 )->add();
     26 		$table->column('ldap_dn'    )->drop();
     27 
     28 		// OpenId subject identifiers may have up to 255 chars, so we have to increase the length
     29         $table->column('name'       )->type(Column::TYPE_VARCHAR )->charset('ascii')->size(255)->modify();
     30 		$table->column('fullname'   )->type(Column::TYPE_VARCHAR )->size(255)->modify();
     31 
     32 		$table->dropUniqueIndex( ['name'] );
     33 		$table->addUniqueIndex ( ['name','auth_type','issuer'] );
     34 	}
     35 }
     36