aboutsummaryrefslogtreecommitdiff
path: root/migrate/migrate.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-09-27 11:09:51 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-10-04 18:49:09 +0300
commitb7ff8f89cea055e75881e716d8358ffa4d7779af (patch)
tree38c41d7b144d86c23b42519a9e4e683be62ccbb4 /migrate/migrate.cxx
parentac80e3c37f1fee068e46b6f5a2043581d413e992 (diff)
Add support for soft and hard rebuilds
Diffstat (limited to 'migrate/migrate.cxx')
-rw-r--r--migrate/migrate.cxx32
1 files changed, 32 insertions, 0 deletions
diff --git a/migrate/migrate.cxx b/migrate/migrate.cxx
index 1093b7c..468d411 100644
--- a/migrate/migrate.cxx
+++ b/migrate/migrate.cxx
@@ -14,6 +14,8 @@
#include <libbutl/pager.hxx>
+#include <libbrep/build.hxx>
+#include <libbrep/build-odb.hxx>
#include <libbrep/package.hxx>
#include <libbrep/package-odb.hxx>
#include <libbrep/database-lock.hxx>
@@ -224,6 +226,36 @@ package_migrate_v20 ([] (database& db)
});
#endif
+// Register the data migration functions for the build database schema.
+//
+template <schema_version v>
+using build_migration_entry_base =
+ data_migration_entry<v, LIBBREP_BUILD_SCHEMA_VERSION_BASE>;
+
+template <schema_version v>
+struct build_migration_entry: build_migration_entry_base<v>
+{
+ build_migration_entry (void (*f) (database& db))
+ : build_migration_entry_base<v> (f, "build") {}
+};
+
+static const build_migration_entry<15>
+build_migrate_v15 ([] (database& db)
+{
+ // Setting proper checksums here feels a bit hairy. Let's assign them
+ // naturally on the first rebuild.
+ //
+ db.execute ("UPDATE build SET "
+ "soft_timestamp = completion_timestamp, "
+ "hard_timestamp = completion_timestamp, "
+ "controller_checksum = '', "
+ "machine_checksum = ''");
+
+ db.execute ("UPDATE build_delay SET "
+ "report_soft_timestamp = report_timestamp, "
+ "report_hard_timestamp = report_timestamp");
+});
+
// main() function
//
int