Elgg  Version master
20170728074757_create_geo_cache_table.php
Go to the documentation of this file.
1 <?php
2 
4 
5 class CreateGeoCacheTable extends AbstractMigration {
16  public function change() {
17 
18  if ($this->hasTable("geocode_cache")) {
19  return;
20  }
21 
22  $table = $this->table("geocode_cache", [
23  'engine' => "MEMORY",
24  'encoding' => "utf8mb4",
25  'collation' => "utf8mb4_general_ci",
26  ]);
27 
28  $table->addColumn('location', 'string', [
29  'null' => true,
30  'limit' => 128,
31  ]);
32 
33  $table->addColumn('lat', 'string', [
34  'null' => true,
35  'limit' => 20,
36  ]);
37 
38  $table->addColumn('long', 'string', [
39  'null' => true,
40  'limit' => 20,
41  ]);
42 
43  $table->addIndex(['location'], [
44  'name' => "location",
45  'unique' => true
46  ]);
47 
48  $table->save();
49 
50  }
51 }
$table
Definition: user.php:37
change()
CREATE TABLE prefix_geocode_cache ( id int(11) NOT NULL AUTO_INCREMENT, location varchar(128) DEFAULT...