🌳 에러 코드
Cannot drop column : needed in a foreign key constraint
🌳 해결 방법
🌾 원인 : foreign key로 등록되어 있어서 해당 컬럼 삭제 불가.
🌾 해결 방법 :
Warning
With foreign_key_checks=0, dropping an index required by a foreign key constraint places the table in an inconsistent state and causes the foreign key check that occurs at table load to fail. To avoid this problem, remove the foreign key constraint before dropping the index (Bug #70260).
you should drop FOREIGN KEY before DROP the COLUMN.
ALTER TABLE `user` DROP FOREIGN KEY `FK_G38T6P7EKUXYWH1`;
ALTER TABLE `user` DROP COLUMN `region_id`;
컬럼 삭제 전, foreign key를 먼저 삭제 후, 컬럼 삭제.
After