Skip to content

Commit

Permalink
changed Datatype of tmpc_keep_time
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwai committed Feb 18, 2024
1 parent b05b730 commit aaf2ceb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions migrations/20240218132517_changeTmpcKeepTimeDataType.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table Guild
modify tmpc_keep_time int unsigned not null;
6 changes: 3 additions & 3 deletions src/mysql_lib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ enum Column {
StudyRoleSeparatorRole(RoleId),
SubjectRoleSeparatorRole(RoleId),
FriendRole(RoleId),
TmpcKeepTime(Time),
TmpcKeepTime(u32),
AlumniRole(RoleId),
AlumniRoleSeparatorRole(RoleId),
}
Expand All @@ -102,7 +102,7 @@ pub struct DatabaseGuild {
pub study_role_separator_role: RoleId,
pub subject_role_separator_role: RoleId,
pub friend_role: RoleId,
pub tmpc_keep_time: Time,
pub tmpc_keep_time: u32,
pub alumni_role: RoleId,
pub alumni_role_separator_role: RoleId,
}
Expand Down Expand Up @@ -625,7 +625,7 @@ pub async fn update_friend_role(
pub async fn update_tmpc_keep_time(
pool: &Pool<MySql>,
guild_id: GuildId,
tmpc_keep_time: Time,
tmpc_keep_time: u32,
) -> Option<bool> {
update_guild_table_value(pool, guild_id, Column::TmpcKeepTime(tmpc_keep_time)).await
}
Expand Down
4 changes: 2 additions & 2 deletions src/mysql_lib/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ mod tests {
study_role_separator_role: RoleId::new(13),
subject_role_separator_role: RoleId::new(14),
friend_role: RoleId::new(15),
tmpc_keep_time: Time::from_hms(12, 0, 0).unwrap(),
tmpc_keep_time: 12,
alumni_role: RoleId::new(16),
alumni_role_separator_role: RoleId::new(17),
logger_pipe_channel: None,
Expand Down Expand Up @@ -100,7 +100,7 @@ mod tests {
study_role_separator_role: RoleId::new(guild.study_role_separator_role.get() + 1),
subject_role_separator_role: RoleId::new(guild.subject_role_separator_role.get() + 1),
friend_role: RoleId::new(guild.friend_role.get() + 1),
tmpc_keep_time: guild.tmpc_keep_time.add(Duration::from_secs(5)),
tmpc_keep_time: guild.tmpc_keep_time + 5,
alumni_role: RoleId::new(guild.alumni_role.get() + 1),
alumni_role_separator_role: RoleId::new(guild.alumni_role_separator_role.get() + 1),
};
Expand Down

0 comments on commit aaf2ceb

Please sign in to comment.