refactor(database): rename migrations to make them more clear
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
"""add beatmap ratings
|
||||
|
||||
Revision ID: 24a32515292d
|
||||
Revises: af88493881eb
|
||||
Create Date: 2025-08-28 11:36:17.874090
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "24a32515292d"
|
||||
down_revision: str | Sequence[str] | None = "af88493881eb"
|
||||
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_table(
|
||||
"beatmap_ratings",
|
||||
sa.Column("id", sa.BigInteger(), autoincrement=True, nullable=False),
|
||||
sa.Column("beatmapset_id", sa.Integer(), nullable=False),
|
||||
sa.Column("user_id", sa.BigInteger(), nullable=True),
|
||||
sa.Column("rating", sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["beatmapset_id"],
|
||||
["beatmapsets.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["user_id"],
|
||||
["lazer_users.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(op.f("ix_beatmap_ratings_beatmapset_id"), "beatmap_ratings", ["beatmapset_id"], unique=False)
|
||||
op.create_index(op.f("ix_beatmap_ratings_user_id"), "beatmap_ratings", ["user_id"], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table("beatmap_ratings")
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user