Elgg  Version master
20170728074857_create_hmac_cache_table.php
Go to the documentation of this file.
1 <?php
2 
5 
6 class CreateHmacCacheTable extends AbstractMigration {
15  public function change() {
16 
17  if ($this->hasTable("hmac_cache")) {
18  return;
19  }
20 
21  $table = $this->table("hmac_cache", [
22  'id' => false,
23  'primary_key' => ["hmac"],
24  'engine' => "MEMORY",
25  'encoding' => "utf8mb4",
26  'collation' => "utf8mb4_general_ci",
27  ]);
28 
29  $table->addColumn('hmac', 'string', [
30  'null' => false,
31  'limit' => MysqlAdapter::TEXT_SMALL,
32  'encoding' => "utf8",
33  'collation' => "utf8_general_ci",
34  ]);
35 
36  $table->addColumn('ts', 'integer', [
37  'null' => false,
38  'limit' => MysqlAdapter::INT_REGULAR,
39  'precision' => 11,
40  ]);
41 
42  $table->addIndex(['ts'], [
43  'name' => "ts",
44  'unique' => false,
45  ]);
46 
47  $table->save();
48 
49  }
50 }
$table
Definition: user.php:37
change()
CREATE TABLE prefix_hmac_cache ( hmac varchar(255) CHARACTER SET utf8 NOT NULL, ts int(11) NOT NULL...