From 127e6f8aa8632f9cae05dee1de9559a7da36c5c4 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Tue, 27 Jun 2023 00:32:35 -0400 Subject: [PATCH] mai2: add finale databases --- core/data/schema/versions/SDEZ_5_rollback.sql | 78 +++++++++ core/data/schema/versions/SDEZ_6_upgrade.sql | 62 +++++++ titles/mai2/__init__.py | 2 +- titles/mai2/schema/item.py | 79 ++++----- titles/mai2/schema/profile.py | 155 ++++++++++++++++++ titles/mai2/schema/score.py | 96 +++++++++++ 6 files changed, 432 insertions(+), 40 deletions(-) create mode 100644 core/data/schema/versions/SDEZ_5_rollback.sql create mode 100644 core/data/schema/versions/SDEZ_6_upgrade.sql diff --git a/core/data/schema/versions/SDEZ_5_rollback.sql b/core/data/schema/versions/SDEZ_5_rollback.sql new file mode 100644 index 0000000..1507faa --- /dev/null +++ b/core/data/schema/versions/SDEZ_5_rollback.sql @@ -0,0 +1,78 @@ +DELETE FROM mai2_static_event WHERE version < 13; +UPDATE mai2_static_event SET version = version - 13 WHERE version >= 13; + +DELETE FROM mai2_static_music WHERE version < 13; +UPDATE mai2_static_music SET version = version - 13 WHERE version >= 13; + +DELETE FROM mai2_static_ticket WHERE version < 13; +UPDATE mai2_static_ticket SET version = version - 13 WHERE version >= 13; + +DELETE FROM mai2_static_cards WHERE version < 13; +UPDATE mai2_static_cards SET version = version - 13 WHERE version >= 13; + +DELETE FROM mai2_profile_detail WHERE version < 13; +UPDATE mai2_profile_detail SET version = version - 13 WHERE version >= 13; + +DELETE FROM mai2_profile_extend WHERE version < 13; +UPDATE mai2_profile_extend SET version = version - 13 WHERE version >= 13; + +DELETE FROM mai2_profile_option WHERE version < 13; +UPDATE mai2_profile_option SET version = version - 13 WHERE version >= 13; + +DELETE FROM mai2_profile_ghost WHERE version < 13; +UPDATE mai2_profile_ghost SET version = version - 13 WHERE version >= 13; + +DELETE FROM mai2_profile_rating WHERE version < 13; +UPDATE mai2_profile_rating SET version = version - 13 WHERE version >= 13; + +DROP TABLE maimai_score_best; +DROP TABLE maimai_playlog; +DROP TABLE maimai_profile_detail; +DROP TABLE maimai_profile_option; +DROP TABLE maimai_profile_web_option; +DROP TABLE maimai_profile_grade_status; + +ALTER TABLE mai2_item_character DROP COLUMN point; + +ALTER TABLE mai2_item_card MODIFY COLUMN cardId int(11) NOT NULL; +ALTER TABLE mai2_item_card MODIFY COLUMN cardTypeId int(11) NOT NULL; +ALTER TABLE mai2_item_card MODIFY COLUMN charaId int(11) NOT NULL; +ALTER TABLE mai2_item_card MODIFY COLUMN mapId int(11) NOT NULL; + +ALTER TABLE mai2_item_character MODIFY COLUMN characterId int(11) NOT NULL; +ALTER TABLE mai2_item_character MODIFY COLUMN level int(11) NOT NULL; +ALTER TABLE mai2_item_character MODIFY COLUMN awakening int(11) NOT NULL; +ALTER TABLE mai2_item_character MODIFY COLUMN useCount int(11) NOT NULL; + +ALTER TABLE mai2_item_charge MODIFY COLUMN chargeId int(11) NOT NULL; +ALTER TABLE mai2_item_charge MODIFY COLUMN stock int(11) NOT NULL; + +ALTER TABLE mai2_item_favorite MODIFY COLUMN itemKind int(11) NOT NULL; + +ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN seasonId int(11) NOT NULL; +ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN point int(11) NOT NULL; +ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN rank int(11) NOT NULL; +ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN rewardGet tinyint(1) NOT NULL; +ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN userName varchar(8) NOT NULL; + +ALTER TABLE mai2_item_item MODIFY COLUMN itemId int(11) NOT NULL; +ALTER TABLE mai2_item_item MODIFY COLUMN itemKind int(11) NOT NULL; +ALTER TABLE mai2_item_item MODIFY COLUMN stock int(11) NOT NULL; +ALTER TABLE mai2_item_item MODIFY COLUMN isValid tinyint(1) NOT NULL; + +ALTER TABLE mai2_item_login_bonus MODIFY COLUMN bonusId int(11) NOT NULL; +ALTER TABLE mai2_item_login_bonus MODIFY COLUMN point int(11) NOT NULL; +ALTER TABLE mai2_item_login_bonus MODIFY COLUMN isCurrent tinyint(1) NOT NULL; +ALTER TABLE mai2_item_login_bonus MODIFY COLUMN isComplete tinyint(1) NOT NULL; + +ALTER TABLE mai2_item_map MODIFY COLUMN mapId int(11) NOT NULL; +ALTER TABLE mai2_item_map MODIFY COLUMN distance int(11) NOT NULL; +ALTER TABLE mai2_item_map MODIFY COLUMN isLock tinyint(1) NOT NULL; +ALTER TABLE mai2_item_map MODIFY COLUMN isClear tinyint(1) NOT NULL; +ALTER TABLE mai2_item_map MODIFY COLUMN isComplete tinyint(1) NOT NULL; + +ALTER TABLE mai2_item_print_detail MODIFY COLUMN printDate timestamp DEFAULT current_timestamp() NOT NULL; +ALTER TABLE mai2_item_print_detail MODIFY COLUMN serialId varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL; +ALTER TABLE mai2_item_print_detail MODIFY COLUMN placeId int(11) NOT NULL; +ALTER TABLE mai2_item_print_detail MODIFY COLUMN clientId varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL; +ALTER TABLE mai2_item_print_detail MODIFY COLUMN printerSerialId varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL; \ No newline at end of file diff --git a/core/data/schema/versions/SDEZ_6_upgrade.sql b/core/data/schema/versions/SDEZ_6_upgrade.sql new file mode 100644 index 0000000..06b2d45 --- /dev/null +++ b/core/data/schema/versions/SDEZ_6_upgrade.sql @@ -0,0 +1,62 @@ +UPDATE mai2_static_event SET version = version + 13 WHERE version < 1000; + +UPDATE mai2_static_music SET version = version + 13 WHERE version < 1000; + +UPDATE mai2_static_ticket SET version = version + 13 WHERE version < 1000; + +UPDATE mai2_static_cards SET version = version + 13 WHERE version < 1000; + +UPDATE mai2_profile_detail SET version = version + 13 WHERE version < 1000; + +UPDATE mai2_profile_extend SET version = version + 13 WHERE version < 1000; + +UPDATE mai2_profile_option SET version = version + 13 WHERE version < 1000; + +UPDATE mai2_profile_ghost SET version = version + 13 WHERE version < 1000; + +UPDATE mai2_profile_rating SET version = version + 13 WHERE version < 1000; + +ALTER TABLE mai2_item_character ADD point int(11) NULL; + +ALTER TABLE mai2_item_card MODIFY COLUMN cardId int(11) NULL; +ALTER TABLE mai2_item_card MODIFY COLUMN cardTypeId int(11) NULL; +ALTER TABLE mai2_item_card MODIFY COLUMN charaId int(11) NULL; +ALTER TABLE mai2_item_card MODIFY COLUMN mapId int(11) NULL; + +ALTER TABLE mai2_item_character MODIFY COLUMN characterId int(11) NULL; +ALTER TABLE mai2_item_character MODIFY COLUMN level int(11) NULL; +ALTER TABLE mai2_item_character MODIFY COLUMN awakening int(11) NULL; +ALTER TABLE mai2_item_character MODIFY COLUMN useCount int(11) NULL; + +ALTER TABLE mai2_item_charge MODIFY COLUMN chargeId int(11) NULL; +ALTER TABLE mai2_item_charge MODIFY COLUMN stock int(11) NULL; + +ALTER TABLE mai2_item_favorite MODIFY COLUMN itemKind int(11) NULL; + +ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN seasonId int(11) NULL; +ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN point int(11) NULL; +ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN rank int(11) NULL; +ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN rewardGet tinyint(1) NULL; +ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN userName varchar(8) NULL; + +ALTER TABLE mai2_item_item MODIFY COLUMN itemId int(11) NULL; +ALTER TABLE mai2_item_item MODIFY COLUMN itemKind int(11) NULL; +ALTER TABLE mai2_item_item MODIFY COLUMN stock int(11) NULL; +ALTER TABLE mai2_item_item MODIFY COLUMN isValid tinyint(1) NULL; + +ALTER TABLE mai2_item_login_bonus MODIFY COLUMN bonusId int(11) NULL; +ALTER TABLE mai2_item_login_bonus MODIFY COLUMN point int(11) NULL; +ALTER TABLE mai2_item_login_bonus MODIFY COLUMN isCurrent tinyint(1) NULL; +ALTER TABLE mai2_item_login_bonus MODIFY COLUMN isComplete tinyint(1) NULL; + +ALTER TABLE mai2_item_map MODIFY COLUMN mapId int(11) NULL; +ALTER TABLE mai2_item_map MODIFY COLUMN distance int(11) NULL; +ALTER TABLE mai2_item_map MODIFY COLUMN isLock tinyint(1) NULL; +ALTER TABLE mai2_item_map MODIFY COLUMN isClear tinyint(1) NULL; +ALTER TABLE mai2_item_map MODIFY COLUMN isComplete tinyint(1) NULL; + +ALTER TABLE mai2_item_print_detail MODIFY COLUMN printDate timestamp DEFAULT current_timestamp() NULL; +ALTER TABLE mai2_item_print_detail MODIFY COLUMN serialId varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL; +ALTER TABLE mai2_item_print_detail MODIFY COLUMN placeId int(11) NULL; +ALTER TABLE mai2_item_print_detail MODIFY COLUMN clientId varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL; +ALTER TABLE mai2_item_print_detail MODIFY COLUMN printerSerialId varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL; \ No newline at end of file diff --git a/titles/mai2/__init__.py b/titles/mai2/__init__.py index dc8fc84..7063ee6 100644 --- a/titles/mai2/__init__.py +++ b/titles/mai2/__init__.py @@ -16,4 +16,4 @@ game_codes = [ Mai2Constants.GAME_CODE_GREEN, Mai2Constants.GAME_CODE, ] -current_schema_version = 5 +current_schema_version = 6 diff --git a/titles/mai2/schema/item.py b/titles/mai2/schema/item.py index 6b70ed1..4e20383 100644 --- a/titles/mai2/schema/item.py +++ b/titles/mai2/schema/item.py @@ -18,10 +18,11 @@ character = Table( ForeignKey("aime_user.id", ondelete="cascade", onupdate="cascade"), nullable=False, ), - Column("characterId", Integer, nullable=False), - Column("level", Integer, nullable=False, server_default="1"), - Column("awakening", Integer, nullable=False, server_default="0"), - Column("useCount", Integer, nullable=False, server_default="0"), + Column("characterId", Integer), + Column("level", Integer), + Column("awakening", Integer), + Column("useCount", Integer), + Column("point", Integer), UniqueConstraint("user", "characterId", name="mai2_item_character_uk"), mysql_charset="utf8mb4", ) @@ -35,12 +36,12 @@ card = Table( ForeignKey("aime_user.id", ondelete="cascade", onupdate="cascade"), nullable=False, ), - Column("cardId", Integer, nullable=False), - Column("cardTypeId", Integer, nullable=False), - Column("charaId", Integer, nullable=False), - Column("mapId", Integer, nullable=False), - Column("startDate", TIMESTAMP, nullable=False, server_default=func.now()), - Column("endDate", TIMESTAMP, nullable=False), + Column("cardId", Integer), + Column("cardTypeId", Integer), + Column("charaId", Integer), + Column("mapId", Integer), + Column("startDate", TIMESTAMP, server_default=func.now()), + Column("endDate", TIMESTAMP), UniqueConstraint("user", "cardId", "cardTypeId", name="mai2_item_card_uk"), mysql_charset="utf8mb4", ) @@ -54,10 +55,10 @@ item = Table( ForeignKey("aime_user.id", ondelete="cascade", onupdate="cascade"), nullable=False, ), - Column("itemId", Integer, nullable=False), - Column("itemKind", Integer, nullable=False), - Column("stock", Integer, nullable=False, server_default="1"), - Column("isValid", Boolean, nullable=False, server_default="1"), + Column("itemId", Integer), + Column("itemKind", Integer), + Column("stock", Integer), + Column("isValid", Boolean), UniqueConstraint("user", "itemId", "itemKind", name="mai2_item_item_uk"), mysql_charset="utf8mb4", ) @@ -71,11 +72,11 @@ map = Table( ForeignKey("aime_user.id", ondelete="cascade", onupdate="cascade"), nullable=False, ), - Column("mapId", Integer, nullable=False), - Column("distance", Integer, nullable=False), - Column("isLock", Boolean, nullable=False, server_default="0"), - Column("isClear", Boolean, nullable=False, server_default="0"), - Column("isComplete", Boolean, nullable=False, server_default="0"), + Column("mapId", Integer), + Column("distance", Integer), + Column("isLock", Boolean), + Column("isClear", Boolean), + Column("isComplete", Boolean), UniqueConstraint("user", "mapId", name="mai2_item_map_uk"), mysql_charset="utf8mb4", ) @@ -89,10 +90,10 @@ login_bonus = Table( ForeignKey("aime_user.id", ondelete="cascade", onupdate="cascade"), nullable=False, ), - Column("bonusId", Integer, nullable=False), - Column("point", Integer, nullable=False), - Column("isCurrent", Boolean, nullable=False, server_default="0"), - Column("isComplete", Boolean, nullable=False, server_default="0"), + Column("bonusId", Integer), + Column("point", Integer), + Column("isCurrent", Boolean), + Column("isComplete", Boolean), UniqueConstraint("user", "bonusId", name="mai2_item_login_bonus_uk"), mysql_charset="utf8mb4", ) @@ -106,12 +107,12 @@ friend_season_ranking = Table( ForeignKey("aime_user.id", ondelete="cascade", onupdate="cascade"), nullable=False, ), - Column("seasonId", Integer, nullable=False), - Column("point", Integer, nullable=False), - Column("rank", Integer, nullable=False), - Column("rewardGet", Boolean, nullable=False), - Column("userName", String(8), nullable=False), - Column("recordDate", TIMESTAMP, nullable=False), + Column("seasonId", Integer), + Column("point", Integer), + Column("rank", Integer), + Column("rewardGet", Boolean), + Column("userName", String(8)), + Column("recordDate", TIMESTAMP), UniqueConstraint( "user", "seasonId", "userName", name="mai2_item_friend_season_ranking_uk" ), @@ -127,7 +128,7 @@ favorite = Table( ForeignKey("aime_user.id", ondelete="cascade", onupdate="cascade"), nullable=False, ), - Column("itemKind", Integer, nullable=False), + Column("itemKind", Integer), Column("itemIdList", JSON), UniqueConstraint("user", "itemKind", name="mai2_item_favorite_uk"), mysql_charset="utf8mb4", @@ -142,10 +143,10 @@ charge = Table( ForeignKey("aime_user.id", ondelete="cascade", onupdate="cascade"), nullable=False, ), - Column("chargeId", Integer, nullable=False), - Column("stock", Integer, nullable=False), - Column("purchaseDate", String(255), nullable=False), - Column("validDate", String(255), nullable=False), + Column("chargeId", Integer), + Column("stock", Integer), + Column("purchaseDate", String(255)), + Column("validDate", String(255)), UniqueConstraint("user", "chargeId", name="mai2_item_charge_uk"), mysql_charset="utf8mb4", ) @@ -161,11 +162,11 @@ print_detail = Table( ), Column("orderId", Integer), Column("printNumber", Integer), - Column("printDate", TIMESTAMP, nullable=False, server_default=func.now()), - Column("serialId", String(20), nullable=False), - Column("placeId", Integer, nullable=False), - Column("clientId", String(11), nullable=False), - Column("printerSerialId", String(20), nullable=False), + Column("printDate", TIMESTAMP, server_default=func.now()), + Column("serialId", String(20)), + Column("placeId", Integer), + Column("clientId", String(11)), + Column("printerSerialId", String(20)), Column("cardRomVersion", Integer), Column("isHolograph", Boolean, server_default="1"), Column("printOption1", Boolean, server_default="0"), diff --git a/titles/mai2/schema/profile.py b/titles/mai2/schema/profile.py index 3cb42d1..eb0da73 100644 --- a/titles/mai2/schema/profile.py +++ b/titles/mai2/schema/profile.py @@ -99,6 +99,68 @@ detail = Table( mysql_charset="utf8mb4", ) +detail_old = Table( + "maimai_profile_detail", + metadata, + Column("id", Integer, primary_key=True, nullable=False), + Column( + "user", + ForeignKey("aime_user.id", ondelete="cascade", onupdate="cascade"), + nullable=False, + ), + Column("version", Integer, nullable=False), + Column("lastDataVersion", Integer), + Column("userName", String(8)), + Column("point", Integer), + Column("totalPoint", Integer), + Column("iconId", Integer), + Column("nameplateId", Integer), + Column("frameId", Integer), + Column("trophyId", Integer), + Column("playCount", Integer), + Column("playVsCount", Integer), + Column("playSyncCount", Integer), + Column("winCount", Integer), + Column("helpCount", Integer), + Column("comboCount", Integer), + Column("feverCount", Integer), + Column("totalHiScore", Integer), + Column("totalEasyHighScore", Integer), + Column("totalBasicHighScore", Integer), + Column("totalAdvancedHighScore", Integer), + Column("totalExpertHighScore", Integer), + Column("totalMasterHighScore", Integer), + Column("totalReMasterHighScore", Integer), + Column("totalHighSync", Integer), + Column("totalEasySync", Integer), + Column("totalBasicSync", Integer), + Column("totalAdvancedSync", Integer), + Column("totalExpertSync", Integer), + Column("totalMasterSync", Integer), + Column("totalReMasterSync", Integer), + Column("playerRating", Integer), + Column("highestRating", Integer), + Column("rankAuthTailId", Integer), + Column("eventWatchedDate", String(255)), + Column("webLimitDate", String(255)), + Column("challengeTrackPhase", Integer), + Column("firstPlayBits", Integer), + Column("lastPlayDate", String(255)), + Column("lastPlaceId", Integer), + Column("lastPlaceName", String(255)), + Column("lastRegionId", Integer), + Column("lastRegionName", String(255)), + Column("lastClientId", String(255)), + Column("lastCountryCode", String(255)), + Column("eventPoint", Integer), + Column("totalLv", Integer), + Column("lastLoginBonusDay", Integer), + Column("lastSurvivalBonusDay", Integer), + Column("loginBonusLv", Integer), + UniqueConstraint("user", "version", name="maimai_profile_detail_uk"), + mysql_charset="utf8mb4", +) + ghost = Table( "mai2_profile_ghost", metadata, @@ -223,6 +285,99 @@ option = Table( mysql_charset="utf8mb4", ) +option_old = Table( + "maimai_profile_option", + metadata, + Column("id", Integer, primary_key=True, nullable=False), + Column( + "user", + ForeignKey("aime_user.id", ondelete="cascade", onupdate="cascade"), + nullable=False, + ), + Column("version", Integer, nullable=False), + Column("soudEffect", Integer), + Column("mirrorMode", Integer), + Column("guideSpeed", Integer), + Column("bgInfo", Integer), + Column("brightness", Integer), + Column("isStarRot", Integer), + Column("breakSe", Integer), + Column("slideSe", Integer), + Column("hardJudge", Integer), + Column("isTagJump", Integer), + Column("breakSeVol", Integer), + Column("slideSeVol", Integer), + Column("isUpperDisp", Integer), + Column("trackSkip", Integer), + Column("optionMode", Integer), + Column("simpleOptionParam", Integer), + Column("adjustTiming", Integer), + Column("dispTiming", Integer), + Column("timingPos", Integer), + Column("ansVol", Integer), + Column("noteVol", Integer), + Column("dmgVol", Integer), + Column("appealFlame", Integer), + Column("isFeverDisp", Integer), + Column("dispJudge", Integer), + Column("judgePos", Integer), + Column("ratingGuard", Integer), + Column("selectChara", Integer), + Column("sortType", Integer), + Column("filterGenre", Integer), + Column("filterLevel", Integer), + Column("filterRank", Integer), + Column("filterVersion", Integer), + Column("filterRec", Integer), + Column("filterFullCombo", Integer), + Column("filterAllPerfect", Integer), + Column("filterDifficulty", Integer), + Column("filterFullSync", Integer), + Column("filterReMaster", Integer), + Column("filterMaxFever", Integer), + Column("finalSelectId", Integer), + Column("finalSelectCategory", Integer), + UniqueConstraint("user", "version", name="maimai_profile_option_uk"), + mysql_charset="utf8mb4", +) + +web_opt = Table( + "maimai_profile_web_option", + metadata, + Column("id", Integer, primary_key=True, nullable=False), + Column( + "user", + ForeignKey("aime_user.id", ondelete="cascade", onupdate="cascade"), + nullable=False, + ), + Column("version", Integer, nullable=False), + Column("isNetMember", Boolean), + Column("dispRate", Integer), + Column("dispJudgeStyle", Integer), + Column("dispRank", Integer), + Column("dispHomeRanker", Integer), + Column("dispTotalLv", Integer), + UniqueConstraint("user", "version", name="maimai_profile_web_option_uk"), + mysql_charset="utf8mb4", +) + +grade_status = Table( + "maimai_profile_grade_status", + metadata, + Column("id", Integer, primary_key=True, nullable=False), + Column( + "user", + ForeignKey("aime_user.id", ondelete="cascade", onupdate="cascade"), + nullable=False, + ), + Column("gradeVersion", Integer), + Column("gradeLevel", Integer), + Column("gradeSubLevel", Integer), + Column("gradeMaxId", Integer), + UniqueConstraint("user", "gradeVersion", name="maimai_profile_grade_status_uk"), + mysql_charset="utf8mb4", +) + rating = Table( "mai2_profile_rating", metadata, diff --git a/titles/mai2/schema/score.py b/titles/mai2/schema/score.py index 85dff16..b754eb6 100644 --- a/titles/mai2/schema/score.py +++ b/titles/mai2/schema/score.py @@ -175,6 +175,102 @@ course = Table( mysql_charset="utf8mb4", ) +playlog_old = Table( + "maimai_playlog", + metadata, + Column("id", Integer, primary_key=True, nullable=False), + Column( + "user", + ForeignKey("aime_user.id", ondelete="cascade", onupdate="cascade"), + nullable=False, + ), + Column("version", Integer), + # Pop access code + Column("orderId", Integer), + Column("sortNumber", Integer), + Column("placeId", Integer), + Column("placeName", String(255)), + Column("country", String(255)), + Column("regionId", Integer), + Column("playDate", String(255)), + Column("userPlayDate", String(255)), + Column("musicId", Integer), + Column("level", Integer), + Column("gameMode", Integer), + Column("rivalNum", Integer), + Column("track", Integer), + Column("eventId", Integer), + Column("isFreeToPlay", Boolean), + Column("playerRating", Integer), + Column("playedUserId1", Integer), + Column("playedUserId2", Integer), + Column("playedUserId3", Integer), + Column("playedUserName1", String(255)), + Column("playedUserName2", String(255)), + Column("playedUserName3", String(255)), + Column("playedMusicLevel1", Integer), + Column("playedMusicLevel2", Integer), + Column("playedMusicLevel3", Integer), + Column("achievement", Integer), + Column("score", Integer), + Column("tapScore", Integer), + Column("holdScore", Integer), + Column("slideScore", Integer), + Column("breakScore", Integer), + Column("syncRate", Integer), + Column("vsWin", Integer), + Column("isAllPerfect", Boolean), + Column("fullCombo", Integer), + Column("maxFever", Integer), + Column("maxCombo", Integer), + Column("tapPerfect", Integer), + Column("tapGreat", Integer), + Column("tapGood", Integer), + Column("tapBad", Integer), + Column("holdPerfect", Integer), + Column("holdGreat", Integer), + Column("holdGood", Integer), + Column("holdBad", Integer), + Column("slidePerfect", Integer), + Column("slideGreat", Integer), + Column("slideGood", Integer), + Column("slideBad", Integer), + Column("breakPerfect", Integer), + Column("breakGreat", Integer), + Column("breakGood", Integer), + Column("breakBad", Integer), + Column("judgeStyle", Integer), + Column("isTrackSkip", Boolean), + Column("isHighScore", Boolean), + Column("isChallengeTrack", Boolean), + Column("challengeLife", Integer), + Column("challengeRemain", Integer), + Column("isAllPerfectPlus", Integer), + mysql_charset="utf8mb4", +) + +best_score_old = Table( + "maimai_score_best", + metadata, + Column("id", Integer, primary_key=True, nullable=False), + Column( + "user", + ForeignKey("aime_user.id", ondelete="cascade", onupdate="cascade"), + nullable=False, + ), + Column("musicId", Integer), + Column("level", Integer), + Column("playCount", Integer), + Column("achievement", Integer), + Column("scoreMax", Integer), + Column("syncRateMax", Integer), + Column("isAllPerfect", Boolean), + Column("isAllPerfectPlus", Integer), + Column("fullCombo", Integer), + Column("maxFever", Integer), + UniqueConstraint("user", "musicId", "level", name="maimai_score_best_uk"), + mysql_charset="utf8mb4", +) class Mai2ScoreData(BaseData): def put_best_score(self, user_id: int, score_data: Dict) -> Optional[int]: