Added new struct fields into structs used for migration logic

This commit is contained in:
user 2024-05-27 12:18:16 +02:00
parent db6da81a3f
commit 6379853307
2 changed files with 19 additions and 1 deletions

View file

@ -1,3 +1,16 @@
// - Commit that changed setting format: 3aa9680baedf850d7d576d0df28ce50cf2124ebe.
// - Commit that made settings variant use u64 instead of String:
// d481f1314409c99a0ed48b006a8e9b53f6caa8a5.
// - Add all back-end functionality for interacting with variants on the front-end:
// 4eaf6fae2bba0219a316d37499ee6e1549645862.
// - Improve memory clock selection for #140, fix dpm_performance enforcement check for GPU:
// a1c44cdea7ae27f7a09fd194c580c79b291d25d1.
// - Remove legacy charge mode and level functionality: 88d359e286bec2fdabde0f4f72b52fb8f4d5200e.
// - Add tags for persistent settings variants: ccf0c04020bfc5ae9f667801f99d1a31f939006a.
// TODO: Check full git diff between data structures from version 1.4.0 and current, to see exactly
// what changed and how to migrate them to the current data structures.
use std::collections::HashMap; use std::collections::HashMap;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -20,6 +33,7 @@ pub struct OldSettingsJson {
pub battery: super::BatteryJson, pub battery: super::BatteryJson,
pub provider: Option<super::DriverJson>, pub provider: Option<super::DriverJson>,
pub events: Option<OldOnEventJson>, pub events: Option<OldOnEventJson>,
pub tags: Vec<String>,
} }
impl From<&OldSettingsJson> for super::SettingsJson { impl From<&OldSettingsJson> for super::SettingsJson {
@ -33,6 +47,7 @@ impl From<&OldSettingsJson> for super::SettingsJson {
gpu: old_settings.gpu.clone(), gpu: old_settings.gpu.clone(),
battery: old_settings.battery.clone(), battery: old_settings.battery.clone(),
provider: old_settings.provider.clone(), provider: old_settings.provider.clone(),
tags: todo!(),
} }
} }
} }
@ -44,9 +59,10 @@ impl From<&OldSettingsJson> for super::FileJson {
variants.insert(0, variant); variants.insert(0, variant);
Self { Self {
version: 0, version: super::LATEST_VERSION,
name: old_settings.name.clone(), name: old_settings.name.clone(),
variants, variants,
app_id: todo!(),
} }
} }
} }

View file

@ -16,3 +16,5 @@ pub use gpu::GpuJson;
pub use migration::OldSettingsJson; pub use migration::OldSettingsJson;
pub use error::{RonError, SerdeError}; pub use error::{RonError, SerdeError};
pub const LATEST_VERSION: u64 = 0;