Merge branch 'release-2.140.115'
[feisty_meow.git] / production / example_apps / zippy_maps / config / Migrations / 20170712152942_DropLatlongFromLocationsTable.php
diff --git a/production/example_apps/zippy_maps/config/Migrations/20170712152942_DropLatlongFromLocationsTable.php b/production/example_apps/zippy_maps/config/Migrations/20170712152942_DropLatlongFromLocationsTable.php
new file mode 100644 (file)
index 0000000..1939f5f
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+use Migrations\AbstractMigration;
+class DropLatlongFromLocationsTable extends AbstractMigration {
+       
+       /**
+        * going forward, we have two columns (lat and lng) for the geo coords.  so we're getting rid
+        * of the latlong combined column.
+        */
+       public function up() {
+               $this->table ( 'locations' )->removeColumn ( 'latlong' )->update ();
+       }
+       /**
+        * but for preservation of former realities, we re-add the latlong column if we're going backwards.
+        * this supports our code for transmogrifying the coordinates between two column format and one
+        * column fomat.
+        */
+       public function down() {
+               $this->table ( 'locations' )->addColumn ( 'latlong', 'string', [ 
+                               'length' => 255,
+                               'null' => true 
+               ] )->update ();
+       }
+}