Elgg  Version master
20170728075155_create_sites_entity_table.php
Go to the documentation of this file.
1 <?php
2 
5 
6 class CreateSitesEntityTable extends AbstractMigration {
17  public function change() {
18 
19  if ($this->hasTable("sites_entity")) {
20  return;
21  }
22 
23  $table = $this->table("sites_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  ]);
36 
37  $table->addColumn('name', 'text', [
38  'null' => false,
39  ]);
40 
41  $table->addColumn('description', 'text', [
42  'null' => false,
43  'limit' => MysqlAdapter::TEXT_LONG,
44  ]);
45 
46  $table->addColumn('url', 'string', [
47  'null' => false,
48  'limit' => MysqlAdapter::TEXT_SMALL,
49  'encoding' => "utf8",
50  'collation' => "utf8_general_ci",
51  ]);
52 
53  $table->addIndex(['url'], [
54  'name' => "url",
55  'unique' => true,
56  ]);
57 
58  $table->save();
59  }
60 }
$table
Definition: user.php:37
change()
CREATE TABLE prefix_sites_entity ( guid bigint(20) unsigned NOT NULL, name text NOT NULL...