Flask-migrate: how to db merge one new migrate file??

Created on 9 Apr 2020  Â·  1Comment  Â·  Source: miguelgrinberg/Flask-Migrate

Current result db history
38576d4a8c56 -> 8f82a446abdf (head), add filed customer
90d2b5f66c28 -> 38576d4a8c56, 4.8 add filed
-> 90d2b5f66c28, v1.0

I want to merge two 90d2b5f66c28 and 38576d4a8c56 migrate files into one new migrate file,

Final desired result
db history
"new "-> 8f82a446abdf (head), add filed customer
-> 90d2b5f66c28, v1.0

I do
db merge 38576d4a8c56 90d2b5f66c28

get a error
Error: Revision 38576d4a8c56 is not a head revision; please specify --splice to create a new branch from this revision

How to merge into one new migrate file?

question

Most helpful comment

Merge is not to consolidate migrations, it is used for a completely different purpose.

There is no support in Alembic or Flask-Migrate to combine existing migrations. You will need to edit your migration scripts by hand. If you carefully copy the contents of the older migration into the newer migration script and then delete the older migration script it should get you what you want.

>All comments

Merge is not to consolidate migrations, it is used for a completely different purpose.

There is no support in Alembic or Flask-Migrate to combine existing migrations. You will need to edit your migration scripts by hand. If you carefully copy the contents of the older migration into the newer migration script and then delete the older migration script it should get you what you want.

Was this page helpful?
0 / 5 - 0 ratings