[ongeki] Add summer support

pull/1/head
samnyan 2020-08-23 15:27:27 +09:00
parent 428293ccc4
commit 93d80e9439
14 changed files with 517 additions and 2 deletions

View File

@ -27,6 +27,7 @@ public class OngekiController {
private final GetGameRewardHandler getGameRewardHandler;
private final GetGameSettingHandler getGameSettingHandler;
private final GetUserActivityHandler getUserActivityHandler;
private final GetUserBossHandler getUserBossHandler;
private final GetUserBpBaseHandler getUserBpBaseHandler;
private final GetUserCardHandler getUserCardHandler;
private final GetUserChapterHandler getUserChapterHandler;
@ -45,12 +46,14 @@ public class OngekiController {
private final GetUserRatinglogListHandler getUserRatinglogListHandler;
private final GetUserRecentRatingHandler getUserRecentRatingHandler;
private final GetUserRegionHandler getUserRegionHandler;
private final GetUserScenarioHandler getUserScenarioHandler;
private final GetUserStoryHandler getUserStoryHandler;
private final GetUserTechCountHandler getUserTechCountHandler;
private final GetUserTrainingRoomByKeyHandler getUserTrainingRoomByKeyHandler;
private final UpsertUserAllHandler upsertUserAllHandler;
@Autowired
public OngekiController(GetGameEventHandler getGameEventHandler, GetGameIdlistHandler getGameIdlistHandler, GetGameMessageHandler getGameMessageHandler, GetGamePointHandler getGamePointHandler, GetGamePresentHandler getGamePresentHandler, GetGameRankingHandler getGameRankingHandler, GetGameRewardHandler getGameRewardHandler, GetGameSettingHandler getGameSettingHandler, GetUserActivityHandler getUserActivityHandler, GetUserBpBaseHandler getUserBpBaseHandler, GetUserCardHandler getUserCardHandler, GetUserChapterHandler getUserChapterHandler, GetUserCharacterHandler getUserCharacterHandler, GetUserDataHandler getUserDataHandler, GetUserDeckByKeyHandler getUserDeckByKeyHandler, GetUserEventPointHandler getUserEventPointHandler, GetUserEventRankingHandler getUserEventRankingHandler, GetUserItemHandler getUserItemHandler, GetUserLoginBonusHandler getUserLoginBonusHandler, GetUserMissionPointHandler getUserMissionPointHandler, GetUserMusicHandler getUserMusicHandler, GetUserMusicItemHandler getUserMusicItemHandler, GetUserOptionHandler getUserOptionHandler, GetUserPreviewHandler getUserPreviewHandler, GetUserRatinglogListHandler getUserRatinglogListHandler, GetUserRecentRatingHandler getUserRecentRatingHandler, GetUserRegionHandler getUserRegionHandler, GetUserStoryHandler getUserStoryHandler, GetUserTrainingRoomByKeyHandler getUserTrainingRoomByKeyHandler, UpsertUserAllHandler upsertUserAllHandler) {
public OngekiController(GetGameEventHandler getGameEventHandler, GetGameIdlistHandler getGameIdlistHandler, GetGameMessageHandler getGameMessageHandler, GetGamePointHandler getGamePointHandler, GetGamePresentHandler getGamePresentHandler, GetGameRankingHandler getGameRankingHandler, GetGameRewardHandler getGameRewardHandler, GetGameSettingHandler getGameSettingHandler, GetUserActivityHandler getUserActivityHandler, GetUserBossHandler getUserBossHandler, GetUserBpBaseHandler getUserBpBaseHandler, GetUserCardHandler getUserCardHandler, GetUserChapterHandler getUserChapterHandler, GetUserCharacterHandler getUserCharacterHandler, GetUserDataHandler getUserDataHandler, GetUserDeckByKeyHandler getUserDeckByKeyHandler, GetUserEventPointHandler getUserEventPointHandler, GetUserEventRankingHandler getUserEventRankingHandler, GetUserItemHandler getUserItemHandler, GetUserLoginBonusHandler getUserLoginBonusHandler, GetUserMissionPointHandler getUserMissionPointHandler, GetUserMusicHandler getUserMusicHandler, GetUserMusicItemHandler getUserMusicItemHandler, GetUserOptionHandler getUserOptionHandler, GetUserPreviewHandler getUserPreviewHandler, GetUserRatinglogListHandler getUserRatinglogListHandler, GetUserRecentRatingHandler getUserRecentRatingHandler, GetUserRegionHandler getUserRegionHandler, GetUserScenarioHandler getUserScenarioHandler, GetUserStoryHandler getUserStoryHandler, GetUserTechCountHandler getUserTechCountHandler, GetUserTrainingRoomByKeyHandler getUserTrainingRoomByKeyHandler, UpsertUserAllHandler upsertUserAllHandler) {
this.getGameEventHandler = getGameEventHandler;
this.getGameIdlistHandler = getGameIdlistHandler;
this.getGameMessageHandler = getGameMessageHandler;
@ -60,6 +63,7 @@ public class OngekiController {
this.getGameRewardHandler = getGameRewardHandler;
this.getGameSettingHandler = getGameSettingHandler;
this.getUserActivityHandler = getUserActivityHandler;
this.getUserBossHandler = getUserBossHandler;
this.getUserBpBaseHandler = getUserBpBaseHandler;
this.getUserCardHandler = getUserCardHandler;
this.getUserChapterHandler = getUserChapterHandler;
@ -78,7 +82,9 @@ public class OngekiController {
this.getUserRatinglogListHandler = getUserRatinglogListHandler;
this.getUserRecentRatingHandler = getUserRecentRatingHandler;
this.getUserRegionHandler = getUserRegionHandler;
this.getUserScenarioHandler = getUserScenarioHandler;
this.getUserStoryHandler = getUserStoryHandler;
this.getUserTechCountHandler = getUserTechCountHandler;
this.getUserTrainingRoomByKeyHandler = getUserTrainingRoomByKeyHandler;
this.upsertUserAllHandler = upsertUserAllHandler;
}
@ -143,6 +149,11 @@ public class OngekiController {
return getUserActivityHandler.handle(request);
}
@PostMapping("GetUserBossApi")
public String getUserBoss(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserBossHandler.handle(request);
}
@PostMapping("GetUserBpBaseApi")
public String getUserBpBase(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserBpBaseHandler.handle(request);
@ -232,11 +243,21 @@ public class OngekiController {
return getUserRegionHandler.handle(request);
}
@PostMapping("GetUserScenarioApi")
public String getUserScenario(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserScenarioHandler.handle(request);
}
@PostMapping("GetUserStoryApi")
public String getUserStory(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserStoryHandler.handle(request);
}
@PostMapping("GetUserTechCountApi")
public String getUserTechCount(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserTechCountHandler.handle(request);
}
@PostMapping("GetUserTrainingRoomByKeyApi")
public String getUserTrainingRoomByKey(@ModelAttribute Map<String, Object> request) throws JsonProcessingException {
return getUserTrainingRoomByKeyHandler.handle(request);

View File

@ -0,0 +1,21 @@
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserBoss;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiUserBossRepository")
public interface UserBossRepository extends JpaRepository<UserBoss, Long> {
List<UserBoss> findByUser_Card_ExtId(int userId);
Optional<UserBoss> findByUserAndMusicId(UserData user, int musicId);
}

View File

@ -0,0 +1,21 @@
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserScenario;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiUserScenarioRepository")
public interface UserScenarioRepository extends JpaRepository<UserScenario, Long> {
List<UserScenario> findByUser_Card_ExtId(int userId);
Optional<UserScenario> findByUserAndScenarioId(UserData user, int scenarioId);
}

View File

@ -0,0 +1,21 @@
package icu.samnyan.aqua.sega.ongeki.dao.userdata;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserData;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserTechCount;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Repository("OngekiUserTechCountRepository")
public interface UserTechCountRepository extends JpaRepository<UserTechCount, Long> {
List<UserTechCount> findByUser_Card_ExtId(int userId);
Optional<UserTechCount> findByUserAndLevelId(UserData user, int levelId);
}

View File

@ -0,0 +1,52 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserBossRepository;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserBoss;
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserBossHandler")
public class GetUserBossHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserBossHandler.class);
private final BasicMapper mapper;
private final UserBossRepository userBossRepository;
@Autowired
public GetUserBossHandler(BasicMapper mapper, UserBossRepository userBossRepository) {
this.mapper = mapper;
this.userBossRepository = userBossRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
List<UserBoss> userBossList = userBossRepository.findByUser_Card_ExtId(userId);
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", userBossList.size());
resultMap.put("userBossList", userBossList);
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,52 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserScenarioRepository;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserScenario;
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetUserScenarioHandler")
public class GetUserScenarioHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserScenarioHandler.class);
private final BasicMapper mapper;
private final UserScenarioRepository userScenarioRepository;
@Autowired
public GetUserScenarioHandler(BasicMapper mapper, UserScenarioRepository userScenarioRepository) {
this.mapper = mapper;
this.userScenarioRepository = userScenarioRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
List<UserScenario> userScenarioList = userScenarioRepository.findByUser_Card_ExtId(userId);
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", userScenarioList.size());
resultMap.put("userScenarioList", userScenarioList);
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -0,0 +1,52 @@
package icu.samnyan.aqua.sega.ongeki.handler.impl;
import com.fasterxml.jackson.core.JsonProcessingException;
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserTechCountRepository;
import icu.samnyan.aqua.sega.ongeki.handler.BaseHandler;
import icu.samnyan.aqua.sega.ongeki.model.userdata.UserTechCount;
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Component("OngekiGetTechCountHandler")
public class GetUserTechCountHandler implements BaseHandler {
private static final Logger logger = LoggerFactory.getLogger(GetUserTechCountHandler.class);
private final BasicMapper mapper;
private final UserTechCountRepository userTechCountRepository;
@Autowired
public GetUserTechCountHandler(BasicMapper mapper, UserTechCountRepository userTechCountRepository) {
this.mapper = mapper;
this.userTechCountRepository = userTechCountRepository;
}
@Override
public String handle(Map<String, Object> request) throws JsonProcessingException {
Integer userId = (Integer) request.get("userId");
List<UserTechCount> userTechCountList = userTechCountRepository.findByUser_Card_ExtId(userId);
Map<String, Object> resultMap = new LinkedHashMap<>();
resultMap.put("userId", userId);
resultMap.put("length", userTechCountList.size());
resultMap.put("userTechCountList", userTechCountList);
String json = mapper.write(resultMap);
logger.info("Response: " + json);
return json;
}
}

View File

@ -50,10 +50,13 @@ public class UpsertUserAllHandler implements BaseHandler {
private final UserMissionPointRepository userMissionPointRepository;
private final UserTrainingRoomRepository userTrainingRoomRepository;
private final UserGeneralDataRepository userGeneralDataRepository;
private final UserBossRepository userBossRepository;
private final UserScenarioRepository userScenarioRepository;
private final UserTechCountRepository userTechCountRepository;
@Autowired
public UpsertUserAllHandler(BasicMapper mapper,
CardService cardService, UserDataRepository userDataRepository, UserOptionRepository userOptionRepository, UserPlaylogRepository userPlaylogRepository, UserActivityRepository userActivityRepository, UserMusicDetailRepository userMusicDetailRepository, UserCharacterRepository userCharacterRepository, UserCardRepository userCardRepository, UserDeckRepository userDeckRepository, UserStoryRepository userStoryRepository, UserChapterRepository userChapterRepository, UserItemRepository userItemRepository, UserMusicItemRepository userMusicItemRepository, UserLoginBonusRepository userLoginBonusRepository, UserEventPointRepository userEventPointRepository, UserMissionPointRepository userMissionPointRepository, UserTrainingRoomRepository userTrainingRoomRepository, UserGeneralDataRepository userGeneralDataRepository) {
CardService cardService, UserDataRepository userDataRepository, UserOptionRepository userOptionRepository, UserPlaylogRepository userPlaylogRepository, UserActivityRepository userActivityRepository, UserMusicDetailRepository userMusicDetailRepository, UserCharacterRepository userCharacterRepository, UserCardRepository userCardRepository, UserDeckRepository userDeckRepository, UserStoryRepository userStoryRepository, UserChapterRepository userChapterRepository, UserItemRepository userItemRepository, UserMusicItemRepository userMusicItemRepository, UserLoginBonusRepository userLoginBonusRepository, UserEventPointRepository userEventPointRepository, UserMissionPointRepository userMissionPointRepository, UserTrainingRoomRepository userTrainingRoomRepository, UserGeneralDataRepository userGeneralDataRepository, UserBossRepository userBossRepository, UserScenarioRepository userScenarioRepository, UserTechCountRepository userTechCountRepository) {
this.mapper = mapper;
this.cardService = cardService;
this.userDataRepository = userDataRepository;
@ -73,6 +76,9 @@ public class UpsertUserAllHandler implements BaseHandler {
this.userMissionPointRepository = userMissionPointRepository;
this.userTrainingRoomRepository = userTrainingRoomRepository;
this.userGeneralDataRepository = userGeneralDataRepository;
this.userBossRepository = userBossRepository;
this.userScenarioRepository = userScenarioRepository;
this.userTechCountRepository = userTechCountRepository;
}
@Override
@ -393,6 +399,57 @@ public class UpsertUserAllHandler implements BaseHandler {
// UserRatinglogList (For the highest rating of each version)
// UserBossList
List<UserBoss> userBossList = upsertUserAll.getUserBossList();
if (userBossList != null) {
List<UserBoss> newUserBossList = new ArrayList<>();
for (UserBoss newUserBoss : userBossList) {
int musicId = newUserBoss.getMusicId();
Optional<UserBoss> userBossOptional = userBossRepository.findByUserAndMusicId(newUserData, musicId);
UserBoss userBoss = userBossOptional.orElseGet(() -> new UserBoss(newUserData));
newUserBoss.setId(userBoss.getId());
newUserBoss.setUser(userBoss.getUser());
newUserBossList.add(newUserBoss);
}
userBossRepository.saveAll(newUserBossList);
}
// UserTechCountList
List<UserTechCount> userTechCountList = upsertUserAll.getUserTechCountList();
if (userTechCountList != null) {
List<UserTechCount> newUserTechCountList = new ArrayList<>();
for (UserTechCount newUserTechCount : userTechCountList) {
int levelId = newUserTechCount.getLevelId();
Optional<UserTechCount> userTechCountOptional = userTechCountRepository.findByUserAndLevelId(newUserData, levelId);
UserTechCount userTechCount = userTechCountOptional.orElseGet(() -> new UserTechCount(newUserData));
newUserTechCount.setId(userTechCount.getId());
newUserTechCount.setUser(userTechCount.getUser());
newUserTechCountList.add(newUserTechCount);
}
userTechCountRepository.saveAll(newUserTechCountList);
}
// UserScenarioList
List<UserScenario> userScenarioList = upsertUserAll.getUserScenarioList();
if (userScenarioList != null) {
List<UserScenario> newUserScenarioList = new ArrayList<>();
for (UserScenario newUserScenario : userScenarioList) {
int scenarioId = newUserScenario.getScenarioId();
Optional<UserScenario> userScenarioOptional = userScenarioRepository.findByUserAndScenarioId(newUserData, scenarioId);
UserScenario userScenario = userScenarioOptional.orElseGet(() -> new UserScenario(newUserData));
newUserScenario.setId(userScenario.getId());
newUserScenario.setUser(userScenario.getUser());
newUserScenarioList.add(newUserScenario);
}
userScenarioRepository.saveAll(newUserScenarioList);
}
String json = mapper.write(new CodeResp(1, "upsertUserAll"));
logger.info("Response: " + json);

View File

@ -71,6 +71,12 @@ public class UpsertUserAll implements Serializable {
private List<Map<String, Object>> userRatinglogList;
private List<UserBoss> userBossList;
private List<UserTechCount> userTechCountList;
private List<UserScenario> userScenarioList;
@JsonProperty("isNewMusicDetailList")
private String isNewMusicDetailList;

View File

@ -0,0 +1,44 @@
package icu.samnyan.aqua.sega.ongeki.model.userdata;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Entity(name = "OngekiUserBoss")
@Table(name = "ongeki_user_boss")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserBoss implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@JsonIgnore
private long id;
@JsonIgnore
@ManyToOne
@JoinColumn(name = "user_id")
private UserData user;
private int musicId;
private int damage;
@JsonProperty("isClear")
private boolean isClear;
public UserBoss(UserData userData) {
this.user = userData;
}
}

View File

@ -0,0 +1,40 @@
package icu.samnyan.aqua.sega.ongeki.model.userdata;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Entity(name = "OngekiUserScenario")
@Table(name = "ongeki_user_scenario")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserScenario implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@JsonIgnore
private long id;
@JsonIgnore
@ManyToOne
@JoinColumn(name = "user_id")
private UserData user;
private int scenarioId;
private int playCount;
public UserScenario(UserData userData) {
this.user = userData;
}
}

View File

@ -0,0 +1,42 @@
package icu.samnyan.aqua.sega.ongeki.model.userdata;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.io.Serializable;
/**
* @author samnyan (privateamusement@protonmail.com)
*/
@Entity(name = "OngekiUserTechCount")
@Table(name = "ongeki_user_tech_count")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserTechCount implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@JsonIgnore
private long id;
@JsonIgnore
@ManyToOne
@JoinColumn(name = "user_id")
private UserData user;
private int levelId;
private int allBreakCount;
private int allBreakPlusCount;
public UserTechCount(UserData userData) {
this.user = userData;
}
}

View File

@ -0,0 +1,40 @@
create table ongeki_user_boss
(
id bigint auto_increment
primary key,
music_id int not null,
damage int not null,
is_clear bit not null,
user_id bigint null,
constraint UKkXe5S9552jrSJP65
unique (user_id, music_id),
constraint FKRvEJ2eAwDd3br6bv
foreign key (user_id) references ongeki_user_data (id)
);
create table ongeki_user_scenario
(
id bigint auto_increment
primary key,
scenario_id int not null,
play_count int not null,
user_id bigint null,
constraint UKCovwoDYcZ532HDvs
unique (user_id, scenario_id),
constraint FKFyD2tqndcCe9qQMA
foreign key (user_id) references ongeki_user_data (id)
);
create table ongeki_user_tech_count
(
id bigint auto_increment
primary key,
level_id int not null,
all_break_count int not null,
all_break_plus_count int not null,
user_id bigint null,
constraint UKvREetXbYLNAtX5G7
unique (user_id, level_id),
constraint FKkg4dYVKWYr8tGkDk
foreign key (user_id) references ongeki_user_data (id)
);

View File

@ -0,0 +1,46 @@
create table ongeki_user_boss
(
id INTEGER,
music_id INTEGER NOT NULL,
damage INTEGER NOT NULL,
is_clear BOOLEAN NOT NULL,
user_id BIGINT REFERENCES ongeki_user_data (id) ON DELETE CASCADE,
PRIMARY KEY (
id
),
CONSTRAINT ongeki_user_boss_uq UNIQUE (
music_id,
user_id
) ON CONFLICT REPLACE
);
create table ongeki_user_scenario
(
id INTEGER,
scenario_id INTEGER NOT NULL,
play_count INTEGER NOT NULL,
user_id BIGINT REFERENCES ongeki_user_data (id) ON DELETE CASCADE,
PRIMARY KEY (
id
),
CONSTRAINT ongeki_user_scenario_uq UNIQUE (
scenario_id,
user_id
) ON CONFLICT REPLACE
);
create table ongeki_user_tech_count
(
id INTEGER,
level_id INTEGER NOT NULL,
all_break_count INTEGER NOT NULL,
all_break_plus_count INTEGER NOT NULL,
user_id BIGINT REFERENCES ongeki_user_data (id) ON DELETE CASCADE,
PRIMARY KEY (
id
),
CONSTRAINT ongeki_user_tech_count_uq UNIQUE (
level_id,
user_id
) ON CONFLICT REPLACE
);