feat: completed migration #11

Merged
silver merged 3 commits from #4-id-instead-of-name into main 2023-09-26 00:16:25 +00:00
3 changed files with 6 additions and 7 deletions
Showing only changes of commit abb00ff8c7 - Show all commits

View file

@ -16,7 +16,6 @@ async fn main() {
get_wolves_csv(&db, &config).await;
// handle wolves api here
get_wolves(&db).await;
}
async fn get_wolves_csv(db: &Pool<Sqlite>, config: &Config) {

View file

@ -16,8 +16,8 @@ use skynet_discord_bot::{get_now_iso, random_string, Config, DataBase, Wolves, W
use sqlx::{Pool, Sqlite};
pub(crate) mod link {
use serenity::model::id::UserId;
use super::*;
use serenity::model::id::UserId;
pub async fn run(command: &ApplicationCommandInteraction, ctx: &Context) -> String {
let db_lock = {

View file

@ -10,12 +10,12 @@ use serenity::{
use chrono::{Datelike, SecondsFormat, Utc};
use rand::{distributions::Alphanumeric, thread_rng, Rng};
use serenity::model::id::UserId;
use sqlx::{
sqlite::{SqliteConnectOptions, SqlitePoolOptions, SqliteRow},
Error, FromRow, Pool, Row, Sqlite,
};
use std::{env, str::FromStr, sync::Arc};
use serenity::model::id::UserId;
use tokio::sync::RwLock;
pub struct Config {
@ -140,7 +140,7 @@ impl<'r> FromRow<'r, SqliteRow> for ServerMembersWolves {
}
_ => None,
};
Ok(Self {
server,
id_wolves: row.try_get("id_wolves")?,
@ -168,7 +168,7 @@ impl<'r> FromRow<'r, SqliteRow> for Wolves {
}
_ => None,
};
Ok(Self {
id_wolves: row.try_get("id_wolves")?,
email: row.try_get("email")?,
@ -258,8 +258,8 @@ pub async fn db_init(config: &Config) -> Result<Pool<Sqlite>, Error> {
minecraft text
)",
)
.execute(&pool)
.await?;
.execute(&pool)
.await?;
sqlx::query("CREATE INDEX IF NOT EXISTS index_discord ON wolves (discord)").execute(&pool).await?;