File tree Expand file tree Collapse file tree 2 files changed +49
-1
lines changed
Expand file tree Collapse file tree 2 files changed +49
-1
lines changed Original file line number Diff line number Diff line change 1+ """Add addresses index
2+
3+ Revision ID: 94324ba323d4
4+ Revises: d2035abc33cf
5+ Create Date: 2025-10-13 18:31:10.151051
6+
7+ """
8+
9+ from typing import Sequence , Union
10+
11+ from alembic import op
12+ import sqlalchemy as sa
13+
14+
15+ # revision identifiers, used by Alembic.
16+ revision : str = "94324ba323d4"
17+ down_revision : Union [str , None ] = "d2035abc33cf"
18+ branch_labels : Union [str , Sequence [str ], None ] = None
19+ depends_on : Union [str , Sequence [str ], None ] = None
20+
21+
22+ def upgrade () -> None :
23+ # ### commands auto generated by Alembic - please adjust! ###
24+ op .create_index (
25+ "ix_service_transactions_addresses" ,
26+ "service_transactions" ,
27+ ["addresses" ],
28+ unique = False ,
29+ postgresql_using = "gin" ,
30+ )
31+ # ### end Alembic commands ###
32+
33+
34+ def downgrade () -> None :
35+ # ### commands auto generated by Alembic - please adjust! ###
36+ op .drop_index (
37+ "ix_service_transactions_addresses" ,
38+ table_name = "service_transactions" ,
39+ postgresql_using = "gin" ,
40+ )
41+ # ### end Alembic commands ###
Original file line number Diff line number Diff line change 22
33from sqlalchemy .dialects .postgresql import ARRAY , JSONB
44from sqlalchemy .orm import mapped_column , Mapped
5- from sqlalchemy import String
5+ from sqlalchemy import Index , String
66
77from .base import Base
88
99
1010class Transaction (Base ):
1111 __tablename__ = "service_transactions"
12+ __table_args__ = (
13+ Index (
14+ "ix_service_transactions_addresses" ,
15+ "addresses" ,
16+ postgresql_using = "gin" ,
17+ ),
18+ )
1219
1320 currencies : Mapped [list [str ]] = mapped_column (ARRAY (String (64 )), index = True )
1421 txid : Mapped [str ] = mapped_column (String (64 ), index = True , unique = True )
You can’t perform that action at this time.
0 commit comments