마리아 db drop constraint
MariaDB(MySQL) 제약조건(Constraints) 확인(조회)
|
SELECT * |
information_schema.table_constraints에서 모든 제약조건(Constraints)를 확인할 수 있다.
추가로 아래와 같이 입력 시 해당 테이블에 제약조건을 확인할 수 있다.
|
SELECT * WHERE table_name='테이블명'; |
결과의 constraint_type에 foreign key 이라고 되어 있는게 있다.
foreign key 는 권고 사항이 아니다. 아시다 시피 피곤한다. 그래서 삭제하려고 했는데...
이런식으로
ALTER TABLE `tbl_magazine_issue` DROP CONSTRAINT `FK_tbl_magazine_issue_mst_users`
하면 될지 알았는데..
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'constraint FK_tbl_magazine_issue_mst_users' at line 1
뜨악~~~ 에러가 뜬다.
mysql, 마리아 db는 foreign key constraint를 삭제할때 특이한 문법을 가지고 있다.
ALTER TABLE tbl_magazine_issue DROP FOREIGN KEY FK_tbl_magazine_issue_mst_users
이러면 삭제가 된다.