Questions on how to best add a complex index in the context of auto-generating migrations #1202
-
So I had a complex index that I didn't know how to model in the sqlAlchemy ORM and I am wondering how to best handle it. So in alembic i created a migration and did:
This worked fine until I auto-generated a new migration in which alembic auto-generated the migration to drop the index I created. So I guess
After doing some googling it seemed like one solution is to simply define the index in the models.
But checking the 2.0 version of the docs it seems it wants me to do something like this:
so my second question is |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
use the include_object hook: https://alembic.sqlalchemy.org/en/latest/api/runtime.html#alembic.runtime.environment.EnvironmentContext.configure.params.include_object
you could do that also
what's different, the "status" column? I would omit that since it is not in your index definition |
Beta Was this translation helpful? Give feedback.
use the include_object hook: https://alembic.sqlalchemy.org/e…