feat: made database changes to handle the extra server data
This commit is contained in:
parent
5f4e46bb51
commit
d3a975a1d1
2 changed files with 17 additions and 1 deletions
5
db/migrations/5_welcome-message.sql
Normal file
5
db/migrations/5_welcome-message.sql
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
-- temp table to allow folks to verify by committee email.
|
||||||
|
-- delete the col in teh server table
|
||||||
|
ALTER TABLE servers ADD COLUMN bot_channel_id integer DEFAULT 0;
|
||||||
|
ALTER TABLE servers ADD COLUMN server_name text NOT NULL;
|
||||||
|
ALTER TABLE servers ADD COLUMN wolves_link text NOT NULL;
|
13
src/lib.rs
13
src/lib.rs
|
@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
|
||||||
use serenity::{
|
use serenity::{
|
||||||
model::{
|
model::{
|
||||||
guild,
|
guild,
|
||||||
id::{GuildId, RoleId},
|
id::{GuildId, RoleId, ChannelId},
|
||||||
},
|
},
|
||||||
prelude::TypeMapKey,
|
prelude::TypeMapKey,
|
||||||
};
|
};
|
||||||
|
@ -228,9 +228,14 @@ pub struct Servers {
|
||||||
pub server: GuildId,
|
pub server: GuildId,
|
||||||
pub wolves_api: String,
|
pub wolves_api: String,
|
||||||
pub role_past: Option<RoleId>,
|
pub role_past: Option<RoleId>,
|
||||||
|
// TODO: this should not be option
|
||||||
pub role_current: Option<RoleId>,
|
pub role_current: Option<RoleId>,
|
||||||
pub member_past: i64,
|
pub member_past: i64,
|
||||||
pub member_current: i64,
|
pub member_current: i64,
|
||||||
|
pub bot_channel_id: ChannelId,
|
||||||
|
// these can be removed in teh future with an API update
|
||||||
|
pub server_name: String,
|
||||||
|
pub wolves_link: String,
|
||||||
}
|
}
|
||||||
impl<'r> FromRow<'r, SqliteRow> for Servers {
|
impl<'r> FromRow<'r, SqliteRow> for Servers {
|
||||||
fn from_row(row: &'r SqliteRow) -> Result<Self, Error> {
|
fn from_row(row: &'r SqliteRow) -> Result<Self, Error> {
|
||||||
|
@ -259,6 +264,9 @@ impl<'r> FromRow<'r, SqliteRow> for Servers {
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let bot_channel_tmp: i64 = row.try_get("bot_channel_id")?;
|
||||||
|
let bot_channel_id = ChannelId::from(bot_channel_tmp as u64);
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
server,
|
server,
|
||||||
wolves_api: row.try_get("wolves_api")?,
|
wolves_api: row.try_get("wolves_api")?,
|
||||||
|
@ -266,6 +274,9 @@ impl<'r> FromRow<'r, SqliteRow> for Servers {
|
||||||
role_current,
|
role_current,
|
||||||
member_past: row.try_get("member_past")?,
|
member_past: row.try_get("member_past")?,
|
||||||
member_current: row.try_get("member_current")?,
|
member_current: row.try_get("member_current")?,
|
||||||
|
bot_channel_id,
|
||||||
|
server_name: row.try_get("server_name")?,
|
||||||
|
wolves_link: row.try_get("wolves_link")?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue