codestates / codestates/ThereWeather
[๐พ Error Handling] ERROR 1828 (HY000): Cannot drop column 'post_id': needed in a foreign key constraint 'custom_fkey_name'
- Dominant language
- JavaScript
- Stars
- 0
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
## ์ด๋ค ์๋ฌ์ธ๊ฐ์?
- ๋ฐ์ดํฐ๋ฒ ์ด์ค์์ foreign key ์ง์ ํ์ ๋ค์ ์ญ์ ํ๋ ค๊ณ , `alter table posts drop post_id;` ์ด ๋ช
๋ น์ด๋ฅผ ์น๊ฒ ๋๋ฉด ๋ฐ๋ก ์นผ๋ผ ์ญ์ ๊ฐ ์๋ ๋ ๋์ค๋ ์๋ฌ๋ฉ์ธ์ง
## ์๋ฌ ๋ฉ์์ง
```jsx
ERROR 1828 (HY000): Cannot drop column 'post_id': needed in a foreign key constraint 'custom_fkey_name'
```
## ์๋ฌ ํธ๋ค๋ง ๋ฐฉ๋ฒ
```jsx
1. show create table posts[์กฐํํ ํ
์ด๋ธ๋ช
];
2. alter table posts[์กฐํํ ํ
์ด๋ธ๋ช
] drop foreign key custom_fkey_name[์ญ์ ํ foreign key ์ด๋ฆ];
3. alter table posts[์กฐํํ ํ
์ด๋ธ๋ช
] drop post_id[์ญ์ ํ ์นผ๋ผ๋ช
];
```
## ์๋ฌ ํธ๋ค๋ง์ ์ํด ์ฐธ๊ณ ํ ๋ ํผ๋ฐ์ค ๋งํฌ
[์์1](https://gcpark.tistory.com/23)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.