>> On Thu, Jun 20, 2019 at 2:37 AM Chris Withers <ch...@withers.org
>> <mailto:ch...@withers.org>> wrote:
>>
>>     Hi All,
>>
>>     I have some versions that make use of the third party package I no
>>     longer use, how do I collapse down alembic revisions that have
>>     already
>>     been executed everywhere?
>>
>>     I found
>> https://stackoverflow.com/questions/34491914/alembic-how-to-merge-all-revision-files-to-one-file
>>
>>     but that doesn't feel right...

On 20/06/2019 19:00, Mike Bayer wrote:

I think the basic idea is to create a database and codebase in the state of the target revision. Then autogenerate a migration from nothing to that revision - just like you would do when starting to use alembic from an existing schema. From there you can change the slug on it so that it works as the down_revision of later migrations and clear out the old unused migrations that you're replacing.

- Michael


I think that's what the stackoverflow answer says too.

Yep.

At the moment that might be the most expedient approach.

Okay, TBH here the case is more that I have a couple of migrations that use a package I want to remove as a dependency (sqlalchemy-searchable, which is really good, fwiw, just turns out "like" querying is actually going to work better for my needs), but I think I can just remove those bits once all the migrations are run through...

However I can see that Alembic might benefit from having a special option to autogenerate a model into Python code assuming no database to start with.    Feel free to propose though Alembic is suffering from lack of contributors right now.

Gotcha, I'll come with a PR rather just asking for something, but I'm suffering from the same problem you are ;-)

thanks as always,

Chris

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy-alembic" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy-alembic+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy-alembic/b8fe3ab2-042a-a789-07a4-f874ef8c34eb%40withers.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to