use raw sql to create alias.ts_vector column

This commit is contained in:
Son 2021-08-04 16:57:31 +02:00
parent 8640f830f2
commit 8d6ff446d8
1 changed files with 8 additions and 1 deletions

View File

@ -19,7 +19,14 @@ depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('alias', sa.Column('ts_vector', "ts_vector", sa.Computed("to_tsvector('english', note)", persisted=True), nullable=True))
bind = op.get_bind()
session = Session(bind=bind)
session.execute("""
ALTER TABLE alias ADD COLUMN ts_vector tsvector GENERATED ALWAYS
AS (to_tsvector('english', note)) STORED;
""")
op.create_index('ix_video___ts_vector__', 'alias', ['ts_vector'], unique=False, postgresql_using='gin')
# ### end Alembic commands ###