From a294f43b611b9defff1a25595d0c8d5fe0e21000 Mon Sep 17 00:00:00 2001 From: WilliamQiufeng Date: Thu, 14 May 2026 20:46:10 +0100 Subject: [PATCH] Add minehit count --- cmd/database/migrations/28_count_minehit.down.sql | 5 +++++ cmd/database/migrations/28_count_minehit.up.sql | 5 +++++ db/multiplayer_match_scores.go | 1 + db/redis_score.go | 1 + db/scores.go | 1 + 5 files changed, 13 insertions(+) create mode 100644 cmd/database/migrations/28_count_minehit.down.sql create mode 100644 cmd/database/migrations/28_count_minehit.up.sql diff --git a/cmd/database/migrations/28_count_minehit.down.sql b/cmd/database/migrations/28_count_minehit.down.sql new file mode 100644 index 0000000..bcb1e28 --- /dev/null +++ b/cmd/database/migrations/28_count_minehit.down.sql @@ -0,0 +1,5 @@ +ALTER TABLE scores + DROP COLUMN count_minehit; + +ALTER TABLE multiplayer_match_scores + DROP COLUMN count_minehit; diff --git a/cmd/database/migrations/28_count_minehit.up.sql b/cmd/database/migrations/28_count_minehit.up.sql new file mode 100644 index 0000000..766f70e --- /dev/null +++ b/cmd/database/migrations/28_count_minehit.up.sql @@ -0,0 +1,5 @@ +ALTER TABLE scores + ADD COLUMN count_minehit INT NOT NULL DEFAULT 0 AFTER count_miss; + +ALTER TABLE multiplayer_match_scores + ADD COLUMN count_minehit INT NOT NULL DEFAULT 0 AFTER count_miss; diff --git a/db/multiplayer_match_scores.go b/db/multiplayer_match_scores.go index 6ff3a2a..15265c1 100644 --- a/db/multiplayer_match_scores.go +++ b/db/multiplayer_match_scores.go @@ -16,6 +16,7 @@ type MultiplayerMatchScore struct { CountGood int `gorm:"column:count_good" json:"count_good"` CountOkay int `gorm:"column:count_okay" json:"count_okay"` CountMiss int `gorm:"column:count_miss" json:"count_miss"` + CountMineHit int `gorm:"column:count_minehit" json:"count_minehit"` FullCombo bool `gorm:"column:full_combo" json:"-"` LivesLeft int `gorm:"column:lives_left" json:"-"` HasFailed bool `gorm:"column:has_failed" json:"-"` diff --git a/db/redis_score.go b/db/redis_score.go index 2b8c86b..068b7a0 100644 --- a/db/redis_score.go +++ b/db/redis_score.go @@ -25,6 +25,7 @@ type RedisScore struct { CountGood int `json:"count_good"` CountOkay int `json:"count_okay"` CountMiss int `json:"count_miss"` + CountMineHit int `json:"count_minehit"` } `json:"score"` User struct { Id int `json:"id"` diff --git a/db/scores.go b/db/scores.go index 8316bb6..5e6ee9e 100644 --- a/db/scores.go +++ b/db/scores.go @@ -32,6 +32,7 @@ type Score struct { CountGood int `gorm:"column:count_good" json:"count_good"` CountOkay int `gorm:"column:count_okay" json:"count_okay"` CountMiss int `gorm:"column:count_miss" json:"count_miss"` + CountMineHit int `gorm:"column:count_minehit" json:"count_minehit"` Grade string `gorm:"column:grade" json:"grade"` ScrollSpeed int `gorm:"column:scroll_speed" json:"scroll_speed"` TimePlayStart int64 `gorm:"column:time_play_start" json:"-"`