mardi 3 novembre 2015

How to change enum type column in laravel migration?

I am using Laravel 5.1 I have a table called packages as the structure,

id              int(11)
weight          decimal(10,2)           
weight_unit     enum('Kg.', 'Gm.')

I would like to change the weight_unit to,

weight_unit enum('Grams','Kgs.','Pounds')

For this I create a migration file,

public function up()
{
    Schema::table('packages', function ($table) {
        $table->enum('weight_unit', array('Grams','Kgs.','Pounds'))->nullable()->change();
    });
}

But when I run migration gives an error,

Unknown database type enum requested, Doctrine\DBAL\Platforms\MySqlPlatform  

may not support it.

How can I alter this table ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire