Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""Adds email search.

Revision ID: d1b5ed66d83d
Revises: 1dafcb9ad889
Create Date: 2023-03-27 08:57:44.499535

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.schema import MetaData

from dispatch.search.fulltext import sync_trigger


# revision identifiers, used by Alembic.
revision = "d1b5ed66d83d"
down_revision = "1dafcb9ad889"
branch_labels = None
depends_on = None


def upgrade():
conn = op.get_context().connection
metadata = MetaData(bind=conn, schema=conn.dialect.default_schema_name)
table = sa.Table("individual_contact", metadata, autoload=True)
sync_trigger(conn, table, "search_vector", ["name", "title", "email", "company", "notes"])


def downgrade():
pass
3 changes: 2 additions & 1 deletion src/dispatch/individual/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ class IndividualContact(Base, ContactMixin, ProjectMixin):
TSVectorType(
"name",
"title",
"email",
"company",
"notes",
weights={"name": "A", "title": "B", "company": "C", "notes": "D"},
weights={"name": "A", "email": "B", "title": "C", "company": "D"},
)
)

Expand Down