storj/storagenode/storagenodedb/testdata/v38.go
Jeff Wendling 4ad01e8170 storagenode/storagenodedb: backfill reputation.joined_at
it was being used in ways that implied it should be NOT NULL
even though it was possibly null. we used to get this data
from the satellite db's added_at column as seen in 30369b02,
so backfill it using that data where joined_at is NULL, and
then alter the table to constrain the column to be NOT NULL.

Fixes #3866.

Change-Id: If2d856189209740d985f71dada7b93525e625ef3
2020-05-01 17:59:53 +00:00

49 lines
2.2 KiB
Go

// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
package testdata
import "storj.io/storj/storagenode/storagenodedb"
var v38 = MultiDBState{
Version: 38,
DBStates: DBStates{
storagenodedb.UsedSerialsDBName: v28.DBStates[storagenodedb.UsedSerialsDBName],
storagenodedb.StorageUsageDBName: v28.DBStates[storagenodedb.StorageUsageDBName],
storagenodedb.ReputationDBName: &DBState{
SQL: `
-- tables to store nodestats cache
CREATE TABLE reputation (
satellite_id BLOB NOT NULL,
uptime_success_count INTEGER NOT NULL,
uptime_total_count INTEGER NOT NULL,
uptime_reputation_alpha REAL NOT NULL,
uptime_reputation_beta REAL NOT NULL,
uptime_reputation_score REAL NOT NULL,
audit_success_count INTEGER NOT NULL,
audit_total_count INTEGER NOT NULL,
audit_reputation_alpha REAL NOT NULL,
audit_reputation_beta REAL NOT NULL,
audit_reputation_score REAL NOT NULL,
disqualified TIMESTAMP,
suspended TIMESTAMP,
updated_at TIMESTAMP NOT NULL,
joined_at TIMESTAMP NOT NULL,
PRIMARY KEY (satellite_id)
);
INSERT INTO reputation VALUES(X'0ed28abb2813e184a1e98b0f6605c4911ea468c7e8433eb583e0fca7ceac3000',1,1,1.0,1.0,1.0,1,1,1.0,1.0,1.0,'2019-07-19 20:00:00+00:00',NULL,'2019-08-23 20:00:00+00:00','2019-09-10 20:00:00+00:00');
`,
},
storagenodedb.PieceSpaceUsedDBName: v31.DBStates[storagenodedb.PieceSpaceUsedDBName],
storagenodedb.PieceInfoDBName: v28.DBStates[storagenodedb.PieceInfoDBName],
storagenodedb.PieceExpirationDBName: v28.DBStates[storagenodedb.PieceExpirationDBName],
storagenodedb.OrdersDBName: v28.DBStates[storagenodedb.OrdersDBName],
storagenodedb.BandwidthDBName: v28.DBStates[storagenodedb.BandwidthDBName],
storagenodedb.SatellitesDBName: v28.DBStates[storagenodedb.SatellitesDBName],
storagenodedb.DeprecatedInfoDBName: v28.DBStates[storagenodedb.DeprecatedInfoDBName],
storagenodedb.NotificationsDBName: v28.DBStates[storagenodedb.NotificationsDBName],
storagenodedb.HeldAmountDBName: v37.DBStates[storagenodedb.HeldAmountDBName],
storagenodedb.PricingDBName: v35.DBStates[storagenodedb.PricingDBName],
},
}