migrations-generator icon indicating copy to clipboard operation
migrations-generator copied to clipboard

Support for Postgresql hstore.

Open pc-magas opened this issue 6 years ago • 1 comments

In my database I utilise the hstore extention. In that database I need to create migration scripts.

But when I generate the migration script via the command:

php artisan migrate:generate

I get the following error:

   Doctrine\DBAL\DBALException  : Unknown database type hstore requested, Doctrine\DBAL\Platforms\PostgreSQL94Platform may not support it.

  at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php:434
    430| 
    431|         $dbType = strtolower($dbType);
    432| 
    433|         if (! isset($this->doctrineTypeMapping[$dbType])) {
  > 434|             throw new DBALException('Unknown database type ' . $dbType . ' requested, ' . static::class . ' may not support it.');
    435|         }
    436| 
    437|         return $this->doctrineTypeMapping[$dbType];
    438|     }

  Exception trace:

  1   Doctrine\DBAL\Platforms\AbstractPlatform::getDoctrineTypeMapping("hstore")
      /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php:363

  2   Doctrine\DBAL\Schema\PostgreSqlSchemaManager::_getPortableTableColumnDefinition()
      /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php:804

On the other hand there are plugins to handle the hstore:

  • https://github.com/emiliopedrollo/laravel-postgres-extended-schema
  • https://github.com/spira/Database

Also there's support for hstore for doctrine as well: https://github.com/opsway/doctrine-dbal-postgresql

Therefore is there a way to allow the generator to let it utilize the 3rd party plugins for hstore or natively let it handle?

IMHO I think is good idea for somehow this plugin to load 3rd party plugins in order to be able to handle custom data types or even custom plugins for various databases.

pc-magas avatar Jul 03 '19 14:07 pc-magas

Did you manage to solve this? I have a similar issue.

rishpandey avatar Dec 08 '20 12:12 rishpandey