laravel migration 中修改含有枚举类型字段的数据表
public function up()
{
// 加上这一句就可以啦
Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
Schema::table('performance', function (Blueprint $table) {
$table->string('assessment_for')->change();
});
Laravel Migration - Update Enum Options
即laravel修改枚举值的时候【增加或者减少相应的枚举值类型】
利用DB:statement()
public function up()
{
Schema::table('customer', function (Blueprint $table) {
//
DB::statement("ALTER TABLE customer CHANGE COLUMN customer_type customer_type ENUM('school','hotel','flat','factory','other') NOT NULL DEFAULT 'school' comment '客户类型' ");
});
}