aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/1.7_table_token_class.php
blob: 7f3a715f435f8126b969fadaf62e52cbddc00b34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?
class TableTokenClass extends Migration
{
    public function description ()
    {
        return 'creates table for Token class';
    }

    public function up ()
    {
        $this->announce(" creating table...");
        
        DBManager::get()->exec("CREATE TABLE IF NOT EXISTS `user_token` (
                                        `user_id` VARCHAR( 32 ) NOT NULL ,
                                        `token` VARCHAR( 32 ) NOT NULL ,
                                        `expiration` INT NOT NULL ,
                                        PRIMARY KEY ( `user_id` , `token` , `expiration` ),
                                        INDEX index_expiration (`expiration`),
                                        INDEX index_token (`token`),
                                        INDEX index_user_id (`user_id`)
                                    ) ENGINE=MyISAM;");
        
        $this->announce("done.");
        
    }
    
    public function down ()
    {
        $this->announce(" removing table...");
        DBManager::get()->exec("DROP TABLE `user_token`");
        
        $this->announce("done.");
        
    }
}