diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2021-07-09 20:55:15 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2021-07-20 17:08:09 +0300 |
commit | 07ab59a93f9447d5489743e8d7e19b6adb5ebbf1 (patch) | |
tree | aa202b26e7ac2b3b6477855e250ab0464301fd2d /bdep/database.cxx | |
parent | 8da242097fcaec5f3676f8d2296b639879825ddd (diff) |
Add support for configuration type and bdep-config-link sub-command
Diffstat (limited to 'bdep/database.cxx')
-rw-r--r-- | bdep/database.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/bdep/database.cxx b/bdep/database.cxx index 5e0aea5..064f9ed 100644 --- a/bdep/database.cxx +++ b/bdep/database.cxx @@ -8,6 +8,8 @@ #include <bdep/diagnostics.hxx> +#include <bdep/project.hxx> +#include <bdep/project-odb.hxx> #include <bdep/database-views.hxx> #include <bdep/database-views-odb.hxx> @@ -18,6 +20,22 @@ namespace bdep using namespace odb::sqlite; using odb::schema_catalog; + // Register the data migration functions. + // + template <odb::schema_version v> + using migration_entry = odb::data_migration_entry<v, DB_SCHEMA_VERSION_BASE>; + + static const migration_entry<2> + migrate_v2 ([] (odb::database& db) + { + for (const shared_ptr<configuration>& c: + pointer_result (db.query<configuration> ())) + { + c->type = "target"; + db.update (c); + } + }); + database open (const dir_path& d, tracer& tr, bool create) { |