From 919bbd2aad26bd73b0dfbc9243ccb7d89fdb8fb1 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 9 Sep 2016 20:37:49 +0200 Subject: migration: new - move to module section --- migration/20160906_02-modules.cpp | 61 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 migration/20160906_02-modules.cpp (limited to 'migration') diff --git a/migration/20160906_02-modules.cpp b/migration/20160906_02-modules.cpp new file mode 100644 index 00000000..ea635f67 --- /dev/null +++ b/migration/20160906_02-modules.cpp @@ -0,0 +1,61 @@ +#include "migration.hpp" +#include "options/options.hpp" + +#include +#include + +using namespace options; +using namespace migrations; + +struct split_modules_rc11 : migration +{ + split_modules_rc11() = default; + + static const char* names[3]; + + QString unique_date() const override + { + return "20160909_02"; + } + + QString name() const override + { + return "split modules to their own section"; + } + + bool should_run() const override + { + bundle new_bundle = make_bundle("modules"); + bundle old_bundle = make_bundle("opentrack-ui"); + + for (const char* name : names) + if (new_bundle->contains(name)) + return false; + + for (const char* name : names) + if (old_bundle->contains(name)) + return true; + + return false; + } + + void run() override + { + bundle new_bundle = make_bundle("modules"); + bundle old_bundle = make_bundle("opentrack-ui"); + + for (const char* name : names) + new_bundle->store_kv(name, QVariant(old_bundle->get(name))); + + new_bundle->save(); + } +}; + +const char* split_modules_rc11::names[3] = +{ + "tracker-dll", + "protocol-dll", + "filter-dll", +}; + +OPENTRACK_MIGRATION(split_modules_rc11); -- cgit v1.2.3