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