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