lepikhinb / laravel-typescript

MIT License
387 stars 46 forks source link

Enum support #3

Open usernotnull opened 3 years ago

usernotnull commented 3 years ago

Some of my models have enum fields.

This causes typescript:generate to throw:

Unknown database type enum requested, Doctrine\DBAL\Platforms\MariaDb1027Platform may not support it.

  at ___\vendor\doctrine\dbal\src\Platforms\AbstractPlatform.php:398

I'm not sure why it's not supported, as enums are working fine on my project/setup.

lepikhinb commented 3 years ago

Enums aren't supported by DBAL, which is used for the columns analysis. I'm going to make a driver for it.

CaReS0107 commented 1 year ago

Schema::getConnection() ->getDoctrineSchemaManager() ->getDatabasePlatform() ->registerDoctrineTypeMapping('enum', 'string');

        In some of your provider
rkrater commented 10 months ago

In some of your provider

Put this in the Model's class or in boot of AppServiceProvider?

Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');

Also, getting Method 'getDatabasePlatform' is deprecated