-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor speedtests handling, ensure rewards only include tests up un…
…til epoch end
- Loading branch information
Showing
10 changed files
with
751 additions
and
696 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
CREATE TABLE speedtests_migration ( | ||
pubkey text NOT NULL, | ||
upload_speed bigint, | ||
download_speed bigint, | ||
latency integer, | ||
serial text, | ||
timestamp timestamptz NOT NULL, | ||
inserted_at timestamptz default now(), | ||
PRIMARY KEY(pubkey, timestamp) | ||
); | ||
CREATE INDEX idx_speedtests_pubkey on speedtests_migration (pubkey); | ||
|
||
INSERT INTO speedtests_migration (pubkey, upload_speed, download_speed, latency, serial, timestamp) | ||
SELECT id, (st).upload_speed, (st).download_speed, (st).latency, '', (st).timestamp | ||
FROM (select id, unnest(speedtests) as st from speedtests) as tmp | ||
ON CONFLICT DO NOTHING; | ||
|
||
ALTER TABLE speedtests RENAME TO speedtests_old; | ||
ALTER TABLE speedtests_migration RENAME TO speedtests; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.