Xethron / migrations-generator

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

Support for Postgresql hstore. #189

Open pc-magas opened 5 years ago

pc-magas commented 5 years ago

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:

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.

rishpandey commented 3 years ago

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