diff --git a/src/cli/basic/cli.rs b/src/cli/basic/cli.rs index edec397bbf..cffec1c9bf 100644 --- a/src/cli/basic/cli.rs +++ b/src/cli/basic/cli.rs @@ -271,6 +271,7 @@ pub async fn cli() -> Result { } "migrate-schemas" => { println!("Running schema migration to row per schema version"); + #[allow(deprecated)] migration::schema::run().await? } _ => { diff --git a/src/common/migration/dashboards.rs b/src/common/migration/dashboards.rs index 5f58f68c4b..fe31289c3d 100644 --- a/src/common/migration/dashboards.rs +++ b/src/common/migration/dashboards.rs @@ -88,6 +88,10 @@ async fn add_distinct_from_dashboard( pub async fn run() -> Result<(), anyhow::Error> { // load dashboards list let db = infra_db::get_db().await; + + // The following for-loop, which assigns all dashboards in the meta table to + // a default folder, is deprecated as of v0.14.0 and will be removed in + // v0.17.0. let db_key = "/dashboard/".to_string(); let data = db.list(&db_key).await?; for (key, val) in data { @@ -108,6 +112,11 @@ pub async fn run() -> Result<(), anyhow::Error> { } } + // The logic that follows is dependent on the dashboards table created in + // the SeaORM migration list. Unlike the logic above, it will not be + // deprecated in v0.14.0, though we could probably move it into its own + // migration script in the SeaORM migration list so that it is tracked by + // SeaORM. if distinct_values::len().await? > 0 { log::info!("dashboard distinct values migration already done."); } else { diff --git a/src/common/migration/mod.rs b/src/common/migration/mod.rs index 25fa742d5d..0c35c9458a 100644 --- a/src/common/migration/mod.rs +++ b/src/common/migration/mod.rs @@ -38,6 +38,7 @@ pub async fn check_upgrade(old_ver: &str, new_ver: &str) -> Result<(), anyhow::E log::info!("Upgrading from {} to {}", old_ver, new_ver); let v093 = Version::from("v0.9.3").unwrap(); if old_ver < v093 { + #[allow(deprecated)] upgrade_092_093().await?; } @@ -49,8 +50,10 @@ pub async fn check_upgrade(old_ver: &str, new_ver: &str) -> Result<(), anyhow::E Ok(()) } +#[deprecated(since = "0.14.0", note = "will be removed in 0.17.0")] async fn upgrade_092_093() -> Result<(), anyhow::Error> { // migration schema + #[allow(deprecated)] schema::run().await?; Ok(()) @@ -63,6 +66,7 @@ async fn upgrade_130_131() -> Result<(), anyhow::Error> { Ok(()) } +#[deprecated(since = "0.14.0", note = "will be removed in 0.17.0")] pub async fn upgrade_resource_names() -> Result<(), anyhow::Error> { // The below migration requires ofga init ready, but on Router node, // we don't initialize ofga, hence the migration should not run on router diff --git a/src/common/migration/schema.rs b/src/common/migration/schema.rs index d0792e659d..2729769037 100644 --- a/src/common/migration/schema.rs +++ b/src/common/migration/schema.rs @@ -47,6 +47,7 @@ use crate::{ const SCHEMA_MIGRATION_KEY: &str = "/migration/schema_versions/status"; const META_MIGRATION_VERSION_KEY: &str = "/migration/meta/version"; +#[deprecated(since = "0.14.0", note = "will be removed in 0.17.0")] pub async fn run() -> Result<(), anyhow::Error> { match upgrade_schema_row_per_version().await { std::result::Result::Ok(true) => { diff --git a/src/main.rs b/src/main.rs index 07559cda96..3f3f33abf3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -227,6 +227,7 @@ async fn main() -> Result<(), anyhow::Error> { panic!("migrate dashboards failed: {}", e); } + #[allow(deprecated)] migration::upgrade_resource_names() .await .expect("migrate resource names into supported ofga format failed");