Skip to content

Commit da5a35b

Browse files
committed
🗃️ Remove unused columns
1 parent 1d88990 commit da5a35b

File tree

2 files changed

+3
-43
lines changed

2 files changed

+3
-43
lines changed

BeatmapRow.cs

-20
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,7 @@ public class BeatmapRow
1414
public int user_id { get; set; }
1515
public string filename { get; set; }
1616
public string checksum { get; set; }
17-
public string version { get; set; }
18-
public int total_length { get; set; }
19-
public int hit_length { get; set; }
20-
public int countTotal { get; set; }
21-
public int countNormal { get; set; }
22-
public int countSlider { get; set; }
23-
public int countSpinner { get; set; }
24-
public double diff_drain { get; set; }
25-
public double diff_size { get; set; }
26-
public double diff_overall { get; set; }
27-
public double diff_approach { get; set; }
28-
public int playmode { get; set; }
2917
public int approved { get; set; }
3018
public DateTimeOffset last_update { get; set; }
31-
public double difficultyrating { get; set; }
32-
public int playcount { get; set; }
33-
public int passcount { get; set; }
34-
public int orphaned { get; set; }
35-
public string youtube_preview { get; set; }
36-
public int score_version { get; set; }
37-
public DateTimeOffset? deleted_at { get; set; }
38-
public double bpm { get; set; }
3919
}
4020
}

Generator.cs

+3-23
Original file line numberDiff line numberDiff line change
@@ -73,28 +73,8 @@ private void createSchema(SqliteConnection sqlite)
7373
`user_id` int unsigned NOT NULL DEFAULT '0',
7474
`filename` varchar(150) DEFAULT NULL,
7575
`checksum` varchar(32) DEFAULT NULL,
76-
`version` varchar(80) NOT NULL DEFAULT '',
77-
`total_length` mediumint unsigned NOT NULL DEFAULT '0',
78-
`hit_length` mediumint unsigned NOT NULL DEFAULT '0',
79-
`countTotal` smallint unsigned NOT NULL DEFAULT '0',
80-
`countNormal` smallint unsigned NOT NULL DEFAULT '0',
81-
`countSlider` smallint unsigned NOT NULL DEFAULT '0',
82-
`countSpinner` smallint unsigned NOT NULL DEFAULT '0',
83-
`diff_drain` float unsigned NOT NULL DEFAULT '0',
84-
`diff_size` float unsigned NOT NULL DEFAULT '0',
85-
`diff_overall` float unsigned NOT NULL DEFAULT '0',
86-
`diff_approach` float unsigned NOT NULL DEFAULT '0',
87-
`playmode` tinyint unsigned NOT NULL DEFAULT '0',
8876
`approved` tinyint NOT NULL DEFAULT '0',
8977
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
90-
`difficultyrating` float NOT NULL DEFAULT '0',
91-
`playcount` int unsigned NOT NULL DEFAULT '0',
92-
`passcount` int unsigned NOT NULL DEFAULT '0',
93-
`orphaned` tinyint(1) NOT NULL DEFAULT '0',
94-
`youtube_preview` varchar(50) DEFAULT NULL,
95-
`score_version` tinyint NOT NULL DEFAULT '1',
96-
`deleted_at` timestamp NULL DEFAULT NULL,
97-
`bpm` float DEFAULT NULL,
9878
PRIMARY KEY (`beatmap_id`))");
9979

10080
sqlite.Execute("CREATE INDEX `beatmapset_id` ON osu_beatmaps (`beatmapset_id`)");
@@ -113,7 +93,7 @@ private void copyBeatmaps(IDbConnection source, IDbConnection destination)
11393

11494
var start = DateTime.Now;
11595

116-
var beatmapsReader = source.Query<BeatmapRow>("SELECT * FROM osu_beatmaps WHERE approved > 0 AND deleted_at IS NULL");
96+
var beatmapsReader = source.Query<BeatmapRow>("SELECT beatmap_id, beatmapset_id, user_id, filename, checksum, approved, last_update FROM osu_beatmaps WHERE approved > 0");
11797

11898
insertBeatmaps(destination, beatmapsReader);
11999

@@ -131,7 +111,7 @@ private void copyBeatmaps(IDbConnection source, IDbConnection destination)
131111
/// <param name="beatmaps">DbDataReader object (obtained from SelectBeatmaps) to insert beatmaps from.</param>
132112
private void insertBeatmaps(IDbConnection conn, IEnumerable<BeatmapRow> beatmaps)
133113
{
134-
const string sql = "INSERT INTO osu_beatmaps VALUES(@beatmap_id, @beatmapset_id, @user_id, @filename, @checksum, @version, @total_length, @hit_length, @countTotal, @countNormal, @countSlider, @countSpinner, @diff_drain, @diff_size, @diff_overall, @diff_approach, @playmode, @approved, @last_update, @difficultyrating, @playcount, @passcount, @orphaned, @youtube_preview, @score_version, @deleted_at, @bpm)";
114+
const string sql = "INSERT INTO osu_beatmaps VALUES(@beatmap_id, @beatmapset_id, @user_id, @filename, @checksum, @approved, @last_update)";
135115

136116
int processedItems = 0;
137117

@@ -148,7 +128,7 @@ private void insertBeatmaps(IDbConnection conn, IEnumerable<BeatmapRow> beatmaps
148128
/// Count beatmaps from MySQL or SQLite database.
149129
/// </summary>
150130
/// <param name="conn">Connection to fetch beatmaps from.</param>
151-
private int getBeatmapCount(IDbConnection conn) => conn.QuerySingle<int>("SELECT COUNT(beatmap_id) FROM osu_beatmaps WHERE approved > 0 AND deleted_at IS NULL");
131+
private int getBeatmapCount(IDbConnection conn) => conn.QuerySingle<int>("SELECT COUNT(beatmap_id) FROM osu_beatmaps WHERE approved > 0");
152132

153133
/// <summary>
154134
/// Get a connection to the offline SQLite cache database.

0 commit comments

Comments
 (0)