perf(user): use keyset to boost user scores API & user beatmap API
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
"""add union index for score
|
||||
|
||||
Revision ID: c5472f592d13
|
||||
Revises: 96c4f4b3f0ab
|
||||
Create Date: 2026-01-03 07:10:11.050661
|
||||
|
||||
"""
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "c5472f592d13"
|
||||
down_revision: str | Sequence[str] | None = "96c4f4b3f0ab"
|
||||
branch_labels: str | Sequence[str] | None = None
|
||||
depends_on: str | Sequence[str] | None = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_index("idx_score_user_mode_date", "scores", ["user_id", "gamemode", "ended_at", "id"], unique=False)
|
||||
op.create_index("idx_score_user_mode_pinned", "scores", ["user_id", "gamemode", "pinned_order", "id"], unique=False)
|
||||
op.create_index("idx_score_user_mode_pp", "scores", ["user_id", "gamemode", "pp", "id"], unique=False)
|
||||
op.create_index("idx_beatmap_playcounts_playcount_id", "beatmap_playcounts", ["playcount", "id"], unique=False)
|
||||
op.create_index(
|
||||
"ix_total_score_best_scores_user_mode_score",
|
||||
"total_score_best_scores",
|
||||
["user_id", "gamemode", "score_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
"ix_total_score_best_scores_beatmap_mode_score",
|
||||
"total_score_best_scores",
|
||||
["beatmap_id", "gamemode", "total_score"],
|
||||
unique=False,
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index("idx_score_user_mode_pp", table_name="scores")
|
||||
op.drop_index("idx_score_user_mode_pinned", table_name="scores")
|
||||
op.drop_index("idx_score_user_mode_date", table_name="scores")
|
||||
op.drop_index("idx_beatmap_playcounts_playcount_id", table_name="beatmap_playcounts")
|
||||
op.drop_index("ix_total_score_best_scores_beatmap_mode_score", table_name="total_score_best_scores")
|
||||
op.drop_index("ix_total_score_best_scores_user_mode_score", table_name="total_score_best_scores")
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user