openrat-cms

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

DBVersion000021.class.php (1149B)


      1 <?php
      2 
      3 namespace cms\update\version;
      4 
      5 use database\DbVersion;
      6 use database\Column;
      7 
      8 /**
      9  * Authentication tokens.
     10  *
     11  * @author dankert
     12  *
     13  */
     14 class DBVersion000021 extends DbVersion
     15 {
     16     /**
     17      *
     18      */
     19     public function update()
     20     {
     21         $table = $this->table('auth')->add();
     22 
     23         $table->column('selector'     )->type(Column::TYPE_VARCHAR )->size(150 )->add();
     24         $table->column('userid'       )->type(Column::TYPE_INT  )->size(0   )->add();
     25         $table->column('token'        )->type(Column::TYPE_VARCHAR )->size(150 )->add();
     26         $table->column('token_algo'   )->type(Column::TYPE_INT  )->size(0   )->defaultValue(0   )->add();
     27         $table->column('expires'      )->type(Column::TYPE_INT  )->size(0   )->add();
     28         $table->column('create_date'  )->type(Column::TYPE_INT  )->size(0   )->add();
     29         $table->column('platform'     )->type(Column::TYPE_VARCHAR)->size(255 )->add();
     30         $table->column('name'         )->type(Column::TYPE_VARCHAR)->size(255 )->add();
     31 
     32 
     33         $table->addPrimaryKey ();
     34 
     35         $table->addConstraint ('userid', 'user');
     36 
     37         $table->addUniqueIndex('selector');
     38     }
     39 }
     40