마이그레이션에 대한 지식!

팀 개발을 해 나가는 중, 마이그레이션에 관한 컨플릭트가 다발했기 때문에, 마이그레이션의 지식을 심굴하기 위해서도 기사를 썼습니다!
실행되지 않은 migration을 알고 싶습니다 ...
그럴 때 편리한 명령이 여기입니다!
bundle exec rake db:migrate:status
Rails 마이그레이션 파일은 파일을 만든 후 마이그레이션을 실행하고 처음으로 데이터베이스에 변경 사항을 반영합니다! (rake db:migrate)
개발을 진행하는 중, 마이그레이션 파일이 늘어나, 어느 파일까지가 마이그레이션을 실행하고 있는지 터미널에서 확인할 수 있습니다!
마이그레이션을 수행 한 후 수정하는 단계!
(마이그레이션을 실행 한 후 내용이 잘못되었음을 알았습니다 ...)

(어떻게 수정하면 좋을까 ...?)

(호호, 두 가지 방법을 소개하자!)

➀
· bundle exec rake db : rollback을 실행하여 한 번 마이그레이션되지 않은 상태로 되돌립니다.
· 마이그레이션 파일을 수정합니다.
· 다시 rake db : migrate를 실행하십시오!
➁
· rails g migration으로 새로운 마이그레이션 파일을 만듭니다.
・수정 위치를 올바른 내용으로 변경하기 위한 마이그레이션 파일을 작성한다.
· rake db : migrate를 실행하십시오!
(이 두 가지 방법으로 수정할 수 있습니다)

마이그레이션 파일에 의한 금지 사항!
(한 번 실행된 마이그레이션 파일은 다음 마이그레이션에 영향을 미치지 않습니다.)

(그렇다)

(그럼, 마이그레이션 후에 파일을 변경하거나 삭제해도 지금의 DB에 악영향을 미치지 않기 때문에, 변경하거나 삭제해도 되나요?)

(그것은, 대단히!)

(팀 개발에서 치명적인 문제가 발생합니다 ...)

(무슨 일입니까?)

(어플리케이션의 파일을 배포처에 push 해, 마이그레이션을 행했을 때에, 로컬 환경과 다른 DB가 완성되거나, 에러가 되어 버린다면...)

(콘플릭트 등의 원인이 될 수도 있으니, 해서는 안 된다!)

(알았어! 고마워!)

이상이 됩니다!
마지막 장은 대화 형식으로 정리해 보았습니다!
그 외, 마이그레이션에 관한 인지 등 가르쳐 주시면 다행입니다!
코멘트 기다리고 있습니다!
조용히 감사합니다

Reference
이 문제에 관하여(마이그레이션에 대한 지식!), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/wacker8818/items/47333d5ff61c8b9d324d텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)