feat(multiplayer): support leaderboard
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
"""playlist: index playlist id
|
||||
|
||||
Revision ID: d0c1b2cefe91
|
||||
Revises: 58a11441d302
|
||||
Create Date: 2025-08-06 06:02:10.512616
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "d0c1b2cefe91"
|
||||
down_revision: str | Sequence[str] | None = "58a11441d302"
|
||||
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(
|
||||
op.f("ix_room_playlists_id"), "room_playlists", ["id"], unique=False
|
||||
)
|
||||
op.create_table(
|
||||
"playlist_best_scores",
|
||||
sa.Column("user_id", sa.BigInteger(), nullable=True),
|
||||
sa.Column("score_id", sa.BigInteger(), nullable=False),
|
||||
sa.Column("room_id", sa.Integer(), nullable=False),
|
||||
sa.Column("playlist_id", sa.Integer(), nullable=False),
|
||||
sa.Column("total_score", sa.BigInteger(), nullable=True),
|
||||
sa.ForeignKeyConstraint(
|
||||
["playlist_id"],
|
||||
["room_playlists.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["room_id"],
|
||||
["rooms.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["score_id"],
|
||||
["scores.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["user_id"],
|
||||
["lazer_users.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("score_id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_playlist_best_scores_playlist_id"),
|
||||
"playlist_best_scores",
|
||||
["playlist_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_playlist_best_scores_room_id"),
|
||||
"playlist_best_scores",
|
||||
["room_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_playlist_best_scores_user_id"),
|
||||
"playlist_best_scores",
|
||||
["user_id"],
|
||||
unique=False,
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(
|
||||
op.f("ix_playlist_best_scores_user_id"), table_name="playlist_best_scores"
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_playlist_best_scores_room_id"), table_name="playlist_best_scores"
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_playlist_best_scores_playlist_id"), table_name="playlist_best_scores"
|
||||
)
|
||||
op.drop_table("playlist_best_scores")
|
||||
op.drop_index(op.f("ix_room_playlists_id"), table_name="room_playlists")
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user