aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2022-08-24 22:49:30 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2022-08-24 22:49:30 +0300
commit340cf0935a199240f6daaab8a347e22172f4d15b (patch)
treed532ba24756792423843e569025cce15b620c376
parent754caf4077e4bfcf7ebb2de9cc531e78350fe7e3 (diff)
Drop all database migrations to be backward compatible with only 0.15.0 (one minor version behind)
-rw-r--r--libbrep/build.hxx2
-rw-r--r--libbrep/build.xml8
-rw-r--r--libbrep/package.hxx2
-rw-r--r--libbrep/package.xml284
-rw-r--r--migrate/migrate.cxx109
5 files changed, 102 insertions, 303 deletions
diff --git a/libbrep/build.hxx b/libbrep/build.hxx
index 8662cec..120ed5c 100644
--- a/libbrep/build.hxx
+++ b/libbrep/build.hxx
@@ -28,7 +28,7 @@
// Used by the data migration entries.
//
-#define LIBBREP_BUILD_SCHEMA_VERSION_BASE 15
+#define LIBBREP_BUILD_SCHEMA_VERSION_BASE 18
#pragma db model version(LIBBREP_BUILD_SCHEMA_VERSION_BASE, 18, closed)
diff --git a/libbrep/build.xml b/libbrep/build.xml
index 7828df1..821444c 100644
--- a/libbrep/build.xml
+++ b/libbrep/build.xml
@@ -1,11 +1,5 @@
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" schema-name="build" version="1">
- <changeset version="18"/>
-
- <changeset version="17"/>
-
- <changeset version="16"/>
-
- <model version="15">
+ <model version="18">
<table name="build" kind="object">
<column name="package_tenant" type="TEXT" null="false"/>
<column name="package_name" type="CITEXT" null="false"/>
diff --git a/libbrep/package.hxx b/libbrep/package.hxx
index 8b0613e..c586d74 100644
--- a/libbrep/package.hxx
+++ b/libbrep/package.hxx
@@ -18,7 +18,7 @@
// Used by the data migration entries.
//
-#define LIBBREP_PACKAGE_SCHEMA_VERSION_BASE 21
+#define LIBBREP_PACKAGE_SCHEMA_VERSION_BASE 25
#pragma db model version(LIBBREP_PACKAGE_SCHEMA_VERSION_BASE, 25, closed)
diff --git a/libbrep/package.xml b/libbrep/package.xml
index e556f63..2e7a613 100644
--- a/libbrep/package.xml
+++ b/libbrep/package.xml
@@ -1,191 +1,5 @@
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" schema-name="package" version="1">
- <changeset version="25">
- <alter-table name="package_tests">
- <add-column name="test_reflect" type="TEXT" null="true"/>
- </alter-table>
- </changeset>
-
- <changeset version="24">
- <alter-table name="package_dependencies">
- <drop-column name="conditional"/>
- </alter-table>
- <alter-table name="package_dependency_alternatives">
- <add-column name="reflect" type="TEXT" null="true"/>
- <add-column name="prefer" type="TEXT" null="true"/>
- <add-column name="accept" type="TEXT" null="true"/>
- <add-column name="require" type="TEXT" null="true"/>
- </alter-table>
- </changeset>
-
- <changeset version="23">
- <alter-table name="package_requirements">
- <drop-column name="conditional"/>
- </alter-table>
- <alter-table name="package_requirement_alternatives">
- <add-column name="reflect" type="TEXT" null="true"/>
- </alter-table>
- </changeset>
-
- <changeset version="22">
- <alter-table name="package_dependency_alternatives">
- <add-column name="enable" type="TEXT" null="true"/>
- <drop-foreign-key name="dep_package_tenant_fk"/>
- <drop-foreign-key name="dep_package_fk"/>
- <drop-column name="dep_name"/>
- <drop-column name="dep_min_version_epoch"/>
- <drop-column name="dep_min_version_canonical_upstream"/>
- <drop-column name="dep_min_version_canonical_release"/>
- <drop-column name="dep_min_version_revision"/>
- <drop-column name="dep_min_version_upstream"/>
- <drop-column name="dep_min_version_release"/>
- <drop-column name="dep_max_version_epoch"/>
- <drop-column name="dep_max_version_canonical_upstream"/>
- <drop-column name="dep_max_version_canonical_release"/>
- <drop-column name="dep_max_version_revision"/>
- <drop-column name="dep_max_version_upstream"/>
- <drop-column name="dep_max_version_release"/>
- <drop-column name="dep_min_open"/>
- <drop-column name="dep_max_open"/>
- <drop-column name="dep_package_tenant"/>
- <drop-column name="dep_package_name"/>
- <drop-column name="dep_package_version_epoch"/>
- <drop-column name="dep_package_version_canonical_upstream"/>
- <drop-column name="dep_package_version_canonical_release"/>
- <drop-column name="dep_package_version_revision"/>
- </alter-table>
- <add-table name="package_dependency_alternative_dependencies" kind="container">
- <column name="tenant" type="TEXT" null="false"/>
- <column name="name" type="CITEXT" null="false"/>
- <column name="version_epoch" type="INTEGER" null="false"/>
- <column name="version_canonical_upstream" type="TEXT" null="false"/>
- <column name="version_canonical_release" type="TEXT" null="false" options="COLLATE &quot;C&quot;"/>
- <column name="version_revision" type="INTEGER" null="false"/>
- <column name="dependency_index" type="BIGINT" null="false"/>
- <column name="alternative_index" type="BIGINT" null="false"/>
- <column name="index" type="BIGINT" null="false"/>
- <column name="dep_name" type="CITEXT" null="false"/>
- <column name="dep_min_version_epoch" type="INTEGER" null="true"/>
- <column name="dep_min_version_canonical_upstream" type="TEXT" null="true"/>
- <column name="dep_min_version_canonical_release" type="TEXT" null="true"/>
- <column name="dep_min_version_revision" type="INTEGER" null="true"/>
- <column name="dep_min_version_upstream" type="TEXT" null="true"/>
- <column name="dep_min_version_release" type="TEXT" null="true"/>
- <column name="dep_max_version_epoch" type="INTEGER" null="true"/>
- <column name="dep_max_version_canonical_upstream" type="TEXT" null="true"/>
- <column name="dep_max_version_canonical_release" type="TEXT" null="true"/>
- <column name="dep_max_version_revision" type="INTEGER" null="true"/>
- <column name="dep_max_version_upstream" type="TEXT" null="true"/>
- <column name="dep_max_version_release" type="TEXT" null="true"/>
- <column name="dep_min_open" type="BOOLEAN" null="true"/>
- <column name="dep_max_open" type="BOOLEAN" null="true"/>
- <column name="dep_package_tenant" type="TEXT" null="true"/>
- <column name="dep_package_name" type="CITEXT" null="true"/>
- <column name="dep_package_version_epoch" type="INTEGER" null="true"/>
- <column name="dep_package_version_canonical_upstream" type="TEXT" null="true"/>
- <column name="dep_package_version_canonical_release" type="TEXT" null="true" options="COLLATE &quot;C&quot;"/>
- <column name="dep_package_version_revision" type="INTEGER" null="true"/>
- <foreign-key name="tenant_fk" deferrable="DEFERRED">
- <column name="tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </foreign-key>
- <foreign-key name="object_id_fk" on-delete="CASCADE">
- <column name="tenant"/>
- <column name="name"/>
- <column name="version_epoch"/>
- <column name="version_canonical_upstream"/>
- <column name="version_canonical_release"/>
- <column name="version_revision"/>
- <references table="package">
- <column name="tenant"/>
- <column name="name"/>
- <column name="version_epoch"/>
- <column name="version_canonical_upstream"/>
- <column name="version_canonical_release"/>
- <column name="version_revision"/>
- </references>
- </foreign-key>
- <index name="package_dependency_alternative_dependencies_object_id_i">
- <column name="tenant"/>
- <column name="name"/>
- <column name="version_epoch"/>
- <column name="version_canonical_upstream"/>
- <column name="version_canonical_release"/>
- <column name="version_revision"/>
- </index>
- <foreign-key name="dep_package_tenant_fk" deferrable="DEFERRED">
- <column name="dep_package_tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </foreign-key>
- <foreign-key name="dep_package_fk" deferrable="DEFERRED">
- <column name="dep_package_tenant"/>
- <column name="dep_package_name"/>
- <column name="dep_package_version_epoch"/>
- <column name="dep_package_version_canonical_upstream"/>
- <column name="dep_package_version_canonical_release"/>
- <column name="dep_package_version_revision"/>
- <references table="package">
- <column name="tenant"/>
- <column name="name"/>
- <column name="version_epoch"/>
- <column name="version_canonical_upstream"/>
- <column name="version_canonical_release"/>
- <column name="version_revision"/>
- </references>
- </foreign-key>
- </add-table>
- <alter-table name="package_requirement_alternatives">
- <add-column name="enable" type="TEXT" null="true"/>
- <drop-column name="id"/>
- </alter-table>
- <add-table name="package_requirement_alternative_requirements" kind="container">
- <column name="tenant" type="TEXT" null="false"/>
- <column name="name" type="CITEXT" null="false"/>
- <column name="version_epoch" type="INTEGER" null="false"/>
- <column name="version_canonical_upstream" type="TEXT" null="false"/>
- <column name="version_canonical_release" type="TEXT" null="false" options="COLLATE &quot;C&quot;"/>
- <column name="version_revision" type="INTEGER" null="false"/>
- <column name="requirement_index" type="BIGINT" null="false"/>
- <column name="alternative_index" type="BIGINT" null="false"/>
- <column name="index" type="BIGINT" null="false"/>
- <column name="id" type="TEXT" null="false"/>
- <foreign-key name="tenant_fk" deferrable="DEFERRED">
- <column name="tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </foreign-key>
- <foreign-key name="object_id_fk" on-delete="CASCADE">
- <column name="tenant"/>
- <column name="name"/>
- <column name="version_epoch"/>
- <column name="version_canonical_upstream"/>
- <column name="version_canonical_release"/>
- <column name="version_revision"/>
- <references table="package">
- <column name="tenant"/>
- <column name="name"/>
- <column name="version_epoch"/>
- <column name="version_canonical_upstream"/>
- <column name="version_canonical_release"/>
- <column name="version_revision"/>
- </references>
- </foreign-key>
- <index name="package_requirement_alternative_requirements_object_id_i">
- <column name="tenant"/>
- <column name="name"/>
- <column name="version_epoch"/>
- <column name="version_canonical_upstream"/>
- <column name="version_canonical_release"/>
- <column name="version_revision"/>
- </index>
- </add-table>
- </changeset>
-
- <model version="21">
+ <model version="25">
<table name="tenant" kind="object">
<column name="id" type="TEXT" null="false"/>
<column name="private" type="BOOLEAN" null="false"/>
@@ -567,7 +381,6 @@
<column name="version_canonical_release" type="TEXT" null="false" options="COLLATE &quot;C&quot;"/>
<column name="version_revision" type="INTEGER" null="false"/>
<column name="index" type="BIGINT" null="false"/>
- <column name="conditional" type="BOOLEAN" null="false"/>
<column name="buildtime" type="BOOLEAN" null="false"/>
<column name="comment" type="TEXT" null="false"/>
<foreign-key name="tenant_fk" deferrable="DEFERRED">
@@ -613,6 +426,52 @@
<column name="version_revision" type="INTEGER" null="false"/>
<column name="dependency_index" type="BIGINT" null="false"/>
<column name="index" type="BIGINT" null="false"/>
+ <column name="enable" type="TEXT" null="true"/>
+ <column name="reflect" type="TEXT" null="true"/>
+ <column name="prefer" type="TEXT" null="true"/>
+ <column name="accept" type="TEXT" null="true"/>
+ <column name="require" type="TEXT" null="true"/>
+ <foreign-key name="tenant_fk" deferrable="DEFERRED">
+ <column name="tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <foreign-key name="object_id_fk" on-delete="CASCADE">
+ <column name="tenant"/>
+ <column name="name"/>
+ <column name="version_epoch"/>
+ <column name="version_canonical_upstream"/>
+ <column name="version_canonical_release"/>
+ <column name="version_revision"/>
+ <references table="package">
+ <column name="tenant"/>
+ <column name="name"/>
+ <column name="version_epoch"/>
+ <column name="version_canonical_upstream"/>
+ <column name="version_canonical_release"/>
+ <column name="version_revision"/>
+ </references>
+ </foreign-key>
+ <index name="package_dependency_alternatives_object_id_i">
+ <column name="tenant"/>
+ <column name="name"/>
+ <column name="version_epoch"/>
+ <column name="version_canonical_upstream"/>
+ <column name="version_canonical_release"/>
+ <column name="version_revision"/>
+ </index>
+ </table>
+ <table name="package_dependency_alternative_dependencies" kind="container">
+ <column name="tenant" type="TEXT" null="false"/>
+ <column name="name" type="CITEXT" null="false"/>
+ <column name="version_epoch" type="INTEGER" null="false"/>
+ <column name="version_canonical_upstream" type="TEXT" null="false"/>
+ <column name="version_canonical_release" type="TEXT" null="false" options="COLLATE &quot;C&quot;"/>
+ <column name="version_revision" type="INTEGER" null="false"/>
+ <column name="dependency_index" type="BIGINT" null="false"/>
+ <column name="alternative_index" type="BIGINT" null="false"/>
+ <column name="index" type="BIGINT" null="false"/>
<column name="dep_name" type="CITEXT" null="false"/>
<column name="dep_min_version_epoch" type="INTEGER" null="true"/>
<column name="dep_min_version_canonical_upstream" type="TEXT" null="true"/>
@@ -656,7 +515,7 @@
<column name="version_revision"/>
</references>
</foreign-key>
- <index name="package_dependency_alternatives_object_id_i">
+ <index name="package_dependency_alternative_dependencies_object_id_i">
<column name="tenant"/>
<column name="name"/>
<column name="version_epoch"/>
@@ -695,7 +554,6 @@
<column name="version_canonical_release" type="TEXT" null="false" options="COLLATE &quot;C&quot;"/>
<column name="version_revision" type="INTEGER" null="false"/>
<column name="index" type="BIGINT" null="false"/>
- <column name="conditional" type="BOOLEAN" null="false"/>
<column name="buildtime" type="BOOLEAN" null="false"/>
<column name="comment" type="TEXT" null="false"/>
<foreign-key name="tenant_fk" deferrable="DEFERRED">
@@ -741,7 +599,8 @@
<column name="version_revision" type="INTEGER" null="false"/>
<column name="requirement_index" type="BIGINT" null="false"/>
<column name="index" type="BIGINT" null="false"/>
- <column name="id" type="TEXT" null="false"/>
+ <column name="enable" type="TEXT" null="true"/>
+ <column name="reflect" type="TEXT" null="true"/>
<foreign-key name="tenant_fk" deferrable="DEFERRED">
<column name="tenant"/>
<references table="tenant">
@@ -773,6 +632,48 @@
<column name="version_revision"/>
</index>
</table>
+ <table name="package_requirement_alternative_requirements" kind="container">
+ <column name="tenant" type="TEXT" null="false"/>
+ <column name="name" type="CITEXT" null="false"/>
+ <column name="version_epoch" type="INTEGER" null="false"/>
+ <column name="version_canonical_upstream" type="TEXT" null="false"/>
+ <column name="version_canonical_release" type="TEXT" null="false" options="COLLATE &quot;C&quot;"/>
+ <column name="version_revision" type="INTEGER" null="false"/>
+ <column name="requirement_index" type="BIGINT" null="false"/>
+ <column name="alternative_index" type="BIGINT" null="false"/>
+ <column name="index" type="BIGINT" null="false"/>
+ <column name="id" type="TEXT" null="false"/>
+ <foreign-key name="tenant_fk" deferrable="DEFERRED">
+ <column name="tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <foreign-key name="object_id_fk" on-delete="CASCADE">
+ <column name="tenant"/>
+ <column name="name"/>
+ <column name="version_epoch"/>
+ <column name="version_canonical_upstream"/>
+ <column name="version_canonical_release"/>
+ <column name="version_revision"/>
+ <references table="package">
+ <column name="tenant"/>
+ <column name="name"/>
+ <column name="version_epoch"/>
+ <column name="version_canonical_upstream"/>
+ <column name="version_canonical_release"/>
+ <column name="version_revision"/>
+ </references>
+ </foreign-key>
+ <index name="package_requirement_alternative_requirements_object_id_i">
+ <column name="tenant"/>
+ <column name="name"/>
+ <column name="version_epoch"/>
+ <column name="version_canonical_upstream"/>
+ <column name="version_canonical_release"/>
+ <column name="version_revision"/>
+ </index>
+ </table>
<table name="package_tests" kind="container">
<column name="tenant" type="TEXT" null="false"/>
<column name="name" type="CITEXT" null="false"/>
@@ -804,6 +705,7 @@
<column name="test_package_version_revision" type="INTEGER" null="true"/>
<column name="test_type" type="TEXT" null="false"/>
<column name="test_buildtime" type="BOOLEAN" null="false"/>
+ <column name="test_reflect" type="TEXT" null="true"/>
<foreign-key name="tenant_fk" deferrable="DEFERRED">
<column name="tenant"/>
<references table="tenant">
diff --git a/migrate/migrate.cxx b/migrate/migrate.cxx
index 7e009e0..172c374 100644
--- a/migrate/migrate.cxx
+++ b/migrate/migrate.cxx
@@ -208,6 +208,7 @@ 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>;
@@ -219,109 +220,11 @@ struct package_migration_entry: package_migration_entry_base<v>
: package_migration_entry_base<v> (f, "package") {}
};
-static const package_migration_entry<22>
-package_migrate_v22 ([] (database& db)
+static const package_migration_entry<26>
+package_migrate_v26 ([] (database& db)
{
- // 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\" "
- "(\"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\"");
-
- // 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\"");
});
+#endif
// Register the data migration functions for the build database schema.
//
@@ -337,8 +240,8 @@ struct build_migration_entry: build_migration_entry_base<v>
: build_migration_entry_base<v> (f, "build") {}
};
-static const build_migration_entry<16>
-build_migrate_v16 ([] (database& db)
+static const build_migration_entry<19>
+build_migrate_v19 ([] (database& db)
{
});
#endif