IT/PHP
[Laravel] php artisan migrate 오류 Unknown database type enum requested, Doctrine\DBAL\Platforms\MariaDb1027Platform may not support it
월공
2022. 5. 23. 11:35
728x90
300x250
환경 : vagrant, Laravel 5.3.31
문제 : 컬럼 데이터 길이 수정건이 있어서 마이그레잇 실행시키던 도중 계속 아래와같은 에러 발생
[Doctrine\DBAL\Exception]
Unknown database type enum requested, Doctrine\DBAL\Platforms\MariaDb1027Platform may not support it.
해결방법 :
// up() 부분의 상단에 아래 한줄 추가
DB::connection()->getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
추가 하고나니 다시 마이그레잇 정상작동 확인
// 컬럼 수정 마이그레이션 파일 생성
php artisan make:migration modify_column_to_[테이블명]_table --table=[테이블명]
migration 파일 전체소스
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ModifyColumnToTblGoodsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('tblGoods', function (Blueprint $table) {
DB::connection()->getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
$table->string('myColumn', 50)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('tblGoods', function (Blueprint $table) {
//
});
}
}
참조글
https://lifesaver.codes/answer/unknown-database-type-enum-mysql57platform-may-not-support-it-3161
728x90
300x250