playlist_best_scores: remove foreign key to allow to remove items
This commit is contained in:
@@ -30,7 +30,7 @@ class PlaylistBestScore(SQLModel, table=True):
|
|||||||
sa_column=Column(BigInteger, ForeignKey("scores.id"), primary_key=True)
|
sa_column=Column(BigInteger, ForeignKey("scores.id"), primary_key=True)
|
||||||
)
|
)
|
||||||
room_id: int = Field(foreign_key="rooms.id", index=True)
|
room_id: int = Field(foreign_key="rooms.id", index=True)
|
||||||
playlist_id: int = Field(foreign_key="room_playlists.id", index=True)
|
playlist_id: int = Field(index=True)
|
||||||
total_score: int = Field(default=0, sa_column=Column(BigInteger))
|
total_score: int = Field(default=0, sa_column=Column(BigInteger))
|
||||||
attempts: int = Field(default=0) # playlist
|
attempts: int = Field(default=0) # playlist
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
"""playlist_best_scores: remove foreign key to allow to remove items
|
||||||
|
|
||||||
|
Revision ID: 9aa4f7c06824
|
||||||
|
Revises: 8bab62d764a5
|
||||||
|
Create Date: 2025-08-13 15:17:53.921545
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Sequence
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision: str = "9aa4f7c06824"
|
||||||
|
down_revision: str | Sequence[str] | None = "8bab62d764a5"
|
||||||
|
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.drop_constraint(
|
||||||
|
op.f("playlist_best_scores_ibfk_1"), "playlist_best_scores", type_="foreignkey"
|
||||||
|
)
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
"""Downgrade schema."""
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.create_foreign_key(
|
||||||
|
op.f("playlist_best_scores_ibfk_1"),
|
||||||
|
"playlist_best_scores",
|
||||||
|
"room_playlists",
|
||||||
|
["playlist_id"],
|
||||||
|
["id"],
|
||||||
|
)
|
||||||
|
# ### end Alembic commands ###
|
||||||
Reference in New Issue
Block a user