enable final migration cleanup.
This commit is contained in:
@@ -95,7 +95,8 @@ func (sr *scrutinyRepository) Migrate(ctx context.Context) error {
|
|||||||
monthlyBucketMax := today.Add(-RETENTION_PERIOD_25_MONTHS_IN_SECONDS * time.Second) //25 weeks
|
monthlyBucketMax := today.Add(-RETENTION_PERIOD_25_MONTHS_IN_SECONDS * time.Second) //25 weeks
|
||||||
|
|
||||||
for _, preDevice := range preDevices {
|
for _, preDevice := range preDevices {
|
||||||
sr.logger.Infof("\n====================================\n\nBegin processing device %s\n\n====================================\n", preDevice.WWN)
|
sr.logger.Debugf("====================================")
|
||||||
|
sr.logger.Infof("begin processing device: %s", preDevice.WWN)
|
||||||
|
|
||||||
//weekly, monthly, yearly lookup storage, so we don't add more data to the buckets than necessary.
|
//weekly, monthly, yearly lookup storage, so we don't add more data to the buckets than necessary.
|
||||||
weeklyLookup := map[string]bool{}
|
weeklyLookup := map[string]bool{}
|
||||||
@@ -105,8 +106,6 @@ func (sr *scrutinyRepository) Migrate(ctx context.Context) error {
|
|||||||
|
|
||||||
//we're looping in ASC mode, so from oldest entry to most current.
|
//we're looping in ASC mode, so from oldest entry to most current.
|
||||||
|
|
||||||
//TODO: skip any results that are outside of the range that we care about for each bucket.
|
|
||||||
|
|
||||||
err, postSmartResults := m20201107210306_FromPreInfluxDBSmartResultsCreatePostInfluxDBSmartResults(tx, preDevice, preSmartResult)
|
err, postSmartResults := m20201107210306_FromPreInfluxDBSmartResultsCreatePostInfluxDBSmartResults(tx, preDevice, preSmartResult)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -236,31 +235,31 @@ func (sr *scrutinyRepository) Migrate(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Printf("finished processing device %s. weekly: %d, monthly: %d, yearly: %d", preDevice.WWN, len(weeklyLookup), len(monthlyLookup), len(yearlyLookup))
|
sr.logger.Infof("finished processing device %s. weekly: %d, monthly: %d, yearly: %d", preDevice.WWN, len(weeklyLookup), len(monthlyLookup), len(yearlyLookup))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
//{
|
{
|
||||||
// ID: "20220503120000", // cleanup - v0.4.0 - influxdb schema
|
ID: "20220503120000", // cleanup - v0.4.0 - influxdb schema
|
||||||
// Migrate: func(tx *gorm.DB) error {
|
Migrate: func(tx *gorm.DB) error {
|
||||||
// // delete unnecessary tables.
|
// delete unnecessary tables.
|
||||||
// err := tx.Migrator().DropTable(
|
err := tx.Migrator().DropTable(
|
||||||
// &m20201107210306.Smart{},
|
&m20201107210306.Smart{},
|
||||||
// &m20201107210306.SmartAtaAttribute{},
|
&m20201107210306.SmartAtaAttribute{},
|
||||||
// &m20201107210306.SmartNvmeAttribute{},
|
&m20201107210306.SmartNvmeAttribute{},
|
||||||
// &m20201107210306.SmartNvmeAttribute{},
|
&m20201107210306.SmartScsiAttribute{},
|
||||||
// )
|
)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// return err
|
return err
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// //migrate the device database to the final version
|
//migrate the device database to the final version
|
||||||
// return tx.AutoMigrate(models.Device{})
|
return tx.AutoMigrate(models.Device{})
|
||||||
// },
|
},
|
||||||
//},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
if err := m.Migrate(); err != nil {
|
if err := m.Migrate(); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user