git - how to chain two migrations through migraions ids and to create a linear chain to collapse the branches? -
i deployed flask app heroku. when run command error.
heroku run python manage.py deploy
this error message:
raise util.commanderror('only single head supported. ' alembic.util.commanderror: single head supported. script directory has multiple heads (due branching), must resolved manually editing revision files form linear sequence. run alembic branches see divergence(s).
ao googled it,then got this:
this happens when go revision not last , create new migration. have 2 branches, alembic cannot handle.look @ how migration files chained through migration ids, need create linear chain collapse branches.
but i'm still confused how solve that. think problem caused git branches. (i tried merge 2 branches, didn't work?)
looks quoted comment made long ago in 1 of blog articles. since then, have written article dedicated topic of resolving migration conflicts: http://blog.miguelgrinberg.com/post/resolving-database-schema-conflicts
this explained in article, basically, have edit migration scripts form linear sequence. each script has pointer predecessor, conflict occurs when have 2 or more scripts have same predecessor. have migrations b , c, both predecessor. this:
--> b __/ \ --> c
assuming @ migration b, c migration cannot applied because on different branch. 1 possible way address conflict change predecessor in c script b. migration chain becomes:
a --> b --> c
so alembic can move b c.
another option, supported in recent versions of alembic use merge
command create merge migration. cover briefly in article well, isn't preferred solution.
Comments
Post a Comment