4 Commits

6 changed files with 130 additions and 6 deletions

View File

@ -1,5 +1,6 @@
from .arcaea import (
ArcaeaLanguage,
ArcaeaLocalizationLanguage,
ArcaeaPlayResultClearType,
ArcaeaPlayResultModifier,
ArcaeaRatingClass,
@ -8,6 +9,7 @@ from .arcaea import (
__all__ = [
"ArcaeaLanguage",
"ArcaeaLocalizationLanguage",
"ArcaeaPlayResultClearType",
"ArcaeaPlayResultModifier",
"ArcaeaRatingClass",

View File

@ -31,6 +31,13 @@ class ArcaeaPlayResultClearType(IntEnum):
EASY_CLEAR = 5
class ArcaeaLocalizationLanguage(Enum):
JA = "ja"
KO = "ko"
ZH_HANT = "zh-Hant"
ZH_HANS = "zh-Hans"
class ArcaeaLanguage(Enum):
EN = "en"
JA = "ja"

View File

@ -11,7 +11,6 @@ from alembic import op
import sqlalchemy as sa
${imports if imports else ""}
# revision identifiers, used by Alembic.
revision: str = ${repr(up_revision)}
down_revision: Union[str, None] = ${repr(down_revision)}
branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}

View File

@ -15,7 +15,6 @@ from alembic import context, op
from arcaea_offline.database.migrations.legacies.v5 import ForceTimezoneDateTime
# revision identifiers, used by Alembic.
revision: str = "0ca6733e40dc"
down_revision: Union[str, None] = "a3f9d48b7de3"
branch_labels: Union[str, Sequence[str], None] = None
@ -27,7 +26,7 @@ def upgrade(
data_migration: bool = True,
data_migration_options: Any = None,
) -> None:
op.create_table(
property_tbl = op.create_table(
"property",
sa.Column("key", sa.String(), nullable=False),
sa.Column("value", sa.String(), nullable=False),
@ -295,6 +294,8 @@ def upgrade(
op.drop_table("scores_old")
op.execute(sa.insert(property_tbl).values(key="version", value="5"))
def downgrade() -> None:
raise NotImplementedError(

View File

@ -1,7 +1,7 @@
"""v1 to v4
Revision ID: a3f9d48b7de3
Revises:
Revises: b7a0accfc17f
Create Date: 2024-11-24 00:03:07.697165
"""
@ -12,9 +12,8 @@ from typing import Mapping, Optional, Sequence, TypedDict, Union
import sqlalchemy as sa
from alembic import context, op
# revision identifiers, used by Alembic.
revision: str = "a3f9d48b7de3"
down_revision: Union[str, None] = None
down_revision: Union[str, None] = "b7a0accfc17f"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
@ -268,6 +267,16 @@ def upgrade(
op.drop_table("scores_old")
op.drop_table("properties", if_exists=True)
properties_tbl = op.create_table(
"properties",
sa.Column("key", sa.TEXT(), nullable=False),
sa.Column("value", sa.TEXT(), nullable=False),
sa.PrimaryKeyConstraint("key", name="pk_properties"),
)
op.execute(sa.insert(properties_tbl).values(key="version", value="4"))
def downgrade() -> None:
raise NotImplementedError(

View File

@ -0,0 +1,106 @@
"""v1
Revision ID: b7a0accfc17f
Revises:
Create Date: 2025-06-05 22:17:13.327742
"""
from typing import Any, Sequence, Union
import sqlalchemy as sa
from alembic import op
revision: str = "b7a0accfc17f"
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade(
*,
data_migration: bool = False,
data_migration_options: Any = None,
) -> None:
op.create_table(
"charts",
sa.Column("song_id", sa.TEXT(), nullable=False),
sa.Column("rating_class", sa.INTEGER(), nullable=False),
sa.Column("name_en", sa.TEXT(), nullable=False),
sa.Column("name_jp", sa.TEXT()),
sa.Column("artist", sa.TEXT(), nullable=False),
sa.Column("bpm", sa.TEXT(), nullable=False),
sa.Column("bpm_base", sa.REAL(), nullable=False),
sa.Column("package_id", sa.TEXT(), nullable=False),
sa.Column("time", sa.INTEGER()),
sa.Column("side", sa.INTEGER(), nullable=False),
sa.Column("world_unlock", sa.BOOLEAN(), nullable=False),
sa.Column("remote_download", sa.BOOLEAN()),
sa.Column("bg", sa.TEXT(), nullable=False),
sa.Column("date", sa.INTEGER(), nullable=False),
sa.Column("version", sa.TEXT(), nullable=False),
sa.Column("difficulty", sa.INTEGER(), nullable=False),
sa.Column("rating", sa.INTEGER(), nullable=False),
sa.Column("note", sa.INTEGER(), nullable=False),
sa.Column("chart_designer", sa.TEXT()),
sa.Column("jacket_designer", sa.TEXT()),
sa.Column("jacket_override", sa.BOOLEAN(), nullable=False),
sa.Column("audio_override", sa.BOOLEAN(), nullable=False),
sa.PrimaryKeyConstraint("song_id", "rating_class", name="pk_charts"),
)
op.create_table(
"aliases",
sa.Column("song_id", sa.TEXT(), nullable=False),
sa.Column("alias", sa.TEXT(), nullable=False),
sa.PrimaryKeyConstraint("song_id", "alias", name="pk_aliases"),
)
op.create_table(
"packages",
sa.Column("package_id", sa.TEXT(), nullable=False),
sa.Column("name", sa.TEXT(), nullable=False),
sa.PrimaryKeyConstraint("package_id", name="pk_packages"),
)
op.create_table(
"scores",
sa.Column("id", sa.INTEGER(), autoincrement=True),
sa.Column("song_id", sa.TEXT(), nullable=False),
sa.Column("rating_class", sa.INTEGER(), nullable=False),
sa.Column("score", sa.INTEGER(), nullable=False),
sa.Column("pure", sa.INTEGER()),
sa.Column("far", sa.INTEGER()),
sa.Column("lost", sa.INTEGER()),
sa.Column("time", sa.INTEGER(), nullable=False),
sa.Column("max_recall", sa.INTEGER()),
sa.Column("clear_type", sa.INTEGER()),
sa.PrimaryKeyConstraint("id", name="pk_scores"),
sa.ForeignKeyConstraint(
["song_id", "rating_class"],
["charts.song_id", "charts.rating_class"],
name="fk_scores_song_id_charts",
onupdate="CASCADE",
ondelete="NO ACTION",
),
)
properties_tbl = op.create_table(
"properties",
sa.Column("key", sa.TEXT(), nullable=False),
sa.Column("value", sa.TEXT(), nullable=False),
# according to the commit history this was a unique constraint
# but i remember sqlalchemy complains if you don't add a primary key
# anyways above tables have modifications like this too
# and nobody actualty uses v1 schema so who cares
sa.PrimaryKeyConstraint("key", name="pk_properties"),
)
# there should be CREATE VIEWs here but im skipping them
# because nobody actually checks this file
op.execute(sa.insert(properties_tbl).values(key="db_version", value="1"))
def downgrade() -> None:
raise NotImplementedError("This is the first revision bro")