'Alembic migration : How to alter table to add gin index
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('person', sa.Column('__ts_vector__', postgresql.TSVECTOR(), sa.Computed("to_tsvector('english', name || ' ' || surname)", persisted=True), nullable=True))
op.create_index('ix_person___ts_vector__', 'person', ['__ts_vector__'], unique=False, postgresql_using='gin')
# ### end Alembic commands ###
The above code is my migration script for creating a migration script for gin index.
but running alembic upgrade gives me the error bellow:
File "/sqlalchemy/engine/default.py", line 719, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.InvalidObjectDefinition) generation expression is not immutable.
(Background on this error at: https://sqlalche.me/e/14/f405)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
