Elgg  Version master
20210412110921_create_delayed_email_queue_table.php
Go to the documentation of this file.
1 <?php
2 
5 
6 class CreateDelayedEmailQueueTable extends AbstractMigration {
7 
18  public function change() {
19  if ($this->hasTable('delayed_email_queue')) {
20  return;
21  }
22 
23  // table
24  $table = $this->table('delayed_email_queue', [
25  'engine' => 'InnoDB',
26  'encoding' => 'utf8mb4',
27  'collation' => 'utf8mb4_general_ci',
28  'signed' => false,
29  ]);
30 
31  // add columns
32  $table->addColumn('recipient_guid', MysqlAdapter::PHINX_TYPE_BIG_INTEGER, [
33  'null' => false,
34  'limit' => MysqlAdapter::INT_BIG,
35  'precision' => 20,
36  'signed' => false,
37  ]);
38 
39  $table->addColumn('delivery_interval', MysqlAdapter::PHINX_TYPE_STRING, [
40  'null' => false,
41  'limit' => MysqlAdapter::INT_TINY,
42  ]);
43 
44  $table->addColumn('data', MysqlAdapter::PHINX_TYPE_BLOB, [
45  'null' => false,
46  'limit' => MysqlAdapter::BLOB_MEDIUM,
47  ]);
48 
49  $table->addColumn('timestamp', MysqlAdapter::PHINX_TYPE_INTEGER, [
50  'null' => false,
51  'limit' => MysqlAdapter::INT_REGULAR,
52  'precision' => 11,
53  ]);
54 
55  // add indexes
56  $table->addIndex(['recipient_guid'], [
57  'name' => 'recipient_guid',
58  'unique' => false,
59  ]);
60  $table->addIndex(['delivery_interval'], [
61  'name' => 'delivery_interval',
62  'unique' => false,
63  ]);
64  $table->addIndex(['recipient_guid', 'delivery_interval'], [
65  'name' => 'recipient_interval',
66  'unique' => false,
67  ]);
68 
69  // create
70  $table->save();
71  }
72 }
change()
CREATE TABLE prefix_delayed_email_queue ( id int(11) unsigned NOT NULL AUTO_INCREMENT, recipient_guid bigint(20) unsigned NOT NULL, delivery_interval varchar(255) NOT NULL, data mediumblob NOT NULL, timestamp int(11) NOT NULL, PRIMARY KEY (id), ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;.
$table
Definition: user.php:37