aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/1.224_db_cache_table.php
blob: 9abe7e3dc6fe525afa7909d4f14ce84bab95155c (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
<?php
class DbCacheTable extends Migration
{
    public function description()
    {
        return 'add database table for simple cache';
    }

    public function up()
    {
        $db = DBManager::get();

        $db->exec('CREATE TABLE cache (
                   cache_key VARCHAR(255) COLLATE latin1_bin NOT NULL,
                   content MEDIUMBLOB NOT NULL,
                   expires INT(11) UNSIGNED NOT NULL,
                   PRIMARY KEY (cache_key)
                   ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC');

        \Studip\Cache\Factory::getCache()->flush();
    }

    public function down()
    {
        $db = DBManager::get();

        $db->exec('DROP TABLE cache');
    }
}