fix(migrations): don't create foreign key constraints in playlist_best_scores migration

This commit is contained in:
MingxuanGame
2025-11-30 00:44:42 +08:00
parent 31ccc9f0a2
commit ab8c809ea0
2 changed files with 12 additions and 14 deletions

View File

@@ -792,10 +792,10 @@ def upgrade() -> None:
sa.Column("playlist_id", sa.Integer(), nullable=False),
sa.Column("total_score", sa.BigInteger(), nullable=True),
sa.Column("attempts", sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(
["playlist_id"],
["room_playlists.id"],
),
# sa.ForeignKeyConstraint(
# ["playlist_id"],
# ["room_playlists.id"],
# ),
sa.ForeignKeyConstraint(
["room_id"],
["rooms.id"],

View File

@@ -8,8 +8,6 @@ Create Date: 2025-08-13 15:17:53.921545
from collections.abc import Sequence
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "9aa4f7c06824"
down_revision: str | Sequence[str] | None = "8bab62d764a5"
@@ -20,18 +18,18 @@ 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")
# 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"],
)
# op.create_foreign_key(
# op.f("playlist_best_scores_ibfk_1"),
# "playlist_best_scores",
# "room_playlists",
# ["playlist_id"],
# ["id"],
# )
# ### end Alembic commands ###