Elgg  Version master
20170728075056_create_queue_table.php
Go to the documentation of this file.
1 <?php
2 
5 
6 class CreateQueueTable extends AbstractMigration {
19  public function change() {
20 
21  if ($this->hasTable("queue")) {
22  return;
23  }
24 
25  $table = $this->table("queue", [
26  'engine' => "InnoDB",
27  'encoding' => "utf8mb4",
28  'collation' => "utf8mb4_general_ci",
29  ]);
30 
31  $table->addColumn('name', 'string', [
32  'null' => false,
33  'limit' => MysqlAdapter::TEXT_SMALL,
34  'encoding' => "utf8",
35  'collation' => "utf8_general_ci",
36  ]);
37 
38  $table->addColumn('data', 'blob', [
39  'null' => false,
40  'limit' => MysqlAdapter::BLOB_MEDIUM,
41  ]);
42 
43  $table->addColumn('timestamp', 'integer', [
44  'null' => false,
45  'limit' => MysqlAdapter::INT_REGULAR,
46  'precision' => 11,
47  ]);
48 
49  $table->addColumn('worker', 'string', [
50  'null' => true,
51  'limit' => 32,
52  ]);
53 
54  $table->addIndex(['name'], [
55  'name' => "name",
56  'unique' => false,
57  ]);
58 
59  $table->addIndex([
60  'timestamp',
61  'worker'
62  ], [
63  'name' => "retrieve",
64  'unique' => false
65  ]);
66 
67  $table->save();
68  }
69 }
$table
Definition: user.php:37
change()
CREATE TABLE prefix_queue ( id int(11) NOT NULL AUTO_INCREMENT, name varchar(255) CHARACTER SET utf8 ...