Define plume_models::migrate_data()

This commit is contained in:
Kitaiti Makoto 2021-09-11 23:06:02 +09:00
parent 218bc54a5f
commit 2fcb449ed8

View File

@ -17,6 +17,8 @@ extern crate serde_json;
#[macro_use] #[macro_use]
extern crate tantivy; extern crate tantivy;
use db_conn::DbPool;
use instance::Instance;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use plume_common::activity_pub::inbox::InboxError; use plume_common::activity_pub::inbox::InboxError;
use posts::PostEvent; use posts::PostEvent;
@ -295,6 +297,15 @@ pub fn ap_url(url: &str) -> String {
format!("https://{}", url) format!("https://{}", url)
} }
pub fn migrate_data(dbpool: &DbPool) -> Result<()> {
ensure_local_instance_keys(&dbpool.get().unwrap())
}
fn ensure_local_instance_keys(conn: &Connection) -> Result<()> {
let instance = Instance::get_local()?;
instance.set_keypair(conn)
}
#[cfg(test)] #[cfg(test)]
#[macro_use] #[macro_use]
mod tests { mod tests {