在heroku

时间:2016-02-09 12:56:05

标签: python heroku alembic

我正在努力修改cookiecutter Flask应用。

本地我在开发过程中删除了几次迁移文件夹和sqllite数据库。我已经将我的chnages推到了heroku。

尝试迁移heroku postgresdb时:

$ heroku run python manage.py db upgrade
.....
alembic.util.CommandError: Multiple head revisions are present for given argument 'head'; please specify a specific target revision, '<branchname>@head' to narrow to a specific head, or 'heads' for all heads

关注http://alembic.readthedocs.org/en/latest/branches.html我试过了:

$ heroku run python manage.py db merge heads
Running python manage.py db merge heads on myapp... up, run.9635
  Generating /app/migrations/versions/35888775_.py ... done

然后我尝试了:

$ heroku run python manage.py db upgrade
Running python manage.py db upgrade on myapp... up, run.7021
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
    ....
    "%s@head" % branch_label if branch_label else "head")
alembic.util.CommandError: Multiple head revisions are present for given argument 'head'; please specify a specific target revision, '<branchname>@head' to narrow to a specific head
, or 'heads' for all heads

如何将修订头合并为一个,并确保与我的开发版本同步?

1 个答案:

答案 0 :(得分:0)

我联系了heroku支持并得到了以下回复(对我有用):

您好,

要从本地存储库中删除文件夹,需要运行git rm。你可以试试下面的东西吗?

$ git rm -r migrations
$ git commit -m 'Remove migrations directory'
$ git push heroku master

要查看实际文件与本地存储库中注册的内容之间的差异,git status可能很有用。

如果您有任何困难,请告诉我们。