반응형

포린키 생성 실패


메시지 내용


2017-10-20 14:53:53 c8ca8b70 Error in foreign key constraint of table CYBER_EDU_MUSEUM_UPDATE/#sql-532_1dca:

 FOREIGN KEY (`DSPY_SIL_CODE`, `PART_NO`) REFERENCES `JNT_DSPY_PART` (`DSPY_SIL_CODE`, `PART_NO`):

Cannot find an index in the referenced table where the

referenced columns appear as the first columns, or column types

in the table and the referenced table do not match for constraint.

Note that the internal storage type of ENUM and SET changed in

tables created with >= InnoDB-4.1.12, and such columns in old tables

cannot be referenced by such columns in new tables.

See http://dev.mysql.com/doc/refman/5.6/en/innodb-foreign-key-constraints.html

for correct foreign key definition.



내가 찾아봐서 해결한 방법은

컬럼에 utf8_unicode_ci , utf8_general_ci 두개를 참조 컬럼과 외래키 컬럼의 콜렉션타입을 다르게 해서 였다.

각각의 테이블 키 컬럼의 타입과 참조 컬럼의 타입을 같게 아무거나 맞춰주니 포린키 생성 성공했다.


utf8_general_ci 에는 악센트 문자가 없어서 엑센트 없는문자로만 나온다네요.

utf8_general_ci로 해야 속도가 빠르다고는 한다. 


제일 중요한건 한가지 타입으로 맞춰주는거.



반응형

+ Recent posts