How to change enum type column in laravel migration?

前端 未结 7 2137
挽巷
挽巷 2021-02-05 04:36

I am using Laravel 5.1 and I have a table called packages with this structure:

id              int(11)
weight          decimal(10,2)           
weight_unit     e         


        
7条回答
  •  野的像风
    2021-02-05 05:13

    You can add custom constructor to migration and explain to Doctrine that enum should be treated like string.

    public function __construct(\Doctrine\DBAL\Migrations\Version $version)
    {
        parent::__construct($version);
    
        $this->platform->registerDoctrineTypeMapping('enum', 'string');
    }
    

提交回复
热议问题