From 7d963c96a6aaa43714637175b9e5e5b0f51c320b Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Tue, 3 May 2022 12:03:08 -0700 Subject: [PATCH] writing pseudocode algorithm for data migration. --- .../pkg/database/scrutiny_repository_migrations.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/webapp/backend/pkg/database/scrutiny_repository_migrations.go b/webapp/backend/pkg/database/scrutiny_repository_migrations.go index 0e299fa..c7cedd2 100644 --- a/webapp/backend/pkg/database/scrutiny_repository_migrations.go +++ b/webapp/backend/pkg/database/scrutiny_repository_migrations.go @@ -63,12 +63,22 @@ func (sr *scrutinyRepository) Migrate(ctx context.Context) error { } //TODO: migrate the data from GORM to influxdb. - + //get a list of all devices: + // get a list of all smart scans in the last 2 weeks: + // get a list of associated smart attribute data: + // translate to a collector.SmartInfo object + // call scrutinyRepository.SaveSmartAttributes + // get a list of all smart scans in the last 9 weeks: + // do same as above (select 1 scan per week) + // get a list of all smart scans in the last 25 months: + // do same as above (select 1 scan per month) + // get a list of all smart scans: + // do same as above (select 1 scan per year) return nil }, }, //{ - // ID: "20220503120000", // v0.4.0 - influxdb schema + // ID: "20220503120000", // cleanup - v0.4.0 - influxdb schema // Migrate: func(tx *gorm.DB) error { // // delete unnecessary tables. // err := tx.Migrator().DropTable(