Elgg  Version master
20170728074828_create_groups_entity_table.php
Go to the documentation of this file.
1 <?php
2 
5 
6 class CreateGroupsEntityTable extends AbstractMigration {
17  public function change() {
18 
19  if ($this->hasTable("groups_entity")) {
20  return;
21  }
22 
23  $table = $this->table("groups_entity", [
24  'id' => false,
25  'primary_key' => ["guid"],
26  'engine' => "InnoDB",
27  'encoding' => "utf8mb4",
28  'collation' => "utf8mb4_general_ci",
29  ]);
30 
31  $table->addColumn('guid', 'integer', [
32  'null' => false,
33  'limit' => MysqlAdapter::INT_BIG,
34  'precision' => 20,
35  'signed' => false,
36  ]);
37 
38  $table->addColumn('name', 'text', [
39  'null' => false,
40  ]);
41 
42  $table->addColumn('description', 'text', [
43  'null' => false,
44  'limit' => MysqlAdapter::TEXT_LONG,
45  ]);
46 
47  $table->addIndex(['name'], [
48  'name' => "name",
49  'unique' => false,
50  'limit' => 50,
51  ]);
52 
53  $table->addIndex(['description'], [
54  'name' => "description",
55  'unique' => false,
56  'limit' => 50
57  ]);
58 
59  $table->save();
60 
61  }
62 }
$table
Definition: user.php:37
change()
CREATE TABLE prefix_groups_entity ( guid bigint(20) unsigned NOT NULL, name text NOT NULL...