codestates / codestates/ThereWeather
[๐พ Error Handling] ERROR 1828 (HY000): Cannot drop column 'post_id': needed in a foreign key constraint 'custom_fkey_name'
- ไธป่ฆ่จ่ช
- JavaScript
- ในใฟใผ
- 0
- ใใฉใผใฏ
- 3
- PR ใใผใธๆๆจ
- 30ๆฅไปฅๅ ใซใใผใธใใใ PR ใฏใใใพใใ
่ชฌๆ
## ์ด๋ค ์๋ฌ์ธ๊ฐ์?
- ๋ฐ์ดํฐ๋ฒ ์ด์ค์์ 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)
ใณใณใใชใใฅใผใทใงใณใฌใคใ
ใใฎใชใใธใใชใฎใณใณใใชใใฅใผใทใงใณใฌใคใใฏ็ดขๅผใใใฆใใพใใ
่ชฟๆปใฎๆนๅๆง
No file or test is named. Start by locating the repository's existing error-handling or database documentation and compare its format with this MySQL ERROR 1828 example; done means the error message and the three stated SQL handling steps are recorded consistently.
็ดขๅผใขใใซใ issue ใฎๆฌๆใใๆธใใใใฎใงใใ
่ฉไพก
- ๆ่กในใฟใใฏ
- mysql
- ้ ๅ
- databases, documentation
- issue ใฎ็จฎ้ก
- ใใญใฅใกใณใ
- ้ฃๆๅบฆ
- 2/5
- ่ฆ็ฉใใๆ้
- 1ใ3ๆ้
- ๆดป็บใ
- ๅๆป
- ๆ็ญใ
- ใใใใญๆ็ขบ
- ๅๅฟ่ ใธใฎใใใใ
- 35/100