refactor(project): make pyright & ruff happy
This commit is contained in:
@@ -60,9 +60,7 @@ def run_migrations_offline() -> None:
|
||||
|
||||
|
||||
def do_run_migrations(connection: Connection) -> None:
|
||||
context.configure(
|
||||
connection=connection, target_metadata=target_metadata, compare_type=True
|
||||
)
|
||||
context.configure(connection=connection, target_metadata=target_metadata, compare_type=True)
|
||||
|
||||
with context.begin_transaction():
|
||||
context.run_migrations()
|
||||
|
||||
@@ -5,6 +5,7 @@ Revises: e96a649e18ca
|
||||
Create Date: 2025-08-22 07:26:59.129564
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
@@ -38,7 +39,7 @@ def upgrade() -> None:
|
||||
sa.Index("ix_email_verifications_user_id", "user_id"),
|
||||
sa.Index("ix_email_verifications_email", "email"),
|
||||
)
|
||||
|
||||
|
||||
# 创建登录会话表
|
||||
op.create_table(
|
||||
"login_sessions",
|
||||
|
||||
@@ -53,9 +53,7 @@ def upgrade() -> None:
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_user_events_user_id"), "user_events", ["user_id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_user_events_user_id"), "user_events", ["user_id"], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
|
||||
@@ -26,51 +26,37 @@ def upgrade() -> None:
|
||||
op.alter_column(
|
||||
"lazer_users",
|
||||
"playmode",
|
||||
type_=sa.Enum(
|
||||
"OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", name="gamemode"
|
||||
),
|
||||
type_=sa.Enum("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", name="gamemode"),
|
||||
)
|
||||
op.alter_column(
|
||||
"beatmaps",
|
||||
"mode",
|
||||
type_=sa.Enum(
|
||||
"OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", name="gamemode"
|
||||
),
|
||||
type_=sa.Enum("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", name="gamemode"),
|
||||
)
|
||||
op.alter_column(
|
||||
"lazer_user_statistics",
|
||||
"mode",
|
||||
type_=sa.Enum(
|
||||
"OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", name="gamemode"
|
||||
),
|
||||
type_=sa.Enum("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", name="gamemode"),
|
||||
)
|
||||
op.alter_column(
|
||||
"score_tokens",
|
||||
"ruleset_id",
|
||||
type_=sa.Enum(
|
||||
"OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", name="gamemode"
|
||||
),
|
||||
type_=sa.Enum("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", name="gamemode"),
|
||||
)
|
||||
op.alter_column(
|
||||
"scores",
|
||||
"gamemode",
|
||||
type_=sa.Enum(
|
||||
"OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", name="gamemode"
|
||||
),
|
||||
type_=sa.Enum("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", name="gamemode"),
|
||||
)
|
||||
op.alter_column(
|
||||
"best_scores",
|
||||
"gamemode",
|
||||
type_=sa.Enum(
|
||||
"OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", name="gamemode"
|
||||
),
|
||||
type_=sa.Enum("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", name="gamemode"),
|
||||
)
|
||||
op.alter_column(
|
||||
"total_score_best_scores",
|
||||
"gamemode",
|
||||
type_=sa.Enum(
|
||||
"OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", name="gamemode"
|
||||
),
|
||||
type_=sa.Enum("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", name="gamemode"),
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
@@ -29,39 +29,19 @@ def upgrade() -> None:
|
||||
"user_login_log",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("user_id", sa.Integer(), nullable=False),
|
||||
sa.Column(
|
||||
"ip_address", sqlmodel.sql.sqltypes.AutoString(length=45), nullable=False
|
||||
),
|
||||
sa.Column(
|
||||
"user_agent", sqlmodel.sql.sqltypes.AutoString(length=500), nullable=True
|
||||
),
|
||||
sa.Column("ip_address", sqlmodel.sql.sqltypes.AutoString(length=45), nullable=False),
|
||||
sa.Column("user_agent", sqlmodel.sql.sqltypes.AutoString(length=500), nullable=True),
|
||||
sa.Column("login_time", sa.DateTime(), nullable=False),
|
||||
sa.Column(
|
||||
"country_code", sqlmodel.sql.sqltypes.AutoString(length=2), nullable=True
|
||||
),
|
||||
sa.Column(
|
||||
"country_name", sqlmodel.sql.sqltypes.AutoString(length=100), nullable=True
|
||||
),
|
||||
sa.Column(
|
||||
"city_name", sqlmodel.sql.sqltypes.AutoString(length=100), nullable=True
|
||||
),
|
||||
sa.Column(
|
||||
"latitude", sqlmodel.sql.sqltypes.AutoString(length=20), nullable=True
|
||||
),
|
||||
sa.Column(
|
||||
"longitude", sqlmodel.sql.sqltypes.AutoString(length=20), nullable=True
|
||||
),
|
||||
sa.Column(
|
||||
"time_zone", sqlmodel.sql.sqltypes.AutoString(length=50), nullable=True
|
||||
),
|
||||
sa.Column("country_code", sqlmodel.sql.sqltypes.AutoString(length=2), nullable=True),
|
||||
sa.Column("country_name", sqlmodel.sql.sqltypes.AutoString(length=100), nullable=True),
|
||||
sa.Column("city_name", sqlmodel.sql.sqltypes.AutoString(length=100), nullable=True),
|
||||
sa.Column("latitude", sqlmodel.sql.sqltypes.AutoString(length=20), nullable=True),
|
||||
sa.Column("longitude", sqlmodel.sql.sqltypes.AutoString(length=20), nullable=True),
|
||||
sa.Column("time_zone", sqlmodel.sql.sqltypes.AutoString(length=50), nullable=True),
|
||||
sa.Column("asn", sa.Integer(), nullable=True),
|
||||
sa.Column(
|
||||
"organization", sqlmodel.sql.sqltypes.AutoString(length=200), nullable=True
|
||||
),
|
||||
sa.Column("organization", sqlmodel.sql.sqltypes.AutoString(length=200), nullable=True),
|
||||
sa.Column("login_success", sa.Boolean(), nullable=False),
|
||||
sa.Column(
|
||||
"login_method", sqlmodel.sql.sqltypes.AutoString(length=50), nullable=False
|
||||
),
|
||||
sa.Column("login_method", sqlmodel.sql.sqltypes.AutoString(length=50), nullable=False),
|
||||
sa.Column("notes", sqlmodel.sql.sqltypes.AutoString(length=500), nullable=True),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
@@ -71,9 +51,7 @@ def upgrade() -> None:
|
||||
["ip_address"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_user_login_log_user_id"), "user_login_log", ["user_id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_user_login_log_user_id"), "user_login_log", ["user_id"], unique=False)
|
||||
op.drop_index(op.f("ix_userloginlog_ip_address"), table_name="userloginlog")
|
||||
op.drop_index(op.f("ix_userloginlog_user_id"), table_name="userloginlog")
|
||||
op.drop_table("userloginlog")
|
||||
@@ -111,12 +89,8 @@ def downgrade() -> None:
|
||||
mysql_default_charset="utf8mb4",
|
||||
mysql_engine="InnoDB",
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_userloginlog_user_id"), "userloginlog", ["user_id"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_userloginlog_ip_address"), "userloginlog", ["ip_address"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_userloginlog_user_id"), "userloginlog", ["user_id"], unique=False)
|
||||
op.create_index(op.f("ix_userloginlog_ip_address"), "userloginlog", ["ip_address"], unique=False)
|
||||
op.drop_index(op.f("ix_user_login_log_user_id"), table_name="user_login_log")
|
||||
op.drop_index(op.f("ix_user_login_log_ip_address"), table_name="user_login_log")
|
||||
op.drop_table("user_login_log")
|
||||
|
||||
@@ -28,48 +28,24 @@ def upgrade() -> None:
|
||||
"userloginlog",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("user_id", sa.Integer(), nullable=False),
|
||||
sa.Column(
|
||||
"ip_address", sqlmodel.sql.sqltypes.AutoString(length=45), nullable=False
|
||||
),
|
||||
sa.Column(
|
||||
"user_agent", sqlmodel.sql.sqltypes.AutoString(length=500), nullable=True
|
||||
),
|
||||
sa.Column("ip_address", sqlmodel.sql.sqltypes.AutoString(length=45), nullable=False),
|
||||
sa.Column("user_agent", sqlmodel.sql.sqltypes.AutoString(length=500), nullable=True),
|
||||
sa.Column("login_time", sa.DateTime(), nullable=False),
|
||||
sa.Column(
|
||||
"country_code", sqlmodel.sql.sqltypes.AutoString(length=2), nullable=True
|
||||
),
|
||||
sa.Column(
|
||||
"country_name", sqlmodel.sql.sqltypes.AutoString(length=100), nullable=True
|
||||
),
|
||||
sa.Column(
|
||||
"city_name", sqlmodel.sql.sqltypes.AutoString(length=100), nullable=True
|
||||
),
|
||||
sa.Column(
|
||||
"latitude", sqlmodel.sql.sqltypes.AutoString(length=20), nullable=True
|
||||
),
|
||||
sa.Column(
|
||||
"longitude", sqlmodel.sql.sqltypes.AutoString(length=20), nullable=True
|
||||
),
|
||||
sa.Column(
|
||||
"time_zone", sqlmodel.sql.sqltypes.AutoString(length=50), nullable=True
|
||||
),
|
||||
sa.Column("country_code", sqlmodel.sql.sqltypes.AutoString(length=2), nullable=True),
|
||||
sa.Column("country_name", sqlmodel.sql.sqltypes.AutoString(length=100), nullable=True),
|
||||
sa.Column("city_name", sqlmodel.sql.sqltypes.AutoString(length=100), nullable=True),
|
||||
sa.Column("latitude", sqlmodel.sql.sqltypes.AutoString(length=20), nullable=True),
|
||||
sa.Column("longitude", sqlmodel.sql.sqltypes.AutoString(length=20), nullable=True),
|
||||
sa.Column("time_zone", sqlmodel.sql.sqltypes.AutoString(length=50), nullable=True),
|
||||
sa.Column("asn", sa.Integer(), nullable=True),
|
||||
sa.Column(
|
||||
"organization", sqlmodel.sql.sqltypes.AutoString(length=200), nullable=True
|
||||
),
|
||||
sa.Column("organization", sqlmodel.sql.sqltypes.AutoString(length=200), nullable=True),
|
||||
sa.Column("login_success", sa.Boolean(), nullable=False),
|
||||
sa.Column(
|
||||
"login_method", sqlmodel.sql.sqltypes.AutoString(length=50), nullable=False
|
||||
),
|
||||
sa.Column("login_method", sqlmodel.sql.sqltypes.AutoString(length=50), nullable=False),
|
||||
sa.Column("notes", sqlmodel.sql.sqltypes.AutoString(length=500), nullable=True),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_userloginlog_ip_address"), "userloginlog", ["ip_address"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_userloginlog_user_id"), "userloginlog", ["user_id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_userloginlog_ip_address"), "userloginlog", ["ip_address"], unique=False)
|
||||
op.create_index(op.f("ix_userloginlog_user_id"), "userloginlog", ["user_id"], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
|
||||
@@ -58,9 +58,7 @@ def upgrade() -> None:
|
||||
),
|
||||
nullable=False,
|
||||
),
|
||||
sa.Column(
|
||||
"category", sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False
|
||||
),
|
||||
sa.Column("category", sqlmodel.sql.sqltypes.AutoString(length=255), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=True),
|
||||
sa.Column("object_type", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column("object_id", sa.BigInteger(), nullable=True),
|
||||
@@ -68,16 +66,10 @@ def upgrade() -> None:
|
||||
sa.Column("details", sa.JSON(), nullable=True),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_notifications_category"), "notifications", ["category"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_notifications_category"), "notifications", ["category"], unique=False)
|
||||
op.create_index(op.f("ix_notifications_id"), "notifications", ["id"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_notifications_name"), "notifications", ["name"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_notifications_object_id"), "notifications", ["object_id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_notifications_name"), "notifications", ["name"], unique=False)
|
||||
op.create_index(op.f("ix_notifications_object_id"), "notifications", ["object_id"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_notifications_object_type"),
|
||||
"notifications",
|
||||
@@ -106,9 +98,7 @@ def upgrade() -> None:
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_user_notifications_id"), "user_notifications", ["id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_user_notifications_id"), "user_notifications", ["id"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_user_notifications_is_read"),
|
||||
"user_notifications",
|
||||
|
||||
@@ -22,18 +22,14 @@ 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_beatmaps_beatmap_status"), "beatmaps", ["beatmap_status"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_beatmaps_beatmap_status"), "beatmaps", ["beatmap_status"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_beatmaps_difficulty_rating"),
|
||||
"beatmaps",
|
||||
["difficulty_rating"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_beatmaps_last_updated"), "beatmaps", ["last_updated"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_beatmaps_last_updated"), "beatmaps", ["last_updated"], unique=False)
|
||||
op.create_index(op.f("ix_beatmaps_user_id"), "beatmaps", ["user_id"], unique=False)
|
||||
op.create_index(op.f("ix_beatmaps_version"), "beatmaps", ["version"], unique=False)
|
||||
op.create_index(
|
||||
@@ -54,48 +50,32 @@ def upgrade() -> None:
|
||||
["beatmap_status"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_beatmapsets_creator"), "beatmapsets", ["creator"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_beatmapsets_creator"), "beatmapsets", ["creator"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_beatmapsets_last_updated"),
|
||||
"beatmapsets",
|
||||
["last_updated"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_beatmapsets_play_count"), "beatmapsets", ["play_count"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_beatmapsets_ranked_date"), "beatmapsets", ["ranked_date"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_beatmapsets_storyboard"), "beatmapsets", ["storyboard"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_beatmapsets_play_count"), "beatmapsets", ["play_count"], unique=False)
|
||||
op.create_index(op.f("ix_beatmapsets_ranked_date"), "beatmapsets", ["ranked_date"], unique=False)
|
||||
op.create_index(op.f("ix_beatmapsets_storyboard"), "beatmapsets", ["storyboard"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_beatmapsets_submitted_date"),
|
||||
"beatmapsets",
|
||||
["submitted_date"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_beatmapsets_title"), "beatmapsets", ["title"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_beatmapsets_title"), "beatmapsets", ["title"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_beatmapsets_title_unicode"),
|
||||
"beatmapsets",
|
||||
["title_unicode"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_beatmapsets_track_id"), "beatmapsets", ["track_id"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_beatmapsets_user_id"), "beatmapsets", ["user_id"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_beatmapsets_video"), "beatmapsets", ["video"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_beatmapsets_track_id"), "beatmapsets", ["track_id"], unique=False)
|
||||
op.create_index(op.f("ix_beatmapsets_user_id"), "beatmapsets", ["user_id"], unique=False)
|
||||
op.create_index(op.f("ix_beatmapsets_video"), "beatmapsets", ["video"], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ Revises: 65e7dc8d5905
|
||||
Create Date: 2025-08-22 15:14:59.242274
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
@@ -23,18 +24,24 @@ depends_on: str | Sequence[str] | None = None
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column("login_sessions", "user_agent",
|
||||
existing_type=mysql.VARCHAR(length=255),
|
||||
type_=sa.String(length=250),
|
||||
existing_nullable=True)
|
||||
op.alter_column(
|
||||
"login_sessions",
|
||||
"user_agent",
|
||||
existing_type=mysql.VARCHAR(length=255),
|
||||
type_=sa.String(length=250),
|
||||
existing_nullable=True,
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column("login_sessions", "user_agent",
|
||||
existing_type=sa.String(length=250),
|
||||
type_=mysql.VARCHAR(length=255),
|
||||
existing_nullable=True)
|
||||
op.alter_column(
|
||||
"login_sessions",
|
||||
"user_agent",
|
||||
existing_type=sa.String(length=250),
|
||||
type_=mysql.VARCHAR(length=255),
|
||||
existing_nullable=True,
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
@@ -40,9 +40,7 @@ def upgrade() -> None:
|
||||
),
|
||||
sa.PrimaryKeyConstraint("user_id", "team_id"),
|
||||
)
|
||||
op.alter_column(
|
||||
"team_members", "user_id", existing_type=mysql.BIGINT(), nullable=False
|
||||
)
|
||||
op.alter_column("team_members", "user_id", existing_type=mysql.BIGINT(), nullable=False)
|
||||
op.drop_index(op.f("ix_team_members_id"), table_name="team_members")
|
||||
op.drop_column("team_members", "id")
|
||||
op.add_column(
|
||||
@@ -79,8 +77,6 @@ def downgrade() -> None:
|
||||
sa.Column("id", mysql.INTEGER(), autoincrement=True, nullable=False),
|
||||
)
|
||||
op.create_index(op.f("ix_team_members_id"), "team_members", ["id"], unique=False)
|
||||
op.alter_column(
|
||||
"team_members", "user_id", existing_type=mysql.BIGINT(), nullable=True
|
||||
)
|
||||
op.alter_column("team_members", "user_id", existing_type=mysql.BIGINT(), nullable=True)
|
||||
op.drop_table("team_requests")
|
||||
# ### end Alembic commands ###
|
||||
|
||||
@@ -38,9 +38,7 @@ def upgrade() -> None:
|
||||
)
|
||||
op.create_index(op.f("ix_v1_api_keys_key"), "v1_api_keys", ["key"], unique=False)
|
||||
op.create_index(op.f("ix_v1_api_keys_name"), "v1_api_keys", ["name"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_v1_api_keys_owner_id"), "v1_api_keys", ["owner_id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_v1_api_keys_owner_id"), "v1_api_keys", ["owner_id"], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
|
||||
@@ -40,9 +40,7 @@ def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column(
|
||||
"lazer_user_statistics",
|
||||
sa.Column(
|
||||
"level_progress", mysql.INTEGER(), autoincrement=False, nullable=False
|
||||
),
|
||||
sa.Column("level_progress", mysql.INTEGER(), autoincrement=False, nullable=False),
|
||||
)
|
||||
op.alter_column(
|
||||
"lazer_user_statistics",
|
||||
|
||||
@@ -26,73 +26,55 @@ def upgrade() -> None:
|
||||
op.alter_column(
|
||||
"beatmaps",
|
||||
"mode",
|
||||
existing_type=mysql.ENUM(
|
||||
"OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"
|
||||
),
|
||||
existing_type=mysql.ENUM("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"),
|
||||
nullable=False,
|
||||
)
|
||||
op.alter_column(
|
||||
"best_scores",
|
||||
"gamemode",
|
||||
existing_type=mysql.ENUM(
|
||||
"OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"
|
||||
),
|
||||
existing_type=mysql.ENUM("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"),
|
||||
nullable=False,
|
||||
)
|
||||
op.alter_column(
|
||||
"lazer_user_statistics",
|
||||
"mode",
|
||||
existing_type=mysql.ENUM(
|
||||
"OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"
|
||||
),
|
||||
existing_type=mysql.ENUM("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"),
|
||||
nullable=False,
|
||||
)
|
||||
op.alter_column(
|
||||
"lazer_users",
|
||||
"playmode",
|
||||
existing_type=mysql.ENUM(
|
||||
"OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"
|
||||
),
|
||||
existing_type=mysql.ENUM("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"),
|
||||
nullable=False,
|
||||
)
|
||||
op.alter_column(
|
||||
"score_tokens",
|
||||
"ruleset_id",
|
||||
existing_type=mysql.ENUM(
|
||||
"OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"
|
||||
),
|
||||
existing_type=mysql.ENUM("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"),
|
||||
nullable=False,
|
||||
)
|
||||
op.alter_column(
|
||||
"scores",
|
||||
"gamemode",
|
||||
existing_type=mysql.ENUM(
|
||||
"OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"
|
||||
),
|
||||
existing_type=mysql.ENUM("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"),
|
||||
nullable=False,
|
||||
)
|
||||
op.alter_column(
|
||||
"total_score_best_scores",
|
||||
"gamemode",
|
||||
existing_type=mysql.ENUM(
|
||||
"OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"
|
||||
),
|
||||
existing_type=mysql.ENUM("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"),
|
||||
nullable=False,
|
||||
)
|
||||
op.alter_column(
|
||||
"rank_history",
|
||||
"mode",
|
||||
existing_type=mysql.ENUM(
|
||||
"OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"
|
||||
),
|
||||
existing_type=mysql.ENUM("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"),
|
||||
nullable=False,
|
||||
)
|
||||
op.alter_column(
|
||||
"rank_top",
|
||||
"mode",
|
||||
existing_type=mysql.ENUM(
|
||||
"OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"
|
||||
),
|
||||
existing_type=mysql.ENUM("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"),
|
||||
nullable=False,
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
@@ -146,17 +128,13 @@ def downgrade() -> None:
|
||||
op.alter_column(
|
||||
"rank_top",
|
||||
"mode",
|
||||
existing_type=mysql.ENUM(
|
||||
"OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"
|
||||
),
|
||||
existing_type=mysql.ENUM("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"),
|
||||
nullable=False,
|
||||
)
|
||||
op.alter_column(
|
||||
"rank_top",
|
||||
"mode",
|
||||
existing_type=mysql.ENUM(
|
||||
"OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"
|
||||
),
|
||||
existing_type=mysql.ENUM("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", "TAIKORX", "FRUITSRX"),
|
||||
nullable=False,
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
@@ -22,9 +22,7 @@ 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 ###
|
||||
|
||||
|
||||
|
||||
@@ -35,9 +35,7 @@ def upgrade() -> None:
|
||||
["beatmap_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_banned_beatmaps_id"), "banned_beatmaps", ["id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_banned_beatmaps_id"), "banned_beatmaps", ["id"], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
|
||||
@@ -36,22 +36,16 @@ def upgrade() -> None:
|
||||
),
|
||||
sa.PrimaryKeyConstraint("client_id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_oauth_clients_client_id"), "oauth_clients", ["client_id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_oauth_clients_client_id"), "oauth_clients", ["client_id"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_oauth_clients_client_secret"),
|
||||
"oauth_clients",
|
||||
["client_secret"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_oauth_clients_owner_id"), "oauth_clients", ["owner_id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_oauth_clients_owner_id"), "oauth_clients", ["owner_id"], unique=False)
|
||||
op.add_column("oauth_tokens", sa.Column("client_id", sa.Integer(), nullable=False))
|
||||
op.create_index(
|
||||
op.f("ix_oauth_tokens_client_id"), "oauth_tokens", ["client_id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_oauth_tokens_client_id"), "oauth_tokens", ["client_id"], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
|
||||
@@ -77,14 +77,8 @@ def downgrade() -> None:
|
||||
"replays_watched_counts",
|
||||
type_="foreignkey",
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_replays_watched_counts_year"), table_name="replays_watched_counts"
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_replays_watched_counts_user_id"), table_name="replays_watched_counts"
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_replays_watched_counts_month"), table_name="replays_watched_counts"
|
||||
)
|
||||
op.drop_index(op.f("ix_replays_watched_counts_year"), table_name="replays_watched_counts")
|
||||
op.drop_index(op.f("ix_replays_watched_counts_user_id"), table_name="replays_watched_counts")
|
||||
op.drop_index(op.f("ix_replays_watched_counts_month"), table_name="replays_watched_counts")
|
||||
op.drop_table("replays_watched_counts")
|
||||
# ### end Alembic commands ###
|
||||
|
||||
@@ -30,9 +30,7 @@ def upgrade() -> None:
|
||||
sa.Column("user_id", sa.BigInteger(), nullable=True),
|
||||
sa.Column(
|
||||
"mode",
|
||||
sa.Enum(
|
||||
"OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", name="gamemode"
|
||||
),
|
||||
sa.Enum("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", name="gamemode"),
|
||||
nullable=False,
|
||||
),
|
||||
sa.Column("rank", sa.Integer(), nullable=False),
|
||||
@@ -43,21 +41,15 @@ def upgrade() -> None:
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_rank_history_date"), "rank_history", ["date"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_rank_history_user_id"), "rank_history", ["user_id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_rank_history_date"), "rank_history", ["date"], unique=False)
|
||||
op.create_index(op.f("ix_rank_history_user_id"), "rank_history", ["user_id"], unique=False)
|
||||
op.create_table(
|
||||
"rank_top",
|
||||
sa.Column("id", sa.BigInteger(), nullable=False),
|
||||
sa.Column("user_id", sa.BigInteger(), nullable=True),
|
||||
sa.Column(
|
||||
"mode",
|
||||
sa.Enum(
|
||||
"OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", name="gamemode"
|
||||
),
|
||||
sa.Enum("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP", name="gamemode"),
|
||||
nullable=False,
|
||||
),
|
||||
sa.Column("rank", sa.Integer(), nullable=False),
|
||||
@@ -84,9 +76,7 @@ def upgrade() -> None:
|
||||
)
|
||||
op.drop_column("lazer_user_statistics", "country_rank")
|
||||
op.drop_column("lazer_user_statistics", "global_rank")
|
||||
op.create_index(
|
||||
op.f("ix_oauth_clients_name"), "oauth_clients", ["name"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_oauth_clients_name"), "oauth_clients", ["name"], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
@@ -102,12 +92,8 @@ def downgrade() -> None:
|
||||
"lazer_user_statistics",
|
||||
sa.Column("country_rank", mysql.INTEGER(), autoincrement=False, nullable=True),
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_lazer_user_statistics_pp"), table_name="lazer_user_statistics"
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_lazer_user_statistics_mode"), table_name="lazer_user_statistics"
|
||||
)
|
||||
op.drop_index(op.f("ix_lazer_user_statistics_pp"), table_name="lazer_user_statistics")
|
||||
op.drop_index(op.f("ix_lazer_user_statistics_mode"), table_name="lazer_user_statistics")
|
||||
op.drop_table("rank_top")
|
||||
op.drop_table("rank_history")
|
||||
# ### end Alembic commands ###
|
||||
|
||||
@@ -23,16 +23,12 @@ depends_on: str | Sequence[str] | None = None
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column(
|
||||
"beatmaps", "max_combo", existing_type=mysql.INTEGER(), nullable=True
|
||||
)
|
||||
op.alter_column("beatmaps", "max_combo", existing_type=mysql.INTEGER(), nullable=True)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column(
|
||||
"beatmaps", "max_combo", existing_type=mysql.INTEGER(), nullable=False
|
||||
)
|
||||
op.alter_column("beatmaps", "max_combo", existing_type=mysql.INTEGER(), nullable=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
@@ -5,6 +5,7 @@ Revises: 0f96348cdfd2
|
||||
Create Date: 2025-08-22 08:27:58.468119
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
@@ -12,7 +13,6 @@ from collections.abc import Sequence
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
import sqlmodel
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "d103d442dc24"
|
||||
@@ -24,179 +24,271 @@ depends_on: str | Sequence[str] | None = None
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
|
||||
|
||||
# 安全创建 password_resets 表(如果不存在)
|
||||
try:
|
||||
op.create_table("password_resets",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("user_id", sa.BigInteger(), nullable=False),
|
||||
sa.Column("email", sa.String(255), nullable=False),
|
||||
sa.Column("reset_code", sa.String(8), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.Column("expires_at", sa.DateTime(), nullable=False),
|
||||
sa.Column("is_used", sa.Boolean(), nullable=False),
|
||||
sa.Column("used_at", sa.DateTime(), nullable=True),
|
||||
sa.Column("ip_address", sa.String(255), nullable=True),
|
||||
sa.Column("user_agent", sa.String(255), nullable=True),
|
||||
sa.ForeignKeyConstraint(["user_id"], ["lazer_users.id"], ),
|
||||
sa.PrimaryKeyConstraint("id")
|
||||
op.create_table(
|
||||
"password_resets",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("user_id", sa.BigInteger(), nullable=False),
|
||||
sa.Column("email", sa.String(255), nullable=False),
|
||||
sa.Column("reset_code", sa.String(8), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=False),
|
||||
sa.Column("expires_at", sa.DateTime(), nullable=False),
|
||||
sa.Column("is_used", sa.Boolean(), nullable=False),
|
||||
sa.Column("used_at", sa.DateTime(), nullable=True),
|
||||
sa.Column("ip_address", sa.String(255), nullable=True),
|
||||
sa.Column("user_agent", sa.String(255), nullable=True),
|
||||
sa.ForeignKeyConstraint(
|
||||
["user_id"],
|
||||
["lazer_users.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
except Exception:
|
||||
# 如果表已存在,继续执行
|
||||
pass
|
||||
|
||||
|
||||
# 安全创建索引
|
||||
try:
|
||||
op.create_index(op.f("ix_password_resets_email"), "password_resets", ["email"], unique=False)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
try:
|
||||
op.create_index(op.f("ix_password_resets_user_id"), "password_resets", ["user_id"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_password_resets_user_id"),
|
||||
"password_resets",
|
||||
["user_id"],
|
||||
unique=False,
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
# 安全删除 two_factor_auth 表 - 先删除表(这会自动删除外键约束和索引)
|
||||
try:
|
||||
op.drop_table("two_factor_auth")
|
||||
except Exception:
|
||||
# 如果表不存在,继续执行
|
||||
pass
|
||||
|
||||
|
||||
# 安全删除 user_ip_history 表
|
||||
try:
|
||||
op.drop_table("user_ip_history")
|
||||
except Exception:
|
||||
# 如果表不存在,继续执行
|
||||
pass
|
||||
|
||||
|
||||
# 安全删除 session_verification 表
|
||||
try:
|
||||
op.drop_table("session_verification")
|
||||
except Exception:
|
||||
# 如果表不存在,继续执行
|
||||
pass
|
||||
op.alter_column("beatmapsets", "nsfw",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=True)
|
||||
op.alter_column("beatmapsets", "spotlight",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=True)
|
||||
op.alter_column("beatmapsets", "video",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=True)
|
||||
op.alter_column("beatmapsets", "can_be_hyped",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=True)
|
||||
op.alter_column("beatmapsets", "discussion_locked",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=True)
|
||||
op.alter_column("beatmapsets", "storyboard",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=True)
|
||||
op.alter_column("beatmapsets", "download_disabled",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=True)
|
||||
|
||||
op.alter_column(
|
||||
"beatmapsets",
|
||||
"nsfw",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=True,
|
||||
)
|
||||
op.alter_column(
|
||||
"beatmapsets",
|
||||
"spotlight",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=True,
|
||||
)
|
||||
op.alter_column(
|
||||
"beatmapsets",
|
||||
"video",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=True,
|
||||
)
|
||||
op.alter_column(
|
||||
"beatmapsets",
|
||||
"can_be_hyped",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=True,
|
||||
)
|
||||
op.alter_column(
|
||||
"beatmapsets",
|
||||
"discussion_locked",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=True,
|
||||
)
|
||||
op.alter_column(
|
||||
"beatmapsets",
|
||||
"storyboard",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=True,
|
||||
)
|
||||
op.alter_column(
|
||||
"beatmapsets",
|
||||
"download_disabled",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=True,
|
||||
)
|
||||
|
||||
# 安全删除索引
|
||||
try:
|
||||
op.drop_index(op.f("uq_user_achievement"), table_name="lazer_user_achievements")
|
||||
except Exception:
|
||||
# 如果索引不存在或有外键约束,继续执行
|
||||
pass
|
||||
|
||||
op.alter_column("scores", "has_replay",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=True)
|
||||
op.alter_column("scores", "passed",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=True)
|
||||
op.alter_column("scores", "preserve",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=True)
|
||||
|
||||
op.alter_column(
|
||||
"scores",
|
||||
"has_replay",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=True,
|
||||
)
|
||||
op.alter_column("scores", "passed", existing_type=mysql.TINYINT(display_width=1), nullable=True)
|
||||
op.alter_column(
|
||||
"scores",
|
||||
"preserve",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=True,
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column("scores", "preserve",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=False)
|
||||
op.alter_column("scores", "passed",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=False)
|
||||
op.alter_column("scores", "has_replay",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=False)
|
||||
op.create_index(op.f("uq_user_achievement"), "lazer_user_achievements", ["user_id", "achievement_id"], unique=True)
|
||||
op.alter_column("beatmapsets", "download_disabled",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=False)
|
||||
op.alter_column("beatmapsets", "storyboard",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=False)
|
||||
op.alter_column("beatmapsets", "discussion_locked",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=False)
|
||||
op.alter_column("beatmapsets", "can_be_hyped",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=False)
|
||||
op.alter_column("beatmapsets", "video",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=False)
|
||||
op.alter_column("beatmapsets", "spotlight",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=False)
|
||||
op.alter_column("beatmapsets", "nsfw",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=False)
|
||||
op.create_table("session_verification",
|
||||
sa.Column("id", mysql.BIGINT(), autoincrement=True, nullable=False),
|
||||
sa.Column("user_id", mysql.BIGINT(), autoincrement=False, nullable=False),
|
||||
sa.Column("session_id", mysql.VARCHAR(length=255), nullable=False),
|
||||
sa.Column("ip_address", mysql.VARCHAR(length=45), nullable=False),
|
||||
sa.Column("is_verified", mysql.TINYINT(display_width=1), autoincrement=False, nullable=False),
|
||||
sa.Column("verified_at", mysql.DATETIME(), nullable=True),
|
||||
sa.Column("expires_at", mysql.DATETIME(), nullable=False),
|
||||
sa.ForeignKeyConstraint(["user_id"], ["lazer_users.id"], name=op.f("session_verification_ibfk_1")),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
mysql_collate="utf8mb4_0900_ai_ci",
|
||||
mysql_default_charset="utf8mb4",
|
||||
mysql_engine="InnoDB"
|
||||
op.alter_column(
|
||||
"scores",
|
||||
"preserve",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=False,
|
||||
)
|
||||
op.create_index(op.f("ix_session_verification_user_id"), "session_verification", ["user_id"], unique=False)
|
||||
op.create_table("user_ip_history",
|
||||
sa.Column("id", mysql.BIGINT(), autoincrement=True, nullable=False),
|
||||
sa.Column("user_id", mysql.BIGINT(), autoincrement=False, nullable=False),
|
||||
sa.Column("ip_address", mysql.VARCHAR(length=45), nullable=False),
|
||||
sa.Column("first_seen", mysql.DATETIME(), nullable=False),
|
||||
sa.Column("last_seen", mysql.DATETIME(), nullable=False),
|
||||
sa.Column("usage_count", mysql.INTEGER(), autoincrement=False, nullable=False),
|
||||
sa.Column("is_trusted", mysql.TINYINT(display_width=1), autoincrement=False, nullable=False),
|
||||
sa.ForeignKeyConstraint(["user_id"], ["lazer_users.id"], name=op.f("user_ip_history_ibfk_1")),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
mysql_collate="utf8mb4_0900_ai_ci",
|
||||
mysql_default_charset="utf8mb4",
|
||||
mysql_engine="InnoDB"
|
||||
op.alter_column("scores", "passed", existing_type=mysql.TINYINT(display_width=1), nullable=False)
|
||||
op.alter_column(
|
||||
"scores",
|
||||
"has_replay",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("uq_user_achievement"),
|
||||
"lazer_user_achievements",
|
||||
["user_id", "achievement_id"],
|
||||
unique=True,
|
||||
)
|
||||
op.alter_column(
|
||||
"beatmapsets",
|
||||
"download_disabled",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=False,
|
||||
)
|
||||
op.alter_column(
|
||||
"beatmapsets",
|
||||
"storyboard",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=False,
|
||||
)
|
||||
op.alter_column(
|
||||
"beatmapsets",
|
||||
"discussion_locked",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=False,
|
||||
)
|
||||
op.alter_column(
|
||||
"beatmapsets",
|
||||
"can_be_hyped",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=False,
|
||||
)
|
||||
op.alter_column(
|
||||
"beatmapsets",
|
||||
"video",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=False,
|
||||
)
|
||||
op.alter_column(
|
||||
"beatmapsets",
|
||||
"spotlight",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=False,
|
||||
)
|
||||
op.alter_column(
|
||||
"beatmapsets",
|
||||
"nsfw",
|
||||
existing_type=mysql.TINYINT(display_width=1),
|
||||
nullable=False,
|
||||
)
|
||||
op.create_table(
|
||||
"session_verification",
|
||||
sa.Column("id", mysql.BIGINT(), autoincrement=True, nullable=False),
|
||||
sa.Column("user_id", mysql.BIGINT(), autoincrement=False, nullable=False),
|
||||
sa.Column("session_id", mysql.VARCHAR(length=255), nullable=False),
|
||||
sa.Column("ip_address", mysql.VARCHAR(length=45), nullable=False),
|
||||
sa.Column(
|
||||
"is_verified",
|
||||
mysql.TINYINT(display_width=1),
|
||||
autoincrement=False,
|
||||
nullable=False,
|
||||
),
|
||||
sa.Column("verified_at", mysql.DATETIME(), nullable=True),
|
||||
sa.Column("expires_at", mysql.DATETIME(), nullable=False),
|
||||
sa.ForeignKeyConstraint(["user_id"], ["lazer_users.id"], name=op.f("session_verification_ibfk_1")),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
mysql_collate="utf8mb4_0900_ai_ci",
|
||||
mysql_default_charset="utf8mb4",
|
||||
mysql_engine="InnoDB",
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_session_verification_user_id"),
|
||||
"session_verification",
|
||||
["user_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_table(
|
||||
"user_ip_history",
|
||||
sa.Column("id", mysql.BIGINT(), autoincrement=True, nullable=False),
|
||||
sa.Column("user_id", mysql.BIGINT(), autoincrement=False, nullable=False),
|
||||
sa.Column("ip_address", mysql.VARCHAR(length=45), nullable=False),
|
||||
sa.Column("first_seen", mysql.DATETIME(), nullable=False),
|
||||
sa.Column("last_seen", mysql.DATETIME(), nullable=False),
|
||||
sa.Column("usage_count", mysql.INTEGER(), autoincrement=False, nullable=False),
|
||||
sa.Column(
|
||||
"is_trusted",
|
||||
mysql.TINYINT(display_width=1),
|
||||
autoincrement=False,
|
||||
nullable=False,
|
||||
),
|
||||
sa.ForeignKeyConstraint(["user_id"], ["lazer_users.id"], name=op.f("user_ip_history_ibfk_1")),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
mysql_collate="utf8mb4_0900_ai_ci",
|
||||
mysql_default_charset="utf8mb4",
|
||||
mysql_engine="InnoDB",
|
||||
)
|
||||
op.create_index(op.f("ix_user_ip_history_user_id"), "user_ip_history", ["user_id"], unique=False)
|
||||
op.create_index(op.f("ix_user_ip_history_ip_address"), "user_ip_history", ["ip_address"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_user_ip_history_ip_address"),
|
||||
"user_ip_history",
|
||||
["ip_address"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(op.f("ix_user_ip_history_id"), "user_ip_history", ["id"], unique=False)
|
||||
op.create_table("two_factor_auth",
|
||||
sa.Column("id", mysql.BIGINT(), autoincrement=True, nullable=False),
|
||||
sa.Column("user_id", mysql.BIGINT(), autoincrement=False, nullable=False),
|
||||
sa.Column("verification_code", mysql.VARCHAR(length=8), nullable=False),
|
||||
sa.Column("expires_at", mysql.DATETIME(), nullable=False),
|
||||
sa.Column("is_used", mysql.TINYINT(display_width=1), autoincrement=False, nullable=False),
|
||||
sa.Column("ip_address", mysql.VARCHAR(length=45), nullable=False),
|
||||
sa.Column("trigger_reason", mysql.VARCHAR(length=50), nullable=False),
|
||||
sa.Column("verified_at", mysql.DATETIME(), nullable=True),
|
||||
sa.ForeignKeyConstraint(["user_id"], ["lazer_users.id"], name=op.f("two_factor_auth_ibfk_1")),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
mysql_collate="utf8mb4_0900_ai_ci",
|
||||
mysql_default_charset="utf8mb4",
|
||||
mysql_engine="InnoDB"
|
||||
op.create_table(
|
||||
"two_factor_auth",
|
||||
sa.Column("id", mysql.BIGINT(), autoincrement=True, nullable=False),
|
||||
sa.Column("user_id", mysql.BIGINT(), autoincrement=False, nullable=False),
|
||||
sa.Column("verification_code", mysql.VARCHAR(length=8), nullable=False),
|
||||
sa.Column("expires_at", mysql.DATETIME(), nullable=False),
|
||||
sa.Column(
|
||||
"is_used",
|
||||
mysql.TINYINT(display_width=1),
|
||||
autoincrement=False,
|
||||
nullable=False,
|
||||
),
|
||||
sa.Column("ip_address", mysql.VARCHAR(length=45), nullable=False),
|
||||
sa.Column("trigger_reason", mysql.VARCHAR(length=50), nullable=False),
|
||||
sa.Column("verified_at", mysql.DATETIME(), nullable=True),
|
||||
sa.ForeignKeyConstraint(["user_id"], ["lazer_users.id"], name=op.f("two_factor_auth_ibfk_1")),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
mysql_collate="utf8mb4_0900_ai_ci",
|
||||
mysql_default_charset="utf8mb4",
|
||||
mysql_engine="InnoDB",
|
||||
)
|
||||
op.create_index(op.f("ix_two_factor_auth_user_id"), "two_factor_auth", ["user_id"], unique=False)
|
||||
op.create_index(op.f("ix_two_factor_auth_id"), "two_factor_auth", ["id"], unique=False)
|
||||
|
||||
@@ -61,12 +61,8 @@ def upgrade() -> None:
|
||||
["description"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_chat_channels_name"), "chat_channels", ["name"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_chat_channels_type"), "chat_channels", ["type"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_chat_channels_name"), "chat_channels", ["name"], unique=False)
|
||||
op.create_index(op.f("ix_chat_channels_type"), "chat_channels", ["type"], unique=False)
|
||||
op.create_table(
|
||||
"chat_messages",
|
||||
sa.Column("channel_id", sa.Integer(), nullable=False),
|
||||
@@ -102,15 +98,9 @@ def upgrade() -> None:
|
||||
["message_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_chat_messages_sender_id"), "chat_messages", ["sender_id"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_chat_messages_timestamp"), "chat_messages", ["timestamp"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_chat_messages_type"), "chat_messages", ["type"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_chat_messages_sender_id"), "chat_messages", ["sender_id"], unique=False)
|
||||
op.create_index(op.f("ix_chat_messages_timestamp"), "chat_messages", ["timestamp"], unique=False)
|
||||
op.create_index(op.f("ix_chat_messages_type"), "chat_messages", ["type"], unique=False)
|
||||
op.create_table(
|
||||
"chat_silence_users",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
|
||||
@@ -24,15 +24,9 @@ depends_on: str | Sequence[str] | None = None
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column(
|
||||
"chat_silence_users", "user_id", existing_type=mysql.BIGINT(), nullable=True
|
||||
)
|
||||
op.alter_column(
|
||||
"chat_silence_users", "banned_at", existing_type=mysql.DATETIME(), nullable=True
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_chat_silence_users_id"), "chat_silence_users", ["id"], unique=False
|
||||
)
|
||||
op.alter_column("chat_silence_users", "user_id", existing_type=mysql.BIGINT(), nullable=True)
|
||||
op.alter_column("chat_silence_users", "banned_at", existing_type=mysql.DATETIME(), nullable=True)
|
||||
op.create_index(op.f("ix_chat_silence_users_id"), "chat_silence_users", ["id"], unique=False)
|
||||
op.add_column("rooms", sa.Column("channel_id", sa.Integer(), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
@@ -48,7 +42,5 @@ def downgrade() -> None:
|
||||
existing_type=mysql.DATETIME(),
|
||||
nullable=False,
|
||||
)
|
||||
op.alter_column(
|
||||
"chat_silence_users", "user_id", existing_type=mysql.BIGINT(), nullable=False
|
||||
)
|
||||
op.alter_column("chat_silence_users", "user_id", existing_type=mysql.BIGINT(), nullable=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
@@ -23,20 +23,14 @@ depends_on: str | Sequence[str] | None = None
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(
|
||||
constraint_name="PRIMARY", table_name="lazer_user_achievements", type_="primary"
|
||||
)
|
||||
op.create_primary_key(
|
||||
"pk_lazer_user_achievements", "lazer_user_achievements", ["id"]
|
||||
)
|
||||
op.drop_constraint(constraint_name="PRIMARY", table_name="lazer_user_achievements", type_="primary")
|
||||
op.create_primary_key("pk_lazer_user_achievements", "lazer_user_achievements", ["id"])
|
||||
op.create_index(
|
||||
"ix_lazer_user_achievements_achievement_id",
|
||||
"lazer_user_achievements",
|
||||
["achievement_id"],
|
||||
)
|
||||
op.create_unique_constraint(
|
||||
"uq_user_achievement", "lazer_user_achievements", ["user_id", "achievement_id"]
|
||||
)
|
||||
op.create_unique_constraint("uq_user_achievement", "lazer_user_achievements", ["user_id", "achievement_id"])
|
||||
op.alter_column(
|
||||
"lazer_user_achievements",
|
||||
"id",
|
||||
@@ -63,14 +57,8 @@ def downgrade() -> None:
|
||||
nullable=False,
|
||||
existing_server_default=None,
|
||||
)
|
||||
op.drop_constraint(
|
||||
constraint_name="PRIMARY", table_name="lazer_user_achievements", type_="primary"
|
||||
)
|
||||
op.drop_constraint(constraint_name="PRIMARY", table_name="lazer_user_achievements", type_="primary")
|
||||
op.drop_constraint("uq_user_achievement", "lazer_user_achievements", type_="unique")
|
||||
op.drop_index(
|
||||
"ix_lazer_user_achievements_achievement_id", "lazer_user_achievements"
|
||||
)
|
||||
op.create_primary_key(
|
||||
"PRIMARY", "lazer_user_achievements", ["id", "achievement_id"]
|
||||
)
|
||||
op.drop_index("ix_lazer_user_achievements_achievement_id", "lazer_user_achievements")
|
||||
op.create_primary_key("PRIMARY", "lazer_user_achievements", ["id", "achievement_id"])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
@@ -48,9 +48,7 @@ def upgrade() -> None:
|
||||
existing_type=mysql.ENUM("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP"),
|
||||
nullable=False,
|
||||
)
|
||||
op.alter_column(
|
||||
"monthly_playcounts", "count", existing_type=mysql.INTEGER(), nullable=False
|
||||
)
|
||||
op.alter_column("monthly_playcounts", "count", existing_type=mysql.INTEGER(), nullable=False)
|
||||
op.alter_column(
|
||||
"score_tokens",
|
||||
"ruleset_id",
|
||||
@@ -107,9 +105,7 @@ def downgrade() -> None:
|
||||
existing_type=mysql.ENUM("OSU", "TAIKO", "FRUITS", "MANIA", "OSURX", "OSUAP"),
|
||||
nullable=True,
|
||||
)
|
||||
op.alter_column(
|
||||
"monthly_playcounts", "count", existing_type=mysql.INTEGER(), nullable=True
|
||||
)
|
||||
op.alter_column("monthly_playcounts", "count", existing_type=mysql.INTEGER(), nullable=True)
|
||||
op.alter_column(
|
||||
"lazer_users",
|
||||
"playmode",
|
||||
|
||||
@@ -114,15 +114,11 @@ def upgrade() -> None:
|
||||
sa.Column("nominations_current", sa.Integer(), nullable=False),
|
||||
sa.Column("hype_current", sa.Integer(), nullable=False),
|
||||
sa.Column("hype_required", sa.Integer(), nullable=False),
|
||||
sa.Column(
|
||||
"availability_info", sqlmodel.sql.sqltypes.AutoString(), nullable=True
|
||||
),
|
||||
sa.Column("availability_info", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column("download_disabled", sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_beatmapsets_artist"), "beatmapsets", ["artist"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_beatmapsets_artist"), "beatmapsets", ["artist"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_beatmapsets_artist_unicode"),
|
||||
"beatmapsets",
|
||||
@@ -133,18 +129,14 @@ def upgrade() -> None:
|
||||
op.create_table(
|
||||
"lazer_users",
|
||||
sa.Column("avatar_url", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column(
|
||||
"country_code", sqlmodel.sql.sqltypes.AutoString(length=2), nullable=False
|
||||
),
|
||||
sa.Column("country_code", sqlmodel.sql.sqltypes.AutoString(length=2), nullable=False),
|
||||
sa.Column("is_active", sa.Boolean(), nullable=False),
|
||||
sa.Column("is_bot", sa.Boolean(), nullable=False),
|
||||
sa.Column("is_supporter", sa.Boolean(), nullable=False),
|
||||
sa.Column("last_visit", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("pm_friends_only", sa.Boolean(), nullable=False),
|
||||
sa.Column("profile_colour", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column(
|
||||
"username", sqlmodel.sql.sqltypes.AutoString(length=32), nullable=False
|
||||
),
|
||||
sa.Column("username", sqlmodel.sql.sqltypes.AutoString(length=32), nullable=False),
|
||||
sa.Column("page", sa.JSON(), nullable=True),
|
||||
sa.Column("previous_usernames", sa.JSON(), nullable=True),
|
||||
sa.Column("support_level", sa.Integer(), nullable=False),
|
||||
@@ -179,13 +171,9 @@ def upgrade() -> None:
|
||||
sa.Column("is_qat", sa.Boolean(), nullable=False),
|
||||
sa.Column("is_bng", sa.Boolean(), nullable=False),
|
||||
sa.Column("id", sa.BigInteger(), autoincrement=True, nullable=False),
|
||||
sa.Column(
|
||||
"email", sqlmodel.sql.sqltypes.AutoString(length=254), nullable=False
|
||||
),
|
||||
sa.Column("email", sqlmodel.sql.sqltypes.AutoString(length=254), nullable=False),
|
||||
sa.Column("priv", sa.Integer(), nullable=False),
|
||||
sa.Column(
|
||||
"pw_bcrypt", sqlmodel.sql.sqltypes.AutoString(length=60), nullable=False
|
||||
),
|
||||
sa.Column("pw_bcrypt", sqlmodel.sql.sqltypes.AutoString(length=60), nullable=False),
|
||||
sa.Column("silence_end_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column("donor_end_at", sa.DateTime(timezone=True), nullable=True),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
@@ -198,19 +186,13 @@ def upgrade() -> None:
|
||||
)
|
||||
op.create_index(op.f("ix_lazer_users_email"), "lazer_users", ["email"], unique=True)
|
||||
op.create_index(op.f("ix_lazer_users_id"), "lazer_users", ["id"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_lazer_users_username"), "lazer_users", ["username"], unique=True
|
||||
)
|
||||
op.create_index(op.f("ix_lazer_users_username"), "lazer_users", ["username"], unique=True)
|
||||
op.create_table(
|
||||
"teams",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(length=100), nullable=False),
|
||||
sa.Column(
|
||||
"short_name", sqlmodel.sql.sqltypes.AutoString(length=10), nullable=False
|
||||
),
|
||||
sa.Column(
|
||||
"flag_url", sqlmodel.sql.sqltypes.AutoString(length=500), nullable=True
|
||||
),
|
||||
sa.Column("short_name", sqlmodel.sql.sqltypes.AutoString(length=10), nullable=False),
|
||||
sa.Column("flag_url", sqlmodel.sql.sqltypes.AutoString(length=500), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=True),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
@@ -263,12 +245,8 @@ def upgrade() -> None:
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_beatmaps_beatmapset_id"), "beatmaps", ["beatmapset_id"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_beatmaps_checksum"), "beatmaps", ["checksum"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_beatmaps_beatmapset_id"), "beatmaps", ["beatmapset_id"], unique=False)
|
||||
op.create_index(op.f("ix_beatmaps_checksum"), "beatmaps", ["checksum"], unique=False)
|
||||
op.create_index(op.f("ix_beatmaps_id"), "beatmaps", ["id"], unique=False)
|
||||
op.create_table(
|
||||
"daily_challenge_stats",
|
||||
@@ -409,27 +387,19 @@ def upgrade() -> None:
|
||||
["user_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_monthly_playcounts_year"), "monthly_playcounts", ["year"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_monthly_playcounts_year"), "monthly_playcounts", ["year"], unique=False)
|
||||
op.create_table(
|
||||
"oauth_tokens",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("user_id", sa.BigInteger(), nullable=True),
|
||||
sa.Column(
|
||||
"access_token", sqlmodel.sql.sqltypes.AutoString(length=500), nullable=False
|
||||
),
|
||||
sa.Column("access_token", sqlmodel.sql.sqltypes.AutoString(length=500), nullable=False),
|
||||
sa.Column(
|
||||
"refresh_token",
|
||||
sqlmodel.sql.sqltypes.AutoString(length=500),
|
||||
nullable=False,
|
||||
),
|
||||
sa.Column(
|
||||
"token_type", sqlmodel.sql.sqltypes.AutoString(length=20), nullable=False
|
||||
),
|
||||
sa.Column(
|
||||
"scope", sqlmodel.sql.sqltypes.AutoString(length=100), nullable=False
|
||||
),
|
||||
sa.Column("token_type", sqlmodel.sql.sqltypes.AutoString(length=20), nullable=False),
|
||||
sa.Column("scope", sqlmodel.sql.sqltypes.AutoString(length=100), nullable=False),
|
||||
sa.Column("expires_at", sa.DateTime(), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=True),
|
||||
sa.ForeignKeyConstraint(
|
||||
@@ -441,17 +411,13 @@ def upgrade() -> None:
|
||||
sa.UniqueConstraint("refresh_token"),
|
||||
)
|
||||
op.create_index(op.f("ix_oauth_tokens_id"), "oauth_tokens", ["id"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_oauth_tokens_user_id"), "oauth_tokens", ["user_id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_oauth_tokens_user_id"), "oauth_tokens", ["user_id"], unique=False)
|
||||
op.create_table(
|
||||
"relationship",
|
||||
sa.Column("id", sa.BigInteger(), autoincrement=True, nullable=False),
|
||||
sa.Column("user_id", sa.BigInteger(), nullable=True),
|
||||
sa.Column("target_id", sa.BigInteger(), nullable=True),
|
||||
sa.Column(
|
||||
"type", sa.Enum("FOLLOW", "BLOCK", name="relationshiptype"), nullable=False
|
||||
),
|
||||
sa.Column("type", sa.Enum("FOLLOW", "BLOCK", name="relationshiptype"), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["target_id"],
|
||||
["lazer_users.id"],
|
||||
@@ -462,12 +428,8 @@ def upgrade() -> None:
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_relationship_target_id"), "relationship", ["target_id"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_relationship_user_id"), "relationship", ["user_id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_relationship_target_id"), "relationship", ["target_id"], unique=False)
|
||||
op.create_index(op.f("ix_relationship_user_id"), "relationship", ["user_id"], unique=False)
|
||||
op.create_table(
|
||||
"rooms",
|
||||
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
@@ -495,16 +457,12 @@ def upgrade() -> None:
|
||||
),
|
||||
sa.Column(
|
||||
"queue_mode",
|
||||
sa.Enum(
|
||||
"HOST_ONLY", "ALL_PLAYERS", "ALL_PLAYERS_ROUND_ROBIN", name="queuemode"
|
||||
),
|
||||
sa.Enum("HOST_ONLY", "ALL_PLAYERS", "ALL_PLAYERS_ROUND_ROBIN", name="queuemode"),
|
||||
nullable=False,
|
||||
),
|
||||
sa.Column("auto_skip", sa.Boolean(), nullable=False),
|
||||
sa.Column("auto_start_duration", sa.Integer(), nullable=False),
|
||||
sa.Column(
|
||||
"status", sa.Enum("IDLE", "PLAYING", name="roomstatus"), nullable=False
|
||||
),
|
||||
sa.Column("status", sa.Enum("IDLE", "PLAYING", name="roomstatus"), nullable=False),
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("host_id", sa.BigInteger(), nullable=True),
|
||||
sa.ForeignKeyConstraint(
|
||||
@@ -559,9 +517,7 @@ def upgrade() -> None:
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_user_account_history_id"), "user_account_history", ["id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_user_account_history_id"), "user_account_history", ["id"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_user_account_history_user_id"),
|
||||
"user_account_history",
|
||||
@@ -654,9 +610,7 @@ def upgrade() -> None:
|
||||
["event_type"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_multiplayer_events_id"), "multiplayer_events", ["id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_multiplayer_events_id"), "multiplayer_events", ["id"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_multiplayer_events_room_id"),
|
||||
"multiplayer_events",
|
||||
@@ -714,12 +668,8 @@ def upgrade() -> None:
|
||||
),
|
||||
sa.PrimaryKeyConstraint("db_id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_room_playlists_db_id"), "room_playlists", ["db_id"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_room_playlists_id"), "room_playlists", ["id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_room_playlists_db_id"), "room_playlists", ["db_id"], unique=False)
|
||||
op.create_index(op.f("ix_room_playlists_id"), "room_playlists", ["id"], unique=False)
|
||||
op.create_table(
|
||||
"score_tokens",
|
||||
sa.Column("score_id", sa.BigInteger(), nullable=True),
|
||||
@@ -754,9 +704,7 @@ def upgrade() -> None:
|
||||
op.create_table(
|
||||
"scores",
|
||||
sa.Column("accuracy", sa.Float(), nullable=False),
|
||||
sa.Column(
|
||||
"map_md5", sqlmodel.sql.sqltypes.AutoString(length=32), nullable=False
|
||||
),
|
||||
sa.Column("map_md5", sqlmodel.sql.sqltypes.AutoString(length=32), nullable=False),
|
||||
sa.Column("build_id", sa.Integer(), nullable=True),
|
||||
sa.Column("classic_total_score", sa.BigInteger(), nullable=True),
|
||||
sa.Column("ended_at", sa.DateTime(), nullable=True),
|
||||
@@ -805,9 +753,7 @@ def upgrade() -> None:
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_scores_beatmap_id"), "scores", ["beatmap_id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_scores_beatmap_id"), "scores", ["beatmap_id"], unique=False)
|
||||
op.create_index(op.f("ix_scores_gamemode"), "scores", ["gamemode"], unique=False)
|
||||
op.create_index(op.f("ix_scores_map_md5"), "scores", ["map_md5"], unique=False)
|
||||
op.create_index(op.f("ix_scores_user_id"), "scores", ["user_id"], unique=False)
|
||||
@@ -837,15 +783,9 @@ def upgrade() -> None:
|
||||
),
|
||||
sa.PrimaryKeyConstraint("score_id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_best_scores_beatmap_id"), "best_scores", ["beatmap_id"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_best_scores_gamemode"), "best_scores", ["gamemode"], unique=False
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_best_scores_user_id"), "best_scores", ["user_id"], unique=False
|
||||
)
|
||||
op.create_index(op.f("ix_best_scores_beatmap_id"), "best_scores", ["beatmap_id"], unique=False)
|
||||
op.create_index(op.f("ix_best_scores_gamemode"), "best_scores", ["gamemode"], unique=False)
|
||||
op.create_index(op.f("ix_best_scores_user_id"), "best_scores", ["user_id"], unique=False)
|
||||
op.create_table(
|
||||
"playlist_best_scores",
|
||||
sa.Column("user_id", sa.BigInteger(), nullable=True),
|
||||
@@ -945,9 +885,7 @@ def upgrade() -> None:
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(
|
||||
op.f("ix_total_score_best_scores_user_id"), table_name="total_score_best_scores"
|
||||
)
|
||||
op.drop_index(op.f("ix_total_score_best_scores_user_id"), table_name="total_score_best_scores")
|
||||
op.drop_index(
|
||||
op.f("ix_total_score_best_scores_gamemode"),
|
||||
table_name="total_score_best_scores",
|
||||
@@ -957,15 +895,9 @@ def downgrade() -> None:
|
||||
table_name="total_score_best_scores",
|
||||
)
|
||||
op.drop_table("total_score_best_scores")
|
||||
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_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_best_scores_user_id"), table_name="best_scores")
|
||||
op.drop_index(op.f("ix_best_scores_gamemode"), table_name="best_scores")
|
||||
@@ -983,34 +915,18 @@ def downgrade() -> None:
|
||||
op.drop_index(op.f("ix_room_playlists_db_id"), table_name="room_playlists")
|
||||
op.drop_table("room_playlists")
|
||||
op.drop_table("room_participated_users")
|
||||
op.drop_index(
|
||||
op.f("ix_multiplayer_events_user_id"), table_name="multiplayer_events"
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_multiplayer_events_room_id"), table_name="multiplayer_events"
|
||||
)
|
||||
op.drop_index(op.f("ix_multiplayer_events_user_id"), table_name="multiplayer_events")
|
||||
op.drop_index(op.f("ix_multiplayer_events_room_id"), table_name="multiplayer_events")
|
||||
op.drop_index(op.f("ix_multiplayer_events_id"), table_name="multiplayer_events")
|
||||
op.drop_index(
|
||||
op.f("ix_multiplayer_events_event_type"), table_name="multiplayer_events"
|
||||
)
|
||||
op.drop_index(op.f("ix_multiplayer_events_event_type"), table_name="multiplayer_events")
|
||||
op.drop_table("multiplayer_events")
|
||||
op.drop_index(
|
||||
op.f("ix_item_attempts_count_user_id"), table_name="item_attempts_count"
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_item_attempts_count_room_id"), table_name="item_attempts_count"
|
||||
)
|
||||
op.drop_index(op.f("ix_item_attempts_count_user_id"), table_name="item_attempts_count")
|
||||
op.drop_index(op.f("ix_item_attempts_count_room_id"), table_name="item_attempts_count")
|
||||
op.drop_table("item_attempts_count")
|
||||
op.drop_index(
|
||||
op.f("ix_beatmap_playcounts_user_id"), table_name="beatmap_playcounts"
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_beatmap_playcounts_beatmap_id"), table_name="beatmap_playcounts"
|
||||
)
|
||||
op.drop_index(op.f("ix_beatmap_playcounts_user_id"), table_name="beatmap_playcounts")
|
||||
op.drop_index(op.f("ix_beatmap_playcounts_beatmap_id"), table_name="beatmap_playcounts")
|
||||
op.drop_table("beatmap_playcounts")
|
||||
op.drop_index(
|
||||
op.f("ix_user_account_history_user_id"), table_name="user_account_history"
|
||||
)
|
||||
op.drop_index(op.f("ix_user_account_history_user_id"), table_name="user_account_history")
|
||||
op.drop_index(op.f("ix_user_account_history_id"), table_name="user_account_history")
|
||||
op.drop_table("user_account_history")
|
||||
op.drop_index(op.f("ix_team_members_id"), table_name="team_members")
|
||||
@@ -1027,29 +943,17 @@ def downgrade() -> None:
|
||||
op.drop_index(op.f("ix_oauth_tokens_id"), table_name="oauth_tokens")
|
||||
op.drop_table("oauth_tokens")
|
||||
op.drop_index(op.f("ix_monthly_playcounts_year"), table_name="monthly_playcounts")
|
||||
op.drop_index(
|
||||
op.f("ix_monthly_playcounts_user_id"), table_name="monthly_playcounts"
|
||||
)
|
||||
op.drop_index(op.f("ix_monthly_playcounts_user_id"), table_name="monthly_playcounts")
|
||||
op.drop_index(op.f("ix_monthly_playcounts_month"), table_name="monthly_playcounts")
|
||||
op.drop_table("monthly_playcounts")
|
||||
op.drop_index(
|
||||
op.f("ix_lazer_user_statistics_user_id"), table_name="lazer_user_statistics"
|
||||
)
|
||||
op.drop_index(op.f("ix_lazer_user_statistics_user_id"), table_name="lazer_user_statistics")
|
||||
op.drop_table("lazer_user_statistics")
|
||||
op.drop_index(
|
||||
op.f("ix_lazer_user_achievements_id"), table_name="lazer_user_achievements"
|
||||
)
|
||||
op.drop_index(op.f("ix_lazer_user_achievements_id"), table_name="lazer_user_achievements")
|
||||
op.drop_table("lazer_user_achievements")
|
||||
op.drop_index(
|
||||
op.f("ix_favourite_beatmapset_user_id"), table_name="favourite_beatmapset"
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_favourite_beatmapset_beatmapset_id"), table_name="favourite_beatmapset"
|
||||
)
|
||||
op.drop_index(op.f("ix_favourite_beatmapset_user_id"), table_name="favourite_beatmapset")
|
||||
op.drop_index(op.f("ix_favourite_beatmapset_beatmapset_id"), table_name="favourite_beatmapset")
|
||||
op.drop_table("favourite_beatmapset")
|
||||
op.drop_index(
|
||||
op.f("ix_daily_challenge_stats_user_id"), table_name="daily_challenge_stats"
|
||||
)
|
||||
op.drop_index(op.f("ix_daily_challenge_stats_user_id"), table_name="daily_challenge_stats")
|
||||
op.drop_table("daily_challenge_stats")
|
||||
op.drop_index(op.f("ix_beatmaps_id"), table_name="beatmaps")
|
||||
op.drop_index(op.f("ix_beatmaps_checksum"), table_name="beatmaps")
|
||||
|
||||
Reference in New Issue
Block a user