memory (sqla_mapping): Add index on PrivateInd* tables:
`PriaveInd*` may be queried without `key`, in which case an index was missing.
This commit is contained in:
parent
b7b5797262
commit
399802455f
2 changed files with 44 additions and 0 deletions
|
|
@ -0,0 +1,38 @@
|
|||
"""add namespace indexes to "PrivateInd*" tables
|
||||
|
||||
Revision ID: ccd879fef17e
|
||||
Revises: 3ddac15a0a39
|
||||
Create Date: 2026-04-28 12:16:01.759630
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "ccd879fef17e"
|
||||
down_revision = "3ddac15a0a39"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
with op.batch_alter_table("private_ind", schema=None) as batch_op:
|
||||
batch_op.create_index(
|
||||
"private_ind__namespace_profile_id", ["namespace", "profile_id"], unique=False
|
||||
)
|
||||
|
||||
with op.batch_alter_table("private_ind_bin", schema=None) as batch_op:
|
||||
batch_op.create_index(
|
||||
"private_ind_bin__namespace_profile_id",
|
||||
["namespace", "profile_id"],
|
||||
unique=False,
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
with op.batch_alter_table("private_ind_bin", schema=None) as batch_op:
|
||||
batch_op.drop_index("private_ind_bin__namespace_profile_id")
|
||||
|
||||
with op.batch_alter_table("private_ind", schema=None) as batch_op:
|
||||
batch_op.drop_index("private_ind__namespace_profile_id")
|
||||
|
|
@ -547,6 +547,9 @@ class PrivateGen(Base):
|
|||
|
||||
class PrivateInd(Base):
|
||||
__tablename__ = "private_ind"
|
||||
__table_args__ = (
|
||||
Index("private_ind__namespace_profile_id", "namespace", "profile_id"),
|
||||
)
|
||||
|
||||
namespace = Column(Text, primary_key=True)
|
||||
key = Column(Text, primary_key=True)
|
||||
|
|
@ -566,6 +569,9 @@ class PrivateGenBin(Base):
|
|||
|
||||
class PrivateIndBin(Base):
|
||||
__tablename__ = "private_ind_bin"
|
||||
__table_args__ = (
|
||||
Index("private_ind_bin__namespace_profile_id", "namespace", "profile_id"),
|
||||
)
|
||||
|
||||
namespace = Column(Text, primary_key=True)
|
||||
key = Column(Text, primary_key=True)
|
||||
|
|
|
|||
Loading…
Reference in a new issue