Elgg  Version master
20170728075027_create_private_settings_table.php
Go to the documentation of this file.
1 <?php
2 
5 
6 class CreatePrivateSettingsTable extends AbstractMigration {
19  public function change() {
20 
21  if ($this->hasTable("private_settings")) {
22  return;
23  }
24 
25  $table = $this->table("private_settings", [
26  'engine' => "InnoDB",
27  'encoding' => "utf8mb4",
28  'collation' => "utf8mb4_general_ci",
29  ]);
30 
31  $table->addColumn('entity_guid', 'integer', [
32  'null' => false,
33  'limit' => MysqlAdapter::INT_BIG,
34  'precision' => 20,
35  'signed' => false,
36  ]);
37 
38  $table->addColumn('name', 'string', [
39  'null' => false,
40  'limit' => 128,
41  ]);
42 
43  $table->addColumn('value', 'text', [
44  'null' => false,
45  'limit' => MysqlAdapter::TEXT_LONG,
46  ]);
47 
48  $table->addIndex([
49  'entity_guid',
50  'name'
51  ], [
52  'name' => "entity_guid",
53  'unique' => true,
54  ]);
55 
56  $table->addIndex(['name'], [
57  'name' => "name",
58  'unique' => false,
59  ]);
60 
61  $table->addIndex(['value'], [
62  'name' => "value",
63  'unique' => false,
64  'limit' => 50,
65  ]);
66 
67  $table->save();
68  }
69 }
$table
Definition: user.php:37
change()
CREATE TABLE prefix_private_settings ( id int(11) NOT NULL AUTO_INCREMENT, entity_guid bigint(20) uns...