-
-
Notifications
You must be signed in to change notification settings - Fork 301
Description
Hi, I'm trying to make a migration on my cockroachdb DB + sqlmodel.
when I first init alembic and create DB everything works, if I scan again (alembic revision --autogenerate) for possible changes, alembic prints "Detected changed index 'ix_file_bucket' on 'file': expression ('INDEX', 'bucket nulls first') to ('INDEX', 'bucket')" (I didn't change anything in code and database)
and alembic creates the following migrations:
op.drop_index(op.f('ix_file_bucket'), table_name='file')
op.create_index('ix_file_bucket', 'file', [sa.text('bucket NULLS FIRST')], unique=False, postgresql_using='prefix')
the next time the alembic is triggered, it fails.
with the message:
sqlalchemy.exc.DBAPIError: (sqlalchemy.dialects.postgresql.asyncpg.Error) <class 'asyncpg.exceptions.ObjectNotInPrerequisiteStateError'>: index "ix_file_bucket" is cancelled, try again later
is there any way to solve this? currently I have to manually delete bad migrations line every time.
Versions.
- OS: Docker
- Python: docker.io/python:3.12-alpine
- Alembic: 1.12.1
- SQLAlchemy: 1.4.41 + sqlmodel==0.0.11
- Database: cockroachdb v23.1.11
- DBAPI: sqlalchemy-cockroachdb==2.0.1