Elgg  Version master
20170728072548_create_access_collections_table.php
Go to the documentation of this file.
1 <?php
2 
5 
6 class CreateAccessCollectionsTable extends AbstractMigration {
16  public function change() {
17 
18  if ($this->hasTable("access_collections")) {
19  return;
20  }
21 
22  $table = $this->table("access_collections", [
23  'engine' => "InnoDB",
24  'encoding' => "utf8mb4",
25  'collation' => "utf8mb4_general_ci",
26  ]);
27 
28  $table->addColumn('name', 'text', [
29  'null' => false,
30  ]);
31 
32  $table->addColumn('owner_guid', 'integer', [
33  'null' => false,
34  'limit' => MysqlAdapter::INT_BIG,
35  'precision' => 20,
36  'signed' => false,
37  ]);
38 
39  $table->addIndex(['owner_guid'], [
40  'name' => "owner_guid",
41  'unique' => false
42  ]);
43 
44  $table->save();
45 
46  $prefix = $this->getAdapter()->getOption('table_prefix');
47  $this->query("ALTER TABLE {$prefix}access_collections AUTO_INCREMENT=3");
48  }
49 }
$table
Definition: user.php:37
change()
CREATE TABLE prefix_access_collections ( id int(11) NOT NULL AUTO_INCREMENT, name text NOT NULL...