aboutsummaryrefslogtreecommitdiff
path: root/migrate
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-12-09 15:47:34 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-12-09 15:47:34 +0300
commitd259750511b3c2aaeace49f8ccb1d7f3ad561452 (patch)
tree9a98e1a2a66fc8a25dc1b58efd2e7e0e77201914 /migrate
parent4bc9390c48cee736917ead5d20aa216fe10bae47 (diff)
Prepare for supporting multiple ids in requirement alternative
Diffstat (limited to 'migrate')
-rw-r--r--migrate/migrate.cxx37
1 files changed, 34 insertions, 3 deletions
diff --git a/migrate/migrate.cxx b/migrate/migrate.cxx
index 627ee4f..7e009e0 100644
--- a/migrate/migrate.cxx
+++ b/migrate/migrate.cxx
@@ -222,9 +222,13 @@ 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.
+ // Note that for both dependency and requirement
+ // package_*_alternative_*s.alternative_index is copied from
+ // package_*_alternatives.index and package_*_alternative_*s.index is set to
+ // 0.
+ //
+
+ // Migrate dependencies.
//
db.execute (
"INSERT INTO \"package_dependency_alternative_dependencies\" "
@@ -290,6 +294,33 @@ package_migrate_v22 ([] (database& db)
"\"dep_package_version_canonical_release\", "
"\"dep_package_version_revision\" "
"FROM \"package_dependency_alternatives\"");
+
+ // Migrate requirements.
+ //
+ db.execute (
+ "INSERT INTO \"package_requirement_alternative_requirements\" "
+ "(\"tenant\", "
+ "\"name\", "
+ "\"version_epoch\", "
+ "\"version_canonical_upstream\", "
+ "\"version_canonical_release\", "
+ "\"version_revision\", "
+ "\"requirement_index\", "
+ "\"alternative_index\", "
+ "\"index\", "
+ "\"id\") "
+ "SELECT "
+ "\"tenant\", "
+ "\"name\", "
+ "\"version_epoch\", "
+ "\"version_canonical_upstream\", "
+ "\"version_canonical_release\", "
+ "\"version_revision\", "
+ "\"requirement_index\", "
+ "\"index\", "
+ "0, "
+ "\"id\" "
+ "FROM \"package_requirement_alternatives\"");
});
// Register the data migration functions for the build database schema.