본문 바로가기
MySql

MySQL Laravel 데이터베이스 스키마의 MediumBlob

by 베이스 공부 2020. 12. 16.
반응형

Laravel 스키마 빌더 내에서 Mediumblob 을 어떻게 만들 수 있습니까?

문서에서 다음과 같이 말합니다.

$table->binary('data'); // BLOB equivalent to the table

하지만 MediumBlob이 필요합니다. 그렇지 않으면 이미지가 64K에서 잘립니다. 우리는 MySQL을 실행하고 있습니다.

라 라벨의 스키마 빌더가 DB에 구애받지 않는다는 것을 알고 있지만 "네이티브 방식"을 피할 수있는 방법이 있으며 그렇지 않은 경우 Mediumblob 열을 어떻게 생성 할 수 있습니까?

 

해결 방법

 

할 수 없습니다.


Schema::create("<table name>", function($table) {
    // here you do all columns supported by the schema builder
});

// once the table is created use a raw query to ALTER it and add the MEDIUMBLOB
DB::statement("ALTER TABLE <table name> ADD <column name> MEDIUMBLOB");

 

참조 페이지 https://stackoverflow.com/questions/20089652

 

 

반응형

댓글