Xethron / migrations-generator

Laravel Migrations Generator: Automatically generate your migrations from an existing database schema.
MIT License
3.32k stars 591 forks source link

Doctrine\DBAL\DBALException : Unknown database type geography requested, Doctrine\DBAL\Platforms\SQLServer2012Platform may not support it. #175

Open rthomas023 opened 5 years ago

rthomas023 commented 5 years ago

I am trying to generate migrations from an MS SQL Server 2014 database and one of my tables uses the "geography" data-type that the generator does not recognize and therefore throws the exception below.

at ../vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php:479 475| 476| $dbType = strtolower($dbType); 477| 478| if (!isset($this->doctrineTypeMapping[$dbType])) {

479| throw new \Doctrine\DBAL\DBALException("Unknown database type ".$dbType." requested, " . get_class($this) . " may not support it."); 480| } 481| 482| return $this->doctrineTypeMapping[$dbType]; 483| }

Exception trace:

1 Doctrine\DBAL\Platforms\AbstractPlatform::getDoctrineTypeMapping("geography") ../vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php:123

2 Doctrine\DBAL\Schema\SQLServerSchemaManager::_getPortableTableColumnDefinition() ../vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:831

Please use the argument -v to see more details.

vahidzoli commented 5 years ago

Hi Thomas, You must use njbarrett/laravel-postgis package to solve your issue, first of all, install this package using composer and then go to your postgresql database and add postgis extension. that's it!