cpan-testers / cpantesters-backend

Backend data processing for CPAN Testers
Other
0 stars 4 forks source link

Migrate old test reports from the Metabase cache to new-style test reports #6

Closed preaction closed 7 years ago

preaction commented 7 years ago

All the old-style test reports we have in the Metabase cache should be migrated to new-style test reports. This will make them available to the new APIs and also make it easier to display the full test report since they are all in one place.

We should make a command module, CPAN::Testers::Backend::Migrate::MetabaseReports, that reads from the metabase.metabase cache table, builds the correct Metabase::Fact object from it (using Data::FlexSerializer to deserialize the fact column from compressed Sereal), and then uses the CPAN::Testers::Schema::ResultSet::TestReport->insert_metabase_fact method to insert it into the new test reports.

The settings for Data::FlexSerializer are available in the CPAN::Testers::Data::Generate script: https://github.com/cpan-testers/cpantesters-backend/blob/master/old/generate/lib/CPAN/Testers/Data/Generator.pm#L161-L165 Once the Data::FlexSerializer object is created, calling deserialize will get the full, correct Metabase::Fact object (in actuality, a CPAN::Testers::Report object).

This routine, and all other migrate routines, should be idempotent: It should not re-migrate data that has already been migrated. If there is an error in migration, the user can delete the bad data manually before re-running the migration.