-
Notifications
You must be signed in to change notification settings - Fork 611
/
CreateDbCacheTable.php
52 lines (45 loc) · 1.04 KB
/
CreateDbCacheTable.php
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
* @link https://craftcms.com/
* @copyright Copyright (c) Pixel & Tonic, Inc.
* @license https://craftcms.github.io/license/
*/
namespace craft\migrations;
use craft\db\Migration;
use craft\db\Table;
/**
* CreateDbCacheTable Migration
*
* @author Pixel & Tonic, Inc. <support@pixelandtonic.com>
* @since 3.4.14
*/
class CreateDbCacheTable extends Migration
{
/**
* @inheritdoc
*/
public function safeUp(): bool
{
if ($this->db->getIsMysql()) {
$dataType = 'longblob';
} else {
$dataType = $this->binary();
}
$this->createTable(Table::CACHE, [
'id' => $this->string(128)->notNull(),
'expire' => $this->integer(11),
'data' => $dataType,
'PRIMARY KEY([[id]])',
]);
$this->createIndex(null, Table::CACHE, ['expire']);
return true;
}
/**
* @inheritdoc
*/
public function safeDown(): bool
{
$this->dropTableIfExists(Table::CACHE);
return true;
}
}