From 10e958d0e118b5642c562a44bf10983b8d5aa2f6 Mon Sep 17 00:00:00 2001 From: Chris Black Date: Mon, 8 Jul 2024 19:05:48 -0700 Subject: [PATCH] update test that used removed date field --- base/settings/R/check.all.settings.R | 10 ++-- base/settings/R/known_bety_migrations.R | 69 +++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 base/settings/R/known_bety_migrations.R diff --git a/base/settings/R/check.all.settings.R b/base/settings/R/check.all.settings.R index 77679467124..c7b665addca 100644 --- a/base/settings/R/check.all.settings.R +++ b/base/settings/R/check.all.settings.R @@ -260,13 +260,11 @@ check.bety.version <- function(dbcon) { } # check if database is newer - last_migration_date <- lubridate::ymd_hms(utils::tail(versions, n = 1)) - pecan_release_date <- lubridate::ymd( - utils::packageDescription("PEcAn.DB")$Date) - if (last_migration_date > pecan_release_date) { + unknown_migrations <- setdiff(versions, .known_bety_migrations) + if (any(unknown_migrations)) { PEcAn.logger::logger.warn( - "Last database migration", utils::tail(versions, n = 1), - "is more recent than this", pecan_release_date, "release of PEcAn.", + "Found database migration(s) not known by this release of PEcAn.settings:", + unknown_migrations, "This could result in PEcAn not working as expected.") } } diff --git a/base/settings/R/known_bety_migrations.R b/base/settings/R/known_bety_migrations.R new file mode 100644 index 00000000000..21a670ae34c --- /dev/null +++ b/base/settings/R/known_bety_migrations.R @@ -0,0 +1,69 @@ +# List of the entries in bety table `schema_migrations` that are known to this +# version of PEcAn.settings. If a live query returns entries not in this table, +# we may wish to warn about a potential mismatch between package and database. +# +# TODO: Would it make sense to move this, and the checks it supports, to PEcAn.DB? +.known_bety_migrations <- c( + "1", + "20130104205059", + "20130104211901", + "20130104211946", + "20130109205535", + "20130222222929", + "20130425152503", + "20130624001504", + "20130629205658", + "20130707190720", + "20130717162614", + "20130813212131", + "20130829162053", + "20150904184512", + "20130830184559", + "20140418005637", + "20140422155957", + "20140423220457", + "20140506210037", + "20140515205254", + "20140521180349", + "20140604192901", + "20140617163304", + "20140610210928", + "20140621060009", + "20140623004229", + "20140624185610", + "20140708232320", + "20140729045640", + "20151007174432", + "20151011190026", + "20140904220035", + "20140904221818", + "20140909212759", + "20140915153555", + "20141009160121", + "20141208165401", + "20141211220550", + "20150202215147", + "20150202220519", + "20150213162341", + "20150313165132", + "20150521211114", + "20150624220952", + "20150624222656", + "20150625184958", + "20151014182146", + "20160303221049", + "20160412030352", + "20160523165531", + "20160617133217", + "20160711231257", + "20160720182233", + "20160930213737", + "20161003180105", + "20161005181021", + "20161129192658", + "20170118205944", + "20170415183619", + "20170712171513", + "20180510184222", + "20181129000515", + "20200329233137")