Seed patchdb UI data (#1835)

* adjust types
for patchdb ui data and create seed file

* feat: For init and the migration use defaults

* fix update path

* update build for ui seed file

* fix accidential revert

* chore: Convert to do during the init

* chore: Update the commit message

Co-authored-by: BluJ <mogulslayer@gmail.com>
This commit is contained in:
Lucy C
2022-09-26 17:36:37 -06:00
committed by GitHub
parent 31c5aebe90
commit 1702c07481
13 changed files with 113 additions and 67 deletions

View File

@@ -1,6 +1,8 @@
use emver::VersionRange;
use crate::config::util::MergeWith;
use crate::hostname::{generate_id, get_hostname, sync_hostname};
use crate::ErrorKind;
use super::v0_3_0::V0_3_0_COMPAT;
use super::*;
@@ -35,28 +37,9 @@ impl VersionT for Version {
.await?;
sync_hostname(db).await?;
let mut ui = crate::db::DatabaseModel::new()
.ui()
.get(db, false)
.await?
.clone();
if let serde_json::Value::Object(ref mut ui) = ui {
ui.insert("ack-instructions".to_string(), serde_json::json!({}));
}
crate::db::DatabaseModel::new().ui().put(db, &ui).await?;
Ok(())
}
async fn down<Db: DbHandle>(&self, db: &mut Db) -> Result<(), Error> {
let mut ui = crate::db::DatabaseModel::new()
.ui()
.get(db, false)
.await?
.clone();
if let serde_json::Value::Object(ref mut ui) = ui {
ui.remove("ack-instructions");
}
crate::db::DatabaseModel::new().ui().put(db, &ui).await?;
async fn down<Db: DbHandle>(&self, _db: &mut Db) -> Result<(), Error> {
Ok(())
}
}