From b7ff8f89cea055e75881e716d8358ffa4d7779af Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 27 Sep 2021 11:09:51 +0300 Subject: Add support for soft and hard rebuilds --- migrate/migrate.cxx | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'migrate') 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 +#include +#include #include #include #include @@ -224,6 +226,36 @@ package_migrate_v20 ([] (database& db) }); #endif +// Register the data migration functions for the build database schema. +// +template +using build_migration_entry_base = + data_migration_entry; + +template +struct build_migration_entry: build_migration_entry_base +{ + build_migration_entry (void (*f) (database& db)) + : build_migration_entry_base (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 -- cgit v1.1