https://github.com/grimzy/laravel-mysql-spatial
For Laravel versions prior to 5.5, you can use the Blueprint provided by this package (Grimzy\LaravelMysqlSpatial\Schema\Blueprint):
For Laravel < 5.5
I have a migration for a table as following:
use Illuminate\Support\Facades\Schema;
use Grimzy\LaravelMysqlSpatial\Schema\Blueprint; //use this as blueprint
use Illuminate\Database\Migrations\Migration;
Schema::create('properties', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->point('position');
$table->integer('radius');
$table->polygon('area_perimeter');
});
Also, I am using this library and added trait to the property model:
https://packagist.org/packages/grimzy/laravel-mysql-spatial
Before updating the position and area_perimeter to use geospatial type, the PHPUnit works with
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="MAIL_DRIVER" value="array"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
<env name="TELESCOPE_ENABLED" value="false"/>
But now it no longer works and I am getting this error:
Argument 1 passed to CreatePropertiesTable::{closure}() must be an instance of Grimzy\LaravelMysqlSpatial\Schema\Blueprint, instance of Illuminate\Database\Schema\Blueprint given
Which has something to do with sqlite does not support point and polygon column
I would like to be able to run phpunit on mysql in memory. Or how can I make this work with the said requirements?
Please or to participate in this conversation.