diff --git a/db/2_wolves-id.sql b/db/2_wolves-id.sql new file mode 100644 index 0000000..43607ce --- /dev/null +++ b/db/2_wolves-id.sql @@ -0,0 +1,16 @@ + +-- add a col for the wolves ID +ALTER TABLE accounts ADD COLUMN id_wolves integer DEFAULT 0; + +-- fill in the values +UPDATE accounts +SET id_wolves=( + SELECT id_wolves + FROM accounts_wolves + WHERE accounts.mail=accounts_wolves.email +) +WHERE ( + SELECT id_wolves + FROM accounts_wolves + WHERE accounts.mail=accounts_wolves.email +) IS NOT NULL diff --git a/src/bin/update_data.rs b/src/bin/update_data.rs index 70f8af7..1c7d7ea 100644 --- a/src/bin/update_data.rs +++ b/src/bin/update_data.rs @@ -55,6 +55,7 @@ async fn update_ldap(config: &Config, db: &Pool) { mail: "".to_string(), student_id: "".to_string(), secure: false, + id_wolves: 0, }; // pull out the required info diff --git a/src/lib.rs b/src/lib.rs index 1199fca..9711dbc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -57,12 +57,11 @@ pub struct Accounts { pub mail: String, pub student_id: String, pub secure: bool, + pub id_wolves: i64, } pub async fn db_init(config: &Config) -> Result, Error> { - dbg!(config); let database = format!("{}/{}", &config.home, &config.database); - dbg!(&database); let pool = SqlitePoolOptions::new() .max_connections(5) .connect_with(