From ab8c809ea010deec3a07a1f9c6d0abfb2087eaef Mon Sep 17 00:00:00 2001 From: MingxuanGame Date: Sun, 30 Nov 2025 00:44:42 +0800 Subject: [PATCH] fix(migrations): don't create foreign key constraints in playlist_best_scores migration --- .../versions/2025-08-10_fdb3822a30ba_init.py | 8 ++++---- ...playlist_best_scores_remove_foreign_key_.py | 18 ++++++++---------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/migrations/versions/2025-08-10_fdb3822a30ba_init.py b/migrations/versions/2025-08-10_fdb3822a30ba_init.py index 8f026e5..22bd41a 100644 --- a/migrations/versions/2025-08-10_fdb3822a30ba_init.py +++ b/migrations/versions/2025-08-10_fdb3822a30ba_init.py @@ -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"], diff --git a/migrations/versions/2025-08-13_9aa4f7c06824_playlist_best_scores_remove_foreign_key_.py b/migrations/versions/2025-08-13_9aa4f7c06824_playlist_best_scores_remove_foreign_key_.py index d8abaf0..2bd2525 100644 --- a/migrations/versions/2025-08-13_9aa4f7c06824_playlist_best_scores_remove_foreign_key_.py +++ b/migrations/versions/2025-08-13_9aa4f7c06824_playlist_best_scores_remove_foreign_key_.py @@ -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 ###