1. 將git local端的migrations資料夾刪除
rm -rf migrations
2. 重新初始化DB
python dbModel.py db init
3. 重新migrate DB
python dbModel.py db migrate
此時遭遇以下 :
此訊息代表heroku現在仍有此DB的資料,解法有兩種12:15 larrywhy$ python dbModel.py db migrate/Library/Python/2.7/site-packages/flask_sqlalchemy/__init__.py:834: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True or False to suppress this warning.'SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and 'INFO [alembic.runtime.migration] Context impl PostgresqlImpl.INFO [alembic.runtime.migration] Will assume transactional DDL.ERROR [root] Error: Can't locate revision identified by '67a89f9722d3'
方法1) 去修改python 的套件將SQLALCHEMY_TRACK_MODIFICATIONS設定成false即可
方法2) 去heroku線上刪除資料庫schema。
4) 重新upgrade DB
python dbModel.py db upgrade
5) 將scheme上傳至heroku git
git add migrations
git push heroku master
沒有留言:
張貼留言