aboutsummaryrefslogtreecommitdiff
path: root/migrate/migrate.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-12-03 20:30:46 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-12-08 16:03:46 +0300
commit4bc9390c48cee736917ead5d20aa216fe10bae47 (patch)
treebe1736676d0ed13863d7574a1afd089bf708312f /migrate/migrate.cxx
parent76c2215ff5aa74f53a028112787ec10593d45715 (diff)
Prepare for supporting multiple dependencies in dependency alternative
Diffstat (limited to 'migrate/migrate.cxx')
-rw-r--r--migrate/migrate.cxx70
1 files changed, 68 insertions, 2 deletions
diff --git a/migrate/migrate.cxx b/migrate/migrate.cxx
index 6c66bf0..627ee4f 100644
--- a/migrate/migrate.cxx
+++ b/migrate/migrate.cxx
@@ -208,7 +208,6 @@ create (database& db, bool extra_only) const
// Register the data migration functions for the package database schema.
//
-#if 0
template <schema_version v>
using package_migration_entry_base =
data_migration_entry<v, LIBBREP_PACKAGE_SCHEMA_VERSION_BASE>;
@@ -223,8 +222,75 @@ struct package_migration_entry: package_migration_entry_base<v>
static const package_migration_entry<22>
package_migrate_v22 ([] (database& db)
{
+ // Note that package_dependency_alternative_dependencies.alternative_index
+ // is copied from package_dependency_alternatives.index and
+ // package_dependency_alternative_dependencies.index is set to 0.
+ //
+ db.execute (
+ "INSERT INTO \"package_dependency_alternative_dependencies\" "
+ "(\"tenant\", "
+ "\"name\", "
+ "\"version_epoch\", "
+ "\"version_canonical_upstream\", "
+ "\"version_canonical_release\", "
+ "\"version_revision\", "
+ "\"dependency_index\", "
+ "\"alternative_index\", "
+ "\"index\", "
+ "\"dep_name\", "
+ "\"dep_min_version_epoch\", "
+ "\"dep_min_version_canonical_upstream\", "
+ "\"dep_min_version_canonical_release\", "
+ "\"dep_min_version_revision\", "
+ "\"dep_min_version_upstream\", "
+ "\"dep_min_version_release\", "
+ "\"dep_max_version_epoch\", "
+ "\"dep_max_version_canonical_upstream\", "
+ "\"dep_max_version_canonical_release\", "
+ "\"dep_max_version_revision\", "
+ "\"dep_max_version_upstream\", "
+ "\"dep_max_version_release\", "
+ "\"dep_min_open\", "
+ "\"dep_max_open\", "
+ "\"dep_package_tenant\", "
+ "\"dep_package_name\", "
+ "\"dep_package_version_epoch\", "
+ "\"dep_package_version_canonical_upstream\", "
+ "\"dep_package_version_canonical_release\", "
+ "\"dep_package_version_revision\") "
+ "SELECT "
+ "\"tenant\", "
+ "\"name\", "
+ "\"version_epoch\", "
+ "\"version_canonical_upstream\", "
+ "\"version_canonical_release\", "
+ "\"version_revision\", "
+ "\"dependency_index\", "
+ "\"index\", "
+ "0, "
+ "\"dep_name\", "
+ "\"dep_min_version_epoch\", "
+ "\"dep_min_version_canonical_upstream\", "
+ "\"dep_min_version_canonical_release\", "
+ "\"dep_min_version_revision\", "
+ "\"dep_min_version_upstream\", "
+ "\"dep_min_version_release\", "
+ "\"dep_max_version_epoch\", "
+ "\"dep_max_version_canonical_upstream\", "
+ "\"dep_max_version_canonical_release\", "
+ "\"dep_max_version_revision\", "
+ "\"dep_max_version_upstream\", "
+ "\"dep_max_version_release\", "
+ "\"dep_min_open\", "
+ "\"dep_max_open\", "
+ "\"dep_package_tenant\", "
+ "\"dep_package_name\", "
+ "\"dep_package_version_epoch\", "
+ "\"dep_package_version_canonical_upstream\", "
+ "\"dep_package_version_canonical_release\", "
+ "\"dep_package_version_revision\" "
+ "FROM \"package_dependency_alternatives\"");
});
-#endif
// Register the data migration functions for the build database schema.
//