일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
- 알고리즘
- 스무고개 Metric
- 백준 2193
- 2003 error
- but how?
- 경제 요약
- git-lfs
- git password
- 웹 독학
- C++
- 프로그래머스
- 미국 이란 전쟁
- Convolutional Neural Networks
- 뤼이드
- cs231
- 프로그래머스 여행경로
- 110 옮기기
- 장영준
- flask
- 리멤버나우
- 이베이 매각
- 오픈소스
- 2003 에러
- flaks
- pytorch-tutorial
- multi-task learning
- 코딩테스트
- aws rds
- 딥러닝
- 리멤버나우 요약
- Today
- Total
Nam's
Flask Study 02 - DB Migration 본문
참고자료:
Alembric: alembic.sqlalchemy.org/en/latest/, bitbucket.org/zzzeek/alembic/src/master/
Flask-Migrate: flask-migrate.readthedocs.io/
DB Migration이란?
[공부하고 더 채우기]
사용법 - wikidocs.net/81059
flask db init
flask db stamp head
# To set the revision in the database to the head, without performing any migrations. You can change head to the required change you want.
flask db migrate
# To detect automatically all the changes.
flask db upgrade
# To apply all the changes.
2021.02.07 내용 추가
flask db migrate 시 자꾸
INFO [alembic.runtime.migration] Context impl MySQLImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
이 두줄만 뜨고 change를 detect하지 못하는 문제가 발생했다.
원인은 개발 중 프로젝트에 문제가 생겨 git repository에서 새로 clone 받는 과정에서 alembric_version table 이 꼬인 것 같다.
2021.03.01 내용 추가
flask db upgrade 가 끝나지 않고 그대로 멈춰서 ctrl+z 로 나온 후 발생한 문제.
workbench로 user table을 아무리 수정하려고 해도, 하다 하다 drop을 하려고 해도 말을 안들었다.
Error 2013: connection lost만 뜨는데, 이게 아무리 봐도 연결 시간 문제는 아니었다.
우연히 찾게된 원인은 flask db upgrade가 계속 실행중이었던 것이다.
ps 로 pid를 확인한 후 kill 해주면 다시 동작한다.
'개발 > Back-end' 카테고리의 다른 글
Flask Study 04 - SQLAlchemy filter, filter_by (or, !=, like) (0) | 2021.02.17 |
---|---|
Flask Study 03 - Marshmallow (0) | 2021.01.26 |
Flask Study 01 - host 설정 (0) | 2021.01.25 |
Flask 디버깅 03 - Load_dotenv로 .env 가져오기 (0) | 2021.01.23 |
Flask 디버깅 02 - Circular Import (0) | 2021.01.23 |