laravel-typescript icon indicating copy to clipboard operation
laravel-typescript copied to clipboard

Enum support

Open usernotnull opened this issue 4 years ago • 3 comments
trafficstars

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.

usernotnull avatar Aug 12 '21 18:08 usernotnull

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

lepikhinb avatar Aug 12 '21 18:08 lepikhinb

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

        In some of your provider

CaReS0107 avatar Jan 28 '23 16:01 CaReS0107

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

rkrater avatar Nov 30 '23 17:11 rkrater