[O] Wacca: Simplify data storage, re-init database

This commit is contained in:
Azalea
2024-03-28 19:04:16 -04:00
parent f97cb4a1bb
commit 40fb1c8868
5 changed files with 208 additions and 187 deletions

View File

@@ -1,36 +0,0 @@
ALTER TABLE wacca_user_song_unlock
DROP FOREIGN KEY fku_wacca_user_song_unlock;
ALTER TABLE wacca_user_ticket
DROP FOREIGN KEY fku_wacca_user_ticket;
ALTER TABLE wacca_user_trophy
DROP FOREIGN KEY fku_wacca_user_trophy;
DROP TABLE maimai2_game_ticket;
DROP TABLE wacca_user_song_unlock;
DROP TABLE wacca_user_ticket;
DROP TABLE wacca_user_trophy;
ALTER TABLE wacca_user_gate
ADD last_used datetime NOT NULL;
ALTER TABLE wacca_user_item
ADD p1 BIGINT NOT NULL,
ADD p2 BIGINT NOT NULL,
ADD p3 BIGINT NOT NULL,
DROP COLUMN acquire_date,
DROP COLUMN use_count,
ADD acquired_date datetime NOT NULL,
DROP CONSTRAINT wacca_user_item_unique,
ADD CONSTRAINT wacca_user_item_unique UNIQUE (user_id, item_id, type);
ALTER TABLE wacca_user
DROP COLUMN last_login_date,
DROP COLUMN vip_expire_time,
ADD last_login_date datetime NOT NULL,
ADD vip_expire_time datetime NOT NULL,
ADD last_consec_date datetime NOT NULL;

View File

@@ -0,0 +1,188 @@
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE wacca_friend, wacca_user_bingo, wacca_user_favorite_song, wacca_user_gate, wacca_user_item, wacca_user_option, wacca_user_playlog, wacca_user_score, wacca_user_stageup, wacca_user;
SET FOREIGN_KEY_CHECKS=1;
create table wacca_user
(
id bigint auto_increment
primary key,
aime_card_id bigint not null,
username varchar(8) not null,
xp int not null,
wp int not null,
wp_total int not null,
wp_spent int not null,
dan_type int not null,
dan_level int not null,
titles varchar(255) not null,
rating int not null,
always_vip bit not null,
login_count int not null,
login_count_days int not null,
login_count_days_consec int not null,
login_count_today int not null,
play_counts varchar(255) not null,
friend_views varchar(255) not null,
last_game_ver varchar(50) not null,
last_song_info varchar(255) not null,
gate_tutorial_flags varchar(255) not null,
last_login_date datetime not null,
vip_expire_time datetime not null,
last_consec_date datetime not null,
favorite_songs TEXT not null,
constraint wacca_user_detail_unique
unique (aime_card_id),
constraint wacca_user_detail_fk
foreign key (aime_card_id) references sega_card (id)
);
create table wacca_friend
(
id bigint auto_increment
primary key,
user_id bigint not null,
`with` bigint not null,
is_accepted bit not null,
constraint wacca_friend_unique
unique (user_id, `with`),
constraint fku_wacca_friend
foreign key (user_id) references wacca_user (id)
on update cascade on delete cascade,
constraint fku_wacca_friend_2
foreign key (`with`) references wacca_user (id)
on update cascade on delete cascade
);
create table wacca_user_bingo
(
id bigint auto_increment
primary key,
user_id bigint not null,
page_number int not null,
page_progress varchar(255) null,
constraint wacca_user_bingo_unique
unique (user_id, page_number),
constraint fku_wacca_user_bingo
foreign key (user_id) references wacca_user (id)
on update cascade on delete cascade
);
create table wacca_user_gate
(
id bigint auto_increment
primary key,
user_id bigint not null,
gate_id int not null,
page int not null,
progress int not null,
loops int not null,
mission_flag int not null,
total_points int not null,
last_used datetime not null,
constraint wacca_user_gate_unique
unique (user_id, gate_id),
constraint fku_wacca_user_gate
foreign key (user_id) references wacca_user (id)
on update cascade on delete cascade
);
create table wacca_user_item
(
id bigint auto_increment
primary key,
user_id bigint not null,
item_id int not null,
type int not null,
p1 bigint not null,
p2 bigint not null,
p3 bigint not null,
acquired_date datetime not null,
constraint wacca_user_item_unique
unique (user_id, item_id, type),
constraint fku_wacca_user_item
foreign key (user_id) references wacca_user (id)
on update cascade on delete cascade
);
create table wacca_user_option
(
id bigint auto_increment
primary key,
user_id bigint not null,
opt_id int not null,
value int not null,
constraint wacca_user_option_unique
unique (user_id, opt_id),
constraint fku_wacca_user_option
foreign key (user_id) references wacca_user (id)
on update cascade on delete cascade
);
create table wacca_user_playlog
(
id bigint auto_increment
primary key,
user_id bigint not null,
song_id int not null,
difficulty int not null,
score int not null,
grade int not null,
max_combo int not null,
fast_ct int not null,
late_ct int not null,
all_marv bit not null,
full_combo bit not null,
give_up bit not null,
judgements varchar(255) not null,
level double not null,
missless bit not null,
new_record bit not null,
skill_pt int not null,
clear bit not null,
date_scored datetime not null,
constraint wacca_user_playlog_unique
unique (user_id, song_id, difficulty, date_scored),
constraint fku_wacca_user_playlog
foreign key (user_id) references wacca_user (id)
on update cascade on delete cascade
);
create table wacca_user_score
(
id bigint auto_increment
primary key,
user_id bigint not null,
song_id int not null,
difficulty int not null,
score int not null,
best_combo int not null,
lowest_miss_ct int not null,
rating int not null,
clears varchar(255) not null,
grades varchar(255) not null,
constraint wacca_user_score_unique
unique (user_id, song_id, difficulty),
constraint fku_wacca_user_score
foreign key (user_id) references wacca_user (id)
on update cascade on delete cascade
);
create table wacca_user_stageup
(
id bigint auto_increment
primary key,
user_id bigint not null,
version int not null,
stage_id int not null,
clear_status int not null,
clear_song_ct int not null,
song1score int not null,
song2score int not null,
song3score int not null,
play_ct int not null,
constraint wacca_user_stageup_unique
unique (user_id, version, stage_id),
constraint fku_wacca_user_stageup
foreign key (user_id) references wacca_user (id)
on update cascade on delete cascade
);

View File

@@ -1,120 +0,0 @@
ALTER TABLE wacca_user_playlog
ADD all_marv BIT(1) NOT NULL;
ALTER TABLE wacca_user_playlog
ADD full_combo BIT(1) NOT NULL;
ALTER TABLE wacca_user_playlog
ADD give_up BIT(1) NOT NULL;
ALTER TABLE wacca_user_playlog
ADD judgements VARCHAR(255) NOT NULL;
ALTER TABLE wacca_user_playlog
ADD level DOUBLE NOT NULL;
ALTER TABLE wacca_user_playlog
ADD missless BIT(1) NOT NULL;
ALTER TABLE wacca_user_playlog
ADD new_record BIT(1) NOT NULL;
ALTER TABLE wacca_user_playlog
ADD skill_pt INT NOT NULL;
ALTER TABLE wacca_user_playlog
MODIFY all_marv BIT(1) NOT NULL;
ALTER TABLE wacca_user_score
ADD clears VARCHAR(255) NOT NULL;
ALTER TABLE wacca_user_score
ADD grades VARCHAR(255) NOT NULL;
ALTER TABLE wacca_user_score
DROP COLUMN allmarv_ct;
ALTER TABLE wacca_user_score RENAME COLUMN chart_id TO difficulty;
ALTER TABLE wacca_user_score
DROP COLUMN clear_ct;
ALTER TABLE wacca_user_score
DROP COLUMN fullcombo_ct;
ALTER TABLE wacca_user_score
DROP COLUMN grade_master_ct;
ALTER TABLE wacca_user_score
DROP COLUMN grade_sp_ct;
ALTER TABLE wacca_user_score
DROP COLUMN grade_ssp_ct;
ALTER TABLE wacca_user_score
DROP COLUMN grade_sssp_ct;
ALTER TABLE wacca_user_score
DROP COLUMN gradeaaact;
ALTER TABLE wacca_user_score
DROP COLUMN gradeaact;
ALTER TABLE wacca_user_score
DROP COLUMN gradeact;
ALTER TABLE wacca_user_score
DROP COLUMN gradebct;
ALTER TABLE wacca_user_score
DROP COLUMN gradecct;
ALTER TABLE wacca_user_score
DROP COLUMN gradedct;
ALTER TABLE wacca_user_score
DROP COLUMN gradesct;
ALTER TABLE wacca_user_score
DROP COLUMN gradessct;
ALTER TABLE wacca_user_score
DROP COLUMN gradesssct;
ALTER TABLE wacca_user_score
DROP COLUMN missless_ct;
ALTER TABLE wacca_user_score
DROP COLUMN play_ct;
ALTER TABLE wacca_user_playlog RENAME COLUMN chart_id TO difficulty;
ALTER TABLE wacca_user_playlog
DROP COLUMN good_ct;
ALTER TABLE wacca_user_playlog
DROP COLUMN great_ct;
ALTER TABLE wacca_user_playlog
DROP COLUMN marv_ct;
ALTER TABLE wacca_user_playlog
DROP COLUMN miss_ct;
ALTER TABLE wacca_user_playlog
DROP COLUMN season;
ALTER TABLE wacca_user_playlog
DROP COLUMN clear;
ALTER TABLE wacca_user_playlog
DROP COLUMN date_scored;
ALTER TABLE wacca_user_item
MODIFY acquired_date datetime NOT NULL;
ALTER TABLE wacca_user_playlog
ADD clear BIT(1) NOT NULL;
ALTER TABLE wacca_user_playlog
ADD date_scored datetime NOT NULL;