forked from Dniel97/artemis
add rollback sql
move GP support to table in DB small fixes
This commit is contained in:
parent
d663b1ef7c
commit
b56a5f020b
22
core/data/schema/versions/SDDT_5_rollback.sql
Normal file
22
core/data/schema/versions/SDDT_5_rollback.sql
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
SET FOREIGN_KEY_CHECKS=0;
|
||||||
|
|
||||||
|
ALTER TABLE ongeki_user_event_point DROP COLUMN version;
|
||||||
|
ALTER TABLE ongeki_user_event_point DROP COLUMN rank;
|
||||||
|
ALTER TABLE ongeki_user_event_point DROP COLUMN type;
|
||||||
|
ALTER TABLE ongeki_user_event_point DROP COLUMN date;
|
||||||
|
|
||||||
|
ALTER TABLE ongeki_user_tech_event DROP COLUMN version;
|
||||||
|
|
||||||
|
ALTER TABLE ongeki_user_mission_point DROP COLUMN version;
|
||||||
|
|
||||||
|
ALTER TABLE ongeki_static_event DROP COLUMN endDate;
|
||||||
|
|
||||||
|
DROP TABLE ongeki_tech_event_ranking;
|
||||||
|
DROP TABLE ongeki_static_music_ranking_list;
|
||||||
|
DROP TABLE ongeki_static_rewards;
|
||||||
|
DROP TABLE ongeki_static_present_list;
|
||||||
|
DROP TABLE ongeki_static_tech_music;
|
||||||
|
DROP TABLE ongeki_static_client_testmode;
|
||||||
|
DROP TABLE ongeki_static_game_point;
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS=1;
|
@ -85,4 +85,14 @@ CREATE TABLE ongeki_static_client_testmode (
|
|||||||
minLeverMovable INT NOT NULL,
|
minLeverMovable INT NOT NULL,
|
||||||
UNIQUE KEY ongeki_static_client_testmode_uk (clientId)
|
UNIQUE KEY ongeki_static_client_testmode_uk (clientId)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE TABLE ongeki_static_game_point (
|
||||||
|
id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
|
||||||
|
type INT NOT NULL,
|
||||||
|
cost INT NOT NULL,
|
||||||
|
startDate VARCHAR(25) NOT NULL DEFAULT "2000-01-01 05:00:00.0",
|
||||||
|
endDate VARCHAR(25) NOT NULL DEFAULT "2099-01-01 05:00:00.0",
|
||||||
|
UNIQUE KEY ongeki_static_game_point_uk (type)
|
||||||
|
);
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS=1;
|
SET FOREIGN_KEY_CHECKS=1;
|
||||||
|
@ -173,49 +173,26 @@ class OngekiBase:
|
|||||||
|
|
||||||
|
|
||||||
def handle_get_game_point_api_request(self, data: Dict) -> Dict:
|
def handle_get_game_point_api_request(self, data: Dict) -> Dict:
|
||||||
"""
|
get_game_point = self.data.static.get_static_game_point()
|
||||||
Sets the GP amount for A and B sets for 1 - 3 credits
|
game_point = []
|
||||||
"""
|
|
||||||
|
if not get_game_point:
|
||||||
|
self.logger.info(f"GP table is empty, inserting defaults")
|
||||||
|
self.data.static.put_static_game_point_defaults()
|
||||||
|
get_game_point = self.data.static.get_static_game_point()
|
||||||
|
for gp in get_game_point:
|
||||||
|
tmp = gp._asdict()
|
||||||
|
game_point.append(tmp)
|
||||||
return {
|
return {
|
||||||
"length": 6,
|
"length": len(game_point),
|
||||||
"gamePointList": [
|
"gamePointList": game_point,
|
||||||
{
|
}
|
||||||
"type": 0,
|
for gp in get_game_point:
|
||||||
"cost": 100,
|
tmp = gp._asdict()
|
||||||
"startDate": "2000-01-01 05:00:00.0",
|
game_point.append(tmp)
|
||||||
"endDate": "2099-01-01 05:00:00.0",
|
return {
|
||||||
},
|
"length": len(game_point),
|
||||||
{
|
"gamePointList": game_point,
|
||||||
"type": 1,
|
|
||||||
"cost": 230,
|
|
||||||
"startDate": "2000-01-01 05:00:00.0",
|
|
||||||
"endDate": "2099-01-01 05:00:00.0",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": 2,
|
|
||||||
"cost": 370,
|
|
||||||
"startDate": "2000-01-01 05:00:00.0",
|
|
||||||
"endDate": "2099-01-01 05:00:00.0",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": 3,
|
|
||||||
"cost": 120,
|
|
||||||
"startDate": "2000-01-01 05:00:00.0",
|
|
||||||
"endDate": "2099-01-01 05:00:00.0",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": 4,
|
|
||||||
"cost": 240,
|
|
||||||
"startDate": "2000-01-01 05:00:00.0",
|
|
||||||
"endDate": "2099-01-01 05:00:00.0",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": 5,
|
|
||||||
"cost": 360,
|
|
||||||
"startDate": "2000-01-01 05:00:00.0",
|
|
||||||
"endDate": "2099-01-01 05:00:00.0",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def handle_game_login_api_request(self, data: Dict) -> Dict:
|
def handle_game_login_api_request(self, data: Dict) -> Dict:
|
||||||
|
@ -134,7 +134,7 @@ present = Table(
|
|||||||
Column("message", String(255)),
|
Column("message", String(255)),
|
||||||
Column("startDate", String(25), nullable=False),
|
Column("startDate", String(25), nullable=False),
|
||||||
Column("endDate", String(25), nullable=False),
|
Column("endDate", String(25), nullable=False),
|
||||||
UniqueConstraint("version", "presentId", "rewardId", name="ongeki_static_present_list_uk"),
|
UniqueConstraint("version", "presentId", name="ongeki_static_present_list_uk"),
|
||||||
mysql_charset="utf8mb4",
|
mysql_charset="utf8mb4",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -174,6 +174,18 @@ client_testmode = Table(
|
|||||||
mysql_charset="utf8mb4",
|
mysql_charset="utf8mb4",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
game_point = Table(
|
||||||
|
"ongeki_static_game_point",
|
||||||
|
metadata,
|
||||||
|
Column("id", Integer, primary_key=True, nullable=False),
|
||||||
|
Column("type", Integer, nullable=False),
|
||||||
|
Column("cost", Integer, nullable=False),
|
||||||
|
Column("startDate", String(25), nullable=False, server_default="2000-01-01 05:00:00.0"),
|
||||||
|
Column("endDate", String(25), nullable=False, server_default="2099-01-01 05:00:00.0"),
|
||||||
|
UniqueConstraint("type", name="ongeki_static_game_point_uk"),
|
||||||
|
mysql_charset="utf8mb4",
|
||||||
|
)
|
||||||
|
|
||||||
class OngekiStaticData(BaseData):
|
class OngekiStaticData(BaseData):
|
||||||
def put_card(self, version: int, card_id: int, **card_data) -> Optional[int]:
|
def put_card(self, version: int, card_id: int, **card_data) -> Optional[int]:
|
||||||
sql = insert(cards).values(version=version, cardId=card_id, **card_data)
|
sql = insert(cards).values(version=version, cardId=card_id, **card_data)
|
||||||
@ -482,3 +494,19 @@ class OngekiStaticData(BaseData):
|
|||||||
self.logger.warning(f"clientId: {clientId} Failed to update ClientSetting data"),
|
self.logger.warning(f"clientId: {clientId} Failed to update ClientSetting data"),
|
||||||
return None
|
return None
|
||||||
return result.lastrowid
|
return result.lastrowid
|
||||||
|
|
||||||
|
def put_static_game_point_defaults(self) -> Optional[List[Dict]]:
|
||||||
|
game_point_defaults = [{"type": 0, "cost": 100},{"type": 1, "cost": 230},{"type": 2, "cost": 370},{"type": 3, "cost": 120},{"type": 4, "cost": 240},{"type": 5, "cost": 360}]
|
||||||
|
sql = insert(game_point).values(game_point_defaults)
|
||||||
|
result = self.execute(sql)
|
||||||
|
if result is None:
|
||||||
|
self.logger.warning(f"Failed to insert default GP table!")
|
||||||
|
return None
|
||||||
|
return result.lastrowid
|
||||||
|
|
||||||
|
def get_static_game_point(self) -> Optional[List[Dict]]:
|
||||||
|
sql = select(game_point.c.type, game_point.c.cost, game_point.c.startDate, game_point.c.endDate)
|
||||||
|
result = self.execute(sql)
|
||||||
|
if result is None:
|
||||||
|
return None
|
||||||
|
return result.fetchall()
|
||||||
|
Loading…
Reference in New Issue
Block a user