diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-06-22 15:23:22 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-06-22 15:27:30 +0300 |
commit | 1ba695892061a3955901b00085b87493d2e2b39e (patch) | |
tree | 4b499bde0c9116e72a424800f4b356b862b0b054 | |
parent | 6e5e3972542baa1c715e13a36c1144f148c6320b (diff) |
Drop all database migrations to be backward compatible with 0.10.0 and above (two minor versions behind)
-rw-r--r-- | bpkg/database.cxx | 32 | ||||
-rw-r--r-- | bpkg/package.hxx | 2 |
2 files changed, 4 insertions, 30 deletions
diff --git a/bpkg/database.cxx b/bpkg/database.cxx index e4b36b0..4f82bed 100644 --- a/bpkg/database.cxx +++ b/bpkg/database.cxx @@ -46,6 +46,7 @@ namespace bpkg // Register the data migration functions. // +#if 0 template <odb::schema_version v> using migration_entry = odb::data_migration_entry<v, DB_SCHEMA_VERSION_BASE>; @@ -57,38 +58,11 @@ namespace bpkg // it is currently unlikely that the epoch was specified explicitly for any // package version. // - static const migration_entry<5> + static const migration_entry<6> migrate_epoch_entry ([] (odb::database& db) { - // Delay the foreign key constraint checks until we are done with all the - // tables. - // - assert (transaction::has_current ()); - db.execute ("PRAGMA defer_foreign_keys = ON"); - - auto update = [&db] (const string& table, - const string& version_prefix = "version") - { - string ec (version_prefix + "_epoch"); - - db.execute ("UPDATE " + table + " SET " + ec + " = 1 " + - "WHERE " + ec + " = 0 AND NOT (" + - version_prefix + "_canonical_upstream = '' AND " + - version_prefix + "_canonical_release = '~')"); - }; - - update ("available_package"); - update ("available_package_locations"); - update ("available_package_dependencies"); - update ("available_package_dependency_alternatives"); - update ("available_package_dependency_alternatives", "dep_min_version"); - update ("available_package_dependency_alternatives", "dep_max_version"); - update ("selected_package"); - update ("selected_package_prerequisites", "min_version"); - update ("selected_package_prerequisites", "max_version"); - - db.execute ("PRAGMA defer_foreign_keys = OFF"); }); +#endif database open (const dir_path& d, tracer& tr, bool create) diff --git a/bpkg/package.hxx b/bpkg/package.hxx index 16f368b..9d7cedf 100644 --- a/bpkg/package.hxx +++ b/bpkg/package.hxx @@ -26,7 +26,7 @@ // Used by the data migration entries. // -#define DB_SCHEMA_VERSION_BASE 4 +#define DB_SCHEMA_VERSION_BASE 5 #pragma db model version(DB_SCHEMA_VERSION_BASE, 5, closed) |