Bugfix/0.3.3 migration (#1922)

* feat: Change migration to use empty name

* chore: Add in the default routes just in case

* Fix/remove merge with seed during init (#1917)

* fix kiosk

* chore: Remove the duplicate loggging information that is making usele… (#1912)

chore: Remove the duplicate loggging information that is making useless noise in the system.

* fix: Remove the init merge with seed

Co-authored-by: Aiden McClelland <me@drbonez.dev>

Co-authored-by: BluJ <mogulslayer@gmail.com>
Co-authored-by: J M <2364004+Blu-J@users.noreply.github.com>
This commit is contained in:
Aiden McClelland
2022-11-09 12:09:05 -07:00
parent d6bf52c11f
commit 0e82b6981f
3 changed files with 43 additions and 24 deletions

View File

@@ -2,10 +2,34 @@ use emver::VersionRange;
use super::v0_3_0::V0_3_0_COMPAT;
use super::*;
use crate::hostname::{generate_id, sync_hostname};
use crate::{
config::util::MergeWith,
hostname::{generate_id, sync_hostname},
};
const V0_3_2: emver::Version = emver::Version::new(0, 3, 2, 0);
lazy_static::lazy_static! {
static ref DEFAULT_UI: serde_json::Value =serde_json::json!({
"name": null,
"auto-check-updates": true,
"pkg-order": [],
"ack-welcome": "0.3.2",
"marketplace": {
"selected-id": null,
"known-hosts": {}
},
"dev": {},
"gaming": {
"snake": {
"high-score": 0
}
},
"ack-instructions": {}
});
}
#[derive(Clone, Debug)]
pub struct Version;
#[async_trait]
@@ -25,6 +49,14 @@ impl VersionT for Version {
crate::hostname::ensure_hostname_is_set(db, &receipts).await?;
receipts.id.set(db, generate_id()).await?;
let mut ui = crate::db::DatabaseModel::new()
.ui()
.get(db, false)
.await?
.clone();
ui.merge_with(&DEFAULT_UI);
crate::db::DatabaseModel::new().ui().put(db, &ui).await?;
sync_hostname(db, &receipts).await?;
Ok(())
}