I want to remove constraints from my table. My query is:
ALTER TABLE `tbl_magazine_issue`
DROP CONSTRAINT `FK_tbl_magazine_issue_mst_users`
<
Some ORM's or frameworks use a different naming convention for foreign keys than the default FK_[parent table]_[referenced table]_[referencing field]
, because they can be altered.
Laravel for example uses [parent table]_[referencing field]_foreign
as naming convention. You can show the names of the foreign keys by using this query, as shown here:
SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE REFERENCED_TABLE_SCHEMA = '' AND REFERENCED_TABLE_NAME = '';
Then remove the foreign key by running the before mentioned DROP FOREIGN KEY query and its proper name.
- 热议问题