【问题标题】:Merging different alembic revision heads fails on heroku在heroku上合并不同的alembic修订头失败
【发布时间】:2016-02-09 12:56:05
【问题描述】:

我正在修改一个cookiecutter Flask 应用程序。

在本地,我在开发过程中多次删除了迁移文件夹和 sqllite db。我已将我的更改推送到 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

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

【问题讨论】:

    标签: python heroku alembic


    【解决方案1】:

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

    嗨,

    要从本地存储库中删除文件夹,需要运行 git rm。你能试试下面的方法吗?

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-16
      • 2011-08-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-02
      • 2017-09-09
      相关资源
      最近更新 更多