feat: completed migration #11
3 changed files with 6 additions and 7 deletions
|
@ -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) {
|
||||
|
|
|
@ -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 = {
|
||||
|
|
10
src/lib.rs
10
src/lib.rs
|
@ -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?;
|
||||
|
||||
|
|
Loading…
Reference in a new issue